@ycodium-ai/plugin-conversation 0.2.2698 → 0.2.2702

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 CHANGED
@@ -1,4 +1,4 @@
1
- var G1=Object.create;var Au=Object.defineProperty;var j1=Object.getOwnPropertyDescriptor;var Q1=Object.getOwnPropertyNames;var X1=Object.getPrototypeOf,Y1=Object.prototype.hasOwnProperty;var J1=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Ru=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},In=(e,t)=>{for(var n in t)Au(e,n,{get:t[n],enumerable:!0})},cb=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Q1(t))!Y1.call(e,r)&&r!==n&&Au(e,r,{get:()=>t[r],enumerable:!(o=j1(t,r))||o.enumerable});return e};var fd=(e,t,n)=>(n=e!=null?G1(X1(e)):{},cb(t||!e||!e.__esModule?Au(n,"default",{value:e,enumerable:!0}):n,e)),ub=e=>cb(Au({},"__esModule",{value:!0}),e);var Mu={};In(Mu,{Activity:()=>eO,Children:()=>Dg,Component:()=>Zr,Fragment:()=>Ba,Profiler:()=>tO,PureComponent:()=>nO,StrictMode:()=>oO,Suspense:()=>Og,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>rO,__COMPILER_RUNTIME:()=>aO,act:()=>sO,cache:()=>iO,cacheSignal:()=>lO,captureOwnerStack:()=>dO,cloneElement:()=>Eu,createContext:()=>yt,createElement:()=>Ne,createRef:()=>cO,default:()=>mn,forwardRef:()=>Mn,isValidElement:()=>Fg,lazy:()=>uO,memo:()=>Ce,startTransition:()=>fO,unstable_useCacheRefresh:()=>pO,use:()=>Ct,useActionState:()=>mO,useCallback:()=>E,useContext:()=>Dt,useDebugValue:()=>gO,useDeferredValue:()=>hO,useEffect:()=>q,useEffectEvent:()=>Bg,useId:()=>Rr,useImperativeHandle:()=>Oo,useInsertionEffect:()=>pd,useLayoutEffect:()=>be,useMemo:()=>V,useOptimistic:()=>vO,useReducer:()=>ea,useRef:()=>N,useState:()=>G,useSyncExternalStore:()=>bo,useTransition:()=>yO,version:()=>CO});var pb,mn,eO,Dg,Zr,Ba,tO,nO,oO,Og,rO,aO,sO,iO,lO,dO,Eu,yt,Ne,cO,Mn,Fg,uO,Ce,fO,pO,Ct,mO,E,Dt,gO,hO,q,Bg,Rr,Oo,pd,be,V,vO,ea,N,G,bo,yO,CO,ie=J1(()=>{pb=window.__ycodiumPluginHost.react,mn=pb,{Activity:eO,Children:Dg,Component:Zr,Fragment:Ba,Profiler:tO,PureComponent:nO,StrictMode:oO,Suspense:Og,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:rO,__COMPILER_RUNTIME:aO,act:sO,cache:iO,cacheSignal:lO,captureOwnerStack:dO,cloneElement:Eu,createContext:yt,createElement:Ne,createRef:cO,forwardRef:Mn,isValidElement:Fg,lazy:uO,memo:Ce,startTransition:fO,unstable_useCacheRefresh:pO,use:Ct,useActionState:mO,useCallback:E,useContext:Dt,useDebugValue:gO,useDeferredValue:hO,useEffect:q,useEffectEvent:Bg,useId:Rr,useImperativeHandle:Oo,useInsertionEffect:pd,useLayoutEffect:be,useMemo:V,useOptimistic:vO,useReducer:ea,useRef:N,useState:G,useSyncExternalStore:bo,useTransition:yO,version:CO}=pb});var Sw=Ru(ao=>{"use strict";var JU=(ie(),ub(Mu));function bw(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 ns(){}var ro={d:{f:ns,r:function(){throw Error(bw(522))},D:ns,C:ns,L:ns,m:ns,X:ns,S:ns,M:ns},p:0,findDOMNode:null},ZU=Symbol.for("react.portal");function ez(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ZU,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var nc=JU.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Bf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}ao.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ro;ao.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(bw(299));return ez(e,t,null,n)};ao.flushSync=function(e){var t=nc.T,n=ro.p;try{if(nc.T=null,ro.p=2,e)return e()}finally{nc.T=t,ro.p=n,ro.d.f()}};ao.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,ro.d.C(e,t))};ao.prefetchDNS=function(e){typeof e=="string"&&ro.d.D(e)};ao.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=Bf(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?ro.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&ro.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};ao.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Bf(t.as,t.crossOrigin);ro.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&&ro.d.M(e)};ao.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=Bf(n,t.crossOrigin);ro.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})}};ao.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Bf(t.as,t.crossOrigin);ro.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 ro.d.m(e)};ao.requestFormReset=function(e){ro.d.r(e)};ao.unstable_batchedUpdates=function(e,t){return e(t)};ao.useFormState=function(e,t,n){return nc.H.useFormState(e,t,n)};ao.useFormStatus=function(){return nc.H.useHostTransitionStatus()};ao.version="19.2.6"});var oc=Ru((boe,ww)=>{"use strict";function Iw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Iw)}catch(e){console.error(e)}}Iw(),ww.exports=Sw()});var tN=Ru(eN=>{"use strict";var ed=(ie(),ub(Mu));function QV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var XV=typeof Object.is=="function"?Object.is:QV,YV=ed.useState,JV=ed.useEffect,ZV=ed.useLayoutEffect,eW=ed.useDebugValue;function tW(e,t){var n=t(),o=YV({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return ZV(function(){r.value=n,r.getSnapshot=t,tx(r)&&a({inst:r})},[e,n,t]),JV(function(){return tx(r)&&a({inst:r}),e(function(){tx(r)&&a({inst:r})})},[e]),eW(n),n}function tx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!XV(e,n)}catch{return!0}}function nW(e,t){return t()}var oW=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?nW:tW;eN.useSyncExternalStore=ed.useSyncExternalStore!==void 0?ed.useSyncExternalStore:oW});var oN=Ru((nhe,nN)=>{"use strict";nN.exports=tN()});var fb=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
1
+ var H1=Object.create;var Lu=Object.defineProperty;var K1=Object.getOwnPropertyDescriptor;var $1=Object.getOwnPropertyNames;var q1=Object.getPrototypeOf,V1=Object.prototype.hasOwnProperty;var W1=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Au=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},bn=(e,t)=>{for(var n in t)Lu(e,n,{get:t[n],enumerable:!0})},ib=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $1(t))!V1.call(e,r)&&r!==n&&Lu(e,r,{get:()=>t[r],enumerable:!(o=K1(t,r))||o.enumerable});return e};var ud=(e,t,n)=>(n=e!=null?H1(q1(e)):{},ib(t||!e||!e.__esModule?Lu(n,"default",{value:e,enumerable:!0}):n,e)),lb=e=>ib(Lu({},"__esModule",{value:!0}),e);var Eu={};bn(Eu,{Activity:()=>j1,Children:()=>Ng,Component:()=>Zr,Fragment:()=>Ha,Profiler:()=>Q1,PureComponent:()=>X1,StrictMode:()=>Y1,Suspense:()=>_g,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>J1,__COMPILER_RUNTIME:()=>Z1,act:()=>eO,cache:()=>tO,cacheSignal:()=>nO,captureOwnerStack:()=>oO,cloneElement:()=>Ru,createContext:()=>yt,createElement:()=>Me,createRef:()=>rO,default:()=>un,forwardRef:()=>Nn,isValidElement:()=>Dg,lazy:()=>aO,memo:()=>ye,startTransition:()=>sO,unstable_useCacheRefresh:()=>iO,use:()=>Ct,useActionState:()=>lO,useCallback:()=>E,useContext:()=>Ot,useDebugValue:()=>dO,useDeferredValue:()=>cO,useEffect:()=>q,useEffectEvent:()=>Og,useId:()=>kr,useImperativeHandle:()=>Bo,useInsertionEffect:()=>fd,useLayoutEffect:()=>xe,useMemo:()=>V,useOptimistic:()=>uO,useReducer:()=>ea,useRef:()=>N,useState:()=>Q,useSyncExternalStore:()=>So,useTransition:()=>fO,version:()=>pO});var cb,un,j1,Ng,Zr,Ha,Q1,X1,Y1,_g,J1,Z1,eO,tO,nO,oO,Ru,yt,Me,rO,Nn,Dg,aO,ye,sO,iO,Ct,lO,E,Ot,dO,cO,q,Og,kr,Bo,fd,xe,V,uO,ea,N,Q,So,fO,pO,le=W1(()=>{cb=window.__ycodiumPluginHost.react,un=cb,{Activity:j1,Children:Ng,Component:Zr,Fragment:Ha,Profiler:Q1,PureComponent:X1,StrictMode:Y1,Suspense:_g,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:J1,__COMPILER_RUNTIME:Z1,act:eO,cache:tO,cacheSignal:nO,captureOwnerStack:oO,cloneElement:Ru,createContext:yt,createElement:Me,createRef:rO,forwardRef:Nn,isValidElement:Dg,lazy:aO,memo:ye,startTransition:sO,unstable_useCacheRefresh:iO,use:Ct,useActionState:lO,useCallback:E,useContext:Ot,useDebugValue:dO,useDeferredValue:cO,useEffect:q,useEffectEvent:Og,useId:kr,useImperativeHandle:Bo,useInsertionEffect:fd,useLayoutEffect:xe,useMemo:V,useOptimistic:uO,useReducer:ea,useRef:N,useState:Q,useSyncExternalStore:So,useTransition:fO,version:pO}=cb});var Cw=Au(ro=>{"use strict";var WU=(le(),lb(Eu));function yw(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 as(){}var oo={d:{f:as,r:function(){throw Error(yw(522))},D:as,C:as,L:as,m:as,X:as,S:as,M:as},p:0,findDOMNode:null},GU=Symbol.for("react.portal");function jU(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:GU,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var tc=WU.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Ff(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}ro.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=oo;ro.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(yw(299));return jU(e,t,null,n)};ro.flushSync=function(e){var t=tc.T,n=oo.p;try{if(tc.T=null,oo.p=2,e)return e()}finally{tc.T=t,oo.p=n,oo.d.f()}};ro.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,oo.d.C(e,t))};ro.prefetchDNS=function(e){typeof e=="string"&&oo.d.D(e)};ro.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=Ff(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?oo.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&oo.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};ro.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Ff(t.as,t.crossOrigin);oo.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&&oo.d.M(e)};ro.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=Ff(n,t.crossOrigin);oo.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})}};ro.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Ff(t.as,t.crossOrigin);oo.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 oo.d.m(e)};ro.requestFormReset=function(e){oo.d.r(e)};ro.unstable_batchedUpdates=function(e,t){return e(t)};ro.useFormState=function(e,t,n){return tc.H.useFormState(e,t,n)};ro.useFormStatus=function(){return tc.H.useHostTransitionStatus()};ro.version="19.2.6"});var nc=Au((hoe,bw)=>{"use strict";function xw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xw)}catch(e){console.error(e)}}xw(),bw.exports=Cw()});var YM=Au(XM=>{"use strict";var Jl=(le(),lb(Eu));function qV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var VV=typeof Object.is=="function"?Object.is:qV,WV=Jl.useState,GV=Jl.useEffect,jV=Jl.useLayoutEffect,QV=Jl.useDebugValue;function XV(e,t){var n=t(),o=WV({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return jV(function(){r.value=n,r.getSnapshot=t,ex(r)&&a({inst:r})},[e,n,t]),GV(function(){return ex(r)&&a({inst:r}),e(function(){ex(r)&&a({inst:r})})},[e]),QV(n),n}function ex(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!VV(e,n)}catch{return!0}}function YV(e,t){return t()}var JV=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?YV:XV;XM.useSyncExternalStore=Jl.useSyncExternalStore!==void 0?Jl.useSyncExternalStore:JV});var ZM=Au((Yge,JM)=>{"use strict";JM.exports=YM()});var db=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  @layer properties, theme, base, components, utilities;
3
3
  @layer properties;
4
4
  :root, :host {
@@ -33,22 +33,6 @@ var G1=Object.create;var Au=Object.defineProperty;var j1=Object.getOwnPropertyDe
33
33
  transform: scaleX(0);
34
34
  }
35
35
  }
36
- @keyframes ultrathink-rainbow {
37
- 0% {
38
- background-position: 0% 50%;
39
- }
40
- 100% {
41
- background-position: 200% 50%;
42
- }
43
- }
44
- @keyframes ultrathink-chroma-shift {
45
- 0% {
46
- filter: hue-rotate(0deg) saturate(1.2);
47
- }
48
- 100% {
49
- filter: hue-rotate(360deg) saturate(1.2);
50
- }
51
- }
52
36
  @layer utilities {
53
37
  @scope (.ycodium-conversation-ui) {
54
38
  .pointer-events-auto:where(:scope, *) {
@@ -1424,7 +1408,7 @@ var G1=Object.create;var Au=Object.defineProperty;var j1=Object.getOwnPropertyDe
1424
1408
  --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
1425
1409
  }
1426
1410
  .topbar-scroll-fade:where(:scope, *) {
1427
- --topbar-scroll-fade-height: 2.5rem;
1411
+ --topbar-scroll-fade-height: 24px;
1428
1412
  -webkit-mask-image: linear-gradient( to bottom, transparent 0%, rgb(0 0 0 / 10%) 10%, rgb(0 0 0 / 30%) 24%, rgb(0 0 0 / 58%) 42%, rgb(0 0 0 / 82%) 62%, rgb(0 0 0 / 96%) 82%, black 100% ), linear-gradient(black, black), linear-gradient(black, black);
1429
1413
  -webkit-mask-position: top, bottom, right;
1430
1414
  -webkit-mask-repeat: no-repeat;
@@ -1433,9 +1417,6 @@ var G1=Object.create;var Au=Object.defineProperty;var j1=Object.getOwnPropertyDe
1433
1417
  mask-position: top, bottom, right;
1434
1418
  mask-repeat: no-repeat;
1435
1419
  mask-size: 100% var(--topbar-scroll-fade-height), 100% calc(100% - var(--topbar-scroll-fade-height)), var(--app-scrollbar-width) 100%;
1436
- @media (width >= 40rem) {
1437
- --topbar-scroll-fade-height: 3rem;
1438
- }
1439
1420
  }
1440
1421
  .virtualized-scroll-fade:where(:scope, *) {
1441
1422
  -webkit-mask-image: var(--virtualized-scroll-fade-mask), linear-gradient(black, black);
@@ -2016,10 +1997,6 @@ var G1=Object.create;var Au=Object.defineProperty;var j1=Object.getOwnPropertyDe
2016
1997
  .opacity-100:where(:scope, *) {
2017
1998
  opacity: 100%;
2018
1999
  }
2019
- .shadow-\\[0_0_0_1px_rgba\\(255\\,255\\,255\\,0\\.07\\)_inset\\]:where(:scope, *) {
2020
- --tw-shadow: 0 0 0 1px var(--tw-shadow-color, rgba(255,255,255,0.07)) inset;
2021
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2022
- }
2023
2000
  .shadow-\\[0_6px_18px_rgba\\(0\\,0\\,0\\,0\\.06\\)\\]:where(:scope, *) {
2024
2001
  --tw-shadow: 0 6px 18px var(--tw-shadow-color, rgba(0,0,0,0.06));
2025
2002
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -3546,32 +3523,6 @@ var G1=Object.create;var Au=Object.defineProperty;var j1=Object.getOwnPropertyDe
3546
3523
  background-color: var(--code-background) !important;
3547
3524
  color: var(--code-foreground) !important;
3548
3525
  }
3549
- .ultrathink-frame:where(:scope, *) {
3550
- --ultrathink-spectrum: linear-gradient(120deg);
3551
- position: relative;
3552
- }
3553
- .ultrathink-frame:where(:scope, *)::before {
3554
- content: "";
3555
- position: absolute;
3556
- inset: 0;
3557
- border-radius: inherit;
3558
- padding: 2px;
3559
- background-image: var(--ultrathink-spectrum);
3560
- background-size: 220% 220%;
3561
- pointer-events: none;
3562
- filter: saturate(0.82) brightness(0.92);
3563
- -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
3564
- -webkit-mask-composite: xor;
3565
- mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
3566
- mask-composite: exclude;
3567
- animation: ultrathink-rainbow 10s linear infinite;
3568
- }
3569
- .ultrathink-frame > *, .ultrathink-frame > *:where(:scope) {
3570
- position: relative;
3571
- }
3572
- .ultrathink-chroma:where(:scope, *) {
3573
- animation: ultrathink-chroma-shift 10s linear infinite;
3574
- }
3575
3526
  .session-turn:where(:scope, *) {
3576
3527
  content-visibility: auto;
3577
3528
  contain-intrinsic-size: auto 1px auto 320px;
@@ -3791,76 +3742,74 @@ var G1=Object.create;var Au=Object.defineProperty;var j1=Object.getOwnPropertyDe
3791
3742
  }
3792
3743
  }
3793
3744
  }
3794
- `;ie();ie();var mb=yt(null),Ug=mb.Provider,gb=yt(""),zg=gb.Provider;function Nu(){return Dt(gb)}function Fo(){let e=Dt(mb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var _u="conversation",Hg="conversation.prompt-preview";var Du="__ycodiumConversationBridge",Kg="ycodium.conversation.rebindable-bridge.v1";var md=16,hb=`ycodium.conversation.host-data.v${md}`,$g="ycodium:assistant-quote-open",ta="\uFFFC";ie();function vb(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=vb(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function yb(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=vb(e))&&(o&&(o+=" "),o+=t);return o}var Cb=yb;var xO=(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},bO=(e,t)=>({classGroupId:e,validator:t}),kb=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var xb=[],SO="arbitrary..",IO=e=>{let t=TO(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return wO(s);let i=s.split("-"),l=i[0]===""&&i.length>1?1:0;return Lb(i,l,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let l=o[s],d=n[s];return l?d?xO(d,l):l:d||xb}return n[s]||xb}}},Lb=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=Lb(e,t+1,a);if(d)return d}let s=n.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),l=s.length;for(let d=0;d<l;d++){let c=s[d];if(c.validator(i))return c.classGroupId}},wO=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?SO+o:void 0})(),TO=e=>{let{theme:t,classGroups:n}=e;return PO(n,t)},PO=(e,t)=>{let n=kb();for(let o in e){let r=e[o];Wg(r,n,o,t)}return n},Wg=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let s=e[a];kO(s,t,n,o)}},kO=(e,t,n,o)=>{if(typeof e=="string"){LO(e,t,n);return}if(typeof e=="function"){AO(e,t,n,o);return}RO(e,t,n,o)},LO=(e,t,n)=>{let o=e===""?t:Ab(t,e);o.classGroupId=n},AO=(e,t,n,o)=>{if(EO(e)){Wg(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(bO(n,e))},RO=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let s=0;s<a;s++){let[i,l]=r[s];Wg(l,Ab(t,i),n,o)}},Ab=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let s=o[a],i=n.nextPart.get(s);i||(i=kb(),n.nextPart.set(s,i)),n=i}return n},EO=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,MO=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,s)=>{n[a]=s,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let s=n[a];if(s!==void 0)return s;if((s=o[a])!==void 0)return r(a,s),s},set(a,s){a in n?n[a]=s:r(a,s)}}};var NO=[],bb=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),_O=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],s=0,i=0,l=0,d,c=r.length;for(let h=0;h<c;h++){let v=r[h];if(s===0&&i===0){if(v===":"){a.push(r.slice(l,h)),l=h+1;continue}if(v==="/"){d=h;continue}}v==="["?s++:v==="]"?s--:v==="("?i++:v===")"&&i--}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 g=d&&d>l?d-l:void 0;return bb(a,m,p,g)};if(t){let r=t+":",a=o;o=s=>s.startsWith(r)?a(s.slice(r.length)):bb(NO,!1,s,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},DO=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 s=n[a],i=s[0]==="[",l=t.has(s);i||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(s)):r.push(s)}return r.length>0&&(r.sort(),o.push(...r)),o}},OO=e=>({cache:MO(e.cacheSize),parseClassName:_O(e),sortModifiers:DO(e),postfixLookupClassGroupIds:FO(e),...IO(e)}),FO=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},BO=/\s+/,UO=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:s}=t,i=[],l=e.trim().split(BO),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let y=!!v,C;if(y){let k=h.substring(0,v);C=o(k);let P=C&&s[C]?o(h):void 0;P&&P!==C&&(C=P,y=!1)}else C=o(h);if(!C){if(!y){d=f+(d.length>0?" "+d:d);continue}if(C=o(h),!C){d=f+(d.length>0?" "+d:d);continue}y=!1}let x=m.length===0?"":m.length===1?m[0]:a(m).join(":"),b=g?x+"!":x,T=b+C;if(i.indexOf(T)>-1)continue;i.push(T);let I=r(C,y);for(let k=0;k<I.length;++k){let P=I[k];i.push(b+P)}d=f+(d.length>0?" "+d:d)}return d},zO=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Rb(n))&&(r&&(r+=" "),r+=o);return r},Rb=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Rb(e[o]))&&(n&&(n+=" "),n+=t);return n},Sb=(e,...t)=>{let n,o,r,a,s=l=>{let d=t.reduce((c,f)=>f(c),e());return n=OO(d),o=n.cache.get,r=n.cache.set,a=i,i(l)},i=l=>{let d=o(l);if(d)return d;let c=UO(l,n);return r(l,c),c};return a=s,(...l)=>a(zO(...l))},HO=[],kn=e=>{let t=n=>n[e]||HO;return t.isThemeGetter=!0,t},Eb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Mb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,KO=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$O=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qO=/\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$/,VO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,WO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,GO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>KO.test(e),mt=e=>!!e&&!Number.isNaN(Number(e)),Er=e=>!!e&&Number.isInteger(Number(e)),qg=e=>e.endsWith("%")&&mt(e.slice(0,-1)),na=e=>$O.test(e),Nb=()=>!0,jO=e=>qO.test(e)&&!VO.test(e),Gg=()=>!1,QO=e=>WO.test(e),XO=e=>GO.test(e),YO=e=>!_e(e)&&!De(e),JO=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)),ZO=e=>za(e,Ob,Gg),_e=e=>Eb.test(e),Ds=e=>za(e,Fb,jO),Ib=e=>za(e,iF,mt),eF=e=>za(e,Ub,Nb),tF=e=>za(e,Bb,Gg),wb=e=>za(e,_b,Gg),nF=e=>za(e,Db,XO),Ou=e=>za(e,zb,QO),De=e=>Mb.test(e),gd=e=>Os(e,Fb),oF=e=>Os(e,Bb),Tb=e=>Os(e,_b),rF=e=>Os(e,Ob),aF=e=>Os(e,Db),Fu=e=>Os(e,zb,!0),sF=e=>Os(e,Ub,!0),za=(e,t,n)=>{let o=Eb.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Os=(e,t,n=!1)=>{let o=Mb.exec(e);return o?o[1]?t(o[1]):n:!1},_b=e=>e==="position"||e==="percentage",Db=e=>e==="image"||e==="url",Ob=e=>e==="length"||e==="size"||e==="bg-size",Fb=e=>e==="length",iF=e=>e==="number",Bb=e=>e==="family-name",Ub=e=>e==="number"||e==="weight",zb=e=>e==="shadow";var Pb=()=>{let e=kn("color"),t=kn("font"),n=kn("text"),o=kn("font-weight"),r=kn("tracking"),a=kn("leading"),s=kn("breakpoint"),i=kn("container"),l=kn("spacing"),d=kn("radius"),c=kn("shadow"),f=kn("inset-shadow"),p=kn("text-shadow"),m=kn("drop-shadow"),g=kn("blur"),h=kn("perspective"),v=kn("aspect"),y=kn("ease"),C=kn("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...b(),De,_e],I=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],P=()=>[De,_e,l],w=()=>[Ua,"full","auto",...P()],L=()=>[Er,"none","subgrid",De,_e],A=()=>["auto",{span:["full",Er,De,_e]},Er,De,_e],M=()=>[Er,"auto",De,_e],R=()=>["auto","min","max","fr",De,_e],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...P()],F=()=>[Ua,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],J=()=>[Ua,"screen","full","dvw","lvw","svw","min","max","fit",...P()],O=()=>[Ua,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],B=()=>[e,De,_e],Y=()=>[...b(),Tb,wb,{position:[De,_e]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",rF,ZO,{size:[De,_e]}],oe=()=>[qg,gd,Ds],Q=()=>["","none","full",d,De,_e],ne=()=>["",mt,gd,Ds],re=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[mt,qg,Tb,wb],ue=()=>["","none",g,De,_e],Me=()=>["none",mt,De,_e],Oe=()=>["none",mt,De,_e],ke=()=>[mt,De,_e],Ee=()=>[Ua,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[na],breakpoint:[na],color:[Nb],container:[na],"drop-shadow":[na],ease:["in","out","in-out"],font:[YO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[na],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[na],shadow:[na],spacing:["px",mt],text:[na],"text-shadow":[na],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ua,_e,De,v]}],container:["container"],"container-type":[{"@container":["","normal","size",De,_e]}],"container-named":[JO],columns:[{columns:[mt,_e,De,i]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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:T()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[Er,"auto",De,_e]}],basis:[{basis:[Ua,"full","auto",i,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mt,Ua,"auto","initial","none",_e]}],grow:[{grow:["",mt,De,_e]}],shrink:[{shrink:["",mt,De,_e]}],order:[{order:[Er,"first","last","none",De,_e]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...D(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...D()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mbs:[{mbs:W()}],mbe:[{mbe:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...O()]}],"min-block-size":[{"min-block":["auto",...O()]}],"max-block-size":[{"max-block":["none",...O()]}],w:[{w:[i,"screen",...F()]}],"min-w":[{"min-w":[i,"screen","none",...F()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,gd,Ds]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,sF,eF]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",qg,_e]}],"font-family":[{font:[oF,tF,t]}],"font-features":[{"font-features":[_e]}],"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,De,_e]}],"line-clamp":[{"line-clamp":[mt,"none",De,Ib]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",De,_e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",De,_e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[mt,"from-font","auto",De,Ds]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[mt,"auto",De,_e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"tab-size":[{tab:[Er,De,_e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",De,_e]}],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",De,_e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Er,De,_e],radial:["",De,_e],conic:[Er,De,_e]},aF,nF]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-bs":[{"border-bs":B()}],"border-color-be":[{"border-be":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[mt,De,_e]}],"outline-w":[{outline:["",mt,gd,Ds]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",c,Fu,Ou]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,Fu,Ou]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[mt,Ds]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",p,Fu,Ou]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[mt,De,_e]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[mt]}],"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":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"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":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"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":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"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":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"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":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"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":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"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":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[De,_e]}],"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":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[mt]}],"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":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",De,_e]}],filter:[{filter:["","none",De,_e]}],blur:[{blur:ue()}],brightness:[{brightness:[mt,De,_e]}],contrast:[{contrast:[mt,De,_e]}],"drop-shadow":[{"drop-shadow":["","none",m,Fu,Ou]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",mt,De,_e]}],"hue-rotate":[{"hue-rotate":[mt,De,_e]}],invert:[{invert:["",mt,De,_e]}],saturate:[{saturate:[mt,De,_e]}],sepia:[{sepia:["",mt,De,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",De,_e]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[mt,De,_e]}],"backdrop-contrast":[{"backdrop-contrast":[mt,De,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mt,De,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mt,De,_e]}],"backdrop-invert":[{"backdrop-invert":["",mt,De,_e]}],"backdrop-opacity":[{"backdrop-opacity":[mt,De,_e]}],"backdrop-saturate":[{"backdrop-saturate":[mt,De,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",mt,De,_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",De,_e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mt,"initial",De,_e]}],ease:[{ease:["linear","initial",y,De,_e]}],delay:[{delay:[mt,De,_e]}],animate:[{animate:["none",C,De,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,De,_e]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Me()}],"rotate-x":[{"rotate-x":Me()}],"rotate-y":[{"rotate-y":Me()}],"rotate-z":[{"rotate-z":Me()}],scale:[{scale:Oe()}],"scale-x":[{"scale-x":Oe()}],"scale-y":[{"scale-y":Oe()}],"scale-z":[{"scale-z":Oe()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[De,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ee()}],"translate-x":[{"translate-x":Ee()}],"translate-y":[{"translate-y":Ee()}],"translate-z":[{"translate-z":Ee()}],"translate-none":["translate-none"],zoom:[{zoom:[Er,De,_e]}],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"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",De,_e]}],"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":B()}],"scrollbar-track-color":[{"scrollbar-track":B()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",De,_e]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[mt,gd,Ds,Ib]}],stroke:[{stroke:["none",...B()]}],"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"]}},lF=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(Gi(e,"cacheSize",t),Gi(e,"prefix",n),Gi(e,"experimentalParseClassName",o),Bu(e.theme,a.theme),Bu(e.classGroups,a.classGroups),Bu(e.conflictingClassGroups,a.conflictingClassGroups),Bu(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Gi(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Gi(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Uu(e.theme,r.theme),Uu(e.classGroups,r.classGroups),Uu(e.conflictingClassGroups,r.conflictingClassGroups),Uu(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Vg(e,r,"postfixLookupClassGroups"),Vg(e,r,"orderSensitiveModifiers"),e),Gi=(e,t,n)=>{n!==void 0&&(e[t]=n)},Bu=(e,t)=>{if(t)for(let n in t)Gi(e,n,t[n])},Uu=(e,t)=>{if(t)for(let n in t)Vg(e,t,n)},Vg=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},Hb=(e,...t)=>typeof e=="function"?Sb(Pb,e,...t):Sb(()=>lF(Pb(),e),...t);var dF=Hb({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 K(...e){return dF(Cb(e))}ie();var zu=yt(!0);function Kb(){return Ct(zu)}var jg=yt(void 0);function Mr(){let e=Ct(zu);return Ct(jg)??e}ie();var Hu=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var $b=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var qb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Qg=e=>{let t=qb(e);return t.charAt(0).toUpperCase()+t.slice(1)};ie();var Vb={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 Wb=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var Gb=Mn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:s,...i},l)=>Ne("svg",{ref:l,...Vb,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Hu("lucide",r),...!a&&!Wb(i)&&{"aria-hidden":"true"},...i},[...s.map(([d,c])=>Ne(d,c)),...Array.isArray(a)?a:[a]]));var ae=(e,t)=>{let n=Mn(({className:o,...r},a)=>Ne(Gb,{ref:a,iconNode:t,className:Hu(`lucide-${$b(Qg(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Qg(e),n};var cF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],hd=ae("arrow-down",cF);var uF=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],vd=ae("arrow-up-right",uF);var fF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],yd=ae("arrow-up",fF);var pF=[["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"}]],Cd=ae("blocks",pF);var mF=[["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"}]],ji=ae("bookmark",mF);var gF=[["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"}]],Fs=ae("bot",gF);var hF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Hn=ae("check",hF);var vF=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Zt=ae("chevron-down",vF);var yF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bs=ae("chevron-left",yF);var CF=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],So=ae("chevron-right",CF);var xF=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xd=ae("chevron-up",xF);var bF=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],bd=ae("chevrons-left",bF);var SF=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Sd=ae("chevrons-right",SF);var IF=[["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"}]],hn=ae("circle-alert",IF);var wF=[["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"}]],Us=ae("copy",wF);var TF=[["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"}]],Bo=ae("ellipsis",TF);var PF=[["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"}]],Id=ae("eye",PF);var kF=[["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"}]],zs=ae("file-code",kF);var LF=[["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"}]],Hs=ae("file-text",LF);var AF=[["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"}]],wd=ae("file",AF);var RF=[["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"}]],Ha=ae("folder",RF);var EF=[["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"}]],Td=ae("frame",EF);var MF=[["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"}]],Pd=ae("git-branch-plus",MF);var NF=[["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"}]],kd=ae("globe",NF);var _F=[["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"}]],Ld=ae("grip-vertical",_F);var DF=[["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"}]],Ad=ae("hammer",DF);var OF=[["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"}]],Ks=ae("image",OF);var FF=[["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"}]],oa=ae("layers",FF);var BF=[["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"}]],Rd=ae("list-ordered",BF);var UF=[["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"}]],$s=ae("list-todo",UF);var zF=[["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"}]],Ed=ae("list",zF);var HF=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ka=ae("loader-circle",HF);var KF=[["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"}]],$a=ae("lock-open",KF);var $F=[["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"}]],Md=ae("lock",$F);var qF=[["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"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],qa=ae("message-circle-question-mark",qF);var VF=[["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"}]],qs=ae("message-circle",VF);var WF=[["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"}]],Vs=ae("message-square",WF);var GF=[["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"}]],Nd=ae("minimize-2",GF);var jF=[["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"}]],Nr=ae("mouse-pointer-click",jF);var QF=[["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"}]],_d=ae("package",QF);var XF=[["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"}]],Ws=ae("paintbrush",XF);var YF=[["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"}]],oo=ae("paperclip",YF);var JF=[["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"}]],_r=ae("pen-line",JF);var ZF=[["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"}]],Dd=ae("pencil-ruler",ZF);var e2=[["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"}]],Od=ae("pencil",e2);var t2=[["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"}]],Gs=ae("puzzle",t2);var n2=[["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"}]],js=ae("rotate-ccw",n2);var o2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qs=ae("search",o2);var r2=[["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"}]],Fd=ae("send",r2);var a2=[["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"}]],Bd=ae("settings",a2);var s2=[["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"}]],Qi=ae("sliders-horizontal",s2);var i2=[["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"}]],Va=ae("sparkles",i2);var l2=[["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"}]],po=ae("square-pen",l2);var d2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ud=ae("square",d2);var c2=[["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"}]],Xs=ae("star",c2);var u2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Io=ae("terminal",u2);var f2=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],ra=ae("text-quote",f2);var p2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Dr=ae("user-round",p2);var m2=[["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=ae("wrench",m2);var g2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Qt=ae("x",g2);var h2=[["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"}]],Ys=ae("zap",h2);ie();function fe(){return{t:Fo().i18n.usePluginTranslation()}}ie();ie();var Xi=yt(null),Hd=yt(null);function Ku(e,t){let n=Ct(Hd);be(()=>{if(!(!t||e===null||n===null))return n(e)},[n,t,e])}function Kd(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,n)=>{e.set(t,(e.get(t)??0)+1),n();let o=!0;return()=>{if(!o)return;o=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),n()}}}}var jb=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function he(e){let t=jb.has(e),n=o=>{let r=Fo(),a=Nu(),s=Mr(),i=r.ui[e],l={};if(t){let d=Ct(Xi),[c,f]=G(o.defaultOpen===!0),p=typeof o.open=="boolean"?o.open:c;Ku(d,s&&p),be(()=>{s||f(!1)},[s]),l={open:s&&p,onOpenChange:(m,...g)=>{f(m),typeof o.onOpenChange=="function"&&o.onOpenChange(m,...g)}}}return Ne(i,{...o,...l,...jb.has(e)&&!s?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var gY=he("useLinkContextMenu"),rr=he("ProviderInstanceIcon"),Qb=he("UserAvatar"),Or=he("Badge"),ce=he("Button"),hY=he("Label"),Yi=he("Input"),Xb=he("Textarea"),vY=he("Switch"),yY=he("Separator"),CY=he("Skeleton"),$u=he("Spinner"),xY=he("ScrollArea"),bY=he("Card"),SY=he("CardAction"),IY=he("CardContent"),wY=he("CardDescription"),TY=he("CardFooter"),PY=he("CardHeader"),kY=he("CardTitle"),LY=he("Empty"),AY=he("EmptyContent"),RY=he("EmptyDescription"),EY=he("EmptyHeader"),MY=he("EmptyMedia"),NY=he("EmptyTitle"),_Y=he("InputGroup"),DY=he("InputGroupAddon"),OY=he("InputGroupInput"),FY=he("DocumentPanel"),BY=he("MasterDetail"),qu=he("Select"),UY=he("SelectContent"),Vu=he("SelectItem"),Wu=he("SelectPopup"),Yb=he("SelectTrigger"),Gu=he("SelectValue"),$d=he("Toggle"),Jb=he("ToggleGroup"),ju=he("AlertDialog"),Qu=he("AlertDialogClose"),Xu=he("AlertDialogDescription"),Yu=he("AlertDialogFooter"),Ju=he("AlertDialogHeader"),Zu=he("AlertDialogPopup"),ef=he("AlertDialogTitle"),tf=he("Dialog"),zY=he("DialogClose"),nf=he("DialogDescription"),of=he("DialogFooter"),rf=he("DialogHeader"),af=he("DialogPopup"),Zb=he("DialogPanel"),sf=he("DialogTitle"),HY=he("DialogTrigger"),KY=he("DropdownMenu"),$Y=he("DropdownMenuContent"),qY=he("DropdownMenuItem"),VY=he("DropdownMenuTrigger"),mo=he("Menu"),Ji=he("MenuGroup"),eS=he("MenuGroupLabel"),Uo=he("MenuItem"),go=he("MenuPopup"),ar=he("MenuRadioGroup"),wo=he("MenuRadioItem"),aa=he("MenuSeparator"),ho=he("MenuTrigger"),Wa=he("Popover"),Ga=he("PopoverPopup"),ja=he("PopoverTrigger"),tS=he("Table"),nS=he("TableBody"),Qa=he("TableCell"),Js=he("TableHead"),oS=he("TableHeader"),lf=he("TableRow"),je=he("Tooltip"),Qe=he("TooltipPopup"),Xe=he("TooltipTrigger"),rS=he("Collapsible"),aS=he("CollapsiblePanel"),sS=he("CollapsibleTrigger"),qd=he("Alert"),Vd=he("AlertAction"),df=he("AlertDescription"),Xg=he("AlertTitle"),cf=he("Kbd"),uf=he("Command"),ff=he("CommandGroup"),pf=he("CommandItem"),mf=he("CommandList"),iS=he("Combobox"),lS=he("ComboboxEmpty"),dS=he("ComboboxInput"),Zi=he("ComboboxItem"),cS=he("ComboboxListVirtualized"),uS=he("TooltipProvider"),fS=he("StyledDiffCodeView"),pS=he("DevBackdropArt"),zo=he("Markdown"),mS=he("DiffView");var{jsx:u,jsxs:S,Fragment:we}=window.__ycodiumPluginHost.jsxRuntime;function gS({mode:e,onModeChange:t}){let{t:n}=fe();return S(Jb,{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:[S($d,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(Vs,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),S($d,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(Rd,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function hS({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(jg,{value:t,children:r==="chat"?n:o})})}ie();function Kn(){return{t:Fo().i18n.usePluginTranslation()}}function vS(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 s=r.toFixed(a);if(Number.parseFloat(s)<100)return`${s}%`}return"99.9%"}function yS(e){let t,n,o,r=!0,a=!1;for(let s of e)s!==void 0&&(a=!0,s.cacheDisjoint!==!0&&(r=!1),s.outputTokens!==void 0&&(t=(t??0)+s.outputTokens),s.inputTokens!==void 0&&(n=(n??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(o=(o??0)+s.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 Wd(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 v2=Ce(function({item:t,ordinal:n,usage:o,onSelect:r}){return S("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}),S("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?S("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:Wd(o.outputTokens)}):null]}):null]})]})});function y2({totals:e}){let{t}=Kn();if(!e)return null;let n=vS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:Wd(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:Wd(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?Wd(e.cachedInputTokens):`${Wd(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:S("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=>S("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var C2=Ce(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=Kn(),s=Fo().writeClipboard,[i,l]=G(!1),d=a("turnNavigator.copyMarkdown");return S(je,{children:[u(Xe,{render:u(ce,{"aria-label":d,disabled:i,onClick:()=>{s(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:i?u(Hn,{className:"size-3 text-primary"}):u(Us,{className:"size-3"})}),u(Qe,{children:u("p",{children:d})})]})});function CS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float"}){let{t:l}=Kn(),[d,c]=G(!1),f=V(()=>e.map((h,v)=>({item:h,ordinal:v+1})).reverse(),[e]),p=V(()=>yS(f.map(({item:h})=>h.turnId===null?void 0:o.get(h.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,g=l("turnNavigator.open",{count:m});return S(Wa,{onOpenChange:c,open:d,children:[S(ja,{render:u(ce,{"aria-label":g,className:K("gap-1.5 rounded-full px-3",i==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:i==="float"?{bottom:n+12}:void 0,title:g,variant:"glass"}),children:[u(Ed,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(Ga,{align:"end",className:"w-80 flex-col",side:"top",children:S("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[S("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:K("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:h,ordinal:v})=>u(v2,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u(y2,{totals:p}),S("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(C2,{size:"icon-xs",getText:a,variant:"ghost"}),u(ce,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(ce,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}ie();function Gd(e){return e.replace(/\s+/g," ")}function x2(e,t){let n=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(n)&&(n=n.slice(1)),n}function b2(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)&&(n=n.slice(0,-1)),n}function gf(e){let n=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return n?.closest('[data-message-role="assistant"]')?n:null}function xS(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),n=gf(t.startContainer);if(n===null||gf(t.endContainer)!==n)return null;let o=n.closest("[data-message-id]")?.dataset.messageId;if(!o)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(n),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(n),s.setStart(t.endContainer,t.endOffset);let i=Gd(t.toString()),l=i.length>i.trimStart().length?" ":"",d=i.length>i.trimEnd().length?" ":"",c=Gd(a.toString()+l),f=Gd(d+s.toString()),p=c.length,m=p+i.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),v=g[g.length-1]??h;return{messageId:o,text:r,start:p,end:m,prefix:x2(c,32),suffix:b2(f,32),anchor:{x:v.right,top:h.top,bottom:v.bottom}}}var hf="assistant-quote-inserter",vf="assistant-quote-open-comment";ie();var SS=100,S2=new Map,bS=new Map,yf=e=>typeof e=="function"?e():e,IS=(e,t)=>typeof t=="function"?t(e):t;function I2(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 w2(e,t){let n=bS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},bS.set(e,n)),n}function T2(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 Yg(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function wS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:yf(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function jd(e){queueMicrotask(()=>T2(e))}function Ot(e,t,n,o=SS){let r=Math.max(1,o),a=I2(S2,e,r),s=wS(a,t,n),i=E(f=>s.alive?(a.limit=r,s.committed=!0,Yg(a,t,s),s.leases+=1,s.subscribers.add(f),jd(a),()=>{s.subscribers.delete(f),s.leases=Math.max(0,s.leases-1),jd(a)}):()=>{},[r,s,a,t]),l=E(()=>s.value,[s]),d=bo(i,l,l),c=E(f=>{if(!s.alive||a.values.get(t)!==s)return;let p=s.value,m=IS(p,f);if(!Object.is(m,p)){s.value=m,Yg(a,t,s);for(let g of s.subscribers)g();jd(a)}},[s,a,t]);return[d,c]}function TS(e,t){let n=N(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:yf(t)});let[,o]=ea(a=>a+1,0),r=E(a=>{let s=n.current;if(s===null||s.key!==e)return;let i=IS(s.value,a);Object.is(i,s.value)||(s.value=i,o())},[e]);return[n.current.value,r]}function xt(e,t,n,o=SS){let r=Math.max(1,o),a=w2(e,r),s=wS(a,t,()=>({current:yf(n)}));return q(()=>{if(!(!s.alive||a.values.get(t)!==s))return a.limit=r,s.committed=!0,Yg(a,t,s),s.leases+=1,jd(a),()=>{s.leases=Math.max(0,s.leases-1),jd(a)}},[r,s,a,t]),s.value}function sr(e,t){let n=N(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:yf(t)}}),n.current.ref}var P2=300;function PS(e){let{data:t,target:n,threadKey:o,surfaceRef:r}=e,{t:a}=fe(),s=xt(hf,o,null),[,i]=Ot(vf,o,null),[l,d]=G(null),c=N(null);if(q(()=>{let h,v=()=>{let I=r.current,k=document.getSelection(),P=k&&k.rangeCount>0?k.getRangeAt(0):null;if(!I||!P||!I.contains(P.commonAncestorContainer)){d(null);return}let w=xS(k);if(w===null){d(null);return}let L=t.assistantQuotes.serialize({version:1,environmentId:n.environmentId,threadId:n.threadId,messageId:w.messageId,text:w.text,start:w.start,end:w.end,prefix:w.prefix,suffix:w.suffix});d({source:L,...w.anchor})},y=I=>{c.current?.contains(I.target)||(clearTimeout(h),h=setTimeout(v,P2))},C=I=>{c.current?.contains(I.target)||(clearTimeout(h),d(null))},x=()=>d(null),b=I=>{I.key==="Escape"&&d(null)},T=()=>{(document.getSelection()?.isCollapsed??!0)&&d(null)};return document.addEventListener("pointerup",y,!0),document.addEventListener("keyup",y,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",b,!0),document.addEventListener("selectionchange",T),window.addEventListener("scroll",x,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",y,!0),document.removeEventListener("keyup",y,!0),document.removeEventListener("pointerdown",C,!0),document.removeEventListener("keydown",b,!0),document.removeEventListener("selectionchange",T),window.removeEventListener("scroll",x,!0)}},[t,r,n.environmentId,n.threadId]),l===null)return null;let f=l.source,p=Math.max(8,Math.min(window.innerWidth-200,l.x-12)),m=l.bottom+6,g=m+40<=window.innerHeight?m:Math.max(8,l.top-40);return u("div",{ref:c,className:"fixed z-50",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:S(ce,{size:"sm",variant:"outline",className:"shadow-md",disabled:f===null,title:f===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{f!==null&&s.current?.(f)===!0&&(i(f),document.getSelection()?.removeAllRanges(),d(null))},children:[u(ra,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}ie();ie();function k2(e){return e!==null&&"tagName"in e&&"closest"in e}function Xa(e){return k2(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function Jg(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function kS(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function LS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return kS(t,"accept");case"Escape":return kS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=Jg(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}ie();var el=new Map,AS=24,L2=4e3,A2=1024,RS=16384;function Zg(e){let t=el.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(el.set(e,n),el.size>AS){for(let[o,r]of el)if(r.listeners.size===0&&o!==e&&(el.delete(o),el.size<=AS))break}return n}function eh(e,t,n){return Zg(e).values.get(t)??n}function Qd(e,t,n,o=!0){let r=Zg(e);if(typeof n=="string"&&(n=n.slice(0,A2)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>RS){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=RS))break}if(r.values.size>L2){let s=r.values.keys().next().value;if(s!==void 0){let i=r.values.get(s);typeof i=="string"&&(r.stringLength-=i.length),r.values.delete(s)}}o&&r.listeners.forEach(s=>s())}function To(e,t,n){let o=E(i=>{let l=Zg(e);return l.listeners.add(i),()=>l.listeners.delete(i)},[e]),r=E(()=>eh(e,t,n),[e,t,n]),a=bo(o,r,r),s=E(i=>Qd(e,t,i),[e,t]);return[a,s]}function Cf(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function ES(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function xf({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let c=e.bySectionKey.get(d)?.turnId;return c==null?[]:[c]}),a=n.flatMap(d=>{let c=e.byRowId.get(d)?.turnId;return c==null?[]:[c]}),s=o?e.byRowId.get(o.firstRowId)?.index:void 0,i=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=s===void 0||i===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(s,i)&&d.firstRowIndex<=Math.max(s,i)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function MS(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}ie();ie();function th(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function Zs(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,o=a):n=a+1}return r}function R2(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Zs(s,t),l=i<0?void 0:s[i],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=Zs(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let s=o(n[a]);if(s)return s}return null}function NS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var nh=class extends Zr{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function _S({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let l=N(null),d=N({inputKey:e,store:Kd()});d.current.inputKey!==e&&(d.current={inputKey:e,store:Kd()});let c=N(i);c.current=i;let f=E(m=>{let g=d.current;return g.store.acquire(m,()=>{d.current===g&&c.current?.(g.store.rows())})},[]);be(()=>{i?.(d.current.store.rows())},[e,i]),Oo(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:g=>{let h=th(m,g);return h===null?null:NS(h,m)},heightOf:g=>{let h=th(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>R2(m)}:null},scrollToEnd:m=>{let g=l.current;if(g){if(m?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(m,g)=>{let h=l.current;if(!h)return!1;let v=th(h,m);return v?(h.scrollTop=Math.max(0,NS(v,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let g=l.current;g&&(g.scrollTop=Math.max(0,m))}}),[]);let p=E(m=>{l.current=m,o(m)},[o]);return u(nh,{inputKey:e,onBeforeInputChange:t,children:u(Hd,{value:f,children:u("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function nl(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function tl(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function bf(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let c=t.getRangeAt(d);c.intersectsNode(e)&&(n??=c,o=c)}if(!n||!o)return null;let r=tl(n.startContainer,e),a=tl(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,l=s[s.length-1]?.dataset.timelineRowId;return i&&l?{firstRowId:r??i,lastRowId:a??l}:null}function Xd(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}ie();function Ya(e){let t=N(e);t.current=e;let n=N(!1),o=N(null),r=N(null),a=N(0),s=E(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=E(()=>{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=E(c=>{o.current=c,i()},[i]),d=E(()=>{o.current=null,s()},[s]);return be(()=>(n.current=!0,i(),()=>{n.current=!1,s()}),[e,s,i]),V(()=>({request:l,cancel:d}),[l,d])}function DS({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l}){let d=N({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l};let c=Ya(n),f=N(null),p=E(()=>{let g=d.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let v=h.top+g.topInset,y=h.bottom-g.bottomInset,C=e.querySelectorAll("[data-timeline-turn-section]"),x=Zs(C,v),b=[];if(x>=0)for(let w=x;w<C.length;w+=1){let L=C[w];if(L.getBoundingClientRect().top>=y)break;L.dataset.timelineTurnSection!==void 0&&b.push(L.dataset.timelineTurnSection)}let T=[...g.interactionRows()],I=e.ownerDocument.activeElement;if(nl(I)){let w=tl(I,e);w&&T.push(w)}let k=xf({index:g.index,visibleSectionKeys:b,protectedRowIds:T,selectionRows:bf(e)}),P=`${g.inputKey}:${JSON.stringify(k)}`;P!==f.current&&(f.current=P,g.onRangeChange?.(k))},[e]),m=E(()=>c.request(p),[c,p]);return be(()=>{if(f.current=null,!n||!e)return;let g=t,h=!0,v=()=>{!h||d.current.inputKey!==g||!d.current.visible||(d.current.onSelectionChange(Xd(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let y=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return y?.observe(e),e.firstElementChild&&y?.observe(e.firstElementChild),v(),()=>{h=!1,c.cancel(),y?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),i?.(null)}},[c,t,i,m,e,n]),be(()=>{n&&m()},[o,m,n]),m}ie();function sa(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let s=Math.round(e/100)/10;return s>=10?"10s":`${s.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];return n>0&&a.push(`${n}h`),o>0&&a.push(`${o}m`),r>0&&a.push(`${r}s`),a.join(" ")}function E2(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function M2(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function N2(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var oh=M2(N2()),OS=new Map;function FS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=OS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(oh,E2(e,t));return OS.set(n,r),r}function rh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var _2=new Intl.DateTimeFormat(void 0,{month:"long"});function D2(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 O2(e,t){let n=rh(e);return n?FS(t,!1).format(n):""}function Ja(e,t){let n=rh(e);if(!n)return"";let o=O2(e,t),r=n.getDate(),a=_2.format(n),s=n.getFullYear();return`${o}, ${r}${D2(r)} ${a} ${s}`}var F2=new Intl.DateTimeFormat(oh,{month:"numeric",day:"numeric"}),B2=new Intl.DateTimeFormat(oh,{month:"numeric",day:"numeric",year:"numeric"});function Za(e,t,n,o=Date.now()){let r=rh(e);if(!r)return"";let a=FS(t,!1).format(r),s=new Date(o),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((i-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===s.getFullYear()?F2:B2).format(r)} ${a}`}ie();ie();var ol=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function U2(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function z2(e,t){let n=()=>new ol("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(U2(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new ol("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function Sf({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=G(!1),s=N(null),i=N(n),l=N(o),d=N(t),c=N(e);i.current=n,l.current=o,d.current=t,c.current=e;let f=E((p,m)=>{z2(p,d.current).then(g=>{g&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(m),c.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},c.current)))},g=>{l.current?.(g instanceof Error?g:new Error(String(g)),m)})},[]);return q(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:f,isCopied:r}}function ft(){let e=Fo().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var BS=1e3,H2={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function K2({title:e,description:t}){return S("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 rl=Ce(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:s}=ft(),i=N(null),[l,d]=G(null),c=N(null),f=(g,h)=>{let v=i.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(h===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:g,description:h}),c.current=setTimeout(()=>d(null),BS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Sf({onCopy:()=>f(s("copyButton.copied")),onError:g=>f(s("copyButton.failedToCopy"),g instanceof ol?s(H2[g.reason]):g.message),timeout:BS});return S(je,{children:[u(Xe,{render:u(ce,{"aria-label":s("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:i,type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:m?u(Hn,{className:"size-3 text-primary"}):u(Us,{className:"size-3"})}),u(Qe,{children:u("p",{children:s("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(K2,{title:l.title,description:l.description})})}):null]})});function $2(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 If({label:e,children:t}){let[n,o]=G(!1);return S(je,{open:n,onOpenChange:o,children:[u(Xe,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Qe,{children:e})]})}var US=Ce(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=ft(),a=t.state,s=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return S("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[S("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?S(If,{label:s,children:[a==="completed"?u(Hn,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(Qt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Ud,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:s})]}):null,t.completedAt?u(If,{label:Ja(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:Za(t.completedAt,n,r)})}):null,t.workingElapsedMs!==void 0?S(If,{label:r("timeline.workingTime",{duration:sa(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),sa(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?S(If,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),$2(t.outputTokens)]}):null]}),o?u(rl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});ie();ie();function zS(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 HS=Ce(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:s="aligned"}=t,{t:i}=ft(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([i("changedFiles.additions",{count:n}),i("changedFiles.deletions",{count:o})]);return S(we,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),S("span",{role:"group","aria-label":l,className:K(s==="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:[S("span",{"aria-hidden":"true",className:"font-mono text-diff-addition",children:["+",zS(n)]}),S("span",{"aria-hidden":"true",className:"font-mono text-diff-deletion",children:["-",zS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function q2(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 KS(e){return e.replaceAll("\\","/")}function $S(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function V2(e){return e.replace(/[\\/]+$/,"")}function W2(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function G2(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function j2(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function wf(e,t){let{path:n,line:o,column:r}=q2(e),a=$S(KS(n)),s=a;if(t){let i=$S(KS(V2(t))),l=W2(i),d=a.toLowerCase(),c=i.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)s=l;else if(d.startsWith(f)){let m=a.slice(i.length+1);s=`${l}/${m}`}else if(!j2(a)){let m=G2(a);s=d.startsWith(p)?a:`${l}/${m}`}}return o?`${s}:${o}${r?`:${r}`:""}`:s}function qS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function VS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Tf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function Yd({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function Jd({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:K("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Pf({state:e,variant:t="inline",className:n,children:o}){return S("div",{"data-process-state":e,"data-process-kind":t,className:K("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]})}function Zd({name:e,className:t}){switch(e){case"bot":return u(Fs,{className:t,"aria-hidden":!0});case"check":return u(Hn,{className:t,"aria-hidden":!0});case"circle-alert":return u(hn,{className:t,"aria-hidden":!0});case"eye":return u(Id,{className:t,"aria-hidden":!0});case"globe":return u(kd,{className:t,"aria-hidden":!0});case"hammer":return u(Ad,{className:t,"aria-hidden":!0});case"message-circle":return u(qs,{className:t,"aria-hidden":!0});case"search":return u(Qs,{className:t,"aria-hidden":!0});case"square-pen":return u(po,{className:t,"aria-hidden":!0});case"terminal":return u(Io,{className:t,"aria-hidden":!0});case"wrench":return u(zd,{className:t,"aria-hidden":!0});case"x":return u(Qt,{className:t,"aria-hidden":!0});case"zap":return u(Ys,{className:t,"aria-hidden":!0})}}function Q2(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 ah(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:Q2(o),count:r}))}function sh(e,t){let n;for(let o of ah(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var al=20;function sl(e){return Cf(e)}function WS(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,s=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,i=o?.name??s??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?wf(l,t):void 0,c=[i.trim().toLowerCase()==="tool"?void 0:i,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(g=>g.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function GS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||ih(e)?null:u(HS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function ih(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function jS({toolIcon:e,glyphClassName:t}){let n=Ct(rn),o=n.SiteIcon;return e.pageUrl!==void 0&&o!==void 0?u(o,{threadRef:n.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):u(Zd,{name:"globe",className:t})}function X2({entry:e,failed:t=!1,derive:n}){return t?u(hn,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):e.toolIcon!==void 0?u(jS,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):u(Zd,{name:sh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function Y2({entries:e,failed:t,derive:n}){let{t:o}=ft(),r=V(()=>ah(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:s,icon:i,count:l})=>S("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u(Zd,{name:i,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},s))})}function QS({entry:e}){let t=Ct(rn),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(we,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var J2=Ce(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,i=Ct(rn).derive,{t:l}=ft(),[d,c]=To(o,`call:${sl(n)}`,!1),f=i.workEntryIndicatesFailure(n),p=ih(n),m=i.resolveWorkEntryStatus(n),g=m==="failed"||m==="running"?m:null,h=Rr();return S("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:[S("button",{type:"button","aria-expanded":d,"aria-controls":h,onClick:()=>{a?.(),c(!d)},className:K("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(Jd,{status:g}),u(Yd,{children:u(X2,{entry:n,failed:f,derive:i})}),S("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:WS(n,r,i)??l("toolGroup.calls",{count:1})}),u(GS,{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(Zt,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u(QS,{entry:n})}):null]})});function Z2({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=N(null);return be(()=>{let a=r.current;if(!a)return;a.scrollTop=eh(e,`${t}:scroll`,0);let s=()=>{Qd(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",s,{passive:!0}),()=>a.removeEventListener("scroll",s)},[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 XS=Ce(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let i=Ct(rn).derive,{t:l}=ft(),[d,c]=To(o,`group:${n}`,!1),[f,p]=To(o,`group-page:${n}`,0),m=Rr(),g=N(null),[h,v]=G(null),y=t.at(-1),C=V(()=>t.filter(F=>i.workEntryIndicatesFailure(F)),[t,i]),x=V(()=>t.filter(ih),[t]),b=t.filter(F=>F.toolLifecycleStatus==="inProgress").length,T=C[0]??x[0],I=T??y,k=Math.max(0,Math.ceil(t.length/al)-1),P=Math.min(f,k),w=P*al,L=t.slice(w,w+al),A=t.length>1;if(be(()=>{if(!h)return;let F=g.current,J=Array.from(F?.querySelectorAll("[data-tool-identity]")??[]).find(B=>B.dataset.toolIdentity===h.id);if(!J)return;let O=J.closest('[data-slot="scroll-area-viewport"]');O&&(O.scrollTop+=J.getBoundingClientRect().top-O.getBoundingClientRect().top),J.querySelector("button")?.focus({preventScroll:!0})},[h]),!y||!I)return null;let M=F=>{a?.(),p(F)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},D=VS(t.map(F=>qS(i.resolveWorkEntryStatus(F)))),H=sh(t,i.toolGroupAction),W=D==="failed"?"failed":D==="running"?"running":"success";return u(Pf,{state:D,variant:"tool",children:S("section",{ref:g,"data-tool-group-id":n,className:"min-w-0",children:[S("div",{className:"flex min-w-0 items-center",children:[S("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!A&&!d&&Qd(o,`call:${sl(y)}`,!0)},className:K(Tf,"flex-1",T?"text-destructive":"text-muted-foreground"),children:[u(Jd,{status:W}),u(Yd,{children:!A&&y.toolIcon!==void 0&&C.length===0?u(jS,{toolIcon:y.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):u(Zd,{name:H,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",C.length>0?"text-destructive":"text-icon-muted")})}),S("span",{className:K("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}):WS(I,r,i)??l("toolGroup.calls",{count:1})}),d&&A?null:u(GS,{entry:I,failed:i.workEntryIndicatesFailure(I)})]}),b>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:b})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:C.length})}):null,x.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:x.length})}):null,d&&A?null:u(Y2,{entries:t,failed:C.length>0,derive:i}),u(Zt,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),T&&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(T)/al)),Qd(o,`call:${sl(T)}`,!0),v({id:sl(T)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:A?S(we,{children:[t.length>al?S("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:w+1,to:Math.min(w+al,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:P===0,Icon:bd},{label:l("toolGroup.previousPage"),target:P-1,disabled:P===0,Icon:Bs},{label:l("toolGroup.nextPage"),target:P+1,disabled:P===k,Icon:So},{label:l("toolGroup.lastPage"),target:k,disabled:P===k,Icon:Sd}].map(({label:F,target:J,disabled:O,Icon:B})=>u("button",{type:"button","aria-label":F,disabled:O,onClick:()=>M(J),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(B,{"aria-hidden":!0,className:"size-icon-1"})},F))]}):null,u(Z2,{threadKey:o,stateKey:`group-scroll:${n}:${P}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:L.map(F=>u(J2,{entry:F,...R},sl(F)))})})]}):u(QS,{entry:y})}):null]})})});function eB(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 YS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,s=!0,i=null,l=()=>{if(i=null,!s||!n.isConnected||!t.contains(n))return;let f=eB(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{s&&i===null&&(i=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{s=!1,c?.disconnect(),i!==null&&cancelAnimationFrame(i),i=null}}}ie();var JS=Ce(function({sectionKey:t,rowKeyPrefix:n,rowIds:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(s=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${n}:${s}`))})});function tB(e,t,n){for(let o=t;o<n;o+=1){let r=e[o];switch(r.kind){case"turn-identity":return r.turnId;case"working":return r.turnId??null;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!==void 0)return r.entries[0].turnId??null;break;case"work":if(r.groupedEntries[0]?.turnId!==void 0)return r.groupedEntries[0].turnId??null;break;case"turn-plan":return r.turnPlan.turnId;case"proposed-plan":return r.proposedPlan.turnId;case"turn-summary":return r.footer.turnId}}return null}function ZS(e,t,n=[]){let o=new Map(n.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let s=tB(e,a.start,a.end),i=o.get(a.key);if(i!==void 0&&i.turnId===s&&nB(i,e,a.start,a.end)){r.push(i);continue}r.push({key:a.key,turnId:s,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(l=>l.id)})}return r}function nB(e,t,n,o){if(e.firstRowIndex!==n||e.rowIds.length!==o-n)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[n+r].id)return!1;return!0}function eI(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function il(e,t,n){let o=e.findIndex(r=>r.rowIds.includes(t));return o<0?n:Math.max(n,e.length-o)}ie();var ei=3,lh=ei;function tI(e){let[t,n]=Ot("timeline-reveal-window",e,ei),o=E(()=>{n(i=>i+lh)},[n]),r=E(i=>{n(l=>i>l?i:l)},[n]),a=E(()=>{n(ei)},[n]),s=E(i=>{n(l=>Math.min(l,Math.max(ei,i)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:s,reset:a}}function nI(e,t){return t.prefixMounted?"mounted":t.loading===null||t.now>e.until?"abandoned":t.loading?(e.loadingObserved=!0,e.sectionsWhileLoading=t.sections,"waiting"):e.loadingObserved?t.sections===e.sectionsWhileLoading?"waiting":"landed":"waiting"}function oB(e,t){let n=d=>d.replace(/\s+/g,""),o=n(t.text);if(o.length===0)return null;let r=(d,c)=>e.slice(Math.max(0,d-t.prefix.length),d)===t.prefix&&e.slice(c,c+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&n(e.slice(t.start,t.end))===o&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Gd(t.text).trim(),s=[];for(let d=e.indexOf(a);d>=0;d=e.indexOf(a,d+1))s.push(d);let i=s.filter(d=>r(d,d+a.length)),l=i.length===1?i[0]:i.length===0&&s.length===1?s[0]:null;return l===null?null:{start:l,end:l+a.length}}function rI(e,t){let n=e.querySelector("[data-assistant-quote-body]")??gf(e);if(n===null)return null;let o=[],r="",a=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let c=a.nextNode();c;c=a.nextNode()){let f=c.data;for(let p=0;p<f.length;p+=1){let m=/\s/.test(f[p]);m&&r.endsWith(" ")||(r+=m?" ":f[p],o.push({node:c,offset:p}))}}let s=oB(r,t);if(s===null)return null;let i=o[s.start],l=o[s.end-1];if(!i||!l)return null;let d=document.createRange();return d.setStart(i.node,i.offset),d.setEnd(l.node,l.offset+1),d}var dh="assistant-quote",oI=2400;function aI(e){let t=globalThis.CSS?.highlights,n=globalThis.Highlight;if(t&&n){let r=new n(e);t.set(dh,r),setTimeout(()=>{t.get(dh)===r&&t.delete(dh)},oI);return}let o=document.getSelection();o&&(o.removeAllRanges(),o.addRange(e),setTimeout(()=>{let r=o.rangeCount>0?o.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&o.removeAllRanges()},oI))}var rB=400;function sI({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,s=new Set,i,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,c=()=>{if(i=void 0,a.hidden||s.size>0||!o()||e.clientHeight<=0||!d()||Xd(e))return;let b=e.querySelectorAll("[data-timeline-turn-section]"),T=e.getBoundingClientRect().top-32-n,I=0,k=Math.max(0,b.length-t);for(;I<k;){let w=Math.floor((I+k)/2),L=b[w].getBoundingClientRect().bottom;if(!Number.isFinite(L))return;L<=T?I=w+1:k=w}if(I===0)return;let P=a.activeElement;if(P&&nl(P)){for(let w=0;w<I;w+=1)if(b[w].contains(P))return}r(b.length-I)},f=!1,p=()=>{if(a.hidden||s.size>0||!o()||f){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(c,rB))},m=()=>{clearTimeout(i),i=void 0,p()},g=()=>{let b=d();!b||!l?m():p(),l=b},h=b=>{s.add(b.pointerId),m()},v=b=>{s.delete(b.pointerId),m()},y=()=>{f=Xd(e),m()},C=()=>{s.clear(),m()},x=["wheel","keydown","focusin","focusout"];for(let b of x)e.addEventListener(b,m,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",y),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",C),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let b of x)e.removeEventListener(b,m);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",y),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",C)}}}ie();function iI({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=N(o);r.current=o;let a=Ya(o),s=N(new Map),i=N(null),l=N(null),d=N(n);d.current=n;let c=E(()=>{if(!r.current||!e)return;let h=e.scrollTop+t,v=null,y=Number.NEGATIVE_INFINITY,C=null,x=Number.POSITIVE_INFINITY;for(let[T,I]of s.current){if(!I.isConnected)continue;let k=I.offsetTop;k<x&&(x=k,C=T),k<=h&&k>=y&&(y=k,v=T)}let b=v??C;b!==l.current&&(l.current=b,d.current(b))},[e,t]),f=E(()=>{r.current&&a.request(c)},[a,c]);q(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let h=!0,v=new IntersectionObserver(()=>{!h||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});i.current=v;for(let y of s.current.values())v.observe(y);return f(),()=>{h=!1,v.disconnect(),i.current=null,a.cancel()}},[o,a,f,e,t]);let p=N(new Map),m=E(h=>{let v=p.current.get(h);if(v)return v;let y=C=>{let x=s.current.get(h);x&&x!==C&&(i.current?.unobserve(x),s.current.delete(h)),C?(s.current.set(h,C),i.current?.observe(C)):p.current.get(h)===y&&p.current.delete(h)};return p.current.set(h,y),y},[]),g=E(()=>{r.current&&(l.current=null,f())},[f]);return V(()=>({observeSection:m,refresh:g}),[m,g])}function ec(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=i=>{let l=e.indexOf(i);return l<0?null:[e.slice(0,l),e.slice(l+i.length)]},s=a(o)??a(r);return s===null?S(we,{children:[e,t]}):S(we,{children:[s[0],t,s[1]]})}ie();function lI(e){return bo(e.subscribe,e.getStructure,e.getStructure)}function dI(e,t){let n=E(r=>e.subscribeRow(t,r),[e,t]),o=E(()=>e.getRow(t),[e,t]);return bo(n,o,o)}function es(e,t,n=Object.is){let o=N(null),r=E(()=>{let a=e.getVersion(),s=o.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),l=s!==null&&s.store===e&&n(s.value,i)?s.value:i;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return bo(e.subscribe,r,r)}ie();function ch(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 ts(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||aB.has(t)?"text":"file"}var aB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function cI(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 sB="<ycodium-system>";function kf(e){return e.startsWith(sB)}var iB=/[ \t]*\(record [^\s()]+\)/g,lB=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function uh(e){return kf(e)?e.split(`
3795
- `).filter(t=>!lB.test(t.trim())).join(`
3796
- `).replace(iB,""):e}var dB=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function uI(e){let t=e.match(dB);return t&&t.length>0?t:[e]}function fI(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 pI(e){switch(e){case"image":return Ks;case"pdf":return Hs;case"text":return zs;case"file":return oo}}var cB=[".m4v",".mov",".mp4",".ogv",".webm"],uB=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function mI(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return cB.includes(n)?"video":uB.includes(n)?"audio":null}var fB=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function tc(e){let t=fB.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=pB(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function pB(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3745
+ `;le();le();var ub=yt(null),Fg=ub.Provider,fb=yt(""),Bg=fb.Provider;function Mu(){return Ot(fb)}function Uo(){let e=Ot(ub);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var Nu="conversation",Ug="conversation.prompt-preview";var _u="__ycodiumConversationBridge",zg="ycodium.conversation.rebindable-bridge.v1";var pd=16,pb=`ycodium.conversation.host-data.v${pd}`,Hg="ycodium:assistant-quote-open",ta="\uFFFC";le();function mb(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=mb(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function gb(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=mb(e))&&(o&&(o+=" "),o+=t);return o}var hb=gb;var mO=(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},gO=(e,t)=>({classGroupId:e,validator:t}),wb=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var vb=[],hO="arbitrary..",vO=e=>{let t=CO(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return yO(s);let i=s.split("-"),l=i[0]===""&&i.length>1?1:0;return Tb(i,l,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let l=o[s],d=n[s];return l?d?mO(d,l):l:d||vb}return n[s]||vb}}},Tb=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=Tb(e,t+1,a);if(d)return d}let s=n.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),l=s.length;for(let d=0;d<l;d++){let c=s[d];if(c.validator(i))return c.classGroupId}},yO=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?hO+o:void 0})(),CO=e=>{let{theme:t,classGroups:n}=e;return xO(n,t)},xO=(e,t)=>{let n=wb();for(let o in e){let r=e[o];qg(r,n,o,t)}return n},qg=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let s=e[a];bO(s,t,n,o)}},bO=(e,t,n,o)=>{if(typeof e=="string"){SO(e,t,n);return}if(typeof e=="function"){IO(e,t,n,o);return}wO(e,t,n,o)},SO=(e,t,n)=>{let o=e===""?t:Pb(t,e);o.classGroupId=n},IO=(e,t,n,o)=>{if(TO(e)){qg(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(gO(n,e))},wO=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let s=0;s<a;s++){let[i,l]=r[s];qg(l,Pb(t,i),n,o)}},Pb=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let s=o[a],i=n.nextPart.get(s);i||(i=wb(),n.nextPart.set(s,i)),n=i}return n},TO=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,PO=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,s)=>{n[a]=s,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let s=n[a];if(s!==void 0)return s;if((s=o[a])!==void 0)return r(a,s),s},set(a,s){a in n?n[a]=s:r(a,s)}}};var kO=[],yb=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),LO=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],s=0,i=0,l=0,d,c=r.length;for(let h=0;h<c;h++){let v=r[h];if(s===0&&i===0){if(v===":"){a.push(r.slice(l,h)),l=h+1;continue}if(v==="/"){d=h;continue}}v==="["?s++:v==="]"?s--:v==="("?i++:v===")"&&i--}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 g=d&&d>l?d-l:void 0;return yb(a,m,p,g)};if(t){let r=t+":",a=o;o=s=>s.startsWith(r)?a(s.slice(r.length)):yb(kO,!1,s,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},AO=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 s=n[a],i=s[0]==="[",l=t.has(s);i||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(s)):r.push(s)}return r.length>0&&(r.sort(),o.push(...r)),o}},RO=e=>({cache:PO(e.cacheSize),parseClassName:LO(e),sortModifiers:AO(e),postfixLookupClassGroupIds:EO(e),...vO(e)}),EO=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},MO=/\s+/,NO=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:s}=t,i=[],l=e.trim().split(MO),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let y=!!v,C;if(y){let k=h.substring(0,v);C=o(k);let P=C&&s[C]?o(h):void 0;P&&P!==C&&(C=P,y=!1)}else C=o(h);if(!C){if(!y){d=f+(d.length>0?" "+d:d);continue}if(C=o(h),!C){d=f+(d.length>0?" "+d:d);continue}y=!1}let x=m.length===0?"":m.length===1?m[0]:a(m).join(":"),b=g?x+"!":x,w=b+C;if(i.indexOf(w)>-1)continue;i.push(w);let I=r(C,y);for(let k=0;k<I.length;++k){let P=I[k];i.push(b+P)}d=f+(d.length>0?" "+d:d)}return d},_O=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=kb(n))&&(r&&(r+=" "),r+=o);return r},kb=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=kb(e[o]))&&(n&&(n+=" "),n+=t);return n},Cb=(e,...t)=>{let n,o,r,a,s=l=>{let d=t.reduce((c,f)=>f(c),e());return n=RO(d),o=n.cache.get,r=n.cache.set,a=i,i(l)},i=l=>{let d=o(l);if(d)return d;let c=NO(l,n);return r(l,c),c};return a=s,(...l)=>a(_O(...l))},DO=[],kn=e=>{let t=n=>n[e]||DO;return t.isThemeGetter=!0,t},Lb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ab=/^\((?:(\w[\w-]*):)?(.+)\)$/i,OO=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,FO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BO=/\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$/,UO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ka=e=>OO.test(e),pt=e=>!!e&&!Number.isNaN(Number(e)),Lr=e=>!!e&&Number.isInteger(Number(e)),Kg=e=>e.endsWith("%")&&pt(e.slice(0,-1)),na=e=>FO.test(e),Rb=()=>!0,KO=e=>BO.test(e)&&!UO.test(e),Vg=()=>!1,$O=e=>zO.test(e),qO=e=>HO.test(e),VO=e=>!Ne(e)&&!De(e),WO=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)),GO=e=>$a(e,Nb,Vg),Ne=e=>Lb.test(e),Es=e=>$a(e,_b,KO),xb=e=>$a(e,tF,pt),jO=e=>$a(e,Ob,Rb),QO=e=>$a(e,Db,Vg),bb=e=>$a(e,Eb,Vg),XO=e=>$a(e,Mb,qO),Du=e=>$a(e,Fb,$O),De=e=>Ab.test(e),md=e=>Ms(e,_b),YO=e=>Ms(e,Db),Sb=e=>Ms(e,Eb),JO=e=>Ms(e,Nb),ZO=e=>Ms(e,Mb),Ou=e=>Ms(e,Fb,!0),eF=e=>Ms(e,Ob,!0),$a=(e,t,n)=>{let o=Lb.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Ms=(e,t,n=!1)=>{let o=Ab.exec(e);return o?o[1]?t(o[1]):n:!1},Eb=e=>e==="position"||e==="percentage",Mb=e=>e==="image"||e==="url",Nb=e=>e==="length"||e==="size"||e==="bg-size",_b=e=>e==="length",tF=e=>e==="number",Db=e=>e==="family-name",Ob=e=>e==="number"||e==="weight",Fb=e=>e==="shadow";var Ib=()=>{let e=kn("color"),t=kn("font"),n=kn("text"),o=kn("font-weight"),r=kn("tracking"),a=kn("leading"),s=kn("breakpoint"),i=kn("container"),l=kn("spacing"),d=kn("radius"),c=kn("shadow"),f=kn("inset-shadow"),p=kn("text-shadow"),m=kn("drop-shadow"),g=kn("blur"),h=kn("perspective"),v=kn("aspect"),y=kn("ease"),C=kn("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...b(),De,Ne],I=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],P=()=>[De,Ne,l],T=()=>[Ka,"full","auto",...P()],L=()=>[Lr,"none","subgrid",De,Ne],A=()=>["auto",{span:["full",Lr,De,Ne]},Lr,De,Ne],M=()=>[Lr,"auto",De,Ne],R=()=>["auto","min","max","fr",De,Ne],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...P()],F=()=>[Ka,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],J=()=>[Ka,"screen","full","dvw","lvw","svw","min","max","fit",...P()],O=()=>[Ka,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],B=()=>[e,De,Ne],Y=()=>[...b(),Sb,bb,{position:[De,Ne]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",JO,GO,{size:[De,Ne]}],re=()=>[Kg,md,Es],G=()=>["","none","full",d,De,Ne],te=()=>["",pt,md,Es],oe=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[pt,Kg,Sb,bb],fe=()=>["","none",g,De,Ne],Re=()=>["none",pt,De,Ne],Be=()=>["none",pt,De,Ne],Se=()=>[pt,De,Ne],Ee=()=>[Ka,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[na],breakpoint:[na],color:[Rb],container:[na],"drop-shadow":[na],ease:["in","out","in-out"],font:[VO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[na],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[na],shadow:[na],spacing:["px",pt],text:[na],"text-shadow":[na],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ka,Ne,De,v]}],container:["container"],"container-type":[{"@container":["","normal","size",De,Ne]}],"container-named":[WO],columns:[{columns:[pt,Ne,De,i]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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:w()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],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:[Lr,"auto",De,Ne]}],basis:[{basis:[Ka,"full","auto",i,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[pt,Ka,"auto","initial","none",Ne]}],grow:[{grow:["",pt,De,Ne]}],shrink:[{shrink:["",pt,De,Ne]}],order:[{order:[Lr,"first","last","none",De,Ne]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...D(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...D()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mbs:[{mbs:W()}],mbe:[{mbe:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...O()]}],"min-block-size":[{"min-block":["auto",...O()]}],"max-block-size":[{"max-block":["none",...O()]}],w:[{w:[i,"screen",...F()]}],"min-w":[{"min-w":[i,"screen","none",...F()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,md,Es]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,eF,jO]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Kg,Ne]}],"font-family":[{font:[YO,QO,t]}],"font-features":[{"font-features":[Ne]}],"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,De,Ne]}],"line-clamp":[{"line-clamp":[pt,"none",De,xb]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",De,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",De,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[pt,"from-font","auto",De,Es]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[pt,"auto",De,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"tab-size":[{tab:[Lr,De,Ne]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",De,Ne]}],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",De,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Lr,De,Ne],radial:["",De,Ne],conic:[Lr,De,Ne]},ZO,XO]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-bs":[{"border-bs":B()}],"border-color-be":[{"border-be":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[pt,De,Ne]}],"outline-w":[{outline:["",pt,md,Es]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",c,Ou,Du]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,Ou,Du]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[pt,Es]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",p,Ou,Du]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[pt,De,Ne]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[pt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[De,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[pt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",De,Ne]}],filter:[{filter:["","none",De,Ne]}],blur:[{blur:fe()}],brightness:[{brightness:[pt,De,Ne]}],contrast:[{contrast:[pt,De,Ne]}],"drop-shadow":[{"drop-shadow":["","none",m,Ou,Du]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",pt,De,Ne]}],"hue-rotate":[{"hue-rotate":[pt,De,Ne]}],invert:[{invert:["",pt,De,Ne]}],saturate:[{saturate:[pt,De,Ne]}],sepia:[{sepia:["",pt,De,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",De,Ne]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[pt,De,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[pt,De,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",pt,De,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[pt,De,Ne]}],"backdrop-invert":[{"backdrop-invert":["",pt,De,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[pt,De,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[pt,De,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",pt,De,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",De,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[pt,"initial",De,Ne]}],ease:[{ease:["linear","initial",y,De,Ne]}],delay:[{delay:[pt,De,Ne]}],animate:[{animate:["none",C,De,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,De,Ne]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:Re()}],"rotate-x":[{"rotate-x":Re()}],"rotate-y":[{"rotate-y":Re()}],"rotate-z":[{"rotate-z":Re()}],scale:[{scale:Be()}],"scale-x":[{"scale-x":Be()}],"scale-y":[{"scale-y":Be()}],"scale-z":[{"scale-z":Be()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[De,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ee()}],"translate-x":[{"translate-x":Ee()}],"translate-y":[{"translate-y":Ee()}],"translate-z":[{"translate-z":Ee()}],"translate-none":["translate-none"],zoom:[{zoom:[Lr,De,Ne]}],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"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",De,Ne]}],"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":B()}],"scrollbar-track-color":[{"scrollbar-track":B()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",De,Ne]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[pt,md,Es,xb]}],stroke:[{stroke:["none",...B()]}],"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"]}},nF=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(Vi(e,"cacheSize",t),Vi(e,"prefix",n),Vi(e,"experimentalParseClassName",o),Fu(e.theme,a.theme),Fu(e.classGroups,a.classGroups),Fu(e.conflictingClassGroups,a.conflictingClassGroups),Fu(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Vi(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Vi(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Bu(e.theme,r.theme),Bu(e.classGroups,r.classGroups),Bu(e.conflictingClassGroups,r.conflictingClassGroups),Bu(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),$g(e,r,"postfixLookupClassGroups"),$g(e,r,"orderSensitiveModifiers"),e),Vi=(e,t,n)=>{n!==void 0&&(e[t]=n)},Fu=(e,t)=>{if(t)for(let n in t)Vi(e,n,t[n])},Bu=(e,t)=>{if(t)for(let n in t)$g(e,t,n)},$g=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},Bb=(e,...t)=>typeof e=="function"?Cb(Ib,e,...t):Cb(()=>nF(Ib(),e),...t);var oF=Bb({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 K(...e){return oF(hb(e))}le();var Uu=yt(!0);function Ub(){return Ct(Uu)}var Wg=yt(void 0);function Ar(){let e=Ct(Uu);return Ct(Wg)??e}le();var zu=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var zb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Hb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Gg=e=>{let t=Hb(e);return t.charAt(0).toUpperCase()+t.slice(1)};le();var Kb={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 $b=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var qb=Nn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:s,...i},l)=>Me("svg",{ref:l,...Kb,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:zu("lucide",r),...!a&&!$b(i)&&{"aria-hidden":"true"},...i},[...s.map(([d,c])=>Me(d,c)),...Array.isArray(a)?a:[a]]));var se=(e,t)=>{let n=Nn(({className:o,...r},a)=>Me(qb,{ref:a,iconNode:t,className:zu(`lucide-${zb(Gg(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Gg(e),n};var rF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],gd=se("arrow-down",rF);var aF=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],hd=se("arrow-up-right",aF);var sF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],vd=se("arrow-up",sF);var iF=[["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"}]],yd=se("blocks",iF);var lF=[["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"}]],Wi=se("bookmark",lF);var dF=[["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"}]],Ns=se("bot",dF);var cF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],qn=se("check",cF);var uF=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],tn=se("chevron-down",uF);var fF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_s=se("chevron-left",fF);var pF=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Io=se("chevron-right",pF);var mF=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cd=se("chevron-up",mF);var gF=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],xd=se("chevrons-left",gF);var hF=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],bd=se("chevrons-right",hF);var vF=[["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"}]],hn=se("circle-alert",vF);var yF=[["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"}]],Ds=se("copy",yF);var CF=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],zo=se("ellipsis",CF);var xF=[["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"}]],Sd=se("eye",xF);var bF=[["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"}]],Os=se("file-code",bF);var SF=[["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"}]],Fs=se("file-text",SF);var IF=[["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"}]],Id=se("file",IF);var wF=[["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"}]],qa=se("folder",wF);var TF=[["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"}]],wd=se("frame",TF);var PF=[["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"}]],Td=se("git-branch-plus",PF);var kF=[["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"}]],Pd=se("globe",kF);var LF=[["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"}]],kd=se("grip-vertical",LF);var AF=[["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"}]],Ld=se("hammer",AF);var RF=[["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"}]],Bs=se("image",RF);var EF=[["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"}]],oa=se("layers",EF);var MF=[["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"}]],Ad=se("list-ordered",MF);var NF=[["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"}]],Us=se("list-todo",NF);var _F=[["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"}]],Rd=se("list",_F);var DF=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Va=se("loader-circle",DF);var OF=[["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"}]],Wa=se("lock-open",OF);var FF=[["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"}]],Ed=se("lock",FF);var BF=[["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"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ga=se("message-circle-question-mark",BF);var UF=[["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"}]],zs=se("message-circle",UF);var zF=[["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"}]],Hs=se("message-square",zF);var HF=[["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"}]],Md=se("minimize-2",HF);var KF=[["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"}]],Rr=se("mouse-pointer-click",KF);var $F=[["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"}]],Nd=se("package",$F);var qF=[["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"}]],Ks=se("paintbrush",qF);var VF=[["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"}]],no=se("paperclip",VF);var WF=[["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"}]],Er=se("pen-line",WF);var GF=[["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"}]],_d=se("pencil-ruler",GF);var jF=[["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"}]],Dd=se("pencil",jF);var QF=[["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"}]],$s=se("puzzle",QF);var XF=[["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"}]],qs=se("rotate-ccw",XF);var YF=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Vs=se("search",YF);var JF=[["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"}]],Od=se("send",JF);var ZF=[["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"}]],Fd=se("settings",ZF);var e2=[["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"}]],Gi=se("sliders-horizontal",e2);var t2=[["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"}]],ja=se("sparkles",t2);var n2=[["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"}]],mo=se("square-pen",n2);var o2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Bd=se("square",o2);var r2=[["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"}]],Ws=se("star",r2);var a2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],wo=se("terminal",a2);var s2=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],ra=se("text-quote",s2);var i2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Mr=se("user-round",i2);var l2=[["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"}]],Ud=se("wrench",l2);var d2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xt=se("x",d2);var c2=[["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"}]],Gs=se("zap",c2);le();function pe(){return{t:Uo().i18n.usePluginTranslation()}}le();le();var ji=yt(null),zd=yt(null);function Hu(e,t){let n=Ct(zd);xe(()=>{if(!(!t||e===null||n===null))return n(e)},[n,t,e])}function Hd(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,n)=>{e.set(t,(e.get(t)??0)+1),n();let o=!0;return()=>{if(!o)return;o=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),n()}}}}var Vb=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function he(e){let t=Vb.has(e),n=o=>{let r=Uo(),a=Mu(),s=Ar(),i=r.ui[e],l={};if(t){let d=Ct(ji),[c,f]=Q(o.defaultOpen===!0),p=typeof o.open=="boolean"?o.open:c;Hu(d,s&&p),xe(()=>{s||f(!1)},[s]),l={open:s&&p,onOpenChange:(m,...g)=>{f(m),typeof o.onOpenChange=="function"&&o.onOpenChange(m,...g)}}}return Me(i,{...o,...l,...Vb.has(e)&&!s?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var cY=he("useLinkContextMenu"),nr=he("ProviderInstanceIcon"),Wb=he("UserAvatar"),Nr=he("Badge"),ce=he("Button"),uY=he("Label"),Qi=he("Input"),Gb=he("Textarea"),fY=he("Switch"),pY=he("Separator"),mY=he("Skeleton"),Ku=he("Spinner"),gY=he("ScrollArea"),hY=he("Card"),vY=he("CardAction"),yY=he("CardContent"),CY=he("CardDescription"),xY=he("CardFooter"),bY=he("CardHeader"),SY=he("CardTitle"),IY=he("Empty"),wY=he("EmptyContent"),TY=he("EmptyDescription"),PY=he("EmptyHeader"),kY=he("EmptyMedia"),LY=he("EmptyTitle"),AY=he("InputGroup"),RY=he("InputGroupAddon"),EY=he("InputGroupInput"),MY=he("DocumentPanel"),NY=he("MasterDetail"),$u=he("Select"),_Y=he("SelectContent"),qu=he("SelectItem"),Vu=he("SelectPopup"),jb=he("SelectTrigger"),Wu=he("SelectValue"),Kd=he("Toggle"),Qb=he("ToggleGroup"),Gu=he("AlertDialog"),ju=he("AlertDialogClose"),Qu=he("AlertDialogDescription"),Xu=he("AlertDialogFooter"),Yu=he("AlertDialogHeader"),Ju=he("AlertDialogPopup"),Zu=he("AlertDialogTitle"),ef=he("Dialog"),DY=he("DialogClose"),tf=he("DialogDescription"),nf=he("DialogFooter"),of=he("DialogHeader"),rf=he("DialogPopup"),Xb=he("DialogPanel"),af=he("DialogTitle"),OY=he("DialogTrigger"),FY=he("DropdownMenu"),BY=he("DropdownMenuContent"),UY=he("DropdownMenuItem"),zY=he("DropdownMenuTrigger"),go=he("Menu"),Xi=he("MenuGroup"),Yb=he("MenuGroupLabel"),Ho=he("MenuItem"),ho=he("MenuPopup"),or=he("MenuRadioGroup"),To=he("MenuRadioItem"),aa=he("MenuSeparator"),vo=he("MenuTrigger"),Qa=he("Popover"),Xa=he("PopoverPopup"),Ya=he("PopoverTrigger"),Jb=he("Table"),Zb=he("TableBody"),Ja=he("TableCell"),js=he("TableHead"),eS=he("TableHeader"),sf=he("TableRow"),Qe=he("Tooltip"),Xe=he("TooltipPopup"),Ye=he("TooltipTrigger"),tS=he("Collapsible"),nS=he("CollapsiblePanel"),oS=he("CollapsibleTrigger"),$d=he("Alert"),qd=he("AlertAction"),lf=he("AlertDescription"),jg=he("AlertTitle"),df=he("Kbd"),cf=he("Command"),uf=he("CommandGroup"),ff=he("CommandItem"),pf=he("CommandList"),rS=he("Combobox"),aS=he("ComboboxEmpty"),sS=he("ComboboxInput"),Yi=he("ComboboxItem"),iS=he("ComboboxListVirtualized"),lS=he("TooltipProvider"),dS=he("StyledDiffCodeView"),cS=he("DevBackdropArt"),Ko=he("Markdown"),uS=he("DiffView");var{jsx:u,jsxs:S,Fragment:Ie}=window.__ycodiumPluginHost.jsxRuntime;function fS({mode:e,onModeChange:t}){let{t:n}=pe();return S(Qb,{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:[S(Kd,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(Hs,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),S(Kd,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(Ad,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function pS({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(Wg,{value:t,children:r==="chat"?n:o})})}le();function Vn(){return{t:Uo().i18n.usePluginTranslation()}}function mS(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 s=r.toFixed(a);if(Number.parseFloat(s)<100)return`${s}%`}return"99.9%"}function gS(e){let t,n,o,r=!0,a=!1;for(let s of e)s!==void 0&&(a=!0,s.cacheDisjoint!==!0&&(r=!1),s.outputTokens!==void 0&&(t=(t??0)+s.outputTokens),s.inputTokens!==void 0&&(n=(n??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(o=(o??0)+s.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 Vd(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 u2=ye(function({item:t,ordinal:n,usage:o,onSelect:r}){return S("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}),S("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?S("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:Vd(o.outputTokens)}):null]}):null]})]})});function f2({totals:e}){let{t}=Vn();if(!e)return null;let n=mS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:Vd(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:Vd(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?Vd(e.cachedInputTokens):`${Vd(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:S("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=>S("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var p2=ye(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=Vn(),s=Uo().writeClipboard,[i,l]=Q(!1),d=a("turnNavigator.copyMarkdown");return S(Qe,{children:[u(Ye,{render:u(ce,{"aria-label":d,disabled:i,onClick:()=>{s(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:i?u(qn,{className:"size-3 text-primary"}):u(Ds,{className:"size-3"})}),u(Xe,{children:u("p",{children:d})})]})});function hS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float"}){let{t:l}=Vn(),[d,c]=Q(!1),f=V(()=>e.map((h,v)=>({item:h,ordinal:v+1})).reverse(),[e]),p=V(()=>gS(f.map(({item:h})=>h.turnId===null?void 0:o.get(h.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,g=l("turnNavigator.open",{count:m});return S(Qa,{onOpenChange:c,open:d,children:[S(Ya,{render:u(ce,{"aria-label":g,className:K("gap-1.5 rounded-full px-3",i==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:i==="float"?{bottom:n+12}:void 0,title:g,variant:"glass"}),children:[u(Rd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(Xa,{align:"end",className:"w-80 flex-col",side:"top",children:S("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[S("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:K("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:h,ordinal:v})=>u(u2,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u(f2,{totals:p}),S("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(p2,{size:"icon-xs",getText:a,variant:"ghost"}),u(ce,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(ce,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}le();function Wd(e){return e.replace(/\s+/g," ")}function m2(e,t){let n=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(n)&&(n=n.slice(1)),n}function g2(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)&&(n=n.slice(0,-1)),n}function mf(e){let n=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return n?.closest('[data-message-role="assistant"]')?n:null}function vS(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),n=mf(t.startContainer);if(n===null||mf(t.endContainer)!==n)return null;let o=n.closest("[data-message-id]")?.dataset.messageId;if(!o)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(n),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(n),s.setStart(t.endContainer,t.endOffset);let i=Wd(t.toString()),l=i.length>i.trimStart().length?" ":"",d=i.length>i.trimEnd().length?" ":"",c=Wd(a.toString()+l),f=Wd(d+s.toString()),p=c.length,m=p+i.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),v=g[g.length-1]??h;return{messageId:o,text:r,start:p,end:m,prefix:m2(c,32),suffix:g2(f,32),anchor:{x:v.right,top:h.top,bottom:v.bottom}}}var gf="assistant-quote-inserter",hf="assistant-quote-open-comment";le();var CS=100,h2=new Map,yS=new Map,vf=e=>typeof e=="function"?e():e,xS=(e,t)=>typeof t=="function"?t(e):t;function v2(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 y2(e,t){let n=yS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},yS.set(e,n)),n}function C2(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 Qg(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function bS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:vf(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function Gd(e){queueMicrotask(()=>C2(e))}function Ft(e,t,n,o=CS){let r=Math.max(1,o),a=v2(h2,e,r),s=bS(a,t,n),i=E(f=>s.alive?(a.limit=r,s.committed=!0,Qg(a,t,s),s.leases+=1,s.subscribers.add(f),Gd(a),()=>{s.subscribers.delete(f),s.leases=Math.max(0,s.leases-1),Gd(a)}):()=>{},[r,s,a,t]),l=E(()=>s.value,[s]),d=So(i,l,l),c=E(f=>{if(!s.alive||a.values.get(t)!==s)return;let p=s.value,m=xS(p,f);if(!Object.is(m,p)){s.value=m,Qg(a,t,s);for(let g of s.subscribers)g();Gd(a)}},[s,a,t]);return[d,c]}function SS(e,t){let n=N(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:vf(t)});let[,o]=ea(a=>a+1,0),r=E(a=>{let s=n.current;if(s===null||s.key!==e)return;let i=xS(s.value,a);Object.is(i,s.value)||(s.value=i,o())},[e]);return[n.current.value,r]}function xt(e,t,n,o=CS){let r=Math.max(1,o),a=y2(e,r),s=bS(a,t,()=>({current:vf(n)}));return q(()=>{if(!(!s.alive||a.values.get(t)!==s))return a.limit=r,s.committed=!0,Qg(a,t,s),s.leases+=1,Gd(a),()=>{s.leases=Math.max(0,s.leases-1),Gd(a)}},[r,s,a,t]),s.value}function rr(e,t){let n=N(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:vf(t)}}),n.current.ref}var x2=300;function IS(e){let{data:t,target:n,threadKey:o,surfaceRef:r}=e,{t:a}=pe(),s=xt(gf,o,null),[,i]=Ft(hf,o,null),[l,d]=Q(null),c=N(null);if(q(()=>{let h,v=()=>{let I=r.current,k=document.getSelection(),P=k&&k.rangeCount>0?k.getRangeAt(0):null;if(!I||!P||!I.contains(P.commonAncestorContainer)){d(null);return}let T=vS(k);if(T===null){d(null);return}let L=t.assistantQuotes.serialize({version:1,environmentId:n.environmentId,threadId:n.threadId,messageId:T.messageId,text:T.text,start:T.start,end:T.end,prefix:T.prefix,suffix:T.suffix});d({source:L,...T.anchor})},y=I=>{c.current?.contains(I.target)||(clearTimeout(h),h=setTimeout(v,x2))},C=I=>{c.current?.contains(I.target)||(clearTimeout(h),d(null))},x=()=>d(null),b=I=>{I.key==="Escape"&&d(null)},w=()=>{(document.getSelection()?.isCollapsed??!0)&&d(null)};return document.addEventListener("pointerup",y,!0),document.addEventListener("keyup",y,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",b,!0),document.addEventListener("selectionchange",w),window.addEventListener("scroll",x,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",y,!0),document.removeEventListener("keyup",y,!0),document.removeEventListener("pointerdown",C,!0),document.removeEventListener("keydown",b,!0),document.removeEventListener("selectionchange",w),window.removeEventListener("scroll",x,!0)}},[t,r,n.environmentId,n.threadId]),l===null)return null;let f=l.source,p=Math.max(8,Math.min(window.innerWidth-200,l.x-12)),m=l.bottom+6,g=m+40<=window.innerHeight?m:Math.max(8,l.top-40);return u("div",{ref:c,className:"fixed z-50",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:S(ce,{size:"sm",variant:"outline",className:"shadow-md",disabled:f===null,title:f===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{f!==null&&s.current?.(f)===!0&&(i(f),document.getSelection()?.removeAllRanges(),d(null))},children:[u(ra,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}le();le();function b2(e){return e!==null&&"tagName"in e&&"closest"in e}function Za(e){return b2(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function Xg(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function wS(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function TS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return wS(t,"accept");case"Escape":return wS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=Xg(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}le();var Ji=new Map,PS=24,S2=4e3,I2=1024,kS=16384;function Yg(e){let t=Ji.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(Ji.set(e,n),Ji.size>PS){for(let[o,r]of Ji)if(r.listeners.size===0&&o!==e&&(Ji.delete(o),Ji.size<=PS))break}return n}function Jg(e,t,n){return Yg(e).values.get(t)??n}function jd(e,t,n,o=!0){let r=Yg(e);if(typeof n=="string"&&(n=n.slice(0,I2)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>kS){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=kS))break}if(r.values.size>S2){let s=r.values.keys().next().value;if(s!==void 0){let i=r.values.get(s);typeof i=="string"&&(r.stringLength-=i.length),r.values.delete(s)}}o&&r.listeners.forEach(s=>s())}function Po(e,t,n){let o=E(i=>{let l=Yg(e);return l.listeners.add(i),()=>l.listeners.delete(i)},[e]),r=E(()=>Jg(e,t,n),[e,t,n]),a=So(o,r,r),s=E(i=>jd(e,t,i),[e,t]);return[a,s]}function yf(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function LS(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function Cf({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let c=e.bySectionKey.get(d)?.turnId;return c==null?[]:[c]}),a=n.flatMap(d=>{let c=e.byRowId.get(d)?.turnId;return c==null?[]:[c]}),s=o?e.byRowId.get(o.firstRowId)?.index:void 0,i=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=s===void 0||i===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(s,i)&&d.firstRowIndex<=Math.max(s,i)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function AS(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}le();le();function Zg(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function Qs(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,o=a):n=a+1}return r}function w2(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Qs(s,t),l=i<0?void 0:s[i],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=Qs(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let s=o(n[a]);if(s)return s}return null}function RS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var eh=class extends Zr{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function ES({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let l=N(null),d=N({inputKey:e,store:Hd()});d.current.inputKey!==e&&(d.current={inputKey:e,store:Hd()});let c=N(i);c.current=i;let f=E(m=>{let g=d.current;return g.store.acquire(m,()=>{d.current===g&&c.current?.(g.store.rows())})},[]);xe(()=>{i?.(d.current.store.rows())},[e,i]),Bo(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:g=>{let h=Zg(m,g);return h===null?null:RS(h,m)},heightOf:g=>{let h=Zg(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>w2(m)}:null},scrollToEnd:m=>{let g=l.current;if(g){if(m?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(m,g)=>{let h=l.current;if(!h)return!1;let v=Zg(h,m);return v?(h.scrollTop=Math.max(0,RS(v,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let g=l.current;g&&(g.scrollTop=Math.max(0,m))}}),[]);let p=E(m=>{l.current=m,o(m)},[o]);return u(eh,{inputKey:e,onBeforeInputChange:t,children:u(zd,{value:f,children:u("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function el(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function Zi(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function xf(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let c=t.getRangeAt(d);c.intersectsNode(e)&&(n??=c,o=c)}if(!n||!o)return null;let r=Zi(n.startContainer,e),a=Zi(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,l=s[s.length-1]?.dataset.timelineRowId;return i&&l?{firstRowId:r??i,lastRowId:a??l}:null}function Qd(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}le();function es(e){let t=N(e);t.current=e;let n=N(!1),o=N(null),r=N(null),a=N(0),s=E(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=E(()=>{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=E(c=>{o.current=c,i()},[i]),d=E(()=>{o.current=null,s()},[s]);return xe(()=>(n.current=!0,i(),()=>{n.current=!1,s()}),[e,s,i]),V(()=>({request:l,cancel:d}),[l,d])}function MS({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l}){let d=N({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l};let c=es(n),f=N(null),p=E(()=>{let g=d.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let v=h.top+g.topInset,y=h.bottom-g.bottomInset,C=e.querySelectorAll("[data-timeline-turn-section]"),x=Qs(C,v),b=[];if(x>=0)for(let T=x;T<C.length;T+=1){let L=C[T];if(L.getBoundingClientRect().top>=y)break;L.dataset.timelineTurnSection!==void 0&&b.push(L.dataset.timelineTurnSection)}let w=[...g.interactionRows()],I=e.ownerDocument.activeElement;if(el(I)){let T=Zi(I,e);T&&w.push(T)}let k=Cf({index:g.index,visibleSectionKeys:b,protectedRowIds:w,selectionRows:xf(e)}),P=`${g.inputKey}:${JSON.stringify(k)}`;P!==f.current&&(f.current=P,g.onRangeChange?.(k))},[e]),m=E(()=>c.request(p),[c,p]);return xe(()=>{if(f.current=null,!n||!e)return;let g=t,h=!0,v=()=>{!h||d.current.inputKey!==g||!d.current.visible||(d.current.onSelectionChange(Qd(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let y=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return y?.observe(e),e.firstElementChild&&y?.observe(e.firstElementChild),v(),()=>{h=!1,c.cancel(),y?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),i?.(null)}},[c,t,i,m,e,n]),xe(()=>{n&&m()},[o,m,n]),m}le();function sa(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let s=Math.round(e/100)/10;return s>=10?"10s":`${s.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];return n>0&&a.push(`${n}h`),o>0&&a.push(`${o}m`),r>0&&a.push(`${r}s`),a.join(" ")}function T2(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function P2(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function k2(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var th=P2(k2()),NS=new Map;function _S(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=NS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(th,T2(e,t));return NS.set(n,r),r}function nh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var L2=new Intl.DateTimeFormat(void 0,{month:"long"});function A2(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 R2(e,t){let n=nh(e);return n?_S(t,!1).format(n):""}function ts(e,t){let n=nh(e);if(!n)return"";let o=R2(e,t),r=n.getDate(),a=L2.format(n),s=n.getFullYear();return`${o}, ${r}${A2(r)} ${a} ${s}`}var E2=new Intl.DateTimeFormat(th,{month:"numeric",day:"numeric"}),M2=new Intl.DateTimeFormat(th,{month:"numeric",day:"numeric",year:"numeric"});function ns(e,t,n,o=Date.now()){let r=nh(e);if(!r)return"";let a=_S(t,!1).format(r),s=new Date(o),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((i-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===s.getFullYear()?E2:M2).format(r)} ${a}`}le();le();var tl=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function N2(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function _2(e,t){let n=()=>new tl("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(N2(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new tl("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function bf({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=Q(!1),s=N(null),i=N(n),l=N(o),d=N(t),c=N(e);i.current=n,l.current=o,d.current=t,c.current=e;let f=E((p,m)=>{_2(p,d.current).then(g=>{g&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(m),c.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},c.current)))},g=>{l.current?.(g instanceof Error?g:new Error(String(g)),m)})},[]);return q(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:f,isCopied:r}}function dt(){let e=Uo().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var DS=1e3,D2={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function O2({title:e,description:t}){return S("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 nl=ye(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:s}=dt(),i=N(null),[l,d]=Q(null),c=N(null),f=(g,h)=>{let v=i.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(h===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:g,description:h}),c.current=setTimeout(()=>d(null),DS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=bf({onCopy:()=>f(s("copyButton.copied")),onError:g=>f(s("copyButton.failedToCopy"),g instanceof tl?s(D2[g.reason]):g.message),timeout:DS});return S(Qe,{children:[u(Ye,{render:u(ce,{"aria-label":s("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:i,type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:m?u(qn,{className:"size-3 text-primary"}):u(Ds,{className:"size-3"})}),u(Xe,{children:u("p",{children:s("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(O2,{title:l.title,description:l.description})})}):null]})});function F2(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 Sf({label:e,children:t}){let[n,o]=Q(!1);return S(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 OS=ye(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=dt(),a=t.state,s=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return S("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[S("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?S(Sf,{label:s,children:[a==="completed"?u(qn,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(Xt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Bd,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:s})]}):null,t.completedAt?u(Sf,{label:ts(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:ns(t.completedAt,n,r)})}):null,t.workingElapsedMs!==void 0?S(Sf,{label:r("timeline.workingTime",{duration:sa(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),sa(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?S(Sf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),F2(t.outputTokens)]}):null]}),o?u(nl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});le();le();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 BS=ye(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:s="aligned"}=t,{t:i}=dt(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([i("changedFiles.additions",{count:n}),i("changedFiles.deletions",{count:o})]);return S(Ie,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),S("span",{role:"group","aria-label":l,className:K(s==="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:[S("span",{"aria-hidden":"true",className:"font-mono text-diff-addition",children:["+",FS(n)]}),S("span",{"aria-hidden":"true",className:"font-mono text-diff-deletion",children:["-",FS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function B2(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 US(e){return e.replaceAll("\\","/")}function zS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function U2(e){return e.replace(/[\\/]+$/,"")}function z2(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function H2(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function K2(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function If(e,t){let{path:n,line:o,column:r}=B2(e),a=zS(US(n)),s=a;if(t){let i=zS(US(U2(t))),l=z2(i),d=a.toLowerCase(),c=i.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)s=l;else if(d.startsWith(f)){let m=a.slice(i.length+1);s=`${l}/${m}`}else if(!K2(a)){let m=H2(a);s=d.startsWith(p)?a:`${l}/${m}`}}return o?`${s}:${o}${r?`:${r}`:""}`:s}function HS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function KS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var wf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function Xd({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function Yd({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:K("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Tf({state:e,variant:t="inline",className:n,children:o}){return S("div",{"data-process-state":e,"data-process-kind":t,className:K("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]})}function Jd({name:e,className:t}){switch(e){case"bot":return u(Ns,{className:t,"aria-hidden":!0});case"check":return u(qn,{className:t,"aria-hidden":!0});case"circle-alert":return u(hn,{className:t,"aria-hidden":!0});case"eye":return u(Sd,{className:t,"aria-hidden":!0});case"globe":return u(Pd,{className:t,"aria-hidden":!0});case"hammer":return u(Ld,{className:t,"aria-hidden":!0});case"message-circle":return u(zs,{className:t,"aria-hidden":!0});case"search":return u(Vs,{className:t,"aria-hidden":!0});case"square-pen":return u(mo,{className:t,"aria-hidden":!0});case"terminal":return u(wo,{className:t,"aria-hidden":!0});case"wrench":return u(Ud,{className:t,"aria-hidden":!0});case"x":return u(Xt,{className:t,"aria-hidden":!0});case"zap":return u(Gs,{className:t,"aria-hidden":!0})}}function $2(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 oh(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:$2(o),count:r}))}function rh(e,t){let n;for(let o of oh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var ol=20;function rl(e){return yf(e)}function $S(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,s=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,i=o?.name??s??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?If(l,t):void 0,c=[i.trim().toLowerCase()==="tool"?void 0:i,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(g=>g.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function qS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||ah(e)?null:u(BS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function ah(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function VS({toolIcon:e,glyphClassName:t}){let n=Ct(rn),o=n.SiteIcon;return e.pageUrl!==void 0&&o!==void 0?u(o,{threadRef:n.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):u(Jd,{name:"globe",className:t})}function q2({entry:e,failed:t=!1,derive:n}){return t?u(hn,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):e.toolIcon!==void 0?u(VS,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):u(Jd,{name:rh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function V2({entries:e,failed:t,derive:n}){let{t:o}=dt(),r=V(()=>oh(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:s,icon:i,count:l})=>S("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u(Jd,{name:i,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},s))})}function WS({entry:e}){let t=Ct(rn),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(Ie,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var W2=ye(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,i=Ct(rn).derive,{t:l}=dt(),[d,c]=Po(o,`call:${rl(n)}`,!1),f=i.workEntryIndicatesFailure(n),p=ah(n),m=i.resolveWorkEntryStatus(n),g=m==="failed"||m==="running"?m:null,h=kr();return S("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":rl(n),className:"border-b border-border/50 last:border-b-0",children:[S("button",{type:"button","aria-expanded":d,"aria-controls":h,onClick:()=>{a?.(),c(!d)},className:K("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(Yd,{status:g}),u(Xd,{children:u(q2,{entry:n,failed:f,derive:i})}),S("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:$S(n,r,i)??l("toolGroup.calls",{count:1})}),u(qS,{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(tn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u(WS,{entry:n})}):null]})});function G2({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=N(null);return xe(()=>{let a=r.current;if(!a)return;a.scrollTop=Jg(e,`${t}:scroll`,0);let s=()=>{jd(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",s,{passive:!0}),()=>a.removeEventListener("scroll",s)},[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 GS=ye(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let i=Ct(rn).derive,{t:l}=dt(),[d,c]=Po(o,`group:${n}`,!1),[f,p]=Po(o,`group-page:${n}`,0),m=kr(),g=N(null),[h,v]=Q(null),y=t.at(-1),C=V(()=>t.filter(F=>i.workEntryIndicatesFailure(F)),[t,i]),x=V(()=>t.filter(ah),[t]),b=t.filter(F=>F.toolLifecycleStatus==="inProgress").length,w=C[0]??x[0],I=w??y,k=Math.max(0,Math.ceil(t.length/ol)-1),P=Math.min(f,k),T=P*ol,L=t.slice(T,T+ol),A=t.length>1;if(xe(()=>{if(!h)return;let F=g.current,J=Array.from(F?.querySelectorAll("[data-tool-identity]")??[]).find(B=>B.dataset.toolIdentity===h.id);if(!J)return;let O=J.closest('[data-slot="scroll-area-viewport"]');O&&(O.scrollTop+=J.getBoundingClientRect().top-O.getBoundingClientRect().top),J.querySelector("button")?.focus({preventScroll:!0})},[h]),!y||!I)return null;let M=F=>{a?.(),p(F)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},D=KS(t.map(F=>HS(i.resolveWorkEntryStatus(F)))),H=rh(t,i.toolGroupAction),W=D==="failed"?"failed":D==="running"?"running":"success";return u(Tf,{state:D,variant:"tool",children:S("section",{ref:g,"data-tool-group-id":n,className:"min-w-0",children:[S("div",{className:"flex min-w-0 items-center",children:[S("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!A&&!d&&jd(o,`call:${rl(y)}`,!0)},className:K(wf,"flex-1",w?"text-destructive":"text-muted-foreground"),children:[u(Yd,{status:W}),u(Xd,{children:!A&&y.toolIcon!==void 0&&C.length===0?u(VS,{toolIcon:y.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):u(Jd,{name:H,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",C.length>0?"text-destructive":"text-icon-muted")})}),S("span",{className:K("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}):$S(I,r,i)??l("toolGroup.calls",{count:1})}),d&&A?null:u(qS,{entry:I,failed:i.workEntryIndicatesFailure(I)})]}),b>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:b})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:C.length})}):null,x.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:x.length})}):null,d&&A?null:u(V2,{entries:t,failed:C.length>0,derive:i}),u(tn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),w&&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(w)/ol)),jd(o,`call:${rl(w)}`,!0),v({id:rl(w)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:A?S(Ie,{children:[t.length>ol?S("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+ol,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:P===0,Icon:xd},{label:l("toolGroup.previousPage"),target:P-1,disabled:P===0,Icon:_s},{label:l("toolGroup.nextPage"),target:P+1,disabled:P===k,Icon:Io},{label:l("toolGroup.lastPage"),target:k,disabled:P===k,Icon:bd}].map(({label:F,target:J,disabled:O,Icon:B})=>u("button",{type:"button","aria-label":F,disabled:O,onClick:()=>M(J),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(B,{"aria-hidden":!0,className:"size-icon-1"})},F))]}):null,u(G2,{threadKey:o,stateKey:`group-scroll:${n}:${P}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:L.map(F=>u(W2,{entry:F,...R},rl(F)))})})]}):u(WS,{entry:y})}):null]})})});function j2(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 jS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,s=!0,i=null,l=()=>{if(i=null,!s||!n.isConnected||!t.contains(n))return;let f=j2(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{s&&i===null&&(i=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{s=!1,c?.disconnect(),i!==null&&cancelAnimationFrame(i),i=null}}}le();var QS=ye(function({sectionKey:t,rowKeyPrefix:n,rowIds:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(s=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${n}:${s}`))})});function Q2(e,t,n){for(let o=t;o<n;o+=1){let r=e[o];switch(r.kind){case"turn-identity":return r.turnId;case"working":return r.turnId??null;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!==void 0)return r.entries[0].turnId??null;break;case"work":if(r.groupedEntries[0]?.turnId!==void 0)return r.groupedEntries[0].turnId??null;break;case"turn-plan":return r.turnPlan.turnId;case"proposed-plan":return r.proposedPlan.turnId;case"turn-summary":return r.footer.turnId}}return null}function XS(e,t,n=[]){let o=new Map(n.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let s=Q2(e,a.start,a.end),i=o.get(a.key);if(i!==void 0&&i.turnId===s&&X2(i,e,a.start,a.end)){r.push(i);continue}r.push({key:a.key,turnId:s,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(l=>l.id)})}return r}function X2(e,t,n,o){if(e.firstRowIndex!==n||e.rowIds.length!==o-n)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[n+r].id)return!1;return!0}function YS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function al(e,t,n){let o=e.findIndex(r=>r.rowIds.includes(t));return o<0?n:Math.max(n,e.length-o)}le();var Xs=3,sh=Xs;function JS(e){let[t,n]=Ft("timeline-reveal-window",e,Xs),o=E(()=>{n(i=>i+sh)},[n]),r=E(i=>{n(l=>i>l?i:l)},[n]),a=E(()=>{n(Xs)},[n]),s=E(i=>{n(l=>Math.min(l,Math.max(Xs,i)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:s,reset:a}}function ZS(e,t){return t.prefixMounted?"mounted":t.loading===null||t.now>e.until?"abandoned":t.loading?(e.loadingObserved=!0,e.sectionsWhileLoading=t.sections,"waiting"):e.loadingObserved?t.sections===e.sectionsWhileLoading?"waiting":"landed":"waiting"}function Y2(e,t){let n=d=>d.replace(/\s+/g,""),o=n(t.text);if(o.length===0)return null;let r=(d,c)=>e.slice(Math.max(0,d-t.prefix.length),d)===t.prefix&&e.slice(c,c+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&n(e.slice(t.start,t.end))===o&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Wd(t.text).trim(),s=[];for(let d=e.indexOf(a);d>=0;d=e.indexOf(a,d+1))s.push(d);let i=s.filter(d=>r(d,d+a.length)),l=i.length===1?i[0]:i.length===0&&s.length===1?s[0]:null;return l===null?null:{start:l,end:l+a.length}}function tI(e,t){let n=e.querySelector("[data-assistant-quote-body]")??mf(e);if(n===null)return null;let o=[],r="",a=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let c=a.nextNode();c;c=a.nextNode()){let f=c.data;for(let p=0;p<f.length;p+=1){let m=/\s/.test(f[p]);m&&r.endsWith(" ")||(r+=m?" ":f[p],o.push({node:c,offset:p}))}}let s=Y2(r,t);if(s===null)return null;let i=o[s.start],l=o[s.end-1];if(!i||!l)return null;let d=document.createRange();return d.setStart(i.node,i.offset),d.setEnd(l.node,l.offset+1),d}var ih="assistant-quote",eI=2400;function nI(e){let t=globalThis.CSS?.highlights,n=globalThis.Highlight;if(t&&n){let r=new n(e);t.set(ih,r),setTimeout(()=>{t.get(ih)===r&&t.delete(ih)},eI);return}let o=document.getSelection();o&&(o.removeAllRanges(),o.addRange(e),setTimeout(()=>{let r=o.rangeCount>0?o.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&o.removeAllRanges()},eI))}var J2=400;function oI({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,s=new Set,i,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,c=()=>{if(i=void 0,a.hidden||s.size>0||!o()||e.clientHeight<=0||!d()||Qd(e))return;let b=e.querySelectorAll("[data-timeline-turn-section]"),w=e.getBoundingClientRect().top-32-n,I=0,k=Math.max(0,b.length-t);for(;I<k;){let T=Math.floor((I+k)/2),L=b[T].getBoundingClientRect().bottom;if(!Number.isFinite(L))return;L<=w?I=T+1:k=T}if(I===0)return;let P=a.activeElement;if(P&&el(P)){for(let T=0;T<I;T+=1)if(b[T].contains(P))return}r(b.length-I)},f=!1,p=()=>{if(a.hidden||s.size>0||!o()||f){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(c,J2))},m=()=>{clearTimeout(i),i=void 0,p()},g=()=>{let b=d();!b||!l?m():p(),l=b},h=b=>{s.add(b.pointerId),m()},v=b=>{s.delete(b.pointerId),m()},y=()=>{f=Qd(e),m()},C=()=>{s.clear(),m()},x=["wheel","keydown","focusin","focusout"];for(let b of x)e.addEventListener(b,m,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",y),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",C),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let b of x)e.removeEventListener(b,m);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",y),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",C)}}}le();function rI({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=N(o);r.current=o;let a=es(o),s=N(new Map),i=N(null),l=N(null),d=N(n);d.current=n;let c=E(()=>{if(!r.current||!e)return;let h=e.scrollTop+t,v=null,y=Number.NEGATIVE_INFINITY,C=null,x=Number.POSITIVE_INFINITY;for(let[w,I]of s.current){if(!I.isConnected)continue;let k=I.offsetTop;k<x&&(x=k,C=w),k<=h&&k>=y&&(y=k,v=w)}let b=v??C;b!==l.current&&(l.current=b,d.current(b))},[e,t]),f=E(()=>{r.current&&a.request(c)},[a,c]);q(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let h=!0,v=new IntersectionObserver(()=>{!h||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});i.current=v;for(let y of s.current.values())v.observe(y);return f(),()=>{h=!1,v.disconnect(),i.current=null,a.cancel()}},[o,a,f,e,t]);let p=N(new Map),m=E(h=>{let v=p.current.get(h);if(v)return v;let y=C=>{let x=s.current.get(h);x&&x!==C&&(i.current?.unobserve(x),s.current.delete(h)),C?(s.current.set(h,C),i.current?.observe(C)):p.current.get(h)===y&&p.current.delete(h)};return p.current.set(h,y),y},[]),g=E(()=>{r.current&&(l.current=null,f())},[f]);return V(()=>({observeSection:m,refresh:g}),[m,g])}function Zd(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=i=>{let l=e.indexOf(i);return l<0?null:[e.slice(0,l),e.slice(l+i.length)]},s=a(o)??a(r);return s===null?S(Ie,{children:[e,t]}):S(Ie,{children:[s[0],t,s[1]]})}le();function aI(e){return So(e.subscribe,e.getStructure,e.getStructure)}function sI(e,t){let n=E(r=>e.subscribeRow(t,r),[e,t]),o=E(()=>e.getRow(t),[e,t]);return So(n,o,o)}function os(e,t,n=Object.is){let o=N(null),r=E(()=>{let a=e.getVersion(),s=o.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),l=s!==null&&s.store===e&&n(s.value,i)?s.value:i;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return So(e.subscribe,r,r)}le();function lh(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 rs(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||Z2.has(t)?"text":"file"}var Z2=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function iI(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 eB="<ycodium-system>";function Pf(e){return e.startsWith(eB)}var tB=/[ \t]*\(record [^\s()]+\)/g,nB=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function dh(e){return Pf(e)?e.split(`
3746
+ `).filter(t=>!nB.test(t.trim())).join(`
3747
+ `).replace(tB,""):e}var oB=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function lI(e){let t=e.match(oB);return t&&t.length>0?t:[e]}function dI(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 cI(e){switch(e){case"image":return Bs;case"pdf":return Fs;case"text":return Os;case"file":return no}}var rB=[".m4v",".mov",".mp4",".ogv",".webm"],aB=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function uI(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return rB.includes(n)?"video":aB.includes(n)?"audio":null}var sB=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function ec(e){let t=sB.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=iB(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function iB(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3797
3748
  `).trimEnd()}),n=null)};for(let r of e.split(`
3798
- `)){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 mB=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function fh(e){let t=mB.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3799
- `),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),s=o.find(p=>p.startsWith("Comment: ")),i=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:s?.slice(9).trim()||"",targetSummary:i?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var gB=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,hB=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,vB=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function yB(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function CB(e){let t={};for(let n of e.matchAll(hB))t[n[1]]=yB(n[2]??"");return t}function gI(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function xB(e){let n=Array.from(e.matchAll(vB)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function bB(e,t,n){let o=CB(e),r=gI(o.startIndex),a=gI(o.endIndex),s=o.filePath?.trim(),i=o.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let l=xB(t);return{id:`review-comment:${n}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:o.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||null,text:l.text,diff:l.contents,fenceLanguage:l.language}}function ph(e){let t=[],n=0,o=0;for(let a of e.matchAll(gB)){let s=a.index??0,i=e.slice(n,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:i});let l=bB(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),n=s+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 hI(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(`
3800
- `)}function vI(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(`
3801
- `)}var SB="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",IB=`${SB} border border-border/70 bg-accent/40 text-foreground`,Lf=`${IB} text-[12px]`,Af="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Rf="truncate leading-tight",yI='<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 wB=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function TB(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function PB(e){let t=e.displayName?.trim();return t||TB(e.name)}function CI(e){let t=[],n=0;for(let o of e.text.matchAll(wB)){let r=o[1]??"",a=o[2]??"",s=(o.index??0)+r.length,i=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(s>n&&t.push(e.text.slice(n,s)),t.push(u(kB,{skill:l,rawText:i},`${s}:${a}`)),n=s+i.length)}return n===0?u(we,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(we,{children:t}))}function kB(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:S("span",{className:K(Lf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:Af,dangerouslySetInnerHTML:{__html:yI}}),u("span",{className:Rf,children:PB(e.skill)})]})})}function xI(e){let{label:t,tooltipText:n,expired:o=!1}=e;return S(je,{children:[S(Xe,{render:u("span",{className:K(Lf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(Io,{className:K(Af,"size-icon-1",o&&"opacity-100")}),u("span",{className:Rf,children:t})]}),u(Qe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var LB=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function AB(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3749
+ `)){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 lB=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function ch(e){let t=lB.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3750
+ `),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),s=o.find(p=>p.startsWith("Comment: ")),i=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:s?.slice(9).trim()||"",targetSummary:i?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var dB=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,cB=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,uB=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function fB(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function pB(e){let t={};for(let n of e.matchAll(cB))t[n[1]]=fB(n[2]??"");return t}function fI(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function mB(e){let n=Array.from(e.matchAll(uB)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function gB(e,t,n){let o=pB(e),r=fI(o.startIndex),a=fI(o.endIndex),s=o.filePath?.trim(),i=o.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let l=mB(t);return{id:`review-comment:${n}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:o.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||null,text:l.text,diff:l.contents,fenceLanguage:l.language}}function uh(e){let t=[],n=0,o=0;for(let a of e.matchAll(dB)){let s=a.index??0,i=e.slice(n,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:i});let l=gB(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),n=s+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 pI(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(`
3751
+ `)}function mI(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(`
3752
+ `)}var hB="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",vB=`${hB} border border-border/70 bg-accent/40 text-foreground`,kf=`${vB} text-[12px]`,Lf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Af="truncate leading-tight",gI='<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 yB=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function CB(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function xB(e){let t=e.displayName?.trim();return t||CB(e.name)}function hI(e){let t=[],n=0;for(let o of e.text.matchAll(yB)){let r=o[1]??"",a=o[2]??"",s=(o.index??0)+r.length,i=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(s>n&&t.push(e.text.slice(n,s)),t.push(u(bB,{skill:l,rawText:i},`${s}:${a}`)),n=s+i.length)}return n===0?u(Ie,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(Ie,{children:t}))}function bB(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:S("span",{className:K(kf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:Lf,dangerouslySetInnerHTML:{__html:gI}}),u("span",{className:Af,children:xB(e.skill)})]})})}function vI(e){let{label:t,tooltipText:n,expired:o=!1}=e;return S(Qe,{children:[S(Ye,{render:u("span",{className:K(kf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(wo,{className:K(Lf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Af,children:t})]}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var SB=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function IB(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3802
3753
  `).trimEnd()}),n=null)};for(let r of e.split(`
3803
- `)){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 RB(e){let t=LB.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=AB(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3754
+ `)){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 wB(e){let t=SB.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=IB(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3804
3755
  ${a}`:r).join(`
3805
3756
 
3806
- `):null,contexts:o}}function bI(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 mh(e){let t=tc(e),n=RB(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var EB=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function SI(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Ef(o))}return t.join(" ")}function Ef(e){let t=e.trim(),n=EB.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,"-")}`:bI({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function II(e,t){let n=0;for(let o of t){let r=Ef(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function gh({row:e}){let t=Ct(rn).derive;if(kf(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?S(we,{children:[u(_B,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(gh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(OB,{row:e})}return u(MB,{row:e,text:e.message.text})}function hh({images:e}){let t=Ct(rn),{t:n}=ft();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=ch(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 MB({row:e,text:t}){let{t:n}=ft(),o=Ct(rn),r=e.message.attachments??[],a=mh(t),s=a.contexts,i=[],l=a.visibleText;for(;;){let v=fh(l);if(!v.annotation)break;i.unshift(v.annotation),l=v.promptText}let d=tc(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=>ts(v)==="image"),g=p.filter(v=>ts(v)!=="image"),h=e.message.author??null;return S("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(NB,{author:h}),S("div",{className:"min-w-0 flex-1 space-y-2",children:[S("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:h?.displayName??n("message.user")}),S(je,{children:[u(Xe,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:Za(e.message.createdAt,o.timestampFormat,n)}),u(Qe,{children:Ja(e.message.createdAt,o.timestampFormat)})]}),S("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(FB,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(rl,{text:a.copyText,variant:"ghost"})]})]}),S("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(hh,{images:m}),g.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(v=>u(vh,{attachment:v},v.id))}),i.map((v,y)=>u(zB,{annotation:v,image:f[y]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(UB,{context:v},`${v.header}:${v.body}`))}):null,u(VB,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:s,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function NB({author:e}){let t=e;return t!==null?u(Qb,{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(Dr,{className:"size-4"})})}function Mf({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 _B({parsed:e}){let{t}=ft();return S(Mf,{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 DB={"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 OB({row:e}){let{t}=ft(),n=Ct(rn).derive,o=e.message.attachments??[],r=o.filter(l=>ts(l)==="image"),a=o.filter(l=>ts(l)!=="image"),s=l=>{let d=fI(l);if(d)return S(Mf,{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 S(Mf,{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?S(Mf,{children:[u("p",{className:"font-medium text-foreground/80",children:t(DB[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},i=uI(e.message.text).map(s).filter(l=>l!==null);return i.length===0&&o.length===0?null:S(we,{children:[i.map((l,d)=>u(Ba,{children:l},d)),o.length>0?S("div",{className:"min-w-0 px-3 py-2",children:[u(hh,{images:r}),a.map(l=>u(vh,{attachment:l},l.id))]}):null]})}function PI(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&kf(e??""))return null;let r=mh(n??e??"").visibleText;for(;;){let i=fh(r);if(!i.annotation)break;r=i.promptText}let a=tc(r).promptText,s=ph(a).map(i=>i.kind==="text"?i.text:i.comment.text).join(" ").replace(/\s+/g," ").trim();return s.length>0?s:null}var kI=34,LI=8,Nf=kI+LI,AI=Ce(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:s}=ft(),i=s(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:LI},"data-timeline-turn-header":"true","data-truncated":"false",children:S("div",{className:K("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:kI}},children:[u("span",{ref:n,className:K("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),S(je,{children:[u(Xe,{render:u(ce,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":i,onClick:a}),children:r?u(xd,{}):u(Zt,{})}),u(Qe,{side:"bottom",children:i})]})]})})});function FB({messageId:e,onFork:t}){let{t:n}=ft(),o=n("fork.action");return S(je,{children:[u(Xe,{render:u(ce,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Pd,{className:"size-3"})}),u(Qe,{side:"top",children:o})]})}function RI({row:e}){let t=Ct(rn),{t:n}=ft(),[o,r]=To(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Pf,{state:"idle",children:S("button",{type:"button",className:K(Tf,"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(Jd,{status:null}),u(Yd,{children:u(ra,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(Zt,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let s=e.message.attachments??[],i=s.filter(c=>ts(c)==="image"),l=s.filter(c=>ts(c)!=="image"),d=e.message.text||(e.message.streaming||s.length>0?"":n("timeline.emptyResponse"));return u(we,{children:S("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"?S("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(rl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(yh,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u("div",{"data-assistant-quote-body":"",children:u(zo,{disclosureKey:`message:${e.message.id}:assistant`,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,onImageExpand:t.onImageExpand})}),u(hh,{images:i}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(vh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?S("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 [@media(pointer:coarse)]:opacity-100",children:[u(BB,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&S(je,{children:[u(Xe,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:Za(e.message.updatedAt,t.timestampFormat,n)}),u(Qe,{children:Ja(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function BB({row:e}){let n=Ct(rn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(rl,{text:n.text??"",variant:"ghost"}):null}var wI=Ce(function(t){let n=t.context.body.length>0?`${t.context.header}
3807
- ${t.context.body}`:t.context.header;return u(xI,{label:t.context.header,tooltipText:n})}),UB=Ce(function(t){let n=t.context.body?`${t.context.header}
3808
- ${t.context.body}`:t.context.header;return S(je,{children:[S(Xe,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(Nr,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Qe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function vh(e){let{t}=ft(),n=ts(e.attachment),o=pI(n),r=t("attachments.open",{name:e.attachment.name}),a=S(we,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),S("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:cI(e.attachment.sizeBytes)})]})]}),s=e.attachment.previewUrl?mI(e.attachment):null;return e.attachment.previewUrl&&s!==null?S("div",{className:"flex max-w-sm flex-col gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:[u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 hover:underline",children:a}),s==="video"?u("video",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,playsInline:!0,preload:"metadata",className:"aspect-video w-full rounded-sm bg-black"}):u("audio",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,preload:"metadata",className:"h-10 w-full"})]}):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 zB(e){let t=Ct(rn),{t:n}=ft();return S("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=ch([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:n("previewAnnotation.cropAlt"),className:"size-full object-cover"})}):null,S("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,S("div",{className:K("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?S("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(Ws,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var HB=8,KB=600,$B=1.75,TI=`linear-gradient(to bottom, black calc(100% - ${$B}rem), transparent)`;function qB(e){return e.trim().length===0?!1:e.length>KB||e.split(`
3809
- `).length>HB}var VB=Ce(function(t){let n=Ct(rn),{t:o}=ft(),[r,a]=To(n.threadKey,`${t.disclosureKey}:expanded`,!1),s=t.text.trim().length>0||t.terminalContexts.length>0,i=s&&qB(t.text),l=i&&!r;return S("div",{children:[s?u("div",{className:K("relative",l&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":l?"true":"false","data-user-message-collapsible":i?"true":"false","data-user-message-fade":l?"true":"false",style:l?{WebkitMaskImage:TI,maskImage:TI}:void 0,children:u(WB,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,i||t.footer?S("div",{className:K("mt-1.5 flex items-center gap-2",i&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[i?u(ce,{type:"button",size:"xs",variant:"ghost","aria-expanded":r,"data-scroll-anchor-ignore":!0,onClick:()=>a(!r),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:o(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),WB=Ce(function(t){let n=Ct(rn),o=(a,s)=>{let i=/^\s+/.exec(a)?.[0]??"",l=a.slice(i.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return S(Ba,{children:[i?u("span",{"aria-hidden":"true",children:i}):null,c?u(zo,{disclosureKey:`${t.disclosureKey}:inline:${s}`,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]},s)},r=ph(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(zo,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,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(GB,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=II(t.text,t.terminalContexts),s=SI(t.terminalContexts),i=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Ef(d.header),f=t.text.indexOf(c,l);if(f===-1){i.length=0;break}f>l&&i.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),i.push(u(wI,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(i.length>0)return l<t.text.length&&i.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:i})}for(let l of t.terminalContexts)i.push(u(wI,{context:l},`user-terminal-context-inline:${l.header}`)),i.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)i.push(u(zo,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:n.onImageExpand},"user-message-terminal-context-inline-text"));else if(s.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}return t.text.length===0?null:u(zo,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:n.onImageExpand})});function GB({comment:e,disclosureKey:t}){let n=Ct(rn),{t:o}=ft(),r=e.fenceLanguage??"diff",a=vI(e);return S("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[S("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:wf(e.filePath,n.workspaceRoot)}),S("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??o("timeline.reviewCommentDefaultSection")," \xB7"," ",e.rangeLabel??o("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(CI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(zo,{disclosureKey:`${t}:fence`,text:hI(r,e.diff),cwd:n.markdownCwd,threadRef:n.threadRef??void 0,skills:n.skills,className:"text-message-foreground"}),a?u(mS,{patch:a}):null]})}function jB({badge:e}){return S(we,{children:[e.driverKind?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(rr,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,S("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?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?S("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function yh({badge:e,createdAt:t}){let n=Ct(rn),{t:o}=ft();return S("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(jB,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),S(je,{children:[u(Xe,{render:u("span",{className:"shrink-0 tabular-nums"}),children:Za(t,n.timestampFormat,o)}),u(Qe,{children:Ja(t,n.timestampFormat)})]})]})}function EI({row:e}){let{t}=ft(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,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 S("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"}),S("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?u(rr,{driver:e.badge.driverKind,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 Ch=240,QB=/\s/u;function MI(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Ch-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(QB.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Ch)||(t.push(a),n+=a.length,n>Ch))return r()}return t.length>0?t.join(""):null}function XB(e,t,n){let o=t.find(s=>s.kind==="message"&&s.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let s of t)s.kind==="message"&&s.message.role==="assistant"&&(a=s.message.text??null);return{id:e,sectionKey:e,anchorRowId:o?.id??t[0]?.id??e,userText:r===null?null:MI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:MI(a),headerText:r===null?null:PI(r.text,n)}}function YB(e){for(let t of e){let n=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(n!==null)return n}return null}function JB(e,t){return e.sectionKey===t.sectionKey&&e.anchorRowId===t.anchorRowId&&e.userText===t.userText&&e.assistantText===t.assistantText&&e.headerText===t.headerText&&e.turnId===t.turnId}function ZB(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function eU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function tU(e){let t=new Map,n=null;return o=>{let r=o.getVersion();if(n!==null&&n.store===o&&n.version===r)return n.entries;let a=new Map,s=[],i=o.getRows();for(let d of o.getStructure().sections){let c=t.get(d.key);if(c!==void 0&&c.rowIds===d.rowIds&&ZB(c.rows,d,i)){a.set(d.key,c),s.push(c.entry);continue}let f=i.slice(d.firstRowIndex,d.firstRowIndex+d.rowIds.length),p=XB(d.key,f,e),m={...p,turnId:YB(f)},g=c!==void 0&&JB(c.entry.item,m)?c.entry:{summary:p,item:m};a.set(d.key,{rowIds:d.rowIds,rows:f,entry:g}),s.push(g)}t=a;let l=n!==null&&eU(n.entries,s)?n.entries:s;return n={store:o,version:r,entries:l},l}}var NI=new WeakMap;function OI(e,t){let n=NI.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:tU(t)},NI.set(e,n)),n.read(e)}var _I=new WeakMap;function FI(e,t){let n=OI(e,t),o=_I.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),_I.set(n,o)),o}function BI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n.sectionKey===t[o].sectionKey&&n.text===t[o].text)}var DI=new WeakMap;function UI(e,t){let n=OI(e,t),o=DI.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),DI.set(n,o)),o}function zI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}ie();var nU=[],oU=e=>e.getMeta().usageByTurnId,rU=e=>e.getMeta().exportApi,HI=Ce(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:s,onTurnNavigatorChange:i}){let l=E(m=>o?UI(m,n):nU,[n,o]),d=es(t,l,zI),c=es(t,oU),f=es(t,rU),p=V(()=>o?{items:d,totalTurnCount:r,bottomInset:a,usageByTurnId:c,onSelect:s,exportMarkdown:f.markdown,onDownload:f.download}:null,[a,f,d,s,o,r,c]);return q(()=>{p!==null&&i(p)},[i,p]),q(()=>{if(o)return()=>i(null)},[i,o]),null});ie();function KI(){let e=Fo(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,s)=>e.notify(r,a,s);return{error:(r,a,s)=>{let i=s?.description??t(a);o(n(r,i),"error",i)},warning:(r,a,s)=>{let i=s?.description??t(a);o(n(r,i),"warning",i)},success:(r,a,s)=>{let i=a??s?.description;o(n(r,i),"success",i)}}}function _f(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function xh(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(`
3810
- `)}function $I(e,t,n){let o=n?.maxLines??8,r=xh(e).trimEnd().split(/\r?\n/).map(l=>l.trimEnd()),a=[],s=0,i=!1;for(let l of r){let d=l.trim().length>0;if(d&&s>=o){i=!0;break}a.push(l),d&&(s+=1)}for(;a.length>0&&a.at(-1)?.trim().length===0;)a.pop();return a.length===0?_f(e)??t("proposedPlan.previewUnavailable"):(i&&a.push("","..."),a.join(`
3811
- `))}function aU(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function qI(e){let t=_f(e);return`${aU(t??"plan")}.md`}function VI(e){return`${e.trimEnd()}
3812
- `}function WI(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 Df=1024,GI=Ce(function({planMarkdown:t,threadKey:n,rowId:o,environmentId:r,threadRef:a,cwd:s,workspaceRoot:i,onSavePlanToWorkspace:l}){let{t:d}=ft(),c=KI(),[f,p]=To(n,`proposed-plan:${o}:expanded`,!1),[m,g]=G(!1),[h,v]=To(n,`proposed-plan:${o}:save-path`,""),[y,C]=G(!1);Ku(o,m||y);let x=N(!1),b=N(!1);be(()=>(x.current=!0,()=>{x.current=!1}),[]);let{copyToClipboard:T,isCopied:I}=Sf({target:"plan",onError:O=>{c.error(d("proposedPlan.couldNotCopy"),O,{description:d("proposedPlan.copyErrorDescription")})}}),k=Rr(),P=_f(t)??d("proposedPlan.defaultTitle"),w=t.split(`
3813
- `).length,L=t.length>900||w>20,A=xh(t),M=L?$I(t,d,{maxLines:10}):null,R=qI(t),D=VI(t),H=()=>{WI(R,D)},W=()=>{T(D)},F=()=>{if(!i){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(R.slice(0,Df)),g(!0)},J=()=>{if(b.current)return;let O=h.trim();if(!(!i||l===null)){if(!O){c.warning(d("proposedPlan.enterWorkspacePath"));return}if(O.length>Df){c.warning(d("proposedPlan.pathTooLong"));return}b.current=!0,C(!0),(async()=>{try{let B=await l({environmentId:r,workspaceRoot:i,relativePath:O,contents:D});if(!x.current)return;B.ok?(g(!1),c.success(d("proposedPlan.savedToWorkspace"),B.relativePath)):c.error(d("proposedPlan.couldNotSave"),void 0,{description:d("proposedPlan.saveErrorDescription")})}catch(B){x.current&&c.error(d("proposedPlan.couldNotSave"),B,{description:d("proposedPlan.saveErrorDescription")})}finally{b.current=!1,x.current&&C(!1)}})()}};return S("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[S("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[S("div",{className:"flex min-w-0 items-center gap-2",children:[u(Or,{variant:"secondary",children:d("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:P})]}),S(mo,{children:[u(ho,{render:u(ce,{"aria-label":d("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(Bo,{"aria-hidden":"true",className:"size-4"})}),S(go,{align:"end",children:[u(Uo,{onClick:W,children:d(I?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(Uo,{onClick:H,children:d("proposedPlan.downloadAsMarkdown")}),l!==null?u(Uo,{onClick:F,disabled:!i||y,children:d("proposedPlan.saveToWorkspace")}):null]})]})]}),S("div",{className:"mt-4",children:[S("div",{className:K("relative",L&&!f&&"max-h-104 overflow-hidden"),children:[L&&!f?u(zo,{disclosureKey:`proposed-plan:${o}:plan`,text:M??"",cwd:s,threadRef:a,isStreaming:!1}):u(zo,{disclosureKey:`proposed-plan:${o}:plan`,text:A,cwd:s,threadRef:a,isStreaming:!1}),L&&!f?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]}),L?u("div",{className:"mt-4 flex justify-center",children:u(ce,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!f),children:d(f?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(tf,{open:m,onOpenChange:O=>{y||g(O)},children:S(af,{className:"max-w-xl",children:[S(rf,{children:[u(sf,{children:d("proposedPlan.saveToWorkspace")}),u(nf,{children:ec(d("proposedPlan.pathHint"),u("code",{children:i??d("proposedPlan.theWorkspace")}),"path")})]}),u(Zb,{className:"space-y-3",children:S("label",{htmlFor:k,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(Yi,{id:k,value:h,maxLength:Df,onChange:O=>v(O.target.value.slice(0,Df)),placeholder:R,spellCheck:!1,disabled:y})]})}),S(of,{children:[u(ce,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:y,children:d("proposedPlan.cancel")}),u(ce,{size:"sm",onClick:()=>{J()},disabled:y,children:d(y?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function jI({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function QI(e,t){let n=e.topOf(t),o=e.heightOf(t);return typeof n!="number"||typeof o!="number"||!Number.isFinite(n)||!Number.isFinite(o)?null:n+Math.max(1,o)}function XI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}ie();var ll=class extends Zr{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 sU({error:e,className:t}){let{t:n}=ft();return S(je,{children:[S(Xe,{render:u("div",{className:K("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(hn,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Qe,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function YI(e){return u(sU,{error:e})}var rn=yt(null),ew=yt(null),iU=u("div",{className:"h-3 sm:h-4"}),lU=u("div",{className:"h-10 sm:h-12"}),dU=Object.freeze([]);function cU({loading:e,blocked:t,onLoadEarlier:n,fade:o}){let{t:r}=ft();return u("div",{className:o?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:n,disabled:e||t,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:r(e?"timeline.loadingEarlier":"timeline.loadEarlier")})})})}function uU({loading:e,blocked:t,onLoadLater:n,onReturnToLatest:o}){let{t:r}=ft();return S("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[u(ce,{variant:"ghost",size:"sm",onClick:n,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),o?u(ce,{variant:"ghost",size:"sm",onClick:o,children:r("timeline.returnToLatest")}):null]})}function fU({onReveal:e,fade:t}){let{t:n}=ft();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:n("timeline.loadEarlier")})})})}var pU=u("div",{className:"h-3 sm:h-4"}),mU=[],gU=new Set,hU=200,JI=1e4,vU=20;function ZI(e,t){let n=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),o=n.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=o<0?n:n.slice(0,o+1);for(let a of r)a.style.contentVisibility="visible";e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility")})}var bh=600;function Sh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let n=e;n&&n!==t;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight&&n.scrollTop>0)return!0;n=n.parentElement}return!1}var yU=()=>{},CU=[];function xU(e){let t=e.getMeta().status;return{latestTurn:t.latestTurn??null,latestAssistantMessageId:t.latestAssistantMessageId??null,isWorking:t.isWorking,workingStepLabel:t.workingStepLabel??null,stall:t.stall??null,retry:t.retry??null,totalTurnCount:t.totalTurnCount??null,scheduledWakes:t.scheduledWakes??dU}}function bU(e,t){return e.latestTurn===t.latestTurn&&e.latestAssistantMessageId===t.latestAssistantMessageId&&e.isWorking===t.isWorking&&e.workingStepLabel===t.workingStepLabel&&e.stall===t.stall&&e.retry===t.retry&&e.totalTurnCount===t.totalTurnCount&&e.scheduledWakes===t.scheduledWakes}var SU=e=>e.getMeta().finalAssistantMessageReceived;function IU(e,t){let n=N(e);return t&&(n.current=e),n.current}var tw=Ce(function({derive:t,SiteIcon:n,rowsStore:o,threadKey:r,threadRef:a,environmentId:s,onInterrupt:i=null,onRespondToDecision:l=null,onCancelScheduledWake:d=null,agentPanelModel:c,onOpenAgents:f=yU,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:C,skills:x=mU,onRowsChange:b,contentInsetEndAdjustment:T,liveFollowEnabled:I,awaitingUserDecision:k=!1,onIsAtEndChange:P,onManualNavigation:w,onDisclosureNavigation:L=w,hideEmptyPlaceholder:A=!1,topFadeEnabled:M=!1,scrollerRef:R,loadEarlier:D=null,loadLater:H=null,pagingBlockedByInteraction:W=!1,onReturnToLatest:F=null,onVisibleTurnRangeChange:J=null,revealMessageRequest:O=null,onRevealMessageHandled:B,revealQuoteRequest:Y=null,onRevealQuoteDone:U,renderWorkGroup:j,renderToolCallDetail:oe,loadScrollAnchor:Q,saveScrollAnchor:ne,useVisibleThreadCompletion:re,onSavePlanToWorkspace:Z,paneActive:te,onTurnNavigatorChange:ue}){let{t:Me}=ft(),{latestTurn:Oe,latestAssistantMessageId:ke,isWorking:Ee,workingStepLabel:ee,stall:Se,retry:X,totalTurnCount:de,scheduledWakes:le}=es(o,xU,bU),se=Mr(),$e=N(se);$e.current=se;let Tt=N(O);Tt.current=O;let[gt,Lt]=Ot("timeline-disclosure-reading",r,!1),it=N(r);it.current=r;let ct=N(W);ct.current=W;let ht=xt("timeline-following-end",r,!0);ht.current=H===null&&I;let lt=xt("timeline-scroll-restore-pending",r,!1),pt=sr(r,null),Pt=sr(r,null),Ft=sr(r,null),gn=xt("timeline-content-inset",r,T),rt=N(null),At=sr(r,[]),Bt=sr(r,!1),en=N(null),Vt=E(()=>At.current,[At]),Wt=E(z=>{At.current=z,en.current?.(),Ve.current?.schedule()},[At]),vn=E(z=>{Bt.current=z,Ve.current?.schedule()},[Bt]),$=E(z=>{z!==null&&(rt.current=z),R(z)},[R]);be(()=>{jI({timeline:rt.current,previousOverlayHeight:gn.current,overlayHeight:T,followingEnd:se&&H===null&&I&&!gt}),gn.current=T},[T,gt,I,H,se]),q(()=>()=>{Pt.current?.stop()},[]);let pe=E(()=>{Pt.current?.stop(),Pt.current=null,pt.current=null,Lt(!1)},[pt,Pt,Lt]),ge=E(z=>{L(),pt.current=z,Lt(!0),Pt.current?.stop();let Ae=rt.current?.node??null;if(!Ae)return;let ot=Array.from(Ae.querySelectorAll("[data-timeline-row-id]")).find(Qn=>Qn.dataset.timelineRowId===z);if(!ot)return;let Gt=Ft.current;Pt.current=YS({viewport:Ae,row:ot,anchor:Gt&&ot.contains(Gt)?Gt:ot,scrollToOffset:Qn=>{Ae.scrollTop=Qn}})},[L]),ye=xt("timeline-live-follow-previous",r,I);be(()=>{I&&!ye.current&&pe(),ye.current=I},[I,pe]);let Pe=IU(H!==null,se),at=!Pe&&Ee,tn=Pe?null:ee,bt=Pe?null:Se,cn=Pe?null:X,st=lI(o),Je=st.sections,Rt=st.rowIds.length,nn=E(z=>{let Ae=o.getRows().find(ot=>ot.id===z||ot.kind==="work"&&ot.groupedEntries.some(Gt=>Gt.id===z)||ot.kind==="tool-group"&&ot.entries.some(Gt=>Gt.id===z));ge(Ae?.id??z)},[o,ge]),Te=xt("timeline-scroll-snapshot",r,null),Ke=E((z,Ae=ht.current)=>{z.scrollLength<=0||(Te.current={threadKey:r,anchor:XI({measurement:z,followingEnd:Ae})})},[ht,r,Te]),qe=E(()=>{let z=Te.current;z&&ne(z.threadKey,z.anchor)},[ne,Te]),ut=E(()=>{if(!se||lt.current)return;if(Rt===0){qe();return}let z=rt.current?.measure();z&&z.scrollLength>0&&(Ke(z,ht.current&&t.resolveIsAtEnd(z,T)!==!1),qe())},[Ke,T,t,ht,se,qe,lt,Rt]),tt=tI(r),nt=N(tt);nt.current=tt;let St=xt("timeline-top-reveal-armed",r,!0),Ut=xt("timeline-network-prepend-awaiting-navigation",r,!1),bn=N(null),ln=N(null);be(()=>()=>{ln.current!==null&&(cancelAnimationFrame(ln.current),ln.current=null)},[r,se]);let un=xt("timeline-network-prepend-scroll-top",r,null),Gn=xt("timeline-mounted-section-keys",r,gU,3),Sn=sr(r,null),xe=Sn.current,Ze=xe===null?-1:Je.findIndex(z=>z.key===xe.firstMountedSectionKey),Mt=Ze>0?Je.length-Math.max(0,Ze-lh):tt.revealedCount,vt=Ze>0?Mt:tt.revealedCount,fn=MS(Je.map(z=>z.key),Gn.current,vt,H!==null||!I||gt||Bt.current||At.current.length>0),{startIndex:yn,hasHiddenOlder:dn}=eI(Je.length,fn),Jt=V(()=>Je.slice(yn),[yn,Je]),jn=xe!==null&&Ze>0&&yn<Ze,zt=N(Je);zt.current=Je,be(()=>{if(se){if(Gn.current=new Set(Jt.map(z=>z.key)),xe!==null){let z=nI(xe,{prefixMounted:jn,loading:D===null?null:D.loading,sections:Je,now:Date.now()});z!=="waiting"&&(Sn.current=null),z==="mounted"&&(Ut.current=!0)}fn<nt.current.revealedCount?nt.current.compactTo(fn):fn>nt.current.revealedCount&&nt.current.revealAtLeast(fn)}},[Ut,D,se,xe,jn,Sn,Gn,fn,Je,Jt]);let Cn=sr(r,null),uo=E((z=null)=>{if(!$e.current)return;let Ae=rt.current?.node;Ae&&(Cn.current={scrollHeight:Ae.scrollHeight,scrollTop:Ae.scrollTop,row:rt.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:z,until:Date.now()+JI})},[Cn]),Tr=E(()=>{let z=Cn.current;if(z===null||z.firstMountedSectionKey===null||Date.now()>z.until)return;let Ae=rt.current?.node;if(!Ae)return;let ot=Te.current;z.scrollHeight=Ae.scrollHeight,z.scrollTop=Ae.scrollTop,z.row=ot?.threadKey===r?ot.anchor:null},[Cn,r,Te]);be(()=>{if(!se)return;let z=Cn.current;if(!z)return;if(Date.now()>z.until){Cn.current=null;return}if(z.firstMountedSectionKey!==null&&Sn.current!==null)return;Cn.current=null;let Ae=rt.current?.node;if(Ae){if(z.row){ZI(Ae,z.row.rowId);let ot=rt.current?.measure()?.topOf(z.row.rowId);ot!=null&&(Ae.scrollTop=ot+z.row.offsetPx)}else Ae.scrollTop=z.scrollTop+(Ae.scrollHeight-z.scrollHeight);jn&&(un.current=Ae.scrollTop)}},[un,se,xe,jn,yn,st]);let Wr=E(()=>{uo(),nt.current.revealOlder()},[uo]),ze=N(Wr);ze.current=Wr;let Pr=N(dn);Pr.current=dn;let er=N(null),Gr=xt("timeline-scroll-restore",r,void 0);if(Gr.current===void 0&&Rt>0){let z=Q(r);Gr.current=z!==null&&st.rowIds.includes(z.rowId)?z:null}let Is=Gr.current??null,_o=N(()=>{}),[no,jr]=Ot("timeline-scroll-restore-settled",r,!1),qi=Is!==null&&!no,ws=xt("timeline-last-anchor-save",r,0);q(()=>{let z=Is;if(!se||no||z===null)return;if(Tt.current!==null){jr(!0);return}let Ae=null,ot=requestAnimationFrame(()=>{!$e.current||it.current!==r||(w(),nt.current.revealAtLeast(il(zt.current,z.rowId,nt.current.revealedCount)),Ae=requestAnimationFrame(()=>{!$e.current||it.current!==r||(jr(!0),_o.current(z.rowId,-z.offsetPx))}))});return()=>{cancelAnimationFrame(ot),Ae!==null&&cancelAnimationFrame(Ae)}},[w,se,r,Is,no]);let zn=xt("timeline-restore-after-presentation",r,!1),Pn=qi||zn.current;lt.current=Pn,be(()=>{if(se)return()=>{it.current!==r?qe():ut(),zn.current=!0}},[se,r]),be(()=>{if(!se||!zn.current)return;if(Tt.current!==null){zn.current=!1,lt.current=!1;return}let z=null,Ae=null,ot=()=>{!$e.current||it.current!==r||(rt.current?.scrollToEnd(),zn.current=!1,lt.current=!1,ht.current=H===null,Ar.current=H===null,or.current={...or.current,followEnabled:!0,restoreInProgress:!1},P(H===null))},Gt=Q(r),Qn=Gt!==null&&zt.current.some(Fa=>Fa.rowIds.includes(Gt.rowId));return Gt===null?z=requestAnimationFrame(ot):Qn?(w(),nt.current.revealAtLeast(il(zt.current,Gt.rowId,nt.current.revealedCount)),z=requestAnimationFrame(()=>{Ae=requestAnimationFrame(()=>{!$e.current||it.current!==r||(_o.current(Gt.rowId,-Gt.offsetPx),zn.current=!1,lt.current=!1)})})):Rt>0&&(z=requestAnimationFrame(ot)),()=>{z!==null&&cancelAnimationFrame(z),Ae!==null&&cancelAnimationFrame(Ae)}},[Q,H,P,w,se,r,Rt,Je.length]);let Do=E(z=>{pe(),w(),nt.current.revealAtLeast(il(zt.current,z.anchorRowId,nt.current.revealedCount));let Ae=r;requestAnimationFrame(()=>{it.current===Ae&&_o.current(z.anchorRowId,24)})},[w,pe,r]);q(()=>{if(O===null||!se)return;pe(),w();let z=t.resolveToolGroupRevealRowId(o.getRows(),O.rowId);nt.current.revealAtLeast(il(zt.current,z,nt.current.revealedCount));let Ae=requestAnimationFrame(()=>{it.current===r&&(_o.current(z,24),B?.())});return()=>cancelAnimationFrame(Ae)},[O,se,w,pe,B,t,r,o]);let Ts=N(null);q(()=>{if(Y===null||!se)return;let z=Ts.current;if((z===null||z.request!==Y)&&(z={request:Y,pages:0,done:!1},Ts.current=z),z.done)return;let{quote:Ae}=Y,ot=Ae.messageId;if(!o.getRows().some(Gt=>Gt.id===ot)){if(D?.loading)return;let Gt=er.current;if(Gt!==null&&z.pages<vU){z.pages+=1,Gt();return}z.done=!0,U?.("message-missing");return}z.done=!0,pe(),w(),nt.current.revealAtLeast(il(zt.current,ot,nt.current.revealedCount)),requestAnimationFrame(()=>{it.current===r&&(_o.current(ot,24),requestAnimationFrame(()=>{let Gt=rt.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(ot)}"]`),Qn=Gt?rI(Gt,Ae):null,Fa=rt.current?.node;if(Qn&&Fa){let _g=Qn.getBoundingClientRect().top-Fa.getBoundingClientRect().top-Fa.clientHeight/3;rt.current?.scrollToOffset(Fa.scrollTop+_g)}Qn&&aI(Qn),U?.(Qn?"found":"passage-missing")}))})},[Y,se,st,D,o,U,w,pe,r]);let He=E(z=>se?FI(z,t):CU,[t,se]),Co=es(o,He,BI),Ps=N(Co);Ps.current=Co;let kr=xt("timeline-active-header",r,null),Qr=Co.at(-1)?.text??null,Na=Qr!==null,ks=N(null),tr=N(null),[Xr,En]=Ot("timeline-pinned-header-expanded",r,!1),nr=N(Xr);nr.current=Xr;let Ls=E(()=>{if(!$e.current)return;let z=ks.current,Ae=tr.current;!z||!Ae||(z.dataset.truncated=nr.current||Ae.scrollWidth>Ae.clientWidth+1?"true":"false")},[]),[As,Lr]=G(null),Vi=es(o,SU),[xn,Rs]=G(null),_a=E(()=>{if(ct.current||it.current!==r||D===null||D.loading)return;let z=Jt[0]?.key;z!==void 0&&(uo(z),Sn.current={firstMountedSectionKey:z,loadingObserved:!1,sectionsWhileLoading:zt.current,until:Date.now()+JI},D.onLoadEarlier())},[uo,D,Sn,r,Jt]);er.current=D===null||D.loading||W?null:_a;let Da=E(()=>{ct.current||it.current!==r||(uo(),H?.onLoadLater())},[uo,H,r]),Yr=E((z,Ae)=>{if(!$e.current)return;let ot=rt.current?.node;ot&&(ZI(ot,z),rt.current?.scrollToRow(z,{viewOffset:Ae}))},[]);_o.current=Yr;let fo=se&&H===null&&I&&!gt&&!Pn,Ar=N(fo);Ar.current=fo;let or=N({followEnabled:fo,restoreInProgress:Pn,loadEarlier:D});or.current={followEnabled:fo,restoreInProgress:Pn,loadEarlier:D};let Ve=N(null);q(()=>{if(!xn||!se)return;let z=sI({root:xn,minimumCount:ei,keepAbovePx:bh,canCompact:()=>{let Ae=or.current,ot=Cn.current;return Ae.followEnabled&&At.current.length===0&&!Ae.restoreInProgress&&!Ae.loadEarlier?.loading&&!(ot&&ot.until>Date.now())&&nt.current.revealedCount>ei},onCompact:Ae=>{St.current=!0,uo(),nt.current.compactTo(Ae)}});return Ve.current=z,()=>{z.disconnect(),Ve.current=null}},[uo,se,xn]),q(()=>{Ve.current?.schedule()},[fo,D?.loading,tt.revealedCount,Je.length]),q(()=>{if(!xn||!se||typeof ResizeObserver>"u")return;let z=()=>{if(!$e.current||!Ar.current)return;let Gt=xn.scrollHeight-xn.clientHeight;Math.abs(xn.scrollTop-Gt)>.5&&(xn.scrollTop=Gt)},Ae=new ResizeObserver(z);Ae.observe(xn);let ot=xn.firstElementChild;return ot&&Ae.observe(ot),()=>Ae.disconnect()},[se,xn]),re({viewport:As,viewActive:te&&se,threadKey:r,completedAt:H===null&&!Pn&&Oe?.state==="completed"&&Vi?Oe.completedAt:null,messageId:ke,bottomInset:T});let Nt=st.rowIds.at(-1)??null;q(()=>{b?.(Nt)},[Nt,b,r]);let pn=xt("timeline-later-load-armed",r,!0),on=E(z=>{if(z>bh){St.current=!0;return}if(St.current){if(St.current=!1,Pr.current){ze.current();return}er.current?.()}},[St]),Es=E(()=>{Ut.current&&(Ut.current=!1,un.current=null,St.current=!0)},[Ut,un,St]),Ms=E(()=>{if(ln.current!==null||ct.current||!$e.current||it.current!==r||lt.current)return!1;let z=rt.current?.measure();return!z||z.scroll>2||z.contentLength-z.scrollLength-z.scroll<=2||!Pr.current&&er.current===null?!1:(Ut.current=!1,un.current=null,St.current=!0,ln.current=requestAnimationFrame(()=>{ln.current=null}),on(z.scroll),!0)},[on,Ut,un,r,lt,St,ln]),Wi=E(()=>{if(!$e.current||it.current!==r)return;let z=rt.current?.measure();if(!z||lt.current)return;Ke(z);let Ae=un.current;Ut.current&&Ae!==null&&Math.abs(z.scroll-Ae)>.5&&Es(),Tr();let ot=t.resolveIsAtEnd({contentLength:z.contentLength,scroll:z.scroll,scrollLength:z.scrollLength},T);ot!==void 0&&P(H===null&&ot),z.contentLength-z.scrollLength-z.scroll>2&&on(z.scroll),z.contentLength-z.scrollLength-z.scroll>bh?pn.current=!0:pn.current&&H&&!H.loading&&!ct.current&&(pn.current=!1,Da());let Qn=Date.now();Qn-ws.current>=hU&&(ws.current=Qn,qe())},[Ke,T,t,on,P,qe,Tr,r,H,pn,Da,Ut,un,Es,lt]),Oa=N(null),Ns=E(()=>{$e.current&&Oa.current===null&&(Oa.current=requestAnimationFrame(()=>{Oa.current=null,Ls()}))},[Ls]);q(()=>()=>{Oa.current!==null&&(cancelAnimationFrame(Oa.current),Oa.current=null)},[r]);let Ag=E(z=>{if(z===null||z===kr.current)return;kr.current=z;let Ae=Ps.current.find(ot=>ot.sectionKey===z);Ae&&tr.current&&(tr.current.textContent=Ae.text),nr.current&&En(!1),Ns()},[kr,Ns,En]),cd=iI({root:xn,topInsetPx:Nf,onActiveSectionChange:Ag,active:se}),Rg=V(()=>ES(Je),[Je]),Eg=DS({root:xn,inputKey:r,visible:se,index:Rg,topInset:Na?Nf:0,bottomInset:T,interactionRows:Vt,onRangeChange:J,onSelectionChange:vn});en.current=Eg,q(()=>{if(!se){qe();return}let z=requestAnimationFrame(()=>{if(!$e.current)return;let Ae=rt.current?.node;Ae&&Ar.current&&(Ae.scrollTop=Ae.scrollHeight-Ae.clientHeight),cd.refresh()});return()=>cancelAnimationFrame(z)},[qe,cd,se]);let Jr=E(()=>{En(z=>!z)},[En]);be(()=>{if(!se)return;let z=kr.current,Ae=z===null?void 0:Ps.current.find(ot=>ot.sectionKey===z);Ae&&tr.current&&(tr.current.textContent=Ae.text),Ns()},[se,Ns,Xr]);let _s=V(()=>{let z=dn?u(fU,{onReveal:Wr,fade:M}):D!==null?u(cU,{loading:D.loading,blocked:W,onLoadEarlier:_a,fade:M}):M?lU:iU;return Na?S(we,{children:[u("div",{style:{height:Nf}}),z]}):z},[_a,dn,Na,D,W,Wr,M]);q(()=>{if(!se)return;let z=requestAnimationFrame(Wi);return()=>cancelAnimationFrame(z)},[Wi,se,Pn,Rt]);let ud=V(()=>({timestampFormat:y,threadKey:r,threadRef:a,markdownCwd:h,resolvedTheme:v,workspaceRoot:C,skills:x,activeThreadEnvironmentId:s,onForkFromUserMessage:m,onImageExpand:g,onOpenFileDiff:p,onProcessDisclosureChange:nn,agentPanelModel:c,onOpenAgents:f,onInterrupt:i,onRespondToDecision:l,scheduledWakes:le,onCancelScheduledWake:d,derive:t,SiteIcon:n,renderWorkGroup:j,renderToolCallDetail:oe,onSavePlanToWorkspace:Z}),[y,r,a,h,v,C,x,s,m,g,p,nn,c,f,i,l,le,d,t,n,j,oe,Z]),Mg=V(()=>({isWorking:at,workingStepLabel:tn,stall:bt,retry:cn}),[at,cn,bt,tn]),Lu=E(z=>u(wU,{rowsStore:o,rowId:z}),[o]),Ng=Rt===0&&!at&&!A;return u(rn,{value:ud,children:S(ew,{value:Mg,children:[u(HI,{rowsStore:o,derive:t,paneVisible:se,totalTurnCount:de,bottomInset:T,onSelect:Do,onTurnNavigatorChange:ue}),S("div",{ref:Lr,onClickCapture:z=>{Ft.current=z.target instanceof Element?z.target.closest("button"):null},onWheelCapture:pe,onTouchMoveCapture:pe,onPointerDownCapture:z=>{z.target===rt.current?.node&&(pe(),Ms())},onKeyDownCapture:z=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(z.key)&&pe()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":k?"true":"false","data-disclosure-reading":gt?"true":void 0,"data-timeline-follow-end":fo?"true":"false","data-timeline-end-inset":T,children:[u(_S,{inputKey:r,onBeforeInputChange:ut,handleRef:$,onAttach:Rs,onInteractionRowsChange:Wt,onScroll:Wi,className:K("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",M&&"topbar-scroll-fade"),children:S("div",{style:{paddingBottom:T},onWheel:z=>{z.defaultPrevented||z.deltaY>=0||Xa(z.target)||Sh(z.target,rt.current?.node??null)||Ms()},onTouchStartCapture:z=>{bn.current=z.touches[0]?.clientY??null},onTouchMove:z=>{let Ae=z.touches[0],ot=bn.current;z.defaultPrevented||Xa(z.target)||Sh(z.target,rt.current?.node??null)||Ae===void 0||ot===null||Ae.clientY<=ot||Ms()&&(bn.current=null)},onTouchEndCapture:()=>{bn.current=null},onTouchCancelCapture:()=>{bn.current=null},onKeyDown:z=>{z.defaultPrevented||z.repeat||z.metaKey||z.ctrlKey||z.altKey||z.shiftKey||Xa(z.target)||Sh(z.target,rt.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(z.key)||Ms()},children:[_s,Jt.map(z=>u(JS,{sectionKey:z.key,rowKeyPrefix:r,rowIds:z.rowIds,renderRow:Lu,sectionRef:cd.observeSection(z.key)},`${r}:${z.key}`)),H?u(uU,{loading:H.loading,blocked:W,onLoadLater:Da,onReturnToLatest:F}):null,pU]})}),Ng?u("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:Me("timeline.empty")})}):null,Qr!==null?u(AI,{ref:ks,textRef:tr,initialText:Qr,expanded:Xr,onToggleExpanded:Jr}):null]})]})})});var wU=Ce(function({rowsStore:t,rowId:n}){let o=dI(t,n),r=Ct(rn);return o===void 0?null:u(Xi,{value:o.id,children:u("div",{className:K("relative",o.kind==="message"&&o.message.role==="user"?"pb-6":o.kind==="message"&&o.message.role==="assistant"?o.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":o.id,"data-timeline-row-kind":o.kind,"data-message-id":o.kind==="message"?o.message.id:void 0,"data-message-role":o.kind==="message"?o.message.role:void 0,children:S(ll,{resetKey:o.id,fallback:YI,children:[o.kind==="turn-summary"?u(US,{footer:o.footer,copyText:o.copyText,timestampFormat:r.timestampFormat}):null,o.kind==="tool-group"?u(XS,{entries:o.entries,groupId:o.groupId,threadKey:r.threadKey,workspaceRoot:r.workspaceRoot,onDisclosureChange:()=>r.onProcessDisclosureChange?.(o.id)}):null,o.kind==="work"?u(TU,{row:o}):null,o.kind==="model-switch"?u(EI,{row:o}):null,o.kind==="turn-identity"?u("div",{"data-turn-identity":o.turnId,className:"px-1 pt-1",children:u(yh,{badge:o.badge,createdAt:o.createdAt})}):null,o.kind==="message"&&o.message.role==="user"?u(gh,{row:o}):null,o.kind==="message"&&o.message.role==="assistant"?u(RI,{row:o}):null,o.kind==="proposed-plan"?u(kU,{row:o}):null,o.kind==="turn-plan"?u(LU,{row:o}):null,o.kind==="working"?u(AU,{row:o}):null]})})})});function TU({row:e}){let t=Ct(rn),n=Mr(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(we,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(PU,{entry:r},r.id))})}function PU({entry:e}){let t=Ct(rn),[n,o]=To(t.threadKey,`work-fallback:${Cf(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return S("div",{children:[S("button",{type:"button","aria-expanded":n,className:K("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:()=>o(!n),disabled:r===void 0,children:[u("span",{"aria-hidden":!0,className:K("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}),r!==void 0?u(Zt,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!n&&"-rotate-90")}):null]}),n&&r!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function kU({row:e}){let t=Ct(rn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(GI,{threadKey:t.threadKey,rowId:e.id,planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var LU=Ce(function({row:t}){let n=Ct(rn),{t:o}=ft(),[r,a]=To(n.threadKey,`turn-plan:${t.id}`,!1),{steps:s}=t.turnPlan.plan,i=s.filter(f=>f.status==="completed").length,l=i===s.length,d=s.find(f=>f.status==="inProgress")?.step??s.find(f=>f.status==="pending")?.step??s.at(-1)?.step??o("proposedPlan.badge");return S("div",{className:"min-w-0 px-1 py-0.5",children:[S("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":r,onClick:()=>a(!r),children:[u(r?Zt:So,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),s.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:s.map(f=>u("span",{className:K("h-[3px] w-2.5 rounded-full",f.status==="completed"?"bg-success":f.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},f.step))}):null,u("span",{className:K("min-w-0 truncate",l?"text-muted-foreground/65":"font-medium text-foreground/85"),children:d}),s.length>1?S("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[i,"/",s.length]}):null]}),r?u("div",{className:"mt-0.5 space-y-px pl-6",children:s.map(f=>S("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:K("w-3 shrink-0 text-center font-mono text-chat-meta",f.status==="completed"?"text-success":f.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:f.status==="completed"?"\u2713":f.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:K("min-w-0",f.status==="completed"?"text-muted-foreground/55":f.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:f.step})]},f.step))}):null]})});function AU({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Ct(ew),{t:r}=ft();return S("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:S("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?ec(r("activity.workingForLive"),u(_U,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?S("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(RU,{retry:o}):n&&!e.compacting?u(MU,{stall:n}):null]})}function RU({retry:e}){let{t}=ft(),n=Ct(rn);return S(qd,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(df,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(Vd,{children:u(ce,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var EU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function MU({stall:e}){let{t}=ft(),{onInterrupt:n}=Ct(rn),o=t(EU[e.reason]);return S("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:ec(t("stall.noOutputForLive"),u(NU,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ce,{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 nw(e,t){let n=Mr();q(()=>{let o=()=>{t.current&&(t.current.textContent=Ih(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 NU({since:e}){let t=N(null);return nw(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Ih(e)})}function _U({createdAt:e}){let t=N(null);return nw(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Ih(e)})}function DU(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));return r<60?`${r}s`:sa(r*1e3)}function Ih(e){return DU(e,new Date().toISOString())??"0s"}function Of(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel}function ow(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function rw(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&&Of(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&&ow(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&Of(e.modelBadge,n.modelBadge)}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&Of(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&&ow(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&&Of(e.modelBadge,n.modelBadge)}}}function OU(e,t){let n=t.historyWindow,{status:o}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,latestTurn:n?null:o.latestTurn,runningTurnId:n?null:o.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!n&&o.isWorking,activeTurnStartedAt:n?null:o.activeTurnStartedAt,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:n?null:o.pendingModelSelection},a=e.deriveGroups(r),s=o.latestTurn;if(n&&s&&s.completedAt!==null){let i=s.turnId;if(a.rows.some(d=>d.kind==="message"?d.message.role==="assistant"&&d.message.turnId===i:d.kind==="work"?d.groupedEntries.some(c=>c.turnId===i):d.kind==="tool-group"&&d.entries.some(c=>c.turnId===i)))return e.deriveGroups({...r,latestTurn:s})}return a}var FU=new Map,BU={markdown:()=>"",download(){}},UU=[],zU={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:UU},HU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:zU,usageByTurnId:FU,exportApi:BU,finalAssistantMessageReceived:!1},version:0};function KU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function $U(e,t,n,o){let r=OU(n,e),a=qU(t.structure.rowIds,r.rows),s=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),i=r.rows.map((g,h)=>{let v=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],y=v!==void 0&&rw(v,g)?v:g;return y!==v&&o.add(g.id),y});if(!a)for(let g of t.indexById.keys())s.has(g)||o.add(g);let l=ZS(i,r.turnGroups,t.structure.sections),d=a?t.structure.rowIds:i.map(g=>g.id),c=a&&KU(t.structure.sections,l)?t.structure:{rowIds:d,sections:l},f=e.derive.hasSettledAssistantMessage(e.timelineEntries,e.status.latestAssistantMessageId),p=t.meta.status===e.status&&t.meta.usageByTurnId===e.usageByTurnId&&t.meta.exportApi===e.exportApi&&t.meta.finalAssistantMessageReceived===f?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:f},m=o.size>0||c!==t.structure||p!==t.meta;return{inputs:e,structure:c,indexById:s,rows:i,meta:p,version:m?t.version+1:t.version}}function qU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n].id)return!1;return!0}function aw(){let e=null,t=null,n=HU,o=new Set,r=0,a=new Set,s=new Map,i=()=>{if(e===null||n.inputs===e)return n;t??=e.derive.createRowsCache();let l=new Set;n=$U(e,n,t,l);for(let d of l)o.add(d);return n};return{setInputs(l){e=l},hasInputs:()=>e!==null,flush(){if(a.size===0&&s.size===0||e===null)return;let{version:l}=i();if(l===r&&o.size===0)return;r=l;let d=[...o];o.clear();for(let c of d){let f=s.get(c);if(f!==void 0)for(let p of Array.from(f))p()}for(let c of Array.from(a))c()},subscribe(l){return a.add(l),()=>{a.delete(l)}},subscribeRow(l,d){let c=s.get(l);return c===void 0&&(c=new Set,s.set(l,c)),c.add(d),()=>{c.delete(d),c.size===0&&s.get(l)===c&&s.delete(l)}},getStructure:()=>i().structure,getRow(l){let{indexById:d,rows:c}=i(),f=d.get(l);return f===void 0?void 0:c[f]},getRows:()=>i().rows,getMeta:()=>i().meta,getVersion:()=>i().version}}ie();var VU=new Set;function sw({data:e,target:t,threadKey:n,visible:o,rowsStore:r,derive:a,resolveModelBadge:s,disclosure:i,historyWindow:l}){let d=e.useChatTimeline({target:t,threadKey:n,visible:o}),c=e.useTurnStatus({target:t,threadKey:n,visible:o}),f=Mr(),p=i.usePersistedExpandedTurnIds(n),[m,g]=Ot("timeline-auto-expanded-turns",n,VU),h=V(()=>a.resolveExpandedTurnIds(p??[],m),[m,a,p]),{latestTurn:v}=c,y=xt("timeline-latest-turn-previous",n,v);q(()=>{let x=y.current;if(y.current=v,!(!v||x?.turnId===void 0)){if(v.turnId===x.turnId){x.state==="running"&&v.state==="interrupted"&&g(b=>{let T=new Set(b);return T.add(v.turnId),T});return}g(b=>{if(!b.has(x.turnId))return b;let T=new Set(b);return T.delete(x.turnId),T})}},[v]);let C=V(()=>({derive:a,timelineEntries:d.timelineEntries,activities:d.activities,status:c,expandedTurnIds:h,resolveModelBadge:s,historyWindow:l,usageByTurnId:d.usageByTurnId,exportApi:d.export}),[d.activities,d.export,d.timelineEntries,d.usageByTurnId,a,h,l,s,c]);return(f||!r.hasInputs())&&r.setInputs(C),be(()=>{r.flush()}),null}var iw=Ce(function({data:t,target:n,threadKey:o,visible:r,...a}){let s=xt("timeline-rows-store",o,null,3);s.current??=aw();let i=s.current;return S(we,{children:[u(sw,{data:t,target:n,threadKey:o,visible:r,rowsStore:i,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),u(tw,{...a,threadKey:o,rowsStore:i,SiteIcon:t.SiteIcon})]})});ie();function lw(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var WU=1e3;function dw(e,t=WU){let[n,o]=G(null);return q(()=>{if(e===null){o(null);return}let r=globalThis.setTimeout(()=>{o(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),n}function cw({phase:e}){let{t}=fe(),n=t(lw(e));return S("div",{"aria-label":n,className:"pointer-events-none flex items-center gap-2 rounded-full border border-border/60 bg-background/90 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur","data-thread-sync-pill":"true",role:"status",children:[u(Ka,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),u("span",{className:"truncate",children:n})]})}function uw({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=fe(),s=dw(e.useThreadSyncPhase(t));return s===null&&!o?null:S("div",{className:"pointer-events-none absolute left-1/2 z-30 flex -translate-x-1/2 flex-col items-center gap-1.5 py-1.5",style:{bottom:n+4},children:[s!==null?u(cw,{phase:s}):null,o?S(ce,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[u(Zt,{}),a("timeline.scrollToEnd")]}):null]})}ie();function fw(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function pw(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var GU=150,jU=16;function mw(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function gw({inputKey:e,visible:t,endInset:n,derive:o,onReturnToLatest:r,controlRef:a}){let[s,i]=Ot("timeline-live-follow-enabled",e,!0),[l,d]=Ot("timeline-show-scroll-to-end",e,!1),c=sr(e,null),[f,p]=TS(e,null),m=E(U=>{c.current=U;let j=U?.node??null;p(oe=>oe===j?oe:j)},[c,p]),g=xt("timeline-is-at-end",e,!0),h=sr(e,null),v=E(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),y=E(()=>{v(),h.current=setTimeout(()=>{h.current=null,d(!0)},GU)},[v,d,h]);q(()=>v,[v]);let C=E(()=>{let U=c.current?.measure();return U==null?void 0:{contentLength:U.contentLength,scroll:U.scroll,scrollLength:U.scrollLength}},[c]),x=xt("timeline-scroll-mode",e,"following-end"),b=Ya(t);be(()=>()=>b.cancel(),[b,e]);let T=xt("timeline-user-scroll-generation",e,0),I=xt("timeline-live-follow-generation",e,0),k=xt("timeline-disclosure-reading-lock",e,fw),P=xt("timeline-last-row-id",e,null),w=E(()=>{b.cancel(),T.current+=1,x.current="free-scrolling",I.current=null,i(!1)},[b,I,x,i,T]),L=E(()=>{k.current.lock(),w(),g.current=!1,v(),d(!0)},[v,g,w,k,d]),A=N(w);A.current=w;let M=E(()=>{let U=c.current?.measure(),j=P.current;if(!U||j===null)return!1;let oe=QI(U,j);return oe===null?!1:oe>Math.max(0,U.scrollLength-n-jU)},[n,c,P]),R=E(U=>{k.current.resume();let j=++T.current;g.current=!0,x.current="following-end",I.current=T.current,i(!0),v(),d(!1),b.request(()=>{pw({requestedGeneration:j,currentGeneration:T.current,mode:x.current,readingLocked:k.current.isLocked()})&&c.current?.scrollToEnd({animated:U})})},[v,b,c,g,I,k,x,i,d,T]),D=N(r);D.current=r;let H=E((U=!1)=>{let j=D.current;if(j){j(()=>R(U));return}R(U)},[R]),W=E(()=>H(!0),[H]),F=E(()=>{k.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(C(),n)===!0&&H())},[o,n,g,C,k,H]);q(()=>{if(!t||f===null)return;let U=null,j=requestAnimationFrame(()=>{let oe=()=>{A.current()},Q=le=>{let se=le instanceof Element?le:null;for(;se&&se!==f;){if(se instanceof HTMLElement&&se.scrollHeight>se.clientHeight+1&&se.scrollTop+se.clientHeight<se.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(se).overflowY))return!1;se=se.parentElement}return se===f},ne=le=>{k.current.isLocked()&&Q(le)&&F()},re=null,Z=!1,te=f.scrollTop,ue=le=>{re=le.touches[0]?.clientY??null},Me=()=>{re=null,Z=!1},Oe=()=>{let le=f.scrollTop;Z&&le>te&&ne(f),te=le},ke=()=>M(),Ee=()=>o.resolveIsAtEnd(C(),n)===!1,ee=le=>{le.deltaY>0&&ne(le.target),le.deltaY<0&&ke()&&oe()},Se=le=>{let se=le.touches[0]?.clientY??null,$e=re!==null&&se!==null&&se<re;re=se,Ee()&&oe(),$e&&ne(le.target)},X=le=>{if(le.target===f){Z=!0,te=f.scrollTop,ke()&&oe();return}Ee()&&oe()},de=le=>{if(!(le.target instanceof Element?le.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(le.key){case"PageUp":case"Home":case"ArrowUp":ke()&&oe();break;case"PageDown":case"End":case"ArrowDown":ne(le.target);break;case" ":le.shiftKey||ne(le.target);break;default:break}};f.addEventListener("wheel",ee,{passive:!0}),f.addEventListener("touchmove",Se,{passive:!0}),f.addEventListener("touchstart",ue,{passive:!0}),f.addEventListener("touchend",Me,{passive:!0}),f.addEventListener("touchcancel",Me,{passive:!0}),f.addEventListener("scroll",Oe,{passive:!0}),window.addEventListener("pointerup",Me,{passive:!0}),window.addEventListener("pointercancel",Me,{passive:!0}),f.addEventListener("pointerdown",X,{passive:!0}),f.addEventListener("keydown",de),U=()=>{f.removeEventListener("wheel",ee),f.removeEventListener("touchmove",Se),f.removeEventListener("touchstart",ue),f.removeEventListener("touchend",Me),f.removeEventListener("touchcancel",Me),f.removeEventListener("scroll",Oe),window.removeEventListener("pointerup",Me),window.removeEventListener("pointercancel",Me),f.removeEventListener("pointerdown",X),f.removeEventListener("keydown",de)}});return()=>{cancelAnimationFrame(j),U?.()}},[M,o,n,e,C,k,F,f,t]);let J=E(U=>{P.current=U},[P]),O=E(U=>{if(k.current.isLocked()){g.current=!1,v(),d(!0);return}if(!U&&I.current===T.current){v(),d(!1);return}g.current!==U&&(g.current=U,U?(x.current="following-end",I.current=T.current,i(!0),v(),d(!1)):(x.current="free-scrolling",I.current=null,y()))},[v,g,I,k,y,x,i,d,T]),B=N(H);B.current=H;let Y=V(()=>({followEnd:U=>B.current(U?.animated??!1)}),[]);return be(()=>(mw(a,Y),()=>mw(a,null)),[Y,a]),{liveFollowEnabled:s,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:J,onIsAtEndChange:O,onManualNavigation:w,onDisclosureNavigation:L,returnToEnd:W}}ie();ie();var hw=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var vw=50,QU=32,wh=class extends Zr{getSnapshotBeforeUpdate(t){return(t.inputKey!==this.props.inputKey||t.rows!==this.props.rows||t.expandedRows!==this.props.expandedRows||t.visible&&!this.props.visible)&&t.capture(),null}componentDidUpdate(){}componentWillUnmount(){this.props.capture()}render(){return this.props.children}};function yw(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let n=e.querySelector("thead"),o=t.top+(n?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=Zs(r,o),s=[];if(a<0)return s;for(let i=a;i<r.length;i+=1){let l=r[i];if(l.getBoundingClientRect().top>=t.bottom)break;let d=l.querySelectorAll("[data-timeline-row-id]"),c=Zs(d,o);if(!(c<0))for(let f=c;f<d.length;f++){let p=d[f];if(p.getBoundingClientRect().top>=t.bottom)break;s.push(p)}}return s}function XU(e){let t=[];for(let n=0;n<e.length;n+=vw)t.push(e.slice(n,n+vw));return t}function YU({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let s=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),i=s===null?[]:[s.input,s.output].filter(d=>d!==void 0&&d.length>0),l=s?.input!==void 0&&s?.output!==void 0?i.join(`
3757
+ `):null,contexts:o}}function yI(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 fh(e){let t=ec(e),n=wB(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var TB=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function CI(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Rf(o))}return t.join(" ")}function Rf(e){let t=e.trim(),n=TB.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,"-")}`:yI({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function xI(e,t){let n=0;for(let o of t){let r=Rf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function ph({row:e}){let t=Ct(rn).derive;if(Pf(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?S(Ie,{children:[u(LB,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(ph,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(RB,{row:e})}return u(PB,{row:e,text:e.message.text})}function mh({images:e}){let t=Ct(rn),{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=lh(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 PB({row:e,text:t}){let{t:n}=dt(),o=Ct(rn),r=e.message.attachments??[],a=fh(t),s=a.contexts,i=[],l=a.visibleText;for(;;){let v=ch(l);if(!v.annotation)break;i.unshift(v.annotation),l=v.promptText}let d=ec(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=>rs(v)==="image"),g=p.filter(v=>rs(v)!=="image"),h=e.message.author??null;return S("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(kB,{author:h}),S("div",{className:"min-w-0 flex-1 space-y-2",children:[S("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:h?.displayName??n("message.user")}),S(Qe,{children:[u(Ye,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:ns(e.message.createdAt,o.timestampFormat,n)}),u(Xe,{children:ts(e.message.createdAt,o.timestampFormat)})]}),S("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(EB,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(nl,{text:a.copyText,variant:"ghost"})]})]}),S("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(mh,{images:m}),g.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(v=>u(gh,{attachment:v},v.id))}),i.map((v,y)=>u(_B,{annotation:v,image:f[y]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(NB,{context:v},`${v.header}:${v.body}`))}):null,u(UB,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:s,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function kB({author:e}){let t=e;return t!==null?u(Wb,{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(Mr,{className:"size-4"})})}function Ef({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 LB({parsed:e}){let{t}=dt();return S(Ef,{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 AB={"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 RB({row:e}){let{t}=dt(),n=Ct(rn).derive,o=e.message.attachments??[],r=o.filter(l=>rs(l)==="image"),a=o.filter(l=>rs(l)!=="image"),s=l=>{let d=dI(l);if(d)return S(Ef,{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 S(Ef,{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?S(Ef,{children:[u("p",{className:"font-medium text-foreground/80",children:t(AB[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},i=lI(e.message.text).map(s).filter(l=>l!==null);return i.length===0&&o.length===0?null:S(Ie,{children:[i.map((l,d)=>u(Ha,{children:l},d)),o.length>0?S("div",{className:"min-w-0 px-3 py-2",children:[u(mh,{images:r}),a.map(l=>u(gh,{attachment:l},l.id))]}):null]})}function II(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Pf(e??""))return null;let r=fh(n??e??"").visibleText;for(;;){let i=ch(r);if(!i.annotation)break;r=i.promptText}let a=ec(r).promptText,s=uh(a).map(i=>i.kind==="text"?i.text:i.comment.text).join(" ").replace(/\s+/g," ").trim();return s.length>0?s:null}var wI=34,TI=8,Mf=wI+TI,PI=ye(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:s}=dt(),i=s(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:TI},"data-timeline-turn-header":"true","data-truncated":"false",children:S("div",{className:K("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:wI}},children:[u("span",{ref:n,className:K("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),S(Qe,{children:[u(Ye,{render:u(ce,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":i,onClick:a}),children:r?u(Cd,{}):u(tn,{})}),u(Xe,{side:"bottom",children:i})]})]})})});function EB({messageId:e,onFork:t}){let{t:n}=dt(),o=n("fork.action");return S(Qe,{children:[u(Ye,{render:u(ce,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Td,{className:"size-3"})}),u(Xe,{side:"top",children:o})]})}function kI({row:e}){let t=Ct(rn),{t:n}=dt(),[o,r]=Po(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Tf,{state:"idle",children:S("button",{type:"button",className:K(wf,"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(Yd,{status:null}),u(Xd,{children:u(ra,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(tn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let s=e.message.attachments??[],i=s.filter(c=>rs(c)==="image"),l=s.filter(c=>rs(c)!=="image"),d=e.message.text||(e.message.streaming||s.length>0?"":n("timeline.emptyResponse"));return u(Ie,{children:S("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"?S("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(nl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(hh,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u("div",{"data-assistant-quote-body":"",children:u(Ko,{disclosureKey:`message:${e.message.id}:assistant`,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,onImageExpand:t.onImageExpand})}),u(mh,{images:i}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(gh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?S("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 [@media(pointer:coarse)]:opacity-100",children:[u(MB,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&S(Qe,{children:[u(Ye,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:ns(e.message.updatedAt,t.timestampFormat,n)}),u(Xe,{children:ts(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function MB({row:e}){let n=Ct(rn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(nl,{text:n.text??"",variant:"ghost"}):null}var bI=ye(function(t){let n=t.context.body.length>0?`${t.context.header}
3758
+ ${t.context.body}`:t.context.header;return u(vI,{label:t.context.header,tooltipText:n})}),NB=ye(function(t){let n=t.context.body?`${t.context.header}
3759
+ ${t.context.body}`:t.context.header;return S(Qe,{children:[S(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(Rr,{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 gh(e){let{t}=dt(),n=rs(e.attachment),o=cI(n),r=t("attachments.open",{name:e.attachment.name}),a=S(Ie,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),S("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:iI(e.attachment.sizeBytes)})]})]}),s=e.attachment.previewUrl?uI(e.attachment):null;return e.attachment.previewUrl&&s!==null?S("div",{className:"flex max-w-sm flex-col gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:[u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 hover:underline",children:a}),s==="video"?u("video",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,playsInline:!0,preload:"metadata",className:"aspect-video w-full rounded-sm bg-black"}):u("audio",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,preload:"metadata",className:"h-10 w-full"})]}):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 _B(e){let t=Ct(rn),{t:n}=dt();return S("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=lh([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:n("previewAnnotation.cropAlt"),className:"size-full object-cover"})}):null,S("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,S("div",{className:K("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?S("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(Ks,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var DB=8,OB=600,FB=1.75,SI=`linear-gradient(to bottom, black calc(100% - ${FB}rem), transparent)`;function BB(e){return e.trim().length===0?!1:e.length>OB||e.split(`
3760
+ `).length>DB}var UB=ye(function(t){let n=Ct(rn),{t:o}=dt(),[r,a]=Po(n.threadKey,`${t.disclosureKey}:expanded`,!1),s=t.text.trim().length>0||t.terminalContexts.length>0,i=s&&BB(t.text),l=i&&!r;return S("div",{children:[s?u("div",{className:K("relative",l&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":l?"true":"false","data-user-message-collapsible":i?"true":"false","data-user-message-fade":l?"true":"false",style:l?{WebkitMaskImage:SI,maskImage:SI}:void 0,children:u(zB,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,i||t.footer?S("div",{className:K("mt-1.5 flex items-center gap-2",i&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[i?u(ce,{type:"button",size:"xs",variant:"ghost","aria-expanded":r,"data-scroll-anchor-ignore":!0,onClick:()=>a(!r),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:o(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),zB=ye(function(t){let n=Ct(rn),o=(a,s)=>{let i=/^\s+/.exec(a)?.[0]??"",l=a.slice(i.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return S(Ha,{children:[i?u("span",{"aria-hidden":"true",children:i}):null,c?u(Ko,{disclosureKey:`${t.disclosureKey}:inline:${s}`,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]},s)},r=uh(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(Ko,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,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(HB,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=xI(t.text,t.terminalContexts),s=CI(t.terminalContexts),i=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Rf(d.header),f=t.text.indexOf(c,l);if(f===-1){i.length=0;break}f>l&&i.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),i.push(u(bI,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(i.length>0)return l<t.text.length&&i.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:i})}for(let l of t.terminalContexts)i.push(u(bI,{context:l},`user-terminal-context-inline:${l.header}`)),i.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)i.push(u(Ko,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:n.onImageExpand},"user-message-terminal-context-inline-text"));else if(s.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}return t.text.length===0?null:u(Ko,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:n.onImageExpand})});function HB({comment:e,disclosureKey:t}){let n=Ct(rn),{t:o}=dt(),r=e.fenceLanguage??"diff",a=mI(e);return S("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[S("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:If(e.filePath,n.workspaceRoot)}),S("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??o("timeline.reviewCommentDefaultSection")," \xB7"," ",e.rangeLabel??o("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(hI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(Ko,{disclosureKey:`${t}:fence`,text:pI(r,e.diff),cwd:n.markdownCwd,threadRef:n.threadRef??void 0,skills:n.skills,className:"text-message-foreground"}),a?u(uS,{patch:a}):null]})}function KB({badge:e}){return S(Ie,{children:[e.driverKind?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(nr,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,S("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?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?S("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function hh({badge:e,createdAt:t}){let n=Ct(rn),{t:o}=dt();return S("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(KB,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),S(Qe,{children:[u(Ye,{render:u("span",{className:"shrink-0 tabular-nums"}),children:ns(t,n.timestampFormat,o)}),u(Xe,{children:ts(t,n.timestampFormat)})]})]})}function LI({row:e}){let{t}=dt(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,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 S("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"}),S("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?u(nr,{driver:e.badge.driverKind,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 vh=240,$B=/\s/u;function AI(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>vh-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($B.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>vh)||(t.push(a),n+=a.length,n>vh))return r()}return t.length>0?t.join(""):null}function qB(e,t,n){let o=t.find(s=>s.kind==="message"&&s.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let s of t)s.kind==="message"&&s.message.role==="assistant"&&(a=s.message.text??null);return{id:e,sectionKey:e,anchorRowId:o?.id??t[0]?.id??e,userText:r===null?null:AI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:AI(a),headerText:r===null?null:II(r.text,n)}}function VB(e){for(let t of e){let n=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(n!==null)return n}return null}function WB(e,t){return e.sectionKey===t.sectionKey&&e.anchorRowId===t.anchorRowId&&e.userText===t.userText&&e.assistantText===t.assistantText&&e.headerText===t.headerText&&e.turnId===t.turnId}function GB(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function jB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function QB(e){let t=new Map,n=null;return o=>{let r=o.getVersion();if(n!==null&&n.store===o&&n.version===r)return n.entries;let a=new Map,s=[],i=o.getRows();for(let d of o.getStructure().sections){let c=t.get(d.key);if(c!==void 0&&c.rowIds===d.rowIds&&GB(c.rows,d,i)){a.set(d.key,c),s.push(c.entry);continue}let f=i.slice(d.firstRowIndex,d.firstRowIndex+d.rowIds.length),p=qB(d.key,f,e),m={...p,turnId:VB(f)},g=c!==void 0&&WB(c.entry.item,m)?c.entry:{summary:p,item:m};a.set(d.key,{rowIds:d.rowIds,rows:f,entry:g}),s.push(g)}t=a;let l=n!==null&&jB(n.entries,s)?n.entries:s;return n={store:o,version:r,entries:l},l}}var RI=new WeakMap;function NI(e,t){let n=RI.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:QB(t)},RI.set(e,n)),n.read(e)}var EI=new WeakMap;function _I(e,t){let n=NI(e,t),o=EI.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),EI.set(n,o)),o}function DI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n.sectionKey===t[o].sectionKey&&n.text===t[o].text)}var MI=new WeakMap;function OI(e,t){let n=NI(e,t),o=MI.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),MI.set(n,o)),o}function FI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}le();var XB=[],YB=e=>e.getMeta().usageByTurnId,JB=e=>e.getMeta().exportApi,BI=ye(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:s,onTurnNavigatorChange:i}){let l=E(m=>o?OI(m,n):XB,[n,o]),d=os(t,l,FI),c=os(t,YB),f=os(t,JB),p=V(()=>o?{items:d,totalTurnCount:r,bottomInset:a,usageByTurnId:c,onSelect:s,exportMarkdown:f.markdown,onDownload:f.download}:null,[a,f,d,s,o,r,c]);return q(()=>{p!==null&&i(p)},[i,p]),q(()=>{if(o)return()=>i(null)},[i,o]),null});le();function UI(){let e=Uo(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,s)=>e.notify(r,a,s);return{error:(r,a,s)=>{let i=s?.description??t(a);o(n(r,i),"error",i)},warning:(r,a,s)=>{let i=s?.description??t(a);o(n(r,i),"warning",i)},success:(r,a,s)=>{let i=a??s?.description;o(n(r,i),"success",i)}}}function Nf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function yh(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(`
3761
+ `)}function zI(e,t,n){let o=n?.maxLines??8,r=yh(e).trimEnd().split(/\r?\n/).map(l=>l.trimEnd()),a=[],s=0,i=!1;for(let l of r){let d=l.trim().length>0;if(d&&s>=o){i=!0;break}a.push(l),d&&(s+=1)}for(;a.length>0&&a.at(-1)?.trim().length===0;)a.pop();return a.length===0?Nf(e)??t("proposedPlan.previewUnavailable"):(i&&a.push("","..."),a.join(`
3762
+ `))}function ZB(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function HI(e){let t=Nf(e);return`${ZB(t??"plan")}.md`}function KI(e){return`${e.trimEnd()}
3763
+ `}function $I(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 _f=1024,qI=ye(function({planMarkdown:t,threadKey:n,rowId:o,environmentId:r,threadRef:a,cwd:s,workspaceRoot:i,onSavePlanToWorkspace:l}){let{t:d}=dt(),c=UI(),[f,p]=Po(n,`proposed-plan:${o}:expanded`,!1),[m,g]=Q(!1),[h,v]=Po(n,`proposed-plan:${o}:save-path`,""),[y,C]=Q(!1);Hu(o,m||y);let x=N(!1),b=N(!1);xe(()=>(x.current=!0,()=>{x.current=!1}),[]);let{copyToClipboard:w,isCopied:I}=bf({target:"plan",onError:O=>{c.error(d("proposedPlan.couldNotCopy"),O,{description:d("proposedPlan.copyErrorDescription")})}}),k=kr(),P=Nf(t)??d("proposedPlan.defaultTitle"),T=t.split(`
3764
+ `).length,L=t.length>900||T>20,A=yh(t),M=L?zI(t,d,{maxLines:10}):null,R=HI(t),D=KI(t),H=()=>{$I(R,D)},W=()=>{w(D)},F=()=>{if(!i){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(R.slice(0,_f)),g(!0)},J=()=>{if(b.current)return;let O=h.trim();if(!(!i||l===null)){if(!O){c.warning(d("proposedPlan.enterWorkspacePath"));return}if(O.length>_f){c.warning(d("proposedPlan.pathTooLong"));return}b.current=!0,C(!0),(async()=>{try{let B=await l({environmentId:r,workspaceRoot:i,relativePath:O,contents:D});if(!x.current)return;B.ok?(g(!1),c.success(d("proposedPlan.savedToWorkspace"),B.relativePath)):c.error(d("proposedPlan.couldNotSave"),void 0,{description:d("proposedPlan.saveErrorDescription")})}catch(B){x.current&&c.error(d("proposedPlan.couldNotSave"),B,{description:d("proposedPlan.saveErrorDescription")})}finally{b.current=!1,x.current&&C(!1)}})()}};return S("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[S("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[S("div",{className:"flex min-w-0 items-center gap-2",children:[u(Nr,{variant:"secondary",children:d("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:P})]}),S(go,{children:[u(vo,{render:u(ce,{"aria-label":d("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(zo,{"aria-hidden":"true",className:"size-4"})}),S(ho,{align:"end",children:[u(Ho,{onClick:W,children:d(I?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(Ho,{onClick:H,children:d("proposedPlan.downloadAsMarkdown")}),l!==null?u(Ho,{onClick:F,disabled:!i||y,children:d("proposedPlan.saveToWorkspace")}):null]})]})]}),S("div",{className:"mt-4",children:[S("div",{className:K("relative",L&&!f&&"max-h-104 overflow-hidden"),children:[L&&!f?u(Ko,{disclosureKey:`proposed-plan:${o}:plan`,text:M??"",cwd:s,threadRef:a,isStreaming:!1}):u(Ko,{disclosureKey:`proposed-plan:${o}:plan`,text:A,cwd:s,threadRef:a,isStreaming:!1}),L&&!f?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]}),L?u("div",{className:"mt-4 flex justify-center",children:u(ce,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!f),children:d(f?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(ef,{open:m,onOpenChange:O=>{y||g(O)},children:S(rf,{className:"max-w-xl",children:[S(of,{children:[u(af,{children:d("proposedPlan.saveToWorkspace")}),u(tf,{children:Zd(d("proposedPlan.pathHint"),u("code",{children:i??d("proposedPlan.theWorkspace")}),"path")})]}),u(Xb,{className:"space-y-3",children:S("label",{htmlFor:k,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(Qi,{id:k,value:h,maxLength:_f,onChange:O=>v(O.target.value.slice(0,_f)),placeholder:R,spellCheck:!1,disabled:y})]})}),S(nf,{children:[u(ce,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:y,children:d("proposedPlan.cancel")}),u(ce,{size:"sm",onClick:()=>{J()},disabled:y,children:d(y?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function VI({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function WI(e,t){let n=e.topOf(t),o=e.heightOf(t);return typeof n!="number"||typeof o!="number"||!Number.isFinite(n)||!Number.isFinite(o)?null:n+Math.max(1,o)}function GI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}le();var sl=class extends Zr{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 eU({error:e,className:t}){let{t:n}=dt();return S(Qe,{children:[S(Ye,{render:u("div",{className:K("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(hn,{"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 jI(e){return u(eU,{error:e})}var rn=yt(null),YI=yt(null),tU=u("div",{className:"h-3 sm:h-4"}),nU=u("div",{className:"h-10 sm:h-12"}),oU=Object.freeze([]);function rU({loading:e,blocked:t,onLoadEarlier:n,fade:o}){let{t:r}=dt();return u("div",{className:o?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:n,disabled:e||t,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:r(e?"timeline.loadingEarlier":"timeline.loadEarlier")})})})}function aU({loading:e,blocked:t,onLoadLater:n,onReturnToLatest:o}){let{t:r}=dt();return S("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[u(ce,{variant:"ghost",size:"sm",onClick:n,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),o?u(ce,{variant:"ghost",size:"sm",onClick:o,children:r("timeline.returnToLatest")}):null]})}function sU({onReveal:e,fade:t}){let{t:n}=dt();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:n("timeline.loadEarlier")})})})}var iU=u("div",{className:"h-3 sm:h-4"}),lU=[],dU=new Set,cU=200,QI=1e4,uU=20;function XI(e,t){let n=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),o=n.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=o<0?n:n.slice(0,o+1);for(let a of r)a.style.contentVisibility="visible";e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility")})}var Ch=600;function xh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let n=e;n&&n!==t;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight&&n.scrollTop>0)return!0;n=n.parentElement}return!1}var fU=()=>{},pU=[];function mU(e){let t=e.getMeta().status;return{latestTurn:t.latestTurn??null,latestAssistantMessageId:t.latestAssistantMessageId??null,isWorking:t.isWorking,workingStepLabel:t.workingStepLabel??null,stall:t.stall??null,retry:t.retry??null,totalTurnCount:t.totalTurnCount??null,scheduledWakes:t.scheduledWakes??oU}}function gU(e,t){return e.latestTurn===t.latestTurn&&e.latestAssistantMessageId===t.latestAssistantMessageId&&e.isWorking===t.isWorking&&e.workingStepLabel===t.workingStepLabel&&e.stall===t.stall&&e.retry===t.retry&&e.totalTurnCount===t.totalTurnCount&&e.scheduledWakes===t.scheduledWakes}var hU=e=>e.getMeta().finalAssistantMessageReceived;function vU(e,t){let n=N(e);return t&&(n.current=e),n.current}var JI=ye(function({derive:t,SiteIcon:n,rowsStore:o,threadKey:r,threadRef:a,environmentId:s,onInterrupt:i=null,onRespondToDecision:l=null,onCancelScheduledWake:d=null,agentPanelModel:c,onOpenAgents:f=fU,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:C,skills:x=lU,onRowsChange:b,contentInsetEndAdjustment:w,liveFollowEnabled:I,awaitingUserDecision:k=!1,onIsAtEndChange:P,onManualNavigation:T,onDisclosureNavigation:L=T,hideEmptyPlaceholder:A=!1,topFadeEnabled:M=!1,scrollerRef:R,loadEarlier:D=null,loadLater:H=null,pagingBlockedByInteraction:W=!1,onReturnToLatest:F=null,onVisibleTurnRangeChange:J=null,revealMessageRequest:O=null,onRevealMessageHandled:B,revealQuoteRequest:Y=null,onRevealQuoteDone:U,renderWorkGroup:X,renderToolCallDetail:re,loadScrollAnchor:G,saveScrollAnchor:te,useVisibleThreadCompletion:oe,onSavePlanToWorkspace:Z,paneActive:ee,onTurnNavigatorChange:fe}){let{t:Re}=dt(),{latestTurn:Be,latestAssistantMessageId:Se,isWorking:Ee,workingStepLabel:ne,stall:we,retry:j,totalTurnCount:ue,scheduledWakes:ge}=os(o,mU,gU),ie=Ar(),He=N(ie);He.current=ie;let Pt=N(O);Pt.current=O;let[ct,gt]=Ft("timeline-disclosure-reading",r,!1),bt=N(r);bt.current=r;let ut=N(W);ut.current=W;let mt=xt("timeline-following-end",r,!0);mt.current=H===null&&I;let st=xt("timeline-scroll-restore-pending",r,!1),lt=rr(r,null),At=rr(r,null),Wt=rr(r,null),fn=xt("timeline-content-inset",r,w),at=N(null),Mt=rr(r,[]),Ht=rr(r,!1),nn=N(null),Kt=E(()=>Mt.current,[Mt]),jt=E(z=>{Mt.current=z,nn.current?.(),Ve.current?.schedule()},[Mt]),yn=E(z=>{Ht.current=z,Ve.current?.schedule()},[Ht]),$=E(z=>{z!==null&&(at.current=z),R(z)},[R]);xe(()=>{VI({timeline:at.current,previousOverlayHeight:fn.current,overlayHeight:w,followingEnd:ie&&H===null&&I&&!ct}),fn.current=w},[w,ct,I,H,ie]),q(()=>()=>{At.current?.stop()},[]);let ae=E(()=>{At.current?.stop(),At.current=null,lt.current=null,gt(!1)},[lt,At,gt]),de=E(z=>{L(),lt.current=z,gt(!0),At.current?.stop();let Le=at.current?.node??null;if(!Le)return;let nt=Array.from(Le.querySelectorAll("[data-timeline-row-id]")).find($n=>$n.dataset.timelineRowId===z);if(!nt)return;let $t=Wt.current;At.current=jS({viewport:Le,row:nt,anchor:$t&&nt.contains($t)?$t:nt,scrollToOffset:$n=>{Le.scrollTop=$n}})},[L]),Pe=xt("timeline-live-follow-previous",r,I);xe(()=>{I&&!Pe.current&&ae(),Pe.current=I},[I,ae]);let _e=vU(H!==null,ie),ft=!_e&&Ee,pn=_e?null:ne,St=_e?null:we,ht=_e?null:j,kt=aI(o),je=kt.sections,Qt=kt.rowIds.length,Zt=E(z=>{let Le=o.getRows().find(nt=>nt.id===z||nt.kind==="work"&&nt.groupedEntries.some($t=>$t.id===z)||nt.kind==="tool-group"&&nt.entries.some($t=>$t.id===z));de(Le?.id??z)},[o,de]),Te=xt("timeline-scroll-snapshot",r,null),$e=E((z,Le=mt.current)=>{z.scrollLength<=0||(Te.current={threadKey:r,anchor:GI({measurement:z,followingEnd:Le})})},[mt,r,Te]),qe=E(()=>{let z=Te.current;z&&te(z.threadKey,z.anchor)},[te,Te]),ot=E(()=>{if(!ie||st.current)return;if(Qt===0){qe();return}let z=at.current?.measure();z&&z.scrollLength>0&&($e(z,mt.current&&t.resolveIsAtEnd(z,w)!==!1),qe())},[$e,w,t,mt,ie,qe,st,Qt]),rt=JS(r),tt=N(rt);tt.current=rt;let It=xt("timeline-top-reveal-armed",r,!0),Bt=xt("timeline-network-prepend-awaiting-navigation",r,!1),wn=N(null),on=N(null);xe(()=>()=>{on.current!==null&&(cancelAnimationFrame(on.current),on.current=null)},[r,ie]);let mn=xt("timeline-network-prepend-scroll-top",r,null),Hn=xt("timeline-mounted-section-keys",r,dU,3),En=rr(r,null),Ce=En.current,Ze=Ce===null?-1:je.findIndex(z=>z.key===Ce.firstMountedSectionKey),_t=Ze>0?je.length-Math.max(0,Ze-sh):rt.revealedCount,vt=Ze>0?_t:rt.revealedCount,cn=AS(je.map(z=>z.key),Hn.current,vt,H!==null||!I||ct||Ht.current||Mt.current.length>0),{startIndex:vn,hasHiddenOlder:ln}=YS(je.length,cn),en=V(()=>je.slice(vn),[vn,je]),Kn=Ce!==null&&Ze>0&&vn<Ze,Dt=N(je);Dt.current=je,xe(()=>{if(ie){if(Hn.current=new Set(en.map(z=>z.key)),Ce!==null){let z=ZS(Ce,{prefixMounted:Kn,loading:D===null?null:D.loading,sections:je,now:Date.now()});z!=="waiting"&&(En.current=null),z==="mounted"&&(Bt.current=!0)}cn<tt.current.revealedCount?tt.current.compactTo(cn):cn>tt.current.revealedCount&&tt.current.revealAtLeast(cn)}},[Bt,D,ie,Ce,Kn,En,Hn,cn,je,en]);let Tn=rr(r,null),Qn=E((z=null)=>{if(!He.current)return;let Le=at.current?.node;Le&&(Tn.current={scrollHeight:Le.scrollHeight,scrollTop:Le.scrollTop,row:at.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:z,until:Date.now()+QI})},[Tn]),$r=E(()=>{let z=Tn.current;if(z===null||z.firstMountedSectionKey===null||Date.now()>z.until)return;let Le=at.current?.node;if(!Le)return;let nt=Te.current;z.scrollHeight=Le.scrollHeight,z.scrollTop=Le.scrollTop,z.row=nt?.threadKey===r?nt.anchor:null},[Tn,r,Te]);xe(()=>{if(!ie)return;let z=Tn.current;if(!z)return;if(Date.now()>z.until){Tn.current=null;return}if(z.firstMountedSectionKey!==null&&En.current!==null)return;Tn.current=null;let Le=at.current?.node;if(Le){if(z.row){XI(Le,z.row.rowId);let nt=at.current?.measure()?.topOf(z.row.rowId);nt!=null&&(Le.scrollTop=nt+z.row.offsetPx)}else Le.scrollTop=z.scrollTop+(Le.scrollHeight-z.scrollHeight);Kn&&(mn.current=Le.scrollTop)}},[mn,ie,Ce,Kn,vn,kt]);let Na=E(()=>{Qn(),tt.current.revealOlder()},[Qn]),ze=N(Na);ze.current=Na;let qr=N(ln);qr.current=ln;let Do=N(null),Vr=xt("timeline-scroll-restore",r,void 0);if(Vr.current===void 0&&Qt>0){let z=G(r);Vr.current=z!==null&&kt.rowIds.includes(z.rowId)?z:null}let Ts=Vr.current??null,Oo=N(()=>{}),[Cn,Ir]=Ft("timeline-scroll-restore-settled",r,!1),Wr=Ts!==null&&!Cn,Ps=xt("timeline-last-anchor-save",r,0);q(()=>{let z=Ts;if(!ie||Cn||z===null)return;if(Pt.current!==null){Ir(!0);return}let Le=null,nt=requestAnimationFrame(()=>{!He.current||bt.current!==r||(T(),tt.current.revealAtLeast(al(Dt.current,z.rowId,tt.current.revealedCount)),Le=requestAnimationFrame(()=>{!He.current||bt.current!==r||(Ir(!0),Oo.current(z.rowId,-z.offsetPx))}))});return()=>{cancelAnimationFrame(nt),Le!==null&&cancelAnimationFrame(Le)}},[T,ie,r,Ts,Cn]);let uo=xt("timeline-restore-after-presentation",r,!1),Mn=Wr||uo.current;st.current=Mn,xe(()=>{if(ie)return()=>{bt.current!==r?qe():ot(),uo.current=!0}},[ie,r]),xe(()=>{if(!ie||!uo.current)return;if(Pt.current!==null){uo.current=!1,st.current=!1;return}let z=null,Le=null,nt=()=>{!He.current||bt.current!==r||(at.current?.scrollToEnd(),uo.current=!1,st.current=!1,mt.current=H===null,Fa.current=H===null,Xn.current={...Xn.current,followEnabled:!0,restoreInProgress:!1},P(H===null))},$t=G(r),$n=$t!==null&&Dt.current.some(za=>za.rowIds.includes($t.rowId));return $t===null?z=requestAnimationFrame(nt):$n?(T(),tt.current.revealAtLeast(al(Dt.current,$t.rowId,tt.current.revealedCount)),z=requestAnimationFrame(()=>{Le=requestAnimationFrame(()=>{!He.current||bt.current!==r||(Oo.current($t.rowId,-$t.offsetPx),uo.current=!1,st.current=!1)})})):Qt>0&&(z=requestAnimationFrame(nt)),()=>{z!==null&&cancelAnimationFrame(z),Le!==null&&cancelAnimationFrame(Le)}},[G,H,P,T,ie,r,Qt,je.length]);let Gr=E(z=>{ae(),T(),tt.current.revealAtLeast(al(Dt.current,z.anchorRowId,tt.current.revealedCount));let Le=r;requestAnimationFrame(()=>{bt.current===Le&&Oo.current(z.anchorRowId,24)})},[T,ae,r]);q(()=>{if(O===null||!ie)return;ae(),T();let z=t.resolveToolGroupRevealRowId(o.getRows(),O.rowId);tt.current.revealAtLeast(al(Dt.current,z,tt.current.revealedCount));let Le=requestAnimationFrame(()=>{bt.current===r&&(Oo.current(z,24),B?.())});return()=>cancelAnimationFrame(Le)},[O,ie,T,ae,B,t,r,o]);let jr=N(null);q(()=>{if(Y===null||!ie)return;let z=jr.current;if((z===null||z.request!==Y)&&(z={request:Y,pages:0,done:!1},jr.current=z),z.done)return;let{quote:Le}=Y,nt=Le.messageId;if(!o.getRows().some($t=>$t.id===nt)){if(D?.loading)return;let $t=Do.current;if($t!==null&&z.pages<uU){z.pages+=1,$t();return}z.done=!0,U?.("message-missing");return}z.done=!0,ae(),T(),tt.current.revealAtLeast(al(Dt.current,nt,tt.current.revealedCount)),requestAnimationFrame(()=>{bt.current===r&&(Oo.current(nt,24),requestAnimationFrame(()=>{let $t=at.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(nt)}"]`),$n=$t?tI($t,Le):null,za=at.current?.node;if($n&&za){let Mg=$n.getBoundingClientRect().top-za.getBoundingClientRect().top-za.clientHeight/3;at.current?.scrollToOffset(za.scrollTop+Mg)}$n&&nI($n),U?.($n?"found":"passage-missing")}))})},[Y,ie,kt,D,o,U,T,ae,r]);let Ke=E(z=>ie?_I(z,t):pU,[t,ie]),fo=os(o,Ke,DI),_a=N(fo);_a.current=fo;let Da=xt("timeline-active-header",r,null),Oa=fo.at(-1)?.text??null,wr=Oa!==null,ks=N(null),Fo=N(null),[Tr,Pn]=Ft("timeline-pinned-header-expanded",r,!1),Pr=N(Tr);Pr.current=Tr;let Qr=E(()=>{if(!He.current)return;let z=ks.current,Le=Fo.current;!z||!Le||(z.dataset.truncated=Pr.current||Le.scrollWidth>Le.clientWidth+1?"true":"false")},[]),[Hi,Ls]=Q(null),As=os(o,hU),[gn,Ki]=Q(null),Xr=E(()=>{if(ut.current||bt.current!==r||D===null||D.loading)return;let z=en[0]?.key;z!==void 0&&(Qn(z),En.current={firstMountedSectionKey:z,loadingObserved:!1,sectionsWhileLoading:Dt.current,until:Date.now()+QI},D.onLoadEarlier())},[Qn,D,En,r,en]);Do.current=D===null||D.loading||W?null:Xr;let Rs=E(()=>{ut.current||bt.current!==r||(Qn(),H?.onLoadLater())},[Qn,H,r]),ld=E((z,Le)=>{if(!He.current)return;let nt=at.current?.node;nt&&(XI(nt,z),at.current?.scrollToRow(z,{viewOffset:Le}))},[]);Oo.current=ld;let po=ie&&H===null&&I&&!ct&&!Mn,Fa=N(po);Fa.current=po;let Xn=N({followEnabled:po,restoreInProgress:Mn,loadEarlier:D});Xn.current={followEnabled:po,restoreInProgress:Mn,loadEarlier:D};let Ve=N(null);q(()=>{if(!gn||!ie)return;let z=oI({root:gn,minimumCount:Xs,keepAbovePx:Ch,canCompact:()=>{let Le=Xn.current,nt=Tn.current;return Le.followEnabled&&Mt.current.length===0&&!Le.restoreInProgress&&!Le.loadEarlier?.loading&&!(nt&&nt.until>Date.now())&&tt.current.revealedCount>Xs},onCompact:Le=>{It.current=!0,Qn(),tt.current.compactTo(Le)}});return Ve.current=z,()=>{z.disconnect(),Ve.current=null}},[Qn,ie,gn]),q(()=>{Ve.current?.schedule()},[po,D?.loading,rt.revealedCount,je.length]),q(()=>{if(!gn||!ie||typeof ResizeObserver>"u")return;let z=()=>{if(!He.current||!Fa.current)return;let $t=gn.scrollHeight-gn.clientHeight;Math.abs(gn.scrollTop-$t)>.5&&(gn.scrollTop=$t)},Le=new ResizeObserver(z);Le.observe(gn);let nt=gn.firstElementChild;return nt&&Le.observe(nt),()=>Le.disconnect()},[ie,gn]),oe({viewport:Hi,viewActive:ee&&ie,threadKey:r,completedAt:H===null&&!Mn&&Be?.state==="completed"&&As?Be.completedAt:null,messageId:Se,bottomInset:w});let Rt=kt.rowIds.at(-1)??null;q(()=>{b?.(Rt)},[Rt,b,r]);let dn=xt("timeline-later-load-armed",r,!0),xn=E(z=>{if(z>Ch){It.current=!0;return}if(It.current){if(It.current=!1,qr.current){ze.current();return}Do.current?.()}},[It]),Ba=E(()=>{Bt.current&&(Bt.current=!1,mn.current=null,It.current=!0)},[Bt,mn,It]),$i=E(()=>{if(on.current!==null||ut.current||!He.current||bt.current!==r||st.current)return!1;let z=at.current?.measure();return!z||z.scroll>2||z.contentLength-z.scrollLength-z.scroll<=2||!qr.current&&Do.current===null?!1:(Bt.current=!1,mn.current=null,It.current=!0,on.current=requestAnimationFrame(()=>{on.current=null}),xn(z.scroll),!0)},[xn,Bt,mn,r,st,It,on]),dd=E(()=>{if(!He.current||bt.current!==r)return;let z=at.current?.measure();if(!z||st.current)return;$e(z);let Le=mn.current;Bt.current&&Le!==null&&Math.abs(z.scroll-Le)>.5&&Ba(),$r();let nt=t.resolveIsAtEnd({contentLength:z.contentLength,scroll:z.scroll,scrollLength:z.scrollLength},w);nt!==void 0&&P(H===null&&nt),z.contentLength-z.scrollLength-z.scroll>2&&xn(z.scroll),z.contentLength-z.scrollLength-z.scroll>Ch?dn.current=!0:dn.current&&H&&!H.loading&&!ut.current&&(dn.current=!1,Rs());let $n=Date.now();$n-Ps.current>=cU&&(Ps.current=$n,qe())},[$e,w,t,xn,P,qe,$r,r,H,dn,Rs,Bt,mn,Ba,st]),Ua=N(null),qi=E(()=>{He.current&&Ua.current===null&&(Ua.current=requestAnimationFrame(()=>{Ua.current=null,Qr()}))},[Qr]);q(()=>()=>{Ua.current!==null&&(cancelAnimationFrame(Ua.current),Ua.current=null)},[r]);let Yr=E(z=>{if(z===null||z===Da.current)return;Da.current=z;let Le=_a.current.find(nt=>nt.sectionKey===z);Le&&Fo.current&&(Fo.current.textContent=Le.text),Pr.current&&Pn(!1),qi()},[Da,qi,Pn]),Jr=rI({root:gn,topInsetPx:Mf,onActiveSectionChange:Yr,active:ie}),cd=V(()=>LS(je),[je]),Pg=MS({root:gn,inputKey:r,visible:ie,index:cd,topInset:wr?Mf:0,bottomInset:w,interactionRows:Kt,onRangeChange:J,onSelectionChange:yn});nn.current=Pg,q(()=>{if(!ie){qe();return}let z=requestAnimationFrame(()=>{if(!He.current)return;let Le=at.current?.node;Le&&Fa.current&&(Le.scrollTop=Le.scrollHeight-Le.clientHeight),Jr.refresh()});return()=>cancelAnimationFrame(z)},[qe,Jr,ie]);let ku=E(()=>{Pn(z=>!z)},[Pn]);xe(()=>{if(!ie)return;let z=Da.current,Le=z===null?void 0:_a.current.find(nt=>nt.sectionKey===z);Le&&Fo.current&&(Fo.current.textContent=Le.text),qi()},[ie,qi,Tr]);let kg=V(()=>{let z=ln?u(sU,{onReveal:Na,fade:M}):D!==null?u(rU,{loading:D.loading,blocked:W,onLoadEarlier:Xr,fade:M}):M?nU:tU;return wr?S(Ie,{children:[u("div",{style:{height:Mf}}),z]}):z},[Xr,ln,wr,D,W,Na,M]);q(()=>{if(!ie)return;let z=requestAnimationFrame(dd);return()=>cancelAnimationFrame(z)},[dd,ie,Mn,Qt]);let Lg=V(()=>({timestampFormat:y,threadKey:r,threadRef:a,markdownCwd:h,resolvedTheme:v,workspaceRoot:C,skills:x,activeThreadEnvironmentId:s,onForkFromUserMessage:m,onImageExpand:g,onOpenFileDiff:p,onProcessDisclosureChange:Zt,agentPanelModel:c,onOpenAgents:f,onInterrupt:i,onRespondToDecision:l,scheduledWakes:ge,onCancelScheduledWake:d,derive:t,SiteIcon:n,renderWorkGroup:X,renderToolCallDetail:re,onSavePlanToWorkspace:Z}),[y,r,a,h,v,C,x,s,m,g,p,Zt,c,f,i,l,ge,d,t,n,X,re,Z]),Ag=V(()=>({isWorking:ft,workingStepLabel:pn,stall:St,retry:ht}),[ft,ht,St,pn]),Rg=E(z=>u(yU,{rowsStore:o,rowId:z}),[o]),Eg=Qt===0&&!ft&&!A;return u(rn,{value:Lg,children:S(YI,{value:Ag,children:[u(BI,{rowsStore:o,derive:t,paneVisible:ie,totalTurnCount:ue,bottomInset:w,onSelect:Gr,onTurnNavigatorChange:fe}),S("div",{ref:Ls,onClickCapture:z=>{Wt.current=z.target instanceof Element?z.target.closest("button"):null},onWheelCapture:ae,onTouchMoveCapture:ae,onPointerDownCapture:z=>{z.target===at.current?.node&&(ae(),$i())},onKeyDownCapture:z=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(z.key)&&ae()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":k?"true":"false","data-disclosure-reading":ct?"true":void 0,"data-timeline-follow-end":po?"true":"false","data-timeline-end-inset":w,children:[u(ES,{inputKey:r,onBeforeInputChange:ot,handleRef:$,onAttach:Ki,onInteractionRowsChange:jt,onScroll:dd,className:K("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",M&&"topbar-scroll-fade"),children:S("div",{style:{paddingBottom:w},onWheel:z=>{z.defaultPrevented||z.deltaY>=0||Za(z.target)||xh(z.target,at.current?.node??null)||$i()},onTouchStartCapture:z=>{wn.current=z.touches[0]?.clientY??null},onTouchMove:z=>{let Le=z.touches[0],nt=wn.current;z.defaultPrevented||Za(z.target)||xh(z.target,at.current?.node??null)||Le===void 0||nt===null||Le.clientY<=nt||$i()&&(wn.current=null)},onTouchEndCapture:()=>{wn.current=null},onTouchCancelCapture:()=>{wn.current=null},onKeyDown:z=>{z.defaultPrevented||z.repeat||z.metaKey||z.ctrlKey||z.altKey||z.shiftKey||Za(z.target)||xh(z.target,at.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(z.key)||$i()},children:[kg,en.map(z=>u(QS,{sectionKey:z.key,rowKeyPrefix:r,rowIds:z.rowIds,renderRow:Rg,sectionRef:Jr.observeSection(z.key)},`${r}:${z.key}`)),H?u(aU,{loading:H.loading,blocked:W,onLoadLater:Rs,onReturnToLatest:F}):null,iU]})}),Eg?u("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:Re("timeline.empty")})}):null,Oa!==null?u(PI,{ref:ks,textRef:Fo,initialText:Oa,expanded:Tr,onToggleExpanded:ku}):null]})]})})});var yU=ye(function({rowsStore:t,rowId:n}){let o=sI(t,n),r=Ct(rn);return o===void 0?null:u(ji,{value:o.id,children:u("div",{className:K("relative",o.kind==="message"&&o.message.role==="user"?"pb-6":o.kind==="message"&&o.message.role==="assistant"?o.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":o.id,"data-timeline-row-kind":o.kind,"data-message-id":o.kind==="message"?o.message.id:void 0,"data-message-role":o.kind==="message"?o.message.role:void 0,children:S(sl,{resetKey:o.id,fallback:jI,children:[o.kind==="turn-summary"?u(OS,{footer:o.footer,copyText:o.copyText,timestampFormat:r.timestampFormat}):null,o.kind==="tool-group"?u(GS,{entries:o.entries,groupId:o.groupId,threadKey:r.threadKey,workspaceRoot:r.workspaceRoot,onDisclosureChange:()=>r.onProcessDisclosureChange?.(o.id)}):null,o.kind==="work"?u(CU,{row:o}):null,o.kind==="model-switch"?u(LI,{row:o}):null,o.kind==="turn-identity"?u("div",{"data-turn-identity":o.turnId,className:"px-1 pt-1",children:u(hh,{badge:o.badge,createdAt:o.createdAt})}):null,o.kind==="message"&&o.message.role==="user"?u(ph,{row:o}):null,o.kind==="message"&&o.message.role==="assistant"?u(kI,{row:o}):null,o.kind==="proposed-plan"?u(bU,{row:o}):null,o.kind==="turn-plan"?u(SU,{row:o}):null,o.kind==="working"?u(IU,{row:o}):null]})})})});function CU({row:e}){let t=Ct(rn),n=Ar(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(Ie,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(xU,{entry:r},r.id))})}function xU({entry:e}){let t=Ct(rn),[n,o]=Po(t.threadKey,`work-fallback:${yf(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return S("div",{children:[S("button",{type:"button","aria-expanded":n,className:K("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:()=>o(!n),disabled:r===void 0,children:[u("span",{"aria-hidden":!0,className:K("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}),r!==void 0?u(tn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!n&&"-rotate-90")}):null]}),n&&r!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function bU({row:e}){let t=Ct(rn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(qI,{threadKey:t.threadKey,rowId:e.id,planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var SU=ye(function({row:t}){let n=Ct(rn),{t:o}=dt(),[r,a]=Po(n.threadKey,`turn-plan:${t.id}`,!1),{steps:s}=t.turnPlan.plan,i=s.filter(f=>f.status==="completed").length,l=i===s.length,d=s.find(f=>f.status==="inProgress")?.step??s.find(f=>f.status==="pending")?.step??s.at(-1)?.step??o("proposedPlan.badge");return S("div",{className:"min-w-0 px-1 py-0.5",children:[S("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":r,onClick:()=>a(!r),children:[u(r?tn:Io,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),s.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:s.map(f=>u("span",{className:K("h-[3px] w-2.5 rounded-full",f.status==="completed"?"bg-success":f.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},f.step))}):null,u("span",{className:K("min-w-0 truncate",l?"text-muted-foreground/65":"font-medium text-foreground/85"),children:d}),s.length>1?S("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[i,"/",s.length]}):null]}),r?u("div",{className:"mt-0.5 space-y-px pl-6",children:s.map(f=>S("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:K("w-3 shrink-0 text-center font-mono text-chat-meta",f.status==="completed"?"text-success":f.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:f.status==="completed"?"\u2713":f.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:K("min-w-0",f.status==="completed"?"text-muted-foreground/55":f.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:f.step})]},f.step))}):null]})});function IU({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Ct(YI),{t:r}=dt();return S("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:S("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?Zd(r("activity.workingForLive"),u(LU,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?S("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(wU,{retry:o}):n&&!e.compacting?u(PU,{stall:n}):null]})}function wU({retry:e}){let{t}=dt(),n=Ct(rn);return S($d,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(lf,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(qd,{children:u(ce,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var TU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function PU({stall:e}){let{t}=dt(),{onInterrupt:n}=Ct(rn),o=t(TU[e.reason]);return S("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:Zd(t("stall.noOutputForLive"),u(kU,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ce,{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 ZI(e,t){let n=Ar();q(()=>{let o=()=>{t.current&&(t.current.textContent=bh(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 kU({since:e}){let t=N(null);return ZI(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:bh(e)})}function LU({createdAt:e}){let t=N(null);return ZI(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:bh(e)})}function AU(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));return r<60?`${r}s`:sa(r*1e3)}function bh(e){return AU(e,new Date().toISOString())??"0s"}function Df(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel}function ew(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function tw(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&&Df(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&&ew(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&Df(e.modelBadge,n.modelBadge)}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&Df(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&&ew(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&&Df(e.modelBadge,n.modelBadge)}}}function RU(e,t){let n=t.historyWindow,{status:o}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,latestTurn:n?null:o.latestTurn,runningTurnId:n?null:o.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!n&&o.isWorking,activeTurnStartedAt:n?null:o.activeTurnStartedAt,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:n?null:o.pendingModelSelection},a=e.deriveGroups(r),s=o.latestTurn;if(n&&s&&s.completedAt!==null){let i=s.turnId;if(a.rows.some(d=>d.kind==="message"?d.message.role==="assistant"&&d.message.turnId===i:d.kind==="work"?d.groupedEntries.some(c=>c.turnId===i):d.kind==="tool-group"&&d.entries.some(c=>c.turnId===i)))return e.deriveGroups({...r,latestTurn:s})}return a}var EU=new Map,MU={markdown:()=>"",download(){}},NU=[],_U={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:NU},DU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:_U,usageByTurnId:EU,exportApi:MU,finalAssistantMessageReceived:!1},version:0};function OU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function FU(e,t,n,o){let r=RU(n,e),a=BU(t.structure.rowIds,r.rows),s=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),i=r.rows.map((g,h)=>{let v=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],y=v!==void 0&&tw(v,g)?v:g;return y!==v&&o.add(g.id),y});if(!a)for(let g of t.indexById.keys())s.has(g)||o.add(g);let l=XS(i,r.turnGroups,t.structure.sections),d=a?t.structure.rowIds:i.map(g=>g.id),c=a&&OU(t.structure.sections,l)?t.structure:{rowIds:d,sections:l},f=e.derive.hasSettledAssistantMessage(e.timelineEntries,e.status.latestAssistantMessageId),p=t.meta.status===e.status&&t.meta.usageByTurnId===e.usageByTurnId&&t.meta.exportApi===e.exportApi&&t.meta.finalAssistantMessageReceived===f?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:f},m=o.size>0||c!==t.structure||p!==t.meta;return{inputs:e,structure:c,indexById:s,rows:i,meta:p,version:m?t.version+1:t.version}}function BU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n].id)return!1;return!0}function nw(){let e=null,t=null,n=DU,o=new Set,r=0,a=new Set,s=new Map,i=()=>{if(e===null||n.inputs===e)return n;t??=e.derive.createRowsCache();let l=new Set;n=FU(e,n,t,l);for(let d of l)o.add(d);return n};return{setInputs(l){e=l},hasInputs:()=>e!==null,flush(){if(a.size===0&&s.size===0||e===null)return;let{version:l}=i();if(l===r&&o.size===0)return;r=l;let d=[...o];o.clear();for(let c of d){let f=s.get(c);if(f!==void 0)for(let p of Array.from(f))p()}for(let c of Array.from(a))c()},subscribe(l){return a.add(l),()=>{a.delete(l)}},subscribeRow(l,d){let c=s.get(l);return c===void 0&&(c=new Set,s.set(l,c)),c.add(d),()=>{c.delete(d),c.size===0&&s.get(l)===c&&s.delete(l)}},getStructure:()=>i().structure,getRow(l){let{indexById:d,rows:c}=i(),f=d.get(l);return f===void 0?void 0:c[f]},getRows:()=>i().rows,getMeta:()=>i().meta,getVersion:()=>i().version}}le();var UU=new Set;function ow({data:e,target:t,threadKey:n,visible:o,rowsStore:r,derive:a,resolveModelBadge:s,disclosure:i,historyWindow:l}){let d=e.useChatTimeline({target:t,threadKey:n,visible:o}),c=e.useTurnStatus({target:t,threadKey:n,visible:o}),f=Ar(),p=i.usePersistedExpandedTurnIds(n),[m,g]=Ft("timeline-auto-expanded-turns",n,UU),h=V(()=>a.resolveExpandedTurnIds(p??[],m),[m,a,p]),{latestTurn:v}=c,y=xt("timeline-latest-turn-previous",n,v);q(()=>{let x=y.current;if(y.current=v,!(!v||x?.turnId===void 0)){if(v.turnId===x.turnId){x.state==="running"&&v.state==="interrupted"&&g(b=>{let w=new Set(b);return w.add(v.turnId),w});return}g(b=>{if(!b.has(x.turnId))return b;let w=new Set(b);return w.delete(x.turnId),w})}},[v]);let C=V(()=>({derive:a,timelineEntries:d.timelineEntries,activities:d.activities,status:c,expandedTurnIds:h,resolveModelBadge:s,historyWindow:l,usageByTurnId:d.usageByTurnId,exportApi:d.export}),[d.activities,d.export,d.timelineEntries,d.usageByTurnId,a,h,l,s,c]);return(f||!r.hasInputs())&&r.setInputs(C),xe(()=>{r.flush()}),null}var rw=ye(function({data:t,target:n,threadKey:o,visible:r,...a}){let s=xt("timeline-rows-store",o,null,3);s.current??=nw();let i=s.current;return S(Ie,{children:[u(ow,{data:t,target:n,threadKey:o,visible:r,rowsStore:i,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),u(JI,{...a,threadKey:o,rowsStore:i,SiteIcon:t.SiteIcon})]})});le();function aw(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var zU=1e3;function sw(e,t=zU){let[n,o]=Q(null);return q(()=>{if(e===null){o(null);return}let r=globalThis.setTimeout(()=>{o(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),n}function iw({phase:e}){let{t}=pe(),n=t(aw(e));return S("div",{"aria-label":n,className:"pointer-events-none flex items-center gap-2 rounded-full border border-border/60 bg-background/90 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur","data-thread-sync-pill":"true",role:"status",children:[u(Va,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),u("span",{className:"truncate",children:n})]})}function lw({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=pe(),s=sw(e.useThreadSyncPhase(t));return s===null&&!o?null:S("div",{className:"pointer-events-none absolute left-1/2 z-30 flex -translate-x-1/2 flex-col items-center gap-1.5 py-1.5",style:{bottom:n+4},children:[s!==null?u(iw,{phase:s}):null,o?S(ce,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[u(tn,{}),a("timeline.scrollToEnd")]}):null]})}le();function dw(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function cw(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var HU=150,KU=16;function uw(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function fw({inputKey:e,visible:t,endInset:n,derive:o,onReturnToLatest:r,controlRef:a}){let[s,i]=Ft("timeline-live-follow-enabled",e,!0),[l,d]=Ft("timeline-show-scroll-to-end",e,!1),c=rr(e,null),[f,p]=SS(e,null),m=E(U=>{c.current=U;let X=U?.node??null;p(re=>re===X?re:X)},[c,p]),g=xt("timeline-is-at-end",e,!0),h=rr(e,null),v=E(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),y=E(()=>{v(),h.current=setTimeout(()=>{h.current=null,d(!0)},HU)},[v,d,h]);q(()=>v,[v]);let C=E(()=>{let U=c.current?.measure();return U==null?void 0:{contentLength:U.contentLength,scroll:U.scroll,scrollLength:U.scrollLength}},[c]),x=xt("timeline-scroll-mode",e,"following-end"),b=es(t);xe(()=>()=>b.cancel(),[b,e]);let w=xt("timeline-user-scroll-generation",e,0),I=xt("timeline-live-follow-generation",e,0),k=xt("timeline-disclosure-reading-lock",e,dw),P=xt("timeline-last-row-id",e,null),T=E(()=>{b.cancel(),w.current+=1,x.current="free-scrolling",I.current=null,i(!1)},[b,I,x,i,w]),L=E(()=>{k.current.lock(),T(),g.current=!1,v(),d(!0)},[v,g,T,k,d]),A=N(T);A.current=T;let M=E(()=>{let U=c.current?.measure(),X=P.current;if(!U||X===null)return!1;let re=WI(U,X);return re===null?!1:re>Math.max(0,U.scrollLength-n-KU)},[n,c,P]),R=E(U=>{k.current.resume();let X=++w.current;g.current=!0,x.current="following-end",I.current=w.current,i(!0),v(),d(!1),b.request(()=>{cw({requestedGeneration:X,currentGeneration:w.current,mode:x.current,readingLocked:k.current.isLocked()})&&c.current?.scrollToEnd({animated:U})})},[v,b,c,g,I,k,x,i,d,w]),D=N(r);D.current=r;let H=E((U=!1)=>{let X=D.current;if(X){X(()=>R(U));return}R(U)},[R]),W=E(()=>H(!0),[H]),F=E(()=>{k.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(C(),n)===!0&&H())},[o,n,g,C,k,H]);q(()=>{if(!t||f===null)return;let U=null,X=requestAnimationFrame(()=>{let re=()=>{A.current()},G=ge=>{let ie=ge instanceof Element?ge:null;for(;ie&&ie!==f;){if(ie instanceof HTMLElement&&ie.scrollHeight>ie.clientHeight+1&&ie.scrollTop+ie.clientHeight<ie.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(ie).overflowY))return!1;ie=ie.parentElement}return ie===f},te=ge=>{k.current.isLocked()&&G(ge)&&F()},oe=null,Z=!1,ee=f.scrollTop,fe=ge=>{oe=ge.touches[0]?.clientY??null},Re=()=>{oe=null,Z=!1},Be=()=>{let ge=f.scrollTop;Z&&ge>ee&&te(f),ee=ge},Se=()=>M(),Ee=()=>o.resolveIsAtEnd(C(),n)===!1,ne=ge=>{ge.deltaY>0&&te(ge.target),ge.deltaY<0&&Se()&&re()},we=ge=>{let ie=ge.touches[0]?.clientY??null,He=oe!==null&&ie!==null&&ie<oe;oe=ie,Ee()&&re(),He&&te(ge.target)},j=ge=>{if(ge.target===f){Z=!0,ee=f.scrollTop,Se()&&re();return}Ee()&&re()},ue=ge=>{if(!(ge.target instanceof Element?ge.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ge.key){case"PageUp":case"Home":case"ArrowUp":Se()&&re();break;case"PageDown":case"End":case"ArrowDown":te(ge.target);break;case" ":ge.shiftKey||te(ge.target);break;default:break}};f.addEventListener("wheel",ne,{passive:!0}),f.addEventListener("touchmove",we,{passive:!0}),f.addEventListener("touchstart",fe,{passive:!0}),f.addEventListener("touchend",Re,{passive:!0}),f.addEventListener("touchcancel",Re,{passive:!0}),f.addEventListener("scroll",Be,{passive:!0}),window.addEventListener("pointerup",Re,{passive:!0}),window.addEventListener("pointercancel",Re,{passive:!0}),f.addEventListener("pointerdown",j,{passive:!0}),f.addEventListener("keydown",ue),U=()=>{f.removeEventListener("wheel",ne),f.removeEventListener("touchmove",we),f.removeEventListener("touchstart",fe),f.removeEventListener("touchend",Re),f.removeEventListener("touchcancel",Re),f.removeEventListener("scroll",Be),window.removeEventListener("pointerup",Re),window.removeEventListener("pointercancel",Re),f.removeEventListener("pointerdown",j),f.removeEventListener("keydown",ue)}});return()=>{cancelAnimationFrame(X),U?.()}},[M,o,n,e,C,k,F,f,t]);let J=E(U=>{P.current=U},[P]),O=E(U=>{if(k.current.isLocked()){g.current=!1,v(),d(!0);return}if(!U&&I.current===w.current){v(),d(!1);return}g.current!==U&&(g.current=U,U?(x.current="following-end",I.current=w.current,i(!0),v(),d(!1)):(x.current="free-scrolling",I.current=null,y()))},[v,g,I,k,y,x,i,d,w]),B=N(H);B.current=H;let Y=V(()=>({followEnd:U=>B.current(U?.animated??!1)}),[]);return xe(()=>(uw(a,Y),()=>uw(a,null)),[Y,a]),{liveFollowEnabled:s,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:J,onIsAtEndChange:O,onManualNavigation:T,onDisclosureNavigation:L,returnToEnd:W}}le();le();var pw=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var mw=50,$U=32,Sh=class extends Zr{getSnapshotBeforeUpdate(t){return(t.inputKey!==this.props.inputKey||t.rows!==this.props.rows||t.expandedRows!==this.props.expandedRows||t.visible&&!this.props.visible)&&t.capture(),null}componentDidUpdate(){}componentWillUnmount(){this.props.capture()}render(){return this.props.children}};function gw(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let n=e.querySelector("thead"),o=t.top+(n?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=Qs(r,o),s=[];if(a<0)return s;for(let i=a;i<r.length;i+=1){let l=r[i];if(l.getBoundingClientRect().top>=t.bottom)break;let d=l.querySelectorAll("[data-timeline-row-id]"),c=Qs(d,o);if(!(c<0))for(let f=c;f<d.length;f++){let p=d[f];if(p.getBoundingClientRect().top>=t.bottom)break;s.push(p)}}return s}function qU(e){let t=[];for(let n=0;n<e.length;n+=mw)t.push(e.slice(n,n+mw));return t}function VU({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let s=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),i=s===null?[]:[s.input,s.output].filter(d=>d!==void 0&&d.length>0),l=s?.input!==void 0&&s?.output!==void 0?i.join(`
3814
3765
 
3815
3766
  `):[r,...i].filter(Boolean).join(`
3816
3767
 
3817
- `);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 Cw=Ce(function({inputKey:t,rows:n,loadEarlier:o,loadLater:r=null,pagingBlockedByInteraction:a=!1,onReturnToLatest:s=null,onVisibleTurnRangeChange:i=null,timestampFormat:l,paneVisible:d,useToolCallDetail:c,threadRef:f,resolveChatAnchorMessageId:p,onOpenInChat:m}){let{t:g}=Kn(),[h,v]=Ot("trajectory-kind-filter",t,"all"),[y,C]=Ot("trajectory-expanded-rows",t,()=>new Set),[x,b]=Ot("trajectory-follow-latest",t,!0),T=V(()=>{let ee=new Set(n.map(Se=>Se.kind));return hw.filter(Se=>ee.has(Se))},[n]),I=V(()=>h==="all"?n:n.filter(ee=>ee.kind===h),[n,h]),k=V(()=>XU(I),[I]),P=ee=>C(Se=>{let X=new Set(Se);return X.has(ee)?X.delete(ee):X.add(ee),X}),w=N(null),L=N(null),A=E(ee=>{w.current=ee,ee&&(L.current=ee)},[]),M=xt("trajectory-at-end",t,!0),R=xt("trajectory-scroll-top",t,0),D=xt("trajectory-row-anchor",t,null),H=N({inputKey:t,paneVisible:d,pagingBlockedByInteraction:a});H.current={inputKey:t,paneVisible:d,pagingBlockedByInteraction:a};let W=N(null);be(()=>{if(W.current=null,!!d)return()=>{W.current=null,i?.(null)}},[t,d,i]);let F=V(()=>({inputKey:t,store:Kd()}),[t]),J=N(F);J.current=F;let O=N(()=>{}),B=E(ee=>{let Se=J.current;return Se.store.acquire(ee,()=>{J.current===Se&&O.current()})},[]),Y=V(()=>{let ee=I.map((Se,X)=>({key:Se.id,turnId:Se.turnId??null,firstRowIndex:X,endRowIndex:X+1}));return{sections:ee,bySectionKey:new Map(ee.map(Se=>[Se.key,Se])),byRowId:new Map(ee.map(Se=>[Se.key,{turnId:Se.turnId,index:Se.firstRowIndex}]))}},[I]),U=E((ee,Se)=>Array.from(ee.querySelectorAll("[data-trajectory-row-id]")).find(X=>X.dataset.trajectoryRowId===Se),[]),j=E((ee,Se)=>{let X=Se[0]?.dataset.timelineRowId,de=X===void 0?void 0:U(ee,X);de&&X!==void 0&&(D.current={rowId:X,offset:ee.getBoundingClientRect().top-de.getBoundingClientRect().top})},[U,D]),oe=E(()=>{if(!d)return;let ee=w.current??L.current;ee&&(R.current=ee.scrollTop,M.current=ee.scrollHeight-ee.scrollTop-ee.clientHeight<=QU,I.length>0&&j(ee,yw(ee)))},[M,I.length,d,j,R]),Q=E(()=>H.current.inputKey===t&&H.current.paneVisible,[t]),ne=E(()=>{if(!Q()||i===null)return;let ee=w.current;if(!ee||ee.clientHeight<=0)return;let Se=yw(ee);j(ee,Se);let X=F.store.rows(),de=ee.ownerDocument.activeElement;if(nl(de)){let $e=tl(de,ee);$e&&X.push($e)}let le=xf({index:Y,visibleSectionKeys:Se.flatMap($e=>{let Tt=$e.dataset.timelineRowId;return Tt===void 0?[]:[Tt]}),protectedRowIds:X,selectionRows:bf(ee)}),se=JSON.stringify(le);W.current!==se&&(W.current=se,i(le))},[F,Q,i,Y,j]),re=Ya(d),Z=E(()=>{Q()&&i!==null&&re.request(ne)},[Q,i,re,ne]);O.current=Z;let te=E(ee=>{let Se=D.current,X=Se===null?void 0:U(ee,Se.rowId),de=X?.closest("[data-trajectory-chunk]"),le=de?.style.contentVisibility;de&&(de.style.contentVisibility="visible");try{ee.scrollTop=X===void 0?R.current:ee.scrollTop+X.getBoundingClientRect().top-ee.getBoundingClientRect().top+Se.offset}finally{de&&(de.style.contentVisibility=le??"")}},[U,D,R]),ue=E(()=>{Q()&&(oe(),Z())},[oe,Q,Z]),Me=E(()=>{!Q()||H.current.pagingBlockedByInteraction||o?.loading||(oe(),o?.onLoadEarlier())},[oe,Q,o]),Oe=E(()=>{!Q()||H.current.pagingBlockedByInteraction||r?.loading||(oe(),r?.onLoadLater())},[oe,Q,r]),ke=E(()=>{Q()&&s?.(()=>{if(!Q())return;M.current=!0,b(!0);let ee=w.current;ee&&(ee.scrollTop=ee.scrollHeight)})},[Q,s,M,b]),Ee=ee=>{if(Q()){if(ee&&r!==null){ke();return}ee&&(M.current=!0),b(ee)}};return be(()=>{if(!Q())return;let ee=w.current;ee&&(x&&M.current&&r===null?ee.scrollTop=ee.scrollHeight:te(ee),Z())},[M,y,I,x,t,Q,r,d,Z,te]),be(()=>{let ee=w.current;if(!Q()||i===null||!ee)return;let Se=!0,X=()=>{Se&&Q()&&Z()},de=()=>{!Se||!Q()||(x&&M.current&&r===null?ee.scrollTop=ee.scrollHeight:te(ee),X())},le=typeof ResizeObserver>"u"?null:new ResizeObserver(de);le?.observe(ee);let se=ee.querySelector("table");return se&&le?.observe(se),ee.addEventListener("focusin",X),ee.addEventListener("focusout",X),ee.ownerDocument.addEventListener("selectionchange",X),X(),()=>{Se=!1,re.cancel(),le?.disconnect(),ee.removeEventListener("focusin",X),ee.removeEventListener("focusout",X),ee.ownerDocument.removeEventListener("selectionchange",X)}},[M,x,t,Q,r,i,d,re,Z,te]),u(wh,{inputKey:t,visible:d,rows:I,expandedRows:y,capture:oe,children:u(Hd,{value:B,children:S("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[S("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[S("div",{role:"group","aria-label":g("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ce,{size:"xs",variant:h==="all"?"secondary":"ghost","aria-pressed":h==="all",onClick:()=>v("all"),children:g("trajectory.filterAll")}),T.map(ee=>u(ce,{size:"xs",variant:h===ee?"secondary":"ghost","aria-pressed":h===ee,onClick:()=>v(ee),children:g(`trajectory.kinds.${ee}`)},ee))]}),u($d,{className:"ml-auto",size:"xs",variant:"outline",pressed:x,onPressedChange:Ee,"aria-label":g("trajectory.followLatest"),children:g("trajectory.followLatest")})]}),S("div",{ref:A,className:"min-h-0 flex-1 overflow-auto",onScroll:ue,"data-trajectory-scroll":!0,children:[o!==null?S("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:g("trajectory.loadEarlier")}),u(ce,{size:"xs",variant:"outline",disabled:o.loading||a,onClick:Me,children:o.loading?g("trajectory.loadingEarlier"):g("trajectory.loadEarlierAction")})]}):null,I.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:g("trajectory.empty")}):S(tS,{children:[u(oS,{className:"sticky top-0 z-10 bg-background",children:S(lf,{className:"hover:bg-transparent",children:[u(Js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnTime")}),u(Js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnType")}),u(Js,{children:g("trajectory.columnSummary")}),u(Js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnStatus")}),u(Js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnDuration")}),u(Js,{className:"w-px",children:u("span",{className:"sr-only",children:g("trajectory.openInChat")})})]})}),k.map((ee,Se)=>u(nS,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":ee[0]?.id??Se,children:ee.map(X=>{let de=y.has(X.id),le=X.detail!==void 0||X.toolCallId!==void 0,se=p(X);return u(Xi,{value:X.id,children:[S(lf,{"data-trajectory-row-id":X.id,"data-timeline-row-id":X.id,className:K(le&&"cursor-pointer"),onClick:le?()=>P(X.id):void 0,children:[u(Qa,{className:"whitespace-nowrap text-muted-foreground",title:Ja(X.createdAt,l),children:Za(X.createdAt,l,g)}),u(Qa,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${X.kind}`)}),u(Qa,{className:"max-w-0 whitespace-normal",children:S("span",{className:"inline-flex items-start gap-1",children:[le?u(ce,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(de?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":de,onClick:$e=>{$e.stopPropagation(),P(X.id)},children:de?u(Zt,{"aria-hidden":!0}):u(So,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:X.summary})]})}),u(Qa,{className:"whitespace-nowrap",children:g(`trajectory.status.${X.status}`)}),u(Qa,{className:"whitespace-nowrap text-muted-foreground",children:X.durationMs!==void 0?sa(X.durationMs):g("trajectory.valueUnknown")}),u(Qa,{className:"whitespace-nowrap",children:se!==null?S(je,{children:[u(Xe,{render:u(ce,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:$e=>{$e.stopPropagation(),m(se)}}),children:u(Vs,{"aria-hidden":!0})}),u(Qe,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${t}:${X.id}`),de&&le?u(lf,{className:"hover:bg-transparent","data-trajectory-detail-row":X.id,"data-timeline-row-id":X.id,children:S(Qa,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),X.kind==="tool-call"&&X.toolCallId!==void 0?u(YU,{threadRef:f,useToolCallDetail:c,toolCallId:X.toolCallId,turnId:X.turnId,fallback:X.detail,revision:`${X.status}:${X.updatedActivityId??X.activityId??X.id}`}):X.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:X.detail}):null]})},`${t}:${X.id}:detail`):null]},`${t}:${X.id}:owner`)})},`${t}:${ee[0]?.id??Se}`))]}),r!==null?S("div",{className:"flex justify-center gap-2 px-3 py-2",children:[u(ce,{size:"xs",variant:"outline",disabled:r.loading||a,onClick:Oe,children:r.loading?g("timeline.loadingLater"):g("timeline.loadLater")}),s===null?null:u(ce,{size:"xs",variant:"ghost",onClick:ke,children:g("timeline.returnToLatest")})]}):null]})]})})})});function xw({data:e,target:t,inputKey:n,paneVisible:o,timestampFormat:r,onOpenInChat:a}){let s=e.useTrajectory({target:t,threadKey:n,visible:o}),i=E(l=>e.useToolCallDetail(t,{toolCallId:l.toolCallId,turnId:l.turnId,revision:l.revision}),[e,t]);return u(Cw,{inputKey:n,rows:s.rows,loadEarlier:s.loadEarlier,loadLater:s.loadLater,pagingBlockedByInteraction:s.pagingBlockedByInteraction,onReturnToLatest:s.onReturnToLatest,onVisibleTurnRangeChange:s.onVisibleTurnRangeChange,timestampFormat:r,paneVisible:o,threadRef:t,useToolCallDetail:i,resolveChatAnchorMessageId:s.resolveChatAnchorMessageId,onOpenInChat:a})}ie();ie();var Th=yt(null),Ff=Th.Provider;function Ho(){let e=Dt(Th);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function ia(){return Dt(Th)}ie();var si=fd(oc());ie();function Pw(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return V(()=>o=>{t.forEach(r=>r(o))},t)}var rc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ti(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Uf(e){return"nodeType"in e}function so(e){var t,n;return e?ti(e)?e:Uf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function zf(e){let{Document:t}=so(e);return e instanceof t}function dl(e){return ti(e)?!1:e instanceof so(e).HTMLElement}function kh(e){return e instanceof so(e).SVGElement}function ni(e){return e?ti(e)?e.document:Uf(e)?zf(e)?e:dl(e)||kh(e)?e.ownerDocument:document:document:document}var Ko=rc?be:q;function Hf(e){let t=N(e);return Ko(()=>{t.current=e}),E(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function kw(){let e=N(null),t=E((o,r)=>{e.current=setInterval(o,r)},[]),n=E(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function cl(e,t){t===void 0&&(t=[e]);let n=N(e);return Ko(()=>{n.current!==e&&(n.current=e)},t),n}function ul(e,t){let n=N();return V(()=>{let o=e(n.current);return n.current=o,o},[...t])}function ac(e){let t=Hf(e),n=N(null),o=E(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Kf(e){let t=N();return q(()=>{t.current=e},[e]),t.current}var Ph={};function oi(e,t){return V(()=>{if(t)return t;let n=Ph[e]==null?0:Ph[e]+1;return Ph[e]=n,e+"-"+n},[e,t])}function Lw(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,s)=>{let i=Object.entries(s);for(let[l,d]of i){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var ri=Lw(1),ai=Lw(-1);function tz(e){return"clientX"in e&&"clientY"in e}function sc(e){if(!e)return!1;let{KeyboardEvent:t}=so(e.target);return t&&e instanceof t}function nz(e){if(!e)return!1;let{TouchEvent:t}=so(e.target);return t&&e instanceof t}function ic(e){if(nz(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 tz(e)?{x:e.clientX,y:e.clientY}:null}var os=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[os.Translate.toString(e),os.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),Tw="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Aw(e){return e.matches(Tw)?e:e.querySelector(Tw)}ie();var oz={display:"none"};function Rw(e){let{id:t,value:n}=e;return mn.createElement("div",{id:t,style:oz},n)}function Ew(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return mn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function Mw(){let[e,t]=G("");return{announce:E(o=>{o!=null&&t(o)},[]),announcement:e}}var Vw=yt(null);function rz(e){let t=Dt(Vw);q(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function az(){let[e]=G(()=>new Set),t=E(o=>(e.add(o),()=>e.delete(o)),[e]);return[E(o=>{let{type:r,event:a}=o;e.forEach(s=>{var i;return(i=s[r])==null?void 0:i.call(s,a)})},[e]),t]}var sz={draggable:`
3768
+ `);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 hw=ye(function({inputKey:t,rows:n,loadEarlier:o,loadLater:r=null,pagingBlockedByInteraction:a=!1,onReturnToLatest:s=null,onVisibleTurnRangeChange:i=null,timestampFormat:l,paneVisible:d,useToolCallDetail:c,threadRef:f,resolveChatAnchorMessageId:p,onOpenInChat:m}){let{t:g}=Vn(),[h,v]=Ft("trajectory-kind-filter",t,"all"),[y,C]=Ft("trajectory-expanded-rows",t,()=>new Set),[x,b]=Ft("trajectory-follow-latest",t,!0),w=V(()=>{let ne=new Set(n.map(we=>we.kind));return pw.filter(we=>ne.has(we))},[n]),I=V(()=>h==="all"?n:n.filter(ne=>ne.kind===h),[n,h]),k=V(()=>qU(I),[I]),P=ne=>C(we=>{let j=new Set(we);return j.has(ne)?j.delete(ne):j.add(ne),j}),T=N(null),L=N(null),A=E(ne=>{T.current=ne,ne&&(L.current=ne)},[]),M=xt("trajectory-at-end",t,!0),R=xt("trajectory-scroll-top",t,0),D=xt("trajectory-row-anchor",t,null),H=N({inputKey:t,paneVisible:d,pagingBlockedByInteraction:a});H.current={inputKey:t,paneVisible:d,pagingBlockedByInteraction:a};let W=N(null);xe(()=>{if(W.current=null,!!d)return()=>{W.current=null,i?.(null)}},[t,d,i]);let F=V(()=>({inputKey:t,store:Hd()}),[t]),J=N(F);J.current=F;let O=N(()=>{}),B=E(ne=>{let we=J.current;return we.store.acquire(ne,()=>{J.current===we&&O.current()})},[]),Y=V(()=>{let ne=I.map((we,j)=>({key:we.id,turnId:we.turnId??null,firstRowIndex:j,endRowIndex:j+1}));return{sections:ne,bySectionKey:new Map(ne.map(we=>[we.key,we])),byRowId:new Map(ne.map(we=>[we.key,{turnId:we.turnId,index:we.firstRowIndex}]))}},[I]),U=E((ne,we)=>Array.from(ne.querySelectorAll("[data-trajectory-row-id]")).find(j=>j.dataset.trajectoryRowId===we),[]),X=E((ne,we)=>{let j=we[0]?.dataset.timelineRowId,ue=j===void 0?void 0:U(ne,j);ue&&j!==void 0&&(D.current={rowId:j,offset:ne.getBoundingClientRect().top-ue.getBoundingClientRect().top})},[U,D]),re=E(()=>{if(!d)return;let ne=T.current??L.current;ne&&(R.current=ne.scrollTop,M.current=ne.scrollHeight-ne.scrollTop-ne.clientHeight<=$U,I.length>0&&X(ne,gw(ne)))},[M,I.length,d,X,R]),G=E(()=>H.current.inputKey===t&&H.current.paneVisible,[t]),te=E(()=>{if(!G()||i===null)return;let ne=T.current;if(!ne||ne.clientHeight<=0)return;let we=gw(ne);X(ne,we);let j=F.store.rows(),ue=ne.ownerDocument.activeElement;if(el(ue)){let He=Zi(ue,ne);He&&j.push(He)}let ge=Cf({index:Y,visibleSectionKeys:we.flatMap(He=>{let Pt=He.dataset.timelineRowId;return Pt===void 0?[]:[Pt]}),protectedRowIds:j,selectionRows:xf(ne)}),ie=JSON.stringify(ge);W.current!==ie&&(W.current=ie,i(ge))},[F,G,i,Y,X]),oe=es(d),Z=E(()=>{G()&&i!==null&&oe.request(te)},[G,i,oe,te]);O.current=Z;let ee=E(ne=>{let we=D.current,j=we===null?void 0:U(ne,we.rowId),ue=j?.closest("[data-trajectory-chunk]"),ge=ue?.style.contentVisibility;ue&&(ue.style.contentVisibility="visible");try{ne.scrollTop=j===void 0?R.current:ne.scrollTop+j.getBoundingClientRect().top-ne.getBoundingClientRect().top+we.offset}finally{ue&&(ue.style.contentVisibility=ge??"")}},[U,D,R]),fe=E(()=>{G()&&(re(),Z())},[re,G,Z]),Re=E(()=>{!G()||H.current.pagingBlockedByInteraction||o?.loading||(re(),o?.onLoadEarlier())},[re,G,o]),Be=E(()=>{!G()||H.current.pagingBlockedByInteraction||r?.loading||(re(),r?.onLoadLater())},[re,G,r]),Se=E(()=>{G()&&s?.(()=>{if(!G())return;M.current=!0,b(!0);let ne=T.current;ne&&(ne.scrollTop=ne.scrollHeight)})},[G,s,M,b]),Ee=ne=>{if(G()){if(ne&&r!==null){Se();return}ne&&(M.current=!0),b(ne)}};return xe(()=>{if(!G())return;let ne=T.current;ne&&(x&&M.current&&r===null?ne.scrollTop=ne.scrollHeight:ee(ne),Z())},[M,y,I,x,t,G,r,d,Z,ee]),xe(()=>{let ne=T.current;if(!G()||i===null||!ne)return;let we=!0,j=()=>{we&&G()&&Z()},ue=()=>{!we||!G()||(x&&M.current&&r===null?ne.scrollTop=ne.scrollHeight:ee(ne),j())},ge=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);ge?.observe(ne);let ie=ne.querySelector("table");return ie&&ge?.observe(ie),ne.addEventListener("focusin",j),ne.addEventListener("focusout",j),ne.ownerDocument.addEventListener("selectionchange",j),j(),()=>{we=!1,oe.cancel(),ge?.disconnect(),ne.removeEventListener("focusin",j),ne.removeEventListener("focusout",j),ne.ownerDocument.removeEventListener("selectionchange",j)}},[M,x,t,G,r,i,d,oe,Z,ee]),u(Sh,{inputKey:t,visible:d,rows:I,expandedRows:y,capture:re,children:u(zd,{value:B,children:S("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[S("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[S("div",{role:"group","aria-label":g("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ce,{size:"xs",variant:h==="all"?"secondary":"ghost","aria-pressed":h==="all",onClick:()=>v("all"),children:g("trajectory.filterAll")}),w.map(ne=>u(ce,{size:"xs",variant:h===ne?"secondary":"ghost","aria-pressed":h===ne,onClick:()=>v(ne),children:g(`trajectory.kinds.${ne}`)},ne))]}),u(Kd,{className:"ml-auto",size:"xs",variant:"outline",pressed:x,onPressedChange:Ee,"aria-label":g("trajectory.followLatest"),children:g("trajectory.followLatest")})]}),S("div",{ref:A,className:"min-h-0 flex-1 overflow-auto",onScroll:fe,"data-trajectory-scroll":!0,children:[o!==null?S("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:g("trajectory.loadEarlier")}),u(ce,{size:"xs",variant:"outline",disabled:o.loading||a,onClick:Re,children:o.loading?g("trajectory.loadingEarlier"):g("trajectory.loadEarlierAction")})]}):null,I.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:g("trajectory.empty")}):S(Jb,{children:[u(eS,{className:"sticky top-0 z-10 bg-background",children:S(sf,{className:"hover:bg-transparent",children:[u(js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnTime")}),u(js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnType")}),u(js,{children:g("trajectory.columnSummary")}),u(js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnStatus")}),u(js,{className:"w-px whitespace-nowrap",children:g("trajectory.columnDuration")}),u(js,{className:"w-px",children:u("span",{className:"sr-only",children:g("trajectory.openInChat")})})]})}),k.map((ne,we)=>u(Zb,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":ne[0]?.id??we,children:ne.map(j=>{let ue=y.has(j.id),ge=j.detail!==void 0||j.toolCallId!==void 0,ie=p(j);return u(ji,{value:j.id,children:[S(sf,{"data-trajectory-row-id":j.id,"data-timeline-row-id":j.id,className:K(ge&&"cursor-pointer"),onClick:ge?()=>P(j.id):void 0,children:[u(Ja,{className:"whitespace-nowrap text-muted-foreground",title:ts(j.createdAt,l),children:ns(j.createdAt,l,g)}),u(Ja,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${j.kind}`)}),u(Ja,{className:"max-w-0 whitespace-normal",children:S("span",{className:"inline-flex items-start gap-1",children:[ge?u(ce,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(ue?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":ue,onClick:He=>{He.stopPropagation(),P(j.id)},children:ue?u(tn,{"aria-hidden":!0}):u(Io,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:j.summary})]})}),u(Ja,{className:"whitespace-nowrap",children:g(`trajectory.status.${j.status}`)}),u(Ja,{className:"whitespace-nowrap text-muted-foreground",children:j.durationMs!==void 0?sa(j.durationMs):g("trajectory.valueUnknown")}),u(Ja,{className:"whitespace-nowrap",children:ie!==null?S(Qe,{children:[u(Ye,{render:u(ce,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:He=>{He.stopPropagation(),m(ie)}}),children:u(Hs,{"aria-hidden":!0})}),u(Xe,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${t}:${j.id}`),ue&&ge?u(sf,{className:"hover:bg-transparent","data-trajectory-detail-row":j.id,"data-timeline-row-id":j.id,children:S(Ja,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),j.kind==="tool-call"&&j.toolCallId!==void 0?u(VU,{threadRef:f,useToolCallDetail:c,toolCallId:j.toolCallId,turnId:j.turnId,fallback:j.detail,revision:`${j.status}:${j.updatedActivityId??j.activityId??j.id}`}):j.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:j.detail}):null]})},`${t}:${j.id}:detail`):null]},`${t}:${j.id}:owner`)})},`${t}:${ne[0]?.id??we}`))]}),r!==null?S("div",{className:"flex justify-center gap-2 px-3 py-2",children:[u(ce,{size:"xs",variant:"outline",disabled:r.loading||a,onClick:Be,children:r.loading?g("timeline.loadingLater"):g("timeline.loadLater")}),s===null?null:u(ce,{size:"xs",variant:"ghost",onClick:Se,children:g("timeline.returnToLatest")})]}):null]})]})})})});function vw({data:e,target:t,inputKey:n,paneVisible:o,timestampFormat:r,onOpenInChat:a}){let s=e.useTrajectory({target:t,threadKey:n,visible:o}),i=E(l=>e.useToolCallDetail(t,{toolCallId:l.toolCallId,turnId:l.turnId,revision:l.revision}),[e,t]);return u(hw,{inputKey:n,rows:s.rows,loadEarlier:s.loadEarlier,loadLater:s.loadLater,pagingBlockedByInteraction:s.pagingBlockedByInteraction,onReturnToLatest:s.onReturnToLatest,onVisibleTurnRangeChange:s.onVisibleTurnRangeChange,timestampFormat:r,paneVisible:o,threadRef:t,useToolCallDetail:i,resolveChatAnchorMessageId:s.resolveChatAnchorMessageId,onOpenInChat:a})}le();le();var Ih=yt(null),Of=Ih.Provider;function $o(){let e=Ot(Ih);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function ia(){return Ot(Ih)}le();var ni=ud(nc());le();function Iw(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return V(()=>o=>{t.forEach(r=>r(o))},t)}var oc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ys(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Bf(e){return"nodeType"in e}function ao(e){var t,n;return e?Ys(e)?e:Bf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Uf(e){let{Document:t}=ao(e);return e instanceof t}function il(e){return Ys(e)?!1:e instanceof ao(e).HTMLElement}function Th(e){return e instanceof ao(e).SVGElement}function Js(e){return e?Ys(e)?e.document:Bf(e)?Uf(e)?e:il(e)||Th(e)?e.ownerDocument:document:document:document}var qo=oc?xe:q;function zf(e){let t=N(e);return qo(()=>{t.current=e}),E(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function ww(){let e=N(null),t=E((o,r)=>{e.current=setInterval(o,r)},[]),n=E(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ll(e,t){t===void 0&&(t=[e]);let n=N(e);return qo(()=>{n.current!==e&&(n.current=e)},t),n}function dl(e,t){let n=N();return V(()=>{let o=e(n.current);return n.current=o,o},[...t])}function rc(e){let t=zf(e),n=N(null),o=E(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Hf(e){let t=N();return q(()=>{t.current=e},[e]),t.current}var wh={};function Zs(e,t){return V(()=>{if(t)return t;let n=wh[e]==null?0:wh[e]+1;return wh[e]=n,e+"-"+n},[e,t])}function Tw(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,s)=>{let i=Object.entries(s);for(let[l,d]of i){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var ei=Tw(1),ti=Tw(-1);function QU(e){return"clientX"in e&&"clientY"in e}function ac(e){if(!e)return!1;let{KeyboardEvent:t}=ao(e.target);return t&&e instanceof t}function XU(e){if(!e)return!1;let{TouchEvent:t}=ao(e.target);return t&&e instanceof t}function sc(e){if(XU(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 QU(e)?{x:e.clientX,y:e.clientY}:null}var ss=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[ss.Translate.toString(e),ss.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),Sw="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Pw(e){return e.matches(Sw)?e:e.querySelector(Sw)}le();var YU={display:"none"};function kw(e){let{id:t,value:n}=e;return un.createElement("div",{id:t,style:YU},n)}function Lw(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return un.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function Aw(){let[e,t]=Q("");return{announce:E(o=>{o!=null&&t(o)},[]),announcement:e}}var Kw=yt(null);function JU(e){let t=Ot(Kw);q(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ZU(){let[e]=Q(()=>new Set),t=E(o=>(e.add(o),()=>e.delete(o)),[e]);return[E(o=>{let{type:r,event:a}=o;e.forEach(s=>{var i;return(i=s[r])==null?void 0:i.call(s,a)})},[e]),t]}var ez={draggable:`
3818
3769
  To pick up a draggable item, press the space bar.
3819
3770
  While dragging, use the arrow keys to move the item.
3820
3771
  Press space again to drop the item in its new position, or press escape to cancel.
3821
- `},iz={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 lz(e){let{announcements:t=iz,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=sz}=e,{announce:a,announcement:s}=Mw(),i=oi("DndLiveRegion"),[l,d]=G(!1);if(q(()=>{d(!0)},[]),rz(V(()=>({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(Rw,{id:o,value:r.draggable}),mn.createElement(Ew,{id:i,announcement:s}));return n?(0,si.createPortal)(c,n):c}var Ln;(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"})(Ln||(Ln={}));function qf(){}function Oh(e,t){return V(()=>({sensor:e,options:t??{}}),[e,t])}function Ww(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return V(()=>[...t].filter(o=>o!=null),[...t])}var ir=Object.freeze({x:0,y:0});function Gw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jw(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function dz(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Nw(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 Fh(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function _w(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 Qw=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=_w(t,t.left,t.top),a=[];for(let s of o){let{id:i}=s,l=n.get(i);if(l){let d=Gw(_w(l),r);a.push({id:i,data:{droppableContainer:s,value:d}})}}return a.sort(jw)},Xw=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=Nw(t),a=[];for(let s of o){let{id:i}=s,l=n.get(i);if(l){let d=Nw(l),c=r.reduce((p,m,g)=>p+Gw(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:i,data:{droppableContainer:s,value:f}})}}return a.sort(jw)};function cz(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),s=r-o,i=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=s*i,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var uz=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:s}=a,i=n.get(s);if(i){let l=cz(i,t);l>0&&r.push({id:s,data:{droppableContainer:a,value:l}})}}return r.sort(dz)};function fz(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Yw(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ir}function pz(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((s,i)=>({...s,top:s.top+e*i.y,bottom:s.bottom+e*i.y,left:s.left+e*i.x,right:s.right+e*i.x}),{...n})}}var mz=pz(1);function gz(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 hz(e,t,n){let o=gz(t);if(!o)return e;let{scaleX:r,scaleY:a,x:s,y:i}=o,l=e.left-s-(1-r)*parseFloat(n),d=e.top-i-(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 vz={ignoreTransform:!1};function di(e,t){t===void 0&&(t=vz);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=so(e).getComputedStyle(e);d&&(n=hz(n,d,c))}let{top:o,left:r,width:a,height:s,bottom:i,right:l}=n;return{top:o,left:r,width:a,height:s,bottom:i,right:l}}function Dw(e){return di(e,{ignoreTransform:!0})}function yz(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Cz(e,t){return t===void 0&&(t=so(e).getComputedStyle(e)),t.position==="fixed"}function xz(e,t){t===void 0&&(t=so(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 fc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(zf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!dl(r)||kh(r)||n.includes(r))return n;let a=so(e).getComputedStyle(r);return r!==e&&xz(r,a)&&n.push(r),Cz(r,a)?n:o(r.parentNode)}return e?o(e):n}function Jw(e){let[t]=fc(e,1);return t??null}function Lh(e){return!rc||!e?null:ti(e)?e:Uf(e)?zf(e)||e===ni(e).scrollingElement?window:dl(e)?e:null:null}function Zw(e){return ti(e)?e.scrollX:e.scrollLeft}function e0(e){return ti(e)?e.scrollY:e.scrollTop}function Eh(e){return{x:Zw(e),y:e0(e)}}var Nn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Nn||(Nn={}));function t0(e){return!rc||!e?!1:e===document.scrollingElement}function n0(e){let t={x:0,y:0},n=t0(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,s=e.scrollTop>=o.y,i=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:s,isRight:i,maxScroll:o,minScroll:t}}var bz={x:.2,y:.2};function Sz(e,t,n,o,r){let{top:a,left:s,right:i,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=bz);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=n0(e),m={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+h.height?(m.y=Nn.Backward,g.y=o*Math.abs((t.top+h.height-a)/h.height)):!c&&l>=t.bottom-h.height&&(m.y=Nn.Forward,g.y=o*Math.abs((t.bottom-h.height-l)/h.height)),!p&&i>=t.right-h.width?(m.x=Nn.Forward,g.x=o*Math.abs((t.right-h.width-i)/h.width)):!f&&s<=t.left+h.width&&(m.x=Nn.Backward,g.x=o*Math.abs((t.left+h.width-s)/h.width)),{direction:m,speed:g}}function Iz(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}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 o0(e){return e.reduce((t,n)=>ri(t,Eh(n)),ir)}function wz(e){return e.reduce((t,n)=>t+Zw(n),0)}function Tz(e){return e.reduce((t,n)=>t+e0(n),0)}function Pz(e,t){if(t===void 0&&(t=di),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);Jw(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var kz=[["x",["left","right"],wz],["y",["top","bottom"],Tz]],dc=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=fc(n),r=o0(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,s,i]of kz)for(let l of s)Object.defineProperty(this,l,{get:()=>{let d=i(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},ii=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 Lz(e){let{EventTarget:t}=so(e);return e instanceof t?e:ni(e)}function Ah(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 $o;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($o||($o={}));function Ow(e){e.preventDefault()}function Az(e){e.stopPropagation()}var It;(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"})(It||(It={}));var r0={start:[It.Space,It.Enter],cancel:[It.Esc],end:[It.Space,It.Enter,It.Tab]},Rz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case It.Right:return{...n,x:n.x+25};case It.Left:return{...n,x:n.x-25};case It.Down:return{...n,y:n.y+25};case It.Up:return{...n,y:n.y-25}}},fl=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 ii(ni(n)),this.windowListeners=new ii(so(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($o.Resize,this.handleCancel),this.windowListeners.add($o.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($o.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&Pz(o),n(ir)}handleKeyDown(t){if(sc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=r0,coordinateGetter:s=Rz,scrollBehavior:i="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}:ir;this.referenceCoordinates||(this.referenceCoordinates=c);let f=s(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=ai(f,c),m={x:0,y:0},{scrollableAncestors:g}=o.current;for(let h of g){let v=t.code,{isTop:y,isRight:C,isLeft:x,isBottom:b,maxScroll:T,minScroll:I}=n0(h),k=Iz(h),P={x:Math.min(v===It.Right?k.right-k.width/2:k.right,Math.max(v===It.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===It.Down?k.bottom-k.height/2:k.bottom,Math.max(v===It.Down?k.top:k.top+k.height/2,f.y))},w=v===It.Right&&!C||v===It.Left&&!x,L=v===It.Down&&!b||v===It.Up&&!y;if(w&&P.x!==f.x){let A=h.scrollLeft+p.x,M=v===It.Right&&A<=T.x||v===It.Left&&A>=I.x;if(M&&!p.y){h.scrollTo({left:A,behavior:i});return}M?m.x=h.scrollLeft-A:m.x=v===It.Right?h.scrollLeft-T.x:h.scrollLeft-I.x,m.x&&h.scrollBy({left:-m.x,behavior:i});break}else if(L&&P.y!==f.y){let A=h.scrollTop+p.y,M=v===It.Down&&A<=T.y||v===It.Up&&A>=I.y;if(M&&!p.x){h.scrollTo({top:A,behavior:i});return}M?m.y=h.scrollTop-A:m.y=v===It.Down?h.scrollTop-T.y:h.scrollTop-I.y,m.y&&h.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(t,ri(ai(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()}};fl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=r0,onActivation:r}=t,{active:a}=n,{code:s}=e.nativeEvent;if(o.start.includes(s)){let i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function Fw(e){return!!(e&&"distance"in e)}function Bw(e){return!!(e&&"delay"in e)}var cc=class{constructor(t,n,o){var r;o===void 0&&(o=Lz(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:s}=a;this.props=t,this.events=n,this.document=ni(s),this.documentListeners=new ii(this.document),this.listeners=new ii(o),this.windowListeners=new ii(so(s)),this.initialCoordinates=(r=ic(a))!=null?r:ir,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($o.Resize,this.handleCancel),this.windowListeners.add($o.DragStart,Ow),this.windowListeners.add($o.VisibilityChange,this.handleCancel),this.windowListeners.add($o.ContextMenu,Ow),this.documentListeners.add($o.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Bw(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Fw(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($o.Click,Az,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($o.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:i}}=a;if(!r)return;let l=(n=ic(t))!=null?n:ir,d=ai(r,l);if(!o&&i){if(Fw(i)){if(i.tolerance!=null&&Ah(d,i.tolerance))return this.handleCancel();if(Ah(d,i.distance))return this.handleStart()}if(Bw(i)&&Ah(d,i.tolerance))return this.handleCancel();this.handlePending(i,d);return}t.cancelable&&t.preventDefault(),s(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===It.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},Ez={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},pl=class extends cc{constructor(t){let{event:n}=t,o=ni(n.target);super(t,Ez,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 Mz={move:{name:"mousemove"},end:{name:"mouseup"}},Mh;(function(e){e[e.RightClick=2]="RightClick"})(Mh||(Mh={}));var Nh=class extends cc{constructor(t){super(t,Mz,ni(t.event.target))}};Nh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Mh.RightClick?!1:(o?.({event:n}),!0)}}];var Rh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},_h=class extends cc{constructor(t){super(t,Rh)}static setup(){return window.addEventListener(Rh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rh.move.name,t)};function t(){}}};_h.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 lc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(lc||(lc={}));var Vf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Vf||(Vf={}));function Nz(e){let{acceleration:t,activator:n=lc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:s=5,order:i=Vf.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=Dz({delta:f,disabled:!a}),[g,h]=kw(),v=N({x:0,y:0}),y=N({x:0,y:0}),C=V(()=>{switch(n){case lc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case lc.DraggableRect:return r}},[n,r,l]),x=N(null),b=E(()=>{let I=x.current;if(!I)return;let k=v.current.x*y.current.x,P=v.current.y*y.current.y;I.scrollBy(k,P)},[]),T=V(()=>i===Vf.TreeOrder?[...d].reverse():d,[i,d]);q(()=>{if(!a||!d.length||!C){h();return}for(let I of T){if(o?.(I)===!1)continue;let k=d.indexOf(I),P=c[k];if(!P)continue;let{direction:w,speed:L}=Sz(I,P,C,t,p);for(let A of["x","y"])m[A][w[A]]||(L[A]=0,w[A]=0);if(L.x>0||L.y>0){h(),x.current=I,g(b,s),v.current=L,y.current=w;return}}v.current={x:0,y:0},y.current={x:0,y:0},h()},[t,b,o,h,a,s,JSON.stringify(C),JSON.stringify(m),g,d,T,c,JSON.stringify(p)])}var _z={x:{[Nn.Backward]:!1,[Nn.Forward]:!1},y:{[Nn.Backward]:!1,[Nn.Forward]:!1}};function Dz(e){let{delta:t,disabled:n}=e,o=Kf(t);return ul(r=>{if(n||!o||!r)return _z;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Nn.Backward]:r.x[Nn.Backward]||a.x===-1,[Nn.Forward]:r.x[Nn.Forward]||a.x===1},y:{[Nn.Backward]:r.y[Nn.Backward]||a.y===-1,[Nn.Forward]:r.y[Nn.Forward]||a.y===1}}},[n,t,o])}function Oz(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return ul(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function Fz(e,t){return V(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,o)}));return[...n,...a]},[]),[e,t])}var uc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(uc||(uc={}));var Dh;(function(e){e.Optimized="optimized"})(Dh||(Dh={}));var Uw=new Map;function Bz(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,s]=G(null),{frequency:i,measure:l,strategy:d}=r,c=N(e),f=v(),p=cl(f),m=E(function(y){y===void 0&&(y=[]),!p.current&&s(C=>C===null?y:C.concat(y.filter(x=>!C.includes(x))))},[p]),g=N(null),h=ul(y=>{if(f&&!n)return Uw;if(!y||y===Uw||c.current!==e||a!=null){let C=new Map;for(let x of e){if(!x)continue;if(a&&a.length>0&&!a.includes(x.id)&&x.rect.current){C.set(x.id,x.rect.current);continue}let b=x.node.current,T=b?new dc(l(b),b):null;x.rect.current=T,T&&C.set(x.id,T)}return C}return y},[e,a,n,f,l]);return q(()=>{c.current=e},[e]),q(()=>{f||m()},[n,f]),q(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),q(()=>{f||typeof i!="number"||g.current!==null||(g.current=setTimeout(()=>{m(),g.current=null},i))},[i,f,m,...o]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case uc.Always:return!1;case uc.BeforeDragging:return n;default:return!n}}}function a0(e,t){return ul(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Uz(e,t){return a0(e,t)}function zz(e){let{callback:t,disabled:n}=e,o=Hf(t),r=V(()=>{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 Wf(e){let{callback:t,disabled:n}=e,o=Hf(t),r=V(()=>{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 Hz(e){return new dc(di(e),e)}function zw(e,t,n){t===void 0&&(t=Hz);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 s=zz({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}}}}),i=Wf({callback:a});return Ko(()=>{a(),e?(i?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),s?.disconnect())},[e]),o}function Kz(e){let t=a0(e);return Yw(e,t)}var Hw=[];function $z(e){let t=N(e),n=ul(o=>e?o&&o!==Hw&&e&&t.current&&e.parentNode===t.current.parentNode?o:fc(e):Hw,[e]);return q(()=>{t.current=e},[e]),n}function qz(e){let[t,n]=G(null),o=N(e),r=E(a=>{let s=Lh(a.target);s&&n(i=>i?(i.set(s,Eh(s)),new Map(i)):null)},[]);return q(()=>{let a=o.current;if(e!==a){s(a);let i=e.map(l=>{let d=Lh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,Eh(d)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),o.current=e}return()=>{s(e),s(a)};function s(i){i.forEach(l=>{let d=Lh(l);d?.removeEventListener("scroll",r)})}},[r,e]),V(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ri(a,s),ir):o0(e):ir,[e,t])}function Kw(e,t){t===void 0&&(t=[]);let n=N(null);return q(()=>{n.current=null},t),q(()=>{let o=e!==ir;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ai(e,n.current):ir}function Vz(e){q(()=>{if(!rc)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 Wz(e,t){return V(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=s=>{a(s,t)},n},{}),[e,t])}function s0(e){return V(()=>e?yz(e):null,[e])}var $w=[];function Gz(e,t){t===void 0&&(t=di);let[n]=e,o=s0(n?so(n):null),[r,a]=G($w);function s(){a(()=>e.length?e.map(l=>t0(l)?o:new dc(t(l),l)):$w)}let i=Wf({callback:s});return Ko(()=>{i?.disconnect(),s(),e.forEach(l=>i?.observe(l))},[e]),r}function jz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return dl(t)?t:e}function Qz(e){let{measure:t}=e,[n,o]=G(null),r=E(d=>{for(let{target:c}of d)if(dl(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=Wf({callback:r}),s=E(d=>{let c=jz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[i,l]=ac(s);return V(()=>({nodeRef:i,rect:n,setRef:l}),[n,i,l])}var Xz=[{sensor:pl,options:{}},{sensor:fl,options:{}}],Yz={current:{}},$f={draggable:{measure:Dw},droppable:{measure:Dw,strategy:uc.WhileDragging,frequency:Dh.Optimized},dragOverlay:{measure:di}},li=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}},Jz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new li,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$f,measureDroppableContainers:qf,windowRect:null,measuringScheduled:!1},Zz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:qf,draggableNodes:new Map,over:null,measureDroppableContainers:qf},Gf=yt(Zz),i0=yt(Jz);function eH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new li}}}function tH(e,t){switch(t.type){case Ln.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ln.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 Ln.DragEnd:case Ln.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ln.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new li(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Ln.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let s=new li(e.droppable.containers);return s.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Ln.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new li(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function nH(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=Dt(Gf),a=Kf(o),s=Kf(n?.id);return q(()=>{if(!t&&!o&&a&&s!=null){if(!sc(a)||document.activeElement===a.target)return;let i=r.get(s);if(!i)return;let{activatorNode:l,node:d}=i;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=Aw(c);if(f){f.focus();break}}})}},[o,t,r,s,a]),null}function oH(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function rH(e){return V(()=>({draggable:{...$f.draggable,...e?.draggable},droppable:{...$f.droppable,...e?.droppable},dragOverlay:{...$f.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function aH(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=N(!1),{x:s,y:i}=typeof r=="boolean"?{x:r,y:r}:r;Ko(()=>{if(!s&&!i||!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=Yw(c,o);if(s||(f.x=0),i||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=Jw(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,s,i,o,n])}var l0=yt({...ir,scaleX:1,scaleY:1}),rs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(rs||(rs={}));var d0=Ce(function(t){var n,o,r,a;let{id:s,accessibility:i,autoScroll:l=!0,children:d,sensors:c=Xz,collisionDetection:f=uz,measuring:p,modifiers:m,...g}=t,h=ea(tH,void 0,eH),[v,y]=h,[C,x]=az(),[b,T]=G(rs.Uninitialized),I=b===rs.Initialized,{draggable:{active:k,nodes:P,translate:w},droppable:{containers:L}}=v,A=k!=null?P.get(k):null,M=N({initial:null,translated:null}),R=V(()=>{var ge;return k!=null?{id:k,data:(ge=A?.data)!=null?ge:Yz,rect:M}:null},[k,A]),D=N(null),[H,W]=G(null),[F,J]=G(null),O=cl(g,Object.values(g)),B=oi("DndDescribedBy",s),Y=V(()=>L.getEnabled(),[L]),U=rH(p),{droppableRects:j,measureDroppableContainers:oe,measuringScheduled:Q}=Bz(Y,{dragging:I,dependencies:[w.x,w.y],config:U.droppable}),ne=Oz(P,k),re=V(()=>F?ic(F):null,[F]),Z=pe(),te=Uz(ne,U.draggable.measure);aH({activeNode:k!=null?P.get(k):null,config:Z.layoutShiftCompensation,initialRect:te,measure:U.draggable.measure});let ue=zw(ne,U.draggable.measure,te),Me=zw(ne?ne.parentElement:null),Oe=N({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=L.getNodeFor((n=Oe.current.over)==null?void 0:n.id),Ee=Qz({measure:U.dragOverlay.measure}),ee=(o=Ee.nodeRef.current)!=null?o:ne,Se=I?(r=Ee.rect)!=null?r:ue:null,X=!!(Ee.nodeRef.current&&Ee.rect),de=Kz(X?null:ue),le=s0(ee?so(ee):null),se=$z(I?ke??ne:null),$e=Gz(se),Tt=oH(m,{transform:{x:w.x-de.x,y:w.y-de.y,scaleX:1,scaleY:1},activatorEvent:F,active:R,activeNodeRect:ue,containerNodeRect:Me,draggingNodeRect:Se,over:Oe.current.over,overlayNodeRect:Ee.rect,scrollableAncestors:se,scrollableAncestorRects:$e,windowRect:le}),gt=re?ri(re,w):null,Lt=qz(se),it=Kw(Lt),ct=Kw(Lt,[ue]),ht=ri(Tt,it),lt=Se?mz(Se,Tt):null,pt=R&&lt?f({active:R,collisionRect:lt,droppableRects:j,droppableContainers:Y,pointerCoordinates:gt}):null,Pt=Fh(pt,"id"),[Ft,gn]=G(null),rt=X?Tt:ri(Tt,ct),At=fz(rt,(a=Ft?.rect)!=null?a:null,ue),Bt=N(null),en=E((ge,ye)=>{let{sensor:Pe,options:at}=ye;if(D.current==null)return;let tn=P.get(D.current);if(!tn)return;let bt=ge.nativeEvent,cn=new Pe({active:D.current,activeNode:tn,event:bt,options:at,context:Oe,onAbort(Je){if(!P.get(Je))return;let{onDragAbort:nn}=O.current,Te={id:Je};nn?.(Te),C({type:"onDragAbort",event:Te})},onPending(Je,Rt,nn,Te){if(!P.get(Je))return;let{onDragPending:qe}=O.current,ut={id:Je,constraint:Rt,initialCoordinates:nn,offset:Te};qe?.(ut),C({type:"onDragPending",event:ut})},onStart(Je){let Rt=D.current;if(Rt==null)return;let nn=P.get(Rt);if(!nn)return;let{onDragStart:Te}=O.current,Ke={activatorEvent:bt,active:{id:Rt,data:nn.data,rect:M}};(0,si.unstable_batchedUpdates)(()=>{Te?.(Ke),T(rs.Initializing),y({type:Ln.DragStart,initialCoordinates:Je,active:Rt}),C({type:"onDragStart",event:Ke}),W(Bt.current),J(bt)})},onMove(Je){y({type:Ln.DragMove,coordinates:Je})},onEnd:st(Ln.DragEnd),onCancel:st(Ln.DragCancel)});Bt.current=cn;function st(Je){return async function(){let{active:nn,collisions:Te,over:Ke,scrollAdjustedTranslate:qe}=Oe.current,ut=null;if(nn&&qe){let{cancelDrop:tt}=O.current;ut={activatorEvent:bt,active:nn,collisions:Te,delta:qe,over:Ke},Je===Ln.DragEnd&&typeof tt=="function"&&await Promise.resolve(tt(ut))&&(Je=Ln.DragCancel)}D.current=null,(0,si.unstable_batchedUpdates)(()=>{y({type:Je}),T(rs.Uninitialized),gn(null),W(null),J(null),Bt.current=null;let tt=Je===Ln.DragEnd?"onDragEnd":"onDragCancel";if(ut){let nt=O.current[tt];nt?.(ut),C({type:tt,event:ut})}})}}},[P]),Vt=E((ge,ye)=>(Pe,at)=>{let tn=Pe.nativeEvent,bt=P.get(at);if(D.current!==null||!bt||tn.dndKit||tn.defaultPrevented)return;let cn={active:bt};ge(Pe,ye.options,cn)===!0&&(tn.dndKit={capturedBy:ye.sensor},D.current=at,en(Pe,ye))},[P,en]),Wt=Fz(c,Vt);Vz(c),Ko(()=>{ue&&b===rs.Initializing&&T(rs.Initialized)},[ue,b]),q(()=>{let{onDragMove:ge}=O.current,{active:ye,activatorEvent:Pe,collisions:at,over:tn}=Oe.current;if(!ye||!Pe)return;let bt={active:ye,activatorEvent:Pe,collisions:at,delta:{x:ht.x,y:ht.y},over:tn};(0,si.unstable_batchedUpdates)(()=>{ge?.(bt),C({type:"onDragMove",event:bt})})},[ht.x,ht.y]),q(()=>{let{active:ge,activatorEvent:ye,collisions:Pe,droppableContainers:at,scrollAdjustedTranslate:tn}=Oe.current;if(!ge||D.current==null||!ye||!tn)return;let{onDragOver:bt}=O.current,cn=at.get(Pt),st=cn&&cn.rect.current?{id:cn.id,rect:cn.rect.current,data:cn.data,disabled:cn.disabled}:null,Je={active:ge,activatorEvent:ye,collisions:Pe,delta:{x:tn.x,y:tn.y},over:st};(0,si.unstable_batchedUpdates)(()=>{gn(st),bt?.(Je),C({type:"onDragOver",event:Je})})},[Pt]),Ko(()=>{Oe.current={activatorEvent:F,active:R,activeNode:ne,collisionRect:lt,collisions:pt,droppableRects:j,draggableNodes:P,draggingNode:ee,draggingNodeRect:Se,droppableContainers:L,over:Ft,scrollableAncestors:se,scrollAdjustedTranslate:ht},M.current={initial:Se,translated:lt}},[R,ne,pt,lt,P,ee,Se,j,L,Ft,se,ht]),Nz({...Z,delta:w,draggingRect:lt,pointerCoordinates:gt,scrollableAncestors:se,scrollableAncestorRects:$e});let vn=V(()=>({active:R,activeNode:ne,activeNodeRect:ue,activatorEvent:F,collisions:pt,containerNodeRect:Me,dragOverlay:Ee,draggableNodes:P,droppableContainers:L,droppableRects:j,over:Ft,measureDroppableContainers:oe,scrollableAncestors:se,scrollableAncestorRects:$e,measuringConfiguration:U,measuringScheduled:Q,windowRect:le}),[R,ne,ue,F,pt,Me,Ee,P,L,j,Ft,oe,se,$e,U,Q,le]),$=V(()=>({activatorEvent:F,activators:Wt,active:R,activeNodeRect:ue,ariaDescribedById:{draggable:B},dispatch:y,draggableNodes:P,over:Ft,measureDroppableContainers:oe}),[F,Wt,R,ue,y,B,P,Ft,oe]);return mn.createElement(Vw.Provider,{value:x},mn.createElement(Gf.Provider,{value:$},mn.createElement(i0.Provider,{value:vn},mn.createElement(l0.Provider,{value:At},d)),mn.createElement(nH,{disabled:i?.restoreFocus===!1})),mn.createElement(lz,{...i,hiddenTextDescribedById:B}));function pe(){let ge=H?.autoScrollEnabled===!1,ye=typeof l=="object"?l.enabled===!1:l===!1,Pe=I&&!ge&&!ye;return typeof l=="object"?{...l,enabled:Pe}:{enabled:Pe}}}),sH=yt(null),qw="button",iH="Draggable";function c0(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=oi(iH),{activators:s,activatorEvent:i,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Dt(Gf),{role:m=qw,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Dt(v?l0:sH),[C,x]=ac(),[b,T]=ac(),I=Wz(s,t),k=cl(n);Ko(()=>(f.set(t,{id:t,key:a,node:C,activatorNode:b,data:k}),()=>{let w=f.get(t);w&&w.key===a&&f.delete(t)}),[f,t]);let P=V(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===qw?!0:void 0,"aria-roledescription":g,"aria-describedby":c.draggable}),[o,m,h,v,g,c.draggable]);return{active:l,activatorEvent:i,activeNodeRect:d,attributes:P,isDragging:v,listeners:o?void 0:I,node:C,over:p,setNodeRef:x,setActivatorNodeRef:T,transform:y}}function u0(){return Dt(i0)}var lH="Droppable",dH={timeout:25};function f0(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=oi(lH),{active:s,dispatch:i,over:l,measureDroppableContainers:d}=Dt(Gf),c=N({disabled:n}),f=N(!1),p=N(null),m=N(null),{disabled:g,updateMeasurementsFor:h,timeout:v}={...dH,...r},y=cl(h??o),C=E(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),m.current=null},v)},[v]),x=Wf({callback:C,disabled:g||!s}),b=E((P,w)=>{x&&(w&&(x.unobserve(w),f.current=!1),P&&x.observe(P))},[x]),[T,I]=ac(b),k=cl(t);return q(()=>{!x||!T.current||(x.disconnect(),f.current=!1,x.observe(T.current))},[T,x]),q(()=>(i({type:Ln.RegisterDroppable,element:{id:o,key:a,disabled:n,node:T,rect:p,data:k}}),()=>i({type:Ln.UnregisterDroppable,key:a,id:o})),[o]),q(()=>{n!==c.current.disabled&&(i({type:Ln.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,i]),{active:s,rect:p,isOver:l?.id===o,node:T,over:l,setNodeRef:I}}ie();function p0(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function cH(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function jf(e){return e!==null&&e>=0}function uH(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 fH(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var m0=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=p0(t,o,n),s=t[r],i=a[r];return!i||!s?null:{x:i.left-s.left,y:i.top-s.top,scaleX:i.width/s.width,scaleY:i.height/s.height}};var Qf={scaleX:1,scaleY:1},g0=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:s}=e,i=(t=a[n])!=null?t:o;if(!i)return null;if(r===n){let d=a[s];return d?{x:0,y:n<s?d.top+d.height-(i.top+i.height):d.top-i.top,...Qf}:null}let l=pH(a,r,n);return r>n&&r<=s?{x:0,y:-i.height-l,...Qf}:r<n&&r>=s?{x:0,y:i.height+l,...Qf}:{x:0,y:0,...Qf}};function pH(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 h0="Sortable",v0=mn.createContext({activeIndex:-1,containerId:h0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:m0,disabled:{draggable:!1,droppable:!1}});function y0(e){let{children:t,id:n,items:o,strategy:r=m0,disabled:a=!1}=e,{active:s,dragOverlay:i,droppableRects:l,over:d,measureDroppableContainers:c}=u0(),f=oi(h0,n),p=i.rect!==null,m=V(()=>o.map(I=>typeof I=="object"&&"id"in I?I.id:I),[o]),g=s!=null,h=s?m.indexOf(s.id):-1,v=d?m.indexOf(d.id):-1,y=N(m),C=!uH(m,y.current),x=v!==-1&&h===-1||C,b=fH(a);Ko(()=>{C&&g&&c(m)},[C,m,g,c]),q(()=>{y.current=m},[m]);let T=V(()=>({activeIndex:h,containerId:f,disabled:b,disableTransforms:x,items:m,overIndex:v,useDragOverlay:p,sortedRects:cH(m,l),strategy:r}),[h,f,b.draggable,b.droppable,x,m,v,l,p,r]);return mn.createElement(v0.Provider,{value:T},t)}var mH=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return p0(n,o,r).indexOf(t)},gH=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:l,transition:d}=e;return!d||!o||i!==a&&r===s?!1:n?!0:s!==r&&t===l},hH={duration:200,easing:"ease"},C0="transform",vH=os.Transition.toString({property:C0,duration:0,easing:"linear"}),yH={roleDescription:"sortable"};function CH(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,s]=G(null),i=N(n);return Ko(()=>{if(!t&&n!==i.current&&o.current){let l=r.current;if(l){let d=di(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)&&s(c)}}n!==i.current&&(i.current=n)},[t,n,o,r]),q(()=>{a&&s(null)},[a]),a}function x0(e){let{animateLayoutChanges:t=gH,attributes:n,disabled:o,data:r,getNewIndex:a=mH,id:s,strategy:i,resizeObserverConfig:l,transition:d=hH}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:C}=Dt(v0),x=xH(o,m),b=c.indexOf(s),T=V(()=>({sortable:{containerId:f,index:b,items:c},...r}),[f,r,b,c]),I=V(()=>c.slice(c.indexOf(s)),[c,s]),{rect:k,node:P,isOver:w,setNodeRef:L}=f0({id:s,data:T,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...l}}),{active:A,activatorEvent:M,activeNodeRect:R,attributes:D,setNodeRef:H,listeners:W,isDragging:F,over:J,setActivatorNodeRef:O,transform:B}=c0({id:s,data:T,attributes:{...yH,...n},disabled:x.draggable}),Y=Pw(L,H),U=!!A,j=U&&!g&&jf(p)&&jf(v),oe=!y&&F,Q=oe&&j?B:null,re=j?Q??(i??C)({rects:h,activeNodeRect:R,activeIndex:p,overIndex:v,index:b}):null,Z=jf(p)&&jf(v)?a({id:s,items:c,activeIndex:p,overIndex:v}):b,te=A?.id,ue=N({activeId:te,items:c,newIndex:Z,containerId:f}),Me=c!==ue.current.items,Oe=t({active:A,containerId:f,isDragging:F,isSorting:U,id:s,index:b,items:c,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:d,wasDragging:ue.current.activeId!=null}),ke=CH({disabled:!Oe,index:b,node:P,rect:k});return q(()=>{U&&ue.current.newIndex!==Z&&(ue.current.newIndex=Z),f!==ue.current.containerId&&(ue.current.containerId=f),c!==ue.current.items&&(ue.current.items=c)},[U,Z,f,c]),q(()=>{if(te===ue.current.activeId)return;if(te!=null&&ue.current.activeId==null){ue.current.activeId=te;return}let ee=setTimeout(()=>{ue.current.activeId=te},50);return()=>clearTimeout(ee)},[te]),{active:A,activeIndex:p,attributes:D,data:T,rect:k,index:b,newIndex:Z,items:c,isOver:w,isSorting:U,isDragging:F,listeners:W,node:P,overIndex:v,over:J,setNodeRef:Y,setActivatorNodeRef:O,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:ke??re,transition:Ee()};function Ee(){if(ke||Me&&ue.current.newIndex===b)return vH;if(!(oe&&!sc(M)||!d)&&(U||Oe))return os.Transition.toString({...d,property:C0})}}function xH(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 Xf(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 bH=[It.Down,It.Right,It.Up,It.Left],b0=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(bH.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 It.Down:o.top<p.top&&l.push(f);break;case It.Up:o.top>p.top&&l.push(f);break;case It.Left:o.left>p.left&&l.push(f);break;case It.Right:o.left<p.left&&l.push(f);break}});let d=Xw({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=Fh(d,"id");if(c===s?.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,g=p?.node.current;if(g&&m&&f&&p){let v=fc(g).some((I,k)=>i[k]!==I),y=S0(f,p),C=SH(f,p),x=v||!y?{x:0,y:0}:{x:C?o.width-m.width:0,y:C?o.height-m.height:0},b={x:m.left,y:m.top};return x.x&&x.y?b:ai(b,x)}}}};function S0(e,t){return!Xf(e)||!Xf(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function SH(e,t){return!Xf(e)||!Xf(t)||!S0(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function IH(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 I0=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:IH(n,t,r)},w0=e=>{let{transform:t}=e;return{...t,x:0}};ie();ie();var Yf={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function T0(e){return`(min-width: ${typeof e=="number"?e:Yf[e]}px)`}function P0(e){return`(max-width: ${(typeof e=="number"?e:Yf[e])-1}px)`}function wH(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(T0(e.min)),e.max!=null&&n.push(P0(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 Yf&&t.push(P0(o))}else n in Yf&&t.push(T0(n));return t.length>0?t.join(" and "):e}function TH(){return!1}function Jf(e){let t=wH(e),n=E(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=E(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return bo(n,o,TH)}ie();var Bh={};In(Bh,{LexicalComposerContext:()=>k0,createLexicalComposerContext:()=>PH,useLexicalComposerContext:()=>kH});ie();var k0=yt(null);function PH(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function kH(){let e=Dt(k0);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 Uh=Bh,L0=Uh.LexicalComposerContext,A0=Uh.createLexicalComposerContext,an=Uh.useLexicalComposerContext;var my={};In(my,{$addUpdateTag:()=>Fp,$applyNodeReplacement:()=>Fc,$caretFromPoint:()=>ms,$caretRangeFromSelection:()=>Pv,$cloneWithProperties:()=>iy,$cloneWithPropertiesEphemeral:()=>cK,$comparePointCaretNext:()=>uy,$copyNode:()=>ay,$create:()=>fK,$createLineBreakNode:()=>Sl,$createNodeSelection:()=>qv,$createParagraphNode:()=>ma,$createPoint:()=>pr,$createRangeSelection:()=>CP,$createRangeSelectionFromDom:()=>U5,$createTabNode:()=>Ep,$createTextNode:()=>_n,$extendCaretToRange:()=>dy,$findMatchingParent:()=>yc,$getAdjacentChildCaret:()=>Rl,$getAdjacentNode:()=>UP,$getAdjacentSiblingOrParentSiblingCaret:()=>xK,$getCaretInDirection:()=>gs,$getCaretRange:()=>ps,$getCaretRangeInDirection:()=>py,$getCharacterOffsets:()=>yv,$getChildCaret:()=>ha,$getChildCaretAtIndex:()=>ek,$getChildCaretOrSelf:()=>QP,$getCollapsedCaretRange:()=>XP,$getCommonAncestor:()=>Cc,$getCommonAncestorResultBranchOrder:()=>fy,$getEditor:()=>sy,$getNearestNodeFromDOMNode:()=>Op,$getNearestRootOrShadowRoot:()=>KP,$getNodeByKey:()=>Rn,$getNodeByKeyOrThrow:()=>$P,$getNodeFromDOMNode:()=>Jv,$getPreviousSelection:()=>xi,$getRoot:()=>Po,$getSelection:()=>_t,$getSiblingCaret:()=>Un,$getState:()=>cp,$getStateChange:()=>a5,$getTextContent:()=>K5,$getTextNodeOffset:()=>fr,$getTextPointCaret:()=>fs,$getTextPointCaretSlice:()=>wv,$getWritableNodeState:()=>Rv,$hasAncestor:()=>Tp,$hasUpdateTag:()=>aK,$insertNodes:()=>H5,$isBlockElementNode:()=>B5,$isChildCaret:()=>ur,$isDecoratorNode:()=>Xt,$isEditorState:()=>W5,$isElementNode:()=>me,$isExtendableTextPointCaret:()=>ZP,$isInlineElementOrDecoratorNode:()=>sK,$isLeafNode:()=>nK,$isLineBreakNode:()=>pi,$isNodeCaret:()=>gK,$isNodeSelection:()=>Nc,$isParagraphNode:()=>PP,$isRangeSelection:()=>Ge,$isRootNode:()=>$n,$isRootOrShadowRoot:()=>Vo,$isSiblingCaret:()=>Ci,$isTabNode:()=>$v,$isTextNode:()=>Ue,$isTextPointCaret:()=>ga,$isTextPointCaretSlice:()=>CK,$isTokenOrSegmented:()=>ua,$isTokenOrTab:()=>is,$nodesOfType:()=>rK,$normalizeCaret:()=>dr,$normalizeSelection__EXPERIMENTAL:()=>up,$onUpdate:()=>HP,$parseSerializedNode:()=>V5,$removeTextFromCaretRange:()=>JP,$rewindSiblingCaret:()=>_l,$selectAll:()=>oK,$setCompositionKey:()=>On,$setPointFromCaret:()=>El,$setSelection:()=>yo,$setSelectionFromCaretRange:()=>YP,$setState:()=>s5,$splitAtPointCaretNext:()=>IK,$splitNode:()=>iK,$updateRangeSelectionFromCaretRange:()=>xc,ArtificialNode__DO_NOT_USE:()=>Ip,BEFORE_INPUT_COMMAND:()=>Mv,BLUR_COMMAND:()=>JT,CAN_REDO_COMMAND:()=>y5,CAN_UNDO_COMMAND:()=>C5,CLEAR_EDITOR_COMMAND:()=>h5,CLEAR_HISTORY_COMMAND:()=>v5,CLICK_COMMAND:()=>DT,COLLABORATION_TAG:()=>dP,COMMAND_PRIORITY_CRITICAL:()=>Y5,COMMAND_PRIORITY_EDITOR:()=>hl,COMMAND_PRIORITY_HIGH:()=>X5,COMMAND_PRIORITY_LOW:()=>j5,COMMAND_PRIORITY_NORMAL:()=>Q5,COMPOSITION_END_COMMAND:()=>Dv,COMPOSITION_END_TAG:()=>pP,COMPOSITION_START_COMMAND:()=>_v,COMPOSITION_START_TAG:()=>fP,CONTROLLED_TEXT_INSERTION_COMMAND:()=>yl,COPY_COMMAND:()=>zv,CUT_COMMAND:()=>Hv,DELETE_CHARACTER_COMMAND:()=>wc,DELETE_LINE_COMMAND:()=>Pc,DELETE_WORD_COMMAND:()=>Tc,DRAGEND_COMMAND:()=>XT,DRAGOVER_COMMAND:()=>QT,DRAGSTART_COMMAND:()=>jT,DROP_COMMAND:()=>GT,DecoratorNode:()=>Lc,ElementNode:()=>cs,FOCUS_COMMAND:()=>YT,FORMAT_ELEMENT_COMMAND:()=>g5,FORMAT_TEXT_COMMAND:()=>as,HISTORIC_TAG:()=>k5,HISTORY_MERGE_TAG:()=>ip,HISTORY_PUSH_TAG:()=>L5,INDENT_CONTENT_COMMAND:()=>p5,INPUT_COMMAND:()=>Nv,INSERT_LINE_BREAK_COMMAND:()=>gc,INSERT_PARAGRAPH_COMMAND:()=>lv,INSERT_TAB_COMMAND:()=>f5,INTERNAL_$isBlock:()=>pa,IS_ALL_FORMATTING:()=>zH,IS_BOLD:()=>NH,IS_CODE:()=>FH,IS_HIGHLIGHT:()=>kv,IS_ITALIC:()=>_H,IS_STRIKETHROUGH:()=>DH,IS_SUBSCRIPT:()=>BH,IS_SUPERSCRIPT:()=>UH,IS_UNDERLINE:()=>OH,KEY_ARROW_DOWN_COMMAND:()=>HT,KEY_ARROW_LEFT_COMMAND:()=>BT,KEY_ARROW_RIGHT_COMMAND:()=>OT,KEY_ARROW_UP_COMMAND:()=>zT,KEY_BACKSPACE_COMMAND:()=>$T,KEY_DELETE_COMMAND:()=>VT,KEY_DOWN_COMMAND:()=>Uv,KEY_ENTER_COMMAND:()=>hp,KEY_ESCAPE_COMMAND:()=>qT,KEY_MODIFIER_COMMAND:()=>ZT,KEY_SPACE_COMMAND:()=>KT,KEY_TAB_COMMAND:()=>WT,LineBreakNode:()=>bl,MOVE_TO_END:()=>FT,MOVE_TO_START:()=>UT,NODE_STATE_KEY:()=>ZH,OUTDENT_CONTENT_COMMAND:()=>m5,PASTE_COMMAND:()=>Ov,PASTE_TAG:()=>A5,ParagraphNode:()=>Tl,REDO_COMMAND:()=>Bv,REMOVE_TEXT_COMMAND:()=>dv,RootNode:()=>wl,SELECTION_CHANGE_COMMAND:()=>Ev,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>u5,SELECT_ALL_COMMAND:()=>cv,SKIP_COLLAB_TAG:()=>R5,SKIP_DOM_SELECTION_TAG:()=>uP,SKIP_SCROLL_INTO_VIEW_TAG:()=>cP,SKIP_SELECTION_FOCUS_TAG:()=>hv,TEXT_TYPE_TO_FORMAT:()=>Xn,TabNode:()=>Il,TextNode:()=>hi,UNDO_COMMAND:()=>Fv,addClassNamesToElement:()=>AK,buildImportMap:()=>P5,configExtension:()=>TK,createCommand:()=>et,createEditor:()=>J5,createSharedNodeState:()=>AT,createState:()=>r5,declarePeerDependency:()=>PK,defineExtension:()=>wK,flipDirection:()=>hs,getDOMOwnerDocument:()=>oy,getDOMSelection:()=>gr,getDOMSelectionFromTarget:()=>qP,getDOMTextNode:()=>yi,getEditorPropertyFromDOMNode:()=>Dc,getNearestEditorFromDOMNode:()=>Yv,getRegisteredNode:()=>Qv,getRegisteredNodeOrThrow:()=>jv,getStaticNodeConfig:()=>Bc,getTextDirection:()=>tK,getTransformSetFromKlass:()=>LP,isBlockDomNode:()=>Sv,isCurrentlyReadOnlyMode:()=>Ml,isDOMDocumentNode:()=>EP,isDOMNode:()=>Nl,isDOMTextNode:()=>Ur,isDOMUnmanaged:()=>jP,isDocumentFragment:()=>VP,isExactShortcutMatch:()=>Ht,isHTMLAnchorElement:()=>lK,isHTMLElement:()=>io,isInlineDomNode:()=>WP,isLexicalEditor:()=>_p,isModifierMatch:()=>BP,isSelectionCapturedInDecoratorInput:()=>Xv,isSelectionWithinEditor:()=>_c,makeStepwiseIterator:()=>cy,mergeRegister:()=>EK,normalizeClassNames:()=>Uc,removeClassNamesFromElement:()=>RK,removeFromParent:()=>ls,resetRandomKey:()=>Z5,safeCast:()=>kK,setDOMUnmanaged:()=>uK,setNodeIndentFromDOM:()=>GP,shallowMergeConfig:()=>LK,toggleTextFormatType:()=>Rc});function ve(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 bT(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,LH=mr&&"documentMode"in document?document.documentMode:null,lr=mr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ds=mr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),dp=!(!mr||!("InputEvent"in window)||LH)&&"getTargetRanges"in new window.InputEvent("input"),kp=mr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Mc=mr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,AH=mr&&/Android/.test(navigator.userAgent),ST=mr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xh=mr&&AH&&ST,Lp=mr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&lr&&!ST,RH=0,EH=1,MH=2,NH=1,_H=2,DH=4,OH=8,FH=16,BH=32,UH=64,kv=128,zH=2047,HH=1,KH=2,$H=3,qH=4,VH=5,WH=6,bc=kp||Mc||Lp?"\xA0":"\u200B",Ap=`
3772
+ `},tz={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 nz(e){let{announcements:t=tz,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=ez}=e,{announce:a,announcement:s}=Aw(),i=Zs("DndLiveRegion"),[l,d]=Q(!1);if(q(()=>{d(!0)},[]),JU(V(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=un.createElement(un.Fragment,null,un.createElement(kw,{id:o,value:r.draggable}),un.createElement(Lw,{id:i,announcement:s}));return n?(0,ni.createPortal)(c,n):c}var Ln;(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"})(Ln||(Ln={}));function $f(){}function _h(e,t){return V(()=>({sensor:e,options:t??{}}),[e,t])}function $w(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return V(()=>[...t].filter(o=>o!=null),[...t])}var ar=Object.freeze({x:0,y:0});function qw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vw(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function oz(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Rw(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 Dh(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Ew(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 Ww=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=Ew(t,t.left,t.top),a=[];for(let s of o){let{id:i}=s,l=n.get(i);if(l){let d=qw(Ew(l),r);a.push({id:i,data:{droppableContainer:s,value:d}})}}return a.sort(Vw)},Gw=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=Rw(t),a=[];for(let s of o){let{id:i}=s,l=n.get(i);if(l){let d=Rw(l),c=r.reduce((p,m,g)=>p+qw(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:i,data:{droppableContainer:s,value:f}})}}return a.sort(Vw)};function rz(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),s=r-o,i=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=s*i,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var az=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:s}=a,i=n.get(s);if(i){let l=rz(i,t);l>0&&r.push({id:s,data:{droppableContainer:a,value:l}})}}return r.sort(oz)};function sz(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function jw(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ar}function iz(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((s,i)=>({...s,top:s.top+e*i.y,bottom:s.bottom+e*i.y,left:s.left+e*i.x,right:s.right+e*i.x}),{...n})}}var lz=iz(1);function dz(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 cz(e,t,n){let o=dz(t);if(!o)return e;let{scaleX:r,scaleY:a,x:s,y:i}=o,l=e.left-s-(1-r)*parseFloat(n),d=e.top-i-(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 uz={ignoreTransform:!1};function ai(e,t){t===void 0&&(t=uz);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=ao(e).getComputedStyle(e);d&&(n=cz(n,d,c))}let{top:o,left:r,width:a,height:s,bottom:i,right:l}=n;return{top:o,left:r,width:a,height:s,bottom:i,right:l}}function Mw(e){return ai(e,{ignoreTransform:!0})}function fz(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function pz(e,t){return t===void 0&&(t=ao(e).getComputedStyle(e)),t.position==="fixed"}function mz(e,t){t===void 0&&(t=ao(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 uc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(Uf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!il(r)||Th(r)||n.includes(r))return n;let a=ao(e).getComputedStyle(r);return r!==e&&mz(r,a)&&n.push(r),pz(r,a)?n:o(r.parentNode)}return e?o(e):n}function Qw(e){let[t]=uc(e,1);return t??null}function Ph(e){return!oc||!e?null:Ys(e)?e:Bf(e)?Uf(e)||e===Js(e).scrollingElement?window:il(e)?e:null:null}function Xw(e){return Ys(e)?e.scrollX:e.scrollLeft}function Yw(e){return Ys(e)?e.scrollY:e.scrollTop}function Ah(e){return{x:Xw(e),y:Yw(e)}}var _n;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(_n||(_n={}));function Jw(e){return!oc||!e?!1:e===document.scrollingElement}function Zw(e){let t={x:0,y:0},n=Jw(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,s=e.scrollTop>=o.y,i=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:s,isRight:i,maxScroll:o,minScroll:t}}var gz={x:.2,y:.2};function hz(e,t,n,o,r){let{top:a,left:s,right:i,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=gz);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=Zw(e),m={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+h.height?(m.y=_n.Backward,g.y=o*Math.abs((t.top+h.height-a)/h.height)):!c&&l>=t.bottom-h.height&&(m.y=_n.Forward,g.y=o*Math.abs((t.bottom-h.height-l)/h.height)),!p&&i>=t.right-h.width?(m.x=_n.Forward,g.x=o*Math.abs((t.right-h.width-i)/h.width)):!f&&s<=t.left+h.width&&(m.x=_n.Backward,g.x=o*Math.abs((t.left+h.width-s)/h.width)),{direction:m,speed:g}}function vz(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}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 e0(e){return e.reduce((t,n)=>ei(t,Ah(n)),ar)}function yz(e){return e.reduce((t,n)=>t+Xw(n),0)}function Cz(e){return e.reduce((t,n)=>t+Yw(n),0)}function xz(e,t){if(t===void 0&&(t=ai),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);Qw(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var bz=[["x",["left","right"],yz],["y",["top","bottom"],Cz]],lc=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=uc(n),r=e0(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,s,i]of bz)for(let l of s)Object.defineProperty(this,l,{get:()=>{let d=i(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},oi=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 Sz(e){let{EventTarget:t}=ao(e);return e instanceof t?e:Js(e)}function kh(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var Vo;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Vo||(Vo={}));function Nw(e){e.preventDefault()}function Iz(e){e.stopPropagation()}var wt;(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"})(wt||(wt={}));var t0={start:[wt.Space,wt.Enter],cancel:[wt.Esc],end:[wt.Space,wt.Enter,wt.Tab]},wz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case wt.Right:return{...n,x:n.x+25};case wt.Left:return{...n,x:n.x-25};case wt.Down:return{...n,y:n.y+25};case wt.Up:return{...n,y:n.y-25}}},cl=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 oi(Js(n)),this.windowListeners=new oi(ao(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Vo.Resize,this.handleCancel),this.windowListeners.add(Vo.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Vo.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&xz(o),n(ar)}handleKeyDown(t){if(ac(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=t0,coordinateGetter:s=wz,scrollBehavior:i="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}:ar;this.referenceCoordinates||(this.referenceCoordinates=c);let f=s(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=ti(f,c),m={x:0,y:0},{scrollableAncestors:g}=o.current;for(let h of g){let v=t.code,{isTop:y,isRight:C,isLeft:x,isBottom:b,maxScroll:w,minScroll:I}=Zw(h),k=vz(h),P={x:Math.min(v===wt.Right?k.right-k.width/2:k.right,Math.max(v===wt.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===wt.Down?k.bottom-k.height/2:k.bottom,Math.max(v===wt.Down?k.top:k.top+k.height/2,f.y))},T=v===wt.Right&&!C||v===wt.Left&&!x,L=v===wt.Down&&!b||v===wt.Up&&!y;if(T&&P.x!==f.x){let A=h.scrollLeft+p.x,M=v===wt.Right&&A<=w.x||v===wt.Left&&A>=I.x;if(M&&!p.y){h.scrollTo({left:A,behavior:i});return}M?m.x=h.scrollLeft-A:m.x=v===wt.Right?h.scrollLeft-w.x:h.scrollLeft-I.x,m.x&&h.scrollBy({left:-m.x,behavior:i});break}else if(L&&P.y!==f.y){let A=h.scrollTop+p.y,M=v===wt.Down&&A<=w.y||v===wt.Up&&A>=I.y;if(M&&!p.x){h.scrollTo({top:A,behavior:i});return}M?m.y=h.scrollTop-A:m.y=v===wt.Down?h.scrollTop-w.y:h.scrollTop-I.y,m.y&&h.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(t,ei(ti(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()}};cl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=t0,onActivation:r}=t,{active:a}=n,{code:s}=e.nativeEvent;if(o.start.includes(s)){let i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function _w(e){return!!(e&&"distance"in e)}function Dw(e){return!!(e&&"delay"in e)}var dc=class{constructor(t,n,o){var r;o===void 0&&(o=Sz(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:s}=a;this.props=t,this.events=n,this.document=Js(s),this.documentListeners=new oi(this.document),this.listeners=new oi(o),this.windowListeners=new oi(ao(s)),this.initialCoordinates=(r=sc(a))!=null?r:ar,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(Vo.Resize,this.handleCancel),this.windowListeners.add(Vo.DragStart,Nw),this.windowListeners.add(Vo.VisibilityChange,this.handleCancel),this.windowListeners.add(Vo.ContextMenu,Nw),this.documentListeners.add(Vo.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Dw(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(_w(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(Vo.Click,Iz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Vo.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:i}}=a;if(!r)return;let l=(n=sc(t))!=null?n:ar,d=ti(r,l);if(!o&&i){if(_w(i)){if(i.tolerance!=null&&kh(d,i.tolerance))return this.handleCancel();if(kh(d,i.distance))return this.handleStart()}if(Dw(i)&&kh(d,i.tolerance))return this.handleCancel();this.handlePending(i,d);return}t.cancelable&&t.preventDefault(),s(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===wt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},Tz={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},ul=class extends dc{constructor(t){let{event:n}=t,o=Js(n.target);super(t,Tz,o)}};ul.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 Pz={move:{name:"mousemove"},end:{name:"mouseup"}},Rh;(function(e){e[e.RightClick=2]="RightClick"})(Rh||(Rh={}));var Eh=class extends dc{constructor(t){super(t,Pz,Js(t.event.target))}};Eh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Rh.RightClick?!1:(o?.({event:n}),!0)}}];var Lh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Mh=class extends dc{constructor(t){super(t,Lh)}static setup(){return window.addEventListener(Lh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lh.move.name,t)};function t(){}}};Mh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var ic;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ic||(ic={}));var qf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(qf||(qf={}));function kz(e){let{acceleration:t,activator:n=ic.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:s=5,order:i=qf.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=Az({delta:f,disabled:!a}),[g,h]=ww(),v=N({x:0,y:0}),y=N({x:0,y:0}),C=V(()=>{switch(n){case ic.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case ic.DraggableRect:return r}},[n,r,l]),x=N(null),b=E(()=>{let I=x.current;if(!I)return;let k=v.current.x*y.current.x,P=v.current.y*y.current.y;I.scrollBy(k,P)},[]),w=V(()=>i===qf.TreeOrder?[...d].reverse():d,[i,d]);q(()=>{if(!a||!d.length||!C){h();return}for(let I of w){if(o?.(I)===!1)continue;let k=d.indexOf(I),P=c[k];if(!P)continue;let{direction:T,speed:L}=hz(I,P,C,t,p);for(let A of["x","y"])m[A][T[A]]||(L[A]=0,T[A]=0);if(L.x>0||L.y>0){h(),x.current=I,g(b,s),v.current=L,y.current=T;return}}v.current={x:0,y:0},y.current={x:0,y:0},h()},[t,b,o,h,a,s,JSON.stringify(C),JSON.stringify(m),g,d,w,c,JSON.stringify(p)])}var Lz={x:{[_n.Backward]:!1,[_n.Forward]:!1},y:{[_n.Backward]:!1,[_n.Forward]:!1}};function Az(e){let{delta:t,disabled:n}=e,o=Hf(t);return dl(r=>{if(n||!o||!r)return Lz;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[_n.Backward]:r.x[_n.Backward]||a.x===-1,[_n.Forward]:r.x[_n.Forward]||a.x===1},y:{[_n.Backward]:r.y[_n.Backward]||a.y===-1,[_n.Forward]:r.y[_n.Forward]||a.y===1}}},[n,t,o])}function Rz(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return dl(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function Ez(e,t){return V(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,o)}));return[...n,...a]},[]),[e,t])}var cc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(cc||(cc={}));var Nh;(function(e){e.Optimized="optimized"})(Nh||(Nh={}));var Ow=new Map;function Mz(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,s]=Q(null),{frequency:i,measure:l,strategy:d}=r,c=N(e),f=v(),p=ll(f),m=E(function(y){y===void 0&&(y=[]),!p.current&&s(C=>C===null?y:C.concat(y.filter(x=>!C.includes(x))))},[p]),g=N(null),h=dl(y=>{if(f&&!n)return Ow;if(!y||y===Ow||c.current!==e||a!=null){let C=new Map;for(let x of e){if(!x)continue;if(a&&a.length>0&&!a.includes(x.id)&&x.rect.current){C.set(x.id,x.rect.current);continue}let b=x.node.current,w=b?new lc(l(b),b):null;x.rect.current=w,w&&C.set(x.id,w)}return C}return y},[e,a,n,f,l]);return q(()=>{c.current=e},[e]),q(()=>{f||m()},[n,f]),q(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),q(()=>{f||typeof i!="number"||g.current!==null||(g.current=setTimeout(()=>{m(),g.current=null},i))},[i,f,m,...o]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case cc.Always:return!1;case cc.BeforeDragging:return n;default:return!n}}}function n0(e,t){return dl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Nz(e,t){return n0(e,t)}function _z(e){let{callback:t,disabled:n}=e,o=zf(t),r=V(()=>{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 Vf(e){let{callback:t,disabled:n}=e,o=zf(t),r=V(()=>{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 Dz(e){return new lc(ai(e),e)}function Fw(e,t,n){t===void 0&&(t=Dz);let[o,r]=Q(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 s=_z({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}}}}),i=Vf({callback:a});return qo(()=>{a(),e?(i?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),s?.disconnect())},[e]),o}function Oz(e){let t=n0(e);return jw(e,t)}var Bw=[];function Fz(e){let t=N(e),n=dl(o=>e?o&&o!==Bw&&e&&t.current&&e.parentNode===t.current.parentNode?o:uc(e):Bw,[e]);return q(()=>{t.current=e},[e]),n}function Bz(e){let[t,n]=Q(null),o=N(e),r=E(a=>{let s=Ph(a.target);s&&n(i=>i?(i.set(s,Ah(s)),new Map(i)):null)},[]);return q(()=>{let a=o.current;if(e!==a){s(a);let i=e.map(l=>{let d=Ph(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,Ah(d)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),o.current=e}return()=>{s(e),s(a)};function s(i){i.forEach(l=>{let d=Ph(l);d?.removeEventListener("scroll",r)})}},[r,e]),V(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ei(a,s),ar):e0(e):ar,[e,t])}function Uw(e,t){t===void 0&&(t=[]);let n=N(null);return q(()=>{n.current=null},t),q(()=>{let o=e!==ar;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ti(e,n.current):ar}function Uz(e){q(()=>{if(!oc)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 zz(e,t){return V(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=s=>{a(s,t)},n},{}),[e,t])}function o0(e){return V(()=>e?fz(e):null,[e])}var zw=[];function Hz(e,t){t===void 0&&(t=ai);let[n]=e,o=o0(n?ao(n):null),[r,a]=Q(zw);function s(){a(()=>e.length?e.map(l=>Jw(l)?o:new lc(t(l),l)):zw)}let i=Vf({callback:s});return qo(()=>{i?.disconnect(),s(),e.forEach(l=>i?.observe(l))},[e]),r}function Kz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return il(t)?t:e}function $z(e){let{measure:t}=e,[n,o]=Q(null),r=E(d=>{for(let{target:c}of d)if(il(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=Vf({callback:r}),s=E(d=>{let c=Kz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[i,l]=rc(s);return V(()=>({nodeRef:i,rect:n,setRef:l}),[n,i,l])}var qz=[{sensor:ul,options:{}},{sensor:cl,options:{}}],Vz={current:{}},Kf={draggable:{measure:Mw},droppable:{measure:Mw,strategy:cc.WhileDragging,frequency:Nh.Optimized},dragOverlay:{measure:ai}},ri=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}},Wz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ri,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$f},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kf,measureDroppableContainers:$f,windowRect:null,measuringScheduled:!1},Gz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:$f,draggableNodes:new Map,over:null,measureDroppableContainers:$f},Wf=yt(Gz),r0=yt(Wz);function jz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ri}}}function Qz(e,t){switch(t.type){case Ln.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ln.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 Ln.DragEnd:case Ln.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ln.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new ri(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Ln.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let s=new ri(e.droppable.containers);return s.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Ln.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new ri(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Xz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=Ot(Wf),a=Hf(o),s=Hf(n?.id);return q(()=>{if(!t&&!o&&a&&s!=null){if(!ac(a)||document.activeElement===a.target)return;let i=r.get(s);if(!i)return;let{activatorNode:l,node:d}=i;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=Pw(c);if(f){f.focus();break}}})}},[o,t,r,s,a]),null}function Yz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function Jz(e){return V(()=>({draggable:{...Kf.draggable,...e?.draggable},droppable:{...Kf.droppable,...e?.droppable},dragOverlay:{...Kf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Zz(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=N(!1),{x:s,y:i}=typeof r=="boolean"?{x:r,y:r}:r;qo(()=>{if(!s&&!i||!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=jw(c,o);if(s||(f.x=0),i||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=Qw(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,s,i,o,n])}var a0=yt({...ar,scaleX:1,scaleY:1}),is;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(is||(is={}));var s0=ye(function(t){var n,o,r,a;let{id:s,accessibility:i,autoScroll:l=!0,children:d,sensors:c=qz,collisionDetection:f=az,measuring:p,modifiers:m,...g}=t,h=ea(Qz,void 0,jz),[v,y]=h,[C,x]=ZU(),[b,w]=Q(is.Uninitialized),I=b===is.Initialized,{draggable:{active:k,nodes:P,translate:T},droppable:{containers:L}}=v,A=k!=null?P.get(k):null,M=N({initial:null,translated:null}),R=V(()=>{var de;return k!=null?{id:k,data:(de=A?.data)!=null?de:Vz,rect:M}:null},[k,A]),D=N(null),[H,W]=Q(null),[F,J]=Q(null),O=ll(g,Object.values(g)),B=Zs("DndDescribedBy",s),Y=V(()=>L.getEnabled(),[L]),U=Jz(p),{droppableRects:X,measureDroppableContainers:re,measuringScheduled:G}=Mz(Y,{dragging:I,dependencies:[T.x,T.y],config:U.droppable}),te=Rz(P,k),oe=V(()=>F?sc(F):null,[F]),Z=ae(),ee=Nz(te,U.draggable.measure);Zz({activeNode:k!=null?P.get(k):null,config:Z.layoutShiftCompensation,initialRect:ee,measure:U.draggable.measure});let fe=Fw(te,U.draggable.measure,ee),Re=Fw(te?te.parentElement:null),Be=N({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Se=L.getNodeFor((n=Be.current.over)==null?void 0:n.id),Ee=$z({measure:U.dragOverlay.measure}),ne=(o=Ee.nodeRef.current)!=null?o:te,we=I?(r=Ee.rect)!=null?r:fe:null,j=!!(Ee.nodeRef.current&&Ee.rect),ue=Oz(j?null:fe),ge=o0(ne?ao(ne):null),ie=Fz(I?Se??te:null),He=Hz(ie),Pt=Yz(m,{transform:{x:T.x-ue.x,y:T.y-ue.y,scaleX:1,scaleY:1},activatorEvent:F,active:R,activeNodeRect:fe,containerNodeRect:Re,draggingNodeRect:we,over:Be.current.over,overlayNodeRect:Ee.rect,scrollableAncestors:ie,scrollableAncestorRects:He,windowRect:ge}),ct=oe?ei(oe,T):null,gt=Bz(ie),bt=Uw(gt),ut=Uw(gt,[fe]),mt=ei(Pt,bt),st=we?lz(we,Pt):null,lt=R&&st?f({active:R,collisionRect:st,droppableRects:X,droppableContainers:Y,pointerCoordinates:ct}):null,At=Dh(lt,"id"),[Wt,fn]=Q(null),at=j?Pt:ei(Pt,ut),Mt=sz(at,(a=Wt?.rect)!=null?a:null,fe),Ht=N(null),nn=E((de,Pe)=>{let{sensor:_e,options:ft}=Pe;if(D.current==null)return;let pn=P.get(D.current);if(!pn)return;let St=de.nativeEvent,ht=new _e({active:D.current,activeNode:pn,event:St,options:ft,context:Be,onAbort(je){if(!P.get(je))return;let{onDragAbort:Zt}=O.current,Te={id:je};Zt?.(Te),C({type:"onDragAbort",event:Te})},onPending(je,Qt,Zt,Te){if(!P.get(je))return;let{onDragPending:qe}=O.current,ot={id:je,constraint:Qt,initialCoordinates:Zt,offset:Te};qe?.(ot),C({type:"onDragPending",event:ot})},onStart(je){let Qt=D.current;if(Qt==null)return;let Zt=P.get(Qt);if(!Zt)return;let{onDragStart:Te}=O.current,$e={activatorEvent:St,active:{id:Qt,data:Zt.data,rect:M}};(0,ni.unstable_batchedUpdates)(()=>{Te?.($e),w(is.Initializing),y({type:Ln.DragStart,initialCoordinates:je,active:Qt}),C({type:"onDragStart",event:$e}),W(Ht.current),J(St)})},onMove(je){y({type:Ln.DragMove,coordinates:je})},onEnd:kt(Ln.DragEnd),onCancel:kt(Ln.DragCancel)});Ht.current=ht;function kt(je){return async function(){let{active:Zt,collisions:Te,over:$e,scrollAdjustedTranslate:qe}=Be.current,ot=null;if(Zt&&qe){let{cancelDrop:rt}=O.current;ot={activatorEvent:St,active:Zt,collisions:Te,delta:qe,over:$e},je===Ln.DragEnd&&typeof rt=="function"&&await Promise.resolve(rt(ot))&&(je=Ln.DragCancel)}D.current=null,(0,ni.unstable_batchedUpdates)(()=>{y({type:je}),w(is.Uninitialized),fn(null),W(null),J(null),Ht.current=null;let rt=je===Ln.DragEnd?"onDragEnd":"onDragCancel";if(ot){let tt=O.current[rt];tt?.(ot),C({type:rt,event:ot})}})}}},[P]),Kt=E((de,Pe)=>(_e,ft)=>{let pn=_e.nativeEvent,St=P.get(ft);if(D.current!==null||!St||pn.dndKit||pn.defaultPrevented)return;let ht={active:St};de(_e,Pe.options,ht)===!0&&(pn.dndKit={capturedBy:Pe.sensor},D.current=ft,nn(_e,Pe))},[P,nn]),jt=Ez(c,Kt);Uz(c),qo(()=>{fe&&b===is.Initializing&&w(is.Initialized)},[fe,b]),q(()=>{let{onDragMove:de}=O.current,{active:Pe,activatorEvent:_e,collisions:ft,over:pn}=Be.current;if(!Pe||!_e)return;let St={active:Pe,activatorEvent:_e,collisions:ft,delta:{x:mt.x,y:mt.y},over:pn};(0,ni.unstable_batchedUpdates)(()=>{de?.(St),C({type:"onDragMove",event:St})})},[mt.x,mt.y]),q(()=>{let{active:de,activatorEvent:Pe,collisions:_e,droppableContainers:ft,scrollAdjustedTranslate:pn}=Be.current;if(!de||D.current==null||!Pe||!pn)return;let{onDragOver:St}=O.current,ht=ft.get(At),kt=ht&&ht.rect.current?{id:ht.id,rect:ht.rect.current,data:ht.data,disabled:ht.disabled}:null,je={active:de,activatorEvent:Pe,collisions:_e,delta:{x:pn.x,y:pn.y},over:kt};(0,ni.unstable_batchedUpdates)(()=>{fn(kt),St?.(je),C({type:"onDragOver",event:je})})},[At]),qo(()=>{Be.current={activatorEvent:F,active:R,activeNode:te,collisionRect:st,collisions:lt,droppableRects:X,draggableNodes:P,draggingNode:ne,draggingNodeRect:we,droppableContainers:L,over:Wt,scrollableAncestors:ie,scrollAdjustedTranslate:mt},M.current={initial:we,translated:st}},[R,te,lt,st,P,ne,we,X,L,Wt,ie,mt]),kz({...Z,delta:T,draggingRect:st,pointerCoordinates:ct,scrollableAncestors:ie,scrollableAncestorRects:He});let yn=V(()=>({active:R,activeNode:te,activeNodeRect:fe,activatorEvent:F,collisions:lt,containerNodeRect:Re,dragOverlay:Ee,draggableNodes:P,droppableContainers:L,droppableRects:X,over:Wt,measureDroppableContainers:re,scrollableAncestors:ie,scrollableAncestorRects:He,measuringConfiguration:U,measuringScheduled:G,windowRect:ge}),[R,te,fe,F,lt,Re,Ee,P,L,X,Wt,re,ie,He,U,G,ge]),$=V(()=>({activatorEvent:F,activators:jt,active:R,activeNodeRect:fe,ariaDescribedById:{draggable:B},dispatch:y,draggableNodes:P,over:Wt,measureDroppableContainers:re}),[F,jt,R,fe,y,B,P,Wt,re]);return un.createElement(Kw.Provider,{value:x},un.createElement(Wf.Provider,{value:$},un.createElement(r0.Provider,{value:yn},un.createElement(a0.Provider,{value:Mt},d)),un.createElement(Xz,{disabled:i?.restoreFocus===!1})),un.createElement(nz,{...i,hiddenTextDescribedById:B}));function ae(){let de=H?.autoScrollEnabled===!1,Pe=typeof l=="object"?l.enabled===!1:l===!1,_e=I&&!de&&!Pe;return typeof l=="object"?{...l,enabled:_e}:{enabled:_e}}}),eH=yt(null),Hw="button",tH="Draggable";function i0(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=Zs(tH),{activators:s,activatorEvent:i,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Ot(Wf),{role:m=Hw,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Ot(v?a0:eH),[C,x]=rc(),[b,w]=rc(),I=zz(s,t),k=ll(n);qo(()=>(f.set(t,{id:t,key:a,node:C,activatorNode:b,data:k}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let P=V(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===Hw?!0:void 0,"aria-roledescription":g,"aria-describedby":c.draggable}),[o,m,h,v,g,c.draggable]);return{active:l,activatorEvent:i,activeNodeRect:d,attributes:P,isDragging:v,listeners:o?void 0:I,node:C,over:p,setNodeRef:x,setActivatorNodeRef:w,transform:y}}function l0(){return Ot(r0)}var nH="Droppable",oH={timeout:25};function d0(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=Zs(nH),{active:s,dispatch:i,over:l,measureDroppableContainers:d}=Ot(Wf),c=N({disabled:n}),f=N(!1),p=N(null),m=N(null),{disabled:g,updateMeasurementsFor:h,timeout:v}={...oH,...r},y=ll(h??o),C=E(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),m.current=null},v)},[v]),x=Vf({callback:C,disabled:g||!s}),b=E((P,T)=>{x&&(T&&(x.unobserve(T),f.current=!1),P&&x.observe(P))},[x]),[w,I]=rc(b),k=ll(t);return q(()=>{!x||!w.current||(x.disconnect(),f.current=!1,x.observe(w.current))},[w,x]),q(()=>(i({type:Ln.RegisterDroppable,element:{id:o,key:a,disabled:n,node:w,rect:p,data:k}}),()=>i({type:Ln.UnregisterDroppable,key:a,id:o})),[o]),q(()=>{n!==c.current.disabled&&(i({type:Ln.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,i]),{active:s,rect:p,isOver:l?.id===o,node:w,over:l,setNodeRef:I}}le();function c0(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function rH(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function Gf(e){return e!==null&&e>=0}function aH(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 sH(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var u0=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=c0(t,o,n),s=t[r],i=a[r];return!i||!s?null:{x:i.left-s.left,y:i.top-s.top,scaleX:i.width/s.width,scaleY:i.height/s.height}};var jf={scaleX:1,scaleY:1},f0=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:s}=e,i=(t=a[n])!=null?t:o;if(!i)return null;if(r===n){let d=a[s];return d?{x:0,y:n<s?d.top+d.height-(i.top+i.height):d.top-i.top,...jf}:null}let l=iH(a,r,n);return r>n&&r<=s?{x:0,y:-i.height-l,...jf}:r<n&&r>=s?{x:0,y:i.height+l,...jf}:{x:0,y:0,...jf}};function iH(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 p0="Sortable",m0=un.createContext({activeIndex:-1,containerId:p0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:u0,disabled:{draggable:!1,droppable:!1}});function g0(e){let{children:t,id:n,items:o,strategy:r=u0,disabled:a=!1}=e,{active:s,dragOverlay:i,droppableRects:l,over:d,measureDroppableContainers:c}=l0(),f=Zs(p0,n),p=i.rect!==null,m=V(()=>o.map(I=>typeof I=="object"&&"id"in I?I.id:I),[o]),g=s!=null,h=s?m.indexOf(s.id):-1,v=d?m.indexOf(d.id):-1,y=N(m),C=!aH(m,y.current),x=v!==-1&&h===-1||C,b=sH(a);qo(()=>{C&&g&&c(m)},[C,m,g,c]),q(()=>{y.current=m},[m]);let w=V(()=>({activeIndex:h,containerId:f,disabled:b,disableTransforms:x,items:m,overIndex:v,useDragOverlay:p,sortedRects:rH(m,l),strategy:r}),[h,f,b.draggable,b.droppable,x,m,v,l,p,r]);return un.createElement(m0.Provider,{value:w},t)}var lH=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return c0(n,o,r).indexOf(t)},dH=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:l,transition:d}=e;return!d||!o||i!==a&&r===s?!1:n?!0:s!==r&&t===l},cH={duration:200,easing:"ease"},h0="transform",uH=ss.Transition.toString({property:h0,duration:0,easing:"linear"}),fH={roleDescription:"sortable"};function pH(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,s]=Q(null),i=N(n);return qo(()=>{if(!t&&n!==i.current&&o.current){let l=r.current;if(l){let d=ai(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)&&s(c)}}n!==i.current&&(i.current=n)},[t,n,o,r]),q(()=>{a&&s(null)},[a]),a}function v0(e){let{animateLayoutChanges:t=dH,attributes:n,disabled:o,data:r,getNewIndex:a=lH,id:s,strategy:i,resizeObserverConfig:l,transition:d=cH}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:C}=Ot(m0),x=mH(o,m),b=c.indexOf(s),w=V(()=>({sortable:{containerId:f,index:b,items:c},...r}),[f,r,b,c]),I=V(()=>c.slice(c.indexOf(s)),[c,s]),{rect:k,node:P,isOver:T,setNodeRef:L}=d0({id:s,data:w,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...l}}),{active:A,activatorEvent:M,activeNodeRect:R,attributes:D,setNodeRef:H,listeners:W,isDragging:F,over:J,setActivatorNodeRef:O,transform:B}=i0({id:s,data:w,attributes:{...fH,...n},disabled:x.draggable}),Y=Iw(L,H),U=!!A,X=U&&!g&&Gf(p)&&Gf(v),re=!y&&F,G=re&&X?B:null,oe=X?G??(i??C)({rects:h,activeNodeRect:R,activeIndex:p,overIndex:v,index:b}):null,Z=Gf(p)&&Gf(v)?a({id:s,items:c,activeIndex:p,overIndex:v}):b,ee=A?.id,fe=N({activeId:ee,items:c,newIndex:Z,containerId:f}),Re=c!==fe.current.items,Be=t({active:A,containerId:f,isDragging:F,isSorting:U,id:s,index:b,items:c,newIndex:fe.current.newIndex,previousItems:fe.current.items,previousContainerId:fe.current.containerId,transition:d,wasDragging:fe.current.activeId!=null}),Se=pH({disabled:!Be,index:b,node:P,rect:k});return q(()=>{U&&fe.current.newIndex!==Z&&(fe.current.newIndex=Z),f!==fe.current.containerId&&(fe.current.containerId=f),c!==fe.current.items&&(fe.current.items=c)},[U,Z,f,c]),q(()=>{if(ee===fe.current.activeId)return;if(ee!=null&&fe.current.activeId==null){fe.current.activeId=ee;return}let ne=setTimeout(()=>{fe.current.activeId=ee},50);return()=>clearTimeout(ne)},[ee]),{active:A,activeIndex:p,attributes:D,data:w,rect:k,index:b,newIndex:Z,items:c,isOver:T,isSorting:U,isDragging:F,listeners:W,node:P,overIndex:v,over:J,setNodeRef:Y,setActivatorNodeRef:O,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:Se??oe,transition:Ee()};function Ee(){if(Se||Re&&fe.current.newIndex===b)return uH;if(!(re&&!ac(M)||!d)&&(U||Be))return ss.Transition.toString({...d,property:h0})}}function mH(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 Qf(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 gH=[wt.Down,wt.Right,wt.Up,wt.Left],y0=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(gH.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 wt.Down:o.top<p.top&&l.push(f);break;case wt.Up:o.top>p.top&&l.push(f);break;case wt.Left:o.left>p.left&&l.push(f);break;case wt.Right:o.left<p.left&&l.push(f);break}});let d=Gw({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=Dh(d,"id");if(c===s?.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,g=p?.node.current;if(g&&m&&f&&p){let v=uc(g).some((I,k)=>i[k]!==I),y=C0(f,p),C=hH(f,p),x=v||!y?{x:0,y:0}:{x:C?o.width-m.width:0,y:C?o.height-m.height:0},b={x:m.left,y:m.top};return x.x&&x.y?b:ti(b,x)}}}};function C0(e,t){return!Qf(e)||!Qf(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function hH(e,t){return!Qf(e)||!Qf(t)||!C0(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function vH(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 x0=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:vH(n,t,r)},b0=e=>{let{transform:t}=e;return{...t,x:0}};le();le();var Xf={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function S0(e){return`(min-width: ${typeof e=="number"?e:Xf[e]}px)`}function I0(e){return`(max-width: ${(typeof e=="number"?e:Xf[e])-1}px)`}function yH(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(S0(e.min)),e.max!=null&&n.push(I0(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 Xf&&t.push(I0(o))}else n in Xf&&t.push(S0(n));return t.length>0?t.join(" and "):e}function CH(){return!1}function Yf(e){let t=yH(e),n=E(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=E(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return So(n,o,CH)}le();var Oh={};bn(Oh,{LexicalComposerContext:()=>w0,createLexicalComposerContext:()=>xH,useLexicalComposerContext:()=>bH});le();var w0=yt(null);function xH(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function bH(){let e=Ot(w0);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 Fh=Oh,T0=Fh.LexicalComposerContext,P0=Fh.createLexicalComposerContext,an=Fh.useLexicalComposerContext;var fy={};bn(fy,{$addUpdateTag:()=>Op,$applyNodeReplacement:()=>Oc,$caretFromPoint:()=>vs,$caretRangeFromSelection:()=>wv,$cloneWithProperties:()=>ay,$cloneWithPropertiesEphemeral:()=>rK,$comparePointCaretNext:()=>dy,$copyNode:()=>oy,$create:()=>sK,$createLineBreakNode:()=>xl,$createNodeSelection:()=>Kv,$createParagraphNode:()=>ma,$createPoint:()=>ur,$createRangeSelection:()=>hP,$createRangeSelectionFromDom:()=>N5,$createTabNode:()=>Rp,$createTextNode:()=>Dn,$extendCaretToRange:()=>iy,$findMatchingParent:()=>vc,$getAdjacentChildCaret:()=>Ll,$getAdjacentNode:()=>OP,$getAdjacentSiblingOrParentSiblingCaret:()=>mK,$getCaretInDirection:()=>ys,$getCaretRange:()=>hs,$getCaretRangeInDirection:()=>uy,$getCharacterOffsets:()=>hv,$getChildCaret:()=>ha,$getChildCaretAtIndex:()=>YP,$getChildCaretOrSelf:()=>WP,$getCollapsedCaretRange:()=>GP,$getCommonAncestor:()=>yc,$getCommonAncestorResultBranchOrder:()=>cy,$getEditor:()=>ry,$getNearestNodeFromDOMNode:()=>Dp,$getNearestRootOrShadowRoot:()=>UP,$getNodeByKey:()=>Rn,$getNodeByKeyOrThrow:()=>zP,$getNodeFromDOMNode:()=>Xv,$getPreviousSelection:()=>hi,$getRoot:()=>ko,$getSelection:()=>Nt,$getSiblingCaret:()=>zn,$getState:()=>dp,$getStateChange:()=>ZH,$getTextContent:()=>O5,$getTextNodeOffset:()=>cr,$getTextPointCaret:()=>gs,$getTextPointCaretSlice:()=>Sv,$getWritableNodeState:()=>Lv,$hasAncestor:()=>wp,$hasUpdateTag:()=>Z5,$insertNodes:()=>D5,$isBlockElementNode:()=>M5,$isChildCaret:()=>dr,$isDecoratorNode:()=>Yt,$isEditorState:()=>z5,$isElementNode:()=>me,$isExtendableTextPointCaret:()=>XP,$isInlineElementOrDecoratorNode:()=>eK,$isLeafNode:()=>X5,$isLineBreakNode:()=>di,$isNodeCaret:()=>dK,$isNodeSelection:()=>Mc,$isParagraphNode:()=>IP,$isRangeSelection:()=>Ge,$isRootNode:()=>Wn,$isRootOrShadowRoot:()=>Go,$isSiblingCaret:()=>gi,$isTabNode:()=>Hv,$isTextNode:()=>Ue,$isTextPointCaret:()=>ga,$isTextPointCaretSlice:()=>pK,$isTokenOrSegmented:()=>ua,$isTokenOrTab:()=>cs,$nodesOfType:()=>J5,$normalizeCaret:()=>ir,$normalizeSelection__EXPERIMENTAL:()=>cp,$onUpdate:()=>BP,$parseSerializedNode:()=>U5,$removeTextFromCaretRange:()=>QP,$rewindSiblingCaret:()=>Ml,$selectAll:()=>Y5,$setCompositionKey:()=>Fn,$setPointFromCaret:()=>Al,$setSelection:()=>Co,$setSelectionFromCaretRange:()=>jP,$setState:()=>e5,$splitAtPointCaretNext:()=>vK,$splitNode:()=>tK,$updateRangeSelectionFromCaretRange:()=>Cc,ArtificialNode__DO_NOT_USE:()=>Sp,BEFORE_INPUT_COMMAND:()=>Rv,BLUR_COMMAND:()=>QT,CAN_REDO_COMMAND:()=>f5,CAN_UNDO_COMMAND:()=>p5,CLEAR_EDITOR_COMMAND:()=>c5,CLEAR_HISTORY_COMMAND:()=>u5,CLICK_COMMAND:()=>MT,COLLABORATION_TAG:()=>sP,COMMAND_PRIORITY_CRITICAL:()=>V5,COMMAND_PRIORITY_EDITOR:()=>ml,COMMAND_PRIORITY_HIGH:()=>q5,COMMAND_PRIORITY_LOW:()=>K5,COMMAND_PRIORITY_NORMAL:()=>$5,COMPOSITION_END_COMMAND:()=>Nv,COMPOSITION_END_TAG:()=>cP,COMPOSITION_START_COMMAND:()=>Mv,COMPOSITION_START_TAG:()=>dP,CONTROLLED_TEXT_INSERTION_COMMAND:()=>hl,COPY_COMMAND:()=>Bv,CUT_COMMAND:()=>Uv,DELETE_CHARACTER_COMMAND:()=>Ic,DELETE_LINE_COMMAND:()=>Tc,DELETE_WORD_COMMAND:()=>wc,DRAGEND_COMMAND:()=>GT,DRAGOVER_COMMAND:()=>WT,DRAGSTART_COMMAND:()=>VT,DROP_COMMAND:()=>qT,DecoratorNode:()=>kc,ElementNode:()=>ps,FOCUS_COMMAND:()=>jT,FORMAT_ELEMENT_COMMAND:()=>d5,FORMAT_TEXT_COMMAND:()=>ls,HISTORIC_TAG:()=>b5,HISTORY_MERGE_TAG:()=>sp,HISTORY_PUSH_TAG:()=>S5,INDENT_CONTENT_COMMAND:()=>i5,INPUT_COMMAND:()=>Ev,INSERT_LINE_BREAK_COMMAND:()=>mc,INSERT_PARAGRAPH_COMMAND:()=>sv,INSERT_TAB_COMMAND:()=>s5,INTERNAL_$isBlock:()=>pa,IS_ALL_FORMATTING:()=>_H,IS_BOLD:()=>kH,IS_CODE:()=>EH,IS_HIGHLIGHT:()=>Tv,IS_ITALIC:()=>LH,IS_STRIKETHROUGH:()=>AH,IS_SUBSCRIPT:()=>MH,IS_SUPERSCRIPT:()=>NH,IS_UNDERLINE:()=>RH,KEY_ARROW_DOWN_COMMAND:()=>BT,KEY_ARROW_LEFT_COMMAND:()=>DT,KEY_ARROW_RIGHT_COMMAND:()=>NT,KEY_ARROW_UP_COMMAND:()=>FT,KEY_BACKSPACE_COMMAND:()=>zT,KEY_DELETE_COMMAND:()=>KT,KEY_DOWN_COMMAND:()=>Fv,KEY_ENTER_COMMAND:()=>gp,KEY_ESCAPE_COMMAND:()=>HT,KEY_MODIFIER_COMMAND:()=>XT,KEY_SPACE_COMMAND:()=>UT,KEY_TAB_COMMAND:()=>$T,LineBreakNode:()=>Cl,MOVE_TO_END:()=>_T,MOVE_TO_START:()=>OT,NODE_STATE_KEY:()=>GH,OUTDENT_CONTENT_COMMAND:()=>l5,PASTE_COMMAND:()=>_v,PASTE_TAG:()=>I5,ParagraphNode:()=>Il,REDO_COMMAND:()=>Ov,REMOVE_TEXT_COMMAND:()=>iv,RootNode:()=>Sl,SELECTION_CHANGE_COMMAND:()=>Av,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>a5,SELECT_ALL_COMMAND:()=>lv,SKIP_COLLAB_TAG:()=>w5,SKIP_DOM_SELECTION_TAG:()=>lP,SKIP_SCROLL_INTO_VIEW_TAG:()=>iP,SKIP_SELECTION_FOCUS_TAG:()=>mv,TEXT_TYPE_TO_FORMAT:()=>Yn,TabNode:()=>bl,TextNode:()=>fi,UNDO_COMMAND:()=>Dv,addClassNamesToElement:()=>IK,buildImportMap:()=>x5,configExtension:()=>CK,createCommand:()=>et,createEditor:()=>W5,createSharedNodeState:()=>PT,createState:()=>JH,declarePeerDependency:()=>xK,defineExtension:()=>yK,flipDirection:()=>Cs,getDOMOwnerDocument:()=>ty,getDOMSelection:()=>pr,getDOMSelectionFromTarget:()=>HP,getDOMTextNode:()=>mi,getEditorPropertyFromDOMNode:()=>_c,getNearestEditorFromDOMNode:()=>Qv,getRegisteredNode:()=>Gv,getRegisteredNodeOrThrow:()=>Wv,getStaticNodeConfig:()=>Fc,getTextDirection:()=>Q5,getTransformSetFromKlass:()=>TP,isBlockDomNode:()=>xv,isCurrentlyReadOnlyMode:()=>Rl,isDOMDocumentNode:()=>LP,isDOMNode:()=>El,isDOMTextNode:()=>Or,isDOMUnmanaged:()=>VP,isDocumentFragment:()=>KP,isExactShortcutMatch:()=>Ut,isHTMLAnchorElement:()=>nK,isHTMLElement:()=>so,isInlineDomNode:()=>$P,isLexicalEditor:()=>Np,isModifierMatch:()=>DP,isSelectionCapturedInDecoratorInput:()=>jv,isSelectionWithinEditor:()=>Nc,makeStepwiseIterator:()=>ly,mergeRegister:()=>TK,normalizeClassNames:()=>Bc,removeClassNamesFromElement:()=>wK,removeFromParent:()=>us,resetRandomKey:()=>G5,safeCast:()=>bK,setDOMUnmanaged:()=>aK,setNodeIndentFromDOM:()=>qP,shallowMergeConfig:()=>SK,toggleTextFormatType:()=>Ac});function ve(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 yT(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 fr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,SH=fr&&"documentMode"in document?document.documentMode:null,sr=fr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),fs=fr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),lp=!(!fr||!("InputEvent"in window)||SH)&&"getTargetRanges"in new window.InputEvent("input"),Pp=fr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ec=fr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,IH=fr&&/Android/.test(navigator.userAgent),CT=fr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jh=fr&&IH&&CT,kp=fr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&sr&&!CT,wH=0,TH=1,PH=2,kH=1,LH=2,AH=4,RH=8,EH=16,MH=32,NH=64,Tv=128,_H=2047,DH=1,OH=2,FH=3,BH=4,UH=5,zH=6,xc=Pp||Ec||kp?"\xA0":"\u200B",Lp=`
3822
3773
 
3823
- `,Lv=ds?"\xA0":bc,IT="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",wT="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",GH=new RegExp("^[^"+wT+"]*["+IT+"]"),jH=new RegExp("^[^"+IT+"]*["+wT+"]"),Xn={bold:1,capitalize:1024,code:16,highlight:kv,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},QH={directionless:1,unmergeable:2},Yh={center:2,end:6,justify:4,left:1,right:3,start:5},XH={[KH]:"center",[WH]:"end",[qH]:"justify",[HH]:"left",[$H]:"right",[VH]:"start"},YH={normal:0,segmented:2,token:1},JH={[RH]:"normal",[MH]:"segmented",[EH]:"token"},ZH="$",R0="$config";function TT(e,t,n,o,r,a){let s=e.getFirstChild();for(;s!==null;){let i=s.__key;s.__parent===t&&(me(s)&&TT(s,i,n,o,r,a),n.has(i)||a.delete(i),r.push(i)),s=s.getNextSibling()}}var Jh=!1,Av=0;function e5(e){Av=e.timeStamp}function zh(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&Dp(e,n)!==void 0}function t5(e,t,n){let o=gr(ko(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let s=e.nodeValue;s!==null&&ty(t,s,r,a,!1)}function n5(e,t,n){if(Ge(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return Ur(t)&&n.isAttached()}function o5(e,t,n,o){for(let r=e;r&&!jP(r);r=Oc(r)){let a=Dp(r,t);if(a!==void 0){let s=Rn(a,n);if(s)return Xt(s)||!io(r)?void 0:[r,s]}else if(r===o)return[o,_P(n)]}}function PT(e,t,n){Jh=!0;let o=performance.now()-Av>100;try{Br(e,()=>{let r=_t()||(function(p){return p.getEditorState().read(()=>{let m=_t();return m!==null?m.clone():null})})(e),a=new Map,s=e.getRootElement(),i=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],g=m.type,h=m.target,v=o5(h,e,i,s);if(!v)continue;let[y,C]=v;if(g==="characterData")o&&Ue(C)&&Ur(h)&&n5(r,h,C)&&t5(h,C,e);else if(g==="childList"){d=!0;let x=m.addedNodes;for(let I=0;I<x.length;I++){let k=x[I],P=Jv(k),w=k.parentNode;if(w!=null&&k!==l&&P===null&&!zh(k,w,e)){if(ds){let L=(io(k)?k.innerText:null)||k.nodeValue;L&&(c+=L)}w.removeChild(k)}}let b=m.removedNodes,T=b.length;if(T>0){let I=0;for(let k=0;k<T;k++){let P=b[k];(zh(P,h,e)||l===P)&&(h.appendChild(P),I++)}T!==I&&a.set(y,C)}}}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],g=m.addedNodes,h=m.target;for(let v=0;v<g.length;v++){let y=g[v],C=y.parentNode;C==null||y.nodeName!=="BR"||zh(y,h,e)||C.removeChild(y)}}n.takeRecords()}r!==null&&(d&&yo(r),ds&&zP(e)&&r.insertRawText(c))})}finally{Jh=!1}}function kT(e){let t=e._observer;t!==null&&PT(e,t.takeRecords(),t)}function LT(e){(function(t){Av===0&&ko(t).addEventListener("textInput",e5,!0)})(e),e._observer=new MutationObserver((t,n)=>{PT(e,t,n)})}var Zh=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||i5).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function r5(e,t){return new Zh(e,t)}function cp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function a5(e,t,n){let o=cp(e,n,"direct"),r=cp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function s5(e,t,n){let o;if(Dn(),typeof n=="function"){let a=e.getLatest(),s=cp(a,t);if(o=n(s),t.isEqual(s,o))return a}else o=n;let r=e.getWritable();return Rv(r).updateFromKnown(t,o),r}function AT(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}=Bc(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let s;"stateConfig"in a?(s=a.stateConfig,a.flat&&n.add(s.key)):s=a,t.set(s.key,s)}}return{flatKeys:n,sharedConfigMap:t}}var ev=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:s}=this.sharedNodeState,i=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})(s,o,r);this.size=i}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 E0(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,s,i){let l;if(i)for(let[d,c]of Object.entries(i)){let f=a.get(d);f?s.has(f)||s.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=E0(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 Rv(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new ev(t,RT(t));return t.__state=n,n}function RT(e){return e.__state?e.__state.sharedNodeState:jv(sy(),e.getType()).sharedNodeState}function E0(e){if(e)for(let t in e)return e}function i5(e){return e}function M0(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 N0(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,s]of Object.entries(o))if(!e.has(a)&&(e.add(a),s!==(r?r[a]:void 0)))return!0}return!1}function _0(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function D0(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,s=t.__format,i=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===s)&&(r===null||r===i)&&(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&&M0(p,c,f)||f&&M0(p,f,c)||c&&N0(p,c,f)||f&&N0(p,f,c))})(l,d))}function O0(e,t){let n=e.mergeWithSibling(t),o=jt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function F0(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Ue(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(D0(t,o)){o=O0(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Ue(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(D0(o,n)){o=O0(o,n);break}break}n.remove()}}else o.remove()}function up(e){return B0(e.anchor),B0(e.focus),e}function B0(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),Ue(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!me(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var mi,qn,Sc,Rp,tv,nv,gi,cr,ov,Ic,An="",Fr=null,ui=null,ml=!1,fp=!1;function pp(e,t){let n=gi.get(e);if(t!==null){let o=iv(e);o.parentNode===t&&t.removeChild(o)}if(cr.has(e)||qn._keyToDOMMap.delete(e),me(n)){let o=gp(n,gi);rv(o,0,o.length-1,null)}n!==void 0&&ny(Ic,Sc,Rp,n,"destroyed")}function rv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&pp(a,o)}}function ci(e,t){e.setProperty("text-align",t)}var l5="40px";function ET(e,t){let n=mi.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(qn._rootElement||e).getPropertyValue("--lexical-indent-base-value")||l5;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function MT(e,t){let n=e.style;t===0?ci(n,""):t===1?ci(n,"left"):t===2?ci(n,"center"):t===3?ci(n,"right"):t===4?ci(n,"justify"):t===5?ci(n,"start"):t===6&&ci(n,"end")}function av(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if($n(o))return null;let a=o.getParentOrThrow();return $n(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function mp(e,t){let n=cr.get(e);n===void 0&&ve(60);let o=n.createDOM(mi,qn);if((function(r,a,s){let i=s._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,s,r),i.set(r,a)})(e,o,qn),Ue(n)?o.setAttribute("data-lexical-text","true"):Xt(n)&&o.setAttribute("data-lexical-decorator","true"),me(n)){let r=n.__indent,a=n.__size;if(av(o,n),r!==0&&ET(o,r),a!==0){let i=a-1;sv(gp(n,cr),n,0,i,n.getDOMSlot(o))}let s=n.__format;s!==0&&MT(o,s),n.isInline()||NT(null,n,o)}else{let r=n.getTextContent();if(Xt(n)){let a=n.decorate(qn,mi);a!==null&&_T(e,a),o.contentEditable="false"}An+=r}return t!==null&&t.insertChild(o),ny(Ic,Sc,Rp,n,"created"),o}function sv(e,t,n,o,r){let a=An;An="";let s=n;for(;s<=o;++s){mp(e[s],r);let i=cr.get(e[s]);i!==null&&Ue(i)?Fr===null&&(Fr=i.getFormat(),ui=i.getStyle()):me(i)&&s<o&&!i.isInline()&&(An+=Ap)}r.element.__lexicalTextContent=An,An=a+An}function U0(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return pi(o)?"line-break":Xt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function NT(e,t,n){let o=U0(e,gi),r=U0(t,cr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function d5(e,t,n){var o;Fr=null,ui=null,(function(r,a,s){let i=An,l=r.__size,d=a.__size;An="";let c=s.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)op(f,c);else{let g=iv(f),h=mp(p,null);try{c.replaceChild(h,g)}catch(v){if(typeof v=="object"&&v!=null){let y=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${f}}.`;throw new Error(y)}throw v}pp(f,null)}let m=cr.get(p);Ue(m)&&Fr===null&&(Fr=m.getFormat(),ui=m.getStyle())}else{let f=gp(r,gi),p=gp(a,cr);if(f.length!==l&&ve(227),p.length!==d&&ve(228),l===0)d!==0&&sv(p,0,0,d-1,s);else if(d===0){if(l!==0){let m=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;rv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,g,h,v,y,C){let x=v-1,b=y-1,T,I,k=C.getFirstChild(),P=0,w=0;for(;P<=x&&w<=b;){let M=g[P],R=h[w];if(M===R)k=Hh(op(R,C.element)),P++,w++;else{if(I===void 0&&(I=z0(h,w)),T===void 0)T=z0(g,P);else if(!T.has(M)){P++;continue}if(!I.has(M)){k=Hh(iv(M)),pp(M,C.element),P++,T.delete(M);continue}if(T.has(R)){let H=Pl(qn,R);H!==k&&C.withBefore(k).insertChild(H),k=Hh(op(R,C.element)),P++,w++}else mp(R,C.withBefore(k)),w++}let D=cr.get(R);D!==null&&Ue(D)?Fr===null&&(Fr=D.getFormat(),ui=D.getStyle()):me(D)&&w<=b&&!D.isInline()&&(An+=Ap)}let L=P>x,A=w>b;if(L&&!A){let M=h[b+1],R=M===void 0?null:qn.getElementByKey(M);sv(h,0,w,b,C.withBefore(R))}else A&&!L&&rv(g,P,x,C.element)})(0,f,p,l,d,s)}c.__lexicalTextContent=An,An=i+An})(e,t,t.getDOMSlot(n)),o=t,Fr==null||Fr===o.__textFormat||fp||o.setTextFormat(Fr),(function(r){ui==null||ui===r.__textStyle||fp||r.setTextStyle(ui)})(t)}function gp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&ve(101),n.push(o),o=r.__next}return n}function op(e,t){let n=gi.get(e),o=cr.get(e);n!==void 0&&o!==void 0||ve(61);let r=ml||nv.has(e)||tv.has(e),a=Pl(qn,e);if(n===o&&!r){let s;if(me(n)){let i=a.__lexicalTextContent;typeof i=="string"?s=i:(s=n.getTextContent(),a.__lexicalTextContent=s)}else s=n.getTextContent();return An+=s,a}if(n!==o&&r&&ny(Ic,Sc,Rp,o,"updated"),o.updateDOM(n,a,mi)){let s=mp(e,null);return t===null&&ve(62),t.replaceChild(s,a),pp(e,null),s}if(me(n)){me(o)||ve(334,e);let s=o.__indent;(ml||s!==n.__indent)&&ET(a,s);let i=o.__format;if((ml||i!==n.__format)&&MT(a,i),r)d5(n,o,a),$n(o)||o.isInline()||NT(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),An+=d}if((ml||o.__dir!==n.__dir)&&(av(a,o),$n(o)&&!ml))for(let l of o.getChildren())me(l)&&av(Pl(qn,l.getKey()),l)}else{let s=o.getTextContent();if(Xt(o)){let i=o.decorate(qn,mi);i!==null&&_T(e,i)}An+=s}if(!fp&&$n(o)&&o.__cachedText!==An){let s=o.getWritable();s.__cachedText=An,o=s}return a}function _T(e,t){let n=qn._pendingDecorators,o=qn._decorators;if(n===null){if(o[e]===t)return;n=NP(qn)}n[e]=t}function Hh(e){let t=e.nextSibling;return t!==null&&t===qn._blockCursorElement&&(t=t.nextSibling),t}function z0(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function c5(e,t,n,o,r,a){An="",ml=o===2,qn=n,mi=n._config,Sc=n._nodes,Rp=qn._listeners.mutation,tv=r,nv=a,gi=e._nodeMap,cr=t._nodeMap,fp=t._readOnly,ov=new Map(n._keyToDOMMap);let s=new Map;return Ic=s,op("root",null),qn=void 0,Sc=void 0,tv=void 0,nv=void 0,gi=void 0,cr=void 0,mi=void 0,ov=void 0,Ic=void 0,s}function iv(e){let t=ov.get(e);return t===void 0&&ve(75,e),t}function et(e){return{type:e}}var Ev=et("SELECTION_CHANGE_COMMAND"),u5=et("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),DT=et("CLICK_COMMAND"),Mv=et("BEFORE_INPUT_COMMAND"),Nv=et("INPUT_COMMAND"),_v=et("COMPOSITION_START_COMMAND"),Dv=et("COMPOSITION_END_COMMAND"),wc=et("DELETE_CHARACTER_COMMAND"),gc=et("INSERT_LINE_BREAK_COMMAND"),lv=et("INSERT_PARAGRAPH_COMMAND"),yl=et("CONTROLLED_TEXT_INSERTION_COMMAND"),Ov=et("PASTE_COMMAND"),dv=et("REMOVE_TEXT_COMMAND"),Tc=et("DELETE_WORD_COMMAND"),Pc=et("DELETE_LINE_COMMAND"),as=et("FORMAT_TEXT_COMMAND"),Fv=et("UNDO_COMMAND"),Bv=et("REDO_COMMAND"),Uv=et("KEYDOWN_COMMAND"),OT=et("KEY_ARROW_RIGHT_COMMAND"),FT=et("MOVE_TO_END"),BT=et("KEY_ARROW_LEFT_COMMAND"),UT=et("MOVE_TO_START"),zT=et("KEY_ARROW_UP_COMMAND"),HT=et("KEY_ARROW_DOWN_COMMAND"),hp=et("KEY_ENTER_COMMAND"),KT=et("KEY_SPACE_COMMAND"),$T=et("KEY_BACKSPACE_COMMAND"),qT=et("KEY_ESCAPE_COMMAND"),VT=et("KEY_DELETE_COMMAND"),WT=et("KEY_TAB_COMMAND"),f5=et("INSERT_TAB_COMMAND"),p5=et("INDENT_CONTENT_COMMAND"),m5=et("OUTDENT_CONTENT_COMMAND"),GT=et("DROP_COMMAND"),g5=et("FORMAT_ELEMENT_COMMAND"),jT=et("DRAGSTART_COMMAND"),QT=et("DRAGOVER_COMMAND"),XT=et("DRAGEND_COMMAND"),zv=et("COPY_COMMAND"),Hv=et("CUT_COMMAND"),cv=et("SELECT_ALL_COMMAND"),h5=et("CLEAR_EDITOR_COMMAND"),v5=et("CLEAR_HISTORY_COMMAND"),y5=et("CAN_REDO_COMMAND"),C5=et("CAN_UNDO_COMMAND"),YT=et("FOCUS_COMMAND"),JT=et("BLUR_COMMAND"),ZT=et("KEY_MODIFIER_COMMAND"),la=Object.freeze({}),uv=[["keydown",function(e,t){kc=e.timeStamp,eP=e.key,!t.isComposing()&&Re(t,Uv,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;Nl(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&Br(t,()=>{RP(n)||(mv=!0)})}],["compositionstart",function(e,t){Re(t,_v,e)}],["compositionend",function(e,t){ds?mc=!0:Mc||!kp&&!Lp?Re(t,Dv,e):(rp=!0,ap=e.data)}],["input",function(e,t){e.stopPropagation(),Br(t,()=>{t.dispatchCommand(Nv,e)},{event:e}),gl=null}],["click",function(e,t){Br(t,()=>{let n=_t(),o=gr(ko(t)),r=xi();if(o){if(Ge(n)){let a=n.anchor,s=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!$n(s)&&Po().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&s!==n.focus.getNode()){let i=yc(s,l=>me(l)&&!l.isInline());me(i)&&i.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(io(a)||Ur(a))&&yo(Mp(r,o,t,e))}}Re(t,DT,e)})}],["cut",la],["copy",la],["dragstart",la],["dragover",la],["dragend",la],["paste",la],["focus",la],["blur",la],["drop",la]];dp&&uv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||ds&&zP(o)||r!=="insertCompositionText"&&Re(o,Mv,n)})(e,t)]);var kc=0,eP=null,tP=0,gl=null,fv=new WeakMap,vp=new WeakMap,pv=!1,mv=!1,hc=!1,mc=!1,rp=!1,ap="",fi=null,nP=[0,"",0,"root",0];function oP(e,t,n,o,r){let a=e.anchor,s=e.focus,i=a.getNode(),l=jt(),d=gr(ko(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!Ue(i)||(!r&&(!dp||tP<o+50)||i.isDirty()&&m<2||DP(n))&&a.offset!==s.offset&&!i.isComposing()||ua(i)||i.isDirty()&&m>1||(r||!dp)&&p!==null&&!i.isComposing()&&c!==yi(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!i.isComposing()&&(i.getFormat()!==e.format||i.getStyle()!==e.style)||(function(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let v=g.anchor.offset,y=h.getParentOrThrow(),C=is(h);return v===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||C||(function(x){let b=x.getPreviousSibling();return(Ue(b)||me(b)&&b.isInline())&&!b.canInsertTextAfter()})(h):v===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||C)})(e,i)}function H0(e,t){return Ur(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function K0(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:s}=e;pv&&(pv=!1,H0(o,r)&&H0(a,s)&&!fi)||Br(t,()=>{if(!n)return void yo(null);if(!_c(t,o,a))return;let i=_t();if(fi&&Ge(i)&&i.isCollapsed()){let l=i.anchor,d=fi.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(i=fi.clone(),yo(i))}if(fi=null,Ge(i)){let l=i.anchor,d=l.getNode();if(i.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(i.dirty=!0);let c=ko(t).event,f=c?c.timeStamp:performance.now(),[p,m,g,h,v]=nP,y=Po(),C=t.isComposing()===!1&&y.getTextContent()==="";if(f<v+200&&l.offset===g&&l.key===h)sp(i,p,m);else if(l.type==="text")Ue(d)||ve(141),rP(i,d);else if(l.type==="element"&&!C){me(d)||ve(259);let x=l.getNode();x.isEmpty()?(function(b,T){let I=T.getTextFormat(),k=T.getTextStyle();sp(b,I,k)})(i,x):sp(i,0,"")}}else{let c=l.key,f=i.focus.key,p=i.getNodes(),m=p.length,g=i.isBackward(),h=g?s:r,v=g?r:s,y=g?f:c,C=g?c:f,x=2047,b=!1;for(let T=0;T<m;T++){let I=p[T],k=I.getTextContentSize();if(Ue(I)&&k!==0&&!(T===0&&I.__key===y&&h===k||T===m-1&&I.__key===C&&v===0)&&(b=!0,x&=I.getFormat(),x===0))break}i.format=b?x:0}}Re(t,Ev,void 0)})}function sp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function rP(e,t){sp(e,t.getFormat(),t.getStyle())}function aP(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function x5(e){let t=e.inputType,n=aP(e),o=jt(),r=_t();if(t==="deleteContentBackward"){if(r===null){let f=xi();if(!Ge(f))return!0;yo(f.clone())}if(Ge(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,eP==="MediaLast"&&a<kc+30&&o.isComposing()&&f){if(On(null),kc=0,setTimeout(()=>{Br(o,()=>{On(null)})},30),Ge(r)){let p=r.anchor.getNode();p.markDirty(),Ue(p)||ve(142),rP(r,p)}}else{On(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===m.length,v=Xh&&f&&!h&&g;if(v&&r.isCollapsed()&&(v=!Xt(UP(r.anchor,!0))),!v){Re(o,wc,!0);let y=_t();Xh&&Ge(y)&&y.isCollapsed()&&(fi=y,setTimeout(()=>fi=null))}}return!0}}var a;if(!Ge(r))return!0;let s=e.data;gl!==null&&ey(!1,o,gl),r.dirty&&gl===null||!r.isCollapsed()||$n(r.anchor.getNode())||n===null||r.applyDOMRange(n),gl=null;let i=r.anchor,l=r.focus,d=i.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
3824
- `)e.preventDefault(),Re(o,gc,!1);else if(s===Ap)e.preventDefault(),Re(o,lv,void 0);else if(s==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else s!=null&&oP(r,n,s,e.timeStamp,!0)?(e.preventDefault(),Re(o,yl,s)):gl=s;return tP=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Re(o,yl,e);break;case"insertFromComposition":On(null),Re(o,yl,e);break;case"insertLineBreak":On(null),Re(o,gc,!1);break;case"insertParagraph":On(null),hc&&!Mc?(hc=!1,Re(o,gc,!1)):Re(o,lv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Re(o,Ov,e);break;case"deleteByComposition":(function(f,p){return f!==p||me(f)||me(p)||!is(f)||!is(p)})(d,c)&&Re(o,dv,e);break;case"deleteByDrag":case"deleteByCut":Re(o,dv,e);break;case"deleteContent":Re(o,wc,!1);break;case"deleteWordBackward":Re(o,Tc,!0);break;case"deleteWordForward":Re(o,Tc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Re(o,Pc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Re(o,Pc,!1);break;case"formatStrikeThrough":Re(o,as,"strikethrough");break;case"formatBold":Re(o,as,"bold");break;case"formatItalic":Re(o,as,"italic");break;case"formatUnderline":Re(o,as,"underline");break;case"historyUndo":Re(o,Fv,void 0);break;case"historyRedo":Re(o,Bv,void 0)}return!0}function b5(e){if(io(e.target)&&RP(e.target))return!0;let t=jt(),n=_t(),o=e.data,r=aP(e);if(o!=null&&Ge(n)&&oP(n,r,o,e.timeStamp,!1)){mc&&(yp(t,o),mc=!1);let a=n.anchor.getNode(),s=gr(ko(t));if(s===null)return!0;let i=n.isBackward(),l=i?n.anchor.offset:n.focus.offset,d=i?n.focus.offset:n.anchor.offset;dp&&!n.isCollapsed()&&Ue(a)&&s.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===FP(s.anchorNode)||Re(t,yl,o);let c=o.length;ds&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Xh&&t.isComposing()&&(kc=0,On(null))}else ey(!1,t,o!==null?o:void 0),mc&&(yp(t,o||void 0),mc=!1);return(function(){Dn();let a=jt();kT(a)})(),!0}function S5(e){let t=jt(),n=_t();if(Ge(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();On(o.key),Fp(fP),(e.timeStamp<kc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Ue(r)&&r.getStyle()!==n.style)&&Re(t,yl,Lv)}return!0}function I5(e){return yp(jt(),e.data),Fp(pP),!0}function yp(e,t){let n=e._compositionKey;if(On(null),n!==null&&t!=null){if(t===""){let o=Rn(n),r=yi(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Ue(o)){let a=gr(ko(e)),s=null,i=null;a!==null&&a.anchorNode===r&&(s=a.anchorOffset,i=a.focusOffset),ty(o,r.nodeValue,s,i,!0)}return}if(t[t.length-1]===`
3825
- `){let o=_t();if(Ge(o)||Nc(o)){if(Ge(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Re(e,hp,null)}}}ey(!0,e,t)}function w5(e){let t=jt();if(e.key==null)return!0;if(rp){if(gT(e))return Br(t,()=>{yp(t,ap)}),rp=!1,ap="",!0;rp=!1,ap=""}if((function(n){return Ht(n,"ArrowRight",{shiftKey:"any"})})(e))Re(t,OT,e);else if((function(n){return Ht(n,"ArrowRight",ca)})(e))Re(t,FT,e);else if((function(n){return Ht(n,"ArrowLeft",{shiftKey:"any"})})(e))Re(t,BT,e);else if((function(n){return Ht(n,"ArrowLeft",ca)})(e))Re(t,UT,e);else if((function(n){return Ht(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Re(t,zT,e);else if((function(n){return Ht(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Re(t,HT,e);else if((function(n){return Ht(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))hc=!0,Re(t,hp,e);else if((function(n){return n.key===" "})(e))Re(t,KT,e);else if((function(n){return lr&&Ht(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),hc=!0,Re(t,gc,!0);else if((function(n){return Ht(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))hc=!1,Re(t,hp,e);else if((function(n){return Ht(n,"Backspace",{shiftKey:"any"})||lr&&Ht(n,"h",{ctrlKey:!0})})(e))gT(e)?Re(t,$T,e):(e.preventDefault(),Re(t,wc,!0));else if((function(n){return n.key==="Escape"})(e))Re(t,qT,e);else if((function(n){return Ht(n,"Delete",{})||lr&&Ht(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Re(t,VT,e):(e.preventDefault(),Re(t,wc,!1));else if((function(n){return Ht(n,"Backspace",mT)})(e))e.preventDefault(),Re(t,Tc,!0);else if((function(n){return Ht(n,"Delete",mT)})(e))e.preventDefault(),Re(t,Tc,!1);else if((function(n){return lr&&Ht(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Re(t,Pc,!0);else if((function(n){return lr&&(Ht(n,"Delete",{metaKey:!0})||Ht(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Re(t,Pc,!1);else if((function(n){return Ht(n,"b",ca)})(e))e.preventDefault(),Re(t,as,"bold");else if((function(n){return Ht(n,"u",ca)})(e))e.preventDefault(),Re(t,as,"underline");else if((function(n){return Ht(n,"i",ca)})(e))e.preventDefault(),Re(t,as,"italic");else if((function(n){return Ht(n,"Tab",{shiftKey:"any"})})(e))Re(t,WT,e);else if((function(n){return Ht(n,"z",ca)})(e))e.preventDefault(),Re(t,Fv,void 0);else if((function(n){return lr?Ht(n,"z",{metaKey:!0,shiftKey:!0}):Ht(n,"y",{ctrlKey:!0})||Ht(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Re(t,Bv,void 0);else{let n=t._editorState._selection;n===null||Ge(n)?hT(e)&&(e.preventDefault(),Re(t,cv,e)):(function(o){return Ht(o,"c",ca)})(e)?(e.preventDefault(),Re(t,zv,e)):(function(o){return Ht(o,"x",ca)})(e)?(e.preventDefault(),Re(t,Hv,e)):hT(e)&&(e.preventDefault(),Re(t,cv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(ZT,e),!0}function sP(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Cl=new Map;function iP(e){let t=qP(e.target);if(t===null)return;let n=Yv(t.anchorNode);if(n===null)return;mv&&(mv=!1,Br(n,()=>{let l=xi(),d=t.anchorNode;(io(d)||Ur(d))&&yo(Mp(l,t,n,e))}));let o=Zv(n),r=o[o.length-1],a=r._key,s=Cl.get(a),i=s||r;i!==n&&K0(t,i,!1),K0(t,n,!0),n!==r?Cl.set(a,n):s&&Cl.delete(a)}function $0(e){e._lexicalHandled=!0}function q0(e){return e._lexicalHandled===!0}var V0=()=>{};function T5(e){let t=fv.get(e);if(t===void 0)return void V0();let n=vp.get(t);if(n===void 0)return void V0();let o=n-1;o>=0||ve(164),fv.delete(e),vp.set(t,o),o===0&&t.removeEventListener("selectionchange",iP);let r=Dc(e);_p(r)?((function(s){if(s._parentEditor!==null){let i=Zv(s),l=i[i.length-1]._key;Cl.get(l)===s&&Cl.delete(l)}else Cl.delete(s._key)})(r),e.__lexicalEditor=null):r&&ve(198);let a=sP(e);for(let s=0;s<a.length;s++)a[s]();e.__lexicalEventHandles=[]}function gv(e,t,n){Dn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(i){let l=_t();if(!Ge(l)||!me(i))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return Tp(f,i)&&d.set(i.__key,0,"element"),Tp(p,i)&&c.set(i.__key,0,"element"),l})(e),s=!1;if(Ge(a)&&t){let i=a.anchor,l=a.focus;i.key===o&&(Sp(i,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0),l.key===o&&(Sp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else Nc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ge(a)&&t&&!s){let i=e.getIndexWithinParent();ls(e),bp(a,r,i,-1)}else ls(e);n||Vo(r)||r.canBeEmpty()||!r.isEmpty()||gv(r,t),t&&a&&$n(r)&&r.isEmpty()&&r.selectEnd()}function P5(e){return e}var lP=Symbol.for("ephemeral");function Cp(e){return e[lP]||!1}var qo=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Bc(this);return t===void 0&&ve(64,this.name),t}static clone(t){ve(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}),MP(this,t)}getType(){return this.__type}isInline(){ve(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Rn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||_t();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Ue(this))return o;if(Ge(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Xt(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:Rn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&ve(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(Vo(n))return me(t)||t===this&&Xt(t)||ve(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&ve(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:Rn(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:Rn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=me(this)?this:this.getParent(),o=me(t)?t:t.getParent(),r=n&&o?Cc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Cc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?fy(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&ve(279),!1)))}isParentOf(t){let n=Cc(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 s=a.__key;if(r.has(s)||(r.add(s),o.push(a)),a===t)break;let i=me(a)?n?a.getFirstChild():a.getLastChild():null;if(i!==null){a=i;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&&ve(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=jt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Cp(this))return this;let t=Rn(this.__key);return t===null&&ve(113),t}getWritable(){if(Cp(this))return this;Dn();let t=va(),n=jt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),s=n._cloneNotNeeded,i=_t();if(i!==null&&i.setCachedNodes(null),s.has(r))return wp(a),a;let l=iy(a);return s.add(r),wp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){ve(70)}updateDOM(t,n,o){ve(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){ve(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,s=a;for(let i of RT(r).flatKeys)i in o&&(s!==void 0&&s!==a||(s={...a}),s[i]=o[i]);return(r.__state||s)&&Rv(n).updateFromJSON(s),r})(this,t)}static transform(){return null}remove(t){gv(this,!0,t)}replace(t,n){Dn();let o=_t();o!==null&&(o=o.clone()),Gh(this,t);let r=this.getLatest(),a=this.__key,s=t.__key,i=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;ls(i);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,g=r.__parent;if(gv(r,!1,!0),c===null?l.__first=s:c.getWritable().__next=s,i.__prev=p,f===null?l.__last=s:f.getWritable().__prev=s,i.__next=m,i.__parent=g,l.__size=d,n&&(me(this)&&me(i)||ve(139),this.getChildren().forEach(h=>{i.append(h)})),Ge(o)){yo(o);let h=o.anchor,v=o.focus;h.key===a&&Q0(h,i),v.key===a&&Q0(v,i)}return ss()===a&&On(s),i}insertAfter(t,n=!0){Dn(),Gh(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),s=_t(),i=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(ls(r),Ge(s)){let g=a.__key,h=s.anchor,v=s.focus;i=h.type==="element"&&h.key===g&&h.offset===m+1,l=v.type==="element"&&v.key===g&&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&&Ge(s)){let m=this.getIndexWithinParent();bp(s,c,m+1);let g=c.__key;i&&s.anchor.set(g,m+2,"element"),l&&s.focus.set(g,m+2,"element")}return t}insertBefore(t,n=!0){Dn(),Gh(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;ls(r);let s=this.getPreviousSibling(),i=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();s===null?i.__first=a:s.getWritable().__next=a,i.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=_t();return n&&Ge(c)&&bp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return ma()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){Dn();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(me(o))return o.select();if(!Ue(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){Dn();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(me(o))return o.select(0,0);if(!Ue(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},k5="historic",L5="history-push",ip="history-merge",A5="paste",dP="collaboration",R5="skip-collab",cP="skip-scroll-into-view",uP="skip-dom-selection",hv="skip-selection-focus",fP="composition-start",pP="composition-end",bl=class e extends qo{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3826
- `}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&&Sv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Zf(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&Zf(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&Sv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Zf(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&Zf(a))return!0}return!1})(t)?null:{conversion:E5,priority:0}}}static importJSON(t){return Sl().updateFromJSON(t)}};function E5(e){return{node:Sl()}}function Sl(){return Fc(new bl)}function pi(e){return e instanceof bl}function Zf(e){return Ur(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Kh(e,t){return 16&t?"code":t&kv?"mark":32&t?"sub":64&t?"sup":null}function $h(e,t){return 1&t?"strong":2&t?"em":"span"}function mP(e,t,n,o,r){let a=o.classList,s=xl(r,"base");s!==void 0&&a.add(...s),s=xl(r,"underlineStrikethrough");let i=!1,l=8&t&&4&t;s!==void 0&&(8&n&&4&n?(i=!0,l||a.add(...s)):l&&a.remove(...s));for(let d in Xn){let c=Xn[d];if(s=xl(r,d),s!==void 0)if(n&c){if(i&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...s);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...s)}else t&c&&a.remove(...s)}}function gP(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?bc:"");if(o==null)t.textContent=a;else{let s=o.nodeValue;if(s!==a)if(r||ds){let[i,l,d]=(function(c,f){let p=c.length,m=f.length,g=0,h=0;for(;g<p&&g<m&&c[g]===f[g];)g++;for(;h+g<p&&h+g<m&&c[p-h-1]===f[m-h-1];)h++;return[g,p-g-h,f.slice(g,m-h)]})(s,a);l!==0&&o.deleteData(i,l),o.insertData(i,d)}else o.nodeValue=a}}function W0(e,t,n,o,r,a){gP(r,e,t);let s=a.theme.text;s!==void 0&&mP(0,0,o,e,s)}function ep(e,t){let n=document.createElement(t);return n.appendChild(e),n}var hi=class e extends qo{__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 JH[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ss()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=Xn[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Rc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=Kh(0,o),a=$h(0,o),s=r===null?a:r,i=document.createElement(s),l=i;this.hasFormat("code")&&i.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),i.appendChild(l)),W0(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(i.style.cssText=d),i}updateDOM(t,n,o){let r=this.__text,a=t.__format,s=this.__format,i=Kh(0,a),l=Kh(0,s),d=$h(0,a),c=$h(0,s);if((i===null?d:i)!==(l===null?c:l))return!0;if(i===l&&d!==c){let h=n.firstChild;h==null&&ve(48);let v=document.createElement(c);return W0(v,this,0,s,r,o),n.replaceChild(v,h),!1}let f=n;l!==null&&i!==null&&(f=n.firstChild,f==null&&ve(49)),gP(r,f,this);let p=o.theme.text;p!==void 0&&a!==s&&mP(0,a,s,f,p);let m=t.__style,g=this.__style;return m!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:D5,priority:0}),b:()=>({conversion:N5,priority:0}),code:()=>({conversion:da,priority:0}),em:()=>({conversion:da,priority:0}),i:()=>({conversion:da,priority:0}),mark:()=>({conversion:da,priority:0}),s:()=>({conversion:da,priority:0}),span:()=>({conversion:M5,priority:0}),strong:()=>({conversion:da,priority:0}),sub:()=>({conversion:da,priority:0}),sup:()=>({conversion:da,priority:0}),u:()=>({conversion:da,priority:0})}}static importJSON(t){return _n().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 io(n)||ve(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=ep(n,"b")),this.hasFormat("italic")&&(n=ep(n,"i")),this.hasFormat("strikethrough")&&(n=ep(n,"s")),this.hasFormat("underline")&&(n=ep(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"?Xn[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?QH[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Rc(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=YH[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){Dn();let o=t,r=n,a=_t(),s=this.getTextContent(),i=this.__key;if(typeof s=="string"){let l=s.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!Ge(a))return yP(i,o,i,r,"text","text");{let l=ss();l!==a.anchor.key&&l!==a.focus.key||On(i),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(),s=a.__text,i=o.length,l=t;l<0&&(l=i+l,l<0&&(l=0));let d=_t();if(r&&Ge(d)){let f=t+i;d.setTextNodeRange(a,f,a,f)}let c=s.slice(0,l)+o+s.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Dn();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=ss(),s=o.length;t.sort((P,w)=>P-w),t.push(s);let i=[],l=t.length;for(let P=0,w=0;P<s&&w<=l;w++){let L=t[w];L>P&&(i.push(o.slice(P,L)),P=L)}let d=i.length;if(d===1)return[n];let c=i[0],f=n.getParent(),p,m=n.getFormat(),g=n.getStyle(),h=n.__detail,v=!1,y=null,C=null,x=_t();if(Ge(x)){let[P,w]=x.isBackward()?[x.focus,x.anchor]:[x.anchor,x.focus];P.type==="text"&&P.key===r&&(y=P),w.type==="text"&&w.key===r&&(C=w)}n.isSegmented()?(p=_n(c),p.__format=m,p.__style=g,p.__detail=h,p.__state=_0(n,p),v=!0):p=n.setTextContent(c);let b=[p];for(let P=1;P<d;P++){let w=_n(i[P]);w.__format=m,w.__style=g,w.__detail=h,w.__state=_0(n,w);let L=w.__key;a===r&&On(L),b.push(w)}let T=y?y.offset:null,I=C?C.offset:null,k=0;for(let P of b){if(!y&&!C)break;let w=k+P.getTextContentSize();if(y!==null&&T!==null&&T<=w&&T>=k&&(y.set(P.getKey(),T-k,"text"),T<w&&(y=null)),C!==null&&I!==null&&I<=w&&I>=k){C.set(P.getKey(),I-k,"text");break}k=w}if(f!==null){(function(L){let A=L.getPreviousSibling(),M=L.getNextSibling();A!==null&&wp(A),M!==null&&wp(M)})(this);let P=f.getWritable(),w=this.getIndexWithinParent();v?(P.splice(w,0,b),this.remove()):P.splice(w,1,b),Ge(x)&&bp(x,f,w,d-1)}return b}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||ve(50);let o=this.__key,r=t.__key,a=this.__text,s=a.length;ss()===r&&On(o);let i=_t();if(Ge(i)){let f=i.anchor,p=i.focus;f!==null&&f.key===r&&nT(f,n,o,t,s),p!==null&&p.key===r&&nT(p,n,o,t,s)}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 M5(e){return{forChild:Kv(e.style),node:null}}function N5(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:Kv(t.style,n?void 0:"bold"),node:null}}var G0=new WeakMap;function _5(e){if(!io(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function D5(e){let t=e;e.parentElement===null&&ve(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,s=[o];for(;a!==null&&(r=G0.get(a))===void 0&&!_5(a);)s.push(a),a=a.parentNode;let i=r===void 0?a:r;for(let l=0;l<s.length;l++)G0.set(s[l],i);return i})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let s=0;s<a;s++){let i=o[s];i===`
3774
+ `,Pv=fs?"\xA0":xc,xT="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",bT="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",HH=new RegExp("^[^"+bT+"]*["+xT+"]"),KH=new RegExp("^[^"+xT+"]*["+bT+"]"),Yn={bold:1,capitalize:1024,code:16,highlight:Tv,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},$H={directionless:1,unmergeable:2},Qh={center:2,end:6,justify:4,left:1,right:3,start:5},qH={[OH]:"center",[zH]:"end",[BH]:"justify",[DH]:"left",[FH]:"right",[UH]:"start"},VH={normal:0,segmented:2,token:1},WH={[wH]:"normal",[PH]:"segmented",[TH]:"token"},GH="$",k0="$config";function ST(e,t,n,o,r,a){let s=e.getFirstChild();for(;s!==null;){let i=s.__key;s.__parent===t&&(me(s)&&ST(s,i,n,o,r,a),n.has(i)||a.delete(i),r.push(i)),s=s.getNextSibling()}}var Xh=!1,kv=0;function jH(e){kv=e.timeStamp}function Bh(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&_p(e,n)!==void 0}function QH(e,t,n){let o=pr(Lo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let s=e.nodeValue;s!==null&&Zv(t,s,r,a,!1)}function XH(e,t,n){if(Ge(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return Or(t)&&n.isAttached()}function YH(e,t,n,o){for(let r=e;r&&!VP(r);r=Dc(r)){let a=_p(r,t);if(a!==void 0){let s=Rn(a,n);if(s)return Yt(s)||!so(r)?void 0:[r,s]}else if(r===o)return[o,EP(n)]}}function IT(e,t,n){Xh=!0;let o=performance.now()-kv>100;try{Dr(e,()=>{let r=Nt()||(function(p){return p.getEditorState().read(()=>{let m=Nt();return m!==null?m.clone():null})})(e),a=new Map,s=e.getRootElement(),i=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],g=m.type,h=m.target,v=YH(h,e,i,s);if(!v)continue;let[y,C]=v;if(g==="characterData")o&&Ue(C)&&Or(h)&&XH(r,h,C)&&QH(h,C,e);else if(g==="childList"){d=!0;let x=m.addedNodes;for(let I=0;I<x.length;I++){let k=x[I],P=Xv(k),T=k.parentNode;if(T!=null&&k!==l&&P===null&&!Bh(k,T,e)){if(fs){let L=(so(k)?k.innerText:null)||k.nodeValue;L&&(c+=L)}T.removeChild(k)}}let b=m.removedNodes,w=b.length;if(w>0){let I=0;for(let k=0;k<w;k++){let P=b[k];(Bh(P,h,e)||l===P)&&(h.appendChild(P),I++)}w!==I&&a.set(y,C)}}}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],g=m.addedNodes,h=m.target;for(let v=0;v<g.length;v++){let y=g[v],C=y.parentNode;C==null||y.nodeName!=="BR"||Bh(y,h,e)||C.removeChild(y)}}n.takeRecords()}r!==null&&(d&&Co(r),fs&&FP(e)&&r.insertRawText(c))})}finally{Xh=!1}}function wT(e){let t=e._observer;t!==null&&IT(e,t.takeRecords(),t)}function TT(e){(function(t){kv===0&&Lo(t).addEventListener("textInput",jH,!0)})(e),e._observer=new MutationObserver((t,n)=>{IT(e,t,n)})}var Yh=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||t5).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function JH(e,t){return new Yh(e,t)}function dp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function ZH(e,t,n){let o=dp(e,n,"direct"),r=dp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function e5(e,t,n){let o;if(On(),typeof n=="function"){let a=e.getLatest(),s=dp(a,t);if(o=n(s),t.isEqual(s,o))return a}else o=n;let r=e.getWritable();return Lv(r).updateFromKnown(t,o),r}function PT(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}=Fc(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let s;"stateConfig"in a?(s=a.stateConfig,a.flat&&n.add(s.key)):s=a,t.set(s.key,s)}}return{flatKeys:n,sharedConfigMap:t}}var Jh=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:s}=this.sharedNodeState,i=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})(s,o,r);this.size=i}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 L0(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,s,i){let l;if(i)for(let[d,c]of Object.entries(i)){let f=a.get(d);f?s.has(f)||s.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=L0(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 Lv(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Jh(t,kT(t));return t.__state=n,n}function kT(e){return e.__state?e.__state.sharedNodeState:Wv(ry(),e.getType()).sharedNodeState}function L0(e){if(e)for(let t in e)return e}function t5(e){return e}function A0(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 R0(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,s]of Object.entries(o))if(!e.has(a)&&(e.add(a),s!==(r?r[a]:void 0)))return!0}return!1}function E0(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function M0(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,s=t.__format,i=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===s)&&(r===null||r===i)&&(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&&A0(p,c,f)||f&&A0(p,f,c)||c&&R0(p,c,f)||f&&R0(p,f,c))})(l,d))}function N0(e,t){let n=e.mergeWithSibling(t),o=Gt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function _0(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Ue(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(M0(t,o)){o=N0(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Ue(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(M0(o,n)){o=N0(o,n);break}break}n.remove()}}else o.remove()}function cp(e){return D0(e.anchor),D0(e.focus),e}function D0(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),Ue(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!me(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var ci,Gn,bc,Ap,Zh,ev,ui,lr,tv,Sc,An="",_r=null,ii=null,fl=!1,up=!1;function fp(e,t){let n=ui.get(e);if(t!==null){let o=av(e);o.parentNode===t&&t.removeChild(o)}if(lr.has(e)||Gn._keyToDOMMap.delete(e),me(n)){let o=mp(n,ui);nv(o,0,o.length-1,null)}n!==void 0&&ey(Sc,bc,Ap,n,"destroyed")}function nv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&fp(a,o)}}function si(e,t){e.setProperty("text-align",t)}var n5="40px";function LT(e,t){let n=ci.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(Gn._rootElement||e).getPropertyValue("--lexical-indent-base-value")||n5;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function AT(e,t){let n=e.style;t===0?si(n,""):t===1?si(n,"left"):t===2?si(n,"center"):t===3?si(n,"right"):t===4?si(n,"justify"):t===5?si(n,"start"):t===6&&si(n,"end")}function ov(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(Wn(o))return null;let a=o.getParentOrThrow();return Wn(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function pp(e,t){let n=lr.get(e);n===void 0&&ve(60);let o=n.createDOM(ci,Gn);if((function(r,a,s){let i=s._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,s,r),i.set(r,a)})(e,o,Gn),Ue(n)?o.setAttribute("data-lexical-text","true"):Yt(n)&&o.setAttribute("data-lexical-decorator","true"),me(n)){let r=n.__indent,a=n.__size;if(ov(o,n),r!==0&&LT(o,r),a!==0){let i=a-1;rv(mp(n,lr),n,0,i,n.getDOMSlot(o))}let s=n.__format;s!==0&&AT(o,s),n.isInline()||RT(null,n,o)}else{let r=n.getTextContent();if(Yt(n)){let a=n.decorate(Gn,ci);a!==null&&ET(e,a),o.contentEditable="false"}An+=r}return t!==null&&t.insertChild(o),ey(Sc,bc,Ap,n,"created"),o}function rv(e,t,n,o,r){let a=An;An="";let s=n;for(;s<=o;++s){pp(e[s],r);let i=lr.get(e[s]);i!==null&&Ue(i)?_r===null&&(_r=i.getFormat(),ii=i.getStyle()):me(i)&&s<o&&!i.isInline()&&(An+=Lp)}r.element.__lexicalTextContent=An,An=a+An}function O0(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return di(o)?"line-break":Yt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function RT(e,t,n){let o=O0(e,ui),r=O0(t,lr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function o5(e,t,n){var o;_r=null,ii=null,(function(r,a,s){let i=An,l=r.__size,d=a.__size;An="";let c=s.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)np(f,c);else{let g=av(f),h=pp(p,null);try{c.replaceChild(h,g)}catch(v){if(typeof v=="object"&&v!=null){let y=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${f}}.`;throw new Error(y)}throw v}fp(f,null)}let m=lr.get(p);Ue(m)&&_r===null&&(_r=m.getFormat(),ii=m.getStyle())}else{let f=mp(r,ui),p=mp(a,lr);if(f.length!==l&&ve(227),p.length!==d&&ve(228),l===0)d!==0&&rv(p,0,0,d-1,s);else if(d===0){if(l!==0){let m=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;nv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,g,h,v,y,C){let x=v-1,b=y-1,w,I,k=C.getFirstChild(),P=0,T=0;for(;P<=x&&T<=b;){let M=g[P],R=h[T];if(M===R)k=Uh(np(R,C.element)),P++,T++;else{if(I===void 0&&(I=F0(h,T)),w===void 0)w=F0(g,P);else if(!w.has(M)){P++;continue}if(!I.has(M)){k=Uh(av(M)),fp(M,C.element),P++,w.delete(M);continue}if(w.has(R)){let H=wl(Gn,R);H!==k&&C.withBefore(k).insertChild(H),k=Uh(np(R,C.element)),P++,T++}else pp(R,C.withBefore(k)),T++}let D=lr.get(R);D!==null&&Ue(D)?_r===null&&(_r=D.getFormat(),ii=D.getStyle()):me(D)&&T<=b&&!D.isInline()&&(An+=Lp)}let L=P>x,A=T>b;if(L&&!A){let M=h[b+1],R=M===void 0?null:Gn.getElementByKey(M);rv(h,0,T,b,C.withBefore(R))}else A&&!L&&nv(g,P,x,C.element)})(0,f,p,l,d,s)}c.__lexicalTextContent=An,An=i+An})(e,t,t.getDOMSlot(n)),o=t,_r==null||_r===o.__textFormat||up||o.setTextFormat(_r),(function(r){ii==null||ii===r.__textStyle||up||r.setTextStyle(ii)})(t)}function mp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&ve(101),n.push(o),o=r.__next}return n}function np(e,t){let n=ui.get(e),o=lr.get(e);n!==void 0&&o!==void 0||ve(61);let r=fl||ev.has(e)||Zh.has(e),a=wl(Gn,e);if(n===o&&!r){let s;if(me(n)){let i=a.__lexicalTextContent;typeof i=="string"?s=i:(s=n.getTextContent(),a.__lexicalTextContent=s)}else s=n.getTextContent();return An+=s,a}if(n!==o&&r&&ey(Sc,bc,Ap,o,"updated"),o.updateDOM(n,a,ci)){let s=pp(e,null);return t===null&&ve(62),t.replaceChild(s,a),fp(e,null),s}if(me(n)){me(o)||ve(334,e);let s=o.__indent;(fl||s!==n.__indent)&&LT(a,s);let i=o.__format;if((fl||i!==n.__format)&&AT(a,i),r)o5(n,o,a),Wn(o)||o.isInline()||RT(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),An+=d}if((fl||o.__dir!==n.__dir)&&(ov(a,o),Wn(o)&&!fl))for(let l of o.getChildren())me(l)&&ov(wl(Gn,l.getKey()),l)}else{let s=o.getTextContent();if(Yt(o)){let i=o.decorate(Gn,ci);i!==null&&ET(e,i)}An+=s}if(!up&&Wn(o)&&o.__cachedText!==An){let s=o.getWritable();s.__cachedText=An,o=s}return a}function ET(e,t){let n=Gn._pendingDecorators,o=Gn._decorators;if(n===null){if(o[e]===t)return;n=RP(Gn)}n[e]=t}function Uh(e){let t=e.nextSibling;return t!==null&&t===Gn._blockCursorElement&&(t=t.nextSibling),t}function F0(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function r5(e,t,n,o,r,a){An="",fl=o===2,Gn=n,ci=n._config,bc=n._nodes,Ap=Gn._listeners.mutation,Zh=r,ev=a,ui=e._nodeMap,lr=t._nodeMap,up=t._readOnly,tv=new Map(n._keyToDOMMap);let s=new Map;return Sc=s,np("root",null),Gn=void 0,bc=void 0,Zh=void 0,ev=void 0,ui=void 0,lr=void 0,ci=void 0,tv=void 0,Sc=void 0,s}function av(e){let t=tv.get(e);return t===void 0&&ve(75,e),t}function et(e){return{type:e}}var Av=et("SELECTION_CHANGE_COMMAND"),a5=et("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),MT=et("CLICK_COMMAND"),Rv=et("BEFORE_INPUT_COMMAND"),Ev=et("INPUT_COMMAND"),Mv=et("COMPOSITION_START_COMMAND"),Nv=et("COMPOSITION_END_COMMAND"),Ic=et("DELETE_CHARACTER_COMMAND"),mc=et("INSERT_LINE_BREAK_COMMAND"),sv=et("INSERT_PARAGRAPH_COMMAND"),hl=et("CONTROLLED_TEXT_INSERTION_COMMAND"),_v=et("PASTE_COMMAND"),iv=et("REMOVE_TEXT_COMMAND"),wc=et("DELETE_WORD_COMMAND"),Tc=et("DELETE_LINE_COMMAND"),ls=et("FORMAT_TEXT_COMMAND"),Dv=et("UNDO_COMMAND"),Ov=et("REDO_COMMAND"),Fv=et("KEYDOWN_COMMAND"),NT=et("KEY_ARROW_RIGHT_COMMAND"),_T=et("MOVE_TO_END"),DT=et("KEY_ARROW_LEFT_COMMAND"),OT=et("MOVE_TO_START"),FT=et("KEY_ARROW_UP_COMMAND"),BT=et("KEY_ARROW_DOWN_COMMAND"),gp=et("KEY_ENTER_COMMAND"),UT=et("KEY_SPACE_COMMAND"),zT=et("KEY_BACKSPACE_COMMAND"),HT=et("KEY_ESCAPE_COMMAND"),KT=et("KEY_DELETE_COMMAND"),$T=et("KEY_TAB_COMMAND"),s5=et("INSERT_TAB_COMMAND"),i5=et("INDENT_CONTENT_COMMAND"),l5=et("OUTDENT_CONTENT_COMMAND"),qT=et("DROP_COMMAND"),d5=et("FORMAT_ELEMENT_COMMAND"),VT=et("DRAGSTART_COMMAND"),WT=et("DRAGOVER_COMMAND"),GT=et("DRAGEND_COMMAND"),Bv=et("COPY_COMMAND"),Uv=et("CUT_COMMAND"),lv=et("SELECT_ALL_COMMAND"),c5=et("CLEAR_EDITOR_COMMAND"),u5=et("CLEAR_HISTORY_COMMAND"),f5=et("CAN_REDO_COMMAND"),p5=et("CAN_UNDO_COMMAND"),jT=et("FOCUS_COMMAND"),QT=et("BLUR_COMMAND"),XT=et("KEY_MODIFIER_COMMAND"),la=Object.freeze({}),dv=[["keydown",function(e,t){Pc=e.timeStamp,YT=e.key,!t.isComposing()&&Ae(t,Fv,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;El(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&Dr(t,()=>{kP(n)||(fv=!0)})}],["compositionstart",function(e,t){Ae(t,Mv,e)}],["compositionend",function(e,t){fs?pc=!0:Ec||!Pp&&!kp?Ae(t,Nv,e):(op=!0,rp=e.data)}],["input",function(e,t){e.stopPropagation(),Dr(t,()=>{t.dispatchCommand(Ev,e)},{event:e}),pl=null}],["click",function(e,t){Dr(t,()=>{let n=Nt(),o=pr(Lo(t)),r=hi();if(o){if(Ge(n)){let a=n.anchor,s=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!Wn(s)&&ko().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&s!==n.focus.getNode()){let i=vc(s,l=>me(l)&&!l.isInline());me(i)&&i.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(so(a)||Or(a))&&Co(Ep(r,o,t,e))}}Ae(t,MT,e)})}],["cut",la],["copy",la],["dragstart",la],["dragover",la],["dragend",la],["paste",la],["focus",la],["blur",la],["drop",la]];lp&&dv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||fs&&FP(o)||r!=="insertCompositionText"&&Ae(o,Rv,n)})(e,t)]);var Pc=0,YT=null,JT=0,pl=null,cv=new WeakMap,hp=new WeakMap,uv=!1,fv=!1,gc=!1,pc=!1,op=!1,rp="",li=null,ZT=[0,"",0,"root",0];function eP(e,t,n,o,r){let a=e.anchor,s=e.focus,i=a.getNode(),l=Gt(),d=pr(Lo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!Ue(i)||(!r&&(!lp||JT<o+50)||i.isDirty()&&m<2||MP(n))&&a.offset!==s.offset&&!i.isComposing()||ua(i)||i.isDirty()&&m>1||(r||!lp)&&p!==null&&!i.isComposing()&&c!==mi(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!i.isComposing()&&(i.getFormat()!==e.format||i.getStyle()!==e.style)||(function(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let v=g.anchor.offset,y=h.getParentOrThrow(),C=cs(h);return v===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||C||(function(x){let b=x.getPreviousSibling();return(Ue(b)||me(b)&&b.isInline())&&!b.canInsertTextAfter()})(h):v===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||C)})(e,i)}function B0(e,t){return Or(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function U0(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:s}=e;uv&&(uv=!1,B0(o,r)&&B0(a,s)&&!li)||Dr(t,()=>{if(!n)return void Co(null);if(!Nc(t,o,a))return;let i=Nt();if(li&&Ge(i)&&i.isCollapsed()){let l=i.anchor,d=li.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(i=li.clone(),Co(i))}if(li=null,Ge(i)){let l=i.anchor,d=l.getNode();if(i.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(i.dirty=!0);let c=Lo(t).event,f=c?c.timeStamp:performance.now(),[p,m,g,h,v]=ZT,y=ko(),C=t.isComposing()===!1&&y.getTextContent()==="";if(f<v+200&&l.offset===g&&l.key===h)ap(i,p,m);else if(l.type==="text")Ue(d)||ve(141),tP(i,d);else if(l.type==="element"&&!C){me(d)||ve(259);let x=l.getNode();x.isEmpty()?(function(b,w){let I=w.getTextFormat(),k=w.getTextStyle();ap(b,I,k)})(i,x):ap(i,0,"")}}else{let c=l.key,f=i.focus.key,p=i.getNodes(),m=p.length,g=i.isBackward(),h=g?s:r,v=g?r:s,y=g?f:c,C=g?c:f,x=2047,b=!1;for(let w=0;w<m;w++){let I=p[w],k=I.getTextContentSize();if(Ue(I)&&k!==0&&!(w===0&&I.__key===y&&h===k||w===m-1&&I.__key===C&&v===0)&&(b=!0,x&=I.getFormat(),x===0))break}i.format=b?x:0}}Ae(t,Av,void 0)})}function ap(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function tP(e,t){ap(e,t.getFormat(),t.getStyle())}function nP(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function m5(e){let t=e.inputType,n=nP(e),o=Gt(),r=Nt();if(t==="deleteContentBackward"){if(r===null){let f=hi();if(!Ge(f))return!0;Co(f.clone())}if(Ge(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,YT==="MediaLast"&&a<Pc+30&&o.isComposing()&&f){if(Fn(null),Pc=0,setTimeout(()=>{Dr(o,()=>{Fn(null)})},30),Ge(r)){let p=r.anchor.getNode();p.markDirty(),Ue(p)||ve(142),tP(r,p)}}else{Fn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===m.length,v=jh&&f&&!h&&g;if(v&&r.isCollapsed()&&(v=!Yt(OP(r.anchor,!0))),!v){Ae(o,Ic,!0);let y=Nt();jh&&Ge(y)&&y.isCollapsed()&&(li=y,setTimeout(()=>li=null))}}return!0}}var a;if(!Ge(r))return!0;let s=e.data;pl!==null&&Jv(!1,o,pl),r.dirty&&pl===null||!r.isCollapsed()||Wn(r.anchor.getNode())||n===null||r.applyDOMRange(n),pl=null;let i=r.anchor,l=r.focus,d=i.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
3775
+ `)e.preventDefault(),Ae(o,mc,!1);else if(s===Lp)e.preventDefault(),Ae(o,sv,void 0);else if(s==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else s!=null&&eP(r,n,s,e.timeStamp,!0)?(e.preventDefault(),Ae(o,hl,s)):pl=s;return JT=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Ae(o,hl,e);break;case"insertFromComposition":Fn(null),Ae(o,hl,e);break;case"insertLineBreak":Fn(null),Ae(o,mc,!1);break;case"insertParagraph":Fn(null),gc&&!Ec?(gc=!1,Ae(o,mc,!1)):Ae(o,sv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Ae(o,_v,e);break;case"deleteByComposition":(function(f,p){return f!==p||me(f)||me(p)||!cs(f)||!cs(p)})(d,c)&&Ae(o,iv,e);break;case"deleteByDrag":case"deleteByCut":Ae(o,iv,e);break;case"deleteContent":Ae(o,Ic,!1);break;case"deleteWordBackward":Ae(o,wc,!0);break;case"deleteWordForward":Ae(o,wc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Ae(o,Tc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Ae(o,Tc,!1);break;case"formatStrikeThrough":Ae(o,ls,"strikethrough");break;case"formatBold":Ae(o,ls,"bold");break;case"formatItalic":Ae(o,ls,"italic");break;case"formatUnderline":Ae(o,ls,"underline");break;case"historyUndo":Ae(o,Dv,void 0);break;case"historyRedo":Ae(o,Ov,void 0)}return!0}function g5(e){if(so(e.target)&&kP(e.target))return!0;let t=Gt(),n=Nt(),o=e.data,r=nP(e);if(o!=null&&Ge(n)&&eP(n,r,o,e.timeStamp,!1)){pc&&(vp(t,o),pc=!1);let a=n.anchor.getNode(),s=pr(Lo(t));if(s===null)return!0;let i=n.isBackward(),l=i?n.anchor.offset:n.focus.offset,d=i?n.focus.offset:n.anchor.offset;lp&&!n.isCollapsed()&&Ue(a)&&s.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===_P(s.anchorNode)||Ae(t,hl,o);let c=o.length;fs&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),jh&&t.isComposing()&&(Pc=0,Fn(null))}else Jv(!1,t,o!==null?o:void 0),pc&&(vp(t,o||void 0),pc=!1);return(function(){On();let a=Gt();wT(a)})(),!0}function h5(e){let t=Gt(),n=Nt();if(Ge(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Fn(o.key),Op(dP),(e.timeStamp<Pc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Ue(r)&&r.getStyle()!==n.style)&&Ae(t,hl,Pv)}return!0}function v5(e){return vp(Gt(),e.data),Op(cP),!0}function vp(e,t){let n=e._compositionKey;if(Fn(null),n!==null&&t!=null){if(t===""){let o=Rn(n),r=mi(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Ue(o)){let a=pr(Lo(e)),s=null,i=null;a!==null&&a.anchorNode===r&&(s=a.anchorOffset,i=a.focusOffset),Zv(o,r.nodeValue,s,i,!0)}return}if(t[t.length-1]===`
3776
+ `){let o=Nt();if(Ge(o)||Mc(o)){if(Ge(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Ae(e,gp,null)}}}Jv(!0,e,t)}function y5(e){let t=Gt();if(e.key==null)return!0;if(op){if(fT(e))return Dr(t,()=>{vp(t,rp)}),op=!1,rp="",!0;op=!1,rp=""}if((function(n){return Ut(n,"ArrowRight",{shiftKey:"any"})})(e))Ae(t,NT,e);else if((function(n){return Ut(n,"ArrowRight",ca)})(e))Ae(t,_T,e);else if((function(n){return Ut(n,"ArrowLeft",{shiftKey:"any"})})(e))Ae(t,DT,e);else if((function(n){return Ut(n,"ArrowLeft",ca)})(e))Ae(t,OT,e);else if((function(n){return Ut(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Ae(t,FT,e);else if((function(n){return Ut(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Ae(t,BT,e);else if((function(n){return Ut(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))gc=!0,Ae(t,gp,e);else if((function(n){return n.key===" "})(e))Ae(t,UT,e);else if((function(n){return sr&&Ut(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),gc=!0,Ae(t,mc,!0);else if((function(n){return Ut(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))gc=!1,Ae(t,gp,e);else if((function(n){return Ut(n,"Backspace",{shiftKey:"any"})||sr&&Ut(n,"h",{ctrlKey:!0})})(e))fT(e)?Ae(t,zT,e):(e.preventDefault(),Ae(t,Ic,!0));else if((function(n){return n.key==="Escape"})(e))Ae(t,HT,e);else if((function(n){return Ut(n,"Delete",{})||sr&&Ut(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Ae(t,KT,e):(e.preventDefault(),Ae(t,Ic,!1));else if((function(n){return Ut(n,"Backspace",uT)})(e))e.preventDefault(),Ae(t,wc,!0);else if((function(n){return Ut(n,"Delete",uT)})(e))e.preventDefault(),Ae(t,wc,!1);else if((function(n){return sr&&Ut(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Ae(t,Tc,!0);else if((function(n){return sr&&(Ut(n,"Delete",{metaKey:!0})||Ut(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Ae(t,Tc,!1);else if((function(n){return Ut(n,"b",ca)})(e))e.preventDefault(),Ae(t,ls,"bold");else if((function(n){return Ut(n,"u",ca)})(e))e.preventDefault(),Ae(t,ls,"underline");else if((function(n){return Ut(n,"i",ca)})(e))e.preventDefault(),Ae(t,ls,"italic");else if((function(n){return Ut(n,"Tab",{shiftKey:"any"})})(e))Ae(t,$T,e);else if((function(n){return Ut(n,"z",ca)})(e))e.preventDefault(),Ae(t,Dv,void 0);else if((function(n){return sr?Ut(n,"z",{metaKey:!0,shiftKey:!0}):Ut(n,"y",{ctrlKey:!0})||Ut(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Ae(t,Ov,void 0);else{let n=t._editorState._selection;n===null||Ge(n)?pT(e)&&(e.preventDefault(),Ae(t,lv,e)):(function(o){return Ut(o,"c",ca)})(e)?(e.preventDefault(),Ae(t,Bv,e)):(function(o){return Ut(o,"x",ca)})(e)?(e.preventDefault(),Ae(t,Uv,e)):pT(e)&&(e.preventDefault(),Ae(t,lv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(XT,e),!0}function oP(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var vl=new Map;function rP(e){let t=HP(e.target);if(t===null)return;let n=Qv(t.anchorNode);if(n===null)return;fv&&(fv=!1,Dr(n,()=>{let l=hi(),d=t.anchorNode;(so(d)||Or(d))&&Co(Ep(l,t,n,e))}));let o=Yv(n),r=o[o.length-1],a=r._key,s=vl.get(a),i=s||r;i!==n&&U0(t,i,!1),U0(t,n,!0),n!==r?vl.set(a,n):s&&vl.delete(a)}function z0(e){e._lexicalHandled=!0}function H0(e){return e._lexicalHandled===!0}var K0=()=>{};function C5(e){let t=cv.get(e);if(t===void 0)return void K0();let n=hp.get(t);if(n===void 0)return void K0();let o=n-1;o>=0||ve(164),cv.delete(e),hp.set(t,o),o===0&&t.removeEventListener("selectionchange",rP);let r=_c(e);Np(r)?((function(s){if(s._parentEditor!==null){let i=Yv(s),l=i[i.length-1]._key;vl.get(l)===s&&vl.delete(l)}else vl.delete(s._key)})(r),e.__lexicalEditor=null):r&&ve(198);let a=oP(e);for(let s=0;s<a.length;s++)a[s]();e.__lexicalEventHandles=[]}function pv(e,t,n){On();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(i){let l=Nt();if(!Ge(l)||!me(i))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return wp(f,i)&&d.set(i.__key,0,"element"),wp(p,i)&&c.set(i.__key,0,"element"),l})(e),s=!1;if(Ge(a)&&t){let i=a.anchor,l=a.focus;i.key===o&&(bp(i,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0),l.key===o&&(bp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else Mc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ge(a)&&t&&!s){let i=e.getIndexWithinParent();us(e),xp(a,r,i,-1)}else us(e);n||Go(r)||r.canBeEmpty()||!r.isEmpty()||pv(r,t),t&&a&&Wn(r)&&r.isEmpty()&&r.selectEnd()}function x5(e){return e}var aP=Symbol.for("ephemeral");function yp(e){return e[aP]||!1}var Wo=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Fc(this);return t===void 0&&ve(64,this.name),t}static clone(t){ve(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}),AP(this,t)}getType(){return this.__type}isInline(){ve(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Rn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||Nt();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Ue(this))return o;if(Ge(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Yt(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:Rn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&ve(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(Go(n))return me(t)||t===this&&Yt(t)||ve(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&ve(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:Rn(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:Rn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=me(this)?this:this.getParent(),o=me(t)?t:t.getParent(),r=n&&o?yc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=yc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?cy(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&ve(279),!1)))}isParentOf(t){let n=yc(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 s=a.__key;if(r.has(s)||(r.add(s),o.push(a)),a===t)break;let i=me(a)?n?a.getFirstChild():a.getLastChild():null;if(i!==null){a=i;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&&ve(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=Gt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(yp(this))return this;let t=Rn(this.__key);return t===null&&ve(113),t}getWritable(){if(yp(this))return this;On();let t=va(),n=Gt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),s=n._cloneNotNeeded,i=Nt();if(i!==null&&i.setCachedNodes(null),s.has(r))return Ip(a),a;let l=ay(a);return s.add(r),Ip(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){ve(70)}updateDOM(t,n,o){ve(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){ve(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,s=a;for(let i of kT(r).flatKeys)i in o&&(s!==void 0&&s!==a||(s={...a}),s[i]=o[i]);return(r.__state||s)&&Lv(n).updateFromJSON(s),r})(this,t)}static transform(){return null}remove(t){pv(this,!0,t)}replace(t,n){On();let o=Nt();o!==null&&(o=o.clone()),Vh(this,t);let r=this.getLatest(),a=this.__key,s=t.__key,i=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;us(i);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,g=r.__parent;if(pv(r,!1,!0),c===null?l.__first=s:c.getWritable().__next=s,i.__prev=p,f===null?l.__last=s:f.getWritable().__prev=s,i.__next=m,i.__parent=g,l.__size=d,n&&(me(this)&&me(i)||ve(139),this.getChildren().forEach(h=>{i.append(h)})),Ge(o)){Co(o);let h=o.anchor,v=o.focus;h.key===a&&W0(h,i),v.key===a&&W0(v,i)}return ds()===a&&Fn(s),i}insertAfter(t,n=!0){On(),Vh(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),s=Nt(),i=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(us(r),Ge(s)){let g=a.__key,h=s.anchor,v=s.focus;i=h.type==="element"&&h.key===g&&h.offset===m+1,l=v.type==="element"&&v.key===g&&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&&Ge(s)){let m=this.getIndexWithinParent();xp(s,c,m+1);let g=c.__key;i&&s.anchor.set(g,m+2,"element"),l&&s.focus.set(g,m+2,"element")}return t}insertBefore(t,n=!0){On(),Vh(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;us(r);let s=this.getPreviousSibling(),i=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();s===null?i.__first=a:s.getWritable().__next=a,i.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=Nt();return n&&Ge(c)&&xp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return ma()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){On();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(me(o))return o.select();if(!Ue(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){On();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(me(o))return o.select(0,0);if(!Ue(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},b5="historic",S5="history-push",sp="history-merge",I5="paste",sP="collaboration",w5="skip-collab",iP="skip-scroll-into-view",lP="skip-dom-selection",mv="skip-selection-focus",dP="composition-start",cP="composition-end",Cl=class e extends Wo{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3777
+ `}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&&xv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Jf(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&Jf(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&xv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Jf(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&Jf(a))return!0}return!1})(t)?null:{conversion:T5,priority:0}}}static importJSON(t){return xl().updateFromJSON(t)}};function T5(e){return{node:xl()}}function xl(){return Oc(new Cl)}function di(e){return e instanceof Cl}function Jf(e){return Or(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function zh(e,t){return 16&t?"code":t&Tv?"mark":32&t?"sub":64&t?"sup":null}function Hh(e,t){return 1&t?"strong":2&t?"em":"span"}function uP(e,t,n,o,r){let a=o.classList,s=yl(r,"base");s!==void 0&&a.add(...s),s=yl(r,"underlineStrikethrough");let i=!1,l=8&t&&4&t;s!==void 0&&(8&n&&4&n?(i=!0,l||a.add(...s)):l&&a.remove(...s));for(let d in Yn){let c=Yn[d];if(s=yl(r,d),s!==void 0)if(n&c){if(i&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...s);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...s)}else t&c&&a.remove(...s)}}function fP(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?xc:"");if(o==null)t.textContent=a;else{let s=o.nodeValue;if(s!==a)if(r||fs){let[i,l,d]=(function(c,f){let p=c.length,m=f.length,g=0,h=0;for(;g<p&&g<m&&c[g]===f[g];)g++;for(;h+g<p&&h+g<m&&c[p-h-1]===f[m-h-1];)h++;return[g,p-g-h,f.slice(g,m-h)]})(s,a);l!==0&&o.deleteData(i,l),o.insertData(i,d)}else o.nodeValue=a}}function $0(e,t,n,o,r,a){fP(r,e,t);let s=a.theme.text;s!==void 0&&uP(0,0,o,e,s)}function Zf(e,t){let n=document.createElement(t);return n.appendChild(e),n}var fi=class e extends Wo{__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 WH[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===ds()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=Yn[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Ac(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=zh(0,o),a=Hh(0,o),s=r===null?a:r,i=document.createElement(s),l=i;this.hasFormat("code")&&i.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),i.appendChild(l)),$0(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(i.style.cssText=d),i}updateDOM(t,n,o){let r=this.__text,a=t.__format,s=this.__format,i=zh(0,a),l=zh(0,s),d=Hh(0,a),c=Hh(0,s);if((i===null?d:i)!==(l===null?c:l))return!0;if(i===l&&d!==c){let h=n.firstChild;h==null&&ve(48);let v=document.createElement(c);return $0(v,this,0,s,r,o),n.replaceChild(v,h),!1}let f=n;l!==null&&i!==null&&(f=n.firstChild,f==null&&ve(49)),fP(r,f,this);let p=o.theme.text;p!==void 0&&a!==s&&uP(0,a,s,f,p);let m=t.__style,g=this.__style;return m!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:A5,priority:0}),b:()=>({conversion:k5,priority:0}),code:()=>({conversion:da,priority:0}),em:()=>({conversion:da,priority:0}),i:()=>({conversion:da,priority:0}),mark:()=>({conversion:da,priority:0}),s:()=>({conversion:da,priority:0}),span:()=>({conversion:P5,priority:0}),strong:()=>({conversion:da,priority:0}),sub:()=>({conversion:da,priority:0}),sup:()=>({conversion:da,priority:0}),u:()=>({conversion:da,priority:0})}}static importJSON(t){return Dn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:n}=super.exportDOM(t);return so(n)||ve(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=Zf(n,"b")),this.hasFormat("italic")&&(n=Zf(n,"i")),this.hasFormat("strikethrough")&&(n=Zf(n,"s")),this.hasFormat("underline")&&(n=Zf(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"?Yn[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?$H[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Ac(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=VH[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){On();let o=t,r=n,a=Nt(),s=this.getTextContent(),i=this.__key;if(typeof s=="string"){let l=s.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!Ge(a))return gP(i,o,i,r,"text","text");{let l=ds();l!==a.anchor.key&&l!==a.focus.key||Fn(i),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(),s=a.__text,i=o.length,l=t;l<0&&(l=i+l,l<0&&(l=0));let d=Nt();if(r&&Ge(d)){let f=t+i;d.setTextNodeRange(a,f,a,f)}let c=s.slice(0,l)+o+s.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){On();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=ds(),s=o.length;t.sort((P,T)=>P-T),t.push(s);let i=[],l=t.length;for(let P=0,T=0;P<s&&T<=l;T++){let L=t[T];L>P&&(i.push(o.slice(P,L)),P=L)}let d=i.length;if(d===1)return[n];let c=i[0],f=n.getParent(),p,m=n.getFormat(),g=n.getStyle(),h=n.__detail,v=!1,y=null,C=null,x=Nt();if(Ge(x)){let[P,T]=x.isBackward()?[x.focus,x.anchor]:[x.anchor,x.focus];P.type==="text"&&P.key===r&&(y=P),T.type==="text"&&T.key===r&&(C=T)}n.isSegmented()?(p=Dn(c),p.__format=m,p.__style=g,p.__detail=h,p.__state=E0(n,p),v=!0):p=n.setTextContent(c);let b=[p];for(let P=1;P<d;P++){let T=Dn(i[P]);T.__format=m,T.__style=g,T.__detail=h,T.__state=E0(n,T);let L=T.__key;a===r&&Fn(L),b.push(T)}let w=y?y.offset:null,I=C?C.offset:null,k=0;for(let P of b){if(!y&&!C)break;let T=k+P.getTextContentSize();if(y!==null&&w!==null&&w<=T&&w>=k&&(y.set(P.getKey(),w-k,"text"),w<T&&(y=null)),C!==null&&I!==null&&I<=T&&I>=k){C.set(P.getKey(),I-k,"text");break}k=T}if(f!==null){(function(L){let A=L.getPreviousSibling(),M=L.getNextSibling();A!==null&&Ip(A),M!==null&&Ip(M)})(this);let P=f.getWritable(),T=this.getIndexWithinParent();v?(P.splice(T,0,b),this.remove()):P.splice(T,1,b),Ge(x)&&xp(x,f,T,d-1)}return b}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||ve(50);let o=this.__key,r=t.__key,a=this.__text,s=a.length;ds()===r&&Fn(o);let i=Nt();if(Ge(i)){let f=i.anchor,p=i.focus;f!==null&&f.key===r&&Z0(f,n,o,t,s),p!==null&&p.key===r&&Z0(p,n,o,t,s)}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 P5(e){return{forChild:zv(e.style),node:null}}function k5(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:zv(t.style,n?void 0:"bold"),node:null}}var q0=new WeakMap;function L5(e){if(!so(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function A5(e){let t=e;e.parentElement===null&&ve(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,s=[o];for(;a!==null&&(r=q0.get(a))===void 0&&!L5(a);)s.push(a),a=a.parentNode;let i=r===void 0?a:r;for(let l=0;l<s.length;l++)q0.set(s[l],i);return i})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let s=0;s<a;s++){let i=o[s];i===`
3827
3778
  `||i===`\r
3828
- `?r.push(Sl()):i===" "?r.push(Ep()):i!==""&&r.push(_n(i))}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=j0(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=j0(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:_n(n)}}function j0(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,io(n)){let a=n.style.display;if(a===""&&!WP(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Ur(n))return n;if(n.nodeName==="BR")return null}}var O5={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function da(e){let t=O5[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Kv(e.style,t),node:null}}function _n(e=""){return Fc(new hi(e))}function Ue(e){return e instanceof hi}function Kv(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),s=e.fontStyle==="italic",i=o.includes("underline"),l=e.verticalAlign;return d=>(Ue(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),s&&!d.hasFormat("italic")&&d.toggleFormat("italic"),i&&!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 Il=class e extends hi{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=xl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return Ep().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&bT(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||ve(286),this}setDetail(t){return t!==2&&ve(127),this}setMode(t){return t!=="normal"&&ve(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Ep(){return Fc(new Il)}function $v(e){return e instanceof Il}var vv=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:uy(dr(ms(this,"next")),dr(ms(t,"next")))<0}getNode(){let t=Rn(this.key);return t===null&&ve(20),t}set(t,n,o,r){let a=this._selection,s=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,Ml()||(ss()===s&&On(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function pr(e,t,n){return new vv(e,t,n)}function qh(e,t){let n=t.__key,o=e.offset,r="element";if(Ue(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!me(t)){let a=t.getNextSibling();if(Ue(a))n=a.__key,o=0,r="text";else{let s=t.getParent();s&&(n=s.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function Q0(e,t){if(me(t)){let n=t.getLastDescendant();me(n)||Ue(n)?qh(e,n):qh(e,t)}else qh(e,t)}var xp=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(!Nc(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(Ue(r))a=r.select();else{let s=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(s,s)}a.insertNodes(t);for(let s=0;s<o;s++)n[s].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=Rn(r);a!==null&&o.push(a)}return Ml()||(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((_t()||xi())===this&&t[0]){let n=Un(t[0],"next");YP(ps(n,n))}for(let n of t)n.remove()}};function Ge(e){return e instanceof vi}var vi=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!!Ge(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,s]=o.getTextSlices();a&&r.push(a.caret.origin);let i=new Set,l=new Set;for(let d of o)if(ur(d)){let{origin:c}=d;r.length===0?i.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;me(c)&&l.has(c)||r.push(c)}if(s&&r.push(s.caret.origin),Ci(o.focus)&&me(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=ha(o.focus.origin,"previous");ur(d)&&i.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Rl(d))i.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!me(d)||l.has(d)||d.isEmpty()||i.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=dr(o.anchor),c=dr(o.anchor.getFlipped()),f=m=>ga(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(py(Pv(this),"next"));return Ml()||(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,s=r.isBefore(a),[i,l]=yv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(me(p)&&!p.isInline())c||(d+=`
3829
- `),c=!p.isEmpty();else if(c=!1,Ue(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=i<l?m.slice(i,l):m.slice(l,i)):m=s?m.slice(i):m.slice(l):p===o&&(m=s?m.slice(0,l):m.slice(0,i)),d+=m}else!Xt(p)&&!pi(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=jt(),o=n.getEditorState()._selection,r=vP(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,s]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(s.key,s.offset,s.type,!0),up(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=Rc(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=Xn[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 s=n[a];s===`
3779
+ `?r.push(xl()):i===" "?r.push(Rp()):i!==""&&r.push(Dn(i))}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=V0(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=V0(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:Dn(n)}}function V0(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,so(n)){let a=n.style.display;if(a===""&&!$P(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Or(n))return n;if(n.nodeName==="BR")return null}}var R5={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function da(e){let t=R5[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:zv(e.style,t),node:null}}function Dn(e=""){return Oc(new fi(e))}function Ue(e){return e instanceof fi}function zv(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),s=e.fontStyle==="italic",i=o.includes("underline"),l=e.verticalAlign;return d=>(Ue(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),s&&!d.hasFormat("italic")&&d.toggleFormat("italic"),i&&!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 bl=class e extends fi{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=yl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return Rp().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&yT(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||ve(286),this}setDetail(t){return t!==2&&ve(127),this}setMode(t){return t!=="normal"&&ve(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Rp(){return Oc(new bl)}function Hv(e){return e instanceof bl}var gv=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:dy(ir(vs(this,"next")),ir(vs(t,"next")))<0}getNode(){let t=Rn(this.key);return t===null&&ve(20),t}set(t,n,o,r){let a=this._selection,s=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,Rl()||(ds()===s&&Fn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function ur(e,t,n){return new gv(e,t,n)}function Kh(e,t){let n=t.__key,o=e.offset,r="element";if(Ue(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!me(t)){let a=t.getNextSibling();if(Ue(a))n=a.__key,o=0,r="text";else{let s=t.getParent();s&&(n=s.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function W0(e,t){if(me(t)){let n=t.getLastDescendant();me(n)||Ue(n)?Kh(e,n):Kh(e,t)}else Kh(e,t)}var Cp=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(!Mc(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(Ue(r))a=r.select();else{let s=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(s,s)}a.insertNodes(t);for(let s=0;s<o;s++)n[s].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=Rn(r);a!==null&&o.push(a)}return Rl()||(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((Nt()||hi())===this&&t[0]){let n=zn(t[0],"next");jP(hs(n,n))}for(let n of t)n.remove()}};function Ge(e){return e instanceof pi}var pi=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!!Ge(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,s]=o.getTextSlices();a&&r.push(a.caret.origin);let i=new Set,l=new Set;for(let d of o)if(dr(d)){let{origin:c}=d;r.length===0?i.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;me(c)&&l.has(c)||r.push(c)}if(s&&r.push(s.caret.origin),gi(o.focus)&&me(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=ha(o.focus.origin,"previous");dr(d)&&i.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Ll(d))i.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!me(d)||l.has(d)||d.isEmpty()||i.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=ir(o.anchor),c=ir(o.anchor.getFlipped()),f=m=>ga(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(uy(wv(this),"next"));return Rl()||(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,s=r.isBefore(a),[i,l]=hv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(me(p)&&!p.isInline())c||(d+=`
3780
+ `),c=!p.isEmpty();else if(c=!1,Ue(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=i<l?m.slice(i,l):m.slice(l,i)):m=s?m.slice(i):m.slice(l):p===o&&(m=s?m.slice(0,l):m.slice(0,i)),d+=m}else!Yt(p)&&!di(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Gt(),o=n.getEditorState()._selection,r=mP(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,s]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(s.key,s.offset,s.type,!0),cp(this)}clone(){let t=this.anchor,n=this.focus;return new e(ur(t.key,t.offset,t.type),ur(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Ac(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=Yn[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 s=n[a];s===`
3830
3781
  `||s===`\r
3831
- `?o.push(Sl()):s===" "?o.push(Ep()):o.push(_n(s))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,s=n,i=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,i=n),s.type==="element"&&(function(v,y,C,x){let b=v.getNode(),T=b.getChildAtIndex(v.offset),I=_n();if(I.setFormat(C),I.setStyle(x),PP(T))T.splice(0,0,[I]);else{let k=$n(b)?ma().append(I):I;T===null?b.append(k):T.insertBefore(k)}v.is(y)&&y.set(I.__key,0,"text"),v.set(I.__key,0,"text")})(s,i,r,a),i.type==="element"&&El(i,dr(ms(i,"next")));let l=s.offset,d=i.offset,c=this.getNodes(),f=c.length,p=c[0];Ue(p)||ve(26);let m=p.getTextContent().length,g=p.getParentOrThrow(),h=c[f-1];if(f===1&&i.type==="element"&&(d=m,i.set(s.key,d,"text")),this.isCollapsed()&&l===m&&(ua(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Ue(v)&&v.canInsertTextBefore()&&!ua(v)||(v=_n(),v.setFormat(r),v.setStyle(a),g.canInsertTextAfter()?p.insertAfter(v):g.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(ua(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Ue(v)&&!ua(v)||(v=_n(),v.setFormat(r),g.canInsertTextBefore()?p.insertBefore(v):g.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=_n(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||me(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),hP(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(is(p)){let x=_n(t);return x.select(),void p.replace(x)}let v=p.getFormat(),y=p.getStyle();if(l!==d||v===r&&y===a){if($v(p)){let x=_n(t);return x.setFormat(r),x.setStyle(a),x.select(),void p.replace(x)}}else{if(p.getTextContent()!==""){let x=_n(t);if(x.setFormat(r),x.setStyle(a),x.select(),l===0)p.insertBefore(x,!1);else{let[b]=p.splitText(l);b.insertAfter(x,!1)}return void(x.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let C=d-l;p=p.spliceText(l,C,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=y,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...h.getParentKeys()]),y=me(p)?p:p.getParentOrThrow(),C=me(h)?h:h.getParentOrThrow(),x=h;if(!y.is(C)&&C.isInline())do x=C,C=C.getParentOrThrow();while(C.isInline());if(i.type==="text"&&(d!==0||h.getTextContent()==="")||i.type==="element"&&h.getIndexWithinParent()<d)if(Ue(h)&&!is(h)&&d!==h.getTextContentSize()){if(h.isSegmented()){let P=_n(h.getTextContent());h.replace(P),h=P}$n(i.getNode())||i.type!=="text"||(h=h.spliceText(0,d,"")),v.add(h.__key)}else{let P=h.getParentOrThrow();P.canBeEmpty()||P.getChildrenSize()!==1?h.remove():P.remove()}else v.add(h.__key);let b=C.getChildren(),T=new Set(c),I=y.is(C),k=y.isInline()&&p.getNextSibling()===null?y:p;for(let P=b.length-1;P>=0;P--){let w=b[P];if(w.is(p)||me(w)&&w.isParentOf(p))break;w.isAttached()&&(!T.has(w)||w.is(x)?I||k.insertAfter(w,!1):w.remove())}if(!I){let P=C,w=null;for(;P!==null;){let L=P.getChildren(),A=L.length;(A===0||L[A-1].is(w))&&(v.delete(P.__key),w=P),P=P.getParent()}}if(is(p))if(l===m)p.select();else{let P=_n(t);P.select(),p.replace(P)}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 P=1;P<f;P++){let w=c[P],L=w.__key;v.has(L)||w.remove()}}}removeText(){let t=_t()===this;xc(this,JP(Pv(this))),t&&_t()!==this&&yo(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void On(null);let o=this.getNodes(),r=[];for(let b of o)Ue(b)&&r.push(b);let a=b=>{o.forEach(T=>{if(me(T)){let I=T.getFormatFlags(t,b);T.setTextFormat(I)}})},s=r.length;if(s===0)return this.toggleFormat(t),On(null),void a(n);let i=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:i,f=d?i:l,p=0,m=r[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===m.getTextContentSize()&&(p=1,m=r[1],g=0),m==null)return;let h=m.getFormatFlags(t,n);a(h);let v=s-1,y=r[v],C=f.type==="text"?f.offset:y.getTextContentSize();if(m.is(y)){if(g===C)return;if(ua(m)||g===0&&C===m.getTextContentSize())m.setFormat(h);else{let b=m.splitText(g,C),T=g===0?b[0]:b[1];T.setFormat(h),c.type==="text"&&c.set(T.__key,0,"text"),f.type==="text"&&f.set(T.__key,C-g,"text")}return void(this.format=h)}g===0||ua(m)||([,m]=m.splitText(g),g=0),m.setFormat(h);let x=y.getFormatFlags(t,h);C>0&&(C===y.getTextContentSize()||ua(y)||([y]=y.splitText(C)),y.setFormat(x));for(let b=p+1;b<v;b++){let T=r[b],I=T.getFormatFlags(t,x);T.setFormat(I)}c.type==="text"&&c.set(m.__key,g,"text"),f.type==="text"&&f.set(y.__key,C,"text"),this.format=h|x}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=_t();return Ge(g)||ve(134),g.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=yc(n,pa),r=t[t.length-1];if(me(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Vh(this);o.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(me(g)||Xt(g))&&!g.isInline())){me(o)||ve(211,n.constructor.name,n.getType());let g=Vh(this);return o.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=ma(),v=null;for(let y=0;y<g.length;y++){let C=g[y],x=pi(C);if(x||Xt(C)&&C.isInline()||me(C)&&C.isInline()||Ue(C)||C.isParentRequired()){if(v===null&&(v=C.createParentElementNode(),h.append(v),x))continue;v!==null&&v.append(C)}else h.append(C),v=null}return h})(t),s=a.getLastDescendant(),i=a.getChildren(),l=!me(o)||!o.isEmpty()?this.insertParagraph():null,d=i[i.length-1],c=i[0];var f;me(f=c)&&pa(f)&&!f.isEmpty()&&me(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(me(o)||ve(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=i[1]),c&&(o===null&&ve(212,n.constructor.name,n.getType()),(function(g,h){let v=h.getParentOrThrow().getLastChild(),y=h,C=[h];for(;y!==v;)y.getNextSibling()||ve(140),y=y.getNextSibling(),C.push(y);let x=g;for(let b of C)x=x.insertAfter(b)})(o,c));let p=yc(s,pa);l&&me(p)&&(l.canMergeWhenEmpty()||pa(d))&&(p.append(...l.getChildren()),l.remove()),me(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let m=me(o)?o.getLastChild():null;pi(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=ma();return Po().splice(this.anchor.offset,0,[s]),s.select(),s}let t=Vh(this),n=yc(this.anchor.getNode(),pa);me(n)||ve(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=Sl();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,s]=yv(this),i=this.isBackward(),[l,d]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=i?[s,a]:[a,s];if(n===0)return[];if(n===1){if(Ue(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(Ue(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Ue(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(rT(this,t,n,o))return;let r=t==="move",a=jt(),s=gr(ko(a));if(!s)return;let i=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||i===null||!me(d)||d.isInline()||d.canBeEmpty()||bv(i,a,l),this.dirty){let c=Pl(a,this.anchor.key),f=Pl(a,this.focus.key);this.anchor.type==="text"&&(c=yi(c)),this.focus.type==="text"&&(f=yi(f)),c&&f&&xP(s,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(s,t,n?"backward":"forward",o),s.rangeCount>0){let c=s.getRangeAt(0),f=this.anchor.getNode(),p=$n(f)?f:KP(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),g=[],h=!1;for(let v=0;v<m.length;v++){let y=m[v];Tp(y,p)?g.push(y):h=!0}if(h&&g.length>0)if(n){let v=g[0];me(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=g[g.length-1];me(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}s.anchorNode===c.startContainer&&s.anchorOffset===c.startOffset||(function(v){let y=v.focus,C=v.anchor,x=C.key,b=C.offset,T=C.type;C.set(y.key,y.offset,y.type,!0),y.set(x,b,T,!0)})(this)}}o==="lineboundary"&&rT(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&me(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(me(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=dy(ms(o,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(ur(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(i.type==="merge-block")break;if(me(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=dr(l);xc(this,ps(d,d)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:l,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(Ci(l)){if(me(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else i={block:l.origin,type:"merge-next-block"};continue}if(Xt(l.origin)){if(!l.origin.isIsolated())if(i.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&me(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=qv();d.add(l.origin.getKey()),yo(d)}else l.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:l,block:d}=i;return xc(this,ps(!l.origin.isEmpty()&&d.isEmpty()?_l(Un(d,l.direction)):a.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&Y0(this,o.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,i!==null&&i.isSegmented()){let l=s.offset,d=i.getTextContentSize();if(i.is(r)||t&&l!==d||!t&&l!==0)return void J0(i,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(i)||t&&l!==0||!t&&l!==d)return void J0(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 g=c.offset,h=f.offset,v=g<h,y=v?g:h,C=v?h:g,x=C-1;y!==x&&(function(b){return!(DP(b)||F5(b))})(p.getTextContent().slice(y,C))&&(d?f.set(f.key,x,f.type):c.set(c.key,x,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()&&$n(o.getParent())&&o.getPreviousSibling()===null&&Y0(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 Nc(e){return e instanceof xp}function X0(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function yv(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]:[X0(n),X0(o)]}function Y0(e,t){for(let n=t;n;n=n.getParent()){if(me(n)){if(n.collapseAtStart(e))return!0;if(Vo(n))break}if(n.getPreviousSibling())break}return!1}var F5=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function J0(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let d=0;d<a;d++){let c=d===a-1;if(i=s,s+=r[d].length,t&&s===n||s>n||c){r.splice(d,1),c&&(i=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(i,i))}function Z0(e,t,n,o){let r,a=t;if(io(e)){let s=!1,i=e.childNodes,l=i.length,d=o._blockCursorElement;a===l&&(s=!0,a=l-1);let c=i[a],f=!1;if(c===d)c=i[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=vl(c),Ue(r))a=fr(r,s?"next":"previous");else{let p=vl(e);if(p===null)return null;if(me(p)){let m=o.getElementByKey(p.getKey());m===null&&ve(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),me(p)||ve(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(me(h)&&(function(v,y,C){let x=v.getParent();return C===null||x===null||!x.canBeEmpty()||x!==C.getNode()})(h,0,n)){let v=s?h.getLastDescendant():h.getFirstDescendant();v===null?p=h:(h=v,p=me(h)?h:h.getParentOrThrow()),a=0}Ue(h)?(r=h,p=null,a=fr(h,s?"next":"previous")):h!==p&&s&&!f&&(me(p)||ve(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Xt(p)&&vl(e)===p?m:m+1,p=p.getParentOrThrow()}if(me(p))return pr(p.__key,a,"element")}}else r=vl(e);return Ue(r)?pr(r.__key,fr(r,a,"clamp"),"text"):null}function eT(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((n||!t)&&a===null&&me(s)&&s.isInline()){let i=s.getPreviousSibling();Ue(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else me(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Ue(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&me(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&me(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();Ue(i)&&e.set(i.__key,0,"text")}}}function hP(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);eT(e,o,r),eT(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function vP(e,t,n,o,r,a){if(e===null||n===null||!_c(r,e,n))return null;let s=Z0(e,t,Ge(a)?a.anchor:null,r);if(s===null)return null;let i=Z0(n,o,Ge(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let l=vl(e),d=vl(n);if(Xt(l)&&Xt(d))return null}return hP(s,i),[s,i]}function B5(e){return me(e)&&!e.isInline()}function yP(e,t,n,o,r,a){let s=va(),i=new vi(pr(e,t,r),pr(n,o,a),0,"");return i.dirty=!0,s._selection=i,i}function CP(){let e=pr("root",0,"element"),t=pr("root",0,"element");return new vi(e,t,0,"")}function qv(){return new xp(new Set)}function U5(e,t){return Mp(null,e,t,null)}function Mp(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,s=a?a.type:void 0,i=s==="selectionchange",l=!Jh&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),d,c,f,p;if(Ge(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&Ge(e)&&!_c(n,d,c))return e.clone();let m=vP(d,f,c,p,n,e);if(m===null)return null;let[g,h]=m,v=0,y="";if(Ge(e)){let C=e.anchor;if(g.key===C.key)v=e.format,y=e.style;else{let x=g.getNode();Ue(x)?(v=x.getFormat(),y=x.getStyle()):me(x)&&(v=x.getTextFormat(),y=x.getTextStyle())}}return new vi(g,h,v,y)}function _t(){return va()._selection}function xi(){return jt()._editorState._selection}function bp(e,t,n,o=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))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"),tT(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 g=c.offset;(n<=g&&o>0||n<g&&o<0)&&c.set(l,Math.max(0,g+o),"element")}if(t.is(m)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}tT(e)}function tT(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),s=o.getNode();if(e.isCollapsed()){if(!me(a))return;let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(me(a)){let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(me(s)){let i=s.getChildrenSize(),l=r>=i,d=l?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function Sp(e,t,n,o,r){let a=null,s=0,i=null;o!==null?(a=o.__key,Ue(o)?(s=o.getTextContentSize(),i="text"):me(o)&&(s=o.getChildrenSize(),i="element")):r!==null&&(a=r.__key,Ue(r)?i="text":me(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function nT(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 xP(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function oT(e,t,n){let o=Pl(e,t.getKey());if(me(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function z5(e,t,n,o,r,a,s){let i=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(dP)&&f!==a||f!==null&&Xv(f))return;if(!Ge(t))return void(e!==null&&_c(n,i,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,g=p.getNode(),h=m.getNode(),[v,y]=oT(n,g,p.offset),[C,x]=oT(n,h,m.offset),b=t.format,T=t.style,I=t.isCollapsed(),k=v,P=C,w=!1;var L,A,M,R,D;if(p.type==="text"?(k=yi(v),w=g.getFormat()!==b||g.getStyle()!==T):Ge(e)&&e.anchor.type==="text"&&(w=!0),m.type==="text"&&(P=yi(C)),k!==null&&P!==null&&(I&&(e===null||w||Ge(e)&&(e.format!==b||e.style!==T))&&(L=b,A=T,M=y,R=p.key,D=performance.now(),nP=[L,A,M,R,D]),d!==y||c!==x||i!==k||l!==P||o.type==="Range"&&I||(f!==null&&a.contains(f)||r.has(hv)||a.focus({preventScroll:!0}),p.type==="element"))){if(xP(o,k,y,P,x),!ds||!t.isCollapsed()||a===null||r.has(hv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(cP)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let H=Ge(t)&&t.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(H!==null){let W;if(H instanceof Text){let F=document.createRange();F.selectNode(H),W=F.getBoundingClientRect()}else W=H.getBoundingClientRect();(function(F,J,O){let B=oy(O),Y=ry(B);if(B===null||Y===null)return;let{top:U,bottom:j}=J,oe=0,Q=0,ne=O;for(;ne!==null;){let re=ne===B.body;if(re)oe=0,Q=ko(F).innerHeight;else{let te=ne.getBoundingClientRect();oe=te.top,Q=te.bottom}let Z=0;if(U<oe?Z=-(oe-U):j>Q&&(Z=j-Q),Z!==0)if(re)Y.scrollBy(0,Z);else{let te=ne.scrollTop;ne.scrollTop+=Z;let ue=ne.scrollTop-te;U-=ue,j-=ue}if(re)break;ne=Oc(ne)}})(n,W,a)}}pv=!0}}function H5(e){let t=_t()||xi();t===null&&(t=Po().selectEnd()),t.insertNodes(e)}function K5(){let e=_t();return e===null?"":e.getTextContent()}function Vh(e){let t=e;e.isCollapsed()||t.removeText();let n=_t();Ge(n)&&(t=n),Ge(t)||ve(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!pa(r);){let s=r;if([r,a]=$5(r,a),s.is(r))break}return a}function $5(e,t){let n=e.getParent();if(!n){let r=ma();return Po().append(r),r.select(),[Po(),0]}if(Ue(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(!me(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new vi(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 rT(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=ms(e.focus,n?"previous":"next"),s=o==="lineboundary",i=t==="move",l=a,d=r==="decorators-and-blocks";if(!ZP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!Xt(f)||f.isIsolated()||(l=c,!s||!f.isInline()))break}if(d)for(let c of dy(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(ur(c))c.origin.isInline()||(l=c);else{if(me(c.origin))continue;Xt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(i&&!s&&Xt(l.origin)&&l.origin.isKeyboardSelectable()){let c=qv();return c.add(l.origin.getKey()),yo(c),!0}return l=dr(l),i&&El(e.anchor,l),El(e.focus,l),d||!s}var Fn=null,Bn=null,vo=!1,Wh=!1,lp=0,aT={characterData:!0,childList:!0,subtree:!0};function Ml(){return vo||Fn!==null&&Fn._readOnly}function Dn(){vo&&ve(13)}function bP(){lp>99&&ve(14)}function va(){return Fn===null&&ve(195,SP()),Fn}function jt(){return Bn===null&&ve(196,SP()),Bn}function SP(){let e=0,t=new Set,n=us.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=Dc(r);if(_p(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}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 q5(){return Bn}function sT(e,t,n){let o=t.__type,r=jv(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function iT(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function IP(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 V5(e){return Vv(e,jt()._nodes)}function Vv(e,t){let n=e.type,o=t.get(n);o===void 0&&ve(17,n);let r=o.klass;e.type!==r.getType()&&ve(18,r.name);let a=r.importJSON(e),s=e.children;if(me(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let l=Vv(s[i],t);a.append(l)}return a}function lT(e,t,n){let o=Fn,r=vo,a=Bn;Fn=t,vo=!0,Bn=e;try{return n()}finally{Fn=o,vo=r,Bn=a}}function fa(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,s=a._selection,i=n._selection,l=e._dirtyType!==0,d=Fn,c=vo,f=Bn,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Bn=e,Fn=n,vo=!1,e._updating=!0;try{let I=e._dirtyType,k=e._dirtyElements,P=e._dirtyLeaves;m.disconnect(),g=c5(a,n,e,I,k,P)}catch(I){if(I instanceof Error&&e._onError(I),Wh)throw I;return kP(e,null,o,n),LT(e),e._dirtyType=2,Wh=!0,fa(e,a),void(Wh=!1)}finally{m.observe(o,aT),e._updating=p,Fn=d,vo=c,Bn=f}}n._readOnly||(n._readOnly=!0);let h=e._dirtyLeaves,v=e._dirtyElements,y=e._normalizedNodes,C=e._updateTags,x=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(I,k){let P=I._decorators,w=I._pendingDecorators||P,L=k._nodeMap,A;for(A in w)L.has(A)||(w===P&&(w=NP(I)),delete w[A])})(e,n);let b=r?null:gr(ko(e));if(e._editable&&b!==null&&(l||i===null||i.dirty||!i.is(s))&&o!==null&&!C.has(uP)){Bn=e,Fn=n;try{if(m!==null&&m.disconnect(),l||i===null||i.dirty){let I=e._blockCursorElement;I!==null&&bv(I,e,o),z5(s,i,e,b,C,o)}(function(I,k,P){let w=I._blockCursorElement;if(Ge(P)&&P.isCollapsed()&&P.anchor.type==="element"&&k.contains(document.activeElement)){let L=P.anchor,A=L.getNode(),M=L.offset,R=!1,D=null;if(M===A.getChildrenSize())jh(A.getChildAtIndex(M-1))&&(R=!0);else{let H=A.getChildAtIndex(M);if(H!==null&&jh(H)){let W=H.getPreviousSibling();(W===null||jh(W))&&(R=!0,D=I.getElementByKey(H.__key))}}if(R){let H=I.getElementByKey(A.__key);return w===null&&(I._blockCursorElement=w=(function(W){let F=W.theme,J=document.createElement("div");J.contentEditable="false",J.setAttribute("data-lexical-cursor","true");let O=F.blockCursor;if(O!==void 0){if(typeof O=="string"){let B=Uc(O);O=F.blockCursor=B}O!==void 0&&J.classList.add(...O)}return J})(I._config)),k.style.caretColor="transparent",void(D===null?H.appendChild(w):H.insertBefore(w,D))}}w!==null&&bv(w,I,k)})(e,o,i)}finally{m!==null&&m.observe(o,aT),Bn=f,Fn=d}}g!==null&&(function(I,k,P,w,L){let A=Array.from(I._listeners.mutation),M=A.length;for(let R=0;R<M;R++){let[D,H]=A[R];for(let W of H){let F=k.get(W);F!==void 0&&D(F,{dirtyLeaves:w,prevEditorState:L,updateTags:P})}}})(e,g,C,h,a),Ge(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(Ev,void 0);let T=e._pendingDecorators;T!==null&&(e._decorators=T,e._pendingDecorators=null,vc("decorator",e,!0,T)),(function(I,k,P){let w=fT(k),L=fT(P);w!==L&&vc("textcontent",I,!0,L)})(e,t||a,n),vc("update",e,!0,{dirtyElements:v,dirtyLeaves:h,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:t||a,tags:C}),(function(I,k){if(I._deferred=[],k.length!==0){let P=I._updating;I._updating=!0;try{for(let w=0;w<k.length;w++)k[w]()}finally{I._updating=P}}})(e,x),(function(I){let k=I._updates;if(k.length!==0){let P=k.shift();if(P){let[w,L]=P;Np(I,w,L)}}})(e)}function vc(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,o)}finally{t._updating=r}}function dT(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,s]=r,i=e._pendingEditorState,l;s!==void 0&&(l=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete&&(i===null&&ve(191),i._flushSync=!0),l&&e._deferred.push(l),IP(e,s.tag)),i==null?Np(e,a,s):a()}}return o}function Np(e,t,n){let o=e._updateTags,r,a=!1,s=!1;n!==void 0&&(r=n.onUpdate,IP(e,n.tag),a=n.skipTransforms||!1,s=n.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=wP(l||i),d=!0),l._flushSync=s;let c=Fn,f=vo,p=Bn,m=e._updating;Fn=l,vo=!1,e._updating=!0,Bn=e;let g=e._headless||e.getRootElement()===null;Gv(null);try{d&&(g?i._selection!==null&&(l._selection=i._selection.clone()):l._selection=(function(C,x){let b=C.getEditorState()._selection,T=gr(ko(C));return Ge(b)||b==null?Mp(b,T,C,x):b.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=dT(e,a),(function(C,x){let b=x.getEditorState()._selection,T=C._selection;if(Ge(T)){let I=T.anchor,k=T.focus,P;if(I.type==="text"&&(P=I.getNode(),P.selectionTransform(b,T)),k.type==="text"){let w=k.getNode();P!==w&&w.selectionTransform(b,T)}}})(l,e),e._dirtyType!==0&&(a?(function(C,x){let b=x._dirtyLeaves,T=C._nodeMap;for(let I of b){let k=T.get(I);Ue(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&F0(k)}})(l,e):(function(C,x){let b=x._dirtyLeaves,T=x._dirtyElements,I=C._nodeMap,k=ss(),P=new Map,w=b,L=w.size,A=T,M=A.size;for(;L>0||M>0;){if(L>0){x._dirtyLeaves=new Set;for(let R of w){let D=I.get(R);Ue(D)&&D.isAttached()&&D.isSimpleText()&&!D.isUnmergeable()&&F0(D),D!==void 0&&iT(D,k)&&sT(x,D,P),b.add(R)}if(w=x._dirtyLeaves,L=w.size,L>0){lp++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let R of A){let D=R[0],H=R[1];if(T.set(D,H),!H)continue;let W=I.get(D);W!==void 0&&iT(W,k)&&sT(x,W,P)}w=x._dirtyLeaves,L=w.size,A=x._dirtyElements,M=A.size,lp++}x._dirtyLeaves=b,x._dirtyElements=T})(l,e),dT(e),(function(C,x,b,T){let I=C._nodeMap,k=x._nodeMap,P=[];for(let[w]of T){let L=k.get(w);L!==void 0&&(L.isAttached()||(me(L)&&TT(L,w,I,k,P,T),I.has(w)||T.delete(w),P.push(w)))}for(let w of P)k.delete(w);for(let w of b){let L=k.get(w);L===void 0||L.isAttached()||(I.has(w)||b.delete(w),k.delete(w))}})(i,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let y=l._selection;if(Ge(y)){let C=l._nodeMap,x=y.anchor.key,b=y.focus.key;C.get(x)!==void 0&&C.get(b)!==void 0||ve(19)}else Nc(y)&&y._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void fa(e)}finally{Fn=c,vo=f,Bn=p,e._updating=m,lp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,y){let C=y.getEditorState()._selection,x=v._selection;if(x!==null){if(x.dirty||!x.is(C))return!0}else if(C!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,fa(e)):d&&eK(()=>{fa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Br(e,t,n){Bn===e&&n===void 0?t():Np(e,t,n)}var Cv=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&&ve(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&ve(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&ve(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"&&(Lp||Mc||kp);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 s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,a),o.__lexicalLineBreak=s}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=cT(n,o);a.push(r);let s=cT(n,this.element),i=t.getIndexWithinParent();for(let l=0;l<s.length;l++){let d=a[l],c=s[l];if(d===void 0||d<c)break;if(d>c){i+=1;break}}return[t.getParentOrThrow(),i]}};function cT(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&&ve(225),n.reverse()}var cs=class extends qo{__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 XH[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=jt()._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(Ue(n)&&t.push(n),me(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;me(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;me(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 me(a)&&a.getLastDescendant()||a||null}let r=n[t];return me(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Rn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&ve(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Rn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&ve(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(),me(a)&&r!==o-1&&!a.isInline()&&(t+=Ap)}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(),me(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=Yh[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=Xn[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Rc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Dn();let o=_t(),r=t,a=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Ue(l)||me(l))return l.select(0,0)}else if(!(t!==void 0&&t!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(Ue(l)||me(l))return l.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return Ge(o)?(o.anchor.set(i,r,"element"),o.focus.set(i,a,"element"),o.dirty=!0,o):yP(i,r,i,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!==""?Yh[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){Cp(this)&&ve(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||ve(226,String(t),String(n),String(r));let s=a.__key,i=[],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 g=0;g<n;g++){m===null&&ve(100);let h=m.getNextSibling(),v=m.__key;ls(m.getWritable()),l.push(v),m=h}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let g=m.getWritable();g.__parent===s&&f--,ls(g);let h=m.__key;if(p===null)a.__first=h,g.__prev=null;else{let v=p.getWritable();v.__next=h,g.__prev=v.__key}m.__key===s&&ve(76),g.__parent=s,i.push(h),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 g=p.getWritable();m.__prev=p.__key,g.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=_t();if(Ge(m)){let g=new Set(l),h=new Set(i),{anchor:v,focus:y}=m;uT(v,g,h)&&Sp(v,v.getNode(),this,c,d),uT(y,g,h)&&Sp(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||Vo(this)||this.remove()}}return a}getDOMSlot(t){return new Cv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(io(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===""||Vo(this)||this.getChildren().some(Ue)||(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 s=n.getElementByKey(a.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function me(e){return e instanceof cs}function uT(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 Lc=class extends qo{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Xt(e){return e instanceof Lc}var wl=class e extends cs{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ve(51)}getTextContent(){let t=this.__cachedText;return!Ml()&&jt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){ve(52)}replace(t){ve(53)}insertBefore(t){ve(54)}insertAfter(t){ve(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)me(r)||Xt(r)||ve(282);return super.splice(t,n,o)}static importJSON(t){return Po().updateFromJSON(t)}collapseAtStart(){return!0}};function $n(e){return e instanceof wl}function wP(e){return new Ac(new Map(e._nodeMap))}function Wv(){return new Ac(new Map([["root",new wl]]))}function TP(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ve(130,n.name),me(e)){let o=t.children;Array.isArray(o)||ve(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=TP(r[a]);o.push(s)}}return t}function W5(e){return e instanceof Ac}var Ac=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 lT(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 lT(null,this,()=>({root:TP(Po())}))}},Ip=class extends cs{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Tl=class e extends cs{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=xl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:G5,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(io(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return ma().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Ue);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=ma();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||Ue(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function G5(e){let t=ma();if(e.style&&(t.setFormat(e.style.textAlign),GP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Yh&&t.setFormat(n)}return{node:t}}function ma(){return Fc(new Tl)}function PP(e){return e instanceof Tl}var hl=0,j5=1,Q5=2,X5=3,Y5=4;function kP(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=Wv(),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 LP(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Bc(o),a=o.transform;if(!n.has(a)){n.add(a);let s=o.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),o=r.extends}else{let s=Object.getPrototypeOf(o);o=s.prototype instanceof qo&&s!==qo?s:void 0}}return t}function J5(e){let t=e||{},n=q5(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,s=Wv(),i=t.namespace||(r!==null?r._config.namespace:OP()),l=t.editorState,d=[wl,hi,bl,Il,Tl,Ip,...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 h=0;h<d.length;h++){let v=d[h],y=null,C=null;if(typeof v!="function"){let T=v;v=T.replace,y=T.with,C=T.withKlass||null}Bc(v);let x=v.getType(),b=LP(v);m.set(x,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:C,sharedNodeState:AT(d[h]),transforms:b})}}let g=new us(s,r,m,{disableEvents:a,namespace:i,theme:o},c||console.error,(function(h,v){let y=new Map,C=new Set,x=b=>{Object.keys(b).forEach(T=>{let I=y.get(T);I===void 0&&(I=[],y.set(T,I)),I.push(b[T])})};return h.forEach(b=>{let T=b.klass.importDOM;if(T==null||C.has(T))return;C.add(T);let I=T.call(b.klass);I!==null&&x(I)}),v&&x(v),y})(m,f?f.import:void 0),p,e);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=2),(function(h){h.registerCommand(Mv,x5,hl),h.registerCommand(Nv,b5,hl),h.registerCommand(_v,S5,hl),h.registerCommand(Dv,I5,hl),h.registerCommand(Uv,w5,hl)})(g),g}var us=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,s,i,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=OP(),this._onError=a,this._htmlConversions=s,this._editable=i,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&&ve(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&&ve(36,String(t));let s=a[o];return s.add(n),()=>{s.delete(n),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(n);s===void 0&&(s=new Set,a.set(n,s)),s.add(r);let i=o&&o.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&ve(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=Iv(o).get(n.getType());if(!r)return;let a=new Map;for(let s of r.keys())a.set(s,"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 s=this.registerNodeTransformToKlass(a,n);r.push(s)}return(function(s,i){let l=Iv(s.getEditorState()),d=[];for(let c of i){let f=l.get(c);f&&d.push(f)}d.length!==0&&s.update(()=>{for(let c of d)for(let f of c.keys()){let p=Rn(f);p&&p.markDirty()}},s._pendingEditorState===null?{tag:ip}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Re(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=xl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,kP(this,n,t,r),n!==null&&(this._config.disableEvents||T5(n),o!=null&&n.classList.remove(...o)),t!==null){let a=ry(t),s=t.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,LT(this),this._updateTags.add(ip),fa(this),this._config.disableEvents||(function(i,l){let d=i.ownerDocument;fv.set(i,d);let c=vp.get(d)??0;c<1&&d.addEventListener("selectionchange",iP),vp.set(d,c+1),i.__lexicalEditor=l;let f=sP(i);for(let p=0;p<uv.length;p++){let[m,g]=uv[p],h=typeof g=="function"?v=>{q0(v)||($0(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(q0(v))return;$0(v);let y=l.isEditable();switch(m){case"cut":return y&&Re(l,Hv,v);case"copy":return Re(l,zv,v);case"paste":return y&&Re(l,Ov,v);case"dragstart":return y&&Re(l,jT,v);case"dragover":return y&&Re(l,QT,v);case"dragend":return y&&Re(l,XT,v);case"focus":return y&&Re(l,YT,v);case"blur":return y&&Re(l,JT,v);case"drop":return y&&Re(l,GT,v)}};i.addEventListener(m,h),f.push(()=>{i.removeEventListener(m,h)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(ip),fa(this);vc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&ve(38);let o=t;o._readOnly&&(o=wP(t),o._selection=t._selection?t._selection.clone():null),kT(this);let r=this._pendingEditorState,a=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),fa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||fa(this)}parseEditorState(t,n){return(function(o,r,a){let s=Wv(),i=Fn,l=vo,d=Bn,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,Fn=s,vo=!1,Bn=r,Gv(null);try{let g=r._nodes;Vv(o.root,g),a&&a(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Fn=i,vo=l,Bn=d}return s})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return fa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Np(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),Br(this,()=>{let r=_t(),a=Po();r!==null?r.dirty||yo(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Fp("focus"),HP(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=gr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,vc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};us.version="0.41.0+prod.esm";var xv=null;function Gv(e){xv=e}var AP=1;function Z5(){AP=1}function jv(e,t){let n=Qv(e,t);return n===void 0&&ve(30,t),n}function Qv(e,t){return e._nodes.get(t)}var eK=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function RP(e){return Xt(Op(e))}function Xv(e){let t=document.activeElement;if(!io(t))return!1;let n=t.nodeName;return Xt(Op(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&Dc(t)==null)}function _c(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Xv(t)&&Yv(t)===e}catch{return!1}}function _p(e){return e instanceof us}function Yv(e){let t=e;for(;t!=null;){let n=Dc(t);if(_p(n))return n;t=Oc(t)}return null}function Dc(e){return e?e.__lexicalEditor:null}function tK(e){return GH.test(e)?"rtl":jH.test(e)?"ltr":null}function is(e){return $v(e)||e.isToken()}function ua(e){return is(e)||e.isSegmented()}function Ur(e){return Nl(e)&&e.nodeType===3}function EP(e){return Nl(e)&&e.nodeType===9}function yi(e){let t=e;for(;t!=null;){if(Ur(t))return t;t=t.firstChild}return null}function Rc(e,t,n){let o=Xn[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~Xn.superscript:t==="superscript"?r&=~Xn.subscript:t==="lowercase"?(r&=~Xn.uppercase,r&=~Xn.capitalize):t==="uppercase"?(r&=~Xn.lowercase,r&=~Xn.capitalize):t==="capitalize"&&(r&=~Xn.lowercase,r&=~Xn.uppercase),r}function nK(e){return Ue(e)||pi(e)||Xt(e)}function MP(e,t){let n=(function(){let s=xv;return xv=null,s})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Dn(),bP();let o=jt(),r=va(),a=""+AP++;r._nodeMap.set(a,e),me(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function ls(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=s),a===null&&(o.__last=i),l!==null&&(l.__next=s),d!==null&&(d.__prev=i),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function wp(e){bP(),Cp(e)&&ve(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=va(),r=jt(),a=o._nodeMap,s=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,s);let i=t.__key;r._dirtyType=1,me(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function On(e){Dn();let t=jt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Rn(n);o!==null&&o.getWritable()}if(e!==null){let o=Rn(e);o!==null&&o.getWritable()}}}function ss(){return Ml()?null:jt()._compositionKey}function Rn(e,t){let n=(t||va())._nodeMap.get(e);return n===void 0?null:n}function Jv(e,t){let n=Dp(e,jt());return n!==void 0?Rn(n,t):null}function Dp(e,t){return e[`__lexicalKey_${t._key}`]}function Op(e,t){let n=e;for(;n!=null;){let o=Jv(n,t);if(o!==null)return o;n=Oc(n)}return null}function NP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function fT(e){return e.read(()=>Po().getTextContent())}function Po(){return _P(va())}function _P(e){return e._nodeMap.get("root")}function yo(e){Dn();let t=va();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function vl(e){let t=jt(),n=(function(o,r){let a=o;for(;a!=null;){let s=Dp(a,r);if(s!==void 0)return s;a=Oc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Rn("root"):null:Rn(n)}function DP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Zv(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function OP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function FP(e){return Ur(e)?e.nodeValue:null}function ey(e,t,n){let o=gr(ko(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:s}=o;if(r!==null){let i=FP(r),l=Op(r);if(i!==null&&Ue(l)){if((i===bc||i===Lv)&&n){let d=n.length;i=n,a=d,s=d}i!==null&&ty(l,i,a,s,e)}}}function ty(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(bc)&&(i=t.slice(0,-bc.length)),r)){let d=Lv,c;for(;(c=i.indexOf(d))!==-1;)i=i.slice(0,c)+i.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||i!==l){if(i===""){if(On(null),kp||Mc||Lp)a.remove();else{let h=jt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=xi(),f=a.getTextContentSize(),p=ss(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!s||Ge(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!s||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let g=_t();if(!Ge(g)||n===null||o===null)return void pT(a,i,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=_n(a.getTextContent());a.replace(h),a=h}pT(a,i,g)}}}function pT(e,t,n){if(e.setTextContent(t),Ge(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=fr(e,a.offset,"clamp"))}}}function tp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function BP(e,t){return tp(e,t,"altKey")&&tp(e,t,"ctrlKey")&&tp(e,t,"shiftKey")&&tp(e,t,"metaKey")}function Ht(e,t,n){if(!BP(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 ca={ctrlKey:!lr,metaKey:lr},mT={altKey:lr,ctrlKey:!lr};function gT(e){return e.key==="Backspace"}function hT(e){return Ht(e,"a",ca)}function oK(e){let t=Po();if(Ge(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"),up(e),e}{let n=t.select(0,t.getChildrenSize());return yo(up(n)),n}}function xl(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=Uc(r);return n[t]=a,a}return r}function ny(e,t,n,o,r){if(n.size===0)return;let a=o.__type,s=o.__key,i=t.get(a);i===void 0&&ve(33,a);let l=i.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(s),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(s,f?"updated":r)}function rK(e){let t=e.getType(),n=va();if(n._readOnly){let a=Iv(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 vT(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 UP(e,t){let n=e.offset;if(e.type==="element")return vT(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?vT(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function zP(e){let t=ko(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Re(e,t,n){return(function(o,r,a){let s=Zv(o);for(let i=4;i>=0;i--)for(let l=0;l<s.length;l++){let d=s[l],c=d._commands.get(r);if(c!==void 0){let f=c[i];if(f!==void 0){let p=Array.from(f),m=p.length,g=!1;if(Br(d,()=>{for(let h=0;h<m;h++)if(p[h](a,o))return void(g=!0)}),g)return g}}}return!1})(e,t,n)}function Pl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&ve(75,t),n}function Oc(e){let t=e.assignedSlot||e.parentElement;return VP(t)?t.host:t}function oy(e){return EP(e)?e:io(e)?e.ownerDocument:null}function aK(e){return jt()._updateTags.has(e)}function Fp(e){Dn(),jt()._updateTags.add(e)}function HP(e){Dn(),jt()._deferred.push(e)}function Tp(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function ry(e){let t=oy(e);return t?t.defaultView:null}function ko(e){let t=e._window;return t===null&&ve(78),t}function sK(e){return me(e)&&e.isInline()||Xt(e)&&e.isInline()}function KP(e){let t=e.getParentOrThrow();for(;t!==null;){if(Vo(t))return t;t=t.getParentOrThrow()}return t}function Vo(e){return $n(e)||me(e)&&e.isShadowRoot()}function ay(e){let t=e.constructor.clone(e);return MP(t,null),t.afterCloneFrom(e),t}function Fc(e){let t=jt(),n=e.getType(),o=Qv(t,n);o===void 0&&ve(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||ve(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,n):s instanceof e.constructor&&i!==e.constructor||ve(202,i.name,i.getType(),e.constructor.name,n),s.__key===e.__key&&ve(203,e.constructor.name,n,i.name,i.getType()),s}return e}function Gh(e,t){!$n(e.getParent())||me(t)||Xt(t)||ve(99)}function $P(e){let t=Rn(e);return t===null&&ve(63,e),t}function jh(e){return(Xt(e)||me(e)&&!e.canBeEmpty())&&!e.isInline()}function bv(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function gr(e){return mr?(e||window).getSelection():null}function qP(e){let t=ry(e);return t?t.getSelection():null}function iK(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),Vo(e)&&ve(102);let o=s=>{let i=s.getParentOrThrow(),l=Vo(i),d=s!==n||l?ay(s):s;if(l)return me(s)&&me(d)||ve(133),s.insertAfter(d),[s,d,d];{let[c,f,p]=o(i),m=s.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function lK(e){return io(e)&&e.tagName==="A"}function io(e){return Nl(e)&&e.nodeType===1}function Nl(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function VP(e){return Nl(e)&&e.nodeType===11}function WP(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 Sv(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 pa(e){if(Xt(e)&&!e.isInline())return!0;if(!me(e)||Vo(e))return!1;let t=e.getFirstChild(),n=t===null||pi(t)||Ue(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function sy(){return jt()}var yT=new WeakMap,dK=new Map;function Iv(e){if(!e._readOnly&&e.isEmpty())return dK;e._readOnly||ve(192);let t=yT.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let s=a.__type,i=o.get(s);i||(i=new Map,o.set(s,i)),i.set(r,a)}return o})(e),yT.set(e,t)),t}function iy(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function cK(e){return(t=iy(e))[lP]=!0,t;var t}function GP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function uK(e){e.__lexicalUnmanaged=!0}function jP(e){return e.__lexicalUnmanaged===!0}function pc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==qo[t]}function Bc(e){let t=R0 in e.prototype?e.prototype[R0]():void 0,n=(function(s){if(!(s===qo||s.prototype instanceof qo)){let i="<unknown>",l="<unknown>";try{i=s.getType()}catch{}try{us.version&&(l=JSON.parse(us.version))}catch{}ve(290,s.name,i,l)}return s===Lc||s===cs||s===qo})(e),o=!n&&pc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!n&&a&&(pc(e,"getType")||(e.getType=()=>a),pc(e,"clone")||(e.clone=s=>(Gv(s),new e)),pc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!pc(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function fK(e){let t=sy();return Dn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var yc=(e,t)=>{let n=e;for(;n!=null&&!$n(n);){if(t(n))return n;n=n.getParent()}return null},pK={next:"previous",previous:"next"},kl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return cy({hasNext:Ci,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Un(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Un(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,s=this.getParentAtCaret(),i=new Map;for(let l=a.getAdjacentCaret();l!==null&&i.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();i.set(d.getKey(),d)}for(let l of r){if(i.size>0){let d=a.getNodeAtCaret();if(d){if(i.delete(d.getKey()),i.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(s)&&l.remove(),d.replace(l)}}else d===null&&ve(263,Array.from(i).join(" "))}else a.insert(l);a=Un(l,this.direction)}for(let l of i.values())l.remove();return this}},Ec=class e extends kl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:ha(t,this.direction)}getParentCaret(t="root"){return Un(ly(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=hs(this.direction);return Un(this.getNodeAtCaret(),t)||ha(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)}},mK={root:$n,shadowRoot:Vo};function hs(e){return pK[e]}function ly(e,t="root"){return mK[t](e)?null:e}var Ll=class e extends kl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Un(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return me(this.origin)?ha(this.origin,this.direction):null}getParentCaret(t="root"){return Un(ly(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=hs(this.direction);return Un(this.getNodeAtCaret(),t)||ha(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 Al)&&this.direction===t.direction&&this.origin.is(t.origin)}},Al=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:fs(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Un(ly(this.getParentAtCaret(),t),this.direction)}getFlipped(){return fs(this.origin,hs(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 Ll||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Un(this.origin,this.direction)}};function ga(e){return e instanceof Al}function gK(e){return e instanceof kl}function Ci(e){return e instanceof Ll}function ur(e){return e instanceof Ec}var hK={next:class extends Al{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Al{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},vK={next:class extends Ll{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ll{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},yK={next:class extends Ec{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Ec{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Un(e,t){return e?new vK[t](e):null}function fs(e,t,n){return e?new hK[t](e,fr(e,n)):null}function fr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&bT(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function wv(e,t){return new Pp(e,t)}function ha(e,t){return me(e)?new yK[t](e):null}function QP(e){return e&&e.getChildCaret()||e}function Rl(e){return e&&QP(e.getAdjacentCaret())}var Tv=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 ga(a)?(function(s,i){let{direction:l,origin:d}=s,c=fr(d,i==="focus"?hs(l):l);return wv(s,c-s.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[wv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=ga(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=ga(o),a=s=>s.isSameNodeCaret(o)?null:Rl(s)||s.getParentCaret(t);return cy({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:a(n),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Pp=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 fs(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function CK(e){return e instanceof Pp}function dy(e){return ps(e,Un(Po(),e.direction))}function XP(e){return ps(e,e)}function ps(e,t){return e.direction!==t.direction&&ve(265),new Tv(e,t,e.direction)}function cy(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 s={done:!1,value:r(a)};return a=o(a),s}}}function uy(e,t){let n=Cc(e.origin,t.origin);switch(n===null&&ve(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,s){return Math.sign(a-s)})(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 fy(n)}}function fy(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,s=n;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===o)return 1}return a===null?1:-1}function np(e,t){return t.is(e)}function CT(e){return me(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Cc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=CT(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=CT(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(np(e,o)||ve(276),{commonAncestor:o,type:"ancestor"}):r===null?(np(t,o)||ve(277),{commonAncestor:o,type:"descendant"}):((me(a)||np(e,a))&&(me(r)||np(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||ve(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function ms(e,t){let{type:n,key:o,offset:r}=e,a=$P(e.key);return n==="text"?(Ue(a)||ve(266,a.getType(),o),fs(a,t,r)):(me(a)||ve(267,a.getType(),o),ek(a,e.offset,t))}function El(e,t){let{origin:n,direction:o}=t,r=o==="next";ga(t)?e.set(n.getKey(),t.offset,"text"):Ci(t)?Ue(n)?e.set(n.getKey(),fr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(ur(t)&&me(n)||ve(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function YP(e){let t=_t(),n=Ge(t)?t:CP();return xc(n,e),yo(n),n}function xc(e,t){El(e.anchor,t.anchor),El(e.focus,t.focus)}function Pv(e){let{anchor:t,focus:n}=e,o=ms(t,"next"),r=ms(n,"next"),a=uy(o,r)<=0?"next":"previous";return ps(gs(o,a),gs(r,a))}function _l(e){let{direction:t,origin:n}=e,o=Un(n,hs(t)).getNodeAtCaret();return o?Un(o,t):ha(n.getParentOrThrow(),t)}function xT(e,t="root"){let n=[e];for(let o=ur(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(_l(o));return n}function Qh(e){return!!e&&e.origin.isAttached()}function JP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=py(e,o),s=xT(a.anchor,n),i=xT(a.focus.getFlipped(),n),l=new Set,d=[];for(let g of a.iterNodeCarets(n))if(ur(g))l.add(g.origin.getKey());else if(Ci(g)){let{origin:h}=g;me(h)&&!l.has(h.getKey())||d.push(h)}for(let g of d)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,v=h.getTextContentSize(),y=_l(Un(h,o)),C=h.getMode();if(Math.abs(g.distance)===v&&r==="removeEmptySlices"||C==="token"&&g.distance!==0)y.remove();else if(g.distance!==0){r="removeEmptySlices";let x=g.removeTextSlice(),b=g.caret.origin;if(C==="segmented"){let T=x.origin,I=_n(T.getTextContent()).setStyle(T.getStyle()).setFormat(T.getFormat());y.replaceOrInsert(I),x=fs(I,o,x.offset)}b.is(s[0].origin)&&(s[0]=x),b.is(i[0].origin)&&(i[0]=x.getFlipped())}}let c,f;for(let g of s)if(Qh(g)){c=dr(g);break}for(let g of i)if(Qh(g)){f=dr(g);break}let p=(function(g,h,v){if(!g||!h)return null;let y=g.getParentAtCaret(),C=h.getParentAtCaret();if(!y||!C)return null;let x=y.getParents().reverse();x.push(y);let b=C.getParents().reverse();b.push(C);let T=Math.min(x.length,b.length),I;for(I=0;I<T&&x[I]===b[I];I++);let k=(L,A)=>{let M;for(let R=I;R<L.length;R++){let D=L[R];if(Vo(D))return;!M&&A(D)&&(M=D)}return M},P=k(x,pa),w=P&&k(b,L=>v.has(L.getKey())&&pa(L));return P&&w?[P,w]:null})(c,f,l);if(p){let[g,h]=p;ha(g,"previous").splice(0,h.getChildren());let v=h.getParent();for(h.remove(!0);v&&v.isEmpty();){let y=v;v=v.getParent(),y.remove(!0)}}let m=[c,f,...s,...i].find(Qh);if(m)return XP(gs(dr(m),e.direction));ve(269,JSON.stringify(s.map(g=>g.origin.__key)))}function dr(e){let t=(function(r){let a=r;for(;ur(a);){let s=Rl(a);if(!ur(s))break;a=s}return a})(e.getLatest()),{direction:n}=t;if(Ue(t.origin))return ga(t)?t:fs(t.origin,n,n);let o=t.getAdjacentCaret();return Ci(o)&&Ue(o.origin)?fs(o.origin,n,hs(n)):t}function ZP(e){return ga(e)&&e.offset!==fr(e.origin,e.direction)}function gs(e,t){return e.direction===t?e:e.getFlipped()}function py(e,t){return e.direction===t?e:ps(gs(e.focus,t),gs(e.anchor,t))}function ek(e,t,n){let o=ha(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return gs(o,n)}function xK(e,t="root"){let n=0,o=e,r=Rl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Rl(o)}return r&&[r,n]}function bK(e){let{origin:t,offset:n,direction:o}=e;if(n===fr(t,o))return e.getSiblingCaret();if(n===fr(t,hs(o)))return _l(e.getSiblingCaret());let[r]=t.splitText(n);return Ue(r)||ve(281),gs(Un(r,"next"),o)}function SK(e,t){return!0}function IK(e,{$copyElementNode:t=ay,$splitTextPointCaretNext:n=bK,rootMode:o="shadowRoot",$shouldSplit:r=SK}={}){if(ga(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:s}=a;if(ur(e)&&(!s.canBeEmpty()||!r(s,"first")))return _l(a);let i=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function wK(e){return e}function TK(...e){return e}function PK(e,t){return[e,t]}function kK(e){return e}function LK(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Uc(...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 AK(e,...t){let n=Uc(...t);n.length>0&&e.classList.add(...n)}function RK(e,...t){let n=Uc(...t);n.length>0&&e.classList.remove(...n)}function EK(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var _=my,Woe=_.$addUpdateTag,Dl=_.$applyNodeReplacement,Ol=_.$caretFromPoint,tk=_.$caretRangeFromSelection,Bp=_.$cloneWithProperties,nk=_.$cloneWithPropertiesEphemeral,Goe=_.$comparePointCaretNext,joe=_.$copyNode,ok=_.$create,bi=_.$createLineBreakNode,rk=_.$createNodeSelection,Wo=_.$createParagraphNode,Qoe=_.$createPoint,Si=_.$createRangeSelection,ak=_.$createRangeSelectionFromDom,sk=_.$createTabNode,hr=_.$createTextNode,ik=_.$extendCaretToRange,ya=_.$findMatchingParent,gy=_.$getAdjacentChildCaret,Xoe=_.$getAdjacentNode,Ii=_.$getAdjacentSiblingOrParentSiblingCaret,hy=_.$getCaretInDirection,lk=_.$getCaretRange,Yoe=_.$getCaretRangeInDirection,dk=_.$getCharacterOffsets,vs=_.$getChildCaret,Joe=_.$getChildCaretAtIndex,vy=_.$getChildCaretOrSelf,ck=_.$getCollapsedCaretRange,Zoe=_.$getCommonAncestor,ere=_.$getCommonAncestorResultBranchOrder,Up=_.$getEditor,tre=_.$getNearestNodeFromDOMNode,nre=_.$getNearestRootOrShadowRoot,Fl=_.$getNodeByKey,ore=_.$getNodeByKeyOrThrow,uk=_.$getNodeFromDOMNode,zc=_.$getPreviousSelection,kt=_.$getRoot,Fe=_.$getSelection,Ca=_.$getSiblingCaret,zp=_.$getState,rre=_.$getStateChange,are=_.$getTextContent,sre=_.$getTextNodeOffset,ire=_.$getTextPointCaret,lre=_.$getTextPointCaretSlice,dre=_.$getWritableNodeState,fk=_.$hasAncestor,cre=_.$hasUpdateTag,ure=_.$insertNodes,Bl=_.$isBlockElementNode,Hc=_.$isChildCaret,Hp=_.$isDecoratorNode,pk=_.$isEditorState,We=_.$isElementNode,mk=_.$isExtendableTextPointCaret,fre=_.$isInlineElementOrDecoratorNode,gk=_.$isLeafNode,Ul=_.$isLineBreakNode,pre=_.$isNodeCaret,yy=_.$isNodeSelection,hk=_.$isParagraphNode,Le=_.$isRangeSelection,Kc=_.$isRootNode,wi=_.$isRootOrShadowRoot,vk=_.$isSiblingCaret,mre=_.$isTabNode,dt=_.$isTextNode,Kp=_.$isTextPointCaret,gre=_.$isTextPointCaretSlice,Cy=_.$isTokenOrSegmented,hre=_.$isTokenOrTab,vre=_.$nodesOfType,yk=_.$normalizeCaret,Ck=_.$normalizeSelection__EXPERIMENTAL,yre=_.$onUpdate,xk=_.$parseSerializedNode,Cre=_.$removeTextFromCaretRange,bk=_.$rewindSiblingCaret,$p=_.$selectAll,xre=_.$setCompositionKey,bre=_.$setPointFromCaret,vr=_.$setSelection,Sk=_.$setSelectionFromCaretRange,qp=_.$setState,Ik=_.$splitAtPointCaretNext,wk=_.$splitNode,Sre=_.$updateRangeSelectionFromCaretRange,xy=_.ArtificialNode__DO_NOT_USE,Ire=_.BEFORE_INPUT_COMMAND,Tk=_.BLUR_COMMAND,$c=_.CAN_REDO_COMMAND,qc=_.CAN_UNDO_COMMAND,Vp=_.CLEAR_EDITOR_COMMAND,Pk=_.CLEAR_HISTORY_COMMAND,kk=_.CLICK_COMMAND,wre=_.COLLABORATION_TAG,Wp=_.COMMAND_PRIORITY_CRITICAL,Yt=_.COMMAND_PRIORITY_EDITOR,Go=_.COMMAND_PRIORITY_HIGH,zl=_.COMMAND_PRIORITY_LOW,Tre=_.COMMAND_PRIORITY_NORMAL,Pre=_.COMPOSITION_END_COMMAND,Lk=_.COMPOSITION_END_TAG,kre=_.COMPOSITION_START_COMMAND,Ak=_.COMPOSITION_START_TAG,Rk=_.CONTROLLED_TEXT_INSERTION_COMMAND,Gp=_.COPY_COMMAND,Ek=_.CUT_COMMAND,jp=_.DELETE_CHARACTER_COMMAND,Mk=_.DELETE_LINE_COMMAND,Nk=_.DELETE_WORD_COMMAND,Lre=_.DRAGEND_COMMAND,Are=_.DRAGOVER_COMMAND,_k=_.DRAGSTART_COMMAND,Dk=_.DROP_COMMAND,yr=_.DecoratorNode,Rre=_.ElementNode,Ok=_.FOCUS_COMMAND,Ere=_.FORMAT_ELEMENT_COMMAND,Fk=_.FORMAT_TEXT_COMMAND,Qp=_.HISTORIC_TAG,Lo=_.HISTORY_MERGE_TAG,Bk=_.HISTORY_PUSH_TAG,by=_.INDENT_CONTENT_COMMAND,Mre=_.INPUT_COMMAND,Sy=_.INSERT_LINE_BREAK_COMMAND,Uk=_.INSERT_PARAGRAPH_COMMAND,zk=_.INSERT_TAB_COMMAND,Vc=_.INTERNAL_$isBlock,Nre=_.IS_ALL_FORMATTING,_re=_.IS_BOLD,Dre=_.IS_CODE,Ore=_.IS_HIGHLIGHT,Fre=_.IS_ITALIC,Bre=_.IS_STRIKETHROUGH,Ure=_.IS_SUBSCRIPT,zre=_.IS_SUPERSCRIPT,Hre=_.IS_UNDERLINE,Hk=_.KEY_ARROW_DOWN_COMMAND,Xp=_.KEY_ARROW_LEFT_COMMAND,Yp=_.KEY_ARROW_RIGHT_COMMAND,Kk=_.KEY_ARROW_UP_COMMAND,Jp=_.KEY_BACKSPACE_COMMAND,$k=_.KEY_DELETE_COMMAND,qk=_.KEY_DOWN_COMMAND,Zp=_.KEY_ENTER_COMMAND,Vk=_.KEY_ESCAPE_COMMAND,Kre=_.KEY_MODIFIER_COMMAND,$re=_.KEY_SPACE_COMMAND,em=_.KEY_TAB_COMMAND,Wk=_.LineBreakNode,qre=_.MOVE_TO_END,Vre=_.MOVE_TO_START,Wre=_.NODE_STATE_KEY,Gk=_.OUTDENT_CONTENT_COMMAND,tm=_.PASTE_COMMAND,jk=_.PASTE_TAG,Qk=_.ParagraphNode,Xk=_.REDO_COMMAND,Yk=_.REMOVE_TEXT_COMMAND,Jk=_.RootNode,Gre=_.SELECTION_CHANGE_COMMAND,Zk=_.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,eL=_.SELECT_ALL_COMMAND,jre=_.SKIP_COLLAB_TAG,tL=_.SKIP_DOM_SELECTION_TAG,Iy=_.SKIP_SCROLL_INTO_VIEW_TAG,Qre=_.SKIP_SELECTION_FOCUS_TAG,nL=_.TEXT_TYPE_TO_FORMAT,oL=_.TabNode,nm=_.TextNode,rL=_.UNDO_COMMAND,Wc=_.addClassNamesToElement,Xre=_.buildImportMap,om=_.configExtension,aL=_.createCommand,rm=_.createEditor,Yre=_.createSharedNodeState,sL=_.createState,iL=_.declarePeerDependency,wn=_.defineExtension,Jre=_.flipDirection,Zre=_.getDOMOwnerDocument,wy=_.getDOMSelection,eae=_.getDOMSelectionFromTarget,lL=_.getDOMTextNode,tae=_.getEditorPropertyFromDOMNode,nae=_.getNearestEditorFromDOMNode,dL=_.getRegisteredNode,oae=_.getRegisteredNodeOrThrow,rae=_.getStaticNodeConfig,aae=_.getTextDirection,sae=_.getTransformSetFromKlass,cL=_.isBlockDomNode,iae=_.isCurrentlyReadOnlyMode,uL=_.isDOMDocumentNode,fL=_.isDOMNode,lae=_.isDOMTextNode,dae=_.isDOMUnmanaged,Ty=_.isDocumentFragment,cae=_.isExactShortcutMatch,pL=_.isHTMLAnchorElement,am=_.isHTMLElement,Gc=_.isInlineDomNode,uae=_.isLexicalEditor,fae=_.isModifierMatch,pae=_.isSelectionCapturedInDecoratorInput,mL=_.isSelectionWithinEditor,Py=_.makeStepwiseIterator,zr=_.mergeRegister,mae=_.normalizeClassNames,sm=_.removeClassNamesFromElement,gae=_.removeFromParent,hae=_.resetRandomKey,Cr=_.safeCast,vae=_.setDOMUnmanaged,yae=_.setNodeIndentFromDOM,im=_.shallowMergeConfig,ky=_.toggleTextFormatType;var Ly={};In(Ly,{LexicalComposer:()=>NK});ie();var gL=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,MK=gL?be:q,lm={tag:Lo};function NK({initialConfig:e,children:t}){let n=V(()=>{let{theme:o,namespace:r,nodes:a,onError:s,editorState:i,html:l}=e,d=A0(null,o),c=rm({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>s(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=kt();if(m.isEmpty()){let g=Wo();m.append(g);let h=gL?document.activeElement:null;(Fe()!==null||h!==null&&h===f.getRootElement())&&g.select()}},lm);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,lm);break}case"object":f.setEditorState(p,lm);break;case"function":f.update(()=>{kt().isEmpty()&&p(f)},lm)}}})(c,i),[c,d]},[]);return MK(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(L0.Provider,{value:n,children:t})}var _K=Ly,hL=_K.LexicalComposer;var Ry={};In(Ry,{$canShowPlaceholder:()=>yL,$canShowPlaceholderCurry:()=>OK,$findTextIntersectionFromCharacters:()=>FK,$isRootTextContentEmpty:()=>Ay,$isRootTextContentEmptyCurry:()=>DK,$rootTextContent:()=>vL,registerLexicalTextEntity:()=>UK});function vL(){return kt().getTextContent()}function Ay(e,t=!0){if(e)return!1;let n=vL();return t&&(n=n.trim()),n===""}function DK(e,t){return()=>Ay(e,t)}function yL(e){if(!Ay(e,!1))return!1;let t=kt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(Hp(r))return!1;if(We(r)){if(!hk(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let l=a[o];if(!dt(l))return!1}}}return!0}function OK(e){return()=>yL(e)}function FK(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(We(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(dt(n)){let s=n.getTextContentSize();if(o+s>t)return{node:n,offset:t-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){n=s;continue e}a=a.getParent()}break}return null}function BK(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 UK(e,t,n,o){let r=s=>s instanceof n,a=s=>{let i=hr(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(nm,s=>{if(!s.isSimpleText())return;let i,l=s.getPreviousSibling(),d=s.getTextContent(),c=s;if(dt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(g=>g.getLatest().__mode)(l)!==0)return void a(l);{let g=m.end-p.length;if(g>0){let h=p+d.slice(0,g);if(l.select(),l.setTextContent(h),g===d.length)s.remove();else{let v=d.slice(g);s.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){i=t(d);let p,m=i===null?"":d.slice(i.end);if(d=m,m===""){let h=c.getNextSibling();if(dt(h)){m=c.getTextContent()+h.getTextContent();let v=t(m);if(v===null)return void(r(h)?a(h):h.markDirty());if(v.start!==0)return}}if(i===null)return;if(i.start===0&&dt(l)&&l.isTextEntity()){f+=i.end;continue}i.start===0?[p,c]=c.splitText(i.end):[,p,c]=c.splitText(i.start+f,i.end+f),p===void 0&&BK(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),c==null)return;f=0,l=g}}),e.registerNodeTransform(n,s=>{let i=s.getTextContent(),l=t(i);if(l===null||l.start!==0)return void a(s);if(i.length>l.end)return void s.splitText(l.end);let d=s.getPreviousSibling();dt(d)&&d.isTextEntity()&&(a(d),a(s));let c=s.getNextSibling();dt(c)&&c.isTextEntity()&&(a(c),r(s)&&a(s))})]}var Ti=Ry,Pae=Ti.$canShowPlaceholder,dm=Ti.$canShowPlaceholderCurry,kae=Ti.$findTextIntersectionFromCharacters,Lae=Ti.$isRootTextContentEmpty,Aae=Ti.$isRootTextContentEmptyCurry,Rae=Ti.$rootTextContent,Eae=Ti.registerLexicalTextEntity;var Oy={};In(Oy,{$addNodeStyle:()=>VK,$cloneWithProperties:()=>Bp,$copyBlockFormatIndent:()=>kL,$ensureForwardRangeSelection:()=>PL,$forEachSelectedTextNode:()=>TL,$getComputedStyleForElement:()=>Ny,$getComputedStyleForParent:()=>_y,$getSelectionStyleValueForProperty:()=>ZK,$isAtNodeEnd:()=>qK,$isParentElementRTL:()=>Dy,$isParentRTL:()=>KK,$moveCaretSelection:()=>RL,$moveCharacter:()=>YK,$patchStyleText:()=>WK,$selectAll:()=>$p,$setBlocksType:()=>GK,$shouldOverrideDefaultCharacterSelection:()=>XK,$sliceSelectedTextNodeContent:()=>$K,$trimTextContentFromAnchor:()=>wL,$wrapNodes:()=>QK,createDOMRange:()=>zK,createRectsFromDOMRange:()=>HK,getCSSFromStyleObject:()=>IL,getStyleObjectFromCSS:()=>fm,trimTextContentFromAnchor:()=>e$});function My(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 um=new Map;function CL(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function xL(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function zK(e,t,n,o,r){let a=t.getKey(),s=o.getKey(),i=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(s),c=n,f=r;if(dt(t)&&(l=CL(l)),dt(o)&&(d=CL(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=xL(l)),d.nodeName==="BR"&&([d,f]=xL(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{i.setStart(l,c),i.setEnd(d,f)}catch{return null}return!i.collapsed||c===f&&a===s||(i.setStart(d,f),i.setEnd(l,c)),i}function HK(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,l=s.length;s.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=s[d],f=i&&i.top<=c.top&&i.top+i.height>c.top&&i.left+i.width>c.left,p=c.width+a===o.width;f||p?(s.splice(d--,1),l--):i=c}return s}function SL(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 fm(e){let t=um.get(e);return t===void 0&&(t=SL(e),um.set(e,t)),t}function IL(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ny(e){let t=Up().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function _y(e){return Ny(Kc(e)?e:e.getParentOrThrow())}function KK(e){let t=_y(e);return t!==null&&t.direction==="rtl"}function $K(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!Cy(t)&&o!==null){let[r,a]=o,s=e.isBackward(),i=r.getNode(),l=a.getNode(),d=t.is(i),c=t.is(l);if(d||c){let[f,p]=dk(e),m=i.is(l),g=t.is(s?l:i),h=t.is(s?i:l),v,y=0;m?(y=f>p?p:f,v=f>p?f:p):g?(y=s?p:f,v=void 0):h&&(y=0,v=s?f:p);let C=t.__text.slice(y,v);C!==t.__text&&(n==="clone"&&(t=nk(t)),t.__text=C)}}return t}function qK(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return We(t)||My(177),e.offset===t.getChildrenSize()}function wL(e,t,n){let o=t.getNode(),r=n;if(We(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(We(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),s=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&&(s=d.isInline()?0:2,a=c)}let i=o.getTextContent();i===""&&We(o)&&!o.isInline()&&(i=`
3782
+ `?o.push(xl()):s===" "?o.push(Rp()):o.push(Dn(s))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,s=n,i=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,i=n),s.type==="element"&&(function(v,y,C,x){let b=v.getNode(),w=b.getChildAtIndex(v.offset),I=Dn();if(I.setFormat(C),I.setStyle(x),IP(w))w.splice(0,0,[I]);else{let k=Wn(b)?ma().append(I):I;w===null?b.append(k):w.insertBefore(k)}v.is(y)&&y.set(I.__key,0,"text"),v.set(I.__key,0,"text")})(s,i,r,a),i.type==="element"&&Al(i,ir(vs(i,"next")));let l=s.offset,d=i.offset,c=this.getNodes(),f=c.length,p=c[0];Ue(p)||ve(26);let m=p.getTextContent().length,g=p.getParentOrThrow(),h=c[f-1];if(f===1&&i.type==="element"&&(d=m,i.set(s.key,d,"text")),this.isCollapsed()&&l===m&&(ua(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Ue(v)&&v.canInsertTextBefore()&&!ua(v)||(v=Dn(),v.setFormat(r),v.setStyle(a),g.canInsertTextAfter()?p.insertAfter(v):g.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(ua(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Ue(v)&&!ua(v)||(v=Dn(),v.setFormat(r),g.canInsertTextBefore()?p.insertBefore(v):g.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=Dn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||me(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),pP(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(cs(p)){let x=Dn(t);return x.select(),void p.replace(x)}let v=p.getFormat(),y=p.getStyle();if(l!==d||v===r&&y===a){if(Hv(p)){let x=Dn(t);return x.setFormat(r),x.setStyle(a),x.select(),void p.replace(x)}}else{if(p.getTextContent()!==""){let x=Dn(t);if(x.setFormat(r),x.setStyle(a),x.select(),l===0)p.insertBefore(x,!1);else{let[b]=p.splitText(l);b.insertAfter(x,!1)}return void(x.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let C=d-l;p=p.spliceText(l,C,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=y,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...h.getParentKeys()]),y=me(p)?p:p.getParentOrThrow(),C=me(h)?h:h.getParentOrThrow(),x=h;if(!y.is(C)&&C.isInline())do x=C,C=C.getParentOrThrow();while(C.isInline());if(i.type==="text"&&(d!==0||h.getTextContent()==="")||i.type==="element"&&h.getIndexWithinParent()<d)if(Ue(h)&&!cs(h)&&d!==h.getTextContentSize()){if(h.isSegmented()){let P=Dn(h.getTextContent());h.replace(P),h=P}Wn(i.getNode())||i.type!=="text"||(h=h.spliceText(0,d,"")),v.add(h.__key)}else{let P=h.getParentOrThrow();P.canBeEmpty()||P.getChildrenSize()!==1?h.remove():P.remove()}else v.add(h.__key);let b=C.getChildren(),w=new Set(c),I=y.is(C),k=y.isInline()&&p.getNextSibling()===null?y:p;for(let P=b.length-1;P>=0;P--){let T=b[P];if(T.is(p)||me(T)&&T.isParentOf(p))break;T.isAttached()&&(!w.has(T)||T.is(x)?I||k.insertAfter(T,!1):T.remove())}if(!I){let P=C,T=null;for(;P!==null;){let L=P.getChildren(),A=L.length;(A===0||L[A-1].is(T))&&(v.delete(P.__key),T=P),P=P.getParent()}}if(cs(p))if(l===m)p.select();else{let P=Dn(t);P.select(),p.replace(P)}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 P=1;P<f;P++){let T=c[P],L=T.__key;v.has(L)||T.remove()}}}removeText(){let t=Nt()===this;Cc(this,QP(wv(this))),t&&Nt()!==this&&Co(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Fn(null);let o=this.getNodes(),r=[];for(let b of o)Ue(b)&&r.push(b);let a=b=>{o.forEach(w=>{if(me(w)){let I=w.getFormatFlags(t,b);w.setTextFormat(I)}})},s=r.length;if(s===0)return this.toggleFormat(t),Fn(null),void a(n);let i=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:i,f=d?i:l,p=0,m=r[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===m.getTextContentSize()&&(p=1,m=r[1],g=0),m==null)return;let h=m.getFormatFlags(t,n);a(h);let v=s-1,y=r[v],C=f.type==="text"?f.offset:y.getTextContentSize();if(m.is(y)){if(g===C)return;if(ua(m)||g===0&&C===m.getTextContentSize())m.setFormat(h);else{let b=m.splitText(g,C),w=g===0?b[0]:b[1];w.setFormat(h),c.type==="text"&&c.set(w.__key,0,"text"),f.type==="text"&&f.set(w.__key,C-g,"text")}return void(this.format=h)}g===0||ua(m)||([,m]=m.splitText(g),g=0),m.setFormat(h);let x=y.getFormatFlags(t,h);C>0&&(C===y.getTextContentSize()||ua(y)||([y]=y.splitText(C)),y.setFormat(x));for(let b=p+1;b<v;b++){let w=r[b],I=w.getFormatFlags(t,x);w.setFormat(I)}c.type==="text"&&c.set(m.__key,g,"text"),f.type==="text"&&f.set(y.__key,C,"text"),this.format=h|x}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=Nt();return Ge(g)||ve(134),g.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=vc(n,pa),r=t[t.length-1];if(me(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=$h(this);o.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(me(g)||Yt(g))&&!g.isInline())){me(o)||ve(211,n.constructor.name,n.getType());let g=$h(this);return o.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=ma(),v=null;for(let y=0;y<g.length;y++){let C=g[y],x=di(C);if(x||Yt(C)&&C.isInline()||me(C)&&C.isInline()||Ue(C)||C.isParentRequired()){if(v===null&&(v=C.createParentElementNode(),h.append(v),x))continue;v!==null&&v.append(C)}else h.append(C),v=null}return h})(t),s=a.getLastDescendant(),i=a.getChildren(),l=!me(o)||!o.isEmpty()?this.insertParagraph():null,d=i[i.length-1],c=i[0];var f;me(f=c)&&pa(f)&&!f.isEmpty()&&me(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(me(o)||ve(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=i[1]),c&&(o===null&&ve(212,n.constructor.name,n.getType()),(function(g,h){let v=h.getParentOrThrow().getLastChild(),y=h,C=[h];for(;y!==v;)y.getNextSibling()||ve(140),y=y.getNextSibling(),C.push(y);let x=g;for(let b of C)x=x.insertAfter(b)})(o,c));let p=vc(s,pa);l&&me(p)&&(l.canMergeWhenEmpty()||pa(d))&&(p.append(...l.getChildren()),l.remove()),me(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let m=me(o)?o.getLastChild():null;di(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=ma();return ko().splice(this.anchor.offset,0,[s]),s.select(),s}let t=$h(this),n=vc(this.anchor.getNode(),pa);me(n)||ve(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=xl();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,s]=hv(this),i=this.isBackward(),[l,d]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=i?[s,a]:[a,s];if(n===0)return[];if(n===1){if(Ue(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(Ue(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Ue(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(tT(this,t,n,o))return;let r=t==="move",a=Gt(),s=pr(Lo(a));if(!s)return;let i=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||i===null||!me(d)||d.isInline()||d.canBeEmpty()||Cv(i,a,l),this.dirty){let c=wl(a,this.anchor.key),f=wl(a,this.focus.key);this.anchor.type==="text"&&(c=mi(c)),this.focus.type==="text"&&(f=mi(f)),c&&f&&vP(s,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(s,t,n?"backward":"forward",o),s.rangeCount>0){let c=s.getRangeAt(0),f=this.anchor.getNode(),p=Wn(f)?f:UP(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),g=[],h=!1;for(let v=0;v<m.length;v++){let y=m[v];wp(y,p)?g.push(y):h=!0}if(h&&g.length>0)if(n){let v=g[0];me(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=g[g.length-1];me(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}s.anchorNode===c.startContainer&&s.anchorOffset===c.startOffset||(function(v){let y=v.focus,C=v.anchor,x=C.key,b=C.offset,w=C.type;C.set(y.key,y.offset,y.type,!0),y.set(x,b,w,!0)})(this)}}o==="lineboundary"&&tT(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&me(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(me(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=iy(vs(o,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(dr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(i.type==="merge-block")break;if(me(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=ir(l);Cc(this,hs(d,d)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:l,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(gi(l)){if(me(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else i={block:l.origin,type:"merge-next-block"};continue}if(Yt(l.origin)){if(!l.origin.isIsolated())if(i.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&me(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=Kv();d.add(l.origin.getKey()),Co(d)}else l.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:l,block:d}=i;return Cc(this,hs(!l.origin.isEmpty()&&d.isEmpty()?Ml(zn(d,l.direction)):a.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&j0(this,o.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,i!==null&&i.isSegmented()){let l=s.offset,d=i.getTextContentSize();if(i.is(r)||t&&l!==d||!t&&l!==0)return void Q0(i,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(i)||t&&l!==0||!t&&l!==d)return void Q0(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 g=c.offset,h=f.offset,v=g<h,y=v?g:h,C=v?h:g,x=C-1;y!==x&&(function(b){return!(MP(b)||E5(b))})(p.getTextContent().slice(y,C))&&(d?f.set(f.key,x,f.type):c.set(c.key,x,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()&&Wn(o.getParent())&&o.getPreviousSibling()===null&&j0(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 Mc(e){return e instanceof Cp}function G0(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function hv(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]:[G0(n),G0(o)]}function j0(e,t){for(let n=t;n;n=n.getParent()){if(me(n)){if(n.collapseAtStart(e))return!0;if(Go(n))break}if(n.getPreviousSibling())break}return!1}var E5=(()=>{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 Q0(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let d=0;d<a;d++){let c=d===a-1;if(i=s,s+=r[d].length,t&&s===n||s>n||c){r.splice(d,1),c&&(i=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(i,i))}function X0(e,t,n,o){let r,a=t;if(so(e)){let s=!1,i=e.childNodes,l=i.length,d=o._blockCursorElement;a===l&&(s=!0,a=l-1);let c=i[a],f=!1;if(c===d)c=i[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=gl(c),Ue(r))a=cr(r,s?"next":"previous");else{let p=gl(e);if(p===null)return null;if(me(p)){let m=o.getElementByKey(p.getKey());m===null&&ve(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),me(p)||ve(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(me(h)&&(function(v,y,C){let x=v.getParent();return C===null||x===null||!x.canBeEmpty()||x!==C.getNode()})(h,0,n)){let v=s?h.getLastDescendant():h.getFirstDescendant();v===null?p=h:(h=v,p=me(h)?h:h.getParentOrThrow()),a=0}Ue(h)?(r=h,p=null,a=cr(h,s?"next":"previous")):h!==p&&s&&!f&&(me(p)||ve(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Yt(p)&&gl(e)===p?m:m+1,p=p.getParentOrThrow()}if(me(p))return ur(p.__key,a,"element")}}else r=gl(e);return Ue(r)?ur(r.__key,cr(r,a,"clamp"),"text"):null}function Y0(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((n||!t)&&a===null&&me(s)&&s.isInline()){let i=s.getPreviousSibling();Ue(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else me(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Ue(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&me(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&me(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();Ue(i)&&e.set(i.__key,0,"text")}}}function pP(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);Y0(e,o,r),Y0(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function mP(e,t,n,o,r,a){if(e===null||n===null||!Nc(r,e,n))return null;let s=X0(e,t,Ge(a)?a.anchor:null,r);if(s===null)return null;let i=X0(n,o,Ge(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let l=gl(e),d=gl(n);if(Yt(l)&&Yt(d))return null}return pP(s,i),[s,i]}function M5(e){return me(e)&&!e.isInline()}function gP(e,t,n,o,r,a){let s=va(),i=new pi(ur(e,t,r),ur(n,o,a),0,"");return i.dirty=!0,s._selection=i,i}function hP(){let e=ur("root",0,"element"),t=ur("root",0,"element");return new pi(e,t,0,"")}function Kv(){return new Cp(new Set)}function N5(e,t){return Ep(null,e,t,null)}function Ep(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,s=a?a.type:void 0,i=s==="selectionchange",l=!Xh&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),d,c,f,p;if(Ge(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&Ge(e)&&!Nc(n,d,c))return e.clone();let m=mP(d,f,c,p,n,e);if(m===null)return null;let[g,h]=m,v=0,y="";if(Ge(e)){let C=e.anchor;if(g.key===C.key)v=e.format,y=e.style;else{let x=g.getNode();Ue(x)?(v=x.getFormat(),y=x.getStyle()):me(x)&&(v=x.getTextFormat(),y=x.getTextStyle())}}return new pi(g,h,v,y)}function Nt(){return va()._selection}function hi(){return Gt()._editorState._selection}function xp(e,t,n,o=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))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"),J0(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 g=c.offset;(n<=g&&o>0||n<g&&o<0)&&c.set(l,Math.max(0,g+o),"element")}if(t.is(m)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}J0(e)}function J0(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),s=o.getNode();if(e.isCollapsed()){if(!me(a))return;let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(me(a)){let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(me(s)){let i=s.getChildrenSize(),l=r>=i,d=l?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function bp(e,t,n,o,r){let a=null,s=0,i=null;o!==null?(a=o.__key,Ue(o)?(s=o.getTextContentSize(),i="text"):me(o)&&(s=o.getChildrenSize(),i="element")):r!==null&&(a=r.__key,Ue(r)?i="text":me(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function Z0(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 vP(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function eT(e,t,n){let o=wl(e,t.getKey());if(me(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function _5(e,t,n,o,r,a,s){let i=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(sP)&&f!==a||f!==null&&jv(f))return;if(!Ge(t))return void(e!==null&&Nc(n,i,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,g=p.getNode(),h=m.getNode(),[v,y]=eT(n,g,p.offset),[C,x]=eT(n,h,m.offset),b=t.format,w=t.style,I=t.isCollapsed(),k=v,P=C,T=!1;var L,A,M,R,D;if(p.type==="text"?(k=mi(v),T=g.getFormat()!==b||g.getStyle()!==w):Ge(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(P=mi(C)),k!==null&&P!==null&&(I&&(e===null||T||Ge(e)&&(e.format!==b||e.style!==w))&&(L=b,A=w,M=y,R=p.key,D=performance.now(),ZT=[L,A,M,R,D]),d!==y||c!==x||i!==k||l!==P||o.type==="Range"&&I||(f!==null&&a.contains(f)||r.has(mv)||a.focus({preventScroll:!0}),p.type==="element"))){if(vP(o,k,y,P,x),!fs||!t.isCollapsed()||a===null||r.has(mv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(iP)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let H=Ge(t)&&t.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(H!==null){let W;if(H instanceof Text){let F=document.createRange();F.selectNode(H),W=F.getBoundingClientRect()}else W=H.getBoundingClientRect();(function(F,J,O){let B=ty(O),Y=ny(B);if(B===null||Y===null)return;let{top:U,bottom:X}=J,re=0,G=0,te=O;for(;te!==null;){let oe=te===B.body;if(oe)re=0,G=Lo(F).innerHeight;else{let ee=te.getBoundingClientRect();re=ee.top,G=ee.bottom}let Z=0;if(U<re?Z=-(re-U):X>G&&(Z=X-G),Z!==0)if(oe)Y.scrollBy(0,Z);else{let ee=te.scrollTop;te.scrollTop+=Z;let fe=te.scrollTop-ee;U-=fe,X-=fe}if(oe)break;te=Dc(te)}})(n,W,a)}}uv=!0}}function D5(e){let t=Nt()||hi();t===null&&(t=ko().selectEnd()),t.insertNodes(e)}function O5(){let e=Nt();return e===null?"":e.getTextContent()}function $h(e){let t=e;e.isCollapsed()||t.removeText();let n=Nt();Ge(n)&&(t=n),Ge(t)||ve(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!pa(r);){let s=r;if([r,a]=F5(r,a),s.is(r))break}return a}function F5(e,t){let n=e.getParent();if(!n){let r=ma();return ko().append(r),r.select(),[ko(),0]}if(Ue(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(!me(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new pi(ur(e.__key,t,"element"),ur(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function tT(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=vs(e.focus,n?"previous":"next"),s=o==="lineboundary",i=t==="move",l=a,d=r==="decorators-and-blocks";if(!XP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!Yt(f)||f.isIsolated()||(l=c,!s||!f.isInline()))break}if(d)for(let c of iy(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(dr(c))c.origin.isInline()||(l=c);else{if(me(c.origin))continue;Yt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(i&&!s&&Yt(l.origin)&&l.origin.isKeyboardSelectable()){let c=Kv();return c.add(l.origin.getKey()),Co(c),!0}return l=ir(l),i&&Al(e.anchor,l),Al(e.focus,l),d||!s}var Bn=null,Un=null,yo=!1,qh=!1,ip=0,nT={characterData:!0,childList:!0,subtree:!0};function Rl(){return yo||Bn!==null&&Bn._readOnly}function On(){yo&&ve(13)}function yP(){ip>99&&ve(14)}function va(){return Bn===null&&ve(195,CP()),Bn}function Gt(){return Un===null&&ve(196,CP()),Un}function CP(){let e=0,t=new Set,n=ms.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=_c(r);if(Np(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}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 B5(){return Un}function oT(e,t,n){let o=t.__type,r=Wv(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function rT(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function xP(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 U5(e){return $v(e,Gt()._nodes)}function $v(e,t){let n=e.type,o=t.get(n);o===void 0&&ve(17,n);let r=o.klass;e.type!==r.getType()&&ve(18,r.name);let a=r.importJSON(e),s=e.children;if(me(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let l=$v(s[i],t);a.append(l)}return a}function aT(e,t,n){let o=Bn,r=yo,a=Un;Bn=t,yo=!0,Un=e;try{return n()}finally{Bn=o,yo=r,Un=a}}function fa(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,s=a._selection,i=n._selection,l=e._dirtyType!==0,d=Bn,c=yo,f=Un,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Un=e,Bn=n,yo=!1,e._updating=!0;try{let I=e._dirtyType,k=e._dirtyElements,P=e._dirtyLeaves;m.disconnect(),g=r5(a,n,e,I,k,P)}catch(I){if(I instanceof Error&&e._onError(I),qh)throw I;return wP(e,null,o,n),TT(e),e._dirtyType=2,qh=!0,fa(e,a),void(qh=!1)}finally{m.observe(o,nT),e._updating=p,Bn=d,yo=c,Un=f}}n._readOnly||(n._readOnly=!0);let h=e._dirtyLeaves,v=e._dirtyElements,y=e._normalizedNodes,C=e._updateTags,x=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(I,k){let P=I._decorators,T=I._pendingDecorators||P,L=k._nodeMap,A;for(A in T)L.has(A)||(T===P&&(T=RP(I)),delete T[A])})(e,n);let b=r?null:pr(Lo(e));if(e._editable&&b!==null&&(l||i===null||i.dirty||!i.is(s))&&o!==null&&!C.has(lP)){Un=e,Bn=n;try{if(m!==null&&m.disconnect(),l||i===null||i.dirty){let I=e._blockCursorElement;I!==null&&Cv(I,e,o),_5(s,i,e,b,C,o)}(function(I,k,P){let T=I._blockCursorElement;if(Ge(P)&&P.isCollapsed()&&P.anchor.type==="element"&&k.contains(document.activeElement)){let L=P.anchor,A=L.getNode(),M=L.offset,R=!1,D=null;if(M===A.getChildrenSize())Wh(A.getChildAtIndex(M-1))&&(R=!0);else{let H=A.getChildAtIndex(M);if(H!==null&&Wh(H)){let W=H.getPreviousSibling();(W===null||Wh(W))&&(R=!0,D=I.getElementByKey(H.__key))}}if(R){let H=I.getElementByKey(A.__key);return T===null&&(I._blockCursorElement=T=(function(W){let F=W.theme,J=document.createElement("div");J.contentEditable="false",J.setAttribute("data-lexical-cursor","true");let O=F.blockCursor;if(O!==void 0){if(typeof O=="string"){let B=Bc(O);O=F.blockCursor=B}O!==void 0&&J.classList.add(...O)}return J})(I._config)),k.style.caretColor="transparent",void(D===null?H.appendChild(T):H.insertBefore(T,D))}}T!==null&&Cv(T,I,k)})(e,o,i)}finally{m!==null&&m.observe(o,nT),Un=f,Bn=d}}g!==null&&(function(I,k,P,T,L){let A=Array.from(I._listeners.mutation),M=A.length;for(let R=0;R<M;R++){let[D,H]=A[R];for(let W of H){let F=k.get(W);F!==void 0&&D(F,{dirtyLeaves:T,prevEditorState:L,updateTags:P})}}})(e,g,C,h,a),Ge(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(Av,void 0);let w=e._pendingDecorators;w!==null&&(e._decorators=w,e._pendingDecorators=null,hc("decorator",e,!0,w)),(function(I,k,P){let T=dT(k),L=dT(P);T!==L&&hc("textcontent",I,!0,L)})(e,t||a,n),hc("update",e,!0,{dirtyElements:v,dirtyLeaves:h,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:t||a,tags:C}),(function(I,k){if(I._deferred=[],k.length!==0){let P=I._updating;I._updating=!0;try{for(let T=0;T<k.length;T++)k[T]()}finally{I._updating=P}}})(e,x),(function(I){let k=I._updates;if(k.length!==0){let P=k.shift();if(P){let[T,L]=P;Mp(I,T,L)}}})(e)}function hc(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,o)}finally{t._updating=r}}function sT(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,s]=r,i=e._pendingEditorState,l;s!==void 0&&(l=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete&&(i===null&&ve(191),i._flushSync=!0),l&&e._deferred.push(l),xP(e,s.tag)),i==null?Mp(e,a,s):a()}}return o}function Mp(e,t,n){let o=e._updateTags,r,a=!1,s=!1;n!==void 0&&(r=n.onUpdate,xP(e,n.tag),a=n.skipTransforms||!1,s=n.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=bP(l||i),d=!0),l._flushSync=s;let c=Bn,f=yo,p=Un,m=e._updating;Bn=l,yo=!1,e._updating=!0,Un=e;let g=e._headless||e.getRootElement()===null;Vv(null);try{d&&(g?i._selection!==null&&(l._selection=i._selection.clone()):l._selection=(function(C,x){let b=C.getEditorState()._selection,w=pr(Lo(C));return Ge(b)||b==null?Ep(b,w,C,x):b.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=sT(e,a),(function(C,x){let b=x.getEditorState()._selection,w=C._selection;if(Ge(w)){let I=w.anchor,k=w.focus,P;if(I.type==="text"&&(P=I.getNode(),P.selectionTransform(b,w)),k.type==="text"){let T=k.getNode();P!==T&&T.selectionTransform(b,w)}}})(l,e),e._dirtyType!==0&&(a?(function(C,x){let b=x._dirtyLeaves,w=C._nodeMap;for(let I of b){let k=w.get(I);Ue(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&_0(k)}})(l,e):(function(C,x){let b=x._dirtyLeaves,w=x._dirtyElements,I=C._nodeMap,k=ds(),P=new Map,T=b,L=T.size,A=w,M=A.size;for(;L>0||M>0;){if(L>0){x._dirtyLeaves=new Set;for(let R of T){let D=I.get(R);Ue(D)&&D.isAttached()&&D.isSimpleText()&&!D.isUnmergeable()&&_0(D),D!==void 0&&rT(D,k)&&oT(x,D,P),b.add(R)}if(T=x._dirtyLeaves,L=T.size,L>0){ip++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let R of A){let D=R[0],H=R[1];if(w.set(D,H),!H)continue;let W=I.get(D);W!==void 0&&rT(W,k)&&oT(x,W,P)}T=x._dirtyLeaves,L=T.size,A=x._dirtyElements,M=A.size,ip++}x._dirtyLeaves=b,x._dirtyElements=w})(l,e),sT(e),(function(C,x,b,w){let I=C._nodeMap,k=x._nodeMap,P=[];for(let[T]of w){let L=k.get(T);L!==void 0&&(L.isAttached()||(me(L)&&ST(L,T,I,k,P,w),I.has(T)||w.delete(T),P.push(T)))}for(let T of P)k.delete(T);for(let T of b){let L=k.get(T);L===void 0||L.isAttached()||(I.has(T)||b.delete(T),k.delete(T))}})(i,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let y=l._selection;if(Ge(y)){let C=l._nodeMap,x=y.anchor.key,b=y.focus.key;C.get(x)!==void 0&&C.get(b)!==void 0||ve(19)}else Mc(y)&&y._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void fa(e)}finally{Bn=c,yo=f,Un=p,e._updating=m,ip=0}e._dirtyType!==0||e._deferred.length>0||(function(v,y){let C=y.getEditorState()._selection,x=v._selection;if(x!==null){if(x.dirty||!x.is(C))return!0}else if(C!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,fa(e)):d&&j5(()=>{fa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Dr(e,t,n){Un===e&&n===void 0?t():Mp(e,t,n)}var vv=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&ve(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&ve(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&ve(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||Ec||Pp);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 s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,a),o.__lexicalLineBreak=s}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=iT(n,o);a.push(r);let s=iT(n,this.element),i=t.getIndexWithinParent();for(let l=0;l<s.length;l++){let d=a[l],c=s[l];if(d===void 0||d<c)break;if(d>c){i+=1;break}}return[t.getParentOrThrow(),i]}};function iT(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&&ve(225),n.reverse()}var ps=class extends Wo{__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 qH[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=Gt()._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(Ue(n)&&t.push(n),me(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;me(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;me(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 me(a)&&a.getLastDescendant()||a||null}let r=n[t];return me(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Rn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&ve(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Rn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&ve(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(),me(a)&&r!==o-1&&!a.isInline()&&(t+=Lp)}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(),me(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=Qh[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=Yn[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Ac(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){On();let o=Nt(),r=t,a=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Ue(l)||me(l))return l.select(0,0)}else if(!(t!==void 0&&t!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(Ue(l)||me(l))return l.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return Ge(o)?(o.anchor.set(i,r,"element"),o.focus.set(i,a,"element"),o.dirty=!0,o):gP(i,r,i,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!==""?Qh[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){yp(this)&&ve(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||ve(226,String(t),String(n),String(r));let s=a.__key,i=[],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 g=0;g<n;g++){m===null&&ve(100);let h=m.getNextSibling(),v=m.__key;us(m.getWritable()),l.push(v),m=h}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let g=m.getWritable();g.__parent===s&&f--,us(g);let h=m.__key;if(p===null)a.__first=h,g.__prev=null;else{let v=p.getWritable();v.__next=h,g.__prev=v.__key}m.__key===s&&ve(76),g.__parent=s,i.push(h),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 g=p.getWritable();m.__prev=p.__key,g.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=Nt();if(Ge(m)){let g=new Set(l),h=new Set(i),{anchor:v,focus:y}=m;lT(v,g,h)&&bp(v,v.getNode(),this,c,d),lT(y,g,h)&&bp(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||Go(this)||this.remove()}}return a}getDOMSlot(t){return new vv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(so(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||Go(this)||this.getChildren().some(Ue)||(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 s=n.getElementByKey(a.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function me(e){return e instanceof ps}function lT(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 Wo{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Yt(e){return e instanceof kc}var Sl=class e extends ps{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ve(51)}getTextContent(){let t=this.__cachedText;return!Rl()&&Gt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){ve(52)}replace(t){ve(53)}insertBefore(t){ve(54)}insertAfter(t){ve(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)me(r)||Yt(r)||ve(282);return super.splice(t,n,o)}static importJSON(t){return ko().updateFromJSON(t)}collapseAtStart(){return!0}};function Wn(e){return e instanceof Sl}function bP(e){return new Lc(new Map(e._nodeMap))}function qv(){return new Lc(new Map([["root",new Sl]]))}function SP(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ve(130,n.name),me(e)){let o=t.children;Array.isArray(o)||ve(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=SP(r[a]);o.push(s)}}return t}function z5(e){return e instanceof Lc}var Lc=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 aT(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 aT(null,this,()=>({root:SP(ko())}))}},Sp=class extends ps{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Il=class e extends ps{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=yl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:H5,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(so(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return ma().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Ue);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=ma();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||Ue(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 H5(e){let t=ma();if(e.style&&(t.setFormat(e.style.textAlign),qP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Qh&&t.setFormat(n)}return{node:t}}function ma(){return Oc(new Il)}function IP(e){return e instanceof Il}var ml=0,K5=1,$5=2,q5=3,V5=4;function wP(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=qv(),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 TP(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Fc(o),a=o.transform;if(!n.has(a)){n.add(a);let s=o.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),o=r.extends}else{let s=Object.getPrototypeOf(o);o=s.prototype instanceof Wo&&s!==Wo?s:void 0}}return t}function W5(e){let t=e||{},n=B5(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,s=qv(),i=t.namespace||(r!==null?r._config.namespace:NP()),l=t.editorState,d=[Sl,fi,Cl,bl,Il,Sp,...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 h=0;h<d.length;h++){let v=d[h],y=null,C=null;if(typeof v!="function"){let w=v;v=w.replace,y=w.with,C=w.withKlass||null}Fc(v);let x=v.getType(),b=TP(v);m.set(x,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:C,sharedNodeState:PT(d[h]),transforms:b})}}let g=new ms(s,r,m,{disableEvents:a,namespace:i,theme:o},c||console.error,(function(h,v){let y=new Map,C=new Set,x=b=>{Object.keys(b).forEach(w=>{let I=y.get(w);I===void 0&&(I=[],y.set(w,I)),I.push(b[w])})};return h.forEach(b=>{let w=b.klass.importDOM;if(w==null||C.has(w))return;C.add(w);let I=w.call(b.klass);I!==null&&x(I)}),v&&x(v),y})(m,f?f.import:void 0),p,e);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=2),(function(h){h.registerCommand(Rv,m5,ml),h.registerCommand(Ev,g5,ml),h.registerCommand(Mv,h5,ml),h.registerCommand(Nv,v5,ml),h.registerCommand(Fv,y5,ml)})(g),g}var ms=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,s,i,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=NP(),this._onError=a,this._htmlConversions=s,this._editable=i,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&&ve(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&&ve(36,String(t));let s=a[o];return s.add(n),()=>{s.delete(n),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(n);s===void 0&&(s=new Set,a.set(n,s)),s.add(r);let i=o&&o.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&ve(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=bv(o).get(n.getType());if(!r)return;let a=new Map;for(let s of r.keys())a.set(s,"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 s=this.registerNodeTransformToKlass(a,n);r.push(s)}return(function(s,i){let l=bv(s.getEditorState()),d=[];for(let c of i){let f=l.get(c);f&&d.push(f)}d.length!==0&&s.update(()=>{for(let c of d)for(let f of c.keys()){let p=Rn(f);p&&p.markDirty()}},s._pendingEditorState===null?{tag:sp}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Ae(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=yl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,wP(this,n,t,r),n!==null&&(this._config.disableEvents||C5(n),o!=null&&n.classList.remove(...o)),t!==null){let a=ny(t),s=t.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,TT(this),this._updateTags.add(sp),fa(this),this._config.disableEvents||(function(i,l){let d=i.ownerDocument;cv.set(i,d);let c=hp.get(d)??0;c<1&&d.addEventListener("selectionchange",rP),hp.set(d,c+1),i.__lexicalEditor=l;let f=oP(i);for(let p=0;p<dv.length;p++){let[m,g]=dv[p],h=typeof g=="function"?v=>{H0(v)||(z0(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(H0(v))return;z0(v);let y=l.isEditable();switch(m){case"cut":return y&&Ae(l,Uv,v);case"copy":return Ae(l,Bv,v);case"paste":return y&&Ae(l,_v,v);case"dragstart":return y&&Ae(l,VT,v);case"dragover":return y&&Ae(l,WT,v);case"dragend":return y&&Ae(l,GT,v);case"focus":return y&&Ae(l,jT,v);case"blur":return y&&Ae(l,QT,v);case"drop":return y&&Ae(l,qT,v)}};i.addEventListener(m,h),f.push(()=>{i.removeEventListener(m,h)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(sp),fa(this);hc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&ve(38);let o=t;o._readOnly&&(o=bP(t),o._selection=t._selection?t._selection.clone():null),wT(this);let r=this._pendingEditorState,a=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),fa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||fa(this)}parseEditorState(t,n){return(function(o,r,a){let s=qv(),i=Bn,l=yo,d=Un,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,Bn=s,yo=!1,Un=r,Vv(null);try{let g=r._nodes;$v(o.root,g),a&&a(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Bn=i,yo=l,Un=d}return s})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return fa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Mp(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),Dr(this,()=>{let r=Nt(),a=ko();r!==null?r.dirty||Co(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Op("focus"),BP(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=pr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,hc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};ms.version="0.41.0+prod.esm";var yv=null;function Vv(e){yv=e}var PP=1;function G5(){PP=1}function Wv(e,t){let n=Gv(e,t);return n===void 0&&ve(30,t),n}function Gv(e,t){return e._nodes.get(t)}var j5=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function kP(e){return Yt(Dp(e))}function jv(e){let t=document.activeElement;if(!so(t))return!1;let n=t.nodeName;return Yt(Dp(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&_c(t)==null)}function Nc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!jv(t)&&Qv(t)===e}catch{return!1}}function Np(e){return e instanceof ms}function Qv(e){let t=e;for(;t!=null;){let n=_c(t);if(Np(n))return n;t=Dc(t)}return null}function _c(e){return e?e.__lexicalEditor:null}function Q5(e){return HH.test(e)?"rtl":KH.test(e)?"ltr":null}function cs(e){return Hv(e)||e.isToken()}function ua(e){return cs(e)||e.isSegmented()}function Or(e){return El(e)&&e.nodeType===3}function LP(e){return El(e)&&e.nodeType===9}function mi(e){let t=e;for(;t!=null;){if(Or(t))return t;t=t.firstChild}return null}function Ac(e,t,n){let o=Yn[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~Yn.superscript:t==="superscript"?r&=~Yn.subscript:t==="lowercase"?(r&=~Yn.uppercase,r&=~Yn.capitalize):t==="uppercase"?(r&=~Yn.lowercase,r&=~Yn.capitalize):t==="capitalize"&&(r&=~Yn.lowercase,r&=~Yn.uppercase),r}function X5(e){return Ue(e)||di(e)||Yt(e)}function AP(e,t){let n=(function(){let s=yv;return yv=null,s})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);On(),yP();let o=Gt(),r=va(),a=""+PP++;r._nodeMap.set(a,e),me(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function us(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=s),a===null&&(o.__last=i),l!==null&&(l.__next=s),d!==null&&(d.__prev=i),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Ip(e){yP(),yp(e)&&ve(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=va(),r=Gt(),a=o._nodeMap,s=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,s);let i=t.__key;r._dirtyType=1,me(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function Fn(e){On();let t=Gt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Rn(n);o!==null&&o.getWritable()}if(e!==null){let o=Rn(e);o!==null&&o.getWritable()}}}function ds(){return Rl()?null:Gt()._compositionKey}function Rn(e,t){let n=(t||va())._nodeMap.get(e);return n===void 0?null:n}function Xv(e,t){let n=_p(e,Gt());return n!==void 0?Rn(n,t):null}function _p(e,t){return e[`__lexicalKey_${t._key}`]}function Dp(e,t){let n=e;for(;n!=null;){let o=Xv(n,t);if(o!==null)return o;n=Dc(n)}return null}function RP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function dT(e){return e.read(()=>ko().getTextContent())}function ko(){return EP(va())}function EP(e){return e._nodeMap.get("root")}function Co(e){On();let t=va();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function gl(e){let t=Gt(),n=(function(o,r){let a=o;for(;a!=null;){let s=_p(a,r);if(s!==void 0)return s;a=Dc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Rn("root"):null:Rn(n)}function MP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Yv(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function NP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function _P(e){return Or(e)?e.nodeValue:null}function Jv(e,t,n){let o=pr(Lo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:s}=o;if(r!==null){let i=_P(r),l=Dp(r);if(i!==null&&Ue(l)){if((i===xc||i===Pv)&&n){let d=n.length;i=n,a=d,s=d}i!==null&&Zv(l,i,a,s,e)}}}function Zv(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(xc)&&(i=t.slice(0,-xc.length)),r)){let d=Pv,c;for(;(c=i.indexOf(d))!==-1;)i=i.slice(0,c)+i.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||i!==l){if(i===""){if(Fn(null),Pp||Ec||kp)a.remove();else{let h=Gt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=hi(),f=a.getTextContentSize(),p=ds(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!s||Ge(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!s||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let g=Nt();if(!Ge(g)||n===null||o===null)return void cT(a,i,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=Dn(a.getTextContent());a.replace(h),a=h}cT(a,i,g)}}}function cT(e,t,n){if(e.setTextContent(t),Ge(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=cr(e,a.offset,"clamp"))}}}function ep(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function DP(e,t){return ep(e,t,"altKey")&&ep(e,t,"ctrlKey")&&ep(e,t,"shiftKey")&&ep(e,t,"metaKey")}function Ut(e,t,n){if(!DP(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 ca={ctrlKey:!sr,metaKey:sr},uT={altKey:sr,ctrlKey:!sr};function fT(e){return e.key==="Backspace"}function pT(e){return Ut(e,"a",ca)}function Y5(e){let t=ko();if(Ge(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"),cp(e),e}{let n=t.select(0,t.getChildrenSize());return Co(cp(n)),n}}function yl(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=Bc(r);return n[t]=a,a}return r}function ey(e,t,n,o,r){if(n.size===0)return;let a=o.__type,s=o.__key,i=t.get(a);i===void 0&&ve(33,a);let l=i.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(s),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(s,f?"updated":r)}function J5(e){let t=e.getType(),n=va();if(n._readOnly){let a=bv(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 mT(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 OP(e,t){let n=e.offset;if(e.type==="element")return mT(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?mT(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function FP(e){let t=Lo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Ae(e,t,n){return(function(o,r,a){let s=Yv(o);for(let i=4;i>=0;i--)for(let l=0;l<s.length;l++){let d=s[l],c=d._commands.get(r);if(c!==void 0){let f=c[i];if(f!==void 0){let p=Array.from(f),m=p.length,g=!1;if(Dr(d,()=>{for(let h=0;h<m;h++)if(p[h](a,o))return void(g=!0)}),g)return g}}}return!1})(e,t,n)}function wl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&ve(75,t),n}function Dc(e){let t=e.assignedSlot||e.parentElement;return KP(t)?t.host:t}function ty(e){return LP(e)?e:so(e)?e.ownerDocument:null}function Z5(e){return Gt()._updateTags.has(e)}function Op(e){On(),Gt()._updateTags.add(e)}function BP(e){On(),Gt()._deferred.push(e)}function wp(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function ny(e){let t=ty(e);return t?t.defaultView:null}function Lo(e){let t=e._window;return t===null&&ve(78),t}function eK(e){return me(e)&&e.isInline()||Yt(e)&&e.isInline()}function UP(e){let t=e.getParentOrThrow();for(;t!==null;){if(Go(t))return t;t=t.getParentOrThrow()}return t}function Go(e){return Wn(e)||me(e)&&e.isShadowRoot()}function oy(e){let t=e.constructor.clone(e);return AP(t,null),t.afterCloneFrom(e),t}function Oc(e){let t=Gt(),n=e.getType(),o=Gv(t,n);o===void 0&&ve(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||ve(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,n):s instanceof e.constructor&&i!==e.constructor||ve(202,i.name,i.getType(),e.constructor.name,n),s.__key===e.__key&&ve(203,e.constructor.name,n,i.name,i.getType()),s}return e}function Vh(e,t){!Wn(e.getParent())||me(t)||Yt(t)||ve(99)}function zP(e){let t=Rn(e);return t===null&&ve(63,e),t}function Wh(e){return(Yt(e)||me(e)&&!e.canBeEmpty())&&!e.isInline()}function Cv(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function pr(e){return fr?(e||window).getSelection():null}function HP(e){let t=ny(e);return t?t.getSelection():null}function tK(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),Go(e)&&ve(102);let o=s=>{let i=s.getParentOrThrow(),l=Go(i),d=s!==n||l?oy(s):s;if(l)return me(s)&&me(d)||ve(133),s.insertAfter(d),[s,d,d];{let[c,f,p]=o(i),m=s.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function nK(e){return so(e)&&e.tagName==="A"}function so(e){return El(e)&&e.nodeType===1}function El(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function KP(e){return El(e)&&e.nodeType===11}function $P(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 xv(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 pa(e){if(Yt(e)&&!e.isInline())return!0;if(!me(e)||Go(e))return!1;let t=e.getFirstChild(),n=t===null||di(t)||Ue(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function ry(){return Gt()}var gT=new WeakMap,oK=new Map;function bv(e){if(!e._readOnly&&e.isEmpty())return oK;e._readOnly||ve(192);let t=gT.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let s=a.__type,i=o.get(s);i||(i=new Map,o.set(s,i)),i.set(r,a)}return o})(e),gT.set(e,t)),t}function ay(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function rK(e){return(t=ay(e))[aP]=!0,t;var t}function qP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function aK(e){e.__lexicalUnmanaged=!0}function VP(e){return e.__lexicalUnmanaged===!0}function fc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==Wo[t]}function Fc(e){let t=k0 in e.prototype?e.prototype[k0]():void 0,n=(function(s){if(!(s===Wo||s.prototype instanceof Wo)){let i="<unknown>",l="<unknown>";try{i=s.getType()}catch{}try{ms.version&&(l=JSON.parse(ms.version))}catch{}ve(290,s.name,i,l)}return s===kc||s===ps||s===Wo})(e),o=!n&&fc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!n&&a&&(fc(e,"getType")||(e.getType=()=>a),fc(e,"clone")||(e.clone=s=>(Vv(s),new e)),fc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!fc(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function sK(e){let t=ry();return On(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var vc=(e,t)=>{let n=e;for(;n!=null&&!Wn(n);){if(t(n))return n;n=n.getParent()}return null},iK={next:"previous",previous:"next"},Tl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return ly({hasNext:gi,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,s=this.getParentAtCaret(),i=new Map;for(let l=a.getAdjacentCaret();l!==null&&i.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();i.set(d.getKey(),d)}for(let l of r){if(i.size>0){let d=a.getNodeAtCaret();if(d){if(i.delete(d.getKey()),i.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(s)&&l.remove(),d.replace(l)}}else d===null&&ve(263,Array.from(i).join(" "))}else a.insert(l);a=zn(l,this.direction)}for(let l of i.values())l.remove();return this}},Rc=class e extends Tl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:ha(t,this.direction)}getParentCaret(t="root"){return zn(sy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Cs(this.direction);return zn(this.getNodeAtCaret(),t)||ha(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)}},lK={root:Wn,shadowRoot:Go};function Cs(e){return iK[e]}function sy(e,t="root"){return lK[t](e)?null:e}var Pl=class e extends Tl{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 me(this.origin)?ha(this.origin,this.direction):null}getParentCaret(t="root"){return zn(sy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Cs(this.direction);return zn(this.getNodeAtCaret(),t)||ha(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 kl)&&this.direction===t.direction&&this.origin.is(t.origin)}},kl=class e extends Tl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:gs(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return zn(sy(this.getParentAtCaret(),t),this.direction)}getFlipped(){return gs(this.origin,Cs(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 Pl||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return zn(this.origin,this.direction)}};function ga(e){return e instanceof kl}function dK(e){return e instanceof Tl}function gi(e){return e instanceof Pl}function dr(e){return e instanceof Rc}var cK={next:class extends kl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends kl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},uK={next:class extends Pl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Pl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},fK={next:class extends Rc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Rc{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 uK[t](e):null}function gs(e,t,n){return e?new cK[t](e,cr(e,n)):null}function cr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&yT(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function Sv(e,t){return new Tp(e,t)}function ha(e,t){return me(e)?new fK[t](e):null}function WP(e){return e&&e.getChildCaret()||e}function Ll(e){return e&&WP(e.getAdjacentCaret())}var Iv=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return ga(a)?(function(s,i){let{direction:l,origin:d}=s,c=cr(d,i==="focus"?Cs(l):l);return Sv(s,c-s.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[Sv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=ga(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=ga(o),a=s=>s.isSameNodeCaret(o)?null:Ll(s)||s.getParentCaret(t);return ly({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:a(n),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Tp=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 gs(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function pK(e){return e instanceof Tp}function iy(e){return hs(e,zn(ko(),e.direction))}function GP(e){return hs(e,e)}function hs(e,t){return e.direction!==t.direction&&ve(265),new Iv(e,t,e.direction)}function ly(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 s={done:!1,value:r(a)};return a=o(a),s}}}function dy(e,t){let n=yc(e.origin,t.origin);switch(n===null&&ve(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,s){return Math.sign(a-s)})(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 cy(n)}}function cy(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,s=n;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===o)return 1}return a===null?1:-1}function tp(e,t){return t.is(e)}function hT(e){return me(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function yc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=hT(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=hT(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(tp(e,o)||ve(276),{commonAncestor:o,type:"ancestor"}):r===null?(tp(t,o)||ve(277),{commonAncestor:o,type:"descendant"}):((me(a)||tp(e,a))&&(me(r)||tp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||ve(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function vs(e,t){let{type:n,key:o,offset:r}=e,a=zP(e.key);return n==="text"?(Ue(a)||ve(266,a.getType(),o),gs(a,t,r)):(me(a)||ve(267,a.getType(),o),YP(a,e.offset,t))}function Al(e,t){let{origin:n,direction:o}=t,r=o==="next";ga(t)?e.set(n.getKey(),t.offset,"text"):gi(t)?Ue(n)?e.set(n.getKey(),cr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(dr(t)&&me(n)||ve(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function jP(e){let t=Nt(),n=Ge(t)?t:hP();return Cc(n,e),Co(n),n}function Cc(e,t){Al(e.anchor,t.anchor),Al(e.focus,t.focus)}function wv(e){let{anchor:t,focus:n}=e,o=vs(t,"next"),r=vs(n,"next"),a=dy(o,r)<=0?"next":"previous";return hs(ys(o,a),ys(r,a))}function Ml(e){let{direction:t,origin:n}=e,o=zn(n,Cs(t)).getNodeAtCaret();return o?zn(o,t):ha(n.getParentOrThrow(),t)}function vT(e,t="root"){let n=[e];for(let o=dr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Ml(o));return n}function Gh(e){return!!e&&e.origin.isAttached()}function QP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=uy(e,o),s=vT(a.anchor,n),i=vT(a.focus.getFlipped(),n),l=new Set,d=[];for(let g of a.iterNodeCarets(n))if(dr(g))l.add(g.origin.getKey());else if(gi(g)){let{origin:h}=g;me(h)&&!l.has(h.getKey())||d.push(h)}for(let g of d)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,v=h.getTextContentSize(),y=Ml(zn(h,o)),C=h.getMode();if(Math.abs(g.distance)===v&&r==="removeEmptySlices"||C==="token"&&g.distance!==0)y.remove();else if(g.distance!==0){r="removeEmptySlices";let x=g.removeTextSlice(),b=g.caret.origin;if(C==="segmented"){let w=x.origin,I=Dn(w.getTextContent()).setStyle(w.getStyle()).setFormat(w.getFormat());y.replaceOrInsert(I),x=gs(I,o,x.offset)}b.is(s[0].origin)&&(s[0]=x),b.is(i[0].origin)&&(i[0]=x.getFlipped())}}let c,f;for(let g of s)if(Gh(g)){c=ir(g);break}for(let g of i)if(Gh(g)){f=ir(g);break}let p=(function(g,h,v){if(!g||!h)return null;let y=g.getParentAtCaret(),C=h.getParentAtCaret();if(!y||!C)return null;let x=y.getParents().reverse();x.push(y);let b=C.getParents().reverse();b.push(C);let w=Math.min(x.length,b.length),I;for(I=0;I<w&&x[I]===b[I];I++);let k=(L,A)=>{let M;for(let R=I;R<L.length;R++){let D=L[R];if(Go(D))return;!M&&A(D)&&(M=D)}return M},P=k(x,pa),T=P&&k(b,L=>v.has(L.getKey())&&pa(L));return P&&T?[P,T]:null})(c,f,l);if(p){let[g,h]=p;ha(g,"previous").splice(0,h.getChildren());let v=h.getParent();for(h.remove(!0);v&&v.isEmpty();){let y=v;v=v.getParent(),y.remove(!0)}}let m=[c,f,...s,...i].find(Gh);if(m)return GP(ys(ir(m),e.direction));ve(269,JSON.stringify(s.map(g=>g.origin.__key)))}function ir(e){let t=(function(r){let a=r;for(;dr(a);){let s=Ll(a);if(!dr(s))break;a=s}return a})(e.getLatest()),{direction:n}=t;if(Ue(t.origin))return ga(t)?t:gs(t.origin,n,n);let o=t.getAdjacentCaret();return gi(o)&&Ue(o.origin)?gs(o.origin,n,Cs(n)):t}function XP(e){return ga(e)&&e.offset!==cr(e.origin,e.direction)}function ys(e,t){return e.direction===t?e:e.getFlipped()}function uy(e,t){return e.direction===t?e:hs(ys(e.focus,t),ys(e.anchor,t))}function YP(e,t,n){let o=ha(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return ys(o,n)}function mK(e,t="root"){let n=0,o=e,r=Ll(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Ll(o)}return r&&[r,n]}function gK(e){let{origin:t,offset:n,direction:o}=e;if(n===cr(t,o))return e.getSiblingCaret();if(n===cr(t,Cs(o)))return Ml(e.getSiblingCaret());let[r]=t.splitText(n);return Ue(r)||ve(281),ys(zn(r,"next"),o)}function hK(e,t){return!0}function vK(e,{$copyElementNode:t=oy,$splitTextPointCaretNext:n=gK,rootMode:o="shadowRoot",$shouldSplit:r=hK}={}){if(ga(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:s}=a;if(dr(e)&&(!s.canBeEmpty()||!r(s,"first")))return Ml(a);let i=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function yK(e){return e}function CK(...e){return e}function xK(e,t){return[e,t]}function bK(e){return e}function SK(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Bc(...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 IK(e,...t){let n=Bc(...t);n.length>0&&e.classList.add(...n)}function wK(e,...t){let n=Bc(...t);n.length>0&&e.classList.remove(...n)}function TK(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var _=fy,Hoe=_.$addUpdateTag,Nl=_.$applyNodeReplacement,_l=_.$caretFromPoint,JP=_.$caretRangeFromSelection,Fp=_.$cloneWithProperties,ZP=_.$cloneWithPropertiesEphemeral,Koe=_.$comparePointCaretNext,$oe=_.$copyNode,ek=_.$create,vi=_.$createLineBreakNode,tk=_.$createNodeSelection,jo=_.$createParagraphNode,qoe=_.$createPoint,yi=_.$createRangeSelection,nk=_.$createRangeSelectionFromDom,ok=_.$createTabNode,mr=_.$createTextNode,rk=_.$extendCaretToRange,ya=_.$findMatchingParent,py=_.$getAdjacentChildCaret,Voe=_.$getAdjacentNode,Ci=_.$getAdjacentSiblingOrParentSiblingCaret,my=_.$getCaretInDirection,ak=_.$getCaretRange,Woe=_.$getCaretRangeInDirection,sk=_.$getCharacterOffsets,xs=_.$getChildCaret,Goe=_.$getChildCaretAtIndex,gy=_.$getChildCaretOrSelf,ik=_.$getCollapsedCaretRange,joe=_.$getCommonAncestor,Qoe=_.$getCommonAncestorResultBranchOrder,Bp=_.$getEditor,Xoe=_.$getNearestNodeFromDOMNode,Yoe=_.$getNearestRootOrShadowRoot,Dl=_.$getNodeByKey,Joe=_.$getNodeByKeyOrThrow,lk=_.$getNodeFromDOMNode,Uc=_.$getPreviousSelection,Lt=_.$getRoot,Oe=_.$getSelection,Ca=_.$getSiblingCaret,Up=_.$getState,Zoe=_.$getStateChange,ere=_.$getTextContent,tre=_.$getTextNodeOffset,nre=_.$getTextPointCaret,ore=_.$getTextPointCaretSlice,rre=_.$getWritableNodeState,dk=_.$hasAncestor,are=_.$hasUpdateTag,sre=_.$insertNodes,Ol=_.$isBlockElementNode,zc=_.$isChildCaret,zp=_.$isDecoratorNode,ck=_.$isEditorState,We=_.$isElementNode,uk=_.$isExtendableTextPointCaret,ire=_.$isInlineElementOrDecoratorNode,fk=_.$isLeafNode,Fl=_.$isLineBreakNode,lre=_.$isNodeCaret,hy=_.$isNodeSelection,pk=_.$isParagraphNode,ke=_.$isRangeSelection,Hc=_.$isRootNode,xi=_.$isRootOrShadowRoot,mk=_.$isSiblingCaret,dre=_.$isTabNode,it=_.$isTextNode,Hp=_.$isTextPointCaret,cre=_.$isTextPointCaretSlice,vy=_.$isTokenOrSegmented,ure=_.$isTokenOrTab,fre=_.$nodesOfType,gk=_.$normalizeCaret,hk=_.$normalizeSelection__EXPERIMENTAL,pre=_.$onUpdate,vk=_.$parseSerializedNode,mre=_.$removeTextFromCaretRange,yk=_.$rewindSiblingCaret,Kp=_.$selectAll,gre=_.$setCompositionKey,hre=_.$setPointFromCaret,gr=_.$setSelection,Ck=_.$setSelectionFromCaretRange,$p=_.$setState,xk=_.$splitAtPointCaretNext,bk=_.$splitNode,vre=_.$updateRangeSelectionFromCaretRange,yy=_.ArtificialNode__DO_NOT_USE,yre=_.BEFORE_INPUT_COMMAND,Sk=_.BLUR_COMMAND,Kc=_.CAN_REDO_COMMAND,$c=_.CAN_UNDO_COMMAND,qp=_.CLEAR_EDITOR_COMMAND,Ik=_.CLEAR_HISTORY_COMMAND,wk=_.CLICK_COMMAND,Cre=_.COLLABORATION_TAG,Vp=_.COMMAND_PRIORITY_CRITICAL,Jt=_.COMMAND_PRIORITY_EDITOR,Qo=_.COMMAND_PRIORITY_HIGH,Bl=_.COMMAND_PRIORITY_LOW,xre=_.COMMAND_PRIORITY_NORMAL,bre=_.COMPOSITION_END_COMMAND,Tk=_.COMPOSITION_END_TAG,Sre=_.COMPOSITION_START_COMMAND,Pk=_.COMPOSITION_START_TAG,kk=_.CONTROLLED_TEXT_INSERTION_COMMAND,Wp=_.COPY_COMMAND,Lk=_.CUT_COMMAND,Gp=_.DELETE_CHARACTER_COMMAND,Ak=_.DELETE_LINE_COMMAND,Rk=_.DELETE_WORD_COMMAND,Ire=_.DRAGEND_COMMAND,wre=_.DRAGOVER_COMMAND,Ek=_.DRAGSTART_COMMAND,Mk=_.DROP_COMMAND,hr=_.DecoratorNode,Tre=_.ElementNode,Nk=_.FOCUS_COMMAND,Pre=_.FORMAT_ELEMENT_COMMAND,_k=_.FORMAT_TEXT_COMMAND,jp=_.HISTORIC_TAG,Ao=_.HISTORY_MERGE_TAG,Dk=_.HISTORY_PUSH_TAG,Cy=_.INDENT_CONTENT_COMMAND,kre=_.INPUT_COMMAND,xy=_.INSERT_LINE_BREAK_COMMAND,Ok=_.INSERT_PARAGRAPH_COMMAND,Fk=_.INSERT_TAB_COMMAND,qc=_.INTERNAL_$isBlock,Lre=_.IS_ALL_FORMATTING,Are=_.IS_BOLD,Rre=_.IS_CODE,Ere=_.IS_HIGHLIGHT,Mre=_.IS_ITALIC,Nre=_.IS_STRIKETHROUGH,_re=_.IS_SUBSCRIPT,Dre=_.IS_SUPERSCRIPT,Ore=_.IS_UNDERLINE,Bk=_.KEY_ARROW_DOWN_COMMAND,Qp=_.KEY_ARROW_LEFT_COMMAND,Xp=_.KEY_ARROW_RIGHT_COMMAND,Uk=_.KEY_ARROW_UP_COMMAND,Yp=_.KEY_BACKSPACE_COMMAND,zk=_.KEY_DELETE_COMMAND,Hk=_.KEY_DOWN_COMMAND,Jp=_.KEY_ENTER_COMMAND,Kk=_.KEY_ESCAPE_COMMAND,Fre=_.KEY_MODIFIER_COMMAND,Bre=_.KEY_SPACE_COMMAND,Zp=_.KEY_TAB_COMMAND,$k=_.LineBreakNode,Ure=_.MOVE_TO_END,zre=_.MOVE_TO_START,Hre=_.NODE_STATE_KEY,qk=_.OUTDENT_CONTENT_COMMAND,em=_.PASTE_COMMAND,Vk=_.PASTE_TAG,Wk=_.ParagraphNode,Gk=_.REDO_COMMAND,jk=_.REMOVE_TEXT_COMMAND,Qk=_.RootNode,Kre=_.SELECTION_CHANGE_COMMAND,Xk=_.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,Yk=_.SELECT_ALL_COMMAND,$re=_.SKIP_COLLAB_TAG,Jk=_.SKIP_DOM_SELECTION_TAG,by=_.SKIP_SCROLL_INTO_VIEW_TAG,qre=_.SKIP_SELECTION_FOCUS_TAG,Zk=_.TEXT_TYPE_TO_FORMAT,eL=_.TabNode,tm=_.TextNode,tL=_.UNDO_COMMAND,Vc=_.addClassNamesToElement,Vre=_.buildImportMap,nm=_.configExtension,nL=_.createCommand,om=_.createEditor,Wre=_.createSharedNodeState,oL=_.createState,rL=_.declarePeerDependency,Sn=_.defineExtension,Gre=_.flipDirection,jre=_.getDOMOwnerDocument,Sy=_.getDOMSelection,Qre=_.getDOMSelectionFromTarget,aL=_.getDOMTextNode,Xre=_.getEditorPropertyFromDOMNode,Yre=_.getNearestEditorFromDOMNode,sL=_.getRegisteredNode,Jre=_.getRegisteredNodeOrThrow,Zre=_.getStaticNodeConfig,eae=_.getTextDirection,tae=_.getTransformSetFromKlass,iL=_.isBlockDomNode,nae=_.isCurrentlyReadOnlyMode,lL=_.isDOMDocumentNode,dL=_.isDOMNode,oae=_.isDOMTextNode,rae=_.isDOMUnmanaged,Iy=_.isDocumentFragment,aae=_.isExactShortcutMatch,cL=_.isHTMLAnchorElement,rm=_.isHTMLElement,Wc=_.isInlineDomNode,sae=_.isLexicalEditor,iae=_.isModifierMatch,lae=_.isSelectionCapturedInDecoratorInput,uL=_.isSelectionWithinEditor,wy=_.makeStepwiseIterator,Fr=_.mergeRegister,dae=_.normalizeClassNames,am=_.removeClassNamesFromElement,cae=_.removeFromParent,uae=_.resetRandomKey,vr=_.safeCast,fae=_.setDOMUnmanaged,pae=_.setNodeIndentFromDOM,sm=_.shallowMergeConfig,Ty=_.toggleTextFormatType;var Py={};bn(Py,{LexicalComposer:()=>kK});le();var fL=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,PK=fL?xe:q,im={tag:Ao};function kK({initialConfig:e,children:t}){let n=V(()=>{let{theme:o,namespace:r,nodes:a,onError:s,editorState:i,html:l}=e,d=P0(null,o),c=om({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>s(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=Lt();if(m.isEmpty()){let g=jo();m.append(g);let h=fL?document.activeElement:null;(Oe()!==null||h!==null&&h===f.getRootElement())&&g.select()}},im);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,im);break}case"object":f.setEditorState(p,im);break;case"function":f.update(()=>{Lt().isEmpty()&&p(f)},im)}}})(c,i),[c,d]},[]);return PK(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(T0.Provider,{value:n,children:t})}var LK=Py,pL=LK.LexicalComposer;var Ly={};bn(Ly,{$canShowPlaceholder:()=>gL,$canShowPlaceholderCurry:()=>RK,$findTextIntersectionFromCharacters:()=>EK,$isRootTextContentEmpty:()=>ky,$isRootTextContentEmptyCurry:()=>AK,$rootTextContent:()=>mL,registerLexicalTextEntity:()=>NK});function mL(){return Lt().getTextContent()}function ky(e,t=!0){if(e)return!1;let n=mL();return t&&(n=n.trim()),n===""}function AK(e,t){return()=>ky(e,t)}function gL(e){if(!ky(e,!1))return!1;let t=Lt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(zp(r))return!1;if(We(r)){if(!pk(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let l=a[o];if(!it(l))return!1}}}return!0}function RK(e){return()=>gL(e)}function EK(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(We(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(it(n)){let s=n.getTextContentSize();if(o+s>t)return{node:n,offset:t-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){n=s;continue e}a=a.getParent()}break}return null}function MK(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 NK(e,t,n,o){let r=s=>s instanceof n,a=s=>{let i=mr(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(tm,s=>{if(!s.isSimpleText())return;let i,l=s.getPreviousSibling(),d=s.getTextContent(),c=s;if(it(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(g=>g.getLatest().__mode)(l)!==0)return void a(l);{let g=m.end-p.length;if(g>0){let h=p+d.slice(0,g);if(l.select(),l.setTextContent(h),g===d.length)s.remove();else{let v=d.slice(g);s.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){i=t(d);let p,m=i===null?"":d.slice(i.end);if(d=m,m===""){let h=c.getNextSibling();if(it(h)){m=c.getTextContent()+h.getTextContent();let v=t(m);if(v===null)return void(r(h)?a(h):h.markDirty());if(v.start!==0)return}}if(i===null)return;if(i.start===0&&it(l)&&l.isTextEntity()){f+=i.end;continue}i.start===0?[p,c]=c.splitText(i.end):[,p,c]=c.splitText(i.start+f,i.end+f),p===void 0&&MK(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),c==null)return;f=0,l=g}}),e.registerNodeTransform(n,s=>{let i=s.getTextContent(),l=t(i);if(l===null||l.start!==0)return void a(s);if(i.length>l.end)return void s.splitText(l.end);let d=s.getPreviousSibling();it(d)&&d.isTextEntity()&&(a(d),a(s));let c=s.getNextSibling();it(c)&&c.isTextEntity()&&(a(c),r(s)&&a(s))})]}var bi=Ly,bae=bi.$canShowPlaceholder,lm=bi.$canShowPlaceholderCurry,Sae=bi.$findTextIntersectionFromCharacters,Iae=bi.$isRootTextContentEmpty,wae=bi.$isRootTextContentEmptyCurry,Tae=bi.$rootTextContent,Pae=bi.registerLexicalTextEntity;var _y={};bn(_y,{$addNodeStyle:()=>UK,$cloneWithProperties:()=>Fp,$copyBlockFormatIndent:()=>wL,$ensureForwardRangeSelection:()=>IL,$forEachSelectedTextNode:()=>SL,$getComputedStyleForElement:()=>Ey,$getComputedStyleForParent:()=>My,$getSelectionStyleValueForProperty:()=>GK,$isAtNodeEnd:()=>BK,$isParentElementRTL:()=>Ny,$isParentRTL:()=>OK,$moveCaretSelection:()=>kL,$moveCharacter:()=>VK,$patchStyleText:()=>zK,$selectAll:()=>Kp,$setBlocksType:()=>HK,$shouldOverrideDefaultCharacterSelection:()=>qK,$sliceSelectedTextNodeContent:()=>FK,$trimTextContentFromAnchor:()=>bL,$wrapNodes:()=>$K,createDOMRange:()=>_K,createRectsFromDOMRange:()=>DK,getCSSFromStyleObject:()=>xL,getStyleObjectFromCSS:()=>um,trimTextContentFromAnchor:()=>jK});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 cm=new Map;function hL(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function vL(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function _K(e,t,n,o,r){let a=t.getKey(),s=o.getKey(),i=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(s),c=n,f=r;if(it(t)&&(l=hL(l)),it(o)&&(d=hL(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=vL(l)),d.nodeName==="BR"&&([d,f]=vL(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{i.setStart(l,c),i.setEnd(d,f)}catch{return null}return!i.collapsed||c===f&&a===s||(i.setStart(d,f),i.setEnd(l,c)),i}function DK(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,l=s.length;s.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=s[d],f=i&&i.top<=c.top&&i.top+i.height>c.top&&i.left+i.width>c.left,p=c.width+a===o.width;f||p?(s.splice(d--,1),l--):i=c}return s}function CL(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 um(e){let t=cm.get(e);return t===void 0&&(t=CL(e),cm.set(e,t)),t}function xL(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ey(e){let t=Bp().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function My(e){return Ey(Hc(e)?e:e.getParentOrThrow())}function OK(e){let t=My(e);return t!==null&&t.direction==="rtl"}function FK(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!vy(t)&&o!==null){let[r,a]=o,s=e.isBackward(),i=r.getNode(),l=a.getNode(),d=t.is(i),c=t.is(l);if(d||c){let[f,p]=sk(e),m=i.is(l),g=t.is(s?l:i),h=t.is(s?i:l),v,y=0;m?(y=f>p?p:f,v=f>p?f:p):g?(y=s?p:f,v=void 0):h&&(y=0,v=s?f:p);let C=t.__text.slice(y,v);C!==t.__text&&(n==="clone"&&(t=ZP(t)),t.__text=C)}}return t}function BK(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return We(t)||Ry(177),e.offset===t.getChildrenSize()}function bL(e,t,n){let o=t.getNode(),r=n;if(We(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(We(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),s=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&&(s=d.isInline()?0:2,a=c)}let i=o.getTextContent();i===""&&We(o)&&!o.isInline()&&(i=`
3832
3783
 
3833
- `);let l=i.length;if(!dt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||Kc(d)||d.remove(),r-=l+s,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=Fl(d);return dt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=i.slice(0,f);if(c!==null&&c!==i){let m=zc(),g=o;if(o.isSimpleText())o.setTextContent(c);else{let h=hr(c);o.replace(h),g=h}if(Le(m)&&m.isCollapsed()){let h=m.anchor.offset;g.select(h,h)}}else if(o.isSimpleText()){let m=t.key===d,g=t.offset;g<r&&(g=l);let h=m?g-r:0,v=m?g:f;if(m&&h===0){let[y]=o.splitText(h,v);y.remove()}else{let[,y]=o.splitText(h,v);y.remove()}}else{let m=hr(p);o.replace(m)}r=0}}}function VK(e){let t=e.getStyle(),n=SL(t);um.set(t,n)}function cm(e,t){(Le(e)?e.isCollapsed():dt(e)||We(e))||My(280);let n=fm(Le(e)?e.style:dt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(n[s],e):i===null?delete a[s]:a[s]=i,a),{...n}),r=IL(o);Le(e)||dt(e)?e.setStyle(r):e.setTextStyle(r),um.set(r,o)}function WK(e,t){if(Le(e)&&e.isCollapsed()){cm(e,t);let o=e.anchor.getNode();We(o)&&o.isEmpty()&&cm(o,t)}TL(o=>{cm(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!We(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),cm(r,t))}}}function TL(e){let t=Fe();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Le(t))for(let a of tk(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!dt(a)||!a.canHaveFormat())continue;let[s,i]=o(a);i!==s&&(Cy(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}Le(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&PL(t)}function PL(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 kL(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function GK(e,t,n=kL){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[s,i]=o;a=Si(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let l=ya(s.getNode(),Vc),d=ya(i.getNode(),Vc);We(l)&&r.set(l.getKey(),l),We(d)&&r.set(d.getKey(),d)}for(let s of e.getNodes())if(We(s)&&Vc(s))r.set(s.getKey(),s);else if(o===null){let i=ya(s,Vc);We(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let l=t();n(i,l),i.replace(l,!0),a&&(s===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Fe())&&vr(a)}function bL(e){return e.getNode().isAttached()}function jK(e){let t=e;for(;t!==null&&!wi(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function QK(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===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 i=null,l=[];for(let d=0;d<s;d++){let c=a[d];wi(c)?(Ey(e,l,l.length,t,n),l=[],i=c):i===null||i!==null&&fk(c,i)?l.push(c):(Ey(e,l,l.length,t,n),l=[c])}Ey(e,l,l.length,t,n)}function Ey(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],s=new Map,i=[],l=We(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,d=!0;break}if(l=l.getParentOrThrow(),wi(l))break}let c=new Set;for(let g=0;g<n;g++){let h=t[g];We(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let f=new Set;for(let g=0;g<n;g++){let h=t[g],v=h.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&gk(h)&&!f.has(h.getKey())){let y=v.getKey();if(s.get(y)===void 0){let C=o();C.setFormat(v.getFormatType()),C.setIndent(v.getIndent()),i.push(C),s.set(y,C),v.getChildren().forEach(x=>{C.append(x),f.add(x.getKey()),We(x)&&x.getChildrenKeys().forEach(b=>f.add(b))}),jK(v)}}else if(c.has(h.getKey())){We(h)||My(179);let y=o();y.setFormat(h.getFormatType()),y.setIndent(h.getIndent()),i.push(y),h.remove(!0)}}if(r!==null)for(let g=0;g<i.length;g++){let h=i[g];r.append(h)}let p=null;if(wi(l))if(d)if(r!==null)l.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];l.insertAfter(h)}else{let g=l.getFirstChild();if(We(g)&&(l=g),g===null)if(r)l.append(r);else for(let h=0;h<i.length;h++){let v=i[h];l.append(v),p=v}else if(r!==null)g.insertBefore(r);else for(let h=0;h<i.length;h++){let v=i[h];g.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];l.insertAfter(h),p=h}let m=zc();Le(m)&&bL(m.anchor)&&bL(m.focus)?vr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function LL(e){let t=AL(e);return t!==null&&t.writingMode==="vertical-rl"}function AL(e){let t=e.anchor.getNode();return We(t)?Ny(t):_y(t)}function XK(e,t){let n=LL(e)?!t:t;Dy(e)&&(n=!n);let o=Ol(e.focus,n?"previous":"next");if(mk(o))return!1;for(let r of ik(o)){if(Hc(r))return!r.origin.isInline();if(!We(r.origin)){if(Hp(r.origin))return!0;break}}return!1}function RL(e,t,n,o){e.modify(t?"extend":"move",n,o)}function Dy(e){let t=AL(e);return t!==null&&t.direction==="rtl"}function YK(e,t,n){let o=Dy(e),r;r=LL(e)||o?!n:n,RL(e,t,r,"character")}function JK(e,t,n){let o=fm(e.getStyle());return o!==null&&o[t]||n}function ZK(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),l=i?s.offset:a.offset,d=i?s.getNode():a.getNode();if(Le(e)&&e.isCollapsed()&&e.style!==""){let c=fm(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))&&dt(f)){let p=JK(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var e$=wL;var sn=Oy,EL=sn.$addNodeStyle,Dae=sn.$cloneWithProperties,Oae=sn.$copyBlockFormatIndent,Fae=sn.$ensureForwardRangeSelection,Bae=sn.$forEachSelectedTextNode,Uae=sn.$getComputedStyleForElement,zae=sn.$getComputedStyleForParent,Hae=sn.$getSelectionStyleValueForProperty,Kae=sn.$isAtNodeEnd,$ae=sn.$isParentElementRTL,qae=sn.$isParentRTL,Vae=sn.$moveCaretSelection,Fy=sn.$moveCharacter,Wae=sn.$patchStyleText,Gae=sn.$selectAll,jae=sn.$setBlocksType,By=sn.$shouldOverrideDefaultCharacterSelection,pm=sn.$sliceSelectedTextNodeContent,Qae=sn.$trimTextContentFromAnchor,Xae=sn.$wrapNodes,Yae=sn.createDOMRange,ML=sn.createRectsFromDOMRange,Jae=sn.getCSSFromStyleObject,Zae=sn.getStyleObjectFromCSS,ese=sn.trimTextContentFromAnchor;var Ky={};In(Ky,{$descendantsMatching:()=>F$,$dfs:()=>C$,$dfsIterator:()=>KL,$filter:()=>E$,$findMatchingParent:()=>ya,$firstToLastIterator:()=>B$,$getAdjacentCaret:()=>x$,$getAdjacentSiblingOrParentSiblingCaret:()=>Ii,$getDepth:()=>qL,$getNearestBlockElementAncestorOrThrow:()=>T$,$getNearestNodeOfType:()=>w$,$getNextRightPreorderNode:()=>I$,$getNextSiblingOrParentSibling:()=>S$,$handleIndentAndOutdent:()=>M$,$insertFirst:()=>N$,$insertNodeToNearestRoot:()=>L$,$insertNodeToNearestRootAtCaret:()=>WL,$isEditorIsNestedEditor:()=>D$,$lastToFirstIterator:()=>Hy,$restoreEditorState:()=>k$,$reverseDfs:()=>b$,$reverseDfsIterator:()=>VL,$splitNode:()=>wk,$unwrapAndFilterDescendants:()=>O$,$unwrapNode:()=>U$,$wrapNodeInElement:()=>A$,CAN_USE_BEFORE_INPUT:()=>c$,CAN_USE_DOM:()=>UL,IS_ANDROID:()=>u$,IS_ANDROID_CHROME:()=>f$,IS_APPLE:()=>p$,IS_APPLE_WEBKIT:()=>m$,IS_CHROME:()=>g$,IS_FIREFOX:()=>zL,IS_IOS:()=>h$,IS_SAFARI:()=>v$,addClassNamesToElement:()=>Wc,calculateZoomLevel:()=>_$,isBlockDomNode:()=>cL,isHTMLAnchorElement:()=>pL,isHTMLElement:()=>am,isInlineDomNode:()=>Gc,isMimeType:()=>HL,makeStateWrapper:()=>z$,markSelection:()=>BL,mediaFileReader:()=>y$,mergeRegister:()=>zr,objectKlassEquals:()=>R$,positionNodeOnRange:()=>FL,registerNestedElementResolver:()=>P$,removeClassNamesFromElement:()=>sm,selectionAlwaysOnDisplay:()=>d$});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 xr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,t$=xr&&"documentMode"in document?document.documentMode:null,DL=xr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),n$=xr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),o$=!(!xr||!("InputEvent"in window)||t$)&&"getTargetRanges"in new window.InputEvent("input"),r$=xr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),a$=xr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,OL=xr&&/Android/.test(navigator.userAgent),zy=xr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),s$=xr&&OL&&zy,i$=xr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&DL&&!zy;function Hr(e){return`${e}px`}var l$={attributes:!0,characterData:!0,childList:!0,subtree:!0};function FL(e,t,n){let o=null,r=null,a=null,s=[],i=document.createElement("div");function l(){o===null&&mm(182),r===null&&mm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=ML(e,t);var g,h;i.isConnected||(h=i,(g=r).insertBefore(h,g.firstChild));let v=!1;for(let y=0;y<m.length;y++){let C=m[y],x=s[y]||document.createElement("div"),b=x.style;b.position!=="absolute"&&(b.position="absolute",v=!0);let T=Hr(C.left-f);b.left!==T&&(b.left=T,v=!0);let I=Hr(C.top-p);b.top!==I&&(x.style.top=I,v=!0);let k=Hr(C.width);b.width!==k&&(x.style.width=k,v=!0);let P=Hr(C.height);b.height!==P&&(x.style.height=P,v=!0),x.parentNode!==i&&(i.append(x),v=!0),s[y]=x}for(;s.length>m.length;)s.pop();v&&n(s)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,i.remove();for(let f of s)f.remove();s=[]}i.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!am(m))return d();d(),o=p,r=m,a=new MutationObserver(g=>{let h=e.getRootElement(),v=h&&h.parentElement;if(h!==o||v!==r)return f();for(let y of g)if(!i.contains(y.target))return l()}),a.observe(m,l$),l()});return()=>{c(),d()}}function NL(e,t,n){if(e.type!=="text"&&We(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[lL(n)||n,e.offset]}function BL(e,t){let n=null,o=null,r=null,a=null,s=null,i=null,l=()=>{};function d(c){c.read(()=>{let f=Fe();if(!Le(f))return n=null,r=null,a=null,i=null,l(),void(l=()=>{});let[p,m]=(function(P){let w=P.getStartEndPoints();return P.isBackward()?[w[1],w[0]]:w})(f),g=p.getNode(),h=g.getKey(),v=p.offset,y=m.getNode(),C=y.getKey(),x=m.offset,b=e.getElementByKey(h),T=e.getElementByKey(C),I=n===null||b!==o||v!==r||h!==n.getKey(),k=a===null||T!==s||x!==i||C!==a.getKey();if((I||k)&&b!==null&&T!==null){let P=(function(w,L,A,M,R,D,H){let W=(w._window?w._window.document:document).createRange();return W.setStart(...NL(L,A,M)),W.setEnd(...NL(R,D,H)),W})(e,p,g,b,m,y,T);l(),l=FL(e,P,w=>{if(t===void 0)for(let L of w){let A=L.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==Hr(-1.5)&&(A.marginTop=Hr(-1.5)),A.paddingTop!==Hr(4)&&(A.paddingTop=Hr(4)),A.paddingBottom!==Hr(0)&&(A.paddingBottom=Hr(0))}else t(w)})}n=g,o=b,r=v,a=y,s=T,i=x})}return d(e.getEditorState()),zr(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function d$(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?n!==null&&(n(),n=null):n===null&&(n=BL(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var c$=o$,UL=xr,u$=OL,f$=s$,p$=DL,m$=i$,g$=zy,zL=n$,h$=a$,v$=r$;function HL(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function y$(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],s=()=>{let{done:i,value:l}=n.next();if(i)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}),s()}),HL(l,t)?d.readAsDataURL(l):s()};s()})}function C$(e,t){return Array.from(KL(e,t))}function x$(e){return e?e.getAdjacentCaret():null}function b$(e,t){return Array.from(VL(e,t))}function KL(e,t){return $L("next",e,t)}function _L(e,t){let n=Ii(Ca(e,t));return n&&n[0]}function $L(e,t,n){let o=kt(),r=t||o,a=We(r)?vs(r,e):Ca(r,e),s=qL(r),i=n?gy(vy(Ca(n,e)))||_L(n,e):_L(r,e),l=s;return Py({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(i))return null;Hc(d)&&l++;let c=Ii(d);return!c||c[0].isSameNodeCaret(i)?null:(l+=c[1],c[0])}})}function S$(e){let t=Ii(Ca(e,"next"));return t&&[t[0].origin,t[1]]}function qL(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function I$(e){let t=vy(Ca(e,"previous")),n=Ii(t,"root");return n&&n[0].origin}function VL(e,t){return $L("previous",e,t)}function w$(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function T$(e){let t=ya(e,n=>We(n)&&!n.isInline());return We(t)||mm(4,e.__key),t}function P$(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let l=i.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=i,c=i;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(s!==null){let{child:i,parent:l}=s;if(i.is(a)){o(l,a);let d=i.getNextSiblings(),c=d.length;if(l.insertAfter(i),c!==0){let f=n(l);i.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function k$(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,s]of t._nodeMap)n.set(a,Bp(s));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;vr(r===null?null:r.clone())}function L$(e){let t=Fe()||zc(),n;if(Le(t))n=Ol(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(n=Ca(i,"next"))}n=n||vs(kt(),"previous").getFlipped().insert(Wo())}let o=WL(e,n),r=gy(o),a=Hc(r)?yk(r):o;return Sk(ck(a)),e.getLatest()}function WL(e,t,n){let o=hy(t,"next");for(let r=o;r;r=Ik(r,n))o=r;return Kp(o)&&mm(283),o.insert(e.isInline()?Wo().append(e):e),hy(Ca(e.getLatest(),"next"),t.direction)}function A$(e,t){let n=t();return e.replace(n),n.append(e),n}function R$(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function E$(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 M$(e){let t=Fe();if(!Le(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],s=a.getKey();if(n.has(s))continue;let i=ya(a,d=>We(d)&&!d.isInline());if(i===null)continue;let l=i.getKey();i.canIndent()&&!n.has(l)&&(n.add(l),e(i))}return n.size>0}function N$(e,t){vs(e,"next").insert(t)}var Uy=!(zL||!UL)&&void 0;function _$(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 D$(e){return e._parentEditor!==null}function O$(e,t){return GL(e,t,null)}function GL(e,t,n){let o=!1;for(let r of Hy(e))t(r)?n!==null&&n(r):(o=!0,We(r)&&GL(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function F$(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(We(r))for(let a of Hy(r))o.push(a);return n}function B$(e){return jL(vs(e,"next"))}function Hy(e){return jL(vs(e,"previous"))}function jL(e){return Py({hasNext:vk,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function U$(e){bk(Ca(e,"next")).splice(1,e.getChildren())}function z$(e){let t=o=>zp(o,e),n=(o,r)=>qp(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 Ye=Ky,ase=Ye.$descendantsMatching,sse=Ye.$dfs,ise=Ye.$dfsIterator,lse=Ye.$filter,dse=Ye.$findMatchingParent,cse=Ye.$firstToLastIterator,use=Ye.$getAdjacentCaret,fse=Ye.$getAdjacentSiblingOrParentSiblingCaret,pse=Ye.$getDepth,QL=Ye.$getNearestBlockElementAncestorOrThrow,mse=Ye.$getNearestNodeOfType,gse=Ye.$getNextRightPreorderNode,hse=Ye.$getNextSiblingOrParentSibling,XL=Ye.$handleIndentAndOutdent,vse=Ye.$insertFirst,yse=Ye.$insertNodeToNearestRoot,Cse=Ye.$insertNodeToNearestRootAtCaret,xse=Ye.$isEditorIsNestedEditor,bse=Ye.$lastToFirstIterator,Sse=Ye.$restoreEditorState,Ise=Ye.$reverseDfs,wse=Ye.$reverseDfsIterator,Tse=Ye.$splitNode,Pse=Ye.$unwrapAndFilterDescendants,kse=Ye.$unwrapNode,Lse=Ye.$wrapNodeInElement,Ase=Ye.CAN_USE_BEFORE_INPUT,Rse=Ye.CAN_USE_DOM,Ese=Ye.IS_ANDROID,Mse=Ye.IS_ANDROID_CHROME,Nse=Ye.IS_APPLE,_se=Ye.IS_APPLE_WEBKIT,Dse=Ye.IS_CHROME,Ose=Ye.IS_FIREFOX,Fse=Ye.IS_IOS,Bse=Ye.IS_SAFARI,Use=Ye.addClassNamesToElement,zse=Ye.calculateZoomLevel,$y=Ye.isBlockDomNode,Hse=Ye.isHTMLAnchorElement,YL=Ye.isHTMLElement,Kse=Ye.isInlineDomNode,$se=Ye.isMimeType,qse=Ye.makeStateWrapper,Vse=Ye.markSelection,Wse=Ye.mediaFileReader,xa=Ye.mergeRegister,jc=Ye.objectKlassEquals,Gse=Ye.positionNodeOnRange,jse=Ye.registerNestedElementResolver,Qse=Ye.removeClassNamesFromElement,Xse=Ye.selectionAlwaysOnDisplay;var qy={};In(qy,{ContentEditable:()=>K$,ContentEditableElement:()=>eA});ie();var ZL=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?be:q;function H$({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:g,id:h,role:v="textbox",spellCheck:y=!0,style:C,tabIndex:x,"data-testid":b,...T},I){let[k,P]=G(e.isEditable()),w=E(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),L=V(()=>(function(...A){return M=>{for(let R of A)typeof R=="function"?R(M):R!=null&&(R.current=M)}})(I,w),[w,I]);return ZL(()=>(P(e.isEditable()),e.registerEditableListener(A=>{P(A)})),[e]),u("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":k&&v==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":k?f:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:m,className:g,contentEditable:k,"data-testid":b,id:h,ref:L,role:v,spellCheck:y,style:C,tabIndex:x,...T})}var eA=Mn(H$);function JL(e){return e.getEditorState().read(dm(e.isComposing()))}var K$=Mn($$);function $$(e,t){let{placeholder:n,...o}=e,[r]=an();return S(we,{children:[u(eA,{editor:r,...o,ref:t}),n!=null&&u(q$,{editor:r,content:n})]})}function q$({content:e,editor:t}){let n=(function(s){let[i,l]=G(()=>JL(s));return ZL(()=>{function d(){let c=JL(s);l(c)}return d(),xa(s.registerUpdateListener(()=>{d()}),s.registerEditableListener(()=>{d()}))},[s]),i})(t),[o,r]=G(t.isEditable());if(be(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[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 tA=qy,nA=tA.ContentEditable,oie=tA.ContentEditableElement;ie();var V$=yt(null),Vy={didCatch:!1,error:null},gm=class extends Zr{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&&W$(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:s}=this.state,i=t;if(a){let l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(l);else if(o)i=Ne(o,l);else if(r!==void 0)i=r;else throw s}return Ne(V$.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function W$(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Wy={};In(Wy,{LexicalErrorBoundary:()=>G$});function G$({children:e,onError:t}){return u(gm,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var j$=Wy,oA=j$.LexicalErrorBoundary;var iC={};In(iC,{$createHorizontalRuleNode:()=>sC,$isDecoratorTextNode:()=>vA,$isHorizontalRuleNode:()=>IA,AutoFocusExtension:()=>Y$,ClearEditorExtension:()=>J$,DecoratorTextExtension:()=>r3,DecoratorTextNode:()=>Yc,EditorStateExtension:()=>Cm,HorizontalRuleExtension:()=>g3,HorizontalRuleNode:()=>ki,INSERT_HORIZONTAL_RULE_COMMAND:()=>p3,InitialStateExtension:()=>bA,LexicalBuilder:()=>ql,NodeSelectionExtension:()=>nC,TabIndentationExtension:()=>h3,applyFormatFromStyle:()=>e3,applyFormatToDom:()=>t3,batch:()=>dA,buildEditorFromExtensions:()=>l3,computed:()=>fA,configExtension:()=>om,declarePeerDependency:()=>iL,defineExtension:()=>wn,effect:()=>Cs,getExtensionDependencyFromEditor:()=>c3,getKnownTypesAndNodes:()=>Z$,getPeerDependencyFromEditor:()=>SA,getPeerDependencyFromEditorOrThrow:()=>u3,namedSignals:()=>bm,registerClearEditor:()=>gA,registerTabIndentation:()=>TA,safeCast:()=>Cr,shallowMergeConfig:()=>im,signal:()=>$l,untracked:()=>Jy,watchedSignal:()=>rC});var Q$=Symbol.for("preact-signals");function xm(){if(ys>1)return void ys--;let e,t=!1;for(;Xc!==void 0;){let n=Xc;for(Xc=void 0,Zy++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&cA(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Zy=0,ys--,t)throw e}function dA(e){if(ys>0)return e();ys++;try{return e()}finally{xm()}}var Kt,Xc;function Jy(e){let t=Kt;Kt=void 0;try{return e()}finally{Kt=t}}var ys=0,Zy=0,ym=0;function rA(e){if(Kt===void 0)return;let t=e.n;return t===void 0||t.t!==Kt?(t={i:0,S:e,p:Kt.s,n:void 0,t:Kt,e:void 0,x:void 0,r:t},Kt.s!==void 0&&(Kt.s.n=t),Kt.s=t,e.n=t,32&Kt.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=Kt.s,t.n=void 0,Kt.s.n=t,Kt.s=t),t):void 0}function lo(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 $l(e,t){return new lo(e,t)}function cA(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 aA(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 uA(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 Pi(e,t){lo.call(this,void 0),this.x=e,this.s=void 0,this.g=ym-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function fA(e,t){return new Pi(e,t)}function pA(e){let t=e.u;if(e.u=void 0,typeof t=="function"){ys++;let n=Kt;Kt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,oC(e),o}finally{Kt=n,xm()}}}function oC(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,pA(e)}function X$(e){if(Kt!==this)throw new Error("Out-of-order effect");uA(this),Kt=e,this.f&=-2,8&this.f&&oC(this),xm()}function Kl(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 Cs(e,t){let n=new Kl(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=$l(r===void 0?e[o]:r);n[o]=a}return n}lo.prototype.brand=Q$,lo.prototype.h=function(){return!0},lo.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:Jy(()=>{var n;(n=this.W)==null||n.call(this)}))},lo.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&&Jy(()=>{var o;(o=this.Z)==null||o.call(this)}))}},lo.prototype.subscribe=function(e){return Cs(()=>{let t=this.value,n=Kt;Kt=void 0;try{e(t)}finally{Kt=n}},{name:"sub"})},lo.prototype.valueOf=function(){return this.value},lo.prototype.toString=function(){return this.value+""},lo.prototype.toJSON=function(){return this.value},lo.prototype.peek=function(){let e=Kt;Kt=void 0;try{return this.value}finally{Kt=e}},Object.defineProperty(lo.prototype,"value",{get(){let e=rA(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Zy>100)throw new Error("Cycle detected");this.v=e,this.i++,ym++,ys++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{xm()}}}}),Pi.prototype=new lo,Pi.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ym))return!0;if(this.g=ym,this.f|=1,this.i>0&&!cA(this))return this.f&=-2,!0;let e=Kt;try{aA(this),Kt=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 Kt=e,uA(this),this.f&=-2,!0},Pi.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)}lo.prototype.S.call(this,e)},Pi.prototype.U=function(e){if(this.t!==void 0&&(lo.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)}},Pi.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(Pi.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=rA(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Kl.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()}},Kl.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,pA(this),aA(this),ys++;let e=Kt;return Kt=this,X$.bind(this,e)},Kl.prototype.N=function(){2&this.f||(this.f|=2,this.o=Xc,Xc=this)},Kl.prototype.d=function(){this.f|=8,1&this.f||oC(this)},Kl.prototype.dispose=function(){this.d()};var Y$=wn({build:(e,t,n)=>bm(t),config:Cr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Cs(()=>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 mA(){let e=kt(),t=Fe(),n=Wo();e.clear(),e.append(n),t!==null&&n.select(),Le(t)&&(t.format=0)}function gA(e,t=mA){return e.registerCommand(Vp,n=>(e.update(t),!0),Yt)}var J$=wn({build:(e,t,n)=>bm(t),config:Cr({$onClear:mA}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Cs(()=>gA(e,o.value))}});function Z$(e){let t=new Set,n=new Set;for(let o of hA(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function hA(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Gy=sL("format",{parse:e=>typeof e=="number"?e:0}),Yc=class extends yr{$config(){return this.config("decorator-text",{extends:yr,stateConfigs:[{flat:!0,stateConfig:Gy}]})}getFormat(){return zp(this,Gy)}getFormatFlags(t,n){return ky(this.getFormat(),t,n)}hasFormat(t){let n=nL[t];return(this.getFormat()&n)!==0}setFormat(t){return qp(this,Gy,t)}toggleFormat(t){let n=this.getFormat(),o=ky(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function vA(e){return e instanceof Yc}function e3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!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 t3(e,t,n=o3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=n3(t,o));return t}function n3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var o3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},r3=wn({name:"@lexical/extension/DecoratorText",nodes:()=>[Yc],register:(e,t,n)=>e.registerCommand(Fk,o=>{let r=Fe();if(yy(r)||Le(r))for(let a of r.getNodes())vA(a)&&a.toggleFormat(o);return!1},zl)});function rC(e,t){let n;return $l(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Cm=wn({build:e=>rC(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function $t(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);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 yA(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]=yA(n[r],o[r]);return e}return t}var aC=0,eC=1,CA=2,jy=3,hm=4,Hl=5,Qy=6,Qc=7;function Xy(e){return e.id===aC}function xA(e){return e.id===CA}function a3(e){return(function(t){return t.id===eC})(e)||$t(305,String(e.id),String(eC)),Object.assign(e,{id:CA})}var s3=new Set,tC=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:aC}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):im;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;xA(n)||$t(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(i,l,d){return Object.assign(i,{config:l,id:jy,registerState:d})})(n,this.mergeConfigs(),o),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,o)),this.state=(function(i,l,d){return Object.assign(i,{id:hm,initResult:l,registerState:d})})(a,s,r)}build(t){let n=this.state,o;n.id!==hm&&$t(307,String(n.id),String(Hl)),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,s,i){return Object.assign(a,{id:Hl,output:s,registerState:i})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Hl&&$t(308,String(o.id),String(Hl));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Qy})})(o),()=>{let a=this.state;a.id!==Qc&&$t(309,String(o.id),String(Qc)),this.state=(function(s){return Object.assign(s,{id:Hl})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Qy&&$t(310,String(n.id),String(Qy)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:Qc})})(n),o}getSignal(){return this._signal===void 0&&$t(311),this._signal}getInitResult(){this.extension.init===void 0&&$t(312,this.extension.name);let t=this.state;return(function(n){return n.id>=hm})(t)||$t(313,String(t.id),String(hm)),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>=jy})(t)||$t(314,String(t.id),String(jy)),{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&&$t(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&$t(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=Qc})(t)||$t(316,String(t.id),String(Qc)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||s3}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>=Hl})(t)||$t(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},sA={tag:Lo};function i3(){let e=kt();e.isEmpty()&&e.append(Wo())}var bA=wn({config:Cr({setOptions:sA,updateOptions:sA}),init:({$initialEditorState:e=i3})=>({$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(pk(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 s=e.parseEditorState(a);e.setEditorState(s,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Jk,nm,Wk,oL,Qk]}),iA=Symbol.for("@lexical/extension/LexicalBuilder");function l3(...e){return ql.fromExtensions(e).buildEditor()}function lA(){}function d3(e){throw e}function vm(e){return Array.isArray(e)?e:[e]}var Yy="0.41.0+prod.esm",ql=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=Yy,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[vm(bA)];for(let o of t)n.push(vm(o));return new e(n)}static maybeFromEditor(t){let n=t[iA];return n&&(n.PACKAGE_VERSION!==Yy&&$t(292,n.PACKAGE_VERSION,Yy),n instanceof e||$t(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&$t(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(rm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[iA]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=lA;function n(){try{t()}finally{t=lA}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=zr(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&&$t(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&&$t(296);let n=vm(t),[o]=n;typeof o.name!="string"&&$t(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&$t(298,o.name),!r){r=new tC(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&$t(299,o.name,a);for(let s of o.conflictsWith||[])this.extensionNameMap.has(s)&&$t(299,o.name,s),this.conflicts.set(s,o.name);for(let s of o.dependencies||[]){let i=vm(s);this.addEdge(o.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of o.peerDependencies||[])this.addEdge(o.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(xA(a))return;let s=o.extension.name;var i;Xy(a)||$t(300,s,r||"[unknown]"),Xy(i=a)||$t(304,String(i.id),String(aC)),a=Object.assign(i,{id:eC}),o.state=a;let l=this.outgoingConfigEdges.get(s);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,s)}a=a3(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())Xy(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 s=this.extensionNameMap.get(r);if(s)for(let i of a)s.configs.add(i)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&$t(301,o.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let s of n){let i=s.register(t,a);i&&r.push(i)}for(let s of n){let i=s.afterRegistration(t);i&&r.push(i)}return zr(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let c of i){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 hA(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&$t(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&&yA(s,f.theme)}Object.keys(s).length>0&&(t.theme=s),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 i)c.init(t);return t.onError||(t.onError=d3),t}};function c3(e,t){let n=ql.fromEditor(e).getExtensionRep(t);return n===void 0&&$t(303,t.name),n.getExtensionDependency()}function SA(e,t){let n=ql.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function u3(e,t){let n=SA(e,t);return n===void 0&&$t(291,t),n}var f3=new Set,nC=wn({build(e,t,n){let o=n.getDependency(Cm).output,r=$l({watchedNodeKeys:new Map}),a=rC(()=>{},()=>Cs(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,l,d=!1;o.value.read(()=>{if(Fe())for(let[c,f]of i.entries()){if(f.size===0){i.delete(c);continue}let p=Fl(c),m=p&&p.isSelected()||!1;d=d||m!==(!!s&&s.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&s&&l.size===s.size||(a.value=l)}));return{watchNodeKey:function(s){let i=fA(()=>(a.value||f3).has(s)),{watchedNodeKeys:l}=r.peek(),d=l.get(s),c=d!==void 0;return d=d||new Set,d.add(i),c||(l.set(s,d),r.value={watchedNodeKeys:l}),i}}},dependencies:[Cm],name:"@lexical/extension/NodeSelection"}),p3=aL("INSERT_HORIZONTAL_RULE_COMMAND"),ki=class e extends yr{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return sC().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:m3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return Wc(n,t.theme.hr),n}getTextContent(){return`
3834
- `}isInline(){return!1}updateDOM(){return!1}};function m3(){return{node:sC()}}function sC(){return ok(ki)}function IA(e){return e instanceof ki}var g3=wn({dependencies:[Cm,nC],name:"@lexical/extension/HorizontalRule",nodes:()=>[ki],register(e,t,n){let{watchNodeKey:o}=n.getDependency(nC).output,r=$l({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return zr(e.registerCommand(kk,s=>{if(fL(s.target)){let i=uk(s.target);if(IA(i))return(function(l,d=!1){let c=Fe(),f=l.isSelected(),p=l.getKey(),m;d&&yy(c)?m=c:(m=rk(),vr(m)),f?m.delete(p):m.add(p)})(i,s.shiftKey),!0}return!1},zl),e.registerMutationListener(ki,(s,i)=>{dA(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of s.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:$l(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Cs(()=>{let s=[];for(let{domNode:i,selectedSignal:l}of r.value.nodeSelections.values())s.push(Cs(()=>{let d=i.value;d&&(l.value?Wc(d,a):sm(d,a))}));return zr(...s)}))}});function wA(e){return e.canBeEmpty()}function TA(e,t,n=wA){return zr(e.registerCommand(em,o=>{let r=Fe();if(!Le(r))return!1;o.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>Bl(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,l=s.focus,d=l.isBefore(i)?l:i,c=d.getNode(),f=QL(c);if(f.canIndent()){let p=f.getKey(),m=Si();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=Ck(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?Gk:by:zk;return e.dispatchCommand(a,void 0)},Yt),e.registerCommand(by,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Fe();if(!Le(r))return!1;let a=typeof n=="function"?n:n.peek();return XL(s=>{if(a(s)){let i=s.getIndent()+1;(!o||i<o)&&s.setIndent(i)}})},Wp))}var h3=wn({build:(e,t,n)=>bm(t),config:Cr({$canIndent:wA,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Cs(()=>{if(!o.value)return TA(e,r,a)})}});var wt=iC,pie=wt.$createHorizontalRuleNode,mie=wt.$isDecoratorTextNode,gie=wt.$isHorizontalRuleNode,hie=wt.AutoFocusExtension,vie=wt.ClearEditorExtension,yie=wt.DecoratorTextExtension,Cie=wt.DecoratorTextNode,xie=wt.EditorStateExtension,bie=wt.HorizontalRuleExtension,Sie=wt.HorizontalRuleNode,Iie=wt.INSERT_HORIZONTAL_RULE_COMMAND,wie=wt.InitialStateExtension,PA=wt.LexicalBuilder,Tie=wt.NodeSelectionExtension,Pie=wt.TabIndentationExtension,kie=wt.applyFormatFromStyle,Lie=wt.applyFormatToDom,kA=wt.batch,Aie=wt.buildEditorFromExtensions,Rie=wt.computed,Eie=wt.configExtension,Mie=wt.declarePeerDependency,Nie=wt.defineExtension,Jc=wt.effect,_ie=wt.getExtensionDependencyFromEditor,Die=wt.getKnownTypesAndNodes,LA=wt.getPeerDependencyFromEditor,Oie=wt.getPeerDependencyFromEditorOrThrow,Sm=wt.namedSignals,Fie=wt.registerClearEditor,Bie=wt.registerTabIndentation,Uie=wt.safeCast,zie=wt.shallowMergeConfig,Hie=wt.signal,Kie=wt.untracked,$ie=wt.watchedSignal;var lC={};In(lC,{HistoryExtension:()=>Im,SharedHistoryExtension:()=>C3,createEmptyHistoryState:()=>EA,registerHistory:()=>RA});function v3(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(Le(a)&&Le(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(y,C,x){let b=y._nodeMap,T=[];for(let I of C){let k=b.get(I);k!==void 0&&T.push(k)}for(let[I,k]of x){if(!k)continue;let P=b.get(I);P===void 0||Kc(P)||T.push(P)}return T})(t,n,o);if(i.length===0)return 0;if(i.length>1){let y=t._nodeMap,C=y.get(a.anchor.key),x=y.get(s.anchor.key);return C&&x&&!e._nodeMap.has(C.__key)&&dt(C)&&C.__text.length===1&&a.anchor.offset===1?2:0}let l=i[0],d=e._nodeMap.get(l.__key);if(!dt(d)||!dt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=s.anchor;if(p.key!==m.key||p.type!=="text")return 0;let g=p.offset,h=m.offset,v=f.length-c.length;return v===1&&h===g-1?2:v===-1&&h===g+1?3:v===-1&&h===g?4:0}function y3(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,s=null;return(i,l,d,c,f,p)=>{let m=Date.now();if(p.has(Ak)&&(r=n,a=o,s=i),p.has(Qp))return o=0,n=m,2;p.has(Lk)&&s&&(n=r,o=a,i=s);let g=v3(i,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(Bk);if(!y&&v&&p.has(Lo))return 0;if(g===1)return 2;if(i===null)return 1;let C=l._selection;if(!(c.size>0||f.size>0))return C!==null?0:2;let x=typeof t=="number"?t:t.peek();return y===!1&&g!==0&&g===o&&m<n+x&&v||c.size===1&&(function(b,T,I){let k=T._nodeMap.get(b),P=I._nodeMap.get(b),w=T._selection,L=I._selection;return!(Le(w)&&Le(L)&&w.anchor.type==="element"&&w.focus.type==="element"&&L.anchor.type==="text"&&L.focus.type==="text"||!dt(k)||!dt(P)||k.__parent!==P.__parent)&&JSON.stringify(T.read(()=>k.exportJSON()))===JSON.stringify(I.read(()=>P.exportJSON()))})(Array.from(c)[0],i,l)?0:1})();return n=m,o=g,h}}function AA(e){e.undoStack=[],e.redoStack=[],e.current=null}function RA(e,t,n){let o=y3(e,n);return xa(e.registerCommand(rL,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(l.length!==0){let d=s.current,c=l.pop();d!==null&&(i.push(d),a.dispatchCommand($c,!0)),l.length===0&&a.dispatchCommand(qc,!1),s.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Qp})}})(e,t),!0),Yt),e.registerCommand(Xk,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(i.length!==0){let d=s.current;d!==null&&(l.push(d),a.dispatchCommand(qc,!0));let c=i.pop();i.length===0&&a.dispatchCommand($c,!1),s.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Qp})}})(e,t),!0),Yt),e.registerCommand(Vp,()=>(AA(t),!1),Yt),e.registerCommand(Pk,()=>(AA(t),e.dispatchCommand($c,!1),e.dispatchCommand(qc,!1),!0),Yt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,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 g=o(s,a,c,i,l,d);if(g===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand($c,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(qc,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function EA(){return{current:null,redoStack:[],undoStack:[]}}var Im=wn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Sm({delay:t,disabled:o,historyState:n(e)}),config:Cr({createInitialHistoryState:EA,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return Jc(()=>o.disabled.value?void 0:RA(e,o.historyState.value,o.delay))}}),C3=wn({dependencies:[om(Im,{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(Im),r=(function(s){return s?LA(s,Im.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Jc(()=>kA(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var wm=lC,jie=wm.HistoryExtension,Qie=wm.SharedHistoryExtension,Tm=wm.createEmptyHistoryState,MA=wm.registerHistory;var dC={};In(dC,{HistoryPlugin:()=>x3,createEmptyHistoryState:()=>Tm});ie();function x3({delay:e,externalHistoryState:t}){let[n]=an();return(function(o,r,a=1e3){let s=V(()=>r||Tm(),[r]);q(()=>MA(o,s,a),[a,o,s])})(n,t,e),null}var NA=dC,_A=NA.HistoryPlugin,DA=NA.createEmptyHistoryState;var cC={};In(cC,{OnChangePlugin:()=>S3});ie();var b3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?be:q;function S3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=an();return b3(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:l})=>{t&&a.size===0&&s.size===0||e&&l.has(Lo)||i.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var I3=cC,OA=I3.OnChangePlugin;var uC={};In(uC,{useLexicalEditable:()=>P3});ie();var w3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?be:q;function T3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function P3(){return(function(e){let[t]=an(),n=V(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=N(o);return w3(()=>{let{initialValueFn:s,subscribe:i}=n,l=s();return a.current!==l&&(a.current=l,r(l)),i(d=>{a.current=d,r(d)})},[n,e]),o})(T3)}var k3=uC,FA=k3.useLexicalEditable;var fC={};In(fC,{ReactProviderExtension:()=>L3});var L3=wn({name:"@lexical/react/ReactProvider"});var A3=fC,BA=A3.ReactProviderExtension;var pC={};In(pC,{DragonExtension:()=>R3,registerDragonSupport:()=>UA});function UA(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 s;try{s=JSON.parse(a)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let i=s.payload;if(i&&i.functionId==="makeChanges"){let l=i.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let g=Fe();if(Le(g)){let h=g.anchor,v=h.getNode(),y=0,C=0;if(dt(v)&&d>=0&&c>=0&&(y=d,C=d+c,g.setTextNodeRange(v,y,v,C)),y===C&&f===""||(g.insertRawText(f),v=h.getNode()),dt(v)){y=p,C=p+m;let x=v.getTextContentSize();y=y>x?x:y,C=C>x?x:C,g.setTextNodeRange(v,y,v,C)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var R3=wn({build:(e,t,n)=>Sm(t),config:Cr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Jc(()=>n.getOutput().disabled.value?void 0:UA(e))});var zA=pC,HA=zA.DragonExtension,KA=zA.registerDragonSupport;var mC={};In(mC,{$generateHtmlFromNodes:()=>M3,$generateNodesFromDOM:()=>E3});function E3(e,t){let n=uL(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!qA.has(a.nodeName)){let s=VA(a,e,r,!1);s!==null&&(o=o.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof xy&&s.insertAfter(bi());for(let s of a){let i=s.getChildren();for(let l of i)s.insertBefore(l);s.remove()}})(r),o}function M3(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=kt().getChildren();for(let r=0;r<o.length;r++)$A(e,o[r],n,t);return n.innerHTML}function $A(e,t,n,o=null){let r=o===null||t.isSelected(o),a=We(t)&&t.excludeFromCopy("html"),s=t;o!==null&&dt(t)&&(s=pm(o,t,"clone"));let i=We(s)?s.getChildren():[],l=dL(e,s.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,s):s.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<i.length;m++){let g=i[m],h=$A(e,g,p,o);!r&&We(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if((YL(c)||Ty(c))&&c.append(p),n.append(c),f){let m=f.call(s,c);m&&(Ty(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var qA=new Set(["STYLE","SCRIPT"]);function VA(e,t,n,o,r=new Map,a){let s=[];if(qA.has(e.nodeName))return s;let i=null,l=(function(g,h){let{nodeName:v}=g,y=h._htmlConversions.get(v.toLowerCase()),C=null;if(y!==void 0)for(let x of y){let b=x(g);b!==null&&(C===null||(C.priority||0)<=(b.priority||0))&&(C=b)}return C!==null?C.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let g=d.node;if(i=Array.isArray(g)?g[g.length-1]:g,i!==null){for(let[,h]of r)if(i=h(i,a),!i)break;i&&s.push(...Array.isArray(g)?g:[i])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(i==null||!wi(i))&&(i!=null&&Bl(i)||o);for(let g=0;g<f.length;g++)p.push(...VA(f[g],t,n,m,new Map(r),i));return c!=null&&(p=c(p)),$y(e)&&(p=N3(e,p,m?()=>{let g=new xy;return n.push(g),g}:Wo)),i==null?p.length>0?s=s.concat(p):$y(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Gc(g.nextSibling)&&Gc(g.previousSibling)})(e)&&(s=s.concat(bi())):We(i)&&i.append(...p),s}function N3(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(Bl(i))o&&!i.getFormat()&&i.setFormat(o),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&Bl(t[s+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var WA=mC,GA=WA.$generateHtmlFromNodes,jA=WA.$generateNodesFromDOM;var hC={};In(hC,{$generateJSONFromSelectedNodes:()=>ZA,$generateNodesFromSerializedNodes:()=>eR,$getClipboardDataFromSelection:()=>nR,$getHtmlContent:()=>XA,$getLexicalContent:()=>YA,$insertDataTransferForPlainText:()=>_3,$insertDataTransferForRichText:()=>D3,$insertGeneratedNodes:()=>gC,copyToClipboard:()=>O3,setLexicalClipboardDataTransfer:()=>oR});function Pm(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 XA(e,t=Fe()){return t==null&&Pm(166),Le(t)&&t.isCollapsed()||t.getNodes().length===0?"":GA(e,t)}function YA(e,t=Fe()){return t==null&&Pm(166),Le(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(ZA(e,t))}function _3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function D3(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let i=JSON.parse(o);if(i.namespace===n._config.namespace&&Array.isArray(i.nodes))return gC(n,eR(i.nodes),t)}catch(i){console.error(i)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let i=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 gC(n,jA(n,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(Le(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){let d=Fe();if(Le(d)){let c=i[l];c===`
3784
+ `);let l=i.length;if(!it(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||Hc(d)||d.remove(),r-=l+s,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=Dl(d);return it(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=i.slice(0,f);if(c!==null&&c!==i){let m=Uc(),g=o;if(o.isSimpleText())o.setTextContent(c);else{let h=mr(c);o.replace(h),g=h}if(ke(m)&&m.isCollapsed()){let h=m.anchor.offset;g.select(h,h)}}else if(o.isSimpleText()){let m=t.key===d,g=t.offset;g<r&&(g=l);let h=m?g-r:0,v=m?g:f;if(m&&h===0){let[y]=o.splitText(h,v);y.remove()}else{let[,y]=o.splitText(h,v);y.remove()}}else{let m=mr(p);o.replace(m)}r=0}}}function UK(e){let t=e.getStyle(),n=CL(t);cm.set(t,n)}function dm(e,t){(ke(e)?e.isCollapsed():it(e)||We(e))||Ry(280);let n=um(ke(e)?e.style:it(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(n[s],e):i===null?delete a[s]:a[s]=i,a),{...n}),r=xL(o);ke(e)||it(e)?e.setStyle(r):e.setTextStyle(r),cm.set(r,o)}function zK(e,t){if(ke(e)&&e.isCollapsed()){dm(e,t);let o=e.anchor.getNode();We(o)&&o.isEmpty()&&dm(o,t)}SL(o=>{dm(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!We(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),dm(r,t))}}}function SL(e){let t=Oe();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(ke(t))for(let a of JP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!it(a)||!a.canHaveFormat())continue;let[s,i]=o(a);i!==s&&(vy(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}ke(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&IL(t)}function IL(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 wL(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function HK(e,t,n=wL){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[s,i]=o;a=yi(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let l=ya(s.getNode(),qc),d=ya(i.getNode(),qc);We(l)&&r.set(l.getKey(),l),We(d)&&r.set(d.getKey(),d)}for(let s of e.getNodes())if(We(s)&&qc(s))r.set(s.getKey(),s);else if(o===null){let i=ya(s,qc);We(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let l=t();n(i,l),i.replace(l,!0),a&&(s===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Oe())&&gr(a)}function yL(e){return e.getNode().isAttached()}function KK(e){let t=e;for(;t!==null&&!xi(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function $K(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===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 i=null,l=[];for(let d=0;d<s;d++){let c=a[d];xi(c)?(Ay(e,l,l.length,t,n),l=[],i=c):i===null||i!==null&&dk(c,i)?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],s=new Map,i=[],l=We(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,d=!0;break}if(l=l.getParentOrThrow(),xi(l))break}let c=new Set;for(let g=0;g<n;g++){let h=t[g];We(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let f=new Set;for(let g=0;g<n;g++){let h=t[g],v=h.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&fk(h)&&!f.has(h.getKey())){let y=v.getKey();if(s.get(y)===void 0){let C=o();C.setFormat(v.getFormatType()),C.setIndent(v.getIndent()),i.push(C),s.set(y,C),v.getChildren().forEach(x=>{C.append(x),f.add(x.getKey()),We(x)&&x.getChildrenKeys().forEach(b=>f.add(b))}),KK(v)}}else if(c.has(h.getKey())){We(h)||Ry(179);let y=o();y.setFormat(h.getFormatType()),y.setIndent(h.getIndent()),i.push(y),h.remove(!0)}}if(r!==null)for(let g=0;g<i.length;g++){let h=i[g];r.append(h)}let p=null;if(xi(l))if(d)if(r!==null)l.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];l.insertAfter(h)}else{let g=l.getFirstChild();if(We(g)&&(l=g),g===null)if(r)l.append(r);else for(let h=0;h<i.length;h++){let v=i[h];l.append(v),p=v}else if(r!==null)g.insertBefore(r);else for(let h=0;h<i.length;h++){let v=i[h];g.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];l.insertAfter(h),p=h}let m=Uc();ke(m)&&yL(m.anchor)&&yL(m.focus)?gr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function TL(e){let t=PL(e);return t!==null&&t.writingMode==="vertical-rl"}function PL(e){let t=e.anchor.getNode();return We(t)?Ey(t):My(t)}function qK(e,t){let n=TL(e)?!t:t;Ny(e)&&(n=!n);let o=_l(e.focus,n?"previous":"next");if(uk(o))return!1;for(let r of rk(o)){if(zc(r))return!r.origin.isInline();if(!We(r.origin)){if(zp(r.origin))return!0;break}}return!1}function kL(e,t,n,o){e.modify(t?"extend":"move",n,o)}function Ny(e){let t=PL(e);return t!==null&&t.direction==="rtl"}function VK(e,t,n){let o=Ny(e),r;r=TL(e)||o?!n:n,kL(e,t,r,"character")}function WK(e,t,n){let o=um(e.getStyle());return o!==null&&o[t]||n}function GK(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),l=i?s.offset:a.offset,d=i?s.getNode():a.getNode();if(ke(e)&&e.isCollapsed()&&e.style!==""){let c=um(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))&&it(f)){let p=WK(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var jK=bL;var sn=_y,LL=sn.$addNodeStyle,Rae=sn.$cloneWithProperties,Eae=sn.$copyBlockFormatIndent,Mae=sn.$ensureForwardRangeSelection,Nae=sn.$forEachSelectedTextNode,_ae=sn.$getComputedStyleForElement,Dae=sn.$getComputedStyleForParent,Oae=sn.$getSelectionStyleValueForProperty,Fae=sn.$isAtNodeEnd,Bae=sn.$isParentElementRTL,Uae=sn.$isParentRTL,zae=sn.$moveCaretSelection,Dy=sn.$moveCharacter,Hae=sn.$patchStyleText,Kae=sn.$selectAll,$ae=sn.$setBlocksType,Oy=sn.$shouldOverrideDefaultCharacterSelection,fm=sn.$sliceSelectedTextNodeContent,qae=sn.$trimTextContentFromAnchor,Vae=sn.$wrapNodes,Wae=sn.createDOMRange,AL=sn.createRectsFromDOMRange,Gae=sn.getCSSFromStyleObject,jae=sn.getStyleObjectFromCSS,Qae=sn.trimTextContentFromAnchor;var zy={};bn(zy,{$descendantsMatching:()=>E$,$dfs:()=>p$,$dfsIterator:()=>UL,$filter:()=>T$,$findMatchingParent:()=>ya,$firstToLastIterator:()=>M$,$getAdjacentCaret:()=>m$,$getAdjacentSiblingOrParentSiblingCaret:()=>Ci,$getDepth:()=>HL,$getNearestBlockElementAncestorOrThrow:()=>C$,$getNearestNodeOfType:()=>y$,$getNextRightPreorderNode:()=>v$,$getNextSiblingOrParentSibling:()=>h$,$handleIndentAndOutdent:()=>P$,$insertFirst:()=>k$,$insertNodeToNearestRoot:()=>S$,$insertNodeToNearestRootAtCaret:()=>$L,$isEditorIsNestedEditor:()=>A$,$lastToFirstIterator:()=>Uy,$restoreEditorState:()=>b$,$reverseDfs:()=>g$,$reverseDfsIterator:()=>KL,$splitNode:()=>bk,$unwrapAndFilterDescendants:()=>R$,$unwrapNode:()=>N$,$wrapNodeInElement:()=>I$,CAN_USE_BEFORE_INPUT:()=>r$,CAN_USE_DOM:()=>OL,IS_ANDROID:()=>a$,IS_ANDROID_CHROME:()=>s$,IS_APPLE:()=>i$,IS_APPLE_WEBKIT:()=>l$,IS_CHROME:()=>d$,IS_FIREFOX:()=>FL,IS_IOS:()=>c$,IS_SAFARI:()=>u$,addClassNamesToElement:()=>Vc,calculateZoomLevel:()=>L$,isBlockDomNode:()=>iL,isHTMLAnchorElement:()=>cL,isHTMLElement:()=>rm,isInlineDomNode:()=>Wc,isMimeType:()=>BL,makeStateWrapper:()=>_$,markSelection:()=>DL,mediaFileReader:()=>f$,mergeRegister:()=>Fr,objectKlassEquals:()=>w$,positionNodeOnRange:()=>_L,registerNestedElementResolver:()=>x$,removeClassNamesFromElement:()=>am,selectionAlwaysOnDisplay:()=>o$});function pm(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 yr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,QK=yr&&"documentMode"in document?document.documentMode:null,ML=yr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),XK=yr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),YK=!(!yr||!("InputEvent"in window)||QK)&&"getTargetRanges"in new window.InputEvent("input"),JK=yr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ZK=yr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,NL=yr&&/Android/.test(navigator.userAgent),By=yr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),e$=yr&&NL&&By,t$=yr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ML&&!By;function Br(e){return`${e}px`}var n$={attributes:!0,characterData:!0,childList:!0,subtree:!0};function _L(e,t,n){let o=null,r=null,a=null,s=[],i=document.createElement("div");function l(){o===null&&pm(182),r===null&&pm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=AL(e,t);var g,h;i.isConnected||(h=i,(g=r).insertBefore(h,g.firstChild));let v=!1;for(let y=0;y<m.length;y++){let C=m[y],x=s[y]||document.createElement("div"),b=x.style;b.position!=="absolute"&&(b.position="absolute",v=!0);let w=Br(C.left-f);b.left!==w&&(b.left=w,v=!0);let I=Br(C.top-p);b.top!==I&&(x.style.top=I,v=!0);let k=Br(C.width);b.width!==k&&(x.style.width=k,v=!0);let P=Br(C.height);b.height!==P&&(x.style.height=P,v=!0),x.parentNode!==i&&(i.append(x),v=!0),s[y]=x}for(;s.length>m.length;)s.pop();v&&n(s)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,i.remove();for(let f of s)f.remove();s=[]}i.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!rm(m))return d();d(),o=p,r=m,a=new MutationObserver(g=>{let h=e.getRootElement(),v=h&&h.parentElement;if(h!==o||v!==r)return f();for(let y of g)if(!i.contains(y.target))return l()}),a.observe(m,n$),l()});return()=>{c(),d()}}function RL(e,t,n){if(e.type!=="text"&&We(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[aL(n)||n,e.offset]}function DL(e,t){let n=null,o=null,r=null,a=null,s=null,i=null,l=()=>{};function d(c){c.read(()=>{let f=Oe();if(!ke(f))return n=null,r=null,a=null,i=null,l(),void(l=()=>{});let[p,m]=(function(P){let T=P.getStartEndPoints();return P.isBackward()?[T[1],T[0]]:T})(f),g=p.getNode(),h=g.getKey(),v=p.offset,y=m.getNode(),C=y.getKey(),x=m.offset,b=e.getElementByKey(h),w=e.getElementByKey(C),I=n===null||b!==o||v!==r||h!==n.getKey(),k=a===null||w!==s||x!==i||C!==a.getKey();if((I||k)&&b!==null&&w!==null){let P=(function(T,L,A,M,R,D,H){let W=(T._window?T._window.document:document).createRange();return W.setStart(...RL(L,A,M)),W.setEnd(...RL(R,D,H)),W})(e,p,g,b,m,y,w);l(),l=_L(e,P,T=>{if(t===void 0)for(let L of T){let A=L.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==Br(-1.5)&&(A.marginTop=Br(-1.5)),A.paddingTop!==Br(4)&&(A.paddingTop=Br(4)),A.paddingBottom!==Br(0)&&(A.paddingBottom=Br(0))}else t(T)})}n=g,o=b,r=v,a=y,s=w,i=x})}return d(e.getEditorState()),Fr(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function o$(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?n!==null&&(n(),n=null):n===null&&(n=DL(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var r$=YK,OL=yr,a$=NL,s$=e$,i$=ML,l$=t$,d$=By,FL=XK,c$=ZK,u$=JK;function BL(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function f$(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],s=()=>{let{done:i,value:l}=n.next();if(i)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}),s()}),BL(l,t)?d.readAsDataURL(l):s()};s()})}function p$(e,t){return Array.from(UL(e,t))}function m$(e){return e?e.getAdjacentCaret():null}function g$(e,t){return Array.from(KL(e,t))}function UL(e,t){return zL("next",e,t)}function EL(e,t){let n=Ci(Ca(e,t));return n&&n[0]}function zL(e,t,n){let o=Lt(),r=t||o,a=We(r)?xs(r,e):Ca(r,e),s=HL(r),i=n?py(gy(Ca(n,e)))||EL(n,e):EL(r,e),l=s;return wy({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(i))return null;zc(d)&&l++;let c=Ci(d);return!c||c[0].isSameNodeCaret(i)?null:(l+=c[1],c[0])}})}function h$(e){let t=Ci(Ca(e,"next"));return t&&[t[0].origin,t[1]]}function HL(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function v$(e){let t=gy(Ca(e,"previous")),n=Ci(t,"root");return n&&n[0].origin}function KL(e,t){return zL("previous",e,t)}function y$(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function C$(e){let t=ya(e,n=>We(n)&&!n.isInline());return We(t)||pm(4,e.__key),t}function x$(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let l=i.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=i,c=i;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(s!==null){let{child:i,parent:l}=s;if(i.is(a)){o(l,a);let d=i.getNextSiblings(),c=d.length;if(l.insertAfter(i),c!==0){let f=n(l);i.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function b$(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,s]of t._nodeMap)n.set(a,Fp(s));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;gr(r===null?null:r.clone())}function S$(e){let t=Oe()||Uc(),n;if(ke(t))n=_l(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(n=Ca(i,"next"))}n=n||xs(Lt(),"previous").getFlipped().insert(jo())}let o=$L(e,n),r=py(o),a=zc(r)?gk(r):o;return Ck(ik(a)),e.getLatest()}function $L(e,t,n){let o=my(t,"next");for(let r=o;r;r=xk(r,n))o=r;return Hp(o)&&pm(283),o.insert(e.isInline()?jo().append(e):e),my(Ca(e.getLatest(),"next"),t.direction)}function I$(e,t){let n=t();return e.replace(n),n.append(e),n}function w$(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function T$(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 P$(e){let t=Oe();if(!ke(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],s=a.getKey();if(n.has(s))continue;let i=ya(a,d=>We(d)&&!d.isInline());if(i===null)continue;let l=i.getKey();i.canIndent()&&!n.has(l)&&(n.add(l),e(i))}return n.size>0}function k$(e,t){xs(e,"next").insert(t)}var Fy=!(FL||!OL)&&void 0;function L$(e,t=!1){let n=1;if((function(){if(Fy===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"),Fy=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return Fy})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function A$(e){return e._parentEditor!==null}function R$(e,t){return qL(e,t,null)}function qL(e,t,n){let o=!1;for(let r of Uy(e))t(r)?n!==null&&n(r):(o=!0,We(r)&&qL(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function E$(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(We(r))for(let a of Uy(r))o.push(a);return n}function M$(e){return VL(xs(e,"next"))}function Uy(e){return VL(xs(e,"previous"))}function VL(e){return wy({hasNext:mk,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function N$(e){yk(Ca(e,"next")).splice(1,e.getChildren())}function _$(e){let t=o=>Up(o,e),n=(o,r)=>$p(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Je=zy,ese=Je.$descendantsMatching,tse=Je.$dfs,nse=Je.$dfsIterator,ose=Je.$filter,rse=Je.$findMatchingParent,ase=Je.$firstToLastIterator,sse=Je.$getAdjacentCaret,ise=Je.$getAdjacentSiblingOrParentSiblingCaret,lse=Je.$getDepth,WL=Je.$getNearestBlockElementAncestorOrThrow,dse=Je.$getNearestNodeOfType,cse=Je.$getNextRightPreorderNode,use=Je.$getNextSiblingOrParentSibling,GL=Je.$handleIndentAndOutdent,fse=Je.$insertFirst,pse=Je.$insertNodeToNearestRoot,mse=Je.$insertNodeToNearestRootAtCaret,gse=Je.$isEditorIsNestedEditor,hse=Je.$lastToFirstIterator,vse=Je.$restoreEditorState,yse=Je.$reverseDfs,Cse=Je.$reverseDfsIterator,xse=Je.$splitNode,bse=Je.$unwrapAndFilterDescendants,Sse=Je.$unwrapNode,Ise=Je.$wrapNodeInElement,wse=Je.CAN_USE_BEFORE_INPUT,Tse=Je.CAN_USE_DOM,Pse=Je.IS_ANDROID,kse=Je.IS_ANDROID_CHROME,Lse=Je.IS_APPLE,Ase=Je.IS_APPLE_WEBKIT,Rse=Je.IS_CHROME,Ese=Je.IS_FIREFOX,Mse=Je.IS_IOS,Nse=Je.IS_SAFARI,_se=Je.addClassNamesToElement,Dse=Je.calculateZoomLevel,Hy=Je.isBlockDomNode,Ose=Je.isHTMLAnchorElement,jL=Je.isHTMLElement,Fse=Je.isInlineDomNode,Bse=Je.isMimeType,Use=Je.makeStateWrapper,zse=Je.markSelection,Hse=Je.mediaFileReader,xa=Je.mergeRegister,Gc=Je.objectKlassEquals,Kse=Je.positionNodeOnRange,$se=Je.registerNestedElementResolver,qse=Je.removeClassNamesFromElement,Vse=Je.selectionAlwaysOnDisplay;var Ky={};bn(Ky,{ContentEditable:()=>O$,ContentEditableElement:()=>YL});le();var XL=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:q;function D$({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:g,id:h,role:v="textbox",spellCheck:y=!0,style:C,tabIndex:x,"data-testid":b,...w},I){let[k,P]=Q(e.isEditable()),T=E(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),L=V(()=>(function(...A){return M=>{for(let R of A)typeof R=="function"?R(M):R!=null&&(R.current=M)}})(I,T),[T,I]);return XL(()=>(P(e.isEditable()),e.registerEditableListener(A=>{P(A)})),[e]),u("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":k&&v==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":k?f:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:m,className:g,contentEditable:k,"data-testid":b,id:h,ref:L,role:v,spellCheck:y,style:C,tabIndex:x,...w})}var YL=Nn(D$);function QL(e){return e.getEditorState().read(lm(e.isComposing()))}var O$=Nn(F$);function F$(e,t){let{placeholder:n,...o}=e,[r]=an();return S(Ie,{children:[u(YL,{editor:r,...o,ref:t}),n!=null&&u(B$,{editor:r,content:n})]})}function B$({content:e,editor:t}){let n=(function(s){let[i,l]=Q(()=>QL(s));return XL(()=>{function d(){let c=QL(s);l(c)}return d(),xa(s.registerUpdateListener(()=>{d()}),s.registerEditableListener(()=>{d()}))},[s]),i})(t),[o,r]=Q(t.isEditable());if(xe(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[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 JL=Ky,ZL=JL.ContentEditable,Jse=JL.ContentEditableElement;le();var U$=yt(null),$y={didCatch:!1,error:null},mm=class extends Zr{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=$y}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($y))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&z$(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState($y))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:s}=this.state,i=t;if(a){let l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(l);else if(o)i=Me(o,l);else if(r!==void 0)i=r;else throw s}return Me(U$.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function z$(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var qy={};bn(qy,{LexicalErrorBoundary:()=>H$});function H$({children:e,onError:t}){return u(mm,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var K$=qy,eA=K$.LexicalErrorBoundary;var aC={};bn(aC,{$createHorizontalRuleNode:()=>rC,$isDecoratorTextNode:()=>mA,$isHorizontalRuleNode:()=>xA,AutoFocusExtension:()=>V$,ClearEditorExtension:()=>W$,DecoratorTextExtension:()=>J$,DecoratorTextNode:()=>Xc,EditorStateExtension:()=>ym,HorizontalRuleExtension:()=>d3,HorizontalRuleNode:()=>Ii,INSERT_HORIZONTAL_RULE_COMMAND:()=>i3,InitialStateExtension:()=>yA,LexicalBuilder:()=>Kl,NodeSelectionExtension:()=>eC,TabIndentationExtension:()=>c3,applyFormatFromStyle:()=>j$,applyFormatToDom:()=>Q$,batch:()=>sA,buildEditorFromExtensions:()=>n3,computed:()=>dA,configExtension:()=>nm,declarePeerDependency:()=>rL,defineExtension:()=>Sn,effect:()=>Ss,getExtensionDependencyFromEditor:()=>r3,getKnownTypesAndNodes:()=>G$,getPeerDependencyFromEditor:()=>CA,getPeerDependencyFromEditorOrThrow:()=>a3,namedSignals:()=>xm,registerClearEditor:()=>fA,registerTabIndentation:()=>SA,safeCast:()=>vr,shallowMergeConfig:()=>sm,signal:()=>Hl,untracked:()=>Xy,watchedSignal:()=>nC});var $$=Symbol.for("preact-signals");function Cm(){if(bs>1)return void bs--;let e,t=!1;for(;Qc!==void 0;){let n=Qc;for(Qc=void 0,Yy++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&iA(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Yy=0,bs--,t)throw e}function sA(e){if(bs>0)return e();bs++;try{return e()}finally{Cm()}}var zt,Qc;function Xy(e){let t=zt;zt=void 0;try{return e()}finally{zt=t}}var bs=0,Yy=0,vm=0;function tA(e){if(zt===void 0)return;let t=e.n;return t===void 0||t.t!==zt?(t={i:0,S:e,p:zt.s,n:void 0,t:zt,e:void 0,x:void 0,r:t},zt.s!==void 0&&(zt.s.n=t),zt.s=t,e.n=t,32&zt.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=zt.s,t.n=void 0,zt.s.n=t,zt.s=t),t):void 0}function io(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 Hl(e,t){return new io(e,t)}function iA(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 nA(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 lA(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 Si(e,t){io.call(this,void 0),this.x=e,this.s=void 0,this.g=vm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function dA(e,t){return new Si(e,t)}function cA(e){let t=e.u;if(e.u=void 0,typeof t=="function"){bs++;let n=zt;zt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,tC(e),o}finally{zt=n,Cm()}}}function tC(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,cA(e)}function q$(e){if(zt!==this)throw new Error("Out-of-order effect");lA(this),zt=e,this.f&=-2,8&this.f&&tC(this),Cm()}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 Ss(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 xm(e,t={}){let n={};for(let o in e){let r=t[o],a=Hl(r===void 0?e[o]:r);n[o]=a}return n}io.prototype.brand=$$,io.prototype.h=function(){return!0},io.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:Xy(()=>{var n;(n=this.W)==null||n.call(this)}))},io.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&&Xy(()=>{var o;(o=this.Z)==null||o.call(this)}))}},io.prototype.subscribe=function(e){return Ss(()=>{let t=this.value,n=zt;zt=void 0;try{e(t)}finally{zt=n}},{name:"sub"})},io.prototype.valueOf=function(){return this.value},io.prototype.toString=function(){return this.value+""},io.prototype.toJSON=function(){return this.value},io.prototype.peek=function(){let e=zt;zt=void 0;try{return this.value}finally{zt=e}},Object.defineProperty(io.prototype,"value",{get(){let e=tA(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Yy>100)throw new Error("Cycle detected");this.v=e,this.i++,vm++,bs++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Cm()}}}}),Si.prototype=new io,Si.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===vm))return!0;if(this.g=vm,this.f|=1,this.i>0&&!iA(this))return this.f&=-2,!0;let e=zt;try{nA(this),zt=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 zt=e,lA(this),this.f&=-2,!0},Si.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)}io.prototype.S.call(this,e)},Si.prototype.U=function(e){if(this.t!==void 0&&(io.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)}},Si.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(Si.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=tA(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,cA(this),nA(this),bs++;let e=zt;return zt=this,q$.bind(this,e)},zl.prototype.N=function(){2&this.f||(this.f|=2,this.o=Qc,Qc=this)},zl.prototype.d=function(){this.f|=8,1&this.f||tC(this)},zl.prototype.dispose=function(){this.d()};var V$=Sn({build:(e,t,n)=>xm(t),config:vr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Ss(()=>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 uA(){let e=Lt(),t=Oe(),n=jo();e.clear(),e.append(n),t!==null&&n.select(),ke(t)&&(t.format=0)}function fA(e,t=uA){return e.registerCommand(qp,n=>(e.update(t),!0),Jt)}var W$=Sn({build:(e,t,n)=>xm(t),config:vr({$onClear:uA}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Ss(()=>fA(e,o.value))}});function G$(e){let t=new Set,n=new Set;for(let o of pA(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function pA(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Vy=oL("format",{parse:e=>typeof e=="number"?e:0}),Xc=class extends hr{$config(){return this.config("decorator-text",{extends:hr,stateConfigs:[{flat:!0,stateConfig:Vy}]})}getFormat(){return Up(this,Vy)}getFormatFlags(t,n){return Ty(this.getFormat(),t,n)}hasFormat(t){let n=Zk[t];return(this.getFormat()&n)!==0}setFormat(t){return $p(this,Vy,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 mA(e){return e instanceof Xc}function j$(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!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 Q$(e,t,n=Y$){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=X$(t,o));return t}function X$(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Y$={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},J$=Sn({name:"@lexical/extension/DecoratorText",nodes:()=>[Xc],register:(e,t,n)=>e.registerCommand(_k,o=>{let r=Oe();if(hy(r)||ke(r))for(let a of r.getNodes())mA(a)&&a.toggleFormat(o);return!1},Bl)});function nC(e,t){let n;return Hl(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var ym=Sn({build:e=>nC(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function qt(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 gA(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]=gA(n[r],o[r]);return e}return t}var oC=0,Jy=1,hA=2,Wy=3,gm=4,Ul=5,Gy=6,jc=7;function jy(e){return e.id===oC}function vA(e){return e.id===hA}function Z$(e){return(function(t){return t.id===Jy})(e)||qt(305,String(e.id),String(Jy)),Object.assign(e,{id:hA})}var e3=new Set,Zy=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:oC}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):sm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;vA(n)||qt(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(i,l,d){return Object.assign(i,{config:l,id:Wy,registerState:d})})(n,this.mergeConfigs(),o),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,o)),this.state=(function(i,l,d){return Object.assign(i,{id:gm,initResult:l,registerState:d})})(a,s,r)}build(t){let n=this.state,o;n.id!==gm&&qt(307,String(n.id),String(Ul)),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,s,i){return Object.assign(a,{id:Ul,output:s,registerState:i})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Ul&&qt(308,String(o.id),String(Ul));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Gy})})(o),()=>{let a=this.state;a.id!==jc&&qt(309,String(o.id),String(jc)),this.state=(function(s){return Object.assign(s,{id:Ul})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Gy&&qt(310,String(n.id),String(Gy)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:jc})})(n),o}getSignal(){return this._signal===void 0&&qt(311),this._signal}getInitResult(){this.extension.init===void 0&&qt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=gm})(t)||qt(313,String(t.id),String(gm)),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>=Wy})(t)||qt(314,String(t.id),String(Wy)),{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&&qt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&qt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=jc})(t)||qt(316,String(t.id),String(jc)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||e3}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>=Ul})(t)||qt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},oA={tag:Ao};function t3(){let e=Lt();e.isEmpty()&&e.append(jo())}var yA=Sn({config:vr({setOptions:oA,updateOptions:oA}),init:({$initialEditorState:e=t3})=>({$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(ck(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 s=e.parseEditorState(a);e.setEditorState(s,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Qk,tm,$k,eL,Wk]}),rA=Symbol.for("@lexical/extension/LexicalBuilder");function n3(...e){return Kl.fromExtensions(e).buildEditor()}function aA(){}function o3(e){throw e}function hm(e){return Array.isArray(e)?e:[e]}var Qy="0.41.0+prod.esm",Kl=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=Qy,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[hm(yA)];for(let o of t)n.push(hm(o));return new e(n)}static maybeFromEditor(t){let n=t[rA];return n&&(n.PACKAGE_VERSION!==Qy&&qt(292,n.PACKAGE_VERSION,Qy),n instanceof e||qt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&qt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(om({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[rA]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=aA;function n(){try{t()}finally{t=aA}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=Fr(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&&qt(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&&qt(296);let n=hm(t),[o]=n;typeof o.name!="string"&&qt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&qt(298,o.name),!r){r=new Zy(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&qt(299,o.name,a);for(let s of o.conflictsWith||[])this.extensionNameMap.has(s)&&qt(299,o.name,s),this.conflicts.set(s,o.name);for(let s of o.dependencies||[]){let i=hm(s);this.addEdge(o.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of o.peerDependencies||[])this.addEdge(o.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(vA(a))return;let s=o.extension.name;var i;jy(a)||qt(300,s,r||"[unknown]"),jy(i=a)||qt(304,String(i.id),String(oC)),a=Object.assign(i,{id:Jy}),o.state=a;let l=this.outgoingConfigEdges.get(s);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,s)}a=Z$(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())jy(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 s=this.extensionNameMap.get(r);if(s)for(let i of a)s.configs.add(i)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&qt(301,o.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let s of n){let i=s.register(t,a);i&&r.push(i)}for(let s of n){let i=s.afterRegistration(t);i&&r.push(i)}return Fr(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let c of i){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 pA(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&qt(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&&gA(s,f.theme)}Object.keys(s).length>0&&(t.theme=s),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 i)c.init(t);return t.onError||(t.onError=o3),t}};function r3(e,t){let n=Kl.fromEditor(e).getExtensionRep(t);return n===void 0&&qt(303,t.name),n.getExtensionDependency()}function CA(e,t){let n=Kl.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function a3(e,t){let n=CA(e,t);return n===void 0&&qt(291,t),n}var s3=new Set,eC=Sn({build(e,t,n){let o=n.getDependency(ym).output,r=Hl({watchedNodeKeys:new Map}),a=nC(()=>{},()=>Ss(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,l,d=!1;o.value.read(()=>{if(Oe())for(let[c,f]of i.entries()){if(f.size===0){i.delete(c);continue}let p=Dl(c),m=p&&p.isSelected()||!1;d=d||m!==(!!s&&s.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&s&&l.size===s.size||(a.value=l)}));return{watchNodeKey:function(s){let i=dA(()=>(a.value||s3).has(s)),{watchedNodeKeys:l}=r.peek(),d=l.get(s),c=d!==void 0;return d=d||new Set,d.add(i),c||(l.set(s,d),r.value={watchedNodeKeys:l}),i}}},dependencies:[ym],name:"@lexical/extension/NodeSelection"}),i3=nL("INSERT_HORIZONTAL_RULE_COMMAND"),Ii=class e extends hr{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return rC().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:l3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return Vc(n,t.theme.hr),n}getTextContent(){return`
3785
+ `}isInline(){return!1}updateDOM(){return!1}};function l3(){return{node:rC()}}function rC(){return ek(Ii)}function xA(e){return e instanceof Ii}var d3=Sn({dependencies:[ym,eC],name:"@lexical/extension/HorizontalRule",nodes:()=>[Ii],register(e,t,n){let{watchNodeKey:o}=n.getDependency(eC).output,r=Hl({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return Fr(e.registerCommand(wk,s=>{if(dL(s.target)){let i=lk(s.target);if(xA(i))return(function(l,d=!1){let c=Oe(),f=l.isSelected(),p=l.getKey(),m;d&&hy(c)?m=c:(m=tk(),gr(m)),f?m.delete(p):m.add(p)})(i,s.shiftKey),!0}return!1},Bl),e.registerMutationListener(Ii,(s,i)=>{sA(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of s.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:Hl(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Ss(()=>{let s=[];for(let{domNode:i,selectedSignal:l}of r.value.nodeSelections.values())s.push(Ss(()=>{let d=i.value;d&&(l.value?Vc(d,a):am(d,a))}));return Fr(...s)}))}});function bA(e){return e.canBeEmpty()}function SA(e,t,n=bA){return Fr(e.registerCommand(Zp,o=>{let r=Oe();if(!ke(r))return!1;o.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>Ol(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,l=s.focus,d=l.isBefore(i)?l:i,c=d.getNode(),f=WL(c);if(f.canIndent()){let p=f.getKey(),m=yi();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=hk(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?qk:Cy:Fk;return e.dispatchCommand(a,void 0)},Jt),e.registerCommand(Cy,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Oe();if(!ke(r))return!1;let a=typeof n=="function"?n:n.peek();return GL(s=>{if(a(s)){let i=s.getIndent()+1;(!o||i<o)&&s.setIndent(i)}})},Vp))}var c3=Sn({build:(e,t,n)=>xm(t),config:vr({$canIndent:bA,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Ss(()=>{if(!o.value)return SA(e,r,a)})}});var Tt=aC,lie=Tt.$createHorizontalRuleNode,die=Tt.$isDecoratorTextNode,cie=Tt.$isHorizontalRuleNode,uie=Tt.AutoFocusExtension,fie=Tt.ClearEditorExtension,pie=Tt.DecoratorTextExtension,mie=Tt.DecoratorTextNode,gie=Tt.EditorStateExtension,hie=Tt.HorizontalRuleExtension,vie=Tt.HorizontalRuleNode,yie=Tt.INSERT_HORIZONTAL_RULE_COMMAND,Cie=Tt.InitialStateExtension,IA=Tt.LexicalBuilder,xie=Tt.NodeSelectionExtension,bie=Tt.TabIndentationExtension,Sie=Tt.applyFormatFromStyle,Iie=Tt.applyFormatToDom,wA=Tt.batch,wie=Tt.buildEditorFromExtensions,Tie=Tt.computed,Pie=Tt.configExtension,kie=Tt.declarePeerDependency,Lie=Tt.defineExtension,Yc=Tt.effect,Aie=Tt.getExtensionDependencyFromEditor,Rie=Tt.getKnownTypesAndNodes,TA=Tt.getPeerDependencyFromEditor,Eie=Tt.getPeerDependencyFromEditorOrThrow,bm=Tt.namedSignals,Mie=Tt.registerClearEditor,Nie=Tt.registerTabIndentation,_ie=Tt.safeCast,Die=Tt.shallowMergeConfig,Oie=Tt.signal,Fie=Tt.untracked,Bie=Tt.watchedSignal;var sC={};bn(sC,{HistoryExtension:()=>Sm,SharedHistoryExtension:()=>p3,createEmptyHistoryState:()=>LA,registerHistory:()=>kA});function u3(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(ke(a)&&ke(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(y,C,x){let b=y._nodeMap,w=[];for(let I of C){let k=b.get(I);k!==void 0&&w.push(k)}for(let[I,k]of x){if(!k)continue;let P=b.get(I);P===void 0||Hc(P)||w.push(P)}return w})(t,n,o);if(i.length===0)return 0;if(i.length>1){let y=t._nodeMap,C=y.get(a.anchor.key),x=y.get(s.anchor.key);return C&&x&&!e._nodeMap.has(C.__key)&&it(C)&&C.__text.length===1&&a.anchor.offset===1?2:0}let l=i[0],d=e._nodeMap.get(l.__key);if(!it(d)||!it(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=s.anchor;if(p.key!==m.key||p.type!=="text")return 0;let g=p.offset,h=m.offset,v=f.length-c.length;return v===1&&h===g-1?2:v===-1&&h===g+1?3:v===-1&&h===g?4:0}function f3(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,s=null;return(i,l,d,c,f,p)=>{let m=Date.now();if(p.has(Pk)&&(r=n,a=o,s=i),p.has(jp))return o=0,n=m,2;p.has(Tk)&&s&&(n=r,o=a,i=s);let g=u3(i,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(Dk);if(!y&&v&&p.has(Ao))return 0;if(g===1)return 2;if(i===null)return 1;let C=l._selection;if(!(c.size>0||f.size>0))return C!==null?0:2;let x=typeof t=="number"?t:t.peek();return y===!1&&g!==0&&g===o&&m<n+x&&v||c.size===1&&(function(b,w,I){let k=w._nodeMap.get(b),P=I._nodeMap.get(b),T=w._selection,L=I._selection;return!(ke(T)&&ke(L)&&T.anchor.type==="element"&&T.focus.type==="element"&&L.anchor.type==="text"&&L.focus.type==="text"||!it(k)||!it(P)||k.__parent!==P.__parent)&&JSON.stringify(w.read(()=>k.exportJSON()))===JSON.stringify(I.read(()=>P.exportJSON()))})(Array.from(c)[0],i,l)?0:1})();return n=m,o=g,h}}function PA(e){e.undoStack=[],e.redoStack=[],e.current=null}function kA(e,t,n){let o=f3(e,n);return xa(e.registerCommand(tL,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(l.length!==0){let d=s.current,c=l.pop();d!==null&&(i.push(d),a.dispatchCommand(Kc,!0)),l.length===0&&a.dispatchCommand($c,!1),s.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:jp})}})(e,t),!0),Jt),e.registerCommand(Gk,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(i.length!==0){let d=s.current;d!==null&&(l.push(d),a.dispatchCommand($c,!0));let c=i.pop();i.length===0&&a.dispatchCommand(Kc,!1),s.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:jp})}})(e,t),!0),Jt),e.registerCommand(qp,()=>(PA(t),!1),Jt),e.registerCommand(Ik,()=>(PA(t),e.dispatchCommand(Kc,!1),e.dispatchCommand($c,!1),!0),Jt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,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 g=o(s,a,c,i,l,d);if(g===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Kc,!1)),c!==null&&(p.push({...c}),e.dispatchCommand($c,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function LA(){return{current:null,redoStack:[],undoStack:[]}}var Sm=Sn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>bm({delay:t,disabled:o,historyState:n(e)}),config:vr({createInitialHistoryState:LA,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return Yc(()=>o.disabled.value?void 0:kA(e,o.historyState.value,o.delay))}}),p3=Sn({dependencies:[nm(Sm,{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(Sm),r=(function(s){return s?TA(s,Sm.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Yc(()=>wA(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Im=sC,$ie=Im.HistoryExtension,qie=Im.SharedHistoryExtension,wm=Im.createEmptyHistoryState,AA=Im.registerHistory;var iC={};bn(iC,{HistoryPlugin:()=>m3,createEmptyHistoryState:()=>wm});le();function m3({delay:e,externalHistoryState:t}){let[n]=an();return(function(o,r,a=1e3){let s=V(()=>r||wm(),[r]);q(()=>AA(o,s,a),[a,o,s])})(n,t,e),null}var RA=iC,EA=RA.HistoryPlugin,MA=RA.createEmptyHistoryState;var lC={};bn(lC,{OnChangePlugin:()=>h3});le();var g3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:q;function h3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=an();return g3(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:l})=>{t&&a.size===0&&s.size===0||e&&l.has(Ao)||i.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var v3=lC,NA=v3.OnChangePlugin;var dC={};bn(dC,{useLexicalEditable:()=>x3});le();var y3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:q;function C3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function x3(){return(function(e){let[t]=an(),n=V(()=>e(t),[t,e]),[o,r]=Q(()=>n.initialValueFn()),a=N(o);return y3(()=>{let{initialValueFn:s,subscribe:i}=n,l=s();return a.current!==l&&(a.current=l,r(l)),i(d=>{a.current=d,r(d)})},[n,e]),o})(C3)}var b3=dC,_A=b3.useLexicalEditable;var cC={};bn(cC,{ReactProviderExtension:()=>S3});var S3=Sn({name:"@lexical/react/ReactProvider"});var I3=cC,DA=I3.ReactProviderExtension;var uC={};bn(uC,{DragonExtension:()=>w3,registerDragonSupport:()=>OA});function OA(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 s;try{s=JSON.parse(a)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let i=s.payload;if(i&&i.functionId==="makeChanges"){let l=i.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let g=Oe();if(ke(g)){let h=g.anchor,v=h.getNode(),y=0,C=0;if(it(v)&&d>=0&&c>=0&&(y=d,C=d+c,g.setTextNodeRange(v,y,v,C)),y===C&&f===""||(g.insertRawText(f),v=h.getNode()),it(v)){y=p,C=p+m;let x=v.getTextContentSize();y=y>x?x:y,C=C>x?x:C,g.setTextNodeRange(v,y,v,C)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var w3=Sn({build:(e,t,n)=>bm(t),config:vr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Yc(()=>n.getOutput().disabled.value?void 0:OA(e))});var FA=uC,BA=FA.DragonExtension,UA=FA.registerDragonSupport;var fC={};bn(fC,{$generateHtmlFromNodes:()=>P3,$generateNodesFromDOM:()=>T3});function T3(e,t){let n=lL(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!HA.has(a.nodeName)){let s=KA(a,e,r,!1);s!==null&&(o=o.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof yy&&s.insertAfter(vi());for(let s of a){let i=s.getChildren();for(let l of i)s.insertBefore(l);s.remove()}})(r),o}function P3(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=Lt().getChildren();for(let r=0;r<o.length;r++)zA(e,o[r],n,t);return n.innerHTML}function zA(e,t,n,o=null){let r=o===null||t.isSelected(o),a=We(t)&&t.excludeFromCopy("html"),s=t;o!==null&&it(t)&&(s=fm(o,t,"clone"));let i=We(s)?s.getChildren():[],l=sL(e,s.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,s):s.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<i.length;m++){let g=i[m],h=zA(e,g,p,o);!r&&We(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if((jL(c)||Iy(c))&&c.append(p),n.append(c),f){let m=f.call(s,c);m&&(Iy(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var HA=new Set(["STYLE","SCRIPT"]);function KA(e,t,n,o,r=new Map,a){let s=[];if(HA.has(e.nodeName))return s;let i=null,l=(function(g,h){let{nodeName:v}=g,y=h._htmlConversions.get(v.toLowerCase()),C=null;if(y!==void 0)for(let x of y){let b=x(g);b!==null&&(C===null||(C.priority||0)<=(b.priority||0))&&(C=b)}return C!==null?C.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let g=d.node;if(i=Array.isArray(g)?g[g.length-1]:g,i!==null){for(let[,h]of r)if(i=h(i,a),!i)break;i&&s.push(...Array.isArray(g)?g:[i])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(i==null||!xi(i))&&(i!=null&&Ol(i)||o);for(let g=0;g<f.length;g++)p.push(...KA(f[g],t,n,m,new Map(r),i));return c!=null&&(p=c(p)),Hy(e)&&(p=k3(e,p,m?()=>{let g=new yy;return n.push(g),g}:jo)),i==null?p.length>0?s=s.concat(p):Hy(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Wc(g.nextSibling)&&Wc(g.previousSibling)})(e)&&(s=s.concat(vi())):We(i)&&i.append(...p),s}function k3(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(Ol(i))o&&!i.getFormat()&&i.setFormat(o),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&Ol(t[s+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var $A=fC,qA=$A.$generateHtmlFromNodes,VA=$A.$generateNodesFromDOM;var mC={};bn(mC,{$generateJSONFromSelectedNodes:()=>XA,$generateNodesFromSerializedNodes:()=>YA,$getClipboardDataFromSelection:()=>ZA,$getHtmlContent:()=>GA,$getLexicalContent:()=>jA,$insertDataTransferForPlainText:()=>L3,$insertDataTransferForRichText:()=>A3,$insertGeneratedNodes:()=>pC,copyToClipboard:()=>R3,setLexicalClipboardDataTransfer:()=>eR});function Tm(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 GA(e,t=Oe()){return t==null&&Tm(166),ke(t)&&t.isCollapsed()||t.getNodes().length===0?"":qA(e,t)}function jA(e,t=Oe()){return t==null&&Tm(166),ke(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(XA(e,t))}function L3(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 i=JSON.parse(o);if(i.namespace===n._config.namespace&&Array.isArray(i.nodes))return pC(n,YA(i.nodes),t)}catch(i){console.error(i)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let i=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 pC(n,VA(n,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(ke(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){let d=Oe();if(ke(d)){let c=i[l];c===`
3835
3786
  `||c===`\r
3836
- `?d.insertParagraph():c===" "?d.insertNodes([sk()]):d.insertText(c)}}}else t.insertRawText(s)}function gC(e,t,n){e.dispatchCommand(Zk,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Le(o)&&o.isCollapsed()){let r=o.anchor,a=null,s=Ol(r,"previous");if(s)if(Kp(s))a=s.origin;else{let i=lk(s,vs(kt(),"next").getFlipped());for(let l of i){if(dt(l.origin)){a=l.origin;break}if(We(l.origin)&&!l.origin.isInline())break}}if(a&&dt(a)){let i=a.getFormat(),l=a.getStyle();o.format===i&&o.style===l||(o.format=i,o.style=l,o.dirty=!0)}}})(n))}function JA(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=We(n)&&n.excludeFromCopy("html"),s=n;t!==null&&dt(s)&&(s=pm(t,s,"clone"));let i=We(s)?s.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Pm(58,f.name),We(d)){let p=c.children;Array.isArray(p)||Pm(59,f.name)}return c})(s);dt(s)&&s.getTextContentSize()===0&&(r=!1);for(let d=0;d<i.length;d++){let c=i[d],f=JA(e,t,c,l.children);!r&&We(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 ZA(e,t){let n=[],o=kt().getChildren();for(let r=0;r<o.length;r++)JA(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function eR(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=xk(o);dt(r)&&EL(r),t.push(r)}return t}var Vl=null;async function O3(e,t,n){if(Vl!==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,s=wy(r);if(o===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),o.append(i);let l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(Gp,p=>(jc(p,ClipboardEvent)&&(f(),Vl!==null&&(r.clearTimeout(Vl),Vl=null),d(QA(e,p,n))),!0),Wp);Vl=r.setTimeout(()=>{f(),Vl=null,d(!1)},50),a.execCommand("copy"),i.remove()})}function QA(e,t,n){if(n===void 0){let r=wy(e._window),a=Fe();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!mL(e,s,i))return!1;n=nR(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(oR(o,n),!0)}var tR=[["text/html",XA],["application/x-lexical-editor",YA]];function nR(e=Fe()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=Up();for(let[o,r]of tR){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function oR(e,t){for(let[n]of tR)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var Kr=hC,Sle=Kr.$generateJSONFromSelectedNodes,Ile=Kr.$generateNodesFromSerializedNodes,wle=Kr.$getClipboardDataFromSelection,rR=Kr.$getHtmlContent,Tle=Kr.$getLexicalContent,vC=Kr.$insertDataTransferForPlainText,Ple=Kr.$insertDataTransferForRichText,kle=Kr.$insertGeneratedNodes,Lle=Kr.copyToClipboard,Ale=Kr.setLexicalClipboardDataTransfer;var yC={};In(yC,{PlainTextExtension:()=>$3,registerPlainText:()=>iR});var Li=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,F3=Li&&"documentMode"in document?document.documentMode:null,B3=Li&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),U3=!(!Li||!("InputEvent"in window)||F3)&&"getTargetRanges"in new window.InputEvent("input"),z3=Li&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),aR=Li&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H3=Li&&/^(?=.*Chrome).*/i.test(navigator.userAgent),K3=Li&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&B3&&!H3;function sR(e,t){t.update(()=>{if(e!==null){let n=jc(e,KeyboardEvent)?null:e.clipboardData,o=Fe();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=rR(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function iR(e){return xa(e.registerCommand(jp,t=>{let n=Fe();return!!Le(n)&&(n.deleteCharacter(t),!0)},Yt),e.registerCommand(Nk,t=>{let n=Fe();return!!Le(n)&&(n.deleteWord(t),!0)},Yt),e.registerCommand(Mk,t=>{let n=Fe();return!!Le(n)&&(n.deleteLine(t),!0)},Yt),e.registerCommand(Rk,t=>{let n=Fe();if(!Le(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)vC(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Yt),e.registerCommand(Yk,()=>{let t=Fe();return!!Le(t)&&(t.removeText(),!0)},Yt),e.registerCommand(Sy,t=>{let n=Fe();return!!Le(n)&&(n.insertLineBreak(t),!0)},Yt),e.registerCommand(Uk,()=>{let t=Fe();return!!Le(t)&&(t.insertLineBreak(),!0)},Yt),e.registerCommand(Xp,t=>{let n=Fe();if(!Le(n))return!1;let o=t,r=o.shiftKey;return!!By(n,!0)&&(o.preventDefault(),Fy(n,r,!0),!0)},Yt),e.registerCommand(Yp,t=>{let n=Fe();if(!Le(n))return!1;let o=t,r=o.shiftKey;return!!By(n,!1)&&(o.preventDefault(),Fy(n,r,!1),!0)},Yt),e.registerCommand(Jp,t=>{let n=Fe();return!!Le(n)&&(!aR||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(jp,!0))},Yt),e.registerCommand($k,t=>{let n=Fe();return!!Le(n)&&(t.preventDefault(),e.dispatchCommand(jp,!1))},Yt),e.registerCommand(Zp,t=>{let n=Fe();if(!Le(n))return!1;if(t!==null){if((aR||z3||K3)&&U3)return!1;t.preventDefault()}return e.dispatchCommand(Sy,!1)},Yt),e.registerCommand(eL,()=>($p(),!0),Yt),e.registerCommand(Gp,t=>{let n=Fe();return!!Le(n)&&(sR(t,e),!0)},Yt),e.registerCommand(Ek,t=>{let n=Fe();return!!Le(n)&&((function(o,r){sR(o,r),r.update(()=>{let a=Fe();Le(a)&&a.removeText()})})(t,e),!0)},Yt),e.registerCommand(tm,t=>{let n=Fe();return!!Le(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Fe(),s=jc(o,ClipboardEvent)?o.clipboardData:null;s!=null&&Le(a)&&vC(s,a)},{tag:jk})})(t,e),!0)},Yt),e.registerCommand(Dk,t=>{let n=Fe();return!!Le(n)&&(t.preventDefault(),!0)},Yt),e.registerCommand(_k,t=>{let n=Fe();return!!Le(n)&&(t.preventDefault(),!0)},Yt))}var $3=wn({conflictsWith:["@lexical/rich-text"],dependencies:[HA],name:"@lexical/plain-text",register:iR});var lR=yC,Ole=lR.PlainTextExtension,dR=lR.registerPlainText;var xC={};In(xC,{PlainTextPlugin:()=>G3});ie();var km=fd(oc(),1);function q3(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 CC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?be:q;function V3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return CC(()=>n.registerDecoratorListener(s=>{(0,km.flushSync)(()=>{a(s)})}),[n]),q(()=>{a(n.getDecorators())},[n]),V(()=>{let s=[],i=Object.keys(r);for(let l=0;l<i.length;l++){let d=i[l],c=u(o,{onError:p=>n._onError(p),children:u(Og,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&s.push((0,km.createPortal)(c,f,d))}return s},[o,r,n])})(e,t)}function W3({editor:e,ErrorBoundary:t}){return(function(n){let o=PA.maybeFromEditor(n);if(o&&o.hasExtensionByName(BA.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&q3(320,r);return!0}return!1})(e)?null:u(V3,{editor:e,ErrorBoundary:t})}function cR(e){return e.getEditorState().read(dm(e.isComposing()))}function G3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=an();return(function(r){CC(()=>xa(dR(r),KA(r)),[r])})(o),S(we,{children:[e,u(j3,{content:t}),u(W3,{editor:o,ErrorBoundary:n})]})}function j3({content:e}){let[t]=an(),n=(function(r){let[a,s]=G(()=>cR(r));return CC(()=>{function i(){let l=cR(r);s(l)}return i(),xa(r.registerUpdateListener(()=>{i()}),r.registerEditableListener(()=>{i()}))},[r]),a})(t),o=FA();return n?typeof e=="function"?e(o):e:null}var Q3=xC,uR=Q3.PlainTextPlugin;function X3(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function Y3(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function J3(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Ai(e){return`[${Y3(X3(e))}](${J3(e)})`}ie();var Z3=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,eq=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var tq=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),nq=/^[A-Za-z][A-Za-z0-9+.-]*:/,oq=/^[A-Za-z]:[\\/]/,rq=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function aq(e){let t=[];for(let n of e.matchAll(tq)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),s=n[3]??"",i=s;try{i=decodeURIComponent(s)}catch{}let l=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\")),d=l>=0?i.slice(l+1):i,c=nq.test(i)&&!oq.test(i);if(!i||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(eq)){let o=n[0],r=n[1]??"",a=n[2],s=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!s||a===void 0&&rq.test(s))continue;let i=(n.index??0)+r.length,l=i+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(i,l),start:i,end:l})}return t}function Zc(e,t={}){let n=aq(e);for(let o of e.matchAll(Z3)){let r=o[0],a=o[1]??"",s=o[2]??"";if(!s)continue;let i=(o.index??0)+a.length,l=i+r.length-a.length;n.push({type:"skill",value:s,source:e.slice(i,l),start:i,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 sq(e){return e.replace(/\r\n/g,`
3837
- `).replace(/^\n+|\n+$/g,"")}function iq(e){return sq(e.text).length>0}function fR(e){return!iq(e)}function lq(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function pR(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:lq(e,t)})}function mR(e,t,n){return e<=n&&n<t}function gR(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 hR(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]===ta){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 dq(e,t){return hR(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function cq(e,t){return dq(e,(n,o)=>{for(let r of Zc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function uq(e){let t=[];if(!e)return t;let n=Zc(e),o=0;for(let r of n)r.start<o||(r.start>o&&gR(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&&gR(t,e.slice(o)),t}function bC(e,t,n){return!e||t>=n?!1:cq(e,(o,r)=>{let a=r+o.start,s=r+o.end,i=a-1,l=s;return!!(i>=0&&/\s/.test(e[i]??"")&&mR(t,n,i)||l<e.length&&/\s/.test(e[l]??"")&&mR(t,n,l))})}function ba(e,t=[]){if(!e)return[];let n=[],o=0;return hR(e,r=>r.type==="text"?(n.push(...uq(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function yR(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var vR=e=>e.type!=="text";function SC(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function fq(e){return e===" "||e===`
3838
- `||e===" "||e==="\r"||e===ta}function pq(e,t){let n=t-1;for(;n>=0&&!fq(e[n]??"");)n-=1;return n+1}function Ao(e,t){let n=SC(e,t),o=ba(e);if(o.length===0)return n;let r=n,a=0;for(let s of o){if(s.type==="mention"){let l=s.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(s.type==="skill"){let l=s.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function CR(e){return e.type==="text"?e.text.length:1}function xR(e,t){let n=e.reduce((o,r)=>o+CR(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function jo(e,t){return xR(ba(e),t)}function Vn(e,t){let n=SC(e,t),o=ba(e);if(o.length===0)return n;let r=n,a=0;for(let s of o){if(s.type==="mention"){let l=s.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(s.type==="skill"){let l=s.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function eu(e,t,n){let o=ba(e);if(!o.some(vR))return!1;let r=xR(o,t),a=0;for(let s of o){if(vR(s)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=CR(s)}return!1}function Yn(e,t){let n=SC(e,t),o=e.lastIndexOf(`
3839
- `,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let i=/^\/(\S*)$/.exec(r);if(i)return{kind:"slash-command",query:i[1]??"",rangeStart:o,rangeEnd:n}}let a=pq(e,n),s=e.slice(a,n);return s.startsWith("$")?{kind:"skill",query:s.slice(1),rangeStart:a,rangeEnd:n}:s.startsWith("@")?{kind:"path",query:s.slice(1),rangeStart:a,rangeEnd:n}:null}function bR(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}}function SR(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function IR(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function wR(e){let t=0;return e.getEditorState().read(()=>{let n=Fe();Le(n)&&!n.isCollapsed()&&(t=n.getTextContent().length)}),t}function TR(e){e.update(()=>{let t=Fe();Le(t)&&!t.isCollapsed()&&t.removeText()})}function Wl(e){return/mac|iphone|ipad|ipod/i.test(e)}function Ri(){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)}`}var PR="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",kR=`${PR} border border-border/70 bg-accent/40 text-foreground`,mq=`${kR} text-[12px]`,$r=`${kR} text-[0.86em] select-none`,Sa="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-['']",Qo="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",LR="truncate leading-tight",Xo="block self-center truncate leading-tight select-none",AR=`${PR} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,RR='<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>',Lm="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 IC(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function ER(e){let t=IC(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}ie();ie();var MR=yt(null),Am=MR.Provider;function Et(){let e=Dt(MR);if(e===null)throw new Error("Composer API has not been provided.");return e}var Rm=Ce(function(t){let n=Et().pierreIcons,o=n.useSpriteReady();pd(n.ensureSprite,[n]);let r=V(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:K("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(Ha,{className:K("size-4 shrink-0 text-icon-muted",t.className)}):u(wd,{className:K("size-4 shrink-0 text-icon-muted",t.className)})});var NR=$r;function _R(e){return S(we,{children:[u(Rm,{pathValue:e.path,kind:ER(e.path),theme:e.theme,className:Qo}),u("span",{className:e.selectable?LR:Xo,children:e.label})]})}function Em(e){return u("span",{className:NR,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(_R,{path:e.path,label:IC(e.path),theme:e.theme})})}function Mm(e){return S("span",{className:AR,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:Qo,dangerouslySetInnerHTML:{__html:RR}}),u("span",{className:Xo,children:e.label})]})}function DR(e){let{label:t,tooltipText:n,expired:o=!1}=e;return S(je,{children:[u(Xe,{render:S("span",{className:K($r,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(Io,{className:K(Qo,"size-icon-1",o&&"opacity-100")}),u("span",{className:Xo,children:t})]})}),u(Qe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function OR({context:e}){let{t}=fe(),n=pR(e,t),o=fR(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(DR,{label:n,tooltipText:r,expired:o})}function gq(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 hq(e){return e.replaceAll("\\","/")}function Yo(e){let t=e.displayName?.trim();return t||gq(e.name)}function wC(e){return e.enabled&&e.userInvocable!==!1}function FR(e,t){return t?e.filter(wC):[]}function BR(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function UR(e){let t=hq(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"}}ie();function vq(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var xs=class e extends yr{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return tu(t.quote,t.source).updateFromJSON(t)}constructor(t,n,o){super(o),this.__quote=t,this.__source=n}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}createDOM(){let t=document.createElement("span");return t.className=Sa,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(yq,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function tu(e,t){return Dl(new xs(e,t))}function yq(e){let{t}=fe(),[n]=an(),o=ia(),r=o?.data.assistantQuotes??null,[a,s]=G(!1),[i,l]=G(e.quote.comment??""),[d,c]=Ot(vf,o?.threadKey??"",null);q(()=>{d===null||d!==e.source||(c(null),l(e.quote.comment??""),s(!0))},[d,e.quote.comment,e.source,c]);let f=vq(e.quote),p=()=>{if(s(!1),r===null)return;let m=r.withComment(e.quote,i),g=r.serialize(m);g!==null&&n.update(()=>{let h=Fl(e.nodeKey);h instanceof xs&&h.replace(tu(m,g))})};return S(Wa,{open:a,onOpenChange:m=>{m&&l(e.quote.comment??""),s(m)},children:[u(ja,{render:S("span",{className:$r,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:f}),children:[u(ra,{"aria-hidden":"true",className:Qo}),u("span",{className:Xo,children:f})]})}),u(Ga,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:S("div",{className:"flex flex-col gap-2",children:[u("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),u(Xb,{value:i,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),p())}}),S("div",{className:"flex justify-end gap-2",children:[u(ce,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:t("composer.cancel")}),u(ce,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})}function zR(e,t){return e.registerCommand(tm,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=t.readQuotes?.()??null,a=r?.collect(o)??[],s=Zc(`${o}
3840
- `).filter(m=>m.type==="mention"&&m.end<=o.length&&!a.some(g=>m.start<g.end&&g.start<m.end));if(s.length===0&&a.length===0)return!1;let i=[...s.map(m=>({start:m.start,end:m.end,isMention:!0,create:()=>t.createMentionNode(m.value,m.source)})),...a.map(m=>({start:m.start,end:m.end,isMention:!1,create:()=>r.createNode(m)}))].sort((m,g)=>m.start-g.start),l=Fe();if(!Le(l))return!1;let d=[],c=m=>{let g=m.split(`
3841
- `);for(let h=0;h<g.length;h+=1){let v=g[h]??"";v.length>0&&d.push(hr(v)),h<g.length-1&&d.push(bi())}},f=i[0];if(f?.isMention&&f.start===0){let m=l.isBackward()?l.focus:l.anchor,g=t.getExpandedAbsoluteOffsetForPoint(m.getNode(),m.offset),h=kt().getTextContent().slice(g-1,g);h.length>0&&!/\s/.test(h)&&d.push(hr(" "))}let p=0;for(let m of i)m.start<p||(m.start>p&&c(o.slice(p,m.start)),d.push(m.create()),p=m.end);return p<o.length?c(o.slice(p)):i.at(-1)?.isMention&&d.push(hr(" ")),l.insertNodes(d),n.preventDefault(),!0},Go)}var Gl=new Map,Cq=32;function HR(e,t){for(Gl.delete(e),Gl.set(e,t);Gl.size>Cq;){let n=Gl.keys().next().value;if(n===void 0)break;Gl.delete(n)}}function xq(e){return{anchor:e.length,focus:e.length}}function Ia(e,t,n){let o=Gl.get(e);if(o)return HR(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:xq(t),history:DA()};return HR(e,r),r}function jl(e,t,n){let o=Ia(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function KR(e,t,n,o){let r=Ia(e,t);r.cursor=n,r.expandedCursor=o}function $R(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 bq=`composer-editor-${Math.random().toString(36).slice(2)}`,Sq=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],QR=new Map(Sq),qR=QR.get("`")??null,XR=yt({onRemoveTerminalContext:()=>{}});function Iq(e){let t=u(Em,{path:e.path,theme:kq()});return S(je,{children:[u(Xe,{render:t}),u(Qe,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var nu=class e extends yr{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return LC(t.path,t.source).updateFromJSON(t)}constructor(t,n=Ai(t),o){super(o),this.__path=t,this.__source=n}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=Sa,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(Iq,{path:this.__path})}};function LC(e,t){return Dl(new nu(e,t))}function wq(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function ou(e){return new Map(e.map(t=>[t.name,{label:Yo(t),description:wq(t)}]))}function Tq(e){let t=u(Mm,{label:e.skillLabel});return e.skillDescription?S(je,{children:[u(Xe,{render:t}),u(Qe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var ru=class e extends yr{__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 YR(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=Sa,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(Tq,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function YR(e,t,n){return Dl(new ru(e,t,n))}function Pq(e){return u(OR,{context:e.context})}var Ei=class e extends yr{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return JR(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=Sa,t}updateDOM(){return!1}getTextContent(){return ta}isInline(){return!0}decorate(){return u(Pq,{context:this.__context})}};function JR(e){return Dl(new Ei(e))}function wa(e){return e instanceof nu||e instanceof ru||e instanceof Ei||e instanceof xs}function kq(){return document.documentElement.classList.contains("dark")?"dark":"light"}function Nm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Dm(e){return e instanceof xs?e.getTextContentSize():1}function ZR(e){return e.getTextContentSize()}function Lq(e,t,n){return t+(n>0?Dm(e):0)}function Aq(e,t,n){return t+(n>0?ZR(e):0)}function Rq(e,t){let n=e.getParent();if(!n||!We(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===Dm(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=Dm(e),null)}function Om(e){return wa(e)?Dm(e):dt(e)?e.getTextContentSize():Ul(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+Om(n),0):0}function PC(e){return wa(e)?ZR(e):dt(e)?e.getTextContentSize():Ul(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+PC(n),0):0}function au(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),s=o.getIndexWithinParent();for(let i=0;i<s;i+=1){let l=a[i];l&&(n+=Om(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(wa(e))return Lq(e,n,t);if(Ul(e))return n+Math.min(t,1);if(We(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let s=0;s<a;s+=1){let i=r[s];i&&(n+=Om(i))}return n}return n}function Fm(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),s=o.getIndexWithinParent();for(let i=0;i<s;i+=1){let l=a[i];l&&(n+=PC(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(wa(e))return Aq(e,n,t);if(Ul(e))return n+Math.min(t,1);if(We(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let s=0;s<a;s+=1){let i=r[s];i&&(n+=PC(i))}return n}return n}function Bm(e,t){if(wa(e))return Rq(e,t);if(dt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(Ul(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(We(e)){let n=e.getChildren();for(let o of n){let r=Bm(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function Um(){return kt().getChildren().reduce((n,o)=>n+Om(o),0)}function Mi(e){let t=kt(),n=Um(),r={value:Math.max(0,Math.min(e,n))},a=Bm(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},s=Si();s.anchor.set(a.key,a.offset,a.type),s.focus.set(a.key,a.offset,a.type),vr(s)}function _m(e,t){let n=kt(),o=Um(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),s={value:r},i={value:a},l=Bm(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=Bm(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=Si();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),vr(c)}function VR(e){if(!Le(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Fm(t,e.anchor.offset),r=Fm(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function WR(e){return Le(e)?e.getNodes().some(t=>wa(t)):!1}function su(e){let t=Fe();if(!Le(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=au(n,t.anchor.offset),r=Um();return Math.max(0,Math.min(o,r))}function GR(e){let t=Fe();if(!Le(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Fm(n,t.anchor.offset),r=kt().getTextContent().length;return Math.max(0,Math.min(o,r))}function TC(e){let t=Fe();return Le(t)?{anchor:au(t.anchor.getNode(),t.anchor.offset),focus:au(t.focus.getNode(),t.focus.offset)}:e}function jR(e,t){let n=t.split(`
3842
- `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(hr(r)),o<n.length-1&&e.append(bi())}}function Eq(e,t,n){let o=0;for(let r of n?.collect(t)??[])jR(e,t.slice(o,r.start)),e.append(tu(r.quote,r.source)),o=r.end;jR(e,t.slice(o))}function AC(e,t,n,o){let r=kt();r.clear();let a=Wo();r.append(a);let s=ba(e,t);for(let i of s){if(i.type==="mention"){a.append(LC(i.path,i.source));continue}if(i.type==="skill"){let l=n.get(i.name);a.append(YR(i.name,l?.label??Yo({name:i.name}),l?.description??null));continue}if(i.type==="terminal-context"){i.context&&a.append(JR(i.context));continue}Eq(a,i.text,o)}}function kC(e){return e instanceof Ei?[e.__context.id]:We(e)?e.getChildren().flatMap(t=>kC(t)):[]}var RC="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)]",EC="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";function Mq(){let[e]=an();return q(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let i=Fe();if(!Le(i)||!i.isCollapsed()||i.anchor.type!=="element")return!1;let l=i.anchor.getNode();return We(l)&&wa(l.getChildAtIndex(i.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let i=Fe();Le(i)&&i.insertText(a)},{discrete:!0}))},n=null,o=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),n=r});return()=>{n?.removeEventListener("beforeinput",t,!0),o()}},[e]),null}function Nq(e){let[t]=an();return q(()=>{let n=(l,d)=>{if(!e.onCommandKeyDown||!d)return!1;if(l==="Enter"&&(d.isComposing||d.keyCode===229))return d.stopPropagation(),!0;let c=e.onCommandKeyDown(l,d);return c&&(d.preventDefault(),d.stopPropagation()),c},o=t.registerCommand(Hk,l=>n("ArrowDown",l),Go),r=t.registerCommand(Kk,l=>n("ArrowUp",l),Go),a=t.registerCommand(Zp,l=>n("Enter",l),Go),s=t.registerCommand(em,l=>n("Tab",l),Go),i=t.registerCommand(Vk,l=>n("Escape",l),Go);return()=>{o(),r(),a(),s(),i()}},[t,e]),null}function _q(){let[e]=an();return q(()=>{let t=e.registerCommand(Xp,o=>{let r=null;if(e.getEditorState().read(()=>{let s=Fe();if(!Le(s)||!s.isCollapsed())return;let i=su(0);if(i<=0)return;let l=kt().getTextContent();eu(l,i,"left")&&(r=i-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Mi(a)}),!0},Go),n=e.registerCommand(Yp,o=>{let r=null;if(e.getEditorState().read(()=>{let s=Fe();if(!Le(s)||!s.isCollapsed())return;let i=su(0),l=Um();if(i>=l)return;let d=kt().getTextContent();eu(d,i,"right")&&(r=i+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Mi(a)}),!0},Go);return()=>{t(),n()}},[e]),null}function Dq(){let[e]=an();return q(()=>e.registerCommand(qk,t=>{if(!Wl(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(()=>{vr(ak(o,e))}),!0)},Go),[e]),null}function Oq(){let[e]=an();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Fe();if(!Le(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!wa(r)||o.anchor.offset===0)return;n=au(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Mi(n)})})}),[e]),null}function Fq(){let[e]=an(),{onRemoveTerminalContext:t}=Ct(XR);return q(()=>e.registerCommand(Jp,n=>{let o=Fe();if(!Le(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=su(0),s=i=>{if(!wa(i))return!1;let l=au(i,0);return i.remove(),i instanceof Ei?(t(i.__context.id),Mi(a)):Mi(l),n?.preventDefault(),!0};if(s(r))return!0;if(dt(r)){if(o.anchor.offset>0)return!1;if(s(r.getPreviousSibling()))return!0;let i=r.getParent();if(We(i)){let l=r.getIndexWithinParent();if(l>0&&s(i.getChildAtIndex(l-1)))return!0}return!1}if(We(r)){let i=o.anchor.offset-1;if(i>=0&&s(r.getChildAtIndex(i)))return!0}return!1},Go),[e,t]),null}function Bq(){let[e]=an();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(Le(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof yr&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),s=e.registerCommand(Ok,()=>(n=!0,o(r()),!1),zl),i=e.registerCommand(Tk,()=>(n=!1,o(new Set),!1),zl);return()=>{a(),s(),i()}},[e]),null}function Uq(){let[e]=an(),t=N(null);return t.current=ia()?.data.assistantQuotes??null,q(()=>zR(e,{createMentionNode:LC,getExpandedAbsoluteOffsetForPoint:Fm,readQuotes:()=>{let n=t.current;return n===null?null:{collect:o=>n.collect(o),createNode:o=>tu(o.quote,o.source)}}}),[e]),null}function zq(e){let[t]=an(),n=N(e.terminalContexts),o=N(ou(e.skills)),r=N(null);r.current=ia()?.data.assistantQuotes??null;let a=N(null),s=N(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=ou(e.skills)},[e.skills]);let i=Bg(l=>{let d=QR.get(l),c=a.current;if(!d)return a.current=null,!1;let f=!1;return t.update(()=>{let p=c??(()=>{let v=Fe();if(!Le(v)||v.isCollapsed()||WR(v))return null;let y=VR(v);if(!y||y.start===y.end)return null;let C=kt().getTextContent();return bC(C,y.start,y.end)?null:{value:C,expandedStart:y.start,expandedEnd:y.end}})();if(!p||!d)return;let m=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${l}${m}${d}${p.value.slice(p.expandedEnd)}`;AC(g,n.current,o.current,r.current);let h=Vn(g,p.expandedStart);_m(h+l.length,h+l.length+m.length),f=!0,a.current=null}),f});return q(()=>{let l=h=>{if(s.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;s.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){a.current=null,s.current=null;return}t.getEditorState().read(()=>{let v=Fe();if(!Le(v)||v.isCollapsed()){a.current=null,s.current=null;return}if(WR(v)){a.current=null,s.current=null;return}let y=VR(v);if(!y||y.start===y.end){a.current=null,s.current=null;return}let C=kt().getTextContent();if(bC(C,y.start,y.end)){a.current=null,s.current=null;return}let x={value:C,expandedStart:y.start,expandedEnd:y.end};a.current=x,s.current=null})},d=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&qR!==null&&a.current){s.current=a.current;return}if(s.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){a.current=null;return}let v=h.inputType==="insertText"?h.data:null;if(!v||v.length!==1){a.current=null;return}i(v)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},c=h=>{queueMicrotask(()=>{t.update(()=>{let v=s.current;if(!v)return;let y=kt().getTextContent(),C=qR;if(C===null){s.current=null;return}let x=`${v.value.slice(0,v.expandedStart)}\`${v.value.slice(v.expandedEnd)}`;if(y!==x){h?.finalAttempt&&(a.current=null,s.current=null);return}let b=v.value.slice(v.expandedStart,v.expandedEnd),T=Vn(y,v.expandedStart);_m(T,T+1);let I=Fe();if(!Le(I)){a.current=null,s.current=null;return}I.insertText(`\`${b}${C}`),_m(T+1,T+1+b.length),a.current=null,s.current=null},{tag:Lo})})},f=h=>{let v=h;(v.inputType==="insertText"||v.inputType==="insertCompositionText")&&c()},p=()=>{c({finalAttempt:!0})},m=null,g=t.registerRootListener((h,v)=>{v?.removeEventListener("keydown",l),v?.removeEventListener("beforeinput",d,!0),v?.removeEventListener("input",f),v?.removeEventListener("compositionend",p),h?.addEventListener("keydown",l),h?.addEventListener("beforeinput",d,!0),h?.addEventListener("input",f),h?.addEventListener("compositionend",p),m=h});return()=>{m&&(m.removeEventListener("keydown",l),m.removeEventListener("beforeinput",d,!0),m.removeEventListener("input",f),m.removeEventListener("compositionend",p)),g()}},[t]),null}function Hq({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let[g]=an(),h=N(c);h.current=c;let v=jo(t,n),y=Ia(e,t,{cursor:v,expandedCursor:Ao(t,v)}),C=jo(t,y.cursor),x=SR(o),b=N(x),T=IR(r),I=N(T),k=N(ou(r)),P=N(null);P.current=ia()?.data.assistantQuotes??null;let w=N({value:t,cursor:C,expandedCursor:y.expandedCursor,selection:y.selection,terminalContextIds:o.map(F=>F.id)}),L=N(e),A=y.history,M=N(!1),R=V(()=>({onRemoveTerminalContext:d}),[d]);be(()=>{k.current=ou(r)},[r]),q(()=>{g.setEditable(!a)},[a,g]),be(()=>{let F=jo(t,n),J=w.current,O=L.current,B=O!==e,Y=b.current!==x,U=I.current!==T;if(!B&&J.value===t&&J.cursor===F&&!Y&&!U)return;if(B){let ue=J.selection;g.getEditorState().read(()=>{ue=TC(ue)}),jl(O,J.value,{cursor:J.cursor,expandedCursor:J.expandedCursor,selection:ue})}let j=Ia(e,t),oe=B?j.selection:{anchor:F,focus:F};w.current={value:t,cursor:B?j.cursor:F,expandedCursor:B?j.expandedCursor:Ao(t,F),selection:oe,terminalContextIds:o.map(ue=>ue.id)},L.current=e,b.current=x,I.current=T;let Q=g.getRootElement(),ne=!!(Q&&document.activeElement===Q);if(!B&&J.value===t&&!Y&&!U&&!ne)return;let re=B?Ia(O,J.value).history:null;M.current=!0;let Z=t==="",te=()=>g.update(()=>{let ue=B||J.value!==t||Y||U;ue&&AC(t,o,k.current,P.current),B?_m(oe.anchor,oe.focus):(ue||ne)&&Mi(F)},{discrete:!0,tag:Z?[Lo,Iy,tL]:Lo});re?$R(re,te):te(),Z&&ne&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let ue=Fe();Le(ue)&&(ue.dirty=!0)},{tag:[Lo,Iy]})},0)),jl(e,t,w.current),queueMicrotask(()=>{M.current=!1})},[n,e,g,T,o,x,t]);let D=E(F=>{let J=g.getRootElement();if(!J)return;let O=jo(w.current.value,F);J.focus({preventScroll:!0}),g.update(()=>{Mi(O)}),w.current={value:w.current.value,cursor:O,expandedCursor:Ao(w.current.value,O),selection:{anchor:O,focus:O},terminalContextIds:w.current.terminalContextIds},jl(L.current,w.current.value,{cursor:w.current.cursor,expandedCursor:w.current.expandedCursor,selection:w.current.selection}),h.current(w.current.value,O,w.current.expandedCursor,!1,w.current.terminalContextIds)},[g]),H=E(()=>{let F=w.current;return g.getEditorState().read(()=>{let J=kt().getTextContent(),O=jo(J,w.current.cursor),B=jo(J,su(O)),Y=Nm(J,w.current.expandedCursor),U=Nm(J,GR(Y)),j=kC(kt()),oe=TC(w.current.selection);F={value:J,cursor:B,expandedCursor:U,selection:oe,terminalContextIds:j}}),w.current=F,jl(L.current,F.value,F),F},[g]);Oo(m,()=>({focus:()=>{D(w.current.cursor)},focusAt:D,focusAtEnd:()=>{D(Vn(w.current.value,w.current.value.length))},readSnapshot:H,readSelectedTextLength:()=>wR(g),removeSelectedText:()=>TR(g)}),[g,D,H]);let W=E(F=>{F.read(()=>{let J=kt().getTextContent(),O=jo(J,w.current.cursor),B=jo(J,su(O)),Y=Nm(J,w.current.expandedCursor),U=Nm(J,GR(Y)),j=kC(kt()),oe=TC(w.current.selection),Q=w.current;if(Q.value===J&&Q.cursor===B&&Q.expandedCursor===U&&Q.selection.anchor===oe.anchor&&Q.selection.focus===oe.focus&&Q.terminalContextIds.length===j.length&&Q.terminalContextIds.every((re,Z)=>re===j[Z])||M.current)return;w.current={value:J,cursor:B,expandedCursor:U,selection:oe,terminalContextIds:j},jl(L.current,J,{cursor:B,expandedCursor:U,selection:oe});let ne=eu(J,B,"left")||eu(J,B,"right");h.current(J,B,U,ne,j)})},[]);return u(XR,{value:R,children:S("div",{className:RC,children:[u(uR,{contentEditable:u(nA,{className:K(EC,i),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":s,...l?{"aria-label":l}:{},placeholder:u("span",{}),onPasteCapture:p}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:s}),ErrorBoundary:oA}),u(OA,{onChange:W}),u(Nq,{...f?{onCommandKeyDown:f}:{}}),u(Mq,{}),u(zq,{terminalContexts:o,skills:r}),u(Dq,{}),u(_q,{}),u(Oq,{}),u(Fq,{}),u(Uq,{}),u(Bq,{}),u(_A,{externalHistoryState:A},e)]})})}function Kq(e){let[t]=an(),n=N(e),o=N(e),[r,a]=G(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,be(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),q(()=>{let i=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),i=c});return()=>{i?.removeEventListener("compositionend",l),d()}},[t]);let s=r===e.documentKey?e:n.current;return u(Hq,{...s})}function Ql({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let g=N(t),h=N(o),v=N(ou(r)),y=N(ia()?.data.assistantQuotes??null),C=V(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[nu,ru,Ei,xs],editorState:()=>{AC(g.current,h.current,v.current,y.current)},onError:x=>{throw x}}),[]);return u(hL,{initialConfig:C,children:u(Kq,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:s,onRemoveTerminalContext:d,onChange:c,onPaste:p,editorRef:m,...f?{onCommandKeyDown:f}:{},...i?{className:i}:{},...l?{ariaLabel:l}:{}})},bq)}function iu(e,t,n){let o=e.trim().length-t;return o<=0?null:n("composer.promptTooLong",{count:o,excess:o.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function MC(e){return e.submissionTarget==="provider-turn"?iu(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function eE(e){let t=e.disabledReason??MC(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}}var Jn=new Map;function $q(e,t,n){return`${e}\0${t}\0${n??"none"}`}function NC(e,t){Jn.delete(e),Jn.set(e,t)}function Xl(e,t){if(Jn.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,Jn.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 qq(e){if(Jn.size<=100)return;let t=Array.from(Jn);for(let[n,o]of t){if(Jn.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Xl(n,o)}for(let[n,o]of t){if(Jn.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Xl(n,o)}}function zm(){queueMicrotask(()=>qq())}function tE(e,t,n,o,r=void 0){let a=n.management?.revision??null,s=$q(e,n.intentId,a),i=Jn.get(s);if(i)return i.releaseUpload=o.releaseUpload,i.watchAuthority=r,i.state;let l={key:s,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.management?.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 Jn.set(s,d),l}function nE(e,t){let n=Jn.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:()=>Xl(e,n)})),n.committed=!0,NC(e,n),n.listeners.add(t),zm(),()=>{n.listeners.delete(t),zm()}):()=>{}}function Ni(e,t){let n=Jn.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,NC(e,n);for(let r of n.listeners)r()}}function Hm(e){return Jn.get(e)?.state}function oE(e){let t=Jn.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,NC(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Xl(e,t);return}zm()}}}function Km(e){let t=Jn.get(e);t&&Xl(e,t)}function rE(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 Jn)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Xl(o,r);zm()}var Vq=[],Wq=[],Gq=()=>{};function aE({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:s,onEdit:i,onClose:l}){let{t:d}=Kn(),c=tE(n,o,e,a,s),f=bo(F=>nE(c.key,F),()=>Hm(c.key)??c,()=>Hm(c.key)??c),{key:p,text:m,retained:g,added:h,saving:v,error:y}=f,C=N(null),[x,b]=G(()=>m.length),T=ia()?.data.assistantQuotes??null,I=F=>iu(T?T.expandForProvider(F):F,a.limits.maxInputChars,d),k=I(m),P=N(null),w=a.useUploadStatuses(),L=V(()=>g.map(F=>F.id),[g]),A=a.useAssetUrls(o,L),M=!t?.management||t.management.revision!==e.management?.revision;q(()=>{t===void 0&&(Km(p),l())},[t,p,l]);let R=()=>{v||(Km(p),l())},D=F=>{if(v||r||M)return;let J=null,O=[...h];for(let B of F){let Y=B.type||"application/octet-stream";if(B.size===0){J=d("attachments.empty",{name:B.name});continue}let U=a.makeImageAttachment({id:a.randomUUID(),name:B.name,mimeType:Y,sizeBytes:B.size,file:B});O.push(U),a.startUpload({environmentId:o,image:U})}Ni(p,B=>({...B,added:O,error:J}))},H=async()=>{let F=Hm(p);if(!F||F.saving||r||M||!F.text.trim()&&F.retained.length+F.added.length===0||I(F.text)!==null)return;let J=oE(p);if(J!==null){Ni(p,O=>({...O,saving:!0,error:null}));try{await a.awaitUploads(F.added.map(B=>B.id));let O=a.getUploadedAttachments({environmentId:o,images:F.added});if(!O)throw new Error(d("turnQueue.uploadFailed"));await i(e,{text:F.text,attachments:[...F.retained,...O]}),Km(p),l()}catch(O){Ni(p,B=>({...B,saving:!1,error:O instanceof Error?O.message:d("turnQueue.actionFailed")}))}finally{J()}}},W=[...g.map((F,J)=>({...F,previewUrl:A[J],added:!1})),...h.map(F=>({...F,added:!0}))];return u(tf,{open:!0,onOpenChange:F=>{F||R()},children:S(af,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(C.current?.focusAtEnd(),!1),children:[S(rf,{children:[u(sf,{children:d("turnQueue.editTitle")}),u(nf,{children:d("turnQueue.editDescription")})]}),S("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:F=>{F.dataTransfer.types.includes("Files")&&F.preventDefault()},onDrop:F=>{F.dataTransfer.files.length&&(F.preventDefault(),F.stopPropagation(),D(Array.from(F.dataTransfer.files)))},children:[u("div",{className:"rounded-lg border border-input bg-background px-3 py-2 focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/24",children:u(Ql,{editorRef:C,documentKey:`queue-editor\0${p}`,value:m,cursor:x,terminalContexts:Vq,skills:Wq,disabled:v,placeholder:d("turnQueue.editText"),ariaLabel:d("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:Gq,onChange:(F,J)=>{b(J),Ni(p,O=>({...O,text:F}))},onCommandKeyDown:(F,J)=>F!=="Enter"||!(J.metaKey||J.ctrlKey)?!1:(H(),!0),onPaste:F=>{F.clipboardData.files.length&&(F.preventDefault(),D(Array.from(F.clipboardData.files)))}})}),k?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:k}):null,u("ul",{className:"flex flex-wrap gap-2",children:W.map(F=>S("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[F.type==="image"&&F.previewUrl?u("img",{src:F.previewUrl,alt:F.name,className:"size-12 rounded object-cover"}):u(oo,{className:"size-4 shrink-0"}),S("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:F.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(F.sizeBytes)}),F.added&&w.get(F.id)!=="ready"?u("p",{children:d(w.get(F.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,F.added&&w.get(F.id)==="failed"?u(ce,{size:"xs",variant:"ghost",disabled:v||r||M,onClick:()=>{let J=h.find(O=>O.id===F.id);J&&a.retryUpload({environmentId:o,image:J})},children:d("turnQueue.retryUpload")}):null]}),u(ce,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:F.name}),disabled:v||M,onClick:()=>{F.added?(a.releaseUpload(F.id),F.previewUrl&&URL.revokeObjectURL(F.previewUrl),Ni(p,J=>({...J,added:J.added.filter(O=>O.id!==F.id)}))):Ni(p,J=>({...J,retained:J.retained.filter(O=>O.id!==F.id)}))},children:u(Qt,{className:"size-3.5"})})]},F.id))}),u("input",{ref:P,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:F=>{D(Array.from(F.target.files??[])),F.target.value=""}}),S(ce,{size:"sm",variant:"outline",disabled:v||r||M,onClick:()=>P.current?.click(),children:[u(oo,{className:"size-4"}),d("turnQueue.addAttachments")]}),M?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,y?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:y}):null]}),S(of,{children:[u(ce,{variant:"ghost",disabled:v,onClick:R,children:d("turnQueue.discardEdit")}),u(ce,{disabled:v||r||M||k!==null||!m.trim()&&W.length===0,onClick:()=>{H()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function sE(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 iE(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return sE(e,o).every((a,s)=>a.intentId===e[s]?.intentId)?null:o}function lE(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:sE(e,t),settled:!1}}ie();ie();function jq({entry:e,unavailable:t,onCancel:n}){let{t:o}=Kn(),r=N(!1),[a,s]=G(!1),[i,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,s(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,s(!1)}}};return S("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"?S("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),S("div",{className:"flex flex-wrap gap-2",children:[u(ce,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ce,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ce,{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,i?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function dE({entries:e,unavailable:t,onCancel:n}){let{t:o}=Kn(),[r,a]=G(!1),s=Rr();return e.length===0?null:S("div",{className:"min-w-0 basis-full space-y-2",children:[u(ce,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":s,onClick:()=>a(i=>!i),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:s,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(i=>u(jq,{entry:i,unavailable:t,onCancel:n},i.intentId))}):null]})}function _C({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=Kn(),s=N(!1),[i,l]=G(!1),[d,c]=G(!1),f=N(!1),[p,m]=G(!1),[g,h]=G(!1),[v,y]=G(null);q(()=>{e.paused||c(!1)},[e.paused]);let C=o?.[0];q(()=>{m(!1),y(null)},[C?.intentId,C?.status,C?.deliveryCertainty]);let x=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!x)return null;let b=r!==void 0&&C?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),T=async()=>{if(f.current||t||r===void 0||C===void 0)return;let w=C;f.current=!0,h(!0),y(null);try{await r(w),m(!1)}catch{y(w.intentId)}finally{f.current=!1,h(!1)}},I=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),k=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),P=async()=>{if(!(s.current||t||!e.paused)){s.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{s.current=!1,l(!1)}}};return S("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:[S("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[S("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:I}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:k}),e.paused&&x?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===C?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ce,{size:"xs",variant:"outline",disabled:i,softDisabled:t,onClick:()=>{P()},children:a(i?"turnQueue.resuming":"turnQueue.resume")}):null,b?S(we,{children:[u(ce,{size:"xs",variant:"outline",disabled:g,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(ju,{open:p,onOpenChange:w=>{w||m(!1)},children:S(Zu,{className:"max-w-lg",children:[S(Ju,{children:[u(ef,{children:a("turnQueue.stopWaiting")}),u(Xu,{children:a("turnQueue.abandonDescription")})]}),S(Yu,{children:[u(Qu,{render:u(ce,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ce,{variant:"outline",disabled:g||t,onClick:()=>{T()},children:a(g?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(dE,{entries:o.filter(w=>w.status!=="queued"),unavailable:t,onCancel:r}):null]})}var Qq=[w0,I0],Xq=[];function Yq({submission:e}){let{t}=Kn();return S("li",{"data-queue-pending-message":e.messageId,className:"flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",children:[u("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:u("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),S("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:uh(e.text)||t("turnQueue.attachmentsOnly")}),e.attachmentNames.length?S("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(oo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),u("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:t("primaryActions.sendingButtonLabel")})]})}function Jq({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:s}){let{t:i}=Kn(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:g}=x0({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return S("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":g||void 0,"data-queue-feedback":r,style:{transform:os.Transform.toString(p),transition:m},className:K("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",g&&"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:K("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(ce,{ref:f,size:"icon-xs",variant:"ghost",className:K("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(g||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":i("turnQueue.reorderMessage"),title:i("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(Hn,{className:"size-3.5"}):u(Ld,{className:"size-3.5"})}),s,g&&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 cE({inputKey:e,entries:t,pendingSubmissions:n=Xq,environmentId:o,unavailable:r,attachments:a,actions:s,onCancel:i}){let{t:l}=Kn(),d=Jf("(prefers-reduced-motion: reduce)"),[c,f]=Ot("turn-queue:editing",e,null),[p,m]=Ot("turn-queue:pending",e,!1),g=xt("turn-queue:pending-ref",e,!1),[h,v]=Ot("turn-queue:error",e,null),[y,C]=Ot("turn-queue:drag",e,null),[x,b]=Ot("turn-queue:move",e,null),T=xt("turn-queue:reorder-ref",e,!1),[I,k]=Ot("turn-queue:feedback",e,null),P=Ww(Oh(pl,{activationConstraint:{distance:5}}),Oh(fl,{coordinateGetter:b0,scrollBehavior:d?"auto":"smooth"})),w=V(()=>t.filter(O=>O.waiting),[t]),L=x?lE(w,x.preview):null,A=L?.entries??w,M=A.length+n.length,R=r||p||x!==null,D=A.findIndex(O=>O.intentId===y?.activeId),H=A.findIndex(O=>O.intentId===y?.overId);q(()=>{rE(e,t)},[t,e]),q(()=>{x!==null&&(r||x.acknowledged&&L?.settled)&&(T.current=!1,b(null),!r&&w.some(O=>O.intentId===x.preview.intentId)&&k({intentId:x.preview.intentId,kind:"saved"}))},[w,x,L?.settled,r]),q(()=>{if(I===null||I.kind==="failed")return;let O=window.setTimeout(()=>k(B=>B===I?null:B),1600);return()=>window.clearTimeout(O)},[I]);let W=async O=>{if(!(g.current||T.current||r)){g.current=!0,m(!0),v(null),k(null);try{await O()}catch(B){v(B instanceof Error?B.message:l("turnQueue.actionFailed"))}finally{g.current=!1,m(!1)}}},F=(O,B)=>W(async()=>{let Y=iE(w,O.intentId,B);if(!(Y===null||!O.management?.canReorder)){T.current=!0,b({preview:Y,acknowledged:!1});try{await s.onReorder(O,B),b(U=>U?.preview===Y?{...U,acknowledged:!0}:U)}catch(U){throw T.current=!1,b(null),k({intentId:O.intentId,kind:"failed"}),U}}}),J=r?l("turnQueue.disconnected"):x!==null?l("turnQueue.saving"):y!==null?`${l("turnQueue.dragStarted")} ${H+1}/${A.length}`:I?.kind==="saved"?l("common.action.done"):I?.kind==="cancelled"?l("turnQueue.dragCancelled"):"";return S(we,{children:[M>0?S("section",{"aria-label":l("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:[S("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:l("turnQueue.queued",{count:M})}),u("span",{role:"status","aria-live":y===null?"polite":"off","data-queue-reorder-status":x?"saving":I?.kind,className:K("min-w-0 truncate",I?.kind==="saved"&&"text-primary"),children:J})]}),u(d0,{sensors:P,collisionDetection:Qw,modifiers:Qq,accessibility:{screenReaderInstructions:{draggable:l("turnQueue.dragInstructions")},announcements:{onDragStart:()=>l("turnQueue.dragStarted"),onDragOver:({over:O})=>{let B=A.findIndex(Y=>Y.intentId===O?.id);return B<0?void 0:`${l("turnQueue.dragStarted")} ${B+1}/${A.length}`},onDragEnd:()=>l("turnQueue.dragFinished"),onDragCancel:()=>l("turnQueue.dragCancelled")}},onDragStart:({active:O})=>{let B=A.find(Y=>Y.intentId===O.id);!B?.management?.canReorder||R||(v(null),k(null),C({activeId:B.intentId,overId:B.intentId}))},onDragOver:({over:O})=>{let B=A.find(Y=>Y.intentId===O?.id);B&&C(Y=>Y&&{...Y,overId:B.intentId})},onDragCancel:()=>{y&&k({intentId:y.activeId,kind:"cancelled"}),C(null)},onDragEnd:({active:O,over:B})=>{if(C(null),!B||O.id===B.id)return;let Y=A.findIndex(Q=>Q.intentId===O.id),U=A.findIndex(Q=>Q.intentId===B.id),j=A[Y];if(!j?.management?.canReorder||U<0)return;let oe=A[U+(Y<U?1:0)]?.intentId??null;F(j,oe)},children:u(y0,{items:A.map(O=>O.intentId),strategy:g0,children:S("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[A.map((O,B)=>S(Jq,{entry:O,disabled:!O.management?.canReorder||R,reducedMotion:d,feedback:I?.intentId===O.intentId?I.kind:void 0,dropPosition:O.intentId===y?.overId&&D!==H?D<H?"after":"before":void 0,dragPosition:O.intentId===y?.activeId?`${H+1}/${A.length}`:void 0,children:[S("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:uh(O.text??"")||l("turnQueue.attachmentsOnly")}),O.attachmentNames.length?S("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(oo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:O.attachmentNames.join(", ")})]}):null,O.pendingAction?u("p",{className:"text-muted-foreground",children:l(O.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,O.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:O.failure}):null]}),S("div",{className:K("flex shrink-0 items-center gap-0.5",O.intentId===y?.activeId&&"invisible"),children:[u(ce,{size:"icon-xs",variant:"ghost",disabled:!O.management||R||y!==null,"aria-label":l("turnQueue.editMessage"),title:l("turnQueue.editMessage"),onClick:()=>f(O),children:u(Od,{className:"size-3.5"})}),O.management?.canSteer?u(ce,{size:"icon-xs",variant:"ghost",disabled:R||y!==null,"aria-label":l("turnQueue.steer"),title:l("turnQueue.steerDescription"),onClick:()=>{W(()=>s.onRun(O,"steer"))},children:u(Fd,{className:"size-3.5"})}):null,S(mo,{children:[u(ho,{render:u(ce,{size:"icon-xs",variant:"ghost",disabled:R||!O.management||y!==null,"aria-label":l("turnQueue.messageActions")}),children:u(Bo,{className:"size-4"})}),S(go,{align:"end",children:[S(Uo,{disabled:!O.management?.canReorder||B===0,onClick:()=>{F(O,A[B-1].intentId)},children:[u(yd,{className:"size-4"}),l("turnQueue.moveUp")]}),S(Uo,{disabled:!O.management?.canReorder||B===A.length-1,onClick:()=>{F(O,A[B+2]?.intentId??null)},children:[u(hd,{className:"size-4"}),l("turnQueue.moveDown")]}),O.management?.canSteer?u(Uo,{onClick:()=>{W(()=>s.onRun(O,"steer"))},children:l("turnQueue.steer")}):null,u(Uo,{disabled:!O.management?.canRun,onClick:()=>{W(()=>s.onRun(O,"interrupt"))},children:l(O.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(aa,{}),u(Uo,{disabled:O.action!=="cancel",onClick:()=>{W(()=>i(O))},children:l("turnQueue.cancelMessage")})]})]})]})]},O.intentId)),n.map(O=>u(Yq,{submission:O},O.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(aE,{entry:c,current:t.find(O=>O.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:R,attachments:a,watchEditorAuthority:s.watchEditorAuthority,onEdit:s.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function uE({data:e,target:t,inputKey:n,attachments:o}){let r=e.useQueue({target:t,threadKey:n}),{environmentId:a,threadId:s}=t,i=e.queue,l=V(()=>{let c={environmentId:a,threadId:s};return{actions:{onEdit:(p,m)=>i.edit(c,p,m),onReorder:(p,m)=>i.reorder(c,p,m),onRun:(p,m)=>i.run(c,p,m),watchEditorAuthority:i.watchEditorAuthority},onCancel:p=>i.cancel(c,p),onResume:()=>i.resume(c)}},[i,a,s]),d=V(()=>({data:e,target:t,threadKey:`${n}\0queue-editor`}),[e,t,n]);return S(we,{children:[u(Ff,{value:d,children:u(cE,{inputKey:n,actions:l.actions,attachments:o,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:a,onCancel:l.onCancel,unavailable:r.unavailable})}),u(_C,{entries:r.entries,onCancel:l.onCancel,onResume:l.onResume,queue:r.state,unavailable:r.unavailable})]})}ie();function Yl(e){return e.id??e.label}function DC(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?[Yl(o)]:[]})))}var fE=Ce(function(t){let n=t.data.useQuestions(t.target);return n.pending.length===0?null:u("div",{"data-async-question-stack":!0,className:"mx-auto mb-2 flex max-h-[45vh] w-full max-w-3xl flex-col gap-2 overflow-y-auto overscroll-contain",children:n.pending.toReversed().map(o=>u(eV,{pending:o,actions:n},o.requestId))})});function Zq(e,t,n){let o={};for(let r of e.questions){let a=n[r.id]?.trim()??"",s=t[r.id]??[];if(a.length>0)o[r.id]=a;else if(s.length>0)o[r.id]=r.multiSelect?s:s[0];else return null}return o}var eV=Ce(function(t){let{pending:n,actions:o}=t,{t:r}=fe(),[a,s]=G({}),[i,l]=G({}),[d,c]=G(!1),[f,p]=G(null),m=Zq(n,a,i),g=y=>{c(!0),p(null),y().then(C=>{c(!1),p(C)})},h=()=>{m===null||d||g(()=>o.answer(n.requestId,m))},v=(y,C,x)=>s(b=>{let T=b[y]??[],I=T.includes(C)?T.filter(k=>k!==C):x?[...T,C]:[C];return{...b,[y]:I}});return S("section",{"data-async-question":n.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 text-sm shadow-xs",children:[S("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[u(qa,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium",children:r("asyncQuestion.title")})]}),n.questions.map(y=>{let C=a[y.id]??[],x=i[y.id]??"";return S("div",{className:"mt-2","data-async-question-item":y.id,children:[u("p",{className:"whitespace-pre-wrap break-words text-foreground/85",children:y.question}),y.multiSelect?u("p",{className:"mt-0.5 text-xs text-secondary-label",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?u("div",{className:"mt-1.5 flex flex-wrap gap-1",children:y.options.map(b=>{let T=Yl(b),I=x.trim().length===0&&C.includes(T);return S(ce,{size:"xs",variant:I?"secondary":"outline","aria-pressed":I,disabled:d,onClick:()=>v(y.id,T,y.multiSelect===!0),children:[I?u(Hn,{"aria-hidden":!0,className:"size-icon-1"}):null,b.label]},T)})}):null,u(Yi,{type:"text",value:x,disabled:d,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),className:"mt-1.5 h-8",onChange:b=>l(T=>({...T,[y.id]:b.target.value})),onKeyDown:b=>{b.key!=="Enter"||b.nativeEvent.isComposing||(b.preventDefault(),h())}})]},y.id)}),f?u("p",{role:"alert",className:"mt-1.5 text-xs text-destructive-foreground",children:f}):null,S("div",{className:K("mt-2 flex items-center justify-end gap-1"),children:[u(ce,{size:"xs",variant:"ghost",disabled:d,onClick:()=>g(()=>o.dismiss(n.requestId)),children:r("asyncQuestion.dismiss")}),u(ce,{size:"xs",disabled:d||m===null,onClick:h,children:r("asyncQuestion.answer")})]})]})});ie();var OC=220,tV={opacity:0,transform:"translate3d(0, 4rem, 0)"},nV={opacity:0,transform:"translate3d(0, 7rem, 0)"},pE={opacity:1,transform:"none"},mE={transition:`transform ${OC}ms ease-in, opacity ${OC}ms ease-in`},oV={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function hE({className:e,items:t}){let{t:n}=fe(),[o,r]=G(null),a=N(null),s=o!==null&&t.some(m=>m.id===o)?o:null;if(q(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let l=t.slice(1),d=l.length>0,c=d&&s!==i.id,f=l[0],p=m=>{!m.onDismiss||s||(r(m.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m.onDismiss?.()},OC))};return u("div",{className:K("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:S("div",{className:K("relative flex flex-col-reverse",d?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[c&&f?u("div",{className:K("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)]",oV[f.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:K("relative z-10",s===i.id?"pointer-events-none":null),style:{...mE,...s===i.id?tV:pE},children:u(gE,{item:i,attached:!0,exiting:s===i.id,onDismissRequest:()=>p(i)})}),d?u("div",{"data-composer-banner-stack-expanded-items":"true",className:K("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:K("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:l.map(m=>u("div",{className:K(s===m.id?"pointer-events-none":null),style:{...mE,...s===m.id?nV:pE},children:u(gE,{item:m,attached:!1,exiting:s===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function gE({item:e,attached:t,exiting:n,onDismissRequest:o}){let{t:r}=fe(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?S(qd,{variant:e.variant,role:"status",className:K("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,S(Xg,{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?S(Vd,{className:K("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:n,onClick:o,children:u(Qt,{})}):null]}):null]}):S(qd,{variant:e.variant,className:K(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(Xg,{children:e.title}),e.description?u(df,{children:e.description}):null,e.actions||e.onDismiss?S(Vd,{className:K(e.actionClassName,a?"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(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:n,onClick:o,children:u(Qt,{})}):null]}):null]})}ie();var vE=yt(!1),yE=vE.Provider;function CE(){return Dt(vE)}function xE({belowSlot:e,composer:t,data:n,draftHero:o,onOverlayElementChange:r,queue:a,questions:s,target:i,threadKey:l}){let d=n.useComposerBanners({target:i,threadKey:l}),c=u(hE,{className:"relative z-0",items:d.items});return S("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:[S("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:[S("div",{className:"pointer-events-auto relative z-10",children:[a,s,o.active?S("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),c]}):c,S("div",{"data-chat-composer-stack":"true",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:u(yE,{value:d.items.length>0,children:t})})}),u("div",{className:"min-h-0",children:e})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),d.overlay]})}function bE(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}ie();var rV={"start-failed":"attachments.uploadFailure.startFailed","not-connected":"attachments.uploadFailure.notConnected",rejected:"attachments.uploadFailure.rejected","timed-out":"attachments.uploadFailure.timedOut",cancelled:"attachments.uploadFailure.cancelled",failed:"attachments.uploadFailure.failed"};function $m(e,t){let n=e.code===void 0?void 0:rV[e.code];return n===void 0?e.reason:t(n,{status:e.httpStatus??""})}function SE(e,t){let n=0,o=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?o+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(n+=1)}return o>0?t("attachments.retryOrRemoveFailed",{count:o}):n>0?t("attachments.stillUploading",{count:n}):null}function qm(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}ie();function IE(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function wE(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function TE(e,t){let n=Et().pane.useVisible(),[o,r]=G(null);be(()=>{if(!n)return;let s=e.current;if(!s)return;let i=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!i)return;let p=f.find(v=>v.target===s);if(!p)return;let m=window.getComputedStyle(s),g=Number.parseFloat(m.paddingLeft)||0,h=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return c.observe(s),()=>{i=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,i&&r(s.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{i=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=IE(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&wE(o,{hasWideActions:t})}}ie();function PE(e,t){let n=[],o=[];for(let r of e){let a=t(r);if(a.kind==="remote")return{paths:[],remote:!0,unavailableNames:[]};a.kind==="path"?n.push(a.path):o.push(r.name)}return{paths:n,remote:!1,unavailableNames:o}}function kE(e){let t=PE(e.folders,e.resolve);t.remote&&e.notifyError(e.t("attachments.folderRemote"));for(let n of t.unavailableNames)e.notifyError(e.t("attachments.folderPathUnavailable",{name:n}),e.t("attachments.folderPathUnavailableDetail"));for(let n of t.paths)e.insertText(`${Ai(n)} `)}var aV=["image/gif","image/jpeg","image/png","image/webp"],sV=new Set(aV);function FC(e){return sV.has(e.toLowerCase())}function iV(e){return FC(e)?"image":"file"}var lV=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function Vm(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||lV.has(t)?"text":"file"}function Jl(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 BC(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return iV(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}var UC="ycodium:paste-as-text",LE=new TextEncoder;function AE(e,t){return e.key.toLowerCase()==="v"&&e.shiftKey&&!e.altKey&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)}function dV(e){return e.bypassAutoAttachment||!e.canAttach||e.text.length===0?"inline":e.wouldExceedInputLimit||e.text.length>=32768||LE.encode(e.text).byteLength>=32768?"attachment":"inline"}function cV(e){let t=new Set(e.map(n=>n.toLowerCase()));if(!t.has("pasted-text.txt"))return"pasted-text.txt";for(let n=2;;n+=1){let o=`pasted-text-${n}.txt`;if(!t.has(o))return o}}function uV(e){let t=Math.max(0,Math.min(e.valueLength,e.selectedLength));return e.valueLength-t+e.textLength>e.maxLength}function RE(e){let t=uV({valueLength:e.valueLength,selectedLength:e.selectedLength,textLength:e.text.length,maxLength:e.maxInputChars});if(dV({text:e.text,bypassAutoAttachment:e.bypassAutoAttachment,wouldExceedInputLimit:t,canAttach:!0})!=="attachment")return{kind:"inline"};let n=LE.encode(e.text).byteLength;return e.maxFileBytes!==null&&n>e.maxFileBytes?t?{kind:"reject",reason:"file-too-large"}:{kind:"inline"}:{kind:"fold",fileName:cV(e.existingNames),sizeBytes:n}}function EE(e,t,n){if(e.blocked)return!1;let{editor:o,registry:r,t:a}=e;r.documentKey!==e.documentKey&&(r.documentKey=e.documentKey,r.names.clear());for(let i of e.existingImageNames)r.names.add(i);let s=RE({text:t,bypassAutoAttachment:n,valueLength:e.promptLength,selectedLength:o?.readSelectedTextLength()??0,maxInputChars:e.maxInputChars,maxFileBytes:e.maxFileBytes,existingNames:[...r.names]});return s.kind==="inline"?!1:s.kind==="reject"?(e.notify.error(a("attachments.pastedTooLargeToAttach"),a("attachments.pastedTooLargeToAttachDetail")),!0):(r.names.add(s.fileName),o?.removeSelectedText(),e.addFoldedFile(new File([t],s.fileName,{type:"text/plain;charset=utf-8"})),e.notify.info(a("attachments.pastedAttached",{name:s.fileName}),a("attachments.pastedAttachedDetail",{size:Jl(s.sizeBytes),shortcut:Wl(navigator.platform)?"\u2318\u21E7V":"Ctrl+Shift+V"})),!0)}ie();var ME="application/x-ycodium-composer-mention";function zC(e){return e.includes(ME)}function NE(e){let t=n=>zC(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(ME);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function _E({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=G(!1),a=NE({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:n}),s=i=>{if(!zC(i.dataTransfer.types))return;i.stopPropagation();let l=i.relatedTarget;l instanceof Node&&i.currentTarget.contains(l)||r(!1)};return be(()=>{r(!1)},[e]),q(()=>{if(!o)return;let i=()=>{r(!1)};return window.addEventListener("dragend",i),()=>window.removeEventListener("dragend",i)},[o]),{isDragOverComposer:o,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:s}}ie();function DE(e){let t=N(0);return q(()=>{let n=()=>{t.current=Date.now()+1e3},o=s=>{s.target instanceof Node&&e.current?.contains(s.target)&&AE(s,Wl(navigator.platform))&&n()},r=()=>{t.current=0},a=()=>{let s=document.activeElement;s instanceof Node&&e.current?.contains(s)&&n()};return window.addEventListener(UC,a),window.addEventListener("keydown",o,!0),window.addEventListener("blur",r),()=>{window.removeEventListener(UC,a),window.removeEventListener("keydown",o,!0),window.removeEventListener("blur",r)}},[e]),E(()=>{let n=Date.now()<=t.current;return t.current=0,n},[])}function OE(e){let{api:t,attachments:n,t:o,addComposerImages:r,promptRef:a,promptInputRef:s,composerEditorRef:i,composerFormRef:l,composerThreadKey:d,attachmentDocumentKey:c,attachmentImagesRef:f,limits:p,supportsAttachmentUploads:m,composerDocumentKey:g,isComposerApprovalState:h,pasteBlocked:v,hasPendingUserInputs:y,projectSelectionRequired:C,environmentId:x}=e,b=DE(l),T=N({documentKey:"",names:new Set}),I=(D,H)=>EE({blocked:v,editor:i.current,documentKey:c,registry:T.current,existingImageNames:f.current.map(W=>W.name),promptLength:a.current.length,maxInputChars:p.maxInputChars,maxFileBytes:m?null:p.inlineAttachmentMaxBytes,t:o,notify:t.notify,addFoldedFile:W=>{r([W],{source:{_tag:"pasted-text"}})}},D,H),k=D=>{let H=Array.from(D.clipboardData.files);if(H.length>0){D.preventDefault(),r(H);return}let W=D.clipboardData.getData("text/plain");I(W,b())&&(D.preventDefault(),D.stopPropagation())},P=(D,H)=>{if(D.length===0||h||y||C)return!1;let W=a.current,F=(H?.ensureLeadingBoundary??!1)&&W.length>0&&!/\s$/.test(W);return s.current?.applyPromptReplacement(W.length,W.length,F?` ${D}`:D)??!1},w=xt(hf,d,null);w.current=D=>{if(h||y||C)return!1;let H=a.current,W=Math.max(0,Math.min(H.length,s.current?.readSnapshot().expandedCursor??H.length)),F=H.slice(0,W),J=H.slice(W),O=`${F.length>0&&!/\s$/.test(F)?" ":""}${D}${/^\s/.test(J)?"":" "}`;return s.current?.applyPromptReplacement(W,W,O)??!1};let{isDragOverComposer:L,composerMentionDragHandlers:A,onComposerMentionDragLeaveCapture:M}=_E({documentKey:g,insertMentionAtEnd:D=>P(D,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{t.notify.error(o("composer.unableToAddToChat"),o("composer.composerBusy"))}});return{onComposerPaste:k,insertComposerTextAtEnd:P,addDroppedFolders:D=>{kE({folders:D,resolve:H=>n.resolveDroppedFolder({environmentId:x,folder:H}),t:o,notifyError:(H,W)=>t.notify.error(H,W),insertText:H=>P(H,{ensureLeadingBoundary:!0})})},isDragOverComposer:L,composerMentionDragHandlers:A,onComposerMentionDragLeaveCapture:M}}ie();function FE(e){let{api:t,t:n,limits:o,promptRef:r,promptInputRef:a,composerEditorRef:s,composerImagesRef:i,composerDraftTarget:l,setComposerDraftPrompt:d,addComposerDraftImages:c,clearComposerDraftPromptAndImages:f,setIsStashMenuOpen:p,setStashPulse:m,isComposerCollapsedMobile:g,expandMobileComposer:h,keybindings:v,terminalOpen:y,isComposerModelPickerOpen:C,hasPendingUserInputs:x,isComposerApprovalState:b,projectSelectionRequired:T,answeringQuestion:I}=e,k=N(0),P=N(null),w=N(new Set),L=t.stash.useStore,A=L(U=>U.entries),M=L(U=>U.stashEntry),R=L(U=>U.takeEntry),D=L(U=>U.finalizeEntryImages);q(()=>()=>{P.current!==null&&window.clearTimeout(P.current)},[]);let H=E(()=>{k.current+=1,m({key:k.current,active:!0}),P.current!==null&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{P.current=null,m(U=>({...U,active:!1}))},1200)},[]),W=E(U=>{let{entry:j,durable:oe}=R(U.id);if(!j)return;oe||t.notify.warning(n("composer.stashReappear"),n("composer.storageRejectedKeep")),p(!1);let Q=r.current,ne=U.prompt.length===0?Q:Q.trim().length?`${Q.replace(/\s+$/,"")}
3787
+ `?d.insertParagraph():c===" "?d.insertNodes([ok()]):d.insertText(c)}}}else t.insertRawText(s)}function pC(e,t,n){e.dispatchCommand(Xk,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(ke(o)&&o.isCollapsed()){let r=o.anchor,a=null,s=_l(r,"previous");if(s)if(Hp(s))a=s.origin;else{let i=ak(s,xs(Lt(),"next").getFlipped());for(let l of i){if(it(l.origin)){a=l.origin;break}if(We(l.origin)&&!l.origin.isInline())break}}if(a&&it(a)){let i=a.getFormat(),l=a.getStyle();o.format===i&&o.style===l||(o.format=i,o.style=l,o.dirty=!0)}}})(n))}function QA(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=We(n)&&n.excludeFromCopy("html"),s=n;t!==null&&it(s)&&(s=fm(t,s,"clone"));let i=We(s)?s.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Tm(58,f.name),We(d)){let p=c.children;Array.isArray(p)||Tm(59,f.name)}return c})(s);it(s)&&s.getTextContentSize()===0&&(r=!1);for(let d=0;d<i.length;d++){let c=i[d],f=QA(e,t,c,l.children);!r&&We(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 XA(e,t){let n=[],o=Lt().getChildren();for(let r=0;r<o.length;r++)QA(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function YA(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=vk(o);it(r)&&LL(r),t.push(r)}return t}var $l=null;async function R3(e,t,n){if($l!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(WA(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,s=Sy(r);if(o===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),o.append(i);let l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(Wp,p=>(Gc(p,ClipboardEvent)&&(f(),$l!==null&&(r.clearTimeout($l),$l=null),d(WA(e,p,n))),!0),Vp);$l=r.setTimeout(()=>{f(),$l=null,d(!1)},50),a.execCommand("copy"),i.remove()})}function WA(e,t,n){if(n===void 0){let r=Sy(e._window),a=Oe();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!uL(e,s,i))return!1;n=ZA(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(eR(o,n),!0)}var JA=[["text/html",GA],["application/x-lexical-editor",jA]];function ZA(e=Oe()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=Bp();for(let[o,r]of JA){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function eR(e,t){for(let[n]of JA)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var Ur=mC,vle=Ur.$generateJSONFromSelectedNodes,yle=Ur.$generateNodesFromSerializedNodes,Cle=Ur.$getClipboardDataFromSelection,tR=Ur.$getHtmlContent,xle=Ur.$getLexicalContent,gC=Ur.$insertDataTransferForPlainText,ble=Ur.$insertDataTransferForRichText,Sle=Ur.$insertGeneratedNodes,Ile=Ur.copyToClipboard,wle=Ur.setLexicalClipboardDataTransfer;var hC={};bn(hC,{PlainTextExtension:()=>F3,registerPlainText:()=>rR});var wi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,E3=wi&&"documentMode"in document?document.documentMode:null,M3=wi&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),N3=!(!wi||!("InputEvent"in window)||E3)&&"getTargetRanges"in new window.InputEvent("input"),_3=wi&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),nR=wi&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,D3=wi&&/^(?=.*Chrome).*/i.test(navigator.userAgent),O3=wi&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&M3&&!D3;function oR(e,t){t.update(()=>{if(e!==null){let n=Gc(e,KeyboardEvent)?null:e.clipboardData,o=Oe();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=tR(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function rR(e){return xa(e.registerCommand(Gp,t=>{let n=Oe();return!!ke(n)&&(n.deleteCharacter(t),!0)},Jt),e.registerCommand(Rk,t=>{let n=Oe();return!!ke(n)&&(n.deleteWord(t),!0)},Jt),e.registerCommand(Ak,t=>{let n=Oe();return!!ke(n)&&(n.deleteLine(t),!0)},Jt),e.registerCommand(kk,t=>{let n=Oe();if(!ke(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)gC(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Jt),e.registerCommand(jk,()=>{let t=Oe();return!!ke(t)&&(t.removeText(),!0)},Jt),e.registerCommand(xy,t=>{let n=Oe();return!!ke(n)&&(n.insertLineBreak(t),!0)},Jt),e.registerCommand(Ok,()=>{let t=Oe();return!!ke(t)&&(t.insertLineBreak(),!0)},Jt),e.registerCommand(Qp,t=>{let n=Oe();if(!ke(n))return!1;let o=t,r=o.shiftKey;return!!Oy(n,!0)&&(o.preventDefault(),Dy(n,r,!0),!0)},Jt),e.registerCommand(Xp,t=>{let n=Oe();if(!ke(n))return!1;let o=t,r=o.shiftKey;return!!Oy(n,!1)&&(o.preventDefault(),Dy(n,r,!1),!0)},Jt),e.registerCommand(Yp,t=>{let n=Oe();return!!ke(n)&&(!nR||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Gp,!0))},Jt),e.registerCommand(zk,t=>{let n=Oe();return!!ke(n)&&(t.preventDefault(),e.dispatchCommand(Gp,!1))},Jt),e.registerCommand(Jp,t=>{let n=Oe();if(!ke(n))return!1;if(t!==null){if((nR||_3||O3)&&N3)return!1;t.preventDefault()}return e.dispatchCommand(xy,!1)},Jt),e.registerCommand(Yk,()=>(Kp(),!0),Jt),e.registerCommand(Wp,t=>{let n=Oe();return!!ke(n)&&(oR(t,e),!0)},Jt),e.registerCommand(Lk,t=>{let n=Oe();return!!ke(n)&&((function(o,r){oR(o,r),r.update(()=>{let a=Oe();ke(a)&&a.removeText()})})(t,e),!0)},Jt),e.registerCommand(em,t=>{let n=Oe();return!!ke(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Oe(),s=Gc(o,ClipboardEvent)?o.clipboardData:null;s!=null&&ke(a)&&gC(s,a)},{tag:Vk})})(t,e),!0)},Jt),e.registerCommand(Mk,t=>{let n=Oe();return!!ke(n)&&(t.preventDefault(),!0)},Jt),e.registerCommand(Ek,t=>{let n=Oe();return!!ke(n)&&(t.preventDefault(),!0)},Jt))}var F3=Sn({conflictsWith:["@lexical/rich-text"],dependencies:[BA],name:"@lexical/plain-text",register:rR});var aR=hC,Ele=aR.PlainTextExtension,sR=aR.registerPlainText;var yC={};bn(yC,{PlainTextPlugin:()=>H3});le();var Pm=ud(nc(),1);function B3(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 vC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:q;function U3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=Q(()=>n.getDecorators());return vC(()=>n.registerDecoratorListener(s=>{(0,Pm.flushSync)(()=>{a(s)})}),[n]),q(()=>{a(n.getDecorators())},[n]),V(()=>{let s=[],i=Object.keys(r);for(let l=0;l<i.length;l++){let d=i[l],c=u(o,{onError:p=>n._onError(p),children:u(_g,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&s.push((0,Pm.createPortal)(c,f,d))}return s},[o,r,n])})(e,t)}function z3({editor:e,ErrorBoundary:t}){return(function(n){let o=IA.maybeFromEditor(n);if(o&&o.hasExtensionByName(DA.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&B3(320,r);return!0}return!1})(e)?null:u(U3,{editor:e,ErrorBoundary:t})}function iR(e){return e.getEditorState().read(lm(e.isComposing()))}function H3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=an();return(function(r){vC(()=>xa(sR(r),UA(r)),[r])})(o),S(Ie,{children:[e,u(K3,{content:t}),u(z3,{editor:o,ErrorBoundary:n})]})}function K3({content:e}){let[t]=an(),n=(function(r){let[a,s]=Q(()=>iR(r));return vC(()=>{function i(){let l=iR(r);s(l)}return i(),xa(r.registerUpdateListener(()=>{i()}),r.registerEditableListener(()=>{i()}))},[r]),a})(t),o=_A();return n?typeof e=="function"?e(o):e:null}var $3=yC,lR=$3.PlainTextPlugin;function q3(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function V3(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function W3(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Ti(e){return`[${V3(q3(e))}](${W3(e)})`}le();var G3=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,j3=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var Q3=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),X3=/^[A-Za-z][A-Za-z0-9+.-]*:/,Y3=/^[A-Za-z]:[\\/]/,J3=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function Z3(e){let t=[];for(let n of e.matchAll(Q3)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),s=n[3]??"",i=s;try{i=decodeURIComponent(s)}catch{}let l=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\")),d=l>=0?i.slice(l+1):i,c=X3.test(i)&&!Y3.test(i);if(!i||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(j3)){let o=n[0],r=n[1]??"",a=n[2],s=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!s||a===void 0&&J3.test(s))continue;let i=(n.index??0)+r.length,l=i+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(i,l),start:i,end:l})}return t}function Jc(e,t={}){let n=Z3(e);for(let o of e.matchAll(G3)){let r=o[0],a=o[1]??"",s=o[2]??"";if(!s)continue;let i=(o.index??0)+a.length,l=i+r.length-a.length;n.push({type:"skill",value:s,source:e.slice(i,l),start:i,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 eq(e){return e.replace(/\r\n/g,`
3788
+ `).replace(/^\n+|\n+$/g,"")}function tq(e){return eq(e.text).length>0}function dR(e){return!tq(e)}function nq(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function cR(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:nq(e,t)})}function uR(e,t,n){return e<=n&&n<t}function fR(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 pR(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]===ta){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 oq(e,t){return pR(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function rq(e,t){return oq(e,(n,o)=>{for(let r of Jc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function aq(e){let t=[];if(!e)return t;let n=Jc(e),o=0;for(let r of n)r.start<o||(r.start>o&&fR(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&&fR(t,e.slice(o)),t}function CC(e,t,n){return!e||t>=n?!1:rq(e,(o,r)=>{let a=r+o.start,s=r+o.end,i=a-1,l=s;return!!(i>=0&&/\s/.test(e[i]??"")&&uR(t,n,i)||l<e.length&&/\s/.test(e[l]??"")&&uR(t,n,l))})}function ba(e,t=[]){if(!e)return[];let n=[],o=0;return pR(e,r=>r.type==="text"?(n.push(...aq(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function gR(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var mR=e=>e.type!=="text";function xC(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function sq(e){return e===" "||e===`
3789
+ `||e===" "||e==="\r"||e===ta}function iq(e,t){let n=t-1;for(;n>=0&&!sq(e[n]??"");)n-=1;return n+1}function Ro(e,t){let n=xC(e,t),o=ba(e);if(o.length===0)return n;let r=n,a=0;for(let s of o){if(s.type==="mention"){let l=s.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(s.type==="skill"){let l=s.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function hR(e){return e.type==="text"?e.text.length:1}function vR(e,t){let n=e.reduce((o,r)=>o+hR(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function Xo(e,t){return vR(ba(e),t)}function lo(e,t){let n=xC(e,t),o=ba(e);if(o.length===0)return n;let r=n,a=0;for(let s of o){if(s.type==="mention"){let l=s.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(s.type==="skill"){let l=s.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function Zc(e,t,n){let o=ba(e);if(!o.some(mR))return!1;let r=vR(o,t),a=0;for(let s of o){if(mR(s)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=hR(s)}return!1}function xo(e,t){let n=xC(e,t),o=e.lastIndexOf(`
3790
+ `,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let i=/^\/(\S*)$/.exec(r);if(i)return{kind:"slash-command",query:i[1]??"",rangeStart:o,rangeEnd:n}}let a=iq(e,n),s=e.slice(a,n);return s.startsWith("$")?{kind:"skill",query:s.slice(1),rangeStart:a,rangeEnd:n}:s.startsWith("@")?{kind:"path",query:s.slice(1),rangeStart:a,rangeEnd:n}:null}function yR(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}}function CR(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function xR(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function bR(e){let t=0;return e.getEditorState().read(()=>{let n=Oe();ke(n)&&!n.isCollapsed()&&(t=n.getTextContent().length)}),t}function SR(e){e.update(()=>{let t=Oe();ke(t)&&!t.isCollapsed()&&t.removeText()})}function ql(e){return/mac|iphone|ipad|ipod/i.test(e)}function Pi(){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)}`}var IR="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",wR=`${IR} border border-border/70 bg-accent/40 text-foreground`,lq=`${wR} text-[12px]`,zr=`${wR} text-[0.86em] select-none`,Sa="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-['']",Yo="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",TR="truncate leading-tight",Jo="block self-center truncate leading-tight select-none",PR=`${IR} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,kR='<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>',km="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 bC(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function LR(e){let t=bC(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}le();le();var AR=yt(null),Lm=AR.Provider;function Et(){let e=Ot(AR);if(e===null)throw new Error("Composer API has not been provided.");return e}var Am=ye(function(t){let n=Et().pierreIcons,o=n.useSpriteReady();fd(n.ensureSprite,[n]);let r=V(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:K("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(qa,{className:K("size-4 shrink-0 text-icon-muted",t.className)}):u(Id,{className:K("size-4 shrink-0 text-icon-muted",t.className)})});var RR=zr;function ER(e){return S(Ie,{children:[u(Am,{pathValue:e.path,kind:LR(e.path),theme:e.theme,className:Yo}),u("span",{className:e.selectable?TR:Jo,children:e.label})]})}function Rm(e){return u("span",{className:RR,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(ER,{path:e.path,label:bC(e.path),theme:e.theme})})}function Em(e){return S("span",{className:PR,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:Yo,dangerouslySetInnerHTML:{__html:kR}}),u("span",{className:Jo,children:e.label})]})}function MR(e){let{label:t,tooltipText:n,expired:o=!1}=e;return S(Qe,{children:[u(Ye,{render:S("span",{className:K(zr,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(wo,{className:K(Yo,"size-icon-1",o&&"opacity-100")}),u("span",{className:Jo,children:t})]})}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function NR({context:e}){let{t}=pe(),n=cR(e,t),o=dR(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(MR,{label:n,tooltipText:r,expired:o})}function dq(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 cq(e){return e.replaceAll("\\","/")}function Zo(e){let t=e.displayName?.trim();return t||dq(e.name)}function SC(e){return e.enabled&&e.userInvocable!==!1}function _R(e,t){return t?e.filter(SC):[]}function DR(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function OR(e){let t=cq(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"}}le();function uq(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var Is=class e extends hr{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return eu(t.quote,t.source).updateFromJSON(t)}constructor(t,n,o){super(o),this.__quote=t,this.__source=n}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}createDOM(){let t=document.createElement("span");return t.className=Sa,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(fq,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function eu(e,t){return Nl(new Is(e,t))}function fq(e){let{t}=pe(),[n]=an(),o=ia(),r=o?.data.assistantQuotes??null,[a,s]=Q(!1),[i,l]=Q(e.quote.comment??""),[d,c]=Ft(hf,o?.threadKey??"",null);q(()=>{d===null||d!==e.source||(c(null),l(e.quote.comment??""),s(!0))},[d,e.quote.comment,e.source,c]);let f=uq(e.quote),p=()=>{if(s(!1),r===null)return;let m=r.withComment(e.quote,i),g=r.serialize(m);g!==null&&n.update(()=>{let h=Dl(e.nodeKey);h instanceof Is&&h.replace(eu(m,g))})};return S(Qa,{open:a,onOpenChange:m=>{m&&l(e.quote.comment??""),s(m)},children:[u(Ya,{render:S("span",{className:zr,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:f}),children:[u(ra,{"aria-hidden":"true",className:Yo}),u("span",{className:Jo,children:f})]})}),u(Xa,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:S("div",{className:"flex flex-col gap-2",children:[u("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),u(Gb,{value:i,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),p())}}),S("div",{className:"flex justify-end gap-2",children:[u(ce,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:t("composer.cancel")}),u(ce,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})}function FR(e,t){return e.registerCommand(em,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=t.readQuotes?.()??null,a=r?.collect(o)??[],s=Jc(`${o}
3791
+ `).filter(m=>m.type==="mention"&&m.end<=o.length&&!a.some(g=>m.start<g.end&&g.start<m.end));if(s.length===0&&a.length===0)return!1;let i=[...s.map(m=>({start:m.start,end:m.end,isMention:!0,create:()=>t.createMentionNode(m.value,m.source)})),...a.map(m=>({start:m.start,end:m.end,isMention:!1,create:()=>r.createNode(m)}))].sort((m,g)=>m.start-g.start),l=Oe();if(!ke(l))return!1;let d=[],c=m=>{let g=m.split(`
3792
+ `);for(let h=0;h<g.length;h+=1){let v=g[h]??"";v.length>0&&d.push(mr(v)),h<g.length-1&&d.push(vi())}},f=i[0];if(f?.isMention&&f.start===0){let m=l.isBackward()?l.focus:l.anchor,g=t.getExpandedAbsoluteOffsetForPoint(m.getNode(),m.offset),h=Lt().getTextContent().slice(g-1,g);h.length>0&&!/\s/.test(h)&&d.push(mr(" "))}let p=0;for(let m of i)m.start<p||(m.start>p&&c(o.slice(p,m.start)),d.push(m.create()),p=m.end);return p<o.length?c(o.slice(p)):i.at(-1)?.isMention&&d.push(mr(" ")),l.insertNodes(d),n.preventDefault(),!0},Qo)}var Vl=new Map,pq=32;function BR(e,t){for(Vl.delete(e),Vl.set(e,t);Vl.size>pq;){let n=Vl.keys().next().value;if(n===void 0)break;Vl.delete(n)}}function mq(e){return{anchor:e.length,focus:e.length}}function Ia(e,t,n){let o=Vl.get(e);if(o)return BR(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:mq(t),history:MA()};return BR(e,r),r}function Wl(e,t,n){let o=Ia(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function UR(e,t,n,o){let r=Ia(e,t);r.cursor=n,r.expandedCursor=o}function zR(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 gq=`composer-editor-${Math.random().toString(36).slice(2)}`,hq=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],WR=new Map(hq),HR=WR.get("`")??null,GR=yt({onRemoveTerminalContext:()=>{}});function vq(e){let t=u(Rm,{path:e.path,theme:bq()});return S(Qe,{children:[u(Ye,{render:t}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var tu=class e extends hr{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return PC(t.path,t.source).updateFromJSON(t)}constructor(t,n=Ti(t),o){super(o),this.__path=t,this.__source=n}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=Sa,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(vq,{path:this.__path})}};function PC(e,t){return Nl(new tu(e,t))}function yq(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function nu(e){return new Map(e.map(t=>[t.name,{label:Zo(t),description:yq(t)}]))}function Cq(e){let t=u(Em,{label:e.skillLabel});return e.skillDescription?S(Qe,{children:[u(Ye,{render:t}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var ou=class e extends hr{__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 jR(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=Sa,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(Cq,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function jR(e,t,n){return Nl(new ou(e,t,n))}function xq(e){return u(NR,{context:e.context})}var ki=class e extends hr{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return QR(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=Sa,t}updateDOM(){return!1}getTextContent(){return ta}isInline(){return!0}decorate(){return u(xq,{context:this.__context})}};function QR(e){return Nl(new ki(e))}function wa(e){return e instanceof tu||e instanceof ou||e instanceof ki||e instanceof Is}function bq(){return document.documentElement.classList.contains("dark")?"dark":"light"}function Mm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function _m(e){return e instanceof Is?e.getTextContentSize():1}function XR(e){return e.getTextContentSize()}function Sq(e,t,n){return t+(n>0?_m(e):0)}function Iq(e,t,n){return t+(n>0?XR(e):0)}function wq(e,t){let n=e.getParent();if(!n||!We(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===_m(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=_m(e),null)}function Dm(e){return wa(e)?_m(e):it(e)?e.getTextContentSize():Fl(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+Dm(n),0):0}function wC(e){return wa(e)?XR(e):it(e)?e.getTextContentSize():Fl(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+wC(n),0):0}function ru(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),s=o.getIndexWithinParent();for(let i=0;i<s;i+=1){let l=a[i];l&&(n+=Dm(l))}o=r}if(it(e))return n+Math.min(t,e.getTextContentSize());if(wa(e))return Sq(e,n,t);if(Fl(e))return n+Math.min(t,1);if(We(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let s=0;s<a;s+=1){let i=r[s];i&&(n+=Dm(i))}return n}return n}function Om(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),s=o.getIndexWithinParent();for(let i=0;i<s;i+=1){let l=a[i];l&&(n+=wC(l))}o=r}if(it(e))return n+Math.min(t,e.getTextContentSize());if(wa(e))return Iq(e,n,t);if(Fl(e))return n+Math.min(t,1);if(We(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let s=0;s<a;s+=1){let i=r[s];i&&(n+=wC(i))}return n}return n}function Fm(e,t){if(wa(e))return wq(e,t);if(it(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(Fl(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(We(e)){let n=e.getChildren();for(let o of n){let r=Fm(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function Bm(){return Lt().getChildren().reduce((n,o)=>n+Dm(o),0)}function Li(e){let t=Lt(),n=Bm(),r={value:Math.max(0,Math.min(e,n))},a=Fm(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},s=yi();s.anchor.set(a.key,a.offset,a.type),s.focus.set(a.key,a.offset,a.type),gr(s)}function Nm(e,t){let n=Lt(),o=Bm(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),s={value:r},i={value:a},l=Fm(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=Fm(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=yi();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),gr(c)}function KR(e){if(!ke(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Om(t,e.anchor.offset),r=Om(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function $R(e){return ke(e)?e.getNodes().some(t=>wa(t)):!1}function au(e){let t=Oe();if(!ke(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=ru(n,t.anchor.offset),r=Bm();return Math.max(0,Math.min(o,r))}function qR(e){let t=Oe();if(!ke(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Om(n,t.anchor.offset),r=Lt().getTextContent().length;return Math.max(0,Math.min(o,r))}function IC(e){let t=Oe();return ke(t)?{anchor:ru(t.anchor.getNode(),t.anchor.offset),focus:ru(t.focus.getNode(),t.focus.offset)}:e}function VR(e,t){let n=t.split(`
3793
+ `);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(vi())}}function Tq(e,t,n){let o=0;for(let r of n?.collect(t)??[])VR(e,t.slice(o,r.start)),e.append(eu(r.quote,r.source)),o=r.end;VR(e,t.slice(o))}function kC(e,t,n,o){let r=Lt();r.clear();let a=jo();r.append(a);let s=ba(e,t);for(let i of s){if(i.type==="mention"){a.append(PC(i.path,i.source));continue}if(i.type==="skill"){let l=n.get(i.name);a.append(jR(i.name,l?.label??Zo({name:i.name}),l?.description??null));continue}if(i.type==="terminal-context"){i.context&&a.append(QR(i.context));continue}Tq(a,i.text,o)}}function TC(e){return e instanceof ki?[e.__context.id]:We(e)?e.getChildren().flatMap(t=>TC(t)):[]}var LC="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)]",AC="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";function Pq(){let[e]=an();return q(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let i=Oe();if(!ke(i)||!i.isCollapsed()||i.anchor.type!=="element")return!1;let l=i.anchor.getNode();return We(l)&&wa(l.getChildAtIndex(i.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let i=Oe();ke(i)&&i.insertText(a)},{discrete:!0}))},n=null,o=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),n=r});return()=>{n?.removeEventListener("beforeinput",t,!0),o()}},[e]),null}function kq(e){let[t]=an();return q(()=>{let n=(l,d)=>{if(!e.onCommandKeyDown||!d)return!1;if(l==="Enter"&&(d.isComposing||d.keyCode===229))return d.stopPropagation(),!0;let c=e.onCommandKeyDown(l,d);return c&&(d.preventDefault(),d.stopPropagation()),c},o=t.registerCommand(Bk,l=>n("ArrowDown",l),Qo),r=t.registerCommand(Uk,l=>n("ArrowUp",l),Qo),a=t.registerCommand(Jp,l=>n("Enter",l),Qo),s=t.registerCommand(Zp,l=>n("Tab",l),Qo),i=t.registerCommand(Kk,l=>n("Escape",l),Qo);return()=>{o(),r(),a(),s(),i()}},[t,e]),null}function Lq(){let[e]=an();return q(()=>{let t=e.registerCommand(Qp,o=>{let r=null;if(e.getEditorState().read(()=>{let s=Oe();if(!ke(s)||!s.isCollapsed())return;let i=au(0);if(i<=0)return;let l=Lt().getTextContent();Zc(l,i,"left")&&(r=i-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Li(a)}),!0},Qo),n=e.registerCommand(Xp,o=>{let r=null;if(e.getEditorState().read(()=>{let s=Oe();if(!ke(s)||!s.isCollapsed())return;let i=au(0),l=Bm();if(i>=l)return;let d=Lt().getTextContent();Zc(d,i,"right")&&(r=i+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Li(a)}),!0},Qo);return()=>{t(),n()}},[e]),null}function Aq(){let[e]=an();return q(()=>e.registerCommand(Hk,t=>{if(!ql(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(()=>{gr(nk(o,e))}),!0)},Qo),[e]),null}function Rq(){let[e]=an();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Oe();if(!ke(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!wa(r)||o.anchor.offset===0)return;n=ru(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Li(n)})})}),[e]),null}function Eq(){let[e]=an(),{onRemoveTerminalContext:t}=Ct(GR);return q(()=>e.registerCommand(Yp,n=>{let o=Oe();if(!ke(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=au(0),s=i=>{if(!wa(i))return!1;let l=ru(i,0);return i.remove(),i instanceof ki?(t(i.__context.id),Li(a)):Li(l),n?.preventDefault(),!0};if(s(r))return!0;if(it(r)){if(o.anchor.offset>0)return!1;if(s(r.getPreviousSibling()))return!0;let i=r.getParent();if(We(i)){let l=r.getIndexWithinParent();if(l>0&&s(i.getChildAtIndex(l-1)))return!0}return!1}if(We(r)){let i=o.anchor.offset-1;if(i>=0&&s(r.getChildAtIndex(i)))return!0}return!1},Qo),[e,t]),null}function Mq(){let[e]=an();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(ke(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof hr&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),s=e.registerCommand(Nk,()=>(n=!0,o(r()),!1),Bl),i=e.registerCommand(Sk,()=>(n=!1,o(new Set),!1),Bl);return()=>{a(),s(),i()}},[e]),null}function Nq(){let[e]=an(),t=N(null);return t.current=ia()?.data.assistantQuotes??null,q(()=>FR(e,{createMentionNode:PC,getExpandedAbsoluteOffsetForPoint:Om,readQuotes:()=>{let n=t.current;return n===null?null:{collect:o=>n.collect(o),createNode:o=>eu(o.quote,o.source)}}}),[e]),null}function _q(e){let[t]=an(),n=N(e.terminalContexts),o=N(nu(e.skills)),r=N(null);r.current=ia()?.data.assistantQuotes??null;let a=N(null),s=N(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=nu(e.skills)},[e.skills]);let i=Og(l=>{let d=WR.get(l),c=a.current;if(!d)return a.current=null,!1;let f=!1;return t.update(()=>{let p=c??(()=>{let v=Oe();if(!ke(v)||v.isCollapsed()||$R(v))return null;let y=KR(v);if(!y||y.start===y.end)return null;let C=Lt().getTextContent();return CC(C,y.start,y.end)?null:{value:C,expandedStart:y.start,expandedEnd:y.end}})();if(!p||!d)return;let m=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${l}${m}${d}${p.value.slice(p.expandedEnd)}`;kC(g,n.current,o.current,r.current);let h=lo(g,p.expandedStart);Nm(h+l.length,h+l.length+m.length),f=!0,a.current=null}),f});return q(()=>{let l=h=>{if(s.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;s.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){a.current=null,s.current=null;return}t.getEditorState().read(()=>{let v=Oe();if(!ke(v)||v.isCollapsed()){a.current=null,s.current=null;return}if($R(v)){a.current=null,s.current=null;return}let y=KR(v);if(!y||y.start===y.end){a.current=null,s.current=null;return}let C=Lt().getTextContent();if(CC(C,y.start,y.end)){a.current=null,s.current=null;return}let x={value:C,expandedStart:y.start,expandedEnd:y.end};a.current=x,s.current=null})},d=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&HR!==null&&a.current){s.current=a.current;return}if(s.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){a.current=null;return}let v=h.inputType==="insertText"?h.data:null;if(!v||v.length!==1){a.current=null;return}i(v)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},c=h=>{queueMicrotask(()=>{t.update(()=>{let v=s.current;if(!v)return;let y=Lt().getTextContent(),C=HR;if(C===null){s.current=null;return}let x=`${v.value.slice(0,v.expandedStart)}\`${v.value.slice(v.expandedEnd)}`;if(y!==x){h?.finalAttempt&&(a.current=null,s.current=null);return}let b=v.value.slice(v.expandedStart,v.expandedEnd),w=lo(y,v.expandedStart);Nm(w,w+1);let I=Oe();if(!ke(I)){a.current=null,s.current=null;return}I.insertText(`\`${b}${C}`),Nm(w+1,w+1+b.length),a.current=null,s.current=null},{tag:Ao})})},f=h=>{let v=h;(v.inputType==="insertText"||v.inputType==="insertCompositionText")&&c()},p=()=>{c({finalAttempt:!0})},m=null,g=t.registerRootListener((h,v)=>{v?.removeEventListener("keydown",l),v?.removeEventListener("beforeinput",d,!0),v?.removeEventListener("input",f),v?.removeEventListener("compositionend",p),h?.addEventListener("keydown",l),h?.addEventListener("beforeinput",d,!0),h?.addEventListener("input",f),h?.addEventListener("compositionend",p),m=h});return()=>{m&&(m.removeEventListener("keydown",l),m.removeEventListener("beforeinput",d,!0),m.removeEventListener("input",f),m.removeEventListener("compositionend",p)),g()}},[t]),null}function Dq({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let[g]=an(),h=N(c);h.current=c;let v=Xo(t,n),y=Ia(e,t,{cursor:v,expandedCursor:Ro(t,v)}),C=Xo(t,y.cursor),x=CR(o),b=N(x),w=xR(r),I=N(w),k=N(nu(r)),P=N(null);P.current=ia()?.data.assistantQuotes??null;let T=N({value:t,cursor:C,expandedCursor:y.expandedCursor,selection:y.selection,terminalContextIds:o.map(F=>F.id)}),L=N(e),A=y.history,M=N(!1),R=V(()=>({onRemoveTerminalContext:d}),[d]);xe(()=>{k.current=nu(r)},[r]),q(()=>{g.setEditable(!a)},[a,g]),xe(()=>{let F=Xo(t,n),J=T.current,O=L.current,B=O!==e,Y=b.current!==x,U=I.current!==w;if(!B&&J.value===t&&J.cursor===F&&!Y&&!U)return;if(B){let fe=J.selection;g.getEditorState().read(()=>{fe=IC(fe)}),Wl(O,J.value,{cursor:J.cursor,expandedCursor:J.expandedCursor,selection:fe})}let X=Ia(e,t),re=B?X.selection:{anchor:F,focus:F};T.current={value:t,cursor:B?X.cursor:F,expandedCursor:B?X.expandedCursor:Ro(t,F),selection:re,terminalContextIds:o.map(fe=>fe.id)},L.current=e,b.current=x,I.current=w;let G=g.getRootElement(),te=!!(G&&document.activeElement===G);if(!B&&J.value===t&&!Y&&!U&&!te)return;let oe=B?Ia(O,J.value).history:null;M.current=!0;let Z=t==="",ee=()=>g.update(()=>{let fe=B||J.value!==t||Y||U;fe&&kC(t,o,k.current,P.current),B?Nm(re.anchor,re.focus):(fe||te)&&Li(F)},{discrete:!0,tag:Z?[Ao,by,Jk]:Ao});oe?zR(oe,ee):ee(),Z&&te&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let fe=Oe();ke(fe)&&(fe.dirty=!0)},{tag:[Ao,by]})},0)),Wl(e,t,T.current),queueMicrotask(()=>{M.current=!1})},[n,e,g,w,o,x,t]);let D=E(F=>{let J=g.getRootElement();if(!J)return;let O=Xo(T.current.value,F);J.focus({preventScroll:!0}),g.update(()=>{Li(O)}),T.current={value:T.current.value,cursor:O,expandedCursor:Ro(T.current.value,O),selection:{anchor:O,focus:O},terminalContextIds:T.current.terminalContextIds},Wl(L.current,T.current.value,{cursor:T.current.cursor,expandedCursor:T.current.expandedCursor,selection:T.current.selection}),h.current(T.current.value,O,T.current.expandedCursor,!1,T.current.terminalContextIds)},[g]),H=E(()=>{let F=T.current;return g.getEditorState().read(()=>{let J=Lt().getTextContent(),O=Xo(J,T.current.cursor),B=Xo(J,au(O)),Y=Mm(J,T.current.expandedCursor),U=Mm(J,qR(Y)),X=TC(Lt()),re=IC(T.current.selection);F={value:J,cursor:B,expandedCursor:U,selection:re,terminalContextIds:X}}),T.current=F,Wl(L.current,F.value,F),F},[g]);Bo(m,()=>({focus:()=>{D(T.current.cursor)},focusAt:D,focusAtEnd:()=>{D(lo(T.current.value,T.current.value.length))},readSnapshot:H,readSelectedTextLength:()=>bR(g),removeSelectedText:()=>SR(g)}),[g,D,H]);let W=E(F=>{F.read(()=>{let J=Lt().getTextContent(),O=Xo(J,T.current.cursor),B=Xo(J,au(O)),Y=Mm(J,T.current.expandedCursor),U=Mm(J,qR(Y)),X=TC(Lt()),re=IC(T.current.selection),G=T.current;if(G.value===J&&G.cursor===B&&G.expandedCursor===U&&G.selection.anchor===re.anchor&&G.selection.focus===re.focus&&G.terminalContextIds.length===X.length&&G.terminalContextIds.every((oe,Z)=>oe===X[Z])||M.current)return;T.current={value:J,cursor:B,expandedCursor:U,selection:re,terminalContextIds:X},Wl(L.current,J,{cursor:B,expandedCursor:U,selection:re});let te=Zc(J,B,"left")||Zc(J,B,"right");h.current(J,B,U,te,X)})},[]);return u(GR,{value:R,children:S("div",{className:LC,children:[u(lR,{contentEditable:u(ZL,{className:K(AC,i),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":s,...l?{"aria-label":l}:{},placeholder:u("span",{}),onPasteCapture:p}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:s}),ErrorBoundary:eA}),u(NA,{onChange:W}),u(kq,{...f?{onCommandKeyDown:f}:{}}),u(Pq,{}),u(_q,{terminalContexts:o,skills:r}),u(Aq,{}),u(Lq,{}),u(Rq,{}),u(Eq,{}),u(Nq,{}),u(Mq,{}),u(EA,{externalHistoryState:A},e)]})})}function Oq(e){let[t]=an(),n=N(e),o=N(e),[r,a]=Q(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,xe(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),q(()=>{let i=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),i=c});return()=>{i?.removeEventListener("compositionend",l),d()}},[t]);let s=r===e.documentKey?e:n.current;return u(Dq,{...s})}function Gl({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let g=N(t),h=N(o),v=N(nu(r)),y=N(ia()?.data.assistantQuotes??null),C=V(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[tu,ou,ki,Is],editorState:()=>{kC(g.current,h.current,v.current,y.current)},onError:x=>{throw x}}),[]);return u(pL,{initialConfig:C,children:u(Oq,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:s,onRemoveTerminalContext:d,onChange:c,onPaste:p,editorRef:m,...f?{onCommandKeyDown:f}:{},...i?{className:i}:{},...l?{ariaLabel:l}:{}})},gq)}function su(e,t,n){let o=e.trim().length-t;return o<=0?null:n("composer.promptTooLong",{count:o,excess:o.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function RC(e){return e.submissionTarget==="provider-turn"?su(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function YR(e){let t=e.disabledReason??RC(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}}var Jn=new Map;function Fq(e,t,n){return`${e}\0${t}\0${n??"none"}`}function EC(e,t){Jn.delete(e),Jn.set(e,t)}function jl(e,t){if(Jn.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,Jn.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 Bq(e){if(Jn.size<=100)return;let t=Array.from(Jn);for(let[n,o]of t){if(Jn.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||jl(n,o)}for(let[n,o]of t){if(Jn.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||jl(n,o)}}function Um(){queueMicrotask(()=>Bq())}function JR(e,t,n,o,r=void 0){let a=n.management?.revision??null,s=Fq(e,n.intentId,a),i=Jn.get(s);if(i)return i.releaseUpload=o.releaseUpload,i.watchAuthority=r,i.state;let l={key:s,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.management?.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 Jn.set(s,d),l}function ZR(e,t){let n=Jn.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:()=>jl(e,n)})),n.committed=!0,EC(e,n),n.listeners.add(t),Um(),()=>{n.listeners.delete(t),Um()}):()=>{}}function Ai(e,t){let n=Jn.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,EC(e,n);for(let r of n.listeners)r()}}function zm(e){return Jn.get(e)?.state}function eE(e){let t=Jn.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,EC(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){jl(e,t);return}Um()}}}function Hm(e){let t=Jn.get(e);t&&jl(e,t)}function tE(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 Jn)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&jl(o,r);Um()}var Uq=[],zq=[],Hq=()=>{};function nE({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:s,onEdit:i,onClose:l}){let{t:d}=Vn(),c=JR(n,o,e,a,s),f=So(F=>ZR(c.key,F),()=>zm(c.key)??c,()=>zm(c.key)??c),{key:p,text:m,retained:g,added:h,saving:v,error:y}=f,C=N(null),[x,b]=Q(()=>m.length),w=ia()?.data.assistantQuotes??null,I=F=>su(w?w.expandForProvider(F):F,a.limits.maxInputChars,d),k=I(m),P=N(null),T=a.useUploadStatuses(),L=V(()=>g.map(F=>F.id),[g]),A=a.useAssetUrls(o,L),M=!t?.management||t.management.revision!==e.management?.revision;q(()=>{t===void 0&&(Hm(p),l())},[t,p,l]);let R=()=>{v||(Hm(p),l())},D=F=>{if(v||r||M)return;let J=null,O=[...h];for(let B of F){let Y=B.type||"application/octet-stream";if(B.size===0){J=d("attachments.empty",{name:B.name});continue}let U=a.makeImageAttachment({id:a.randomUUID(),name:B.name,mimeType:Y,sizeBytes:B.size,file:B});O.push(U),a.startUpload({environmentId:o,image:U})}Ai(p,B=>({...B,added:O,error:J}))},H=async()=>{let F=zm(p);if(!F||F.saving||r||M||!F.text.trim()&&F.retained.length+F.added.length===0||I(F.text)!==null)return;let J=eE(p);if(J!==null){Ai(p,O=>({...O,saving:!0,error:null}));try{await a.awaitUploads(F.added.map(B=>B.id));let O=a.getUploadedAttachments({environmentId:o,images:F.added});if(!O)throw new Error(d("turnQueue.uploadFailed"));await i(e,{text:F.text,attachments:[...F.retained,...O]}),Hm(p),l()}catch(O){Ai(p,B=>({...B,saving:!1,error:O instanceof Error?O.message:d("turnQueue.actionFailed")}))}finally{J()}}},W=[...g.map((F,J)=>({...F,previewUrl:A[J],added:!1})),...h.map(F=>({...F,added:!0}))];return u(ef,{open:!0,onOpenChange:F=>{F||R()},children:S(rf,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(C.current?.focusAtEnd(),!1),children:[S(of,{children:[u(af,{children:d("turnQueue.editTitle")}),u(tf,{children:d("turnQueue.editDescription")})]}),S("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:F=>{F.dataTransfer.types.includes("Files")&&F.preventDefault()},onDrop:F=>{F.dataTransfer.files.length&&(F.preventDefault(),F.stopPropagation(),D(Array.from(F.dataTransfer.files)))},children:[u("div",{className:"rounded-lg border border-input bg-background px-3 py-2 focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/24",children:u(Gl,{editorRef:C,documentKey:`queue-editor\0${p}`,value:m,cursor:x,terminalContexts:Uq,skills:zq,disabled:v,placeholder:d("turnQueue.editText"),ariaLabel:d("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:Hq,onChange:(F,J)=>{b(J),Ai(p,O=>({...O,text:F}))},onCommandKeyDown:(F,J)=>F!=="Enter"||!(J.metaKey||J.ctrlKey)?!1:(H(),!0),onPaste:F=>{F.clipboardData.files.length&&(F.preventDefault(),D(Array.from(F.clipboardData.files)))}})}),k?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:k}):null,u("ul",{className:"flex flex-wrap gap-2",children:W.map(F=>S("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[F.type==="image"&&F.previewUrl?u("img",{src:F.previewUrl,alt:F.name,className:"size-12 rounded object-cover"}):u(no,{className:"size-4 shrink-0"}),S("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:F.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(F.sizeBytes)}),F.added&&T.get(F.id)!=="ready"?u("p",{children:d(T.get(F.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,F.added&&T.get(F.id)==="failed"?u(ce,{size:"xs",variant:"ghost",disabled:v||r||M,onClick:()=>{let J=h.find(O=>O.id===F.id);J&&a.retryUpload({environmentId:o,image:J})},children:d("turnQueue.retryUpload")}):null]}),u(ce,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:F.name}),disabled:v||M,onClick:()=>{F.added?(a.releaseUpload(F.id),F.previewUrl&&URL.revokeObjectURL(F.previewUrl),Ai(p,J=>({...J,added:J.added.filter(O=>O.id!==F.id)}))):Ai(p,J=>({...J,retained:J.retained.filter(O=>O.id!==F.id)}))},children:u(Xt,{className:"size-3.5"})})]},F.id))}),u("input",{ref:P,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:F=>{D(Array.from(F.target.files??[])),F.target.value=""}}),S(ce,{size:"sm",variant:"outline",disabled:v||r||M,onClick:()=>P.current?.click(),children:[u(no,{className:"size-4"}),d("turnQueue.addAttachments")]}),M?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,y?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:y}):null]}),S(nf,{children:[u(ce,{variant:"ghost",disabled:v,onClick:R,children:d("turnQueue.discardEdit")}),u(ce,{disabled:v||r||M||k!==null||!m.trim()&&W.length===0,onClick:()=>{H()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function oE(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 rE(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return oE(e,o).every((a,s)=>a.intentId===e[s]?.intentId)?null:o}function aE(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:oE(e,t),settled:!1}}le();le();function Kq({entry:e,unavailable:t,onCancel:n}){let{t:o}=Vn(),r=N(!1),[a,s]=Q(!1),[i,l]=Q(!1),[d,c]=Q(!1);q(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,s(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,s(!1)}}};return S("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"?S("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),S("div",{className:"flex flex-wrap gap-2",children:[u(ce,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ce,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ce,{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,i?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function sE({entries:e,unavailable:t,onCancel:n}){let{t:o}=Vn(),[r,a]=Q(!1),s=kr();return e.length===0?null:S("div",{className:"min-w-0 basis-full space-y-2",children:[u(ce,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":s,onClick:()=>a(i=>!i),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:s,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(i=>u(Kq,{entry:i,unavailable:t,onCancel:n},i.intentId))}):null]})}function MC({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=Vn(),s=N(!1),[i,l]=Q(!1),[d,c]=Q(!1),f=N(!1),[p,m]=Q(!1),[g,h]=Q(!1),[v,y]=Q(null);q(()=>{e.paused||c(!1)},[e.paused]);let C=o?.[0];q(()=>{m(!1),y(null)},[C?.intentId,C?.status,C?.deliveryCertainty]);let x=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!x)return null;let b=r!==void 0&&C?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),w=async()=>{if(f.current||t||r===void 0||C===void 0)return;let T=C;f.current=!0,h(!0),y(null);try{await r(T),m(!1)}catch{y(T.intentId)}finally{f.current=!1,h(!1)}},I=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),k=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),P=async()=>{if(!(s.current||t||!e.paused)){s.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{s.current=!1,l(!1)}}};return S("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:[S("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[S("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:I}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:k}),e.paused&&x?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===C?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ce,{size:"xs",variant:"outline",disabled:i,softDisabled:t,onClick:()=>{P()},children:a(i?"turnQueue.resuming":"turnQueue.resume")}):null,b?S(Ie,{children:[u(ce,{size:"xs",variant:"outline",disabled:g,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(Gu,{open:p,onOpenChange:T=>{T||m(!1)},children:S(Ju,{className:"max-w-lg",children:[S(Yu,{children:[u(Zu,{children:a("turnQueue.stopWaiting")}),u(Qu,{children:a("turnQueue.abandonDescription")})]}),S(Xu,{children:[u(ju,{render:u(ce,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ce,{variant:"outline",disabled:g||t,onClick:()=>{w()},children:a(g?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(sE,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var $q=[b0,x0],qq=[];function Vq({submission:e}){let{t}=Vn();return S("li",{"data-queue-pending-message":e.messageId,className:"flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",children:[u("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:u("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),S("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:dh(e.text)||t("turnQueue.attachmentsOnly")}),e.attachmentNames.length?S("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(no,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),u("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:t("primaryActions.sendingButtonLabel")})]})}function Wq({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:s}){let{t:i}=Vn(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:g}=v0({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return S("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":g||void 0,"data-queue-feedback":r,style:{transform:ss.Transform.toString(p),transition:m},className:K("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",g&&"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:K("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(ce,{ref:f,size:"icon-xs",variant:"ghost",className:K("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(g||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":i("turnQueue.reorderMessage"),title:i("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(qn,{className:"size-3.5"}):u(kd,{className:"size-3.5"})}),s,g&&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 iE({inputKey:e,entries:t,pendingSubmissions:n=qq,environmentId:o,unavailable:r,attachments:a,actions:s,onCancel:i}){let{t:l}=Vn(),d=Yf("(prefers-reduced-motion: reduce)"),[c,f]=Ft("turn-queue:editing",e,null),[p,m]=Ft("turn-queue:pending",e,!1),g=xt("turn-queue:pending-ref",e,!1),[h,v]=Ft("turn-queue:error",e,null),[y,C]=Ft("turn-queue:drag",e,null),[x,b]=Ft("turn-queue:move",e,null),w=xt("turn-queue:reorder-ref",e,!1),[I,k]=Ft("turn-queue:feedback",e,null),P=$w(_h(ul,{activationConstraint:{distance:5}}),_h(cl,{coordinateGetter:y0,scrollBehavior:d?"auto":"smooth"})),T=V(()=>t.filter(O=>O.waiting),[t]),L=x?aE(T,x.preview):null,A=L?.entries??T,M=A.length+n.length,R=r||p||x!==null,D=A.findIndex(O=>O.intentId===y?.activeId),H=A.findIndex(O=>O.intentId===y?.overId);q(()=>{tE(e,t)},[t,e]),q(()=>{x!==null&&(r||x.acknowledged&&L?.settled)&&(w.current=!1,b(null),!r&&T.some(O=>O.intentId===x.preview.intentId)&&k({intentId:x.preview.intentId,kind:"saved"}))},[T,x,L?.settled,r]),q(()=>{if(I===null||I.kind==="failed")return;let O=window.setTimeout(()=>k(B=>B===I?null:B),1600);return()=>window.clearTimeout(O)},[I]);let W=async O=>{if(!(g.current||w.current||r)){g.current=!0,m(!0),v(null),k(null);try{await O()}catch(B){v(B instanceof Error?B.message:l("turnQueue.actionFailed"))}finally{g.current=!1,m(!1)}}},F=(O,B)=>W(async()=>{let Y=rE(T,O.intentId,B);if(!(Y===null||!O.management?.canReorder)){w.current=!0,b({preview:Y,acknowledged:!1});try{await s.onReorder(O,B),b(U=>U?.preview===Y?{...U,acknowledged:!0}:U)}catch(U){throw w.current=!1,b(null),k({intentId:O.intentId,kind:"failed"}),U}}}),J=r?l("turnQueue.disconnected"):x!==null?l("turnQueue.saving"):y!==null?`${l("turnQueue.dragStarted")} ${H+1}/${A.length}`:I?.kind==="saved"?l("common.action.done"):I?.kind==="cancelled"?l("turnQueue.dragCancelled"):"";return S(Ie,{children:[M>0?S("section",{"aria-label":l("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:[S("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:l("turnQueue.queued",{count:M})}),u("span",{role:"status","aria-live":y===null?"polite":"off","data-queue-reorder-status":x?"saving":I?.kind,className:K("min-w-0 truncate",I?.kind==="saved"&&"text-primary"),children:J})]}),u(s0,{sensors:P,collisionDetection:Ww,modifiers:$q,accessibility:{screenReaderInstructions:{draggable:l("turnQueue.dragInstructions")},announcements:{onDragStart:()=>l("turnQueue.dragStarted"),onDragOver:({over:O})=>{let B=A.findIndex(Y=>Y.intentId===O?.id);return B<0?void 0:`${l("turnQueue.dragStarted")} ${B+1}/${A.length}`},onDragEnd:()=>l("turnQueue.dragFinished"),onDragCancel:()=>l("turnQueue.dragCancelled")}},onDragStart:({active:O})=>{let B=A.find(Y=>Y.intentId===O.id);!B?.management?.canReorder||R||(v(null),k(null),C({activeId:B.intentId,overId:B.intentId}))},onDragOver:({over:O})=>{let B=A.find(Y=>Y.intentId===O?.id);B&&C(Y=>Y&&{...Y,overId:B.intentId})},onDragCancel:()=>{y&&k({intentId:y.activeId,kind:"cancelled"}),C(null)},onDragEnd:({active:O,over:B})=>{if(C(null),!B||O.id===B.id)return;let Y=A.findIndex(G=>G.intentId===O.id),U=A.findIndex(G=>G.intentId===B.id),X=A[Y];if(!X?.management?.canReorder||U<0)return;let re=A[U+(Y<U?1:0)]?.intentId??null;F(X,re)},children:u(g0,{items:A.map(O=>O.intentId),strategy:f0,children:S("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[A.map((O,B)=>S(Wq,{entry:O,disabled:!O.management?.canReorder||R,reducedMotion:d,feedback:I?.intentId===O.intentId?I.kind:void 0,dropPosition:O.intentId===y?.overId&&D!==H?D<H?"after":"before":void 0,dragPosition:O.intentId===y?.activeId?`${H+1}/${A.length}`:void 0,children:[S("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:dh(O.text??"")||l("turnQueue.attachmentsOnly")}),O.attachmentNames.length?S("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(no,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:O.attachmentNames.join(", ")})]}):null,O.pendingAction?u("p",{className:"text-muted-foreground",children:l(O.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,O.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:O.failure}):null]}),S("div",{className:K("flex shrink-0 items-center gap-0.5",O.intentId===y?.activeId&&"invisible"),children:[u(ce,{size:"icon-xs",variant:"ghost",disabled:!O.management||R||y!==null,"aria-label":l("turnQueue.editMessage"),title:l("turnQueue.editMessage"),onClick:()=>f(O),children:u(Dd,{className:"size-3.5"})}),O.management?.canSteer?u(ce,{size:"icon-xs",variant:"ghost",disabled:R||y!==null,"aria-label":l("turnQueue.steer"),title:l("turnQueue.steerDescription"),onClick:()=>{W(()=>s.onRun(O,"steer"))},children:u(Od,{className:"size-3.5"})}):null,S(go,{children:[u(vo,{render:u(ce,{size:"icon-xs",variant:"ghost",disabled:R||!O.management||y!==null,"aria-label":l("turnQueue.messageActions")}),children:u(zo,{className:"size-4"})}),S(ho,{align:"end",children:[S(Ho,{disabled:!O.management?.canReorder||B===0,onClick:()=>{F(O,A[B-1].intentId)},children:[u(vd,{className:"size-4"}),l("turnQueue.moveUp")]}),S(Ho,{disabled:!O.management?.canReorder||B===A.length-1,onClick:()=>{F(O,A[B+2]?.intentId??null)},children:[u(gd,{className:"size-4"}),l("turnQueue.moveDown")]}),O.management?.canSteer?u(Ho,{onClick:()=>{W(()=>s.onRun(O,"steer"))},children:l("turnQueue.steer")}):null,u(Ho,{disabled:!O.management?.canRun,onClick:()=>{W(()=>s.onRun(O,"interrupt"))},children:l(O.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(aa,{}),u(Ho,{disabled:O.action!=="cancel",onClick:()=>{W(()=>i(O))},children:l("turnQueue.cancelMessage")})]})]})]})]},O.intentId)),n.map(O=>u(Vq,{submission:O},O.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(nE,{entry:c,current:t.find(O=>O.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:R,attachments:a,watchEditorAuthority:s.watchEditorAuthority,onEdit:s.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function lE({data:e,target:t,inputKey:n,attachments:o}){let r=e.useQueue({target:t,threadKey:n}),{environmentId:a,threadId:s}=t,i=e.queue,l=V(()=>{let c={environmentId:a,threadId:s};return{actions:{onEdit:(p,m)=>i.edit(c,p,m),onReorder:(p,m)=>i.reorder(c,p,m),onRun:(p,m)=>i.run(c,p,m),watchEditorAuthority:i.watchEditorAuthority},onCancel:p=>i.cancel(c,p),onResume:()=>i.resume(c)}},[i,a,s]),d=V(()=>({data:e,target:t,threadKey:`${n}\0queue-editor`}),[e,t,n]);return S(Ie,{children:[u(Of,{value:d,children:u(iE,{inputKey:n,actions:l.actions,attachments:o,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:a,onCancel:l.onCancel,unavailable:r.unavailable})}),u(MC,{entries:r.entries,onCancel:l.onCancel,onResume:l.onResume,queue:r.state,unavailable:r.unavailable})]})}le();function Ql(e){return e.id??e.label}function NC(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?[Ql(o)]:[]})))}var dE=ye(function(t){let n=t.data.useQuestions(t.target);return n.pending.length===0?null:u("div",{"data-async-question-stack":!0,className:"mx-auto mb-2 flex max-h-[45vh] w-full max-w-3xl flex-col gap-2 overflow-y-auto overscroll-contain",children:n.pending.toReversed().map(o=>u(jq,{pending:o,actions:n},o.requestId))})});function Gq(e,t,n){let o={};for(let r of e.questions){let a=n[r.id]?.trim()??"",s=t[r.id]??[];if(a.length>0)o[r.id]=a;else if(s.length>0)o[r.id]=r.multiSelect?s:s[0];else return null}return o}var jq=ye(function(t){let{pending:n,actions:o}=t,{t:r}=pe(),[a,s]=Q({}),[i,l]=Q({}),[d,c]=Q(!1),[f,p]=Q(null),m=Gq(n,a,i),g=y=>{c(!0),p(null),y().then(C=>{c(!1),p(C)})},h=()=>{m===null||d||g(()=>o.answer(n.requestId,m))},v=(y,C,x)=>s(b=>{let w=b[y]??[],I=w.includes(C)?w.filter(k=>k!==C):x?[...w,C]:[C];return{...b,[y]:I}});return S("section",{"data-async-question":n.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 text-sm shadow-xs",children:[S("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[u(Ga,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium",children:r("asyncQuestion.title")})]}),n.questions.map(y=>{let C=a[y.id]??[],x=i[y.id]??"";return S("div",{className:"mt-2","data-async-question-item":y.id,children:[u("p",{className:"whitespace-pre-wrap break-words text-foreground/85",children:y.question}),y.multiSelect?u("p",{className:"mt-0.5 text-xs text-secondary-label",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?u("div",{className:"mt-1.5 flex flex-wrap gap-1",children:y.options.map(b=>{let w=Ql(b),I=x.trim().length===0&&C.includes(w);return S(ce,{size:"xs",variant:I?"secondary":"outline","aria-pressed":I,disabled:d,onClick:()=>v(y.id,w,y.multiSelect===!0),children:[I?u(qn,{"aria-hidden":!0,className:"size-icon-1"}):null,b.label]},w)})}):null,u(Qi,{type:"text",value:x,disabled:d,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),className:"mt-1.5 h-8",onChange:b=>l(w=>({...w,[y.id]:b.target.value})),onKeyDown:b=>{b.key!=="Enter"||b.nativeEvent.isComposing||(b.preventDefault(),h())}})]},y.id)}),f?u("p",{role:"alert",className:"mt-1.5 text-xs text-destructive-foreground",children:f}):null,S("div",{className:K("mt-2 flex items-center justify-end gap-1"),children:[u(ce,{size:"xs",variant:"ghost",disabled:d,onClick:()=>g(()=>o.dismiss(n.requestId)),children:r("asyncQuestion.dismiss")}),u(ce,{size:"xs",disabled:d||m===null,onClick:h,children:r("asyncQuestion.answer")})]})]})});le();var _C=220,Qq={opacity:0,transform:"translate3d(0, 4rem, 0)"},Xq={opacity:0,transform:"translate3d(0, 7rem, 0)"},cE={opacity:1,transform:"none"},uE={transition:`transform ${_C}ms ease-in, opacity ${_C}ms ease-in`},Yq={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function pE({className:e,items:t}){let{t:n}=pe(),[o,r]=Q(null),a=N(null),s=o!==null&&t.some(m=>m.id===o)?o:null;if(q(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let l=t.slice(1),d=l.length>0,c=d&&s!==i.id,f=l[0],p=m=>{!m.onDismiss||s||(r(m.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m.onDismiss?.()},_C))};return u("div",{className:K("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:S("div",{className:K("relative flex flex-col-reverse",d?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[c&&f?u("div",{className:K("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)]",Yq[f.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:K("relative z-10",s===i.id?"pointer-events-none":null),style:{...uE,...s===i.id?Qq:cE},children:u(fE,{item:i,attached:!0,exiting:s===i.id,onDismissRequest:()=>p(i)})}),d?u("div",{"data-composer-banner-stack-expanded-items":"true",className:K("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:K("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:l.map(m=>u("div",{className:K(s===m.id?"pointer-events-none":null),style:{...uE,...s===m.id?Xq:cE},children:u(fE,{item:m,attached:!1,exiting:s===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function fE({item:e,attached:t,exiting:n,onDismissRequest:o}){let{t:r}=pe(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?S($d,{variant:e.variant,role:"status",className:K("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,S(jg,{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?S(qd,{className:K("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:n,onClick:o,children:u(Xt,{})}):null]}):null]}):S($d,{variant:e.variant,className:K(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(jg,{children:e.title}),e.description?u(lf,{children:e.description}):null,e.actions||e.onDismiss?S(qd,{className:K(e.actionClassName,a?"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(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:n,onClick:o,children:u(Xt,{})}):null]}):null]})}le();var mE=yt(!1),gE=mE.Provider;function hE(){return Ot(mE)}function vE({belowSlot:e,composer:t,data:n,draftHero:o,onOverlayElementChange:r,queue:a,questions:s,target:i,threadKey:l}){let d=n.useComposerBanners({target:i,threadKey:l}),c=u(pE,{className:"relative z-0",items:d.items});return S("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:[S("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:[S("div",{className:"pointer-events-auto relative z-10",children:[a,s,o.active?S("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),c]}):c,S("div",{"data-chat-composer-stack":"true",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:u(gE,{value:d.items.length>0,children:t})})}),u("div",{className:"min-h-0",children:e})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),d.overlay]})}function yE(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}function DC(e){return typeof e=="string"?e:`${e.environmentId}\0${e.threadId}`}var CE=(e,t)=>`${e}\0${DC(t)}`;le();var Jq={"start-failed":"attachments.uploadFailure.startFailed","not-connected":"attachments.uploadFailure.notConnected",rejected:"attachments.uploadFailure.rejected","timed-out":"attachments.uploadFailure.timedOut",cancelled:"attachments.uploadFailure.cancelled",failed:"attachments.uploadFailure.failed"};function Km(e,t){let n=e.code===void 0?void 0:Jq[e.code];return n===void 0?e.reason:t(n,{status:e.httpStatus??""})}function xE(e,t){let n=0,o=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?o+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(n+=1)}return o>0?t("attachments.retryOrRemoveFailed",{count:o}):n>0?t("attachments.stillUploading",{count:n}):null}function $m(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}le();function bE(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function SE(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function IE(e,t){let n=Et().pane.useVisible(),[o,r]=Q(null);xe(()=>{if(!n)return;let s=e.current;if(!s)return;let i=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!i)return;let p=f.find(v=>v.target===s);if(!p)return;let m=window.getComputedStyle(s),g=Number.parseFloat(m.paddingLeft)||0,h=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return c.observe(s),()=>{i=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,i&&r(s.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{i=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=bE(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&SE(o,{hasWideActions:t})}}le();function wE(e,t){let n=[],o=[];for(let r of e){let a=t(r);if(a.kind==="remote")return{paths:[],remote:!0,unavailableNames:[]};a.kind==="path"?n.push(a.path):o.push(r.name)}return{paths:n,remote:!1,unavailableNames:o}}function TE(e){let t=wE(e.folders,e.resolve);t.remote&&e.notifyError(e.t("attachments.folderRemote"));for(let n of t.unavailableNames)e.notifyError(e.t("attachments.folderPathUnavailable",{name:n}),e.t("attachments.folderPathUnavailableDetail"));for(let n of t.paths)e.insertText(`${Ti(n)} `)}var Zq=["image/gif","image/jpeg","image/png","image/webp"],eV=new Set(Zq);function OC(e){return eV.has(e.toLowerCase())}function tV(e){return OC(e)?"image":"file"}var nV=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function qm(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||nV.has(t)?"text":"file"}function Xl(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 FC(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return tV(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}var BC="ycodium:paste-as-text",PE=new TextEncoder;function kE(e,t){return e.key.toLowerCase()==="v"&&e.shiftKey&&!e.altKey&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)}function oV(e){return e.bypassAutoAttachment||!e.canAttach||e.text.length===0?"inline":e.wouldExceedInputLimit||e.text.length>=32768||PE.encode(e.text).byteLength>=32768?"attachment":"inline"}function rV(e){let t=new Set(e.map(n=>n.toLowerCase()));if(!t.has("pasted-text.txt"))return"pasted-text.txt";for(let n=2;;n+=1){let o=`pasted-text-${n}.txt`;if(!t.has(o))return o}}function aV(e){let t=Math.max(0,Math.min(e.valueLength,e.selectedLength));return e.valueLength-t+e.textLength>e.maxLength}function LE(e){let t=aV({valueLength:e.valueLength,selectedLength:e.selectedLength,textLength:e.text.length,maxLength:e.maxInputChars});if(oV({text:e.text,bypassAutoAttachment:e.bypassAutoAttachment,wouldExceedInputLimit:t,canAttach:!0})!=="attachment")return{kind:"inline"};let n=PE.encode(e.text).byteLength;return e.maxFileBytes!==null&&n>e.maxFileBytes?t?{kind:"reject",reason:"file-too-large"}:{kind:"inline"}:{kind:"fold",fileName:rV(e.existingNames),sizeBytes:n}}function AE(e,t,n){if(e.blocked)return!1;let{editor:o,registry:r,t:a}=e;r.documentKey!==e.documentKey&&(r.documentKey=e.documentKey,r.names.clear());for(let i of e.existingImageNames)r.names.add(i);let s=LE({text:t,bypassAutoAttachment:n,valueLength:e.promptLength,selectedLength:o?.readSelectedTextLength()??0,maxInputChars:e.maxInputChars,maxFileBytes:e.maxFileBytes,existingNames:[...r.names]});return s.kind==="inline"?!1:s.kind==="reject"?(e.notify.error(a("attachments.pastedTooLargeToAttach"),a("attachments.pastedTooLargeToAttachDetail")),!0):(r.names.add(s.fileName),o?.removeSelectedText(),e.addFoldedFile(new File([t],s.fileName,{type:"text/plain;charset=utf-8"})),e.notify.info(a("attachments.pastedAttached",{name:s.fileName}),a("attachments.pastedAttachedDetail",{size:Xl(s.sizeBytes),shortcut:ql(navigator.platform)?"\u2318\u21E7V":"Ctrl+Shift+V"})),!0)}le();var RE="application/x-ycodium-composer-mention";function UC(e){return e.includes(RE)}function EE(e){let t=n=>UC(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(RE);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function ME({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=Q(!1),a=EE({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:n}),s=i=>{if(!UC(i.dataTransfer.types))return;i.stopPropagation();let l=i.relatedTarget;l instanceof Node&&i.currentTarget.contains(l)||r(!1)};return xe(()=>{r(!1)},[e]),q(()=>{if(!o)return;let i=()=>{r(!1)};return window.addEventListener("dragend",i),()=>window.removeEventListener("dragend",i)},[o]),{isDragOverComposer:o,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:s}}le();function NE(e){let t=N(0);return q(()=>{let n=()=>{t.current=Date.now()+1e3},o=s=>{s.target instanceof Node&&e.current?.contains(s.target)&&kE(s,ql(navigator.platform))&&n()},r=()=>{t.current=0},a=()=>{let s=document.activeElement;s instanceof Node&&e.current?.contains(s)&&n()};return window.addEventListener(BC,a),window.addEventListener("keydown",o,!0),window.addEventListener("blur",r),()=>{window.removeEventListener(BC,a),window.removeEventListener("keydown",o,!0),window.removeEventListener("blur",r)}},[e]),E(()=>{let n=Date.now()<=t.current;return t.current=0,n},[])}function _E(e){let{api:t,attachments:n,t:o,addComposerImages:r,promptRef:a,promptInputRef:s,composerEditorRef:i,composerFormRef:l,composerThreadKey:d,attachmentDocumentKey:c,attachmentImagesRef:f,limits:p,supportsAttachmentUploads:m,composerDocumentKey:g,isComposerApprovalState:h,pasteBlocked:v,hasPendingUserInputs:y,projectSelectionRequired:C,environmentId:x}=e,b=NE(l),w=N({documentKey:"",names:new Set}),I=(D,H)=>AE({blocked:v,editor:i.current,documentKey:c,registry:w.current,existingImageNames:f.current.map(W=>W.name),promptLength:a.current.length,maxInputChars:p.maxInputChars,maxFileBytes:m?null:p.inlineAttachmentMaxBytes,t:o,notify:t.notify,addFoldedFile:W=>{r([W],{source:{_tag:"pasted-text"}})}},D,H),k=D=>{let H=Array.from(D.clipboardData.files);if(H.length>0){D.preventDefault(),r(H);return}let W=D.clipboardData.getData("text/plain");I(W,b())&&(D.preventDefault(),D.stopPropagation())},P=(D,H)=>{if(D.length===0||h||y||C)return!1;let W=a.current,F=(H?.ensureLeadingBoundary??!1)&&W.length>0&&!/\s$/.test(W);return s.current?.applyPromptReplacement(W.length,W.length,F?` ${D}`:D)??!1},T=xt(gf,d,null);T.current=D=>{if(h||y||C)return!1;let H=a.current,W=Math.max(0,Math.min(H.length,s.current?.readSnapshot().expandedCursor??H.length)),F=H.slice(0,W),J=H.slice(W),O=`${F.length>0&&!/\s$/.test(F)?" ":""}${D}${/^\s/.test(J)?"":" "}`;return s.current?.applyPromptReplacement(W,W,O)??!1};let{isDragOverComposer:L,composerMentionDragHandlers:A,onComposerMentionDragLeaveCapture:M}=ME({documentKey:g,insertMentionAtEnd:D=>P(D,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{t.notify.error(o("composer.unableToAddToChat"),o("composer.composerBusy"))}});return{onComposerPaste:k,insertComposerTextAtEnd:P,addDroppedFolders:D=>{TE({folders:D,resolve:H=>n.resolveDroppedFolder({environmentId:x,folder:H}),t:o,notifyError:(H,W)=>t.notify.error(H,W),insertText:H=>P(H,{ensureLeadingBoundary:!0})})},isDragOverComposer:L,composerMentionDragHandlers:A,onComposerMentionDragLeaveCapture:M}}le();function DE(e){let{api:t,t:n,limits:o,promptRef:r,promptInputRef:a,composerEditorRef:s,composerImagesRef:i,composerDraftTarget:l,setComposerDraftPrompt:d,addComposerDraftImages:c,clearComposerDraftPromptAndImages:f,setIsStashMenuOpen:p,setStashPulse:m,isComposerCollapsedMobile:g,expandMobileComposer:h,keybindings:v,terminalOpen:y,isComposerModelPickerOpen:C,hasPendingUserInputs:x,isComposerApprovalState:b,projectSelectionRequired:w,answeringQuestion:I}=e,k=N(0),P=N(null),T=N(new Set),L=t.stash.useStore,A=L(U=>U.entries),M=L(U=>U.stashEntry),R=L(U=>U.takeEntry),D=L(U=>U.finalizeEntryImages);q(()=>()=>{P.current!==null&&window.clearTimeout(P.current)},[]);let H=E(()=>{k.current+=1,m({key:k.current,active:!0}),P.current!==null&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{P.current=null,m(U=>({...U,active:!1}))},1200)},[]),W=E(U=>{let{entry:X,durable:re}=R(U.id);if(!X)return;re||t.notify.warning(n("composer.stashReappear"),n("composer.storageRejectedKeep")),p(!1);let G=r.current,te=U.prompt.length===0?G:G.trim().length?`${G.replace(/\s+$/,"")}
3843
3794
 
3844
- ${U.prompt}`:U.prompt,re=ne!==Q;if(re&&(r.current=ne,d(l,ne),a.current?.syncCursor(Vn(ne,ne.length),null)),U.attachments.length>0){let te=new Set(i.current.map(ke=>ke.id)),ue=new Set(i.current.map(ke=>`${ke.mimeType}\0${ke.sizeBytes}\0${ke.name}`)),Me=U.attachments.filter(ke=>!te.has(ke.id)&&!ue.has(`${ke.mimeType}\0${ke.sizeBytes}\0${ke.name}`)),Oe=t.draft.hydrateImagesFromPersisted(Me);Oe.length>0&&c(l,Oe)}let Z=[];U.droppedImageNames.length>0&&Z.push(n("composer.stashImagesTooLarge",{names:U.droppedImageNames.join(", ")})),U.unreadableImageNames&&U.unreadableImageNames.length>0&&Z.push(n("composer.stashImagesUnreadable",{names:U.unreadableImageNames.join(", ")})),Z.length>0&&t.notify.warning(n("composer.someImagesNotRestored"),Z.join(" ")),re&&window.requestAnimationFrame(()=>{s.current?.focusAtEnd()})},[c,l,i,r,d,n,R]),F=E(U=>{let{durable:j}=R(U.id);j||t.notify.warning(n("composer.stashEntryMayReturn"),n("composer.storageRejectedDelete"))},[n,R]),J=E(async()=>{let U=r.current.split(ta).join("").trim(),j=[...i.current];if(U.length===0&&j.length===0){p(re=>!re);return}let oe=`${String(l)}\0${U}\0${j.map(re=>re.id).join(",")}`;if(w.current.has(oe))return;w.current.add(oe);let Q=l,ne=Ri();try{let{evicted:re,written:Z,durable:te}=M({id:ne,createdAt:new Date().toISOString(),prompt:U,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:j.length});if(!Z){t.notify.error(n("composer.couldNotStash"),n("composer.storageRejectedWrite"));return}te||t.notify.warning(n("composer.stashNotSurvive"),n("composer.storageUnavailableMemory")),r.current="",f(Q);for(let X of j)t.uploads.release(X.id);a.current?.syncCursor(0,null),H(),re&&t.notify.warning(n("composer.oldestStashDiscarded"),n("composer.oldestStashDiscardedDetail",{count:t.stash.maxEntries}));let ue=[],Me=[],Oe=[];for(let X of j){let de=await t.imageCompression.compressForStash(X.file);if(!de.ok){(de.reason==="too-large"?Me:Oe).push(X.name);continue}ue.push({id:X.id,name:X.name,mimeType:de.image.mimeType,sizeBytes:de.image.sizeBytes,dataUrl:de.image.dataUrl})}let{kept:ke,droppedNames:Ee}=t.stash.partitionAttachments(ue),{attached:ee,durable:Se}=D(ne,{attachments:ke,droppedImageNames:[...Me,...Ee],unreadableImageNames:Oe});ee?!Se&&te&&j.length>0&&t.notify.warning(n("composer.stashImagesNotSaved"),n("composer.stashImagesMissingOnReload")):ke.length>0&&t.notify.warning(n("composer.stashImagesDidNotAttach"),n("composer.stashImagesDidNotAttachDetail",{count:ke.length}))}finally{w.current.delete(oe)}},[f,l,i,D,r,H,M,n]),O=E(()=>{p(U=>!U)},[]),B=E(()=>{if(g){h(),p(!0);return}O()},[h,g,O]),Y=E(()=>{p(!1)},[]);return t.pane.useKeydown(U=>{if(t.keybindings.resolveShortcutCommand(U,v,{context:{terminalFocus:t.terminalFocus.getOwner()!==null,terminalOpen:y,modelPickerOpen:C}})==="composer.stash"&&(U.preventDefault(),U.stopPropagation(),!t.commandPalette.isOpen())){if(x&&!b){p(oe=>!oe);return}b||T||I||J()}},{capture:!0}),{stashQueue:A,restoreStashEntry:W,deleteStashEntry:F,toggleStashMenu:O,toggleInlineStashMenu:B,closeStashMenu:Y}}ie();function BE(e,t,n){return{...BC({id:Ri(),name:t.name||e.t("attachments.defaultFileName"),mimeType:t.type||"application/octet-stream",sizeBytes:t.size,...n?{source:n}:{}}),previewUrl:URL.createObjectURL(t),file:t}}async function UE(e,t,n){let{t:o,supportsAttachmentUploads:r,inlineAttachmentMaxBytes:a}=e;if(!e.activeThreadId||t.length===0)return;if(e.answerQuestionsFirst){e.notifyError(o("attachments.answerQuestionsFirst"));return}let s=e.activeThreadId,i=e.attachmentDocumentKey,l=e.pendingCompressions,d=l.get(i)??0,c=[],f=null;for(let p of t){if(p.size<=0){f=o("attachments.empty",{name:p.name});continue}c.push(p)}if(e.setThreadError(s,f),c.length!==0){l.set(i,d+c.length);try{let p=[],m=null;for(let g of c){if(!(e.imageCompression.isHeicFile(g)||FC(g.type))){if(!r&&g.size>a){m=o("attachments.tooLarge",{name:g.name,limit:Jl(a)});continue}p.push(BE(e,g,n?.source));continue}let v=await e.imageCompression.prepareForAttachment(g,r?Number.POSITIVE_INFINITY:a);if(!v.ok){if(r){p.push(BE(e,g));continue}m=v.reason==="unreadable"?o("attachments.unreadableImage",{name:g.name}):o("attachments.imageTooLarge",{name:g.name});continue}let y=v.file;p.push({...BC({id:Ri(),name:y.name||o("attachments.defaultImageName"),mimeType:y.type,sizeBytes:y.size}),previewUrl:URL.createObjectURL(y),file:y})}p.length===1&&p[0]?e.addImage(p[0]):p.length>1&&e.addImages(p),m!==null&&e.setThreadError(s,m)}finally{let p=(l.get(i)??0)-c.length;p>0?l.set(i,p):l.delete(i)}}}function zE(e){let{api:t,t:n,limits:o,setThreadError:r,activeThreadId:a,answerQuestionsFirst:s,attachmentTarget:i,attachmentDocumentKey:l,supportsAttachmentUploads:d,pendingImageCompressionsRef:c,addComposerDraftImage:f,addComposerDraftImages:p,removeComposerDraftImage:m}=e,g=E(b=>{f(i,b)},[i,f]),h=E(b=>{p(i,b)},[i,p]),v=E(b=>{t.uploads.release(b),m(i,b)},[t.uploads,i,m]),y=(b,T)=>UE({activeThreadId:a,answerQuestionsFirst:s,notifyError:I=>t.notify.error(I),t:n,setThreadError:r,attachmentDocumentKey:l,pendingCompressions:c.current,supportsAttachmentUploads:d,inlineAttachmentMaxBytes:o.inlineAttachmentMaxBytes,imageCompression:t.imageCompression,addImage:g,addImages:h},b,T);return{addComposerImages:y,removeComposerImage:b=>{v(b)},onComposerAttachmentInputChange:b=>{let T=Array.from(b.target.files??[]);b.target.value="",T.length!==0&&y(T)}}}ie();var HE=e=>({images:e.images,nonPersistedImageIds:e.nonPersistedImageIds});function fV(e){let{supported:t,attachments:n,environmentId:o,threadId:r,requestId:a,question:s,responding:i}=e,l=s?.id,d=s?.allowFreeform;return V(()=>t&&a!==null&&l!==void 0&&d!==!1&&!i&&r?n.questionDraftTarget({environmentId:o,threadId:r,requestId:a,questionId:l}):null,[d,n,o,l,a,i,t,r])}function KE(e){let t=fV(e),n=t??e.composerDraftTarget,o=t?[e.environmentId,e.composerDraftTarget,"question",t].join("\0"):[e.environmentId,e.composerDraftTarget].join("\0");return{questionAttachmentTarget:t,attachmentTarget:n,attachmentDocumentKey:o}}ie();ie();var br=["approval-required","auto-accept-edits","auto","full-access"];var pV={"approval-required":Md,"auto-accept-edits":_r,auto:Va,"full-access":$a},mV={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Wm(){let{t:e}=fe();return E(t=>{let n=mV[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:pV[t]}},[e])}function $E(e,t){let n=br.indexOf(e);if(n===-1)return br[0];let o=(n+t+br.length)%br.length;return br[o]??br[0]}function qE(e){let{composerRef:t,sendContextRef:n,api:o,t:r,limits:a,composerData:s,refs:i,composerDraftTarget:l,activeThread:d,addComposerImages:c,addDroppedFolders:f,focusComposer:p,insertComposerTextAtEnd:m,insertComposerDraftTerminalContext:g,composerPreviewAnnotations:h,composerReviewComments:v,isComposerApprovalState:y,pendingUserInputCount:C,projectSelectionRequired:x,noProviderAvailable:b,modelState:T,handleRuntimeModeChange:I,runtimeMode:k,setIsComposerModelPickerOpen:P,setProviderInputSubmissionError:w}=e,{composerEditorRef:L,promptInputRef:A,promptRef:M,composerImagesRef:R,composerTerminalContextsRef:D,composerElementContextsRef:H,providerInputRejectedRef:W}=i,{selectedModel:F,selectedModelOptionsForDispatch:J,selectedModelSelection:O,selectedModelStatus:B,selectedNativeModeId:Y,selectedPromptEffort:U,selectedProvider:j,selectedProviderEntry:oe,selectedProviderModels:Q,selectedPluginAction:ne,pluginBlockMessage:re,composerNativeMode:Z,canSwitchNativeMode:te,handleComposerNativeModeChange:ue}=T,Me=E(()=>A.current?.readSnapshot()??{value:M.current,cursor:Vn(M.current,M.current.length),expandedCursor:M.current.length,terminalContextIds:D.current.map(ke=>ke.id)},[D,M]),Oe=()=>({prompt:M.current,images:R.current,terminalContexts:D.current,elementContexts:H.current,previewAnnotations:h,reviewComments:v,selectedPromptEffort:U,selectedModelOptionsForDispatch:J,selectedModelSelection:O,...Y?{selectedNativeModeId:Y}:{},providerAvailable:oe!==void 0,selectedProvider:j,selectedModel:F,selectedModelStatus:B,selectedProviderModels:Q,selectedPluginAction:ne});n.current=Oe,Oo(t,()=>({focusAtEnd:()=>{L.current?.focusAtEnd()},focusAt:Ee=>{L.current?.focusAt(Ee)},addDroppedFiles:Ee=>{c(Ee),p()},addDroppedFolders:Ee=>{f(Ee),p()},insertTextAtEnd:m,toggleModelPicker:()=>{P(Ee=>!Ee)},cyclePermissionMode:Ee=>{if(Z===null){I($E(k,Ee));return}let{modes:ee,current:Se}=Z;if(!te||ee.length<2)return;let X=ee.findIndex(le=>le.id===Se.id),de=ee[(X+Ee+ee.length)%ee.length];de!==void 0&&ue(de.id)},readSnapshot:Me,resetCursorState:Ee=>{A.current?.resetCursorState(Ee)},addTerminalContext:Ee=>{if(!d)return;let ee=Me(),Se=o.terminalContext.insertInlinePlaceholder(ee.value,ee.expandedCursor),X=Vn(Se.prompt,Se.cursor);g(l,Se.prompt,{id:Ri(),threadId:d.id,createdAt:new Date().toISOString(),...Ee},Se.contextIndex)&&(M.current=Se.prompt,A.current?.syncCursor(X,Yn(Se.prompt,Se.cursor)),window.requestAnimationFrame(()=>{L.current?.focusAt(X)}))},readSendIdentity:()=>({pluginActionId:ne?.id??null,prompt:M.current}),getSendContext:Oe,validateProviderInput:Ee=>{let ee=re??MC({prompt:M.current,providerInput:s.assistantQuotes.expandForProvider(Ee),submissionTarget:"provider-turn",maxInputChars:a.maxInputChars,t:r});return W.current=ee!==null,w(ee),ee===null}}),[d,c,l,g,M,R,D,H,h,v,p,y,C,x,Me,F,J,O,Y,b,U,j,Q,ne,re,s,Oe,n,a.maxInputChars,Z,te,ue,I,k,r])}ie();function VE(e){let{composerImages:t,composerImagesRef:n,composerTerminalContexts:o,composerTerminalContextsRef:r,composerElementContexts:a,composerElementContextsRef:s}=e;be(()=>{n.current=t},[t,n]),be(()=>{r.current=o},[o,r]),be(()=>{s.current=a},[a,s])}ie();var gV=['[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(",");function hV(e){return e.closest(gV)!==null}function WE(e){let{isMobileViewport:t,forceExpandedOnMobile:n,composerEditorRef:o,composerSurfaceRef:r,composerFormRef:a}=e,[s,i]=G(!1),l=t&&!n&&!s,d=N(null),c=N(null),f=N(null),p=N(!1),m=E(()=>{if(!t)return;d.current!==null&&(window.cancelAnimationFrame(d.current),d.current=null);let y=document.activeElement;y instanceof HTMLElement&&y.blur(),i(!1)},[t]),g=E(()=>{d.current!==null&&(window.cancelAnimationFrame(d.current),d.current=null),c.current!==null&&window.cancelAnimationFrame(c.current),f.current!==null&&window.cancelAnimationFrame(f.current),p.current=!0,i(!0),c.current=window.requestAnimationFrame(()=>{c.current=null,o.current?.focusAtEnd(),f.current=window.requestAnimationFrame(()=>{f.current=null,p.current=!1})})},[]),h=E(()=>{t&&(p.current||(d.current!==null&&window.cancelAnimationFrame(d.current),d.current=window.requestAnimationFrame(()=>{if(d.current=null,p.current)return;let y=r.current,C=a.current,x=document.activeElement;x instanceof Element&&hV(x)||x instanceof Node&&(y&&y.contains(x)||C&&C.contains(x))||i(!1)})))},[t]);return q(()=>()=>{d.current!==null&&window.cancelAnimationFrame(d.current),c.current!==null&&window.cancelAnimationFrame(c.current),f.current!==null&&window.cancelAnimationFrame(f.current)},[]),{isComposerCollapsedMobile:l,blurMobileComposerAfterSend:m,expandMobileComposer:g,scheduleComposerCollapseCheck:h,handleFormFocusCapture:y=>{let C=y.target;l&&C instanceof HTMLElement&&C.closest('[data-chat-composer-collapsed-controls="true"]')||(d.current!==null&&(window.cancelAnimationFrame(d.current),d.current=null),i(!0))}}}ie();function GE(e){let{t,threadId:n,setThreadError:o,promptRef:r,promptInputRef:a,respondToApproval:s,respondToDecision:i,selectUserInputOption:l,advanceUserInput:d,activePendingProgress:c,activePendingIsResponding:f,activePendingResolvedAnswers:p}=e,m=V(()=>c?{questionIndex:c.questionIndex,isLastQuestion:c.isLastQuestion,canAdvance:c.canAdvance,isResponding:f,isComplete:!!p}:null,[f,c,p]),g=E((C,x)=>{l(C,x),r.current="",a.current?.resetCursorState({cursor:0})},[r,l]),h=E(async(C,x,b)=>{try{await s(C,x,b)}catch(T){o(n,T instanceof Error?T.message:t("approval.respondFailed"))}},[n,s,o,t]),v=E((C,x)=>{i(C,x).then(b=>{b!==null&&o(n,b)})},[n,i,o]),y=E(()=>{d().then(C=>{C!==null&&o(n,C)})},[d,n,o]);return{pendingPrimaryAction:m,onSelectActivePendingUserInputOption:g,onRespondToApproval:h,onRespondToComposerDecision:v,onAdvanceActivePendingUserInput:y}}ie();function jE(e){return e.startsWith("!")}function QE(e){return e.slice(1).trim()}function XE(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function vV(){return null}function YE(){let{data:e,target:t,threadKey:n}=Ho();return(e.useShellCommand??vV)({target:t,threadKey:n})}ie();function JE({promptRef:e,maxInputChars:t,noProviderAvailable:n,isSendDisabled:o,sendDisabledReason:r,isModelSendBlocked:a,onModelSendBlocked:s,activeThreadId:i,activePendingProgress:l,composerDocumentKey:d,pendingImageCompressionsRef:c,onSend:f,onProviderInputRejectedReset:p,wasProviderInputRejected:m,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:v}){let{t:y}=fe(),[C,x]=G(null);q(()=>x(null),[d]);let b=E(I=>{x(k=>k===null?k:iu(I,t,y))},[t,y]),T=E((I,k="foreground")=>{if(n||o){I?.preventDefault();return}if(a){I?.preventDefault(),s();return}if(i&&(c.current.get(d)??0)>0){I?.preventDefault(),g();return}let P=eE({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:I,onSend:w=>(p(),f(w,k),!m())});x(P.validationMessage),P.didDispatch&&h()&&v()},[l,i,v,d,a,o,t,n,s,p,f,g,c,e,r,h,y,m]);return{composerSubmissionError:C,setComposerSubmissionError:x,revalidatePromptLength:b,submitComposer:T}}function ZE(e){let{api:t,t:n,limits:o,composerDraftTarget:r,composerDraft:a,composerDocumentKey:s,promptRef:i,promptInputRef:l,providerInputRejectedRef:d,pendingImageCompressionsRef:c,setComposerDraftPrompt:f,setModelSendBlockShown:p,onSend:m,onCompactContext:g,blurMobileComposerAfterSend:h,isMobileViewport:v,isComposerApprovalState:y,activePendingApproval:C,activePendingProgress:x,activePendingResolvedAnswers:b,pendingUserInputCount:T,activeThreadId:I,phase:k,isSendBusy:P,environmentUnavailable:w,compactDisabled:L,noProviderAvailable:A,isSendDisabled:M,sendDisabledReason:R,isModelSendBlocked:D,showPlanFollowUpPrompt:H}=e,W=YE(),F=t.draft.useThreadDraftSelector(r,te=>jE(te.prompt)),J=W!==null&&F&&!y&&x===null,O=E(()=>!v||P||M||A||w!==null||k==="running"?!1:x?x.isLastQuestion&&!!b:H||a.hasSendableContent,[x,b,a.hasSendableContent,w,v,P,M,A,k,H]),{composerSubmissionError:B,setComposerSubmissionError:Y,revalidatePromptLength:U,submitComposer:j}=JE({promptRef:i,maxInputChars:o.maxInputChars,noProviderAvailable:A,isSendDisabled:M,sendDisabledReason:R,isModelSendBlocked:D,onModelSendBlocked:()=>{p(!0)},activeThreadId:I,activePendingProgress:x,composerDocumentKey:s,pendingImageCompressionsRef:c,onSend:m,onProviderInputRejectedReset:()=>{d.current=!1},wasProviderInputRejected:()=>d.current,onStillCompressing:()=>{t.notify.info(n("composer.stillCompressing"),n("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:O,blurMobileComposerAfterSend:h}),oe=N(!1),Q=E(te=>{if(te?.preventDefault(),W===null||oe.current)return;if(W.unavailableReason!==null){Y(W.unavailableReason);return}let ue=i.current,Me=QE(ue),Oe=XE(Me);if(Oe==="empty")return;if(Oe==="multiline"){Y(n("composer.shellCommand.singleLine"));return}Y(null),oe.current=!0;let ke=r;W.run(Me).then(Ee=>{!Ee||i.current!==ue||(i.current="",f(ke,""),l.current?.syncCursor(0,null))}).finally(()=>{oe.current=!1})},[r,W,i,f,Y,n]),ne=E((te,ue)=>{if(J){Q(te);return}j(te,ue)},[Q,J,j]),re=E(()=>{if(!J)return!1;let te=i.current.slice(1);return i.current=te,f(r,te),l.current?.resetCursorState({prompt:te,cursor:te.length}),!0},[r,i,f,J]),Z=E(()=>{L||A||C!==null||T>0||k==="running"||P||!I||g()},[C,I,L,P,A,g,T,k]);return{composerSubmissionError:B,revalidatePromptLength:U,submitComposerOrShellCommand:ne,exitShellCommandMode:re,compactThreadContext:Z,hostShellCommand:W,shellCommandMode:J}}ie();ie();var Gm=Ce(function(t){let{t:n}=fe();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:K("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?S(ce,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:K("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(ji,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):S("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:K("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(ji,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});ie();function tM(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 eM({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:K("flex w-10 shrink-0 items-center gap-0.5",e),children:tM(t).map(({key:n,step:o})=>u("span",{className:K("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 jm=Ce(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:s,steps:i}){let{t:l}=fe();if(s.totalSteps<=0)return null;let d=s.completedSteps>=s.totalSteps,c=l("tasksBadge.ariaLabel",{completed:s.completedSteps,total:s.totalSteps,step:s.step});return a==="inline"?S("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[S(ce,{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($s,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(eM,{steps:i}),S("span",{className:K("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Qt,{"aria-hidden":!0,className:"size-2.5"})})]}):S("div",{className:K("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:[S("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($s,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:l("tasksBadge.label")}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:s.step}),S("span",{className:K("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]}),u(eM,{className:"w-20",steps:i})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Qt,{"aria-hidden":!0,className:"size-3"})})]})}),nM=Ce(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=fe();return S("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[S("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[S("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:s=>s.preventDefault(),children:[u($s,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),S("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:s=>s.preventDefault(),children:u(Qt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:tM(r).map(({key:s,step:i})=>S("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:K("w-3 shrink-0 text-center font-mono text-[10px]",i.status==="completed"?"text-success":i.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:i.status==="completed"?"\u2713":i.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:K("min-w-0 flex-1",i.status==="completed"?"text-muted-foreground/55":i.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:i.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:i.durationMs!==void 0?sa(i.durationMs):i.status==="inProgress"?a("tasksBadge.now"):null})]},s))})]})});function oM(e){let{activeThreadId:t,activeThread:n,activeTasksProgress:o,activeTaskSteps:r,isTasksDrawerOpen:a,setIsTasksDrawerOpen:s,dismissedTasksTurnId:i,setDismissedTasksTurnId:l,stashQueue:d,isStashMenuOpen:c,stashPulse:f,toggleInlineStashMenu:p,isComposerApprovalState:m,externalDrawerAttached:g,showComposerTopDrawer:h,isComposerCollapsedMobile:v,hasBlockingComposerTopDrawer:y}=e,C=E(()=>{s(D=>!D)},[]),x=n?.latestTurn?.turnId??null,b=x!==null&&i===x,T=b?null:o,I=b?null:r,k=E(()=>{x!==null&&l(x),s(!1)},[x]),w=d.length>0&&!m&&(g||h||a||v)?u(Gm,{count:d.length,menuOpen:c,placement:"inline",pulseKey:f.key,pulsing:f.active,onToggleMenu:p}):null,A=T!==null&&I!==null&&!a&&!y&&(g||h||v)?u(jm,{expanded:!1,onDismiss:k,onToggle:C,placement:"inline",progress:T,steps:I}):null,M=!g&&!h&&!a&&!v,R=M&&(d.length>0||T!==null&&I!==null&&T.totalSteps>0);return q(()=>{(T===null||I===null)&&s(!1)},[I,T]),q(()=>{y&&s(!1)},[y]),q(()=>{s(!1)},[t]),{toggleTasksDrawer:C,dismissTasks:k,visibleTasksProgress:T,visibleTaskSteps:I,inlineStashBadge:w,inlineTasksBadge:A,showShoulderTabs:M,hasShoulderTab:R}}ie();function rM(e){return e==="ready"}function aM(e){return e==="ready"||e==="unchecked"||e==="checking"}function sM(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 Qm(e){return e.enabled&&aM(e.readiness)}function lu(e){return e.enabled}function iM(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 lM=e=>e.enabled;function dM(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}function yV(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function CV(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${yV(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function HC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return CV(n,e.subProvider)}function Zl(e){return HC(e,{preferShortName:!0})}function cM(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?Zl(n):e.model}function uM(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}ie();var fM="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 Ro({className:e,size:t="sm",variant:n="ghost",...o}){return u(ce,{className:K(fM,e),size:t,variant:n,...o})}function Eo({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:K("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function qr(){return u(Zt,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function Xm({className:e,size:t="sm",variant:n="ghost",...o}){return u(Yb,{className:K(fM,e),icon:u(qr,{}),size:t,variant:n,...o})}function KC(e,t){if(!e)return t("composer.agentPickerLabel");let n=e.agentName?.trim(),o=e.displayName.trim();return n?!o||o===n?n:`${n} \xB7 ${o}`:o}function $C(e,t){let n=e.filter(lu),o=t.lockedProvider;if(o==null||o.length===0)return n;let r=t.lockedContinuationGroupKey;return n.filter(a=>a.driverKind===o&&(!r||a.continuationGroupKey===r))}var qC=Ce(function(t){let{t:n}=fe(),o=t.instanceEntries.filter(lu),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(c=>c.instanceId===r)??null,s=t.notChosen===!0&&r===null,i=r!==null||s?null:o.find(c=>c.instanceId===t.activeInstanceId)??null,l=t.lockedProvider!=null&&t.lockedProvider.length>0,d=r!==null||s?$C(t.instanceEntries,t):o;return S(mo,{children:[S(ho,{render:u(Ro,{"aria-label":n("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||l&&r===null||d.length===0,className:K("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[r!==null?u(hn,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):s?null:i?u(rr,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?S("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?r:KC(a,n)," \xB7 ",n("composer.agentUnavailableBadge")]}):s?u("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:n("composer.agentChoosePlaceholder")}):u("span",{className:"min-w-0 truncate",children:KC(i,n)}),u(qr,{})]}),u(go,{align:"start",children:u(ar,{value:r!==null||s?"":t.activeInstanceId,onValueChange:c=>{!c||r===null&&!s&&c===t.activeInstanceId||t.onInstanceChange(c)},children:d.map(c=>u(wo,{value:c.instanceId,children:KC(c,n)},c.instanceId))})})]})});function pM(e){return u(qC,{...e})}function Ym(e){switch(e){case"probing":return{seatKey:"modelPicker.fetchingModels",blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{seatKey:"modelPicker.chooseModel",blockKey:"composer.modelMissing",canChooseModel:!0};default:return null}}function mM(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function xV(e){return typeof e!="string"?null:e.trim()||null}function bV(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function SV(e,t){return e?.find(o=>o.id===t)?.value}function gM(e,t){let n=xV(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 IV(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?gM(e,t):gM(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function du(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(bV).map(r=>IV(r,SV(n,r.id)??r.currentValue))}function bs(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function Jm(e){if(!e)return;let t=bs(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function wV(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=bs(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function Zm(e,t){if(!t||t.length===0)return;let n=new Set(t.map(r=>r.id)),o=wV(e)?.filter(r=>n.has(r.id));return o&&o.length>0?o:void 0}function VC(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function hM(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3845
- ${n}`}ie();function eg(e,t,n){if(e!=="opencode"||t.length===0)return!1;let o=n?.trim();return o?!t.some(r=>r.slug===o):!1}function tg(e,t){if(e)return t?e:e.filter(n=>n.id!=="agent"||n.value!=="plan")}var vM={agent:"traits.savedOption.agent",effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant"};function TV(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function yM(e,t){return Object.hasOwn(vM,t)?e(vM[t]):TV(t)}function CM(e,t){return(e??[]).map(n=>typeof n.value=="boolean"?{id:n.id,label:t(n.id),type:"boolean",currentValue:n.value}:{id:n.id,label:t(n.id),type:"select",options:[{id:n.value,label:n.value}],currentValue:n.value})}var PV=`Ultrathink:
3846
- `;function kV(){let{t:e}=fe();return u(Or,{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 LV(e,t,n){return Zm(e,[...t??[],{id:n}])}function xM(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function ng(e){if(!e)return null;let t=bs(e);return typeof t=="string"?t:null}function bM(){let{t:e}=fe();return t=>yM(e,t)}var AV=e=>e;function RV(e,t,n,o,r,a,s,i,l){let d=e.getModelCapabilities(n,o,i),c=eg(t,n,o),f=c?CM(tg(a,i),l):du({caps:d,selections:a}),p=f.filter(L=>L.type==="select"),m=f.filter(L=>L.type==="boolean"),g=p[0]??null,h=p.find(L=>L.id==="contextWindow")??null,v=p.find(L=>L.id==="agent")??null,y=m.find(L=>L.id==="fastMode")??null,C=m.find(L=>L.id==="thinking")??null,x=s&&(g?.promptInjectedValues?.length??0)>0&&r!=="none",b=x&&r==="ultrathink-in-body",T=(x?"ultrathink":ng(g))??null,I=typeof C?.currentValue=="boolean"?C.currentValue:null,k=ng(h),P=ng(v),w=v?Jm(v):null;return{caps:d,descriptors:f,selectDescriptors:p,booleanDescriptors:m,primarySelectDescriptor:g,contextWindowDescriptor:h,agentDescriptor:v,fastModeDescriptor:y,thinkingDescriptor:C,effort:T,thinkingEnabled:I,contextWindow:k,ultrathinkPromptControlled:x,ultrathinkInBodyText:b,selectedAgent:P,selectedAgentLabel:w,modelIsUnavailable:c}}function WC(e){let t=RV(e.modelApi,e.provider,e.models,e.model,e.promptInjection,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled,e.labelOf??AV),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,s=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:s,hasAnyControls:n||o||r||a||s||t.modelIsUnavailable&&t.descriptors.length>0}}function GC(e){return WC(e).hasAnyControls}var jC=Ce(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:s,modelOptions:i,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=fe(),p=bM(),m=Et(),g=m.draft.useStore(L=>L.setProviderModelOptions),h=E(L=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(L);return}let A=c.threadRef??c.draftId;A&&g(A,t,L,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,g]),{descriptors:v,selectDescriptors:y,booleanDescriptors:C,primarySelectDescriptor:x,ultrathinkPromptControlled:b,ultrathinkInBodyText:T,hasAnyControls:I,modelIsUnavailable:k}=WC({modelApi:m.model,provider:t,models:o,model:r,promptInjection:a,modelOptions:i,allowPromptInjectedEffort:l,planModeEnabled:d,labelOf:p}),P=(L,A)=>{h(LV(L,i,A))},w=(L,A)=>{if(A){if(L.promptInjectedValues?.includes(A)){s(M=>M.trim().length===0?PV:hM(M,"ultrathink"));return}T&&L.id===x?.id||(b&&L.id===x?.id&&s(M=>M.replace(/^Ultrathink:\s*/i,"")),P(xM(v,L.id,A),L.id))}};return I?k?u(we,{children:v.map((L,A)=>{let M=L.type==="boolean"?f(L.currentValue===!0?"traits.on":"traits.off"):Jm(L);return M?S("div",{children:[A>0?u(aa,{}):null,S(Ji,{children:[u(eS,{children:L.label}),u("div",{className:"px-2 pb-1.5 text-ui-sm text-muted-foreground",children:M})]})]},L.id):null})}):S(we,{children:[y.map((L,A)=>{let M=b&&L.id===x?.id?"ultrathink":ng(L)??"";return S("div",{children:[A>0?u(aa,{}):null,S(Ji,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:L.label}),T&&L.id===x?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(ar,{value:M,onValueChange:R=>w(L,R),children:L.options.map(R=>u(wo,{value:R.id,hideIndicator:!0,closeOnClick:!0,disabled:T&&L.id===x?.id,children:S("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:S("span",{className:"min-w-0 truncate",children:[R.label,R.isDefault?S(we,{children:[" ",u(kV,{})]}):null]})}),R.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:R.description}):null]})},R.id))})]})]},L.id)}),C.map((L,A)=>{let M=L.currentValue===!0?"on":"off";return S("div",{children:[A>0||y.length>0?u(aa,{}):null,S(Ji,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:L.label}),u(ar,{value:M,onValueChange:R=>{P(xM(v,L.id,R==="on"),L.id)},children:["on","off"].map(R=>u(wo,{value:R,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(R==="on"?"traits.on":"traits.off")})})},R))})]})]},L.id)})]}):null});function EV(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 i=bs(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(i==="default"||i===l.id)){o=i===l.id,n=a.options.find(({id:d})=>d===i)?.label??e(o?"traits.fast":"traits.normal");continue}}let s=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")}):Jm(a);typeof s=="string"&&s.length>0&&r.push(s)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var SM=Ce(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:s,modelOptions:i,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,g]=G(!1),{t:h}=fe(),v=bM(),y=Et().model,{descriptors:C,primarySelectDescriptor:x,ultrathinkPromptControlled:b}=WC({modelApi:y,provider:t,models:o,model:r,promptInjection:a,modelOptions:i,allowPromptInjectedEffort:l,planModeEnabled:d,labelOf:v});if(!GC({modelApi:y,provider:t,models:o,model:r,promptInjection:a,modelOptions:i,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:T,showFastModeIcon:I}=EV(h,{provider:t,descriptors:C,primarySelectDescriptorId:x?.id??null,ultrathinkPromptControlled:b}),k=I?S(we,{children:[u(Eo,{icon:Ys,className:K("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:h("traits.fastModeOn")})]}):null,P=t==="codex";return S(mo,{open:m,onOpenChange:w=>{g(w)},children:[u(ho,{render:u(Ro,{variant:c??"ghost",className:K(P?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:P?S("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[k,u("span",{className:"min-w-0 truncate",children:T}),u(qr,{})]}):S(we,{children:[k,u("span",{children:T}),u(qr,{})]})}),u(go,{align:"start",children:u(jC,{provider:t,...n?{instanceId:n}:{},models:o,model:r,promptInjection:a,onPromptUpdate:s,modelOptions:i,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function IM(e){return VC(e)?VC(e.replace(/^Ultrathink:\s*/i,""))?"ultrathink-in-body":"ultrathink":"none"}function wM(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:s="none",planModeEnabled:i}=e;if(eg(n,r,o)){let g=tg(a,i);return{provider:n,promptEffort:null,modelOptionsForDispatch:g&&g.length>0?[...g]:void 0}}let l=t.getModelCapabilities(r,o,i),d=du({caps:l,selections:a}),c=d.find(g=>g.type==="select"),f=bs(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&s!=="none";return{provider:n,promptEffort:p,modelOptionsForDispatch:Zm(d,[...a??[],...i?[]:MV(r,o,t)]),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function MV(e,t,n){let o=du({caps:n.getModelCapabilities(e,t,!0),selections:void 0}).find(r=>r.type==="select"&&r.id==="agent");return o&&bs(o)==="plan"?[{id:o.id}]:[]}function TM(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:s,models:i,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!GC({modelApi:t.modelApi,provider:n,models:i,model:s,modelOptions:l,promptInjection:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:i,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:s,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f})}function PM(e){return TM(jC,e)}function kM(e){return TM(SM,e)}ie();function LM(e){let{threadId:t,isLocalDraftThread:n,selection:o,selectionsEqual:r,onChosen:a}=e,s=N(null);q(()=>{let i=s.current;s.current={threadId:t,selection:o},!(i===null||i.threadId!==t||n)&&(r(i.selection,o)||a?.(o))},[t,n,o,r,a])}ie();function AM(e){let{api:t,providerStatus:n,instanceId:o,environmentId:r,cwd:a,threadId:s}=e,i=t.providerInventory.useWorkspaceInventory({environmentId:r,instanceId:o,cwd:a,threadId:s});return V(()=>n===null||i===null?n:{...n,slashCommands:i.slashCommands,skills:i.skills},[n,i])}function RM(e){let{api:t,t:n,settings:o,composerDraft:r,composerDraftTarget:a,environmentId:s,gitCwd:i,routeKind:l,threadId:d,activeThread:c,isLocalDraftThread:f,unavailableAgentInstanceId:p,agentNotChosen:m,runtimeMode:g,lockedProvider:h,providerStatuses:v,projectId:y,activeProjectDefaultModelSelection:C,activeThreadModelSelection:x,compactDisabledReason:b,externalSendDisabledReason:T,attachmentBlockReason:I,answeringQuestion:k,setComposerDraftNativeMode:P,handleNativeModeChange:w,onProviderInstanceSelect:L,onModelSelectionChosen:A}=e,M=V(()=>iM(t.model.applyInstanceSettings(t.model.deriveInstanceEntries(v),o)),[t.model,v,o]),R=r.activeProvider??null,D=c?.session?.providerInstanceId??x?.instanceId??C?.instanceId??null,W=dM(M,R??D)??t.model.makeDriverKind("unconfigured"),F=h??W,J=V(()=>{if(!h||!c)return null;let ye=c.session?.providerInstanceId??x?.instanceId;return ye?M.find(Pe=>Pe.instanceId===ye)?.continuationGroupKey??null:null},[c,x?.instanceId,h,M]),O=V(()=>{if(p!==null)return p;let ye=[r.activeProvider,c?.session?.providerInstanceId,x?.instanceId,C?.instanceId];for(let Pe of ye){if(!Pe)continue;let at=M.find(tn=>tn.instanceId===Pe&&lM(tn));if(at){if(h&&at.driverKind!==h||J&&at.continuationGroupKey!==J)continue;return at.instanceId}}return t.model.noProviderSelection.instanceId},[C?.instanceId,c?.session?.providerInstanceId,x?.instanceId,r.activeProvider,J,h,M,p]),B=p!==null,Y=V(()=>B||m?void 0:M.find(ye=>ye.instanceId===O),[m,B,M,O]),U=Y===void 0&&!B&&!m,j=B&&$C(M,{lockedProvider:h,lockedContinuationGroupKey:J}).length===0,oe=b??(U?n("composer.compactingUnavailable"):null),Q=Y?.driverKind??F,{modelOptions:ne,selectedModel:re,selectedModelStatus:Z}=t.draft.useEffectiveModelState({threadRef:a,providers:v,selectedProvider:Q,selectedInstanceId:O,threadModelSelection:x,projectModelSelection:C,settings:o}),te=V(()=>Y?.snapshot??null,[Y]),ue=AM({api:t,providerStatus:te,instanceId:Y?.instanceId??null,environmentId:s,cwd:i,threadId:l==="server"?d:null}),Me=V(()=>Y?.models??[],[Y]),Oe=r.promptInjection,ke=V(()=>wM({provider:Q,model:re,models:Me,promptInjectionState:Oe,modelOptions:ne?.[O],planModeEnabled:o.planModeEnabled},t.model),[ne,Oe,O,re,Q,Me,o.planModeEnabled]),Ee=ke.promptEffort,ee=ke.modelOptionsForDispatch,Se=o.planModeEnabled,X=V(()=>({showInteractionModeToggle:Se&&t.model.getInteractionModeToggle(v,Q),runtimeModeSwitch:ue?.runtimeModeSwitch??"next-turn"}),[Se,v,Q,ue]),de=ue?.supportsNativeModeSwitch===!0,le=f&&de?r.nativeModeByProvider?.[O]??null:null,se=V(()=>t.model.resolveNativeMode(ue,{runtimeMode:g,nativeModeId:f?le:c?.nativeModeId??null}),[t.model,c?.nativeModeId,ue,g,f,le]),$e=le&&se?.current.id===le?le:void 0,Tt=E(ye=>{f&&P(a,O,ye),w(ye)},[f,P,a,O,w]),gt=V(()=>t.model.createSelection(O,re,ee),[t.model,O,re,ee]);LM({threadId:c?.id??null,isLocalDraftThread:f,selection:gt,selectionsEqual:t.model.selectionsEqual,onChosen:B||m?void 0:A});let Lt=E(ye=>L(ye,gt),[L,gt]),it=re,ct=V(()=>{let ye=new Map;for(let Pe of M)ye.set(Pe.instanceId,t.model.getAppModelOptionsForInstance(o,Pe,Pe.instanceId===O?it:null));return ye},[t.model,M,O,it,o]),ht=V(()=>(ct.get(O)??[]).some(Pe=>Pe.slug===it)?it:t.model.normalizeSlug(it)??it,[t.model,ct,O,it,Q]),lt=f&&h===null,pt=t.pluginComposer.useOptions(lt?s:null,y),Pt=pt.options,Ft=lt?r.selectedPluginActionKey:null,gn=V(()=>Ft===null?null:Pt.find(ye=>ye.id===Ft)??null,[Ft,Pt]),rt=Ft!==null,At=rt&&gn===null?n(pt.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,Bt=T??At??(k?null:I),en=Bt!==null,[Vt,Wt]=G(!1);q(()=>{Wt(!1)},[O]);let vn=Ym(Z),$=mM({status:Z,submissionTarget:k?"pending-user-input":"provider-turn"}),pe=Vt&&$?vn:null,ge=V(()=>cM(x,ct),[x,ct]);return{providerInstanceEntries:M,lockedContinuationGroupKey:J,selectedInstanceId:O,agentUnavailable:B,selectedProviderEntry:Y,noProviderAvailable:U,agentUnavailableNoChoice:j,resolvedCompactDisabledReason:oe,selectedProvider:Q,composerModelOptions:ne,selectedModel:re,selectedModelStatus:Z,selectedProviderStatus:ue,selectedProviderModels:Me,composerPromptInjectionState:Oe,composerProviderState:ke,selectedPromptEffort:Ee,selectedModelOptionsForDispatch:ee,planModeUiEnabled:Se,composerProviderControls:X,canSwitchNativeMode:de,composerNativeMode:se,selectedNativeModeId:$e,handleComposerNativeModeChange:Tt,selectedModelSelection:gt,onAgentInstanceChange:Lt,modelOptionsByInstance:ct,selectedModelForPickerWithCustomFallback:ht,canSelectPluginAction:lt,pluginOptions:Pt,selectedPluginAction:gn,isPluginComposer:rt,pluginBlockMessage:At,sendDisabledReason:Bt,isSendDisabled:en,setModelSendBlockShown:Wt,isModelSendBlocked:$,modelSendBlock:pe,activeThreadModelDisplayName:ge}}ie();function EM(e){let{api:t,settings:n,routeKind:o,routeThreadRef:r,draftId:a,promptRef:s,promptInputRef:i,composerDraftTarget:l,setComposerDraftPrompt:d,scheduleComposerFocus:c,answeringQuestion:f,selectedProvider:p,selectedInstanceId:m,selectedModel:g,selectedProviderModels:h,composerModelOptions:v,composerPromptInjectionState:y}=e,C=E(T=>{let I=i.current?.readDraftPrompt()??s.current,k=T(I);if(k===I){c();return}f?d(l,k):(s.current=k,d(l,k),i.current?.syncCursor(Vn(k,k.length),Yn(k,k.length))),c()},[f,l,s,c,d]),x=PM({modelApi:t.model,provider:p,instanceId:m,...o==="server"?{threadRef:r}:{},...o==="draft"&&a?{draftId:a}:{},model:g,models:h,modelOptions:v?.[m],promptInjection:y,onPromptUpdate:C,planModeEnabled:n.planModeEnabled}),b=kM({modelApi:t.model,provider:p,instanceId:m,...o==="server"?{threadRef:r}:{},...o==="draft"&&a?{draftId:a}:{},model:g,models:h,modelOptions:v?.[m],promptInjection:y,onPromptUpdate:C,planModeEnabled:n.planModeEnabled});return{providerTraitsMenuContent:x,providerTraitsPicker:b}}ie();ie();ie();function MM(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function NV(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.instanceId===t.instanceId&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function NM(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function QC(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function og(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 XC(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function _M(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=QC(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 DM(e,t){let n=[];for(let o of e){let r=_M(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,display:r,nativeLabel:o.nativeLabel,durationMs:o.windowMs,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:XC(o,t)})}return n}function OM(e){return e.filter(t=>t.kind==="rate-limit"&&_M(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function FM(e){return e.snapshot===null||e.credentialIdentity===null?null:NV(e.snapshot,e)?e.snapshot:null}function BM(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function UM(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}ie();function zM(e,t){let n=N(e),o=N(0),r=N(!1),[a,s]=G(e),[i,l]=G(null),[d,c]=G(!1);a!==e&&(s(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=E(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let g=await t();if(o.current!==p||n.current!==m)return;l(g)}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:i,refreshing:d,refresh:f}}function HM(e){let t=e===null?Number.NaN:Date.parse(e),[n,o]=G(()=>Date.now());q(()=>{let a=Date.now();if(o(a),!Number.isFinite(t)||t<=a)return;let s=setTimeout(()=>o(Date.now()),Math.min(2147483647,t-a));return()=>clearTimeout(s)},[t]);let r=Number.isFinite(t)&&t>n;return{active:r,retryAt:r?e:null}}var _V={reset:"accountUsage.redeemOutcomeReset",nothingToReset:"accountUsage.redeemOutcomeNothingToReset",noCredit:"accountUsage.redeemOutcomeNoCredit",alreadyRedeemed:"accountUsage.redeemOutcomeAlreadyRedeemed",failed:"accountUsage.redeemFailed"};function DV({instanceLabel:e,resetCredits:t,onRedeemReset:n,onResult:o,t:r}){let[a,s]=G(!1),[i,l]=G(!1),d=async()=>{s(!1),l(!0);try{o(await n())}catch{o("failed")}finally{l(!1)}};return S(we,{children:[u(ce,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":r("accountUsage.redeemAria",{instance:e}),disabled:i,onClick:()=>s(!0),children:r(i?"accountUsage.redeeming":"accountUsage.redeemAction")}),u(ju,{open:a,onOpenChange:s,children:S(Zu,{className:"max-w-lg",children:[S(Ju,{children:[u(ef,{children:r("accountUsage.redeemConfirmTitle")}),u(Xu,{children:r("accountUsage.redeemConfirmDescription",{count:t,instance:e})})]}),S(Yu,{children:[u(Qu,{render:u(ce,{variant:"ghost"}),children:r("accountUsage.redeemCancel")}),u(ce,{variant:"destructive-outline",disabled:i,onClick:()=>{d()},children:r("accountUsage.redeemConfirm")})]})]})})]})}function JC(e,t){switch(e.unit){case"days":return t("accountUsage.windowDays",{count:e.count});case"hours":return t("accountUsage.windowHours",{count:e.count});case"minutes":return t("accountUsage.windowMinutes",{count:e.count});case"seconds":return t("accountUsage.windowSeconds",{count:e.count})}}function ZC(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=og(e.durationMs);return o!==null?JC(o,t):UV(e.kind,t)}function OV(e,t){switch(e.kind){case"unlimited":return t("accountUsage.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("accountUsage.percentUsed",{value:e.amount}):t("accountUsage.percentRemaining",{value:e.amount})}}function FV(e,t){let n=OV(e.display,t);if(e.kind==="quota-window")return`${ZC(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function BV(e,t,n){let o=ZC({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:e.durationMs},t),r=og(e.durationMs);return r!==null?`${o} \xB7 ${JC(r,t)}`:e.resetsAt!==null?`${o} \xB7 ${t("accountUsage.resetsAt",{time:_i(e.resetsAt,n)})}`:o}function UV(e,t){switch(e){case"balance":return t("accountUsage.kindBalance");case"credits":return t("accountUsage.kindCredits");case"quota-window":return t("accountUsage.kindQuotaWindow");case"spend-cap":return t("accountUsage.kindSpendCap");case"rate-limit":return t("accountUsage.kindRateLimit")}}function zV(e,t){switch(e){case"account":return t("accountUsage.scopeAccount");case"org":return t("accountUsage.scopeOrg")}}var KM=new Map;function _i(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let o=KM.get(t);return o===void 0&&(o=new Intl.DateTimeFormat(t,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),KM.set(t,o)),o.format(n)}function HV(e,t,n){switch(e.outcome){case"fresh":return t("accountUsage.outcomeFresh");case"partial":return t("accountUsage.outcomePartial");case"joined-inflight":return t("accountUsage.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("accountUsage.outcomeRateLimited"):t("accountUsage.outcomeRateLimitedUntil",{time:_i(e.retryAt,n)});case"offline":return t("accountUsage.outcomeOffline");case"unsupported":return t("accountUsage.outcomeUnsupported");case"error":return t("accountUsage.outcomeError")}}function KV(e,t){switch(e){case"credential-unavailable":return t("accountUsage.unsupportedSignedOut");case"instance-disabled":return t("accountUsage.unsupportedDisabled");case"unsupported-driver":return t("accountUsage.unsupportedNoChannel");default:return t("accountUsage.unsupported")}}function $V(e,t){switch(e){case"rate-limited":return t("accountUsage.outcomeRateLimited");case"auth-rejected":return t("accountUsage.errorAuthRejected");case"unreachable":return t("accountUsage.errorUnreachable");case"response-invalid":return t("accountUsage.errorResponseInvalid");case"reader-unloaded":return t("accountUsage.errorReaderUnloaded");case"never-read":return t("accountUsage.neverRead");case"missing-credentials":return t("accountUsage.errorMissingCredentials");case"custom-endpoint":return t("accountUsage.errorCustomEndpoint");case"unsupported-login":return t("accountUsage.errorUnsupportedLogin");default:return t("accountUsage.outcomeError")}}function qV(e,t,n){return e.capability.status==="unsupported"?KV(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?$V(e.error,n):e.credentialIdentity===null||e.capability.status==="unknown"?n("accountUsage.unknown"):n("accountUsage.noData")}function YC(e,t){let n=QC(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 $M(e){let[t,n]=G(!1);return u(VV,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function VV(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=fe(),s=Et().i18n.useLanguage(),i=MM(r),{feedback:l,refreshing:d,refresh:c}=zM(i,o),[f,p]=G(null),m=f?.key===i?f.outcome:null,g=r.capability.status==="supported"&&r.credentialIdentity!==null?FM(r):null,h=g?.metrics??[],v=DM(h,r.error),y=v.some(M=>M.stale)||r.error!==null&&g!==null,C=BM(v),x=UM(h),b=HM(r.retryAt??null),T=d||b.active,I=r.error==="never-read",k=qV(r,v,a),P=NM(r),L=`${Rr()}-account-usage-details`,A=[...v.map(M=>({key:M.metricId,text:FV(M,a)})),...OM(h).map(M=>({key:`${M.metricId}\0status`,text:BV(M,a,s)})),...C===null?[]:[{key:"resets-at",text:a("accountUsage.resetsAt",{time:_i(C,s)})}]];return S("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-account-usage":"true","data-refresh-outcome":l?.outcome??"",children:[S("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ce,{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":L,"aria-label":a(t?"accountUsage.hideDetails":"accountUsage.showDetails"),onClick:n,children:S("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[S("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.instanceLabel}),y?u("span",{className:"text-ui-xs text-muted-foreground","data-composer-account-usage-stale":"true",children:a("accountUsage.stale")}):null,u(Zt,{"aria-hidden":"true",className:K("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-ui-xs tabular-nums text-secondary-label",children:A.length>0?A.map((M,R)=>S("span",{children:[R>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,M.text]},M.key)):k})]})}),P?u(ce,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("accountUsage.refreshAria",{instance:r.instanceLabel}),disabled:T,onClick:()=>{p(null),c()},children:a(d?"accountUsage.refreshing":I?"accountUsage.read":"accountUsage.refresh")}):null,r.onRedeemReset!==void 0&&(r.resetCredits??0)>0?u(DV,{instanceLabel:r.instanceLabel,resetCredits:r.resetCredits??0,onRedeemReset:r.onRedeemReset,onResult:M=>p({key:i,outcome:M}),t:a}):null]}),t?S("div",{id:L,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-account-usage-details":"true",children:[h.length===0?u("p",{className:"text-ui-xs text-secondary-label",children:k??a("accountUsage.noData")}):h.map(M=>u(WV,{metric:M,queryError:r.error,t:a,language:s},M.metricId)),x!==null?u("p",{className:"text-ui-xs text-secondary-label",children:a("accountUsage.collectedAt",{time:_i(x,s)})}):null]}):null,b.active&&b.retryAt!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground",children:a("accountUsage.outcomeRateLimitedUntil",{time:_i(b.retryAt,s)})}):m!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground","data-composer-account-usage-redeem":m,children:a(_V[m])}):l!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground",children:HV(l,a,s)}):r.error!==null&&g!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground",children:a("accountUsage.errorKeepLast")}):null]})}function WV({metric:e,queryError:t,t:n,language:o}){let r=YC(e,e.used),a=e.unlimited===!0?n("accountUsage.unlimited"):YC(e,e.remaining),s=YC(e,e.limit),i=n("accountUsage.sharedScope",{scope:zV(e.scope,n)}),l=XC(e,t),d=e.windowMs,c=og(d),f=ZC({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return S("div",{className:"text-ui-xs text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-window-ms":d===null?void 0:String(d),children:[S("div",{className:"font-medium text-foreground",children:[f,l?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("accountUsage.stale")}):null]}),S("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[r!==null?S("span",{children:[r," ",n("accountUsage.used")]}):null,a!==null?S("span",{children:[a," ",e.unlimited===!0?null:n("accountUsage.remaining")]}):null,s!==null?S("span",{children:[s," ",n("accountUsage.limit")]}):null]}),u("div",{className:"mt-0.5",children:i}),e.fetchedAt!==null?u("div",{children:n("accountUsage.collectedAt",{time:_i(e.fetchedAt,o)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:_i(e.resetsAt,o)})}):null,c!==null?u("div",{children:JC(c,n)}):null]})}var qM=Ce(function(t){let{data:n,target:o}=Ho(),r=Kb(),a=n.useAccountUsage({target:o,active:r&&!t.hidden});return t.hidden||a===void 0?null:u($M,{...a},a.queryKey)});function VM(e){switch(e){case"image":return Ks;case"pdf":return Hs;case"text":return zs;case"file":return oo}}function GV(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(`
3847
- `)}function jV({context:e,onRemove:t}){let{t:n}=fe(),o=Et().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return S(je,{children:[u(Xe,{render:S("span",{className:K($r,"pr-1"),children:[u(Nr,{className:K(Qo,"size-icon-1")}),u("span",{className:Xo,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:Lm,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(e.id)},children:u(Qt,{className:"size-3","aria-hidden":!0})})]})}),u(Qe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:GV(e,o.formatLabel,o.formatSourceLabel)})]})}function WM({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(o=>u(jV,{context:o,onRemove:t},o.id))})}function GM({comments:e,onRemove:t,className:n}){let{t:o}=fe();return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,s=S("span",{className:K($r,"pr-1"),children:[u(qs,{className:K(Qo,"size-icon-1")}),u("span",{className:Xo,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:Lm,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(r.id)},children:u(Qt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?s:S(je,{children:[u(Xe,{render:s}),u(Qe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function rg(e){let{t}=fe(),n=t(e.tooltipKey,{count:e.count});return S(je,{children:[u(Xe,{render:S("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Qe,{side:"top",children:n})]})}function jM({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:s}){let{t:i}=fe(),l=Et().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:K("flex flex-wrap gap-1.5",s),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(g=>{let h=l.normalizeSelection(g.element);return h?[{id:g.id,label:l.formatLabel(h)}]:[]});return S("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":i("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:i("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(Nr,{className:"size-icon-2"})}),S("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,S("div",{className:K("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?S("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:g,label:h})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:h},g)),m.length>2?S("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,S("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(rg,{icon:u(Nr,{className:"size-3"}),count:c.elements.length,tooltipKey:"previewAnnotation.elementCount"}):null,c.regions.length>0?u(rg,{icon:u(Td,{className:"size-3"}),count:c.regions.length,tooltipKey:"previewAnnotation.regionCount"}):null,c.strokes.length>0?u(rg,{icon:u(_r,{className:"size-3"}),count:c.strokes.length,tooltipKey:"previewAnnotation.drawingCount"}):null,c.styleChanges.length>0?u(rg,{icon:u(Ws,{className:"size-3"}),count:c.styleChanges.length,tooltipKey:"previewAnnotation.styleChangeCount"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:qm(p.progress)}):null,p?.status==="failed"&&f&&a?S(je,{children:[u(Xe,{render:u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":i("attachments.retryUpload",{name:f.name}),onClick:()=>a(f)}),children:u(js,{className:"size-3"})}),u(Qe,{side:"top",children:$m(p,i)})]}):null]})]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":i("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(Qt,{className:"size-3"})})]},c.id)})})}function ex(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 QM(e){let{t}=fe(),{api:n,environmentId:o,composerDraftTarget:r,isComposerCollapsedMobile:a,isComposerApprovalState:s,hasPendingUserInputs:i,supportsAttachmentUploads:l,uploadsByImageId:d,composerImages:c,composerPreviewableImages:f,composerPreviewAnnotations:p,composerReviewComments:m,composerElementContexts:g,nonPersistedComposerImageIdSet:h,removeComposerDraftPreviewAnnotation:v,removeComposerDraftReviewComment:y,removeComposerDraftElementContext:C,removeComposerImage:x,onExpandImage:b}=e;return S(we,{children:[!a&&!s&&!i&&p.length>0&&u(jM,{annotations:p,images:c,...l?{uploadsByImageId:d,onRetryUpload:T=>n.uploads.retry({environmentId:o,image:T})}:{},onRemove:T=>{n.uploads.release(T),v(r,T)},onExpandImage:T=>{let I=ex(f,T);I&&b(I)},className:"mb-3"}),!a&&!s&&!i&&m.length>0&&u(GM,{comments:m,onRemove:T=>y(r,T),className:"mb-3"}),!a&&!s&&!i&&g.length>0&&u(WM,{contexts:g,onRemove:T=>C(r,T),className:"mb-3"}),!a&&!s&&!i&&c.some(T=>!p.some(I=>I.id===T.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:c.filter(T=>!p.some(I=>I.id===T.id)).map(T=>{let I=l?d[T.id]:void 0,k=Vm(T),P=VM(k),w=k==="image"&&!!T.previewUrl;return S("div",{className:K("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",w?"w-16":"w-44 max-w-full"),children:[w?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":t("attachments.preview",{name:T.name}),onClick:()=>{let L=ex(f,T.id);L&&b(L)},children:u("img",{src:T.previewUrl,alt:T.name,className:"h-full w-full object-cover"})}):S("a",{href:T.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":t("attachments.open",{name:T.name}),children:[u(P,{className:"size-4 shrink-0 text-secondary-label"}),S("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:T.name}),u("span",{className:"block text-[10px] text-secondary-label",children:Jl(T.sizeBytes)})]})]}),h.has(T.id)&&S(je,{children:[u(Xe,{render:u("span",{role:"img","aria-label":t("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(hn,{className:"size-3"})})}),u(Qe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:t("attachments.draftMayNotPersistDetail")})]}),I?.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:qm(I.progress)}),I?.status==="failed"&&S(je,{children:[u(Xe,{render:u(ce,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>n.uploads.retry({environmentId:o,image:T}),"aria-label":t("attachments.retryUpload",{name:T.name})}),children:u(js,{})}),u(Qe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:$m(I,t)})]}),u(ce,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>x(T.id),"aria-label":t("attachments.remove",{name:T.name}),children:u(Qt,{})})]},T.id)})})]})}function XM(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function YM(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}function JM(e){return e.isComposerApprovalState?e.approvalDetail??e.t("composer.resolveApprovalToContinue"):e.activePendingProgress?e.t("composer.typeOwnAnswer"):e.showPlanFollowUpPrompt?e.t("composer.addFeedbackRefinePlan"):e.projectSelectionRequired?e.t("composer.chooseProjectToStart"):e.noProviderAvailable?e.t("composer.enableProviderToSend"):e.t(e.tailPlaceholderKey??"composer.askAnythingFull")}ie();ie();var ZM=Ce(function(t){let{t:n}=fe(),o=Wm();return S(mo,{children:[u(ho,{render:u(ce,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":n("composer.moreComposerControls")}),children:u(Bo,{"aria-hidden":"true",className:"size-4"})}),S(go,{align:"start",children:[t.traitsMenuContent?S(we,{children:[t.traitsMenuContent,u(aa,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?S(we,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.modeMenuTitle")}),S(ar,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(wo,{value:"default",children:n("composer.interactionModeChat")}),u(wo,{value:"plan",children:n("composer.interactionModePlan")})]}),u(aa,{})]}):null,t.nativeMode===null?S(we,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),u(ar,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:br.map(r=>u(wo,{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]}):S(we,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?S(we,{children:[u(ar,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(wo,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):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})]})]})]})});ie();ie();ie();var Cx=fd(oN(),1),UN=fd(oc(),1),zN=fd(oc(),1);Mn(function(t,n){return Ne("div",{ref:n,...t})});var mg=Mn(function(t,n){return Ne("div",{ref:n,...t})}),Jo=mg,La={OS:"web"};function Di(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function xx(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 HN(){return"normal"}function rW(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:HN()}function aW(e){var t;return(t=e?.rtl)!=null?t:!1}function Ra(e){return bx(e?.props)}function bx(e){return!!e?.horizontal&&aW(e)}function Sx(e){return e?.horizontal?(bx(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function sW(e,t){var n;return(n=xx(e,t))!=null?n:0}function rN(e,t){return t&&(Ra(e)?t.left:t.right)||0}function iW(e,t,n,o){return!Ra(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function Ix(e,t,n){if(!e||!Ra(e))return t;let o=xx(e,n),r=Di(t,o),a=rW(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Di(o-r,o):r}function lW(e,t,n){if(!Ra(e))return e.horizontalRTLScrollType=void 0,t;let o=xx(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Di(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let s=e.horizontalRTLScrollType;if(s==="inverted")return Di(a,o);if(s==="normal")return Di(r,o);if(!e.hasScrolled){let f=HN();return e.horizontalRTLScrollType=f,Di(r,o)}let i=e.scroll,l=Math.abs(r-i),c=Math.abs(a-i)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Di(c?a:r,o)}var dW=e=>e,gg=yt(null),KN="\0",cW=0;function uW({children:e}){let[t]=G(()=>({animatedScrollY:dW(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:cW++,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 Ne(gg.Provider,{value:t},e)}function Ir(){return Dt(gg)}function $N(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let s=0;s<t.length;s++){let i=Ie(e,t[s]);r.push(i),i!==o[s]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let s of t)a.push(Pa(e,s,r));return()=>{for(let s of a)s()}}}}function fW(e){return e.length===1?e[0]:e.join(KN)}function pW(e){return e.split(KN)}function Pa(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 Be(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 s of a)s(n)}}function mW(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 gW(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function No(e){let t=Dt(gg),n=fW(e),{subscribe:o,get:r}=V(()=>$N(t,pW(n)),[t,n]);return(0,Cx.useSyncExternalStore)(o,r,r)}function hW(e,t){let n=Dt(gg),{subscribe:o,get:r}=V(()=>$N(n,[e]),[n,e]),a=E(()=>t(r()[0]),[r,t]);return(0,Cx.useSyncExternalStore)(o,a,a)}function vW(e){return Math.max(0,e??0)}function Fi(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,s=r.contentInset,i=s??o.nativeContentInset,l=(a?rN(o,i):i?.bottom)||0,d=vW(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 g={bottom:0,left:0,right:0,...i,...p};return Math.max(((a?rN(o,g):g.bottom)||0)+d,f)}return Math.max(m,f)}function Zn(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,s=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,i=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=Fi(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+i+s+(c||0)}var td=({children:e})=>Ne(mg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);Ce(function(){let t=Ir(),[n=0,o=0,r=0,a=0,s=0,i=0,l=!1]=No(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=Zn(t),[,c]=ea(f=>f+1,0);return yW(()=>{c()},100),Ne(mg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Ne(td,null,Ne(Jo,null,"TotalSize:"),Ne(Jo,null,n.toFixed(2))),Ne(td,null,Ne(Jo,null,"ContentSize:"),Ne(Jo,null,d.toFixed(2))),Ne(td,null,Ne(Jo,null,"At end:"),Ne(Jo,null,String(l))),Ne(td,null,Ne(Jo,null,"ScrollAdjust:"),Ne(Jo,null,o.toFixed(2))),Ne(td,null,Ne(Jo,null,"RawScroll: "),Ne(Jo,null,r.toFixed(2))),Ne(td,null,Ne(Jo,null,"ComputedScroll: "),Ne(Jo,null,a.toFixed(2))))});function yW(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var wx=!0,qN=new WeakMap;function CW(e){return qN.get(e)}function xW(e,t){qN.set(e,t)}var bW=typeof __DEV__<"u"?__DEV__:void 0,aN,sN=typeof process<"u"&&typeof process.env=="object"&&process.env?(aN="production")!=null?aN:process.env.MODE:void 0,iN=typeof sN=="string"?sN.toLowerCase()!=="production":void 0,lN,Mo=(lN=iN??bW)!=null?lN:!1,nd=-1e7,VN=1,SW=Mo&&!1,IW=Mo&&!1;function hg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function WN(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 wW(e){hg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,WN(e)}function TW(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function PW(e,t){var n,o,r,a;let s=e.state,i=s.deferredPublicOnScrollEvent;s.deferredPublicOnScrollEvent=void 0,i&&((a=(r=s.props).onScroll)==null||a.call(r,TW(s,i,(o=(n=t??s.scrollPending)!=null?n:s.scroll)!=null?o:0)))}var nx=1;function kW(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function dN(e){e.initialScrollSession=void 0}function lx(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 ag(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=lx({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=lx({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var vg={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){ag(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){ag(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=ag(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},Wn={clear(e){Wn.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=nx},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>nx},isAtZeroTargetOffset(e){return e<=nx},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=ag(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Aa(e,t={}){var n,o,r,a;let s=e.initialScrollSession,i=(n=t.kind)!=null?n:s?.kind,l=s?.completion,d=s?.kind==="bootstrap"?s.bootstrap:void 0,c=i==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!i||!e.initialScroll&&!c&&!kW(l))return dN(e);let f=(a=(r=t.previousDataLength)!=null?r:s?.previousDataLength)!=null?a:0;return e.initialScrollSession=lx({bootstrap:c,completion:l,kind:i,previousDataLength:f}),e.initialScrollSession}var LW=1.3;function dx(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*LW||!t&&n<=0&&o>0}var GN=(e,t,n,o,r,a,s,i)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{i({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?dx(e,t,n)?(i(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(s(e),c(),!0):!1};function AW(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function jN(e){let t=e.state;if(!t.edgeReachedGate)return;let n=Zn(e),o=n-t.scroll-t.scrollLength-Fi(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,s=t.props.onEndReachedThreshold*t.scrollLength,i=dx(t.scroll,!1,a),l=dx(o,r,s);i&&l&&(t.edgeReachedGate=void 0)}function QN(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function XN(e){e.state.edgeReachedGate="closed"}function cN(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function RW(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",AW(e,o),o}function fu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function YN(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:s,scroll:i,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=Zn(e);if(jN(e),f>0&&a){let p=Fi(e),m=f-i-s-p,g=f<s;Be(e,"isAtEnd",g||m<=VN),Be(e,"isNearEnd",g||m<=c*s),Be(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*s),fu(r)||l||(r.isEndReached=GN(m,g,c*s,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:i},v=>{var y,C;QN(e,"end",t,n)&&(XN(e),(C=(y=r.props).onEndReached)==null||C.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function EW(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:s},scroll:i,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=s*l;jN(e),r&&p>0&&i>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Be(e,"isAtStart",i<=VN),Be(e,"isNearStart",i<=p),fu(o)||o.scrollingTo||(o.isStartReached=GN(i,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:i},g=>{var h,v;QN(e,"start",t,n)&&(XN(e),(v=(h=o.props).onStartReached)==null||v.call(h,{distanceFromStart:g}))},g=>{o.startReachedSnapshot=g}))}function yg(e,t){let n=!e.state.edgeReachedGate;YN(e,t,n),EW(e,t,n)}function JN(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),yg(e)}var MW=6,NW=3,_W=250;function ZN(e){e.state.scheduledWork.cancel("adaptiveRender")}function uN(e,t){let n=e.state;ZN(e),t<=0?hu(e,"normal","scroll"):n.scheduledWork.timeout(()=>hu(e,"normal","scroll"),t,"adaptiveRender")}function hu(e,t,n){var o,r;Ie(e,"adaptiveRender")!==t&&(Be(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function Tx(e){var t,n;ZN(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";Ie(e,"adaptiveRender")!==o&&hu(e,o,"initial")}function DW(e,t,n){var o,r,a;let s=e.state,i=s.props.adaptiveRender,l=Ie(e,"adaptiveRender");if(Ie(e,"readyToRender"))if(i){let d=(o=i.enterVelocity)!=null?o:MW,c=(r=i.exitVelocity)!=null?r:NW,f=(a=i.exitDelay)!=null?a:_W,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",g=s.scheduledWork.has("adaptiveRender")?"normal":l;m!==g&&(m==="light"?(hu(e,"light","scroll"),uN(e,f)):l==="light"&&uN(e,f))}else Tx(e)}var Px=50;function e_(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,Px):o}function t_(e){let{state:t}=e;t.props.drawDistance<=Px||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function kx(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Be(e,"readyToRender",!1),Tx(e)}function Lx(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")&&(Be(e,"readyToRender",!0),hu(e,"normal","ready"),o.props.drawDistance>Px&&t_(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var OW=2e3;function fN(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function n_(e){e.scheduledWork.cancel("preservedInitialScroll")}function od(e){n_(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Aa(e)}function pN(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&&(hg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),vg.resetFlags(r),Aa(r,{bootstrap:null}),rd(e))}function rd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)fN(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let i=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof i=="number"&&Number.isFinite(i)&&fN(a,i)}let s=()=>{var i,l,d,c,f;let p=((i=a.initialScrollSession)==null?void 0:i.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;Wn.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Aa(a),n_(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||od(a)},OW,"preservedInitialScroll")):od(a),t?.recalculateItems&&JN(e),Lx(e,{didInitialScroll:!0}),p&&PW(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(s);return}s()}function Cg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function FW(e){let{state:t}=e;return(t.props.horizontal?(Ra(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:Ie(e,"stylePaddingTop")||0)+(Ie(e,"alignItemsAtEndPadding")||0)+(Ie(e,"headerSize")||0)}function qt(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 BW(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 UW(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-BW(e)-Fi(e)):0}function Hi(e){let t=Ie(e,"alignItemsAtEndPadding")||0,n=UW(e);t!==n&&Be(e,"alignItemsAtEndPadding",n)}function pu(e,t,n,o=!0){let r=e.state,a=r.totalSize,s=r.totalSize;t===null?(s=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):s+=n,a!==s?(r.pendingTotalSize=void 0,r.totalSize=s,o&&Be(e,"totalSize",s),Hi(e)):o&&e.values.get("totalSize")!==s&&Be(e,"totalSize",s)}function cx(e,t,n,o=!0){let r=e.state,{sizes:a}=r,s=a.get(t),i=s!==void 0?n-s:n;i!==0&&pu(e,t,i,o),a.set(t,n)}function o_(e){return typeof e=="function"}function xg(e){return Array.isArray(e)}var mN=new Set;function Oi(e,t){Mo&&!mN.has(e)&&(mN.add(e),console.warn(`[legend-list] ${t}`))}function vu(e){return Math.floor(e*8)/8}function mu(e){return e==null}function gN(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 uu(e,t,n){return gN(e,n)+gN(t,n)}function ux(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 s=0;s<a;s++)if(Ie(e,`containerItemKey${s}`)===t)return s;return-1}function r_(e,t,n,o,r){var a,s;let i=e.state,{getFixedItemSize:l,getItemType:d}=i.props,c=t?i.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(s=r?.itemType)!=null?s:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,i.sizesKnown.set(t,c))}return c}function a_(e,t){let n=qt(e.state,t);return r_(e,n,t,e.state.props.data[t])}function zW(e,t,n){for(let o=t;o<=n;o++)if(a_(e,o)===void 0)return!1;return!0}function eo(e,t,n,o,r,a,s,i){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:g,props:{estimatedItemSize:h,getItemType:v},scrollingTo:y}=p,C=p.sizesKnown.get(t);if(C!==void 0)return C;let x,b=m.get(t);if(a&&b!==void 0)return b;if(x=r_(e,t,n,o,i),x!==void 0)return cx(e,t,x,s),x;let T=(d=i?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!y){let I=(c=g[T])==null?void 0:c.avg;I!==void 0&&(x=vu(I))}if(x===void 0&&b!==void 0)return b;if(x===void 0&&r&&y){let I=(f=y.averageSizeSnapshot)==null?void 0:f[T];I!==void 0&&(x=vu(I))}return x===void 0&&(x=h+e.scrollAxisGap),cx(e,t,x,s),x}function Ax(e,t){if(t===void 0||t<0)return;let n=qt(e.state,t);return eo(e,n,t,e.state.props.data[t])}function bg(e,t,n){var o;let r=e.state,{index:a,viewOffset:s,viewPosition:i}=n,l=t;if(s&&(l-=s),a!==void 0){let d=FW(e);d&&(l+=d)}if(i!==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:eo(e,qt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),g=Fi(e);if(l-=i*(r.scrollLength-g-m),!c&&a===r.props.data.length-1){let h=Ie(e,"footerSize")||0;l+=h}}return l}function Ss(e,t,n){let o=e.state,r=Zn(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&La.OS!=="android"){let s=Math.max(0,r-o.scrollLength),i=n?.viewOffset,l=typeof i=="number"&&i<0?-i:0,d=s+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function yu(e){var t,n;let o=e.state;if(o?.scrollingTo){hg(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&&pu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let s=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",i=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;rd(e,{onFinished:()=>{r?.()},preserveTarget:s&&o.props.data.length===0||i,recalculateItems:!0,schedulePreservedTargetClear:i,syncObservedOffset:s,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}JN(e),r?.()}}var HW=80,KW=1500,$W=320,qW=1;function VW(e,t){var n,o;let r=e.state,{animated:a,horizontal:s,offset:i}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!s,p=f?Zn(e):void 0,m=f?Ix(r,i,p):0,g=f?0:i;if(l.scrollTo({animated:c,x:m,y:g}),c){let h=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;WW(e,{readOffset:()=>l.getCurrentScrollOffset(),target:h,targetOffset:i})}else{r.scroll=i;let h=r.scrollingTo;r.scheduledWork.timeout(()=>{h===r.scrollingTo&&yu(e)},100,"platformScrollCompletion")}}function WW(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){yu(e);return}let a="onscrollend"in o,s,i=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),KW),f=()=>{o.removeEventListener("scroll",g),a&&o.removeEventListener("scrollend",h),s!==void 0&&clearTimeout(s),clearTimeout(c)},p=()=>{i||(i=!0,f())},m=v=>{if(i)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let y=n(),C=Math.abs(y-r)<=qW;v==="scrollend"&&!C||(l.cancel("platformScrollCompletion"),yu(e))},g=()=>{s!==void 0&&clearTimeout(s),s=setTimeout(()=>m("idle"),HW)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):s=setTimeout(()=>m("idle"),$W),l.register("platformScrollCompletion",p)}function ad(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,i=!!(Ie(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=i,!1;if(i){if(t.pendingMaintainScrollAtEnd=!1,Zn(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 g=r.current;if(t.props.horizontal&&Ra(t)){let h=Zn(e),v=sW(t,h),y=Ix(t,v,h);g?.scrollTo({animated:a.animated,x:y,y:0})}else g?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&ad(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function Ki(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 co=.1,GW=300,jW=2,QW=1;function XW(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,s=e.indexByKey.get(r.id)===void 0;if(a||s||!n){e.mvcpAnchorLock=void 0;return}return r}function YW(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:s}=t,i=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!i||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(s)<=co&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=jW){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+GW,id:n,position:o,quietPasses:c}}}function JW(e,t,n,o,r,a){return!1}function ZW(e,t,n){if(Math.abs(t)<=co)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 e4(e,t){return e<0?-t:t}function ox(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>co&&Ki(e,r)}function t4(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>co)return;let o=Zn(e),r=ZW(t,n.amount,o);if(Math.abs(r)<=co)return;let a=n.amount-r;Math.abs(a)<=co||(n.manualApplied=a,Ki(e,a),n.furthestProgressTowardAmount=0)}function n4(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),s=r<0&&a>co||r>0&&a<-co,i=e4(r,a);if(Math.abs(r)<=co)return n.pendingNativeMVCPAdjust=void 0,!0;if(s)return n.pendingNativeMVCPAdjust=void 0,!1;if(i+co>=Math.abs(r))return ox(e,r,a),!0;let l=Math.max(0,Zn(e)-n.scrollLength);return Math.abs(t-l)<=QW||n.pendingMaintainScrollAtEnd&&Ie(e,"isWithinMaintainScrollAtEndThreshold")&&i>co?(ox(e,r,a),!0):i>o.furthestProgressTowardAmount+co?(o.furthestProgressTowardAmount=i,!1):(o.furthestProgressTowardAmount>co&&i<o.furthestProgressTowardAmount-co&&(n.pendingNativeMVCPAdjust=void 0),!1)}function o4(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:s,size:i,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=XW(n,c,s,d),m,g,h=[],v=f?.index,y=f?.viewPosition,C=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(y??0)>0,x=t?s:i,b=n.indexByKey,T=n.scroll;if(Zn(e),x){if(p&&v===void 0?(g=p.id,m=p.position):v!==void 0?g=qt(n,v):o.length>0&&n.didContainersLayout&&!t&&(g=o.find(I=>b.get(I)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let I=0;I<o.length;I++){let k=o[I],P=b.get(k);if(P!==void 0){let w=r[P];w!==void 0&&h.push({id:k,position:w})}}if(g!==void 0&&m===void 0){let I=b.get(g);I!==void 0&&(m=r[I])}return()=>{let I=0,k=p?.id,P,w=!1,L=n.props.data;if(t&&s&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let R=b.get(g);if(R!==void 0){let D=L[R];w=D===void 0||!l(D,R,L),w&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&s&&v===void 0&&(()=>{if(g===void 0||w)return!0;let R=b.get(g);return R===void 0||r[R]===void 0})())for(let R=0;R<h.length;R++){let{id:D,position:H}=h[R],W=b.get(D);if(W!==void 0&&l){let J=L[W];if(J===void 0||!l(J,W,L))continue}let F=W!==void 0?r[W]:void 0;if(F!==void 0){I=F-H,k=D,P=F;break}}if(!w&&g!==void 0&&m!==void 0){let R=b.get(g),D=R!==void 0?r[R]:void 0;if(D!==void 0){let H=Zn(e),W=D-m;if(W!==0&&C&&n.scroll+n.scrollLength>H)if(W>0)W=Math.max(0,H-n.scroll-n.scrollLength);else{let F=Math.max(0,H-n.scrollLength);n.scroll=F,n.scrollPending=F,W=0}I=W,k=g,P=D}}if(y&&y>0){let R=eo(e,g,v,n.props.data[v]),D=f?.itemSize;if(R!==void 0&&D!==void 0&&R!==D){let H=R-D;H!==0&&(I+=H*y,f.itemSize=R)}}if(YW(n,{anchorId:k,anchorPosition:P,dataChanged:t,now:d,positionDiff:I}),JW()){n.pendingNativeMVCPAdjust={amount:I,furthestProgressTowardAmount:0,manualApplied:0,startScroll:T},t4(e);return}Math.abs(I)>co&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&Ie(e,"isWithinMaintainScrollAtEndThreshold")||Ki(e,I))}}}var hN=1e3,r4=200,Sg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>hN)return 0;let r=0,a=0,s=0;for(let i=n;i>0;i--){let l=t[i],d=t[i-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>hN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/r4);a+=c/f*g,s+=g}return s>0?a/s:0};function a4(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Iu(e){return e.dataChangeNeedsScrollUpdate||a4(e)}function Bi(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:s,lastScrollAdjustForHistory:i,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(),g=i!==void 0&&Math.abs(m-i)>.1;if(g&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(g||d.push({scroll:t,time:p})),d.length>5&&d.shift(),s&&!c){let{lt:w,gt:L}=s;if(w&&t<w||L&&t>L){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let h=Math.abs(t-f),y=!!o?.fromNativeScrollEvent&&h>.1&&!g&&c===void 0&&!a.pendingNativeMVCPAdjust?RW(e,t-f):void 0,C=n4(e,t),x=a.scrollLength,b=x>0&&c===void 0&&h>x&&!a.pendingNativeMVCPAdjust,T=Sg(a);DW(e,T,{forceLight:b});let I=a.scrollLastCalculate;if(Iu(a)||C||y!==void 0||n||I===void 0||Math.abs(a.scroll-I)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=h;let w=()=>{var A;let M={doMVCP:c!==void 0,scrollVelocity:T};b&&(M.drawDistanceMode="visible-first"),(A=a.triggerCalculateItemsInView)==null||A.call(a,M),yg(e,y)};b?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,zN.flushSync)(w),t_(e)):w();let L=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);C&&L&&(a.pendingMaintainScrollAtEnd=!1,ad(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function s4(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 i4(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,s=Wn.get(e),i=!e.didFinishInitialScroll&&(o||!!s)&&Wn.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!s&&Wn.isAtZeroTargetOffset(r);if(i){e.hasScrolled=!1,Wn.set(e,{startScroll:(n=s?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&Wn.clear(e)}function l4(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,s;for(;r<=a;){let i=Math.floor((r+a)/2),l=n.positions[i];l===void 0?a=i-1:l<=t?(s=i,r=i+1):a=i-1}return s}function vN(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=Ax(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function d4(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),s=Math.max(a,t+o.scrollLength),i=n!==void 0?Math.max(0,Math.min(r-1,n)):l4(e,a);if(i===void 0)return;if(n!==void 0&&o.positions[i]===void 0)return{end:i,start:i};if(n===void 0){let d=vN(e,i);if(d===void 0||d<=a)return}for(;i>0;){let d=o.positions[i];if(d===void 0||d<=a||o.positions[i-1]===void 0)break;i--}for(;i>0;){let d=vN(e,i-1);if(d===void 0||d<=a)break;i--}let l=i;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>s)break;l++}return{end:l,start:i}}function c4(e,t,n){let o=d4(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function Ig(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:s,...i}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=i,{props:{horizontal:m}}=r;hg(r);let g=f?c:bg(e,c,i),h=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Ss(e,g,i),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&vg.resetFlags(r);let C=s4(r);r.scrollingTo={...i,...C?{averageSizeSnapshot:C}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||c4(e,v,i.index)}r.scrollPending=v,i4(r,{isInitialScroll:d,requestedOffset:y,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):Bi(e,v,!0,{markHasScrolled:!1})),s||!d||La.OS==="android"?VW(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function s_(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function sg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:s}){let i=e.state,{data:l}=i.props;t=s_(t,l.length);let d=Ax(e,t),c=Cg(e,t);t===l.length-1&&s===void 0&&(s=1),i.scrollForNextCalculateItemsInView=void 0,Ig(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:s??0})}function wg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,s=r.index,i=s!==void 0?s_(s,e.state.props.data.length):void 0,l=Ax(e,i);Ig(e,{animated:!1,forceScroll:n,index:i!==void 0&&i>=0?i:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Ui(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&kx(e,{resetInitialScroll:!0}),Aa(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Sr(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?Cg(e,t.index):0,s=bg(e,a,t);return Ss(e,s,t)}function i_(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,s=!!r?.isInitialScroll,i=!!t?.requiresMeasuredLayout&&!o&&!s;if(!(!a||i||n||r&&!s))return{initialScroll:a,isInitialScrollInProgress:s,queuedInitialLayout:o,scrollingTo:r}}function u4(e,t){var n,o,r;let a=e.state,s=i_(a,{requiresMeasuredLayout:!0});if(!s)return!1;let{initialScroll:i,isInitialScrollInProgress:l,queuedInitialLayout:d}=s,c=l?s.scrollingTo:void 0,f=Sr(e,i),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=i.contentOffset===void 0||Math.abs(i.contentOffset-f)>1,g=p!==void 0&&Math.abs(p-f)>1,h=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!g||t?.forceScroll&&h)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Ui(e,{...i,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return wg(e,{forceScroll:v,resolvedOffset:f,target:i}),!0}function f4(e,t){var n,o;let r=e.state,a=i_(r);if(!a)return!1;let{initialScroll:s,queuedInitialLayout:i}=a,l=(n=s.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||!!i;return wg(e,{forceScroll:f,resolvedOffset:l,target:s}),!0}function Cu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?f4(e,{forceScroll:t?.forceScroll}):u4(e,{forceScroll:t?.forceScroll})}function gu(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 s=qt(e,a);if(s===void 0||!e.sizesKnown.has(s))return!1}}return o}var Tg=1,p4=8,m4=24,g4="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function Zo(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function $i(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function h4(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 v4(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:s}=e,i=o+a,l=[],d=s!==void 0?Math.max(0,Math.min(t-1,s)):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<i&&c+f>o)l.push(d);else if(l.length>0&&c>=i)break}}return l}function y4(e){let{mountFrameCount:t,maxFrames:n=p4,maxPasses:o=m4,passCount:r}=e;return t>=n||r>=o}function l_(e,t){return y4(t)?(Mo&&console.warn(g4),E4(e),!0):!1}function xu(e){var t;let n=Zo(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Aa(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function d_(e,t){var n,o,r;let a=Zo(e);Aa(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 C4(e,t){var n,o,r;let a=Zo(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,Aa(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&d_(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function fx(e){requestAnimationFrame(()=>{var t;Zo(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function Rx(e){let t=e.state,n=Zo(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=Zo(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!l_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&Rx(e))};n.frameHandle=requestAnimationFrame(o)}function cg(e,t){C4(e.state,t),Rx(e),fx(e.state)}function Ex(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 x4(e){return!!e?.preserveForBottomPadding}function zi(e){return!!e?.preserveForFooterLayout}function c_(e){return!!(e&&e.viewPosition===1&&(x4(e)||zi(e)))}function b4(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,s=zi(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:s,viewOffset:-r-(s?n:0),viewPosition:1}}function S4(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function ug(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!zi(r))return;let a=Ex({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Ui(e,a)}function I4(e){od(e)}function Mx(e,t,n=Tg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=bu(o);return Math.abs(r-Sr(e,t))>n}function bu(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 u_(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||$i(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:bu(n);return Sr(e,o)-r}function f_(e){return u_(e)===void 0?!1:(p_(e,{}),!0)}function p_(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=u_(e);if(a===void 0||Math.abs(a)<=Tg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Ki(e,a)),p_(e,t)})}function w4(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||Mx(e,o)&&(c_(o)&&Ie(e,"isAtEnd")||(zi(o)?ug(e,{dataLength:n.props.data.length,stylePaddingEnd:Sx(n.props),target:o}):I4(n)))}function T4(e,t){var n,o,r;let{initialScrollAtEnd:a,target:s}=t,i=e.state,l=Sr(e,s),d=l===0&&!a&&($i(i)?Math.abs((n=s.contentOffset)!=null?n:0)<=1:s.index===0&&((o=s.viewPosition)!=null?o:0)===0&&Math.abs((r=s.viewOffset)!=null?r:0)<=1),c=i.props.data.length===0&&s.index!==void 0;d?(xu(i),rd(e,{resolvedOffset:l})):c?(xu(i),rd(e,{preserveTarget:!0,resolvedOffset:l})):(d_(i,{scroll:l,seedContentOffset:0,targetIndexSeed:s.index}),Rx(e))}function P4(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:s}=t,i=e.state,l=i.initialScroll;if($i(i)||!l)return;let d=!!(i.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=Zo(i);if(!r&&o&&n>0&&i.didFinishInitialScroll&&!c&&!d){od(i);return}let p=n>0&&(r||c_(l));if(!(!o&&!d&&!p)){if(p){let m=r?Ex({dataLength:n,footerSize:Ie(e,"footerSize")||0,preserveForFooterLayout:zi(l),stylePaddingEnd:s}):b4({dataLength:n,footerSize:Ie(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:s,target:l});if(!d&&Mx(e,l)){ug(e,{dataLength:n,stylePaddingEnd:s,target:l});return}if(!S4(l,m)||c||d||o){Ui(e,m,{resetDidFinish:d}),cg(e,{scroll:Sr(e,m),seedContentOffset:d&&!c?bu(i):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Ui(e,l,{resetDidFinish:d}),cg(e,{scroll:Sr(e,l),seedContentOffset:d&&!c?bu(i):void 0,targetIndexSeed:l.index}))}}function k4(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,s=e.state;if(!r)return;let i=s.initialScroll;if(!($i(s)||n===0||!i||!(Zo(s)||zi(i))))if(Mx(e,i))ug(e,{dataLength:n,stylePaddingEnd:a,target:i});else{let d=Ex({dataLength:n,footerSize:o,preserveForFooterLayout:zi(i),stylePaddingEnd:a});if(!(i.index!==d.index||i.viewPosition!==d.viewPosition||i.viewOffset!==d.viewOffset))ug(e,{dataLength:n,stylePaddingEnd:a,target:i});else{let f=!!s.didFinishInitialScroll;Ui(e,d,{resetDidFinish:f}),cg(e,{scroll:Sr(e,d),targetIndexSeed:d.index})}}}function L4(e){var t,n,o;let r=e.state,a=r.initialScroll,s=Zo(r);if(a&&r.props.data.length>0&&!$i(r)&&(s||a.viewPosition===1)){let i=Sr(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!s&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:bu(r),c=i-d;if(Math.abs(c)>Tg){if(r.didFinishInitialScroll)f_(e);else if(l){let f=Wn.get(r);l.offset=i,l.targetOffset=i,r.initialScroll={...a,contentOffset:i},r.hasScrolled=!1,Wn.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:i}),Ki(e,c)}}}else cg(e,{scroll:i,targetIndexSeed:a.index})}}function A4(e){var t,n;let o=e.state,r=Zo(o),a=o.initialScroll;if(!r||!a||$i(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,l_(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 s=Sr(e,a),i=gu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-s)>1,{data:d}=o.props,c=v4({dataLength:d.length,getSize:h=>{var v,y;let C=(v=o.idCache[h])!=null?v:qt(o,h);return(y=o.sizes.get(C))!=null?y:eo(e,C,h,d[h])},offset:s,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(h=>{var v;let y=(v=o.idCache[h])!=null?v:qt(o,h);return o.sizesKnown.has(y)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=s,r.visibleIndices=c,l){r.scroll=s,fx(o);return}if(!i||!f)return;if(!(p!==void 0&&Math.abs(p-s)<=Tg&&h4(m,c))){fx(o);return}xu(o),wg(e,{forceScroll:!0,resolvedOffset:s,target:a,waitForCompletionFrame:La.OS==="web"})}function R4(e,t){var n;let o=e.state;xu(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;rd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function E4(e){var t,n,o,r;let a=e.state,s=Zo(a),i=a.initialScroll;s&&i&&!$i(a)&&a.refScroller.current?(xu(a),wg(e,{forceScroll:!0,resolvedOffset:s.scroll,target:i,waitForCompletionFrame:La.OS==="web"})):R4(e,(r=(o=(n=(t=Zo(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function m_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function M4(e,t,n,o){var r,a;let{getFixedItemSize:s,getItemType:i}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===i&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=i?(r=i(o,n))!=null?r:"":void 0;d=m_(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==s&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=s),s&&!d.didResolveFixedItemSize&&(d.fixedItemSize=s(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function g_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var N4=20,_4=1,D4=1,rx=16;function Nx(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!_x(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>z4(e),"checkFinishedScrollFrame")}function O4(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=_4}function F4(e,t){return!!t?.isInitialScroll&&vg.didDispatchNativeScroll(e)&&!e.hasScrolled}function h_(e){var t;return(t=Wn.get(e))==null?void 0:t.targetOffset}function v_(e){let t=h_(e);return!e.didFinishInitialScroll&&Wn.hasNonZeroTargetOffset(t)}function yN(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 Wn.hasNonZeroTargetOffset(r)&&vg.didDispatchNativeScroll(e)&&!e.hasScrolled||Wn.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||v_(e)}function CN(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&Zn(e)<=n.scrollLength&&n.scrollPending<=D4}function B4(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function U4(e,t){var n;let o=t.index,a=B4(e,t)&&o!==void 0?bg(e,Cg(e,o),t):(n=t.targetOffset)!=null?n:Ss(e,t.offset-(t.viewOffset||0),t);return Ss(e,a,t)}function _x(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=U4(e,t),s=Ss(e,o,t),i=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||La.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-s)<1&&(i<1||c&&d<1)}}function z4(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=_x(e,t);o.isAtResolvedTarget&&O4(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&yu(e)}function H4(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 K4(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=CN(e),r=F4(t,n),a=n!==void 0?yN(t,n):!1,s=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,i=o||a?0:r?rx:s?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let g=v_(t)&&!t.hasScrolled,h=r?5:g?N4:5,v=CN(e),y=yN(t,m),C=_x(e,m),x=La.OS==="android",b=t.hasScrolled&&(!m.isInitialScroll||C.isAtResolvedTarget),T=m.isInitialScroll&&!C.isAtResolvedTarget&&l<=h;if(v||b||y||x||l>h)yu(e);else if((g||T)&&l<=h){let I=(p=(f=h_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;H4(e,I),d(r?rx:100)}else d(r?rx:100)}};d(i)}function y_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?f_(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Cu(e,{forceScroll:!0})}function $4(e){var t;if(!e.state.initialScroll)return;let n=()=>Cu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),Nx(e,{onlyIfAligned:!0})}function q4(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:s,initialContentOffset:i,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=i??0,m=d&&l&&s;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Ui(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){T4(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?rd(e,{resolvedOffset:p}):Lx(e,{didInitialScroll:!0}))}function V4(e,t){var n,o,r;let{dataLength:a,didDataChange:s,didStartFreshData:i,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,g=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,h=a>0&&(!m.hasHadNonEmptyData||i);if(a>0&&(m.hasHadNonEmptyData=!0),h&&(d?(Ui(e,d),Aa(m,{kind:c,previousDataLength:g})):od(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Aa(m),p){P4(e,{dataLength:a,didDataChange:s,initialScrollAtEnd:l,previousDataLength:g,stylePaddingEnd:f});return}let v=g===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;g!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&kx(e,{resetInitialScroll:!0}),Cu(e))}function C_(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function W4(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 s=o.containerItemKeys.get(a);s!==void 0&&r.add(s)}}return r}function fg(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 s of t)a.add(s);e.pendingContainerIds=a}if(!o){let a=((n=Ie(e,"containerLayoutEpoch"))!=null?n:0)+1;Be(e,"containerLayoutEpoch",a)}}function G4(e,t,n,o){var r,a,s,i,l,d,c,f,p;let m=e.state,{columns:g,columnSpans:h,positions:v,props:{data:y,itemsAreEqual:C,keyExtractor:x}}=m,b=y[n];if(b===void 0)return{didChangePosition:!1,didRefreshData:!1};let T=(r=m.idCache[n])!=null?r:qt(m,n),I=(a=o?.updateLayout)!=null?a:!0,k=!1,P=!1;if(I){let M=v[n];if(M===void 0)return Be(e,`containerPosition${t}`,nd),{didChangePosition:!1,didRefreshData:!1};let R=(M||0)-((s=o?.scrollAdjustPending)!=null?s:0),D=(i=m.sizes.get(T))!=null?i:eo(e,T,n,b),H=iW(m,R,D,Ie(e,"totalSize")),W=g[n]||1,F=h[n]||1,J=Ie(e,`containerPosition${t}`),O=Ie(e,`containerColumn${t}`),B=Ie(e,`containerSpan${t}`);H>nd&&H!==J&&(Be(e,`containerPosition${t}`,H),k=!0),W>=0&&W!==O&&Be(e,`containerColumn${t}`,W),F!==B&&Be(e,`containerSpan${t}`,F)}Ie(e,`containerItemIndex${t}`)!==n&&Be(e,`containerItemIndex${t}`,n);let L=Ie(e,`containerItemData${t}`),A=()=>{Be(e,`containerItemData${t}`,b),P=!0};if(L!==b){let M=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===y?m.pendingDataComparison:void 0,R=(c=M?.byIndex[n])!=null?c:0;if(R===2)A();else if(R!==1){let D=(f=Ie(e,`containerItemKey${t}`))!=null?f:T,H=x?.(L,n);if(L===void 0||!x||H!==D)A();else if(!C)A();else{let W=C(L,b,n,y);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==y)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:y,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=W?1:2),W||A()}}}return{didChangePosition:k,didRefreshData:P}}function j4(e,t,n){var o;let r=e.state,a=Ie(e,"numColumns"),s=t;r.columns[t]!==1&&(s=xN(r,a,t));let l=0,d=r.columns[s];if(s>0){let c=s-1,f=(o=r.positions[c])!=null?o:0,p=xN(r,a,c),m=Q4(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:s}}function xN(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 Q4(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let s=0;for(let i=t;i<=n;i++){if(i<0||i>=a.length)continue;let l=r.idCache[i],d=eo(e,l,i,a[i],o);d>s&&(s=d)}return s}function X4(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,s=(t=Ie(e,"numColumns"))!=null?t:1;if(a.length===0)pu(e,null,0);else{let i=a.length-1,l=qt(o,i),d=r[i];if(l!==void 0&&d!==void 0)if(s>1){let c=i;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<=i;p++){let m=(n=o.idCache[p])!=null?n:qt(o,p),g=eo(e,m,p,a[p]);g>f&&(f=g)}pu(e,null,d+f)}else{let c=eo(e,l,i,a[i]);if(c!==void 0){let f=d+c;pu(e,null,f)}}}}function x_(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?Zn(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let s=n[a];qt(t,s);let i=t.positions[s];r[a]=Ix(t,i,o)}Be(e,"snapToOffsets",r)}function b_(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:s,startIndex:i}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,g=e.positionListeners.size>0,{columns:h,columnSpans:v,indexByKey:y,positions:C,idCache:x,sizesKnown:b,props:{data:T,overrideItemLayout:I,snapToIndices:k},scrollingTo:P}=m,w=T.length,L=(l=Ie(e,"numColumns"))!=null?l:1,A=L>1,M=Mo?new Map:void 0,R=Ie(e,"extraData"),D=I?{span:1}:void 0,H=m.lastScrollDelta,W=s??Sg(m),F=!o&&!t&&(r||Math.abs(W)>0||m.scrollLength>0&&H>m.scrollLength),J=a+1e3,O=!0,B=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=Ie(e,"scrollAdjustPending"))!=null?d:0)!==0,Y=!1,U=0,j=1,oe=0;if(t&&(v.length=0),A||(h.length&&(h.length=0),v.length&&(v.length=0)),i>0){if(A){let{startIndex:te,currentRowTop:ue}=j4(e,i,O);i=te,U=ue}else if(i<w){let te=i-1,ue=qt(m,te),Me=(c=C[te])!=null?c:0,Oe=(f=b.get(ue))!=null?f:eo(e,ue,te,T[te],O,B,Y);U=Me+Oe}}let Q=t||y.size===0,ne=A&&!!I&&!!D,re=!1,Z;for(let te=i;te<w;te++){if(F&&Z!==void 0&&te>Z){re=!0;break}F&&Z===void 0&&!P&&!t&&U>J&&(Z=te+(A?L:1)+10);let ue=(p=x[te])!=null?p:qt(m,te),Me=1;if(ne){D.span=1,I(D,T[te],te,L,R);let Ee=D.span;Ee!==void 0&&Number.isFinite(Ee)&&(Me=Math.max(1,Math.min(L,Math.round(Ee))))}A&&j+Me-1>L&&(U+=oe,j=1,oe=0);let Oe=b.get(ue),ke=Oe!==void 0?Oe:eo(e,ue,te,T[te],O,B,Y);Mo&&Q&&(M.has(ue)&&console.error(`[legend-list] Error: Detected overlapping key (${ue}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),M.set(ue,te)),U!==C[te]&&(C[te]=U,g&&gW(e,ue,U)),Q&&y.set(ue,te),A?(h[te]=j,v[te]=Me,ke>oe&&(oe=ke),j+=Me,j>L&&(U+=oe,j=1,oe=0)):U+=ke}re||X4(e),k&&x_(e)}function S_(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 Y4(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function I_(e,t,n,o,r,a,s=r,i=a){let{props:{data:l}}=e;for(let d of n){let c=S_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=s,c.endBuffered=i,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>bN(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):bN(l,d,e,t,o)}}function bN(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:s}=t,i=a.id,l=S_(o,i),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[C,x]of o.mapViewabilityAmountValues)w_(n,o,a,C,x.key,r,x.item,x.index).sizeVisible<0&&(g??(g=[]),g.push(C));let h=[],v=new Set;if(d)for(let C of d){v.add(C.key);let x=n.indexByKey.get(C.key),b=x!==void 0?e[x]:void 0,T=ux(o,C.key),I=!1;x!==void 0&&b!==void 0&&(I=IN(n,o,a,T,C.key,r,b,x)),I||h.push({...C,index:x??C.index,isViewable:!1,item:b??C.item})}let y=[];for(let C=c;C<=f;C++){let x=e[C];if(x){let b=qt(n,C),T=ux(o,b);if(IN(n,o,a,T,b,r,x,C)){let I={containerId:T,index:C,isViewable:!0,item:x,key:b};y.push(I),v.has(I.key)||h.push(I)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:y}),h.length>0){l.viewableItems=y;for(let C=0;C<h.length;C++){let x=h[C];J4(o,i,x.containerId,x)}s&&s({changed:h,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:y})}if(g)for(let C of g){let x=o.mapViewabilityAmountValues.get(C);x&&x.sizeVisible<0&&o.mapViewabilityAmountValues.delete(C)}}function SN(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 w_(e,t,n,o,r,a,s,i){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,g=m?p:f,h=d-c,v=e.positions[i],y=l.get(r)||0;if(v===void 0){let M={containerId:o,index:i,isViewable:!1,item:s,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:y,sizeVisible:-1},R=t.mapViewabilityAmountValues.get(o);if(!SN(R,M)){t.mapViewabilityAmountValues.set(o,M);let D=t.mapViewabilityAmountCallbacks.get(o);D&&D(M)}return M}let C=v-h,x=C+y,b=C>=0&&x<=a&&x>C,T=b?y:Math.min(x,a)-Math.max(C,0),I=y?b?100:100*(T/y):0,k=y?100*(T/a):0,w=(b?100:m?k:I)>=g,L={containerId:o,index:i,isViewable:w,item:s,key:r,percentOfScroller:k,percentVisible:I,scrollSize:a,size:y,sizeVisible:T},A=t.mapViewabilityAmountValues.get(o);if(!SN(A,L)){t.mapViewabilityAmountValues.set(o,L);let M=t.mapViewabilityAmountCallbacks.get(o);M&&M(L)}return L}function IN(e,t,n,o,r,a,s,i){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==i)&&(l=w_(e,t,n,o,r,a,s,i)),l.isViewable}function J4(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var wN=UN.unstable_batchedUpdates,Z4=typeof wN=="function"?wN:e=>e(),eG=32,tG=64,nG=3;function oG(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*nG),o=t+tG,r=Math.max(t,Math.min(n,o),Math.min(e,eG)),a=Math.max(e,t);return Math.min(a,r)}function rG(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function aG(e,t,n,o,r,a,s){var i;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,g=r.length>0?new Set(r):void 0,h=t.map((L,A)=>({isSticky:c.props.stickyHeaderIndicesSet.has(L),itemIndex:L,itemType:a?.(L),order:A})),v=h.filter(L=>!L.isSticky),y=h.filter(L=>L.isSticky),C=[],x=[];for(let L=0;L<d;L++){let A=Ie(e,`containerItemKey${L}`),M=!!g?.has(L);if(!(A&&s?.has(A)&&c.indexByKey.has(A))){if(p.has(L))(A===void 0||M)&&x.push({containerIndex:L,distance:Number.POSITIVE_INFINITY});else if(A===void 0||M)C.push({containerIndex:L,distance:Number.POSITIVE_INFINITY});else if(!m){let D=c.indexByKey.get(A);if(D!==void 0&&(D<n||D>o)){let H=D<n?n-D:D-o;C.push({containerIndex:L,distance:H})}}}}C.sort(sG);let b=new Array(l),T=d,I=!1,k=(L,A)=>{b[L.order]={containerIndex:A,itemIndex:L.itemIndex,itemType:L.itemType},g?.delete(A)&&(I=!0)},P=(L,A,M)=>{for(let R of L){if(b[R.order])continue;let D=A.findIndex(H=>{var W;return M((W=f.get(H.containerIndex))==null?void 0:W.itemType,R.itemType)});if(D!==-1){let[H]=A.splice(D,1);k(R,H.containerIndex)}}},w=(L,A,M)=>{a&&P(L,A,(R,D)=>D!==void 0&&R===D),P(L,A,R=>R===void 0),M&&P(L,A,()=>!0)};w(v,C,!0),w(y,x,!1);for(let L of h){if(b[L.order])continue;let A=T++;L.isSticky&&p.add(A),k(L,A)}if(I&&(r.length=0,g))for(let L of g)r.push(L);if(Mo){let L=(i=Ie(e,"numContainersPooled"))!=null?i:Number.POSITIVE_INFINITY;T>L&&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:L,numNeeded:l,stillNeeded:T-d}})}return b}function sG(e,t){return t.distance-e.distance}function iG(e){let t=e.state;t.queuedInitialLayout=!0,YN(e),Lx(e,{didLayout:!0})}var lG=4,dG=100;function cG(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/lG);return Math.sign(e)*t*n}function uG(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},dG,"renderRangeProjection")}function fG(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],s=o[a];if(s!==void 0&&t>=s)return r}return-1}function pG(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 mG(e,t,n,o,r,a,s){var i;let l=e.state;Be(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(pG(e,f))continue;let p=(i=l.idCache[f])!=null?i:qt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>s)&&!r.has(f)&&(r.add(f),o.push(f))}}function gG(e,t,n,o,r,a,s){var i,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||s(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Be(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let h=t[m+1],v=!1;if(h){let y=d.positions[h];v=y!==void 0&&n>y+o*2}else{let y=(i=d.idCache[p])!=null?i:qt(d,p);if(y){let C=d.positions[p],x=(l=d.sizes.get(y))!=null?l:eo(e,y,p,d.props.data[p]);v=C!==void 0&&n>C+x+o*3}}v&&a.push(c)}}function T_(e,t,n,o,r,a){let s=!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:s=!0),s}function P_(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let s=a;s<=t.endNoBuffer;s++){let i=(o=e.idCache[s])!=null?o:qt(e,s);r.push(i)}return r}function px(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:qt(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 hG(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:s,positions:i,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=s[f])!=null?n:qt(r,f),m=(o=d.get(p))!=null?o:eo(e,p,f,l[f]);if(i[f]+m>t)return f}return null}function vG(e,t,n,o,r){var a,s;let i=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=i;if(m===null||l===null||m<0||l<m)return;let g={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let h=m;h<=l&&h<f.length;h++){let v=(a=d[h])!=null?a:qt(i,h),y=(s=p.get(v))!=null?s:eo(e,v,h,f[h]),C=c[h];if(T_(g,h,C,y,o,r))break}Object.assign(i,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:P_(i,g),startNoBuffer:g.startNoBuffer}),px(i,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&I_(i,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function ka(e,t={}){let n=e.state;Z4(()=>{var o,r,a,s,i,l,d,c,f,p,m,g,h,v,y,C,x,b,T,I,k;let{columns:P,containerItemKeys:w,enableScrollForNextCalculateItemsInView:L,idCache:A,indexByKey:M,minIndexSizeChanged:R,positions:D,props:{alwaysRenderIndicesArr:H,alwaysRenderIndicesSet:W,getItemType:F,keyExtractor:J,onStickyHeaderChange:O},scrollForNextCalculateItemsInView:B,scrollLength:Y,sizes:U,startBufferedId:j,viewabilityConfigCallbackPairs:oe}=n,{data:Q}=n.props,ne=n.props.stickyHeaderIndicesArr||[],re=n.props.stickyHeaderIndicesSet||new Set,Z=e_(e,t.drawDistanceMode),{dataChanged:te,doMVCP:ue,forceFullItemPositions:Me}=t,Oe=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,ke=!!Oe,Ee=Ie(e,"numContainers");if(!Q||Y===0||!Ee)return;let ee=Zn(e),Se,X=Ie(e,"stylePaddingTop")+Ie(e,"alignItemsAtEndPadding")+Ie(e,"headerSize"),de=Ie(e,"numColumns"),le=(r=t.scrollVelocity)!=null?r:Sg(n),se=0,{initialScroll:$e,queuedInitialLayout:Tt}=n,gt=ke?(a=Oe?.scroll)!=null?a:n.scroll:!Tt&&fu(n)&&$e?Sr(e,$e):n.scroll,Lt=0,it=0,ct=0,ht=0,lt=0,pt=0,Pt=gt,Ft=xe=>{var Ze;Pt=xe,Lt=(Ze=Ie(e,"scrollAdjustPending"))!=null?Ze:0,it=Lt-X,ct=Math.round(xe+se+it),ct+Y>ee&&(ct=Math.max(0,ee-Y))};Ft(gt);let gn=Ie(e,"activeStickyIndex"),rt=()=>{let xe=ne.length>0?fG(ne,ct,n):-1,Ze=xe>=0?ne[xe]:-1,Mt=gn!==Ze;(xe>=0||gn>=0)&&Be(e,"activeStickyIndex",Ze);let vt=!!O&&ne.length>0&&Mt;return{currentStickyIdx:xe,finishCalculateItemsInView:vt?()=>{let fn=Q[Ze];fn!==void 0&&O?.({index:Ze,item:fn})}:void 0}},At=te?void 0:rt(),Bt=Z,en=Z;le>0||le===0&&ct<Math.max(50,Z)?(Bt=Z*.5,en=Z*1.5):(Bt=Z*1.5,en=Z*.5);let Wt=!te&&!Me&&!ke&&!fu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!Ie(e,"readyToRender")?cG(le,Math.min(Bt,en)):0,vn=()=>{let xe=Math.max(0,ct),Ze=Math.max(0,-Pt);lt=Math.max(xe,ct+Y+Ze),ht=xe-Bt+Wt,pt=lt+en+Wt};if(vn(),Wt!==0&&uG(e),L&&!ke&&!te&&!Me&&B){let{top:xe,bottom:Ze}=B;if(xe===null&&Ze===null)n.scrollForNextCalculateItemsInView=void 0;else if((xe===null||ht>xe)&&(Ze===null||pt<Ze)&&!Iu(n)){oe?vG(e,oe,Y,ct,lt):n.props.onFirstVisibleItemChanged&&px(n,hG(e,ct)),(s=At?.finishCalculateItemsInView)==null||s.call(At);return}}let $=ue&&!ke?o4(e,te):void 0;te&&C_(n);let pe=Me||te?0:(i=R??n.startBuffered)!=null?i:0,ge=!Me&&!te&&de>1&&R!==void 0;b_(e,te,{doMVCP:ue,forceFullUpdate:!!Me,optimizeForVisibleWindow:ge,scrollBottomBuffered:pt,scrollVelocity:le,startIndex:pe}),ee=Zn(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let ye;if(te&&ue&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let xe=n.props.maintainVisibleContentPosition.shouldRestorePosition;ye=new Set;for(let Ze of n.idsInView){let Mt=M.get(Ze);Mt!==void 0&&(xe&&!xe(Q[Mt],Mt,Q)||ye.add(Ze))}}let Pe=n.scroll,at=(l=Ie(e,"scrollAdjustPending"))!=null?l:0;$?.(),$&&(n.scroll!==Pe||((d=Ie(e,"scrollAdjustPending"))!=null?d:0)!==at)&&(Ft(n.scroll),vn()),te&&(At=rt());let bt=null,cn=null,st=null,Je=(c=ke?Oe?.targetIndexSeed:void 0)!=null?c:!te&&j&&M.get(j)||0;for(let xe=Je;xe>=0;xe--){let Ze=(f=A[xe])!=null?f:qt(n,xe),Mt=D[xe],vt=(p=U.get(Ze))!=null?p:eo(e,Ze,xe,Q[xe]);if(Mt+vt>ht)Je=xe;else break}if(de>1)for(;Je>0;){let xe=P[Je];if(xe===1||xe===void 0)break;Je-=1}let Rt=!1,nn,Te,Ke=0;for(let xe=0;xe<Ee;xe++){let Ze=Ie(e,`containerItemKey${xe}`);if(Ze!==void 0){let Mt=M.get(Ze);Ke=Math.max(Ke,Mt)}}let qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},ut=Q.length;for(let xe=Math.max(0,Je);xe<ut&&(!Rt||xe<=Ke);xe++){let Ze=(m=A[xe])!=null?m:qt(n,xe),Mt=(g=U.get(Ze))!=null?g:eo(e,Ze,xe,Q[xe]),vt=D[xe];Rt||(T_(qe,xe,vt,Mt,ct,lt),bt===null&&vt+Mt>ht&&(bt=xe,cn=Ze,ht<0?nn=null:nn=vt),qe.startNoBuffer!==null&&(vt<=pt?(st=xe,pt>ee?Te=null:Te=vt+Mt):Rt=!0))}Object.assign(n,{endBuffered:st,endNoBuffer:qe.endNoBuffer,firstFullyOnScreenIndex:qe.firstFullyOnScreenIndex,idsInView:P_(n,qe),startBuffered:bt,startBufferedId:cn,startNoBuffer:qe.startNoBuffer}),L&&nn!==void 0&&Te!==void 0&&(n.scrollForNextCalculateItemsInView=mu(nn)&&mu(Te)?void 0:{bottom:Te,top:nn});let tt=Ee,nt=[];if(te)for(let xe=0;xe<tt;xe++){let Ze=Ie(e,`containerItemKey${xe}`);(!J||Ze&&M.get(Ze)===void 0)&&nt.push(xe)}let St=n.scrollTargetPinnedRange,Ut=0,bn=-1;St&&(Ut=Math.max(0,Math.min(St.start,St.end)),bn=Math.min(ut-1,Math.max(St.start,St.end)));let ln=Ut<=bn,un=xe=>W.has(xe)||ln&&xe>=Ut&&xe<=bn;if(bt!==null&&st!==null){let xe=[],Ze=new Set,Mt=vt=>{var fn;if(vt>=0&&vt<ut){let yn=(fn=A[vt])!=null?fn:qt(n,vt),dn=w.get(yn);dn!==void 0?n.stickyContainerPool.add(dn):!mu(yn)&&!Ze.has(vt)&&(Ze.add(vt),xe.push(vt))}};for(let vt=bt;vt<=st;vt++){let fn=(h=A[vt])!=null?h:qt(n,vt);w.has(fn)||(Ze.add(vt),xe.push(vt))}for(let vt of H)Mt(vt);if(ln)for(let vt=Ut;vt<=bn;vt++)Mt(vt);if(ne.length>0?mG(e,ne,(v=At?.currentStickyIdx)!=null?v:-1,xe,Ze,bt,st):gn!==-1&&Be(e,"activeStickyIndex",-1),xe.length>0){let fn=aG(e,xe,bt,st,nt,F?yn=>{let dn=F(Q[yn],yn);return dn!==void 0?String(dn):""}:void 0,ye);for(let yn of fn){let dn=yn.itemIndex,Jt=yn.containerIndex,jn=(y=A[dn])!=null?y:qt(n,dn),zt=Ie(e,`containerItemKey${Jt}`);zt&&zt!==jn&&w.delete(zt),zt!==jn&&(Se??(Se=new Set),Se.add(Jt),n.containerItemGenerations[Jt]=((C=n.containerItemGenerations[Jt])!=null?C:0)+1),Be(e,`containerItemKey${Jt}`,jn),Be(e,`containerItemIndex${Jt}`,dn),Be(e,`containerItemData${Jt}`,Q[dn]),n.containerItemMetadata.set(Jt,m_(n,dn,Q[dn],yn.itemType)),w.set(jn,Jt),(x=n.userScrollAnchorReset)==null||x.keys.add(jn);let Cn=`containerSticky${Jt}`,uo=re.has(dn),Tr=un(dn);uo?(Be(e,Cn,!0),n.stickyContainerPool.add(Jt)):(Ie(e,Cn)&&Be(e,Cn,!1),Tr?n.stickyContainerPool.add(Jt):n.stickyContainerPool.delete(Jt)),Jt>=tt&&(tt=Jt+1)}tt!==Ee&&(Be(e,"numContainers",tt),tt>Ie(e,"numContainersPooled")&&Be(e,"numContainersPooled",rG(ut,tt)))}((b=n.userScrollAnchorReset)==null?void 0:b.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&gG(e,ne,ct,Z,(T=At?.currentStickyIdx)!=null?T:-1,nt,un);let Gn=nt.length>0?new Set(nt):void 0,Sn=!1;for(let xe=0;xe<tt;xe++){let Ze=Ie(e,`containerItemKey${xe}`);if(Gn?.has(xe))Ze!==void 0&&(w.delete(Ze),Se??(Se=new Set),Se.add(xe),n.containerItemGenerations[xe]=((I=n.containerItemGenerations[xe])!=null?I:0)+1),n.containerItemMetadata.delete(xe),n.stickyContainerPool.has(xe)&&(Be(e,`containerSticky${xe}`,!1),n.stickyContainerPool.delete(xe)),Be(e,`containerItemKey${xe}`,void 0),Be(e,`containerItemIndex${xe}`,void 0),Be(e,`containerItemData${xe}`,void 0),Be(e,`containerPosition${xe}`,nd),Be(e,`containerColumn${xe}`,-1),Be(e,`containerSpan${xe}`,1);else{let Mt=M.get(Ze);Mt!==void 0&&(Sn=G4(e,xe,Mt,{scrollAdjustPending:Lt,updateLayout:!0}).didChangePosition||Sn)}}if(Se&&wx&&fg(e,Se),Sn&&Be(e,"lastPositionUpdate",Date.now()),ke){A4(e);return}px(n,qe.startNoBuffer),!Tt&&!n.didContainersLayout&&(fu(n)?gu(n,n.startBuffered,n.endBuffered):gu(n,n.startNoBuffer,n.endNoBuffer)||gu(n,n.startBuffered,n.endBuffered))&&(iG(e),$4(e)),oe&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&I_(e.state,e,oe,Y,qe.startNoBuffer,qe.endNoBuffer,bt??qe.startNoBuffer,st??qe.endNoBuffer),(k=At?.finishCalculateItemsInView)==null||k.call(At)})}function pg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=Ie(e,"anchoredEndSpaceSize"),s=o.anchoredEndSpaceReadyAnchorIndex,i=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:h,anchorMaxSize:v,anchorOffset:y=0}=r,{data:C}=o.props;if(h>=0&&h<C.length&&o.scrollLength>0){d=qt(o,h);let x=0,b=!1;for(let I=h;I<C.length;I++){let k=a_(e,I),P=I===h&&v!==void 0?Math.min(k||0,Math.max(0,v)):k;k===void 0&&(b=!0),P!=null&&P>0&&(x+=P)}x=Math.max(0,x-e.scrollAxisGap),x+=(e.values.get("footerSize")||0)+Sx(o.props),c=!b;let T=Math.max(0,o.scrollLength-x-y);f=b?Math.min(a||0,T):T}else h>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(s!==l||i!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Hi(e),Bi(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Bi(e,o.scroll,!0,{markHasScrolled:!1})),f}function yG(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 TN(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=Ie(e,"otherAxisSize");(!a||r>a)&&Be(e,"otherAxisSize",r)}}var Ta;function k_(e){let t=Ta===void 0;Ta??(Ta=new Map);try{e()}finally{if(t){let n=Ta;Ta=void 0;for(let[o,r]of n)Dx(o,r)}}}function CG(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 xG(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,yG(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&pg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&ad(e)}function L_(e,t){if(Ta){let n=Ta.get(e);n?n.push(t):Ta.set(e,[t])}else Dx(e,[t])}function Dx(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 i=o.indexByKey.get(a.itemKey),l=i===void 0||(n=o.props.data)==null?void 0:n[i],d=a.containerId!==void 0&&i!==void 0&&l!==void 0?M4(o,a.containerId,i,l):void 0,c=bG(e,a.itemKey,a.size,d);CG(r,c)}xG(e,r)}function bG(e,t,n,o){var r,a;let s=e.state,i=s.userScrollAnchorReset,l=!!i?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:g,data:h,maintainScrollAtEnd:v}}=s;if(!h)return{didMeasureUserScrollAnchorResetItem:l};let y=s.indexByKey.get(t);if(f){if(y===void 0)return{didMeasureUserScrollAnchorResetItem:l};let P=s.props.data[y];if(P===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let L=(a=o?.itemType)!=null?a:p&&(r=p(P,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(P,y,L),itemType:L}}let w=o.fixedItemSize;if(w!==void 0&&w===c.get(t))return TN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let C=!d,x=!1,b,T=s.sizesKnown.get(t),I=SG(e,t,n,o),k=vu(m?n.width:n.height);if(I!==0){b=b!==void 0?Math.min(b,y):y;let{startBuffered:P,endBuffered:w}=s;C||(C=y>=P&&y<=w),!C&&s.containerItemKeys.has(t)&&(C=!0),(T===void 0||Math.abs(T-k)>5)&&(x=!0),g?.({index:y,itemData:s.props.data[y],itemKey:t,previous:k-I,size:k})}if(b!==void 0&&(s.minIndexSizeChanged=s.minIndexSizeChanged!==void 0?Math.min(s.minIndexSizeChanged,b):b),TN(e,n,m),d||gu(s,s.startBuffered,s.endBuffered)){let P=x&&!!v?.onItemLayout;return{didChange:I!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:C,shouldMaintainScrollAtEnd:P}}return{didChange:I!==0,didMeasureUserScrollAnchorResetItem:l}}function SG(e,t,n,o){var r,a;let s=e.state,{indexByKey:i,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=s;if(!c)return 0;let g=i.get(t),h=c[g],v=o?.itemType,y=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(h,g))!=null?r:"",y=m(h,g,v));let C=o?.didResolveFixedItemSize||v!==void 0||y!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:y,itemType:v}:void 0,x=eo(e,t,g,h,void 0,void 0,void 0,C),b=f?n.width:n.height,T=l.get(t),I=Math.round(b);if(l.set(t,I),y===void 0&&I>0){v??(v=p&&(a=p(h,g))!=null?a:"");let k=d[v];k||(k=d[v]={avg:0,num:0}),k.num===0?(k.avg=I,k.num++):T!==void 0&&T>0?k.avg+=(I-T)/k.num:(k.avg=(k.avg*k.num+I)/(k.num+1),k.num++)}return!x||Math.abs(x-I)>.1?(cx(e,t,I),I-x):0}function IG(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),s=Ie(e,`containerItemKey${r}`),i=a?.current;if(s!==void 0&&i){let l=i.getBoundingClientRect();xW(i,l),n.push({containerId:r,itemKey:s,size:{height:l.height,width:l.width}})}}n.length>0&&Dx(e,n)}var A_=Mn,Vr=Ce,wG=Vr(function({children:t}){let n=Ir(),[o]=No(["containerLayoutEpoch"]);return be(()=>{{let r=W4(n);r!==void 0&&IG(n,r)}},[n,o]),t}),ig=e=>Fg(e)?e:e?Ne(e,null):null,TG=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),mx={contain:"paint layout style",...TG?{display:"flex",flexDirection:"column"}:{}},PG=Vr(function({id:t,horizontal:n,style:o,refView:r,...a}){let[s=nd]=No([`containerPosition${t}`]),i=xg(o)?Object.assign({},...o):o,l=n?{...mx,...i,left:s}:{...mx,...i,top:s},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Ne("div",{ref:r,...m,style:l})}),kG=Vr(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:s,onLayout:i,onLayoutChange:l,children:d,...c}){let[f=nd,p,m]=No([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),g=V(()=>{var y;return(y=xg(o)?Object.assign({},...o):o)!=null?y:{}},[o]),h=V(()=>{var y;let C={...mx,...g};delete C.transform;let x=(y=s?.offset)!=null?y:0,b=p===m;return C.position=b?"sticky":"absolute",C.zIndex=m+1e3,n?C.left=b?x:f:C.top=b?x:f,C},[g,n,f,m,p,s?.offset]),v=V(()=>s?.backdropComponent?Ne("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},ig(s.backdropComponent)):null,[s?.backdropComponent]);return Ne("div",{ref:r,style:h,...c},v,d)}),LG=PG;function AG(e){G(()=>e())}var R_=yt(null),RG=-1;function EG(){return Dt(R_)}function MG(){var e;let t=EG(),n=(e=t?.containerId)!=null?e:RG,[o]=No([`containerItemKey${n}`]);return hW("lastItemKeys",a=>t&&!mu(o)&&a?.includes(o)||!1)}function NG({ItemSeparatorComponent:e,leadingItem:t}){return MG()?null:Ne(e,{leadingItem:t})}var ax=null;function _G(){return ax||(ax=new ResizeObserver(e=>{k_(()=>{for(let t of e){let n=lg.get(t.target);if(n)for(let o of n)o(t)}})})),ax}var lg=new WeakMap;function DG(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=_G(),r=(n=lg.get(e))!=null?n:new Set;return r.size===0&&(lg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(lg.delete(e),o.unobserve(e))}}function Ox({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return be(()=>{var s,i;let l=e.current,c=((i=(s=l?.getScrollableNode)==null?void 0:s.call(l))!=null?i:null)||l;if(!c)return;let f=(m,g)=>{m.height===0&&m.width===0||(o(m,g),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(PN(m),!0),p=m}return DG(c,m=>{var g;let h=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,y=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(g=h?.getBoundingClientRect())!=null?g:m.contentRect,C=p??CW(c),x=C===void 0||y.width!==C.width||y.height!==C.height;p=y;let b=!!r?.();(x||b)&&f(PN(y),!1)})},[t,...a||[]]),{}}function PN(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var dg=new Map,sx;function E_(e){dg.delete(e)}function OG(e,t){dg.set(e,t),sx===void 0&&(sx=requestAnimationFrame(()=>{let n=Array.from(dg.values());dg.clear(),sx=void 0,k_(()=>{for(let o of n)o()})}))}function FG({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,s=r.itemKey;r.didLayout=!0;let i=n,l=r.horizontal?"width":"height",d=vu(n[l]);r.lastSize&&vu(r.lastSize[l]);let f=a.sizesKnown.get(s),p=()=>{r.lastSize=i,L_(t,{containerId:e,itemKey:s,size:i})};!Iu(a)&&f!==void 0&&d+1<f?OG(r,()=>{var g;if(r.itemKey===s){let h=o.current,v=(g=h?.getBoundingClientRect)==null?void 0:g.call(h);v&&(i={height:v.height,width:v.width}),p()}}):(E_(r),p())}function BG({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=N({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[s,i]=G(0),l=E(f=>{FG({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=E(()=>{fg(t,e)},[e,t]);be(()=>(t.containerLayoutTriggers.set(e,d),()=>{E_(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),be(()=>{fg(t,e)});let{onLayout:c}=Ox({measureInLayoutEffect:!wx,onLayoutChange:l,ref:r,webLayoutResync:()=>Iu(t.state)},[o,s]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function UG({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:s,otherAxisSize:i}){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&&La.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:i,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:s,...l||{}}:{boxSizing:l?"border-box":void 0,left:s,position:"absolute",right:a>1?null:0,top:0,width:i,...l||{}}}var zG=Vr(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:s,stickyHeaderConfig:i}){let l=Ir(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Ra(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[g=0,h=1,v,y=1,C,x]=No([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),b=N(null),{onLayout:T,triggerLayout:I}=BG({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:b}),k=g>0?g:1,P=Math.min(Math.max(h||1,1),y),w=y>1?`${(k-1)/y*100}%`:0,L=y>1?`${P/y*100}%`:void 0,A=V(()=>UG({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!s,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:w,otherAxisSize:L}),[r,f,w,L,d,l.state.props.contentContainerAlignItems,y,s]),M=V(()=>n!==void 0?a(n):null,[n,v,C]),{renderedItem:R}=M||{},D=V(()=>(l.viewRefs.set(t,b),{containerId:t,triggerLayout:I}),[t,I]);return Ne(x?m||kG:p||LG,{animatedScrollY:x?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:T,refView:b,stickyHeaderConfig:i,style:A},Ne(R_.Provider,{value:D},R,M&&s&&Ne(NG,{ItemSeparatorComponent:s,leadingItem:M.item})))});function HG({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:s=zG}){let[i]=No([`containerItemKey${e}`]);return i===void 0?null:Ne(s,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:i,recycleItems:n,stickyHeaderConfig:a})}var KG=Vr(function(t){return Ne(HG,{...t})});function $G(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)),s=qG(a),i=new Set(s);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!i.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],g=n.indexOf(m);if(i.has(g)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function qG(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let i=0;i<t;i++){let l=e[i],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(i)):(n[d]=l,r[d]=i),d>0&&(o[i]=r[d-1])}let a=[],s=r[r.length-1];for(;s!==-1;)a.unshift(s),s=o[s];return a}function VG(e){let t=Ir(),n=N(void 0);q(()=>{let o=Pa(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[s,i]of t.viewRefs){let l=i.current,d=Ie(t,`containerItemIndex${s}`);l&&d!==void 0&&a.set(l,d)}$G(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function WG(e,t){let[n,o]=G(t),r=n!==t;return be(()=>{o(t)},[t]),e&&!r}var GG=Vr(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=N(null),s=Ir(),i=s.columnWrapperStyle,l=Ra(s.state),[d,c,f]=No(["otherAxisSize","readyToRender","totalSize"]),p=WG(!!c,t);VG(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"),i&&o>1){let{columnGap:g,rowGap:h,gap:v}=i,y=g||v||0,C=h||v||0;n?(C&&(m.marginTop=m.marginBottom=-C/2),y&&(m.marginRight=-y)):C&&(m.marginBottom=-C)}return Ne("div",{ref:a,style:m},Ne(wG,null,r))}),jG=Vr(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:s}){let[i,l]=No(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<i;c++)d.push(Ne(KG,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:s}));return Ne(GG,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function QG(e){return xg(e)?Object.assign({},...e.filter(Boolean)):e}var Su={create:e=>e,flatten:e=>QG(e)};function gx(e){let t=N(e);return t.current=e,t}function XG(e){let t=gx(e),n=N(void 0),o=V(()=>({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 hx="legend-list-content-container",M_="legend-list-scrollbar-x-hidden",N_="legend-list-scrollbar-y-hidden";function YG(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function vx(){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 kN(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 __(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function JG(e,t,n){return __(n?t:e)}function LN(e,t,n){var o,r,a,s,i,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:(s=(a=d?.width)!=null?a:e?.clientWidth)!=null?s:window.innerWidth}}return{height:(i=e?.clientHeight)!=null?i:0,width:(l=e?.clientWidth)!=null?l:0}}function AN(e,t){return Math.max(0,Math.min(e,t))}function RN(e,t){return t?e.width:e.height}function ZG(e,t,n){return Math.max(0,RN(e,n)-RN(t,n))}function EN(e,t){return t&&YG()||e}function ej(e,t){return t&&typeof window<"u"?window:e}function tj(e,t,n){let o=e.getBoundingClientRect(),r=vx();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 nj({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var MN="legend-list-scrollbar-axis-hidden-style",oj=200,rj=`.${N_}::-webkit-scrollbar:vertical{width:0;display:none;}.${M_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function aj(){if(typeof document>"u"||document.getElementById(MN))return;let e=document.createElement("style");e.id=MN,e.textContent=rj,document.head.appendChild(e)}function sj(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 ij(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 lj(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 NN=Mn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:s,maintainVisibleContentPosition:i,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:g=!1,onLayout:h,...v},y){var C,x,b;let T=Ir(),[I]=No(["anchoredEndSpaceSize"]),k=N(null),P=N(null),w=g,L=E(()=>ej(k.current,w),[w]),A=E(()=>{let X=k.current,de=JG(X,P.current,w),le=LN(X,w,a);return ZG(de,le,a)},[a,w]),M=E(()=>{let X=k.current;if(w){let de=A(),le=vx(),se=kN(X,le),$e=a?le.x-se.left:le.y-se.top;return AN($e,de)}return X?a?X.scrollLeft:X.scrollTop:0},[A,a,w]),R=E((X,de)=>{let le=k.current,se=L();if(!se||typeof se.scrollTo!="function")return;let $e=A(),Tt=AN(X,$e),Lt={behavior:de?"smooth":"auto"};if(w){let it=vx(),ct=kN(le,it),{left:ht,top:lt}=nj({clampedOffset:Tt,horizontal:a,listPos:ct,scroll:it});Lt.left=ht,Lt.top=lt}else a?Lt.left=Tt:Lt.top=Tt;se.scrollTo(Lt)},[A,L,a,w]);Oo(y,()=>({getBoundingClientRect:()=>{var de;return(de=k.current)==null?void 0:de.getBoundingClientRect()},getCurrentScrollOffset:M,getScrollableNode:()=>EN(k.current,w),getScrollEventTarget:()=>L(),getScrollResponder:()=>EN(k.current,w),isWindowScroll:()=>w,scrollBy:(de,le)=>{let se=L();!se||typeof se.scrollBy!="function"||se.scrollBy({behavior:"auto",left:de,top:le})},scrollTo:de=>{let{x:le=0,y:se=0,animated:$e=!0}=de;R(a?le:se,$e)},scrollToEnd:(de={})=>{let{animated:le=!0}=de,se=A();R(se,le)},scrollToOffset:de=>{let{offset:le,animated:se=!0}=de;R(le,se)}}),[M,A,L,a,w,R]);let D=E(()=>{if(!l||!k.current)return;let X=__(P.current),de=LN(k.current,w,a),le=M(),se={nativeEvent:{contentOffset:{x:a?le:0,y:a?0:le},contentSize:{height:X.height,width:X.width},layoutMeasurement:{height:de.height,width:de.width}}};l(se)},[M,a,w,l]),H=XG(D),W=N(void 0),F=E(()=>{let X=W.current;X!==void 0&&(clearTimeout(X),W.current=void 0),H.flush(),d?.()},[d,H]),J=E(X=>{if(!l)return;let de=T.state;if(!!de?.scrollingTo||!!de?.initialScrollSession&&!de.didFinishInitialScroll||!!de?.initialScroll&&!de.didFinishInitialScroll||!!de&&Iu(de)?H.flush():H.schedule(),d){let se=W.current;se!==void 0&&clearTimeout(se),W.current=setTimeout(F,oj)}},[T.state,F,d,l,H]);be(()=>{let X=L();if(X)return X.addEventListener("scroll",J,{passive:!0}),"onscrollend"in X&&X.addEventListener("scrollend",F),()=>{X.removeEventListener("scroll",J),"onscrollend"in X&&X.removeEventListener("scrollend",F);let de=W.current;de!==void 0&&(clearTimeout(de),W.current=void 0),H.cancel()}},[F,L,J,H]),q(()=>{let X=()=>{s&&R(a?s.x||0:s.y||0,!1)};X(),requestAnimationFrame(X)},[s?.x,s?.y,a,R]),be(()=>{if(!h||!k.current)return;let X=k.current,de=()=>{h({nativeEvent:{layout:tj(X,w,a)}})};de();let le=new ResizeObserver(()=>{de()});le.observe(X);let se=()=>{de()};return w&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",se),()=>{le.disconnect(),w&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",se)}},[w,h]);let O=!w&&(a?!f&&M_:!p&&N_);be(()=>{O&&aj()},[O]);let B={...w?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Su.flatten(n),...i?{overflowAnchor:"none"}:{}},Y=sj(T),U=(x=(C=T.state)==null?void 0:C.props)!=null&&x.anchoredEndSpace&&I?I:0,j=Math.max(0,Y-U),oe=j?a?{flexShrink:0,width:j}:{height:j}:void 0,Q={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...Su.flatten(r),...i?{overflowAnchor:"none"}:{}},ne=o?`${hx} ${o}`:hx,{contentContainerClassName:re,contentInset:Z,scrollEventThrottle:te,ScrollComponent:ue,snapToOffsets:Me,useWindowScroll:Oe,className:ke,...Ee}=v,ee=w?[]:ij(Me);ee.length>0&&(B.scrollSnapType=a?"x mandatory":"y mandatory",Q.position=(b=Q.position)!=null?b:"relative");let Se=O?ke?`${ke} ${O}`:O:ke;return Mo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${ke??""}`)&&Oi("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."),Ne("div",{className:Se,ref:k,...Ee,style:B},m,Ne("div",{className:ne,ref:P,style:Q},ee.map(X=>Ne("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":X,key:`snap-${X}`,style:lj(X,a)})),t,oe?Ne("div",{"aria-hidden":!0,style:oe}):null))});function dj({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function _N(e,t){let n=Ir();be(()=>Pa(n,e,r=>{t(r)}),[t,n,e])}function cj(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function uj(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,s=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,i=null;return s&&(i=t?.isConnected&&t.parentElement===s?t:s.querySelector(`:scope > .${hx}`)),s?{contentNode:i,scrollElement:s}:null}function fj(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function pj(){let e=Ir(),t=N(0),n=N(0),o=N(void 0),r=N(void 0),a=N(null),s=E(()=>{let i=Ie(e,"scrollAdjust"),l=Ie(e,"scrollAdjustUserOffset"),d=(i||0)+(l||0);if(d-t.current!==0){let f=uj(e,a.current);if(f){let p=!!e.state.props.horizontal,m=cj(p),{contentNode:g,scrollElement:h}=f,v=p?h.scrollLeft:h.scrollTop,y=(l||0)-n.current,x=(y!==0?v+y:e.state.scroll)-v,b=Math.abs(x)>.01,T=()=>fj(h,m.x*x,m.y*x);if(a.current=g,b&&g){let I=g[m.contentSizeKey],k=h[m.viewportSizeKey],P=v+x;if(x>0&&!e.state.adjustingFromInitialMount&&I<P+k){let L=g.style[m.paddingEndProp],A=r.current,M=A?.value===L?A.baseline:L,R=(P+k-I)*2,H=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+R}px`;g.style[m.paddingEndProp]=H,r.current={baseline:M,value:g.style[m.paddingEndProp]},g.offsetHeight,T(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let W=r.current;o.current=void 0,r.current=void 0,g.style[m.paddingEndProp]===W?.value&&(g.style[m.paddingEndProp]=W.baseline)})}else T()}else b&&T()}t.current=d,n.current=l||0}},[e]);return _N("scrollAdjust",s),_N("scrollAdjustUserOffset",s),null}var mj=Mn(function({ScrollComponent:t,...n},o){let[r]=No(["snapToOffsets"]);return Ne(t,{...n,ref:o,snapToOffsets:r})}),yx=.1;function gj(e,t,n){let o=Ie(e,t)!==n;return o&&(Be(e,t,n),Hi(e)),o}function hj(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:s,scrollingTo:i}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!i&&s>=c-yx&&Math.abs(l)>yx}function DN(e,t){let{state:n}=e,o=Ie(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>yx;r&&(Be(e,"headerSize",t),Hi(e),a&&hj(e,o,t)&&Ki(e,t-o)),n.didMeasureHeader=!0}function vj(e,t){let n=gj(e,"footerSize",t);return n&&pg(e),n}function yj(e,t){var n,o,r,a,s,i,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)&&((s=e?.left)!=null?s:0)===((i=t?.left)!=null?i:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function Cj(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!yj(o,r);return n.contentInsetOverride=r,a&&Hi(e),a}function xj(e,t){let n=gx(e),o=gx(t);return V(()=>Mn((r,a)=>{var s,i;return(i=(s=n.current)==null?void 0:s.call(n,o.current(r,a)))!=null?i:null}),[o,n])}var ON=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=N(null),a=t??r;return Ox({onLayoutChange:e,ref:a}),Ne("div",{...o,ref:a},n)},bj=Vr(function({horizontal:t}){let[n=0]=No(["alignItemsAtEndPadding"]);return n<=0?null:Ne(mg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),Sj=Vr(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:s,recycleItems:i,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:g,ListFooterComponentStyle:h,ListEmptyComponent:v,getRenderedItem:y,refScrollView:C,renderScrollComponent:x,onLayoutFooter:b,onInternalScrollBeginDrag:T,onInternalScrollEnd:I,scrollAdjustHandler:k,snapToIndices:P,stickyHeaderConfig:w,stickyHeaderIndices:L,useWindowScroll:A=!1,...M}){let R=Ir(),D=R.state.props.maintainVisibleContentPosition,[H=0,W=0]=No(["anchoredEndSpaceSize","otherAxisSize"]),F=R.state.props.alignItemsAtEndPaddingEnabled,J=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&H>0,O;if(J){let re=a?Ra(R.state)?"Left":"Right":"Bottom",Z=Su.flatten(r);O={[`padding${re}`]:uu({},Z||{},re)+H}}let B=dj({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:W}),Y=xj(x,(re,Z)=>({...re,ref:Z})),U=x?Y:NN,j=P?mj:U,oe=E((re,Z)=>{var te;let ue=vj(R,re);Z?.(),ue&&((te=R.state.props.maintainScrollAtEnd)!=null&&te.onFooterLayout)&&ad(R)},[R]);be(()=>{p||DN(R,0),g||oe(0)},[p,g,R,oe]);let Q=E(re=>{let Z=re[a?"width":"height"];DN(R,Z)},[R,a]),ne=E((re,Z)=>{let te=re[a?"width":"height"];oe(te,()=>{b?.(re,Z)})},[a,b,oe]);return Ne(j,{...M,...U===NN?{onInternalScrollEnd:I,useWindowScroll:A}:{},contentContainerStyle:[a?{height:"100%"}:{},r,O,{boxSizing:"border-box"}],contentOffset:s!==void 0?a?{x:s,y:0}:{x:0,y:s}:void 0,horizontal:a,maintainVisibleContentPosition:D.size||D.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:C,ScrollComponent:P?U:void 0,style:B?[B,o]:o},Ne(pj,null),p&&Ne(ON,{onLayoutChange:Q,style:m},ig(p)),v&&ig(v),F&&Ne(bj,{horizontal:a}),t&&!v&&Ne(jG,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:i,stickyHeaderConfig:w}),g&&Ne(ON,{onLayoutChange:ne,style:h},ig(g)),Mo&&SW)}),Ij=100,wj=.9,Tj=.9;function Pj(e){let t=Ir(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:s,useWindowScroll:i}=e,l=!!n;q(()=>{l&&(a??1)>1&&Oi("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),q(()=>{i&&s&&Oi("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[s,i]),q(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Oi("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<Ij)return;let p=()=>{let g=Ie(t,"readyToRender"),h=Ie(t,"numContainers")||0,v=Ie(t,"totalSize")||0,y=t.state.scrollLength||0;if(!g||v<=0||y<=0)return;let C=h>=Math.ceil(c*wj),x=y>=v*Tj;C&&x&&Oi("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=[Pa(t,"numContainers",p),Pa(t,"readyToRender",p),Pa(t,"totalSize",p)];return()=>{for(let g of m)g()}},[t])}function kj(e){}var Lj=Mo?Pj:kj;function Aj(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),g_(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 i=!n&&a?.onDataChange&&ad(e);!i&&r&&t.length>r.length&&(o.isEndReached=!1),i||yg(e),delete o.previousData}function Rj(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:s}}=e,i;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!s)return i&&(e.pendingDataComparison={byIndex:i,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:s(n[l],l),c=s(t[l],l);if(d!==c)return i&&(e.pendingDataComparison={byIndex:i,nextData:t,previousData:n}),!0;if(!a)return i&&(e.pendingDataComparison={byIndex:i,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(i??(i=[]),i[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:i,nextData:t,previousData:n},!0}return!1}function D_(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:s,getItemType:i,numColumns:l,estimatedItemSize:d}}=o,c=e_(e),f=Ie(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(s){let g=0,h=Math.min(20,a.length);for(let v=0;v<h;v++){let y=a[v];if(y!==void 0){let C=(t=i?.(y,v))!=null?t:"";g+=((n=s(y,v,C))!=null?n:d)+e.scrollAxisGap}}p=g/h}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let g=0;g<m;g++)Be(e,`containerPosition${g}`,nd),Be(e,`containerColumn${g}`,-1),Be(e,`containerSpan${g}`,1);return Be(e,"numContainers",m),Be(e,"numContainersPooled",oG(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{ka(e,{dataChanged:!0,doMVCP:!0})}):ka(e,{dataChanged:!0,doMVCP:!0})),!0}}function Ej(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function Mj(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,s=o.props.horizontal?"width":"height",i=o.props.horizontal?"height":"width",l=t;if(a){let v=Ej()[s];l=v>0?{...t,[s]:v}:t}let d=l[s],c=o.scrollLength,f=d>0?d:c,p=l[i],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let g=o.otherAxisSize,h=f!==o.scrollLength||p!==g;if(h){if(o.scrollLength=f,o.otherAxisSize=p,Hi(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&D_(e),m&&ka(e,{doMVCP:!0}),(h||p!==g)&&Be(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&ad(e),yg(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}Mo&&d===0&&Oi("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 Nj(e,t){let n=Wn.get(e);if(!!n&&Wn.didReachTarget(t,n)){Wn.clear(e);return}n&&(e.hasScrolled=!1,Wn.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function _j(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function Dj(e){return{...e,nativeEvent:{...e.nativeEvent}}}function Oj(e,t){var n,o,r,a,s,i;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=lW(l,f,(s=t.nativeEvent.contentSize)==null?void 0:s.width)),l.didFinishInitialScroll&&((i=l.initialScroll)==null?void 0:i.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=Ss(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,Ig(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Bi(e,f,c,{fromNativeScrollEvent:!0}),Nj(l,f),w4(e),l.scrollingTo&&Nx(e),l.props.onScroll&&(_j(l)?l.deferredPublicOnScrollEvent=Dj(t):l.props.onScroll(t))}var Fj=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()}},Bj=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,Be(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&Nx(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=Cg(this.ctx,e.index);o=bg(this.ctx,a,e),o=Ss(this.ctx,o,e)}else o=Ss(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,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),Be(this.ctx,"scrollAdjustPending",0),ka(this.ctx)}}}};function Uj(e,t){let n=e.state,o=Fi(e,t),a=Fi(e)-o;if(a!==0){let s=!!Ie(e,"isWithinMaintainScrollAtEndThreshold");Bi(e,n.scroll,!0,{markHasScrolled:!1}),!y_(e)&&s&&a>0&&Ki(e,a)}}function ix(e){return V(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var zj=(...e)=>E(n=>{for(let o of e)o&&(o_(o)?o(n):o.current=n)},e);function Hj(e){return null}function Kj(e,t,n,o){return o}function $j(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 qj(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,s=Ie(e,"footerSize")||0;return sg(e,{...t,index:r,viewOffset:-a-s+(t?.viewOffset||0),viewPosition:1}),!0}var Vj="default";function Wj(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||Vj]={average:o.avg,count:o.num})}return t}function Gj(e){fg(e)}function jj(e,t){let n=e.state,o=800,r=2,a=0,s=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,i=(h,v=!1)=>{var y;let C=n.props,x=C.data.length,b=(y=C.anchoredEndSpace)==null?void 0:y.anchorIndex;return h<0?v:h>=x?!1:b===void 0||b<0||b>=x||h<b?!0:zW(e,b,x-1)},l=(h,v,y)=>{let C=Date.now(),x=0,b=()=>{if(h!==a)return;s()||!y()?x=0:x+=1;let T=Date.now()-C>=o;if(x>=r||T){v();return}n.scheduledWork.frame(b,"imperativeScrollReady")};n.scheduledWork.frame(b,"imperativeScrollReady")},d=(h,v,y,C=()=>!0)=>{let x=()=>{if(h!==a)return;(!y()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};s()||!C()?l(h,x,C):x()},c=h=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return WN(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let C=c(y);pN(e),d(C,y,h,v)});n.runPendingScrollToEnd=()=>{let h=n.pendingScrollToEnd;h&&(n.pendingScrollToEnd=void 0,h.token===a&&d(h.token,h.resolve,()=>qj(e,h.options),()=>i(n.props.data.length-1,!0)))};let p=h=>{if(n){let{index:v,...y}=h,{startNoBuffer:C,endNoBuffer:x}=n;if(v<C||v>x){let b=v<C?0:1;return sg(e,{...y,index:v,viewPosition:b}),!0}}return!1},m=n.refScroller;return{clearCaches:h=>{var v,y;let C=(v=h?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),g_(n);for(let x in n.averageSizes)delete n.averageSizes[x];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Be(e,"totalSize",0),C==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),Gj(e),(y=n.triggerCalculateItemsInView)==null||y.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var h,v,y;return(y=(v=(h=m.current).getNativeScrollRef)==null?void 0:v.call(h))!=null?y:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:Ie(e,"activeStickyIndex"),contentLength:Zn(e),data:n.props.data,elementAtIndex:h=>{var v;return(v=e.viewRefs.get(ux(e,qt(n,h))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>Wj(n),indexByKey:h=>n.indexByKey.get(h),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:(h,v)=>Pa(e,h,v),listenToPosition:(h,v)=>mW(e,h,v),positionAtIndex:h=>n.positions[h],positionByKey:h=>{let v=n.indexByKey.get(h);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Sg(n),sizeAtIndex:h=>n.sizesKnown.get(qt(n,h)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:h=>{let v=Cj(e,h);Bi(e,n.scroll,!0,{markHasScrolled:!1}),v&&y_(e)},scrollIndexIntoView:h=>f(()=>p(h)),scrollItemIntoView:({item:h,...v})=>f(()=>{let C=n.props.data.indexOf(h);return C!==-1?(p({index:C,...v}),!0):!1}),scrollToEnd:h=>new Promise(v=>{var y;let C=c(v);n.pendingScrollToEnd={options:h,resolve:v,token:C},t?.(),pN(e),t||(y=n.runPendingScrollToEnd)==null||y.call(n)}),scrollToIndex:h=>f(()=>(sg(e,h),!0),h.index>=0?()=>i(h.index):void 0),scrollToItem:({item:h,...v})=>f(()=>{let C=n.props.data.indexOf(h);return C!==-1?(sg(e,{index:C,...v}),!0):!1}),scrollToOffset:h=>f(()=>(Ig(e,h),!0)),setItemSize:(h,v)=>{L_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=o_(h)?h(Ie(e,"scrollAdjustUserOffset")||0):h;Be(e,"scrollAdjustUserOffset",v)}}}var Qj=(e,t)=>e-t,FN=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,cu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function Xj(e,t,n,o){var r,a;if(t.length===0)return[];let s=new Set,i=t.length,l=FN(e?.top);if(l>0)for(let f=0;f<Math.min(l,i);f++)cu(s,i,f);let d=FN(e?.bottom);if(d>0)for(let f=Math.max(0,i-d);f<i;f++)cu(s,i,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&cu(s,i,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<i&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(cu(s,i,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:i;p<i;p++)cu(s,i,p)}let c=Array.from(s);return c.sort(Qj),c}function Yj(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:s,renderItem:i}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=Ie(e,"extraData"),f=a[l];if(i&&!mu(f)){let p={data:a,extraData:c,index:l,item:f,type:s&&(n=s(f,l))!=null?n:""};d=i(p)}return{index:l,item:a[l],renderedItem:d}}function BN(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 Jj(e){var t;return e?e===!0?{...BN(void 0,!1),animated:!1}:{...BN(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function Zj(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 e6(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;Be(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=Ie(e,"totalSize")||0,Be(e,"totalSize",r-o)},16)}Be(e,"stylePaddingTop",t)}}function t6(e){let t=N(null),n=N(0),o=N(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return E((s,i,...l)=>{{let d=Date.now();o.current=l,d-n.current>=i?(n.current=d,s(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),s(...o.current),t.current=null,o.current=null)},i-(d-n.current)))}},[e])}function n6(e,t){let n=t6("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var o6=Vr(A_(function(t,n){let{children:o,data:r,renderItem:a,...s}=t,l=o!==void 0&&r===void 0?{...s,childrenMode:!0,data:(xg(o)?o:Dg.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...s,data:r||[],renderItem:a};return Ne(uW,null,Ne(r6,{...l,ref:n}))})),r6=A_(function(t,n){var o,r,a,s,i,l,d,c,f,p,m,g,h,v,y,C,x,b,T;let I=E(Ve=>{},[]);t.recycleItems===void 0&&Oi("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:k=!1,anchoredEndSpace:P,alwaysRender:w,columnWrapperStyle:L,contentContainerStyle:A,contentInset:M,data:R=[],dataKey:D,dataVersion:H,drawDistance:W=250,contentInsetEndAdjustment:F,estimatedItemSize:J=100,estimatedListSize:O,extraData:B,getFixedItemSize:Y,getItemType:U,horizontal:j,rtl:oe,estimatedHeaderSize:Q,initialScrollAtEnd:ne=!1,initialScrollIndex:re,initialScrollOffset:Z,experimental_adaptiveRender:te,itemsAreEqual:ue,keyExtractor:Me,ListEmptyComponent:Oe,ListFooterComponent:ke,ListFooterComponentStyle:Ee,ListHeaderComponent:ee,maintainScrollAtEnd:Se=!1,maintainScrollAtEndThreshold:X=.1,maintainVisibleContentPosition:de,numColumns:le=1,overrideItemLayout:se,onEndReached:$e,onEndReachedThreshold:Tt=.5,onItemSizeChanged:gt,onMetricsChange:Lt,onLayout:it,onLoad:ct,onMomentumScrollEnd:ht,onRefresh:lt,onScroll:pt,onScrollBeginDrag:Pt,onStartReached:Ft,onStartReachedThreshold:gn=.5,onStickyHeaderChange:rt,onFirstVisibleItemChanged:At,onViewableItemsChanged:Bt,progressViewOffset:en,recycleItems:Vt=!1,refreshControl:Wt,refreshing:vn,refScrollView:$,renderScrollComponent:pe,renderItem:ge,scrollEventThrottle:ye,snapToIndices:Pe,stickyHeaderIndices:at,style:tn,useWindowScroll:bt=!1,viewabilityConfig:cn,viewabilityConfigCallbackPairs:st,...Je}=t,Rt=t.animatedPropsInternal,nn=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",Te=t.positionComponentInternal,Ke=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:qe,positionComponentInternal:ut,stickyPositionComponentInternal:tt,...nt}=Je,St=Su.flatten(A),Ut=k&&!j&&St?.minHeight==null&&R.length>0,bn=k&&!Ut&&(j?St?.minWidth==null:St?.minHeight==null),ln={...St,...k&&!Ut?{display:"flex",flexDirection:j?"row":"column",...bn?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},un={...Su.flatten(tn)},Gn=uu(un,ln,"Top"),Sn=uu(un,ln,"Bottom"),xe=uu(un,ln,"Left"),Ze=uu(un,ln,"Right"),Mt=Sx({horizontal:j,rtl:oe,stylePaddingBottom:Sn,stylePaddingLeft:xe,stylePaddingRight:Ze}),vt=Jj(Se),fn=Zj(de),yn=re!=null,dn=Z!=null,Jt=!ne&&!yn&&!dn&&bx({horizontal:j,rtl:oe}),jn=!ne&&!yn&&(dn||Jt),zt=ne||yn,Cn=ne?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-Mt,viewPosition:1}:yn?typeof re=="object"?{index:(r=re.index)!=null?r:0,preserveForBottomPadding:re.viewOffset===void 0&&re.viewPosition===1?!0:void 0,viewOffset:(a=re.viewOffset)!=null?a:re.viewPosition===1?-Mt:0,viewPosition:(s=re.viewPosition)!=null?s:0}:{index:re??0,viewOffset:Z??0}:jn?{contentOffset:Z??0,index:0,viewOffset:0}:void 0,[uo,Tr]=G(!wx),[,Wr]=ea(Ve=>Ve+1,0),ze=Ir();ze.columnWrapperStyle=L||(ln?$j(ln):void 0);let Pr=j?(d=(i=ze.columnWrapperStyle)==null?void 0:i.columnGap)!=null?d:(l=ze.columnWrapperStyle)==null?void 0:l.gap:(p=(c=ze.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=ze.columnWrapperStyle)==null?void 0:f.gap,er=typeof Pr=="number"&&Number.isFinite(Pr)?Pr:0,Gr=N(null),Is=zj(Gr,$),_o=Me??((Ve,Nt)=>Nt.toString()),no=at,jr=F,qi=N(jr),ws=V(()=>{let Ve=Xj(w,R,_o,P?.anchorIndex);return{arr:Ve,set:new Set(Ve)}},[P?.anchorIndex,w?.top,w?.bottom,(m=w?.indices)==null?void 0:m.join(","),(g=w?.keys)==null?void 0:g.join(","),R,D,H,_o]),zn=!!bt&&!pe,Pn=N(void 0),Do=!!se,Ts=N(Do);if(!Pn.current){if(!ze.state){let Ve=(O??{height:0,width:0})[j?"width":"height"];ze.values.set("adaptiveRender",(h=te?.initialMode)!=null?h:"normal"),ze.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:Cn,initialScrollSession:Cn?{kind:jn?"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 Fj,scroll:0,scrollAdjustHandler:new Bj(ze),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:Ve,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 Nt=ze.state;Nt.triggerCalculateItemsInView=pn=>ka(ze,pn),Nt.reprocessCurrentScroll=()=>Bi(ze,Nt.scroll,!0),Be(ze,"maintainVisibleContentPosition",fn),Be(ze,"extraData",B),Q!==void 0&&Be(ze,"headerSize",Q)}Pn.current=ze.state}let He=Pn.current,Co=He.isFirst,Ps=He.props.adaptiveRender,kr=He.props.numColumns,Qr=!Co&&ze.scrollAxisGap!==er;ze.scrollAxisGap=er,He.didColumnsChange=le!==kr||Qr;let Na=(y=(v=He.props.data)==null?void 0:v.length)!=null?y:0,ks=He.props.data!==R,tr=He.props.dataKey!==D,Xr=He.props.dataVersion!==H,En=tr||Xr||ks&&Rj(He,R,He.props.data),nr=!Co&&En&&He.hasHadNonEmptyData&&(tr||Na===0)&&R.length>0;En&&!ne&&He.didFinishInitialScroll&&((C=He.initialScroll)==null?void 0:C.viewPosition)===1&&He.props.data.length>0&&od(He),En&&(He.dataChangeEpoch+=1,He.dataChangeNeedsScrollUpdate=!0,He.didDataChange=!0,He.previousData=He.props.data),nr&&(He.freshDataTransitionEpoch+=1);let Ls=n6(pt??I,ye??0),As=ye&&pt?Ls:pt,Lr=!Co&&!En&&((x=He.props.anchoredEndSpace)==null?void 0:x.anchorIndex)!==P?.anchorIndex;He.props={adaptiveRender:te,alignItemsAtEnd:k,alignItemsAtEndPaddingEnabled:Ut,alwaysRender:w,alwaysRenderIndicesArr:ws.arr,alwaysRenderIndicesSet:ws.set,anchoredEndSpace:P,anchoredEndSpaceOwner:nn,animatedProps:Rt,contentContainerAlignItems:ln.alignItems,contentInset:M,contentInsetEndAdjustment:jr,data:R,dataKey:D,dataVersion:H,drawDistance:W,estimatedItemSize:J,getFixedItemSize:ix(Y),getItemType:ix(U),horizontal:!!j,itemsAreEqual:ue,keyExtractor:ix(_o),maintainScrollAtEnd:vt,maintainScrollAtEndThreshold:X,maintainVisibleContentPosition:fn,numColumns:le,onEndReached:$e,onEndReachedThreshold:Tt,onFirstVisibleItemChanged:At,onItemSizeChanged:gt,onLoad:ct,onMomentumScrollEnd:ht,onScroll:As,onScrollBeginDrag:Pt,onStartReached:Ft,onStartReachedThreshold:gn,onStickyHeaderChange:rt,overrideItemLayout:se,positionComponentInternal:Te,recycleItems:!!Vt,renderItem:ge,rtl:oe,snapToIndices:Pe,stickyHeaderIndicesArr:no??[],stickyHeaderIndicesSet:V(()=>new Set(no??[]),[no?.join(",")]),stickyPositionComponentInternal:Ke,stylePaddingBottom:Sn,stylePaddingLeft:xe,stylePaddingRight:Ze,stylePaddingTop:Gn,useWindowScroll:zn},He.refScroller=Gr,!Co&&Ps&&!te&&Tx(ze);let Vi=V(()=>R.length?Array.from({length:Math.min(le,R.length)},(Ve,Nt)=>qt(He,R.length-1-Nt)):[],[R,D,H,le]),xn=Ve=>{Be(ze,"lastItemKeys",Vi),Be(ze,"numColumns",le);let Nt=Ie(ze,"stylePaddingTop");e6(ze,{stylePaddingTop:Gn}),Pn.current.props.stylePaddingBottom=Sn,Hi(ze);let pn=Gn-Nt;Ve&&fn.size&&pn&&Nt!==void 0&&La.OS};Co&&(xn(!1),C_(He),b_(ze,!0));let Rs=V(()=>{var Ve,Nt;let pn=He.initialScroll;if(!pn)return;let on=(Ve=pn.contentOffset)!=null?Ve:Sr(ze,pn);return zt&&((Nt=He.initialScrollSession)==null?void 0:Nt.kind)==="bootstrap"&&La.OS==="web"?void 0:on},[zt]);be(()=>{q4(ze,{alwaysDispatchInitialScroll:Jt,dataLength:R.length,hasFooterComponent:!!ke,initialContentOffset:Rs,initialScrollAtEnd:ne,useBootstrapInitialScroll:zt})},[]),(Co||En||He.didColumnsChange)&&(Pn.current.lastBatchingAction=Date.now(),!Me&&!Co&&En&&(Pn.current.sizes.clear(),Pn.current.positions.length=0,Pn.current.totalSize=0,Be(ze,"totalSize",0))),Mo&&Lj(t),be(()=>{nr&&kx(ze,{resetInitialScroll:!!Cn,resetLayout:!0}),V4(ze,{dataLength:R.length,didDataChange:En,didStartFreshData:nr,initialScrollAtEnd:ne,latestInitialScroll:Cn,latestInitialScrollSessionKind:jn?"offset":"bootstrap",stylePaddingEnd:Mt,useBootstrapInitialScroll:zt})},[R.length,D,En,nr,ne,Mt,zt]),be(()=>{var Ve;Lr&&(He.scrollForNextCalculateItemsInView=void 0,(Ve=He.triggerCalculateItemsInView)==null||Ve.call(He)),pg(ze)},[ze,R,H,P?.anchorIndex,P?.anchorMaxSize,P?.anchorOffset,Lr,j,le,oe,Sn,xe,Ze]),be(()=>{let Ve=qi.current;qi.current=jr,Uj(ze,Ve)},[ze,jr]);let _a=E(Ve=>{zt&&k4(ze,{dataLength:R.length,footerSize:Ve[j?"width":"height"],initialScrollAtEnd:ne,stylePaddingEnd:Mt})},[R.length,ne,j,Mt,zt]),Da=E((Ve,Nt)=>{let pn=He.scrollLength,on=He.otherAxisSize;Mj(ze,Ve,Tr),pg(ze);let Es=pn!==He.scrollLength||on!==He.otherAxisSize;zt&&!Nt&&Es&&L4(ze),!zt&&Cu(ze)},[R.length,ne,Mt,zt]),{onLayout:Yr}=Ox({onLayoutChange:Da,onLayoutProp:it,ref:Gr});be(()=>{Pe&&x_(ze)},[Pe]),be(()=>xn(!0),[D,H,Vi.join(","),le,er,Sn,Gn,Ut]),be(()=>{let{didColumnsChange:Ve,didDataChange:Nt,isFirst:pn,props:{data:on}}=He;!(on.length>0&&D_(ze))&&!pn&&(Nt||Ve)&&Aj(ze,on,{didColumnsChange:Ve}),Nt&&(He.pendingDataComparison=void 0),He.didColumnsChange=!1,He.didDataChange=!1,He.isFirst=!1},[R,D,H,le,er]),be(()=>{var Ve;Be(ze,"extraData",B);let Nt=Ts.current!==Do;Ts.current=Do,(Do||Nt)&&le>1&&((Ve=He.triggerCalculateItemsInView)==null||Ve.call(He,{forceFullItemPositions:!0}))},[B,Do,le]),q(()=>{if(!Lt)return;let Ve,Nt=()=>{let on={footerSize:Ie(ze,"footerSize")||0,headerSize:Ie(ze,"headerSize")||0};(!Ve||on.headerSize!==Ve.headerSize||on.footerSize!==Ve.footerSize)&&(Ve=on,Lt(on))};Nt();let pn=[Pa(ze,"headerSize",Nt),Pa(ze,"footerSize",Nt)];return()=>{for(let on of pn)on()}},[ze,Lt]),q(()=>{let Ve=Y4({onViewableItemsChanged:Bt,viewabilityConfig:cn,viewabilityConfigCallbackPairs:st});He.viewabilityConfigCallbackPairs=Ve,He.enableScrollForNextCalculateItemsInView=!0,Ve&&(He.scrollForNextCalculateItemsInView=void 0)},[cn,st,Bt]),AG(()=>{}),Oo(n,()=>jj(ze,Wr),[]),q(()=>()=>{wW(He),He.scheduledWork.dispose()},[He]),be(()=>{var Ve;(Ve=He.runPendingScrollToEnd)==null||Ve.call(He)}),q(()=>{zt||Cu(ze)},[ze,zt]);let fo=V(()=>({getRenderedItem:Ve=>Yj(ze,Ve),onMomentumScrollEnd:Ve=>{K4(ze),He.props.onMomentumScrollEnd&&He.props.onMomentumScrollEnd(Ve)},onScroll:Ve=>Oj(ze,Ve),onScrollBeginDrag:Ve=>{var Nt,pn;cN(ze),(pn=(Nt=He.props).onScrollBeginDrag)==null||pn.call(Nt,Ve)},onScrollEnd:()=>cN(ze)}),[]),Ar=Kj(no,j,ze,fo.onScroll),or=Wt;return Ne(Ba,null,Ne(Sj,{...nt,alignItemsAtEnd:k,canRender:uo,contentContainerStyle:ln,contentInset:M,freshDataTransitionEpoch:He.freshDataTransitionEpoch,getRenderedItem:fo.getRenderedItem,horizontal:j,initialContentOffset:Rs,ListEmptyComponent:R.length===0?Oe:void 0,ListFooterComponent:ke,ListFooterComponentStyle:Ee,ListHeaderComponent:ee,onInternalScrollBeginDrag:fo.onScrollBeginDrag,onInternalScrollEnd:fo.onScrollEnd,onLayout:Yr,onLayoutFooter:_a,onMomentumScrollEnd:fo.onMomentumScrollEnd,onScroll:Ar,recycleItems:Vt,refreshControl:or?Gn>0?Eu(or,{progressViewOffset:((b=or.props.progressViewOffset)!=null?b:0)+Gn}):or:lt&&Ne(Hj,{onRefresh:lt,progressViewOffset:(en||0)+Gn,refreshing:!!vn}),refScrollView:Is,renderScrollComponent:pe,scrollAdjustHandler:(T=Pn.current)==null?void 0:T.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:Pe,stickyHeaderIndices:no,style:un,useWindowScroll:zn}),Mo&&IW)});var a6=o6;var O_=a6;ie();ie();var Fx="model:",Bx="unavailable-models:",Ux="action:",sd="pluginActions:manage";function wu(e,t){return`${Fx}${e.length}:${e}${t}`}function zx(e){if(!e.startsWith(Fx))return null;let t=e.slice(Fx.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 F_(e){return`${Bx}${e}`}function B_(e){return e.startsWith(Bx)?e.slice(Bx.length):null}function Tu(e){return`${Ux}${e}`}function U_(e){if(!e.startsWith(Ux))return null;let t=e.slice(Ux.length);return t.length>0?t:null}var z_=Ce(function(t){let{t:n}=fe(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.model.subProvider,t.providerAccountEmail].filter(i=>typeof i=="string"&&i.length>0).join(" \xB7 "),a=S(Zi,{hideIndicator:!0,index:t.index,value:wu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:K("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:[S("div",{className:"min-w-0 flex-1 text-left",children:[S("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?Zl(t.model):HC(t.model,t.preferShortName?{preferShortName:!0}:void 0)}),t.model.isUnavailable?u(Or,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]}),t.showProvider&&S("div",{className:"mt-1 flex items-center gap-1.5",children:[u(rr,{driver:t.driver,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})]})]}),S("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(cf,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,S(je,{children:[u(Xe,{render:u(ce,{size:"icon-xs",variant:"ghost",className:K("-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:i=>{i.stopPropagation(),t.onToggleFavorite()},onKeyDown:i=>{i.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(Xs,{className:K("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Qe,{side:"top",align:"center",children:o})]})]})]}),s=t.disabledReason??t.actionLabel;return s?S(je,{children:[u(Xe,{render:a}),u(Qe,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:s})]}):a});ie();function s6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(rM(o))return n;let r=sM(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 i6="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",l6="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 ",d6=`${l6} text-update-foreground`,H_="left",K_=8,$_="max-w-64 text-balance font-normal leading-snug",q_=Ce(function(t){let{t:n}=fe(),{t:o}=fe(),r=Et().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},s=t.showFavorites??!0,[i,l]=G(null),d=N(null),[c,f]=G(null);return be(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(g=>g.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,s]),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:S("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:K(i6,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,s?S(we,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:S(je,{children:[u(Xe,{render:u("button",{className:K("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(Xs,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Qe,{side:H_,sideOffset:K_,align:"center",className:$_,children:n("modelPicker.favorites")})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Qm(p),g=t.disabledInstanceIds?.has(p.instanceId)??!1,h=m||g,v=t.selectedInstanceId===p.instanceId,y=i===p.instanceId,C=r(p.snapshot),x=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),b=m?s6(p,o):g?t.getDisabledInstanceTooltip?.(p)??p.displayName:C?`${p.displayName} \u2014 ${x}`:p.displayName,T=S("button",{className:K("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))]",h&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!h&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(k=>k===p.instanceId?null:k),onFocus:()=>l(p.instanceId),onBlur:()=>l(k=>k===p.instanceId?null:k),disabled:h,type:"button","aria-label":h?b:p.displayName,children:[u(rr,{driver:p.driverKind,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:y&&!h?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),C?u("span",{className:d6,"aria-hidden":!0,children:u($u,{className:"size-2.5"})}):null]}),I=h?u("span",{className:"relative block w-full",children:T}):T;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:S(je,{children:[u(Xe,{render:I}),S(Qe,{side:H_,sideOffset:K_,align:"center",className:$_,children:[b,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function V_(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}function W_(e){return e.instanceReady?!0:e.entry.enabled&&e.entry.driverKind==="opencode"&&e.instanceId===e.activeInstanceId&&e.option.slug===e.activeModel&&e.option.isUnavailable===!0}function to(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function c6(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let s=0;s<e.length;s+=1)if(e[s]===t[n]&&(o===-1&&(o=s),r!==-1&&(a+=s-r-1),r=s,n+=1,n===t.length)){let i=s-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+i+l}return null}function Hx(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function u6(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let s=a+r.length;(o===null||s<o)&&(o=s)}return o}function wr(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+Hx(t,n);if(e.boundaryBase!==void 0){let o=u6(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+Hx(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+Hx(t,n)}if(e.fuzzyBase!==void 0){let o=c6(t,n);if(o!==null)return e.fuzzyBase+o}return null}function f6(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function p6(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;f6(t,a)<0?o=r:n=r+1}return n}function Pg(e,t,n){if(n<=0)return;let o=p6(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var m6=24;function g6(e){return[to(e.name),...e.shortName?[to(e.shortName)]:[],...e.subProvider?[to(e.subProvider)]:[],to(e.driverKind),to(e.providerDisplayName),...e.providerAccountEmail?[to(e.providerAccountEmail)]:[],Kx(e),...e.slug?[to(e.slug)]:[]]}function h6(e,t,n){return wr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function Kx(e){return to([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function G_(e,t){let n=to(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 s=0;s<e.length;s+=1){let i=h6(e[s],r,s*10);i!==null&&a.push(i)}if(a.length===0)return null;o+=Math.min(...a)}return o}function j_(e,t){let n=G_(g6(e),t);return n===null?null:e.isFavorite?n-m6:n}function Q_(e,t){return G_([to(e.title),to(e.description??"")],t)}function X_({top:e,bottom:t}){if(!(!e&&!t))return K("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 Y_(e,t){return`${e}:${t}`}var J_=new Map,Z_=[],v6=[],y6=[];function Pu(e){return wu(e.instanceId,e.slug)}function eD(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function C6(){return u("div",{className:"h-0.5"})}function $x(e){return e?.trim()||null}function tD({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 x6=Ce(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=fe(),s=$x(o.description);return S(we,{children:[r?u(tD,{label:a("modelPicker.plugins")}):null,S(Zi,{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(Gs,{className:"size-4 shrink-0 text-muted-foreground/70"}),S("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:s})]})]})]})}),b6=Ce(function({index:t,showSectionHeader:n}){let{t:o}=fe();return S(we,{children:[n?u(tD,{label:o("modelPicker.plugins")}):null,S(Zi,{hideIndicator:!0,index:t,value:sd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(vd,{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")})]})]})}),nD=Ce(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,hideInstanceRail:a=!1,getModelDisabledReason:s,getModelContinuationLabel:i,onContinueInModel:l,onInstanceModelChange:d,onManagePlugins:c,onSelectPluginAction:f}=t,p=t.pluginActions??Z_,m=t.selectedPluginActionKey??null,{t:g}=fe(),{t:h}=fe(),v=Et(),[y,C]=G(""),[x,b]=G(!1),[T,I]=G(!1),k=N(null),P=N(null),w=N(null),L=v.environment.useActiveEnvironmentId(),A=v.settings.useClientSettings($=>$.favorites??[]),M=V(()=>L===null?y6:A.filter($=>$.environmentId===L),[L,A]),R=(o.get(t.activeInstanceId)??[]).some($=>$.slug===t.model&&$.isUnavailable===!0),[D,H]=G(()=>t.lockedProvider!==null||R?t.activeInstanceId:M.length>0?"favorites":t.activeInstanceId),[W,F]=G(()=>new Set),J=V(()=>n??[],[n]),O=v.settings.useUpdateClientSettings(),B=E(()=>{k.current?.focus({preventScroll:!0})},[]),Y=E($=>{H($),window.requestAnimationFrame(()=>{B()})},[B]);be(()=>{B();let $=window.requestAnimationFrame(()=>{B()}),pe=window.setTimeout(()=>{B()},0);return()=>{window.cancelAnimationFrame($),window.clearTimeout(pe)}},[B]);let U=V(()=>new Set(M.map($=>Y_($.instanceId,$.model))),[M]),j=E($=>L===null?!1:M.some(pe=>eD($,pe,L)),[L,M]),oe=V(()=>new Map(r.map($=>[$.instanceId,$])),[r]),Q=E($=>t.lockedProvider===null?!0:$.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?$.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),ne=V(()=>{let $=new Set;for(let pe of r)Qm(pe)&&$.add(pe.instanceId);return $},[r]),re=V(()=>{let $=[];for(let[pe,ge]of o){let ye=oe.get(pe);if(!ye)continue;let Pe=ne.has(pe);for(let at of ge)W_({entry:ye,instanceReady:Pe,instanceId:pe,option:at,activeInstanceId:t.activeInstanceId,activeModel:t.model})&&$.push({slug:at.slug,name:at.name,...at.shortName?{shortName:at.shortName}:{},...at.subProvider?{subProvider:at.subProvider}:{},...at.isUnavailable?{isUnavailable:!0}:{},instanceId:pe,driverKind:ye.driverKind,instanceDisplayName:ye.displayName,...ye.accentColor?{instanceAccentColor:ye.accentColor}:{},...ye.accountEmail?{instanceAccountEmail:ye.accountEmail}:{},...ye.continuationGroupKey?{continuationGroupKey:ye.continuationGroupKey}:{}})}return $},[o,oe,ne,t.activeInstanceId,t.model]),Z=t.lockedProvider!==null,te=y.trim().length>0,ue=V(()=>{if(!Z)return;let $=new Set;for(let pe of r)Q(pe)||$.add(pe.instanceId);return $},[r,Z,Q]),Me=V(()=>{let $=r.filter(lu);if(!Z)return $;let pe=[],ge=[];for(let ye of $)Q(ye)?pe.push(ye):ge.push(ye);return[...pe,...ge]},[r,Z,Q]),Oe=!a&&!te&&Me.length>0,ke=V(()=>r.map($=>$.instanceId),[r]),Ee=V(()=>{let $=re;if(y.trim()){let pe=$.map(ge=>({model:ge,score:j_({name:ge.name,...ge.shortName?{shortName:ge.shortName}:{},...ge.subProvider?{subProvider:ge.subProvider}:{},driverKind:ge.driverKind,providerDisplayName:ge.instanceDisplayName,...ge.instanceAccountEmail?{providerAccountEmail:ge.instanceAccountEmail}:{},isFavorite:j(ge)},y),isFavorite:j(ge),tieBreaker:Kx({name:ge.name,...ge.shortName?{shortName:ge.shortName}:{},...ge.subProvider?{subProvider:ge.subProvider}:{},driverKind:ge.driverKind,providerDisplayName:ge.instanceDisplayName,...ge.instanceAccountEmail?{providerAccountEmail:ge.instanceAccountEmail}:{}})})).filter(ge=>ge.score!==null);if(t.lockedProvider!==null){let ge=[];for(let ye of pe)Q(ye.model)&&ge.push(ye);return ge.toSorted((ye,Pe)=>{let at=ye.score-Pe.score;return at!==0?at:ye.isFavorite!==Pe.isFavorite?ye.isFavorite?-1:1:ye.tieBreaker.localeCompare(Pe.tieBreaker)}).map(ye=>ye.model)}return pe.toSorted((ge,ye)=>{let Pe=ge.score-ye.score;return Pe!==0?Pe:ge.isFavorite!==ye.isFavorite?ge.isFavorite?-1:1:ge.tieBreaker.localeCompare(ye.tieBreaker)}).map(ge=>ge.model)}return t.lockedProvider!==null?($=$.filter(pe=>Q(pe)),D==="favorites"?$=$.filter(pe=>j(pe)):$=$.filter(pe=>pe.instanceId===D)):D==="favorites"?$=$.filter(pe=>j(pe)):$=$.filter(pe=>pe.instanceId===D),v.model.sortProviderModelItems($,{favoriteModelKeys:U,groupFavorites:D!=="favorites",instanceOrder:D==="favorites"?ke:[]})},[U,re,ke,Q,t.lockedProvider,y,D,j]),ee=E(($,pe)=>v.model.resolvePickerRowAction({disabledReason:s?.($,pe)??null,continuationLabel:l?i?.($,pe)??null:null}),[i,s,l]),Se=E($=>ee($.instanceId,$.slug),[ee]),X=V(()=>V_(Ee,$=>Se($).kind==="blocked"),[Ee,Se]),de=V(()=>X.unavailable.length===0?null:{key:F_(D),models:X.unavailable,isExpanded:W.has(D)},[W,X,D]),le=V(()=>[...X.current,...de?.isExpanded?de.models:[]],[X,de]),se=f!==void 0,$e=V(()=>{if(!se)return Z_;let $=y.trim();return $.length===0?p:p.map(pe=>({action:pe,score:Q_(pe,$)})).filter(pe=>pe.score!==null).toSorted((pe,ge)=>pe.score-ge.score||pe.action.title.localeCompare(ge.action.title)).map(pe=>pe.action)},[y,p,se]),Tt=se&&(!te||$e.length>0),gt=V(()=>Tt?[...$e.map($=>Tu($.id)),sd]:v6,[Tt,$e]),Lt=V(()=>new Map($e.map($=>[Tu($.id),$])),[$e]),it=gt[0]??null,ct=E($=>{F(pe=>{let ge=new Set(pe);return ge.has($)?ge.delete($):ge.add($),ge})},[]),ht=E(($,pe)=>{let ge=ee(pe,$);if(ge.kind==="blocked")return;if(ge.kind==="continue"){l?.(pe,$);return}let ye=o.get(pe);if(!ye||!oe.has(pe))return;let Pe=v.model.resolveSelectableModel($,ye);Pe&&d(pe,Pe)},[oe,o,l,d,ee]),lt=E($=>{let pe=B_($);if(pe){ct(pe);return}if($===sd){c?.();return}let ge=U_($);if(ge!==null){f?.(ge);return}let ye=le.find(at=>Pu(at)===$);if(!ye||Se(ye).kind==="blocked")return;let Pe=zx($);Pe&&ht(Pe.slug,Pe.instanceId)},[ht,c,f,ct,le,Se]),pt=E($=>{if(L===null)return;let pe=A.findIndex(ye=>eD($,ye,L)),ge=[...A];pe>=0?ge.splice(pe,1):ge.push({environmentId:L,instanceId:$.instanceId,model:$.slug}),O({favorites:ge})},[L,A,O]),Pt=V(()=>{let $=new Map,pe=0;for(let ge of le){if(ee(ge.instanceId,ge.slug).kind==="blocked")continue;let ye=v.keybindings.modelPickerJumpCommandForIndex(pe);if(!ye)return $;$.set(Pu(ge),ye),pe+=1}return $},[ee,le]),Ft=V(()=>[...Pt.keys()],[Pt]),gn=V(()=>[...re.map($=>Pu($)),...de?[de.key]:[],...se?[...p.map($=>Tu($.id)),sd]:[]],[re,p,se,de]),rt=V(()=>{let $=le.map(pe=>Pu(pe));return de&&$.splice(X.current.length,0,de.key),gt.length>0?[...$,...gt]:$},[de,X,gt,le]),At=V(()=>new Map(le.map($=>[Pu($),$])),[le]),Bt=E(()=>{let $=P.current?.getScrollableNode();if(!($ instanceof HTMLElement))return;let pe=Math.max(0,$.scrollHeight-$.clientHeight);b($.scrollTop>1),I(pe-$.scrollTop>1)},[]),en=V(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Vt=V(()=>{if(Pt.size===0)return J_;let $={platform:navigator.platform,context:en},pe=new Map;for(let[ge,ye]of Pt){let Pe=v.keybindings.shortcutLabelForCommand(J,ye,$);Pe&&pe.set(ge,Pe)}return pe.size>0?pe:J_},[J,Pt,en]),Wt=m===null?wu(t.activeInstanceId,t.model):Tu(m),vn=V(()=>({favoritesSet:U,modelJumpLabelByKey:Vt,selectedItemKey:Wt}),[U,Vt,Wt]);return v.pane.useKeydown($=>{if($.defaultPrevented||$.repeat)return;let pe=v.keybindings.resolveShortcutCommand($,J,{platform:navigator.platform,context:en}),ge=v.keybindings.modelPickerJumpIndexFromCommand(pe??"");if(ge===null)return;let ye=Ft[ge];if(!ye)return;let Pe=zx(ye);Pe&&($.preventDefault(),$.stopPropagation(),ht(Pe.slug,Pe.instanceId))},{capture:!0}),be(()=>{b(!1),I(rt.length>5);let $=0,pe=window.requestAnimationFrame(()=>{Bt(),$=window.requestAnimationFrame(Bt)});return()=>{window.cancelAnimationFrame(pe),window.cancelAnimationFrame($)}},[rt,Bt]),u(uS,{delay:0,children:S("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:[Oe&&u(q_,{selectedInstanceId:D,onSelectInstance:Y,instanceEntries:Me,showFavorites:!0,...ue?{disabledInstanceIds:ue,getDisabledInstanceTooltip:$=>h("instance.lockedToThread",{name:$.displayName})}:{}}),u(iS,{inline:!0,items:gn,filteredItems:rt,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:Wt,onItemHighlighted:($,pe)=>{w.current=typeof $=="string"?$:null,pe.reason==="keyboard"&&pe.index>=0&&P.current?.scrollIndexIntoView?.({index:pe.index,animated:!1})},onValueChange:$=>{typeof $=="string"&&lt($)},children:S("div",{className:K("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",Oe&&"border-l border-border/70"),children:[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(dS,{ref:k,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:g("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(Qs,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:y,onChange:$=>C($.target.value),onKeyDown:$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),t.onRequestClose?.();return}if($.key==="Enter"&&w.current){$.preventBaseUIHandler?.(),$.preventDefault(),$.stopPropagation(),lt(w.current);return}$.stopPropagation()},onMouseDown:$=>$.stopPropagation(),onTouchStart:$=>$.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(cS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(O_,{ref:P,data:rt,extraData:vn,keyExtractor:$=>$,renderItem:({item:$,index:pe})=>{let ge=de?.key===$?{label:g("modelPicker.unavailableModels"),count:de.models.length,isExpanded:de.isExpanded}:null;if(ge)return S(Zi,{hideIndicator:!0,index:pe,value:$,"aria-expanded":ge.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[S("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:ge.label}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:g("modelPicker.modelCount",{count:ge.count})})]}),u(So,{className:K("size-4 transition-transform",ge.isExpanded&&"rotate-90")})]});let ye=Lt.get($);if(ye)return u(x6,{index:pe,itemKey:$,action:ye,showSectionHeader:$===it});if($===sd)return u(b6,{index:pe,showSectionHeader:$===it});let Pe=At.get($);if(!Pe)return null;let at=Se(Pe);return u(z_,{index:pe,model:Pe,instanceId:Pe.instanceId,driver:Pe.driverKind,providerDisplayName:Pe.instanceDisplayName,providerAccentColor:Pe.instanceAccentColor,providerAccountEmail:Pe.instanceAccountEmail,isFavorite:j(Pe),isSelected:$===Wt,showProvider:!0,preferShortName:!Z,useTriggerLabel:!1,jumpLabel:Vt.get($)??null,disabledReason:at.kind==="blocked"?at.reason:null,actionLabel:at.kind==="continue"?at.label:null,onToggleFavorite:()=>pt(Pe)},$)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:C6,onLayout:Bt,onScroll:Bt,className:K("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",X_({top:x,bottom:T}))})})}),u(lS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:g("modelPicker.noModelsFound")})]})})]})})});function S6(e){let t=e.unknownModelLabel?.trim();if(t)return t;let n=e.catalogOptions.find(o=>o.slug===e.model);return n?Zl(n):e.model}var qx=Ce(function(t){let{t:n}=fe(),[o,r]=G(!1),s=Mr()&&(t.open??o),i=V(()=>t.instanceEntries.find(b=>b.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=Ym(t.modelStatus??"known"),f=S6({model:t.model,catalogOptions:d,unknownModelLabel:c?n(c.seatKey):null}),p=c===null&&d.some(b=>b.slug===t.model&&b.isUnavailable===!0),m=b=>{t.onOpenChange?.(b),t.open===void 0&&r(b)};q(()=>{if(!s)return;let{documentElement:b,body:T}=document,I=b.style.overscrollBehavior,k=T.style.overflow,P=T.style.paddingRight,w=window.innerWidth-b.clientWidth;b.style.overscrollBehavior="contain",T.style.overflow="hidden",w>0&&(T.style.paddingRight=`${w}px`);let L=R=>R instanceof Element&&R.closest("[data-model-picker-content]"),A=R=>{L(R.target)||R.preventDefault()},M=R=>{L(R.target)||R.preventDefault()};return document.addEventListener("wheel",A,{capture:!0,passive:!1}),document.addEventListener("touchmove",M,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",A,{capture:!0}),document.removeEventListener("touchmove",M,{capture:!0}),b.style.overscrollBehavior=I,T.style.overflow=k,T.style.paddingRight=P}},[s]);let g=(b,T)=>{t.disabled||(t.onInstanceModelChange(b,T),m(!1))},h=(b,T)=>{t.disabled||(t.onContinueInModel?.(b,T),m(!1))},v=b=>{t.disabled||(t.onSelectPluginAction?.(b),m(!1))},y=()=>{t.onManagePlugins?.(),m(!1)},C=t.selectedPluginActionKey==null?null:t.pluginActions?.find(b=>b.id===t.selectedPluginActionKey)??null,x=C?$x(C.description):null;return S(Wa,{open:s,onOpenChange:b=>{if(t.disabled){m(!1);return}m(b)},children:[S(ja,{render:u(Ro,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:K("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:C?S(we,{children:[u(Gs,{className:"size-4 shrink-0"}),S(je,{children:[S(Xe,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:C.title}),x?S("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",x]}):null]}),u(Qe,{side:"top",children:x?`${C.title} \xB7 ${x}`:C.title})]})]}):S(we,{children:[t.showInstanceOnTrigger!==!1&&i?u(rr,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:K("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,S(je,{children:[u(Xe,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:f}),u(Qe,{side:"top",children:p?n("modelPicker.unavailableLabel",{name:f}):f})]}),p?u(Or,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(qr,{})})]}),u(Ga,{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(nD,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.hideInstanceRail?{hideInstanceRail:!0}:{},...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>m(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:g,...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:v}:{},...t.onManagePlugins?{onManagePlugins:y}:{}})})]})});function oD(e){let{slots:t,...n}=e,o=u(qx,{...n,hideInstanceRail:!0,showInstanceOnTrigger:!1}),r=t?.renderSlot("conversation.input.model",n,o);return u("span",{"data-conversation-slot":"conversation.input.model",children:r??o})}function rD(e){return u(qx,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}ie();function aD(e){return e.description??e.name}var sD=Ce(function(t){let{t:n}=fe(),{current:o,modes:r}=t.nativeMode,a=aD(o);return!t.canSwitch||r.length<2?S(je,{children:[S(Xe,{render:u(Ro,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Eo,{icon:Qi}),u("span",{children:o.name})]}),S(Qe,{side:"top",children:[u("span",{className:"block font-medium",children:a}),r.length>1?u("span",{className:"mt-1 block text-muted-foreground text-xs",children:n("composer.agentModesList",{modes:r.map(s=>s.name).join(", ")})}):null]})]}):S(we,{children:[S(je,{children:[S(qu,{value:o.id,onValueChange:s=>t.onNativeModeChange(s),children:[S(Xe,{render:u(Xm,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Eo,{icon:Qi}),u(Gu,{children:o.name})]}),S(Wu,{alignItemWithTrigger:!1,children:[r.map(s=>u(Vu,{value:s.id,hideIndicator:!0,className:"min-w-56 py-2",children:S("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:s.name}),s.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:s.description}):null]})},s.id)),t.appliesNextTurn?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Qe,{side:"top",children:t.appliesNextTurn?`${a} ${n("runtimeMode.appliesNextTurnHint")}`:a})]}),t.appliesNextTurn?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:n("runtimeMode.appliesNextTurn")}):null]})});function Vx(e){let{t}=fe(),n=Wm();if(e.nativeMode)return u(sD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let o=n(e.runtimeMode),r=o.icon,a=e.runtimeModeSwitch==="next-turn";return S(we,{children:[S(je,{children:[S(qu,{value:e.runtimeMode,onValueChange:s=>e.onRuntimeModeChange(s),children:[S(Xe,{render:u(Xm,{"data-composer-permission":"true","data-composer-runtime-mode-switch":e.runtimeModeSwitch,className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[u(Eo,{icon:r}),u(Gu,{children:o.label})]}),S(Wu,{alignItemWithTrigger:!1,children:[br.map(s=>{let i=n(s),l=i.icon;return u(Vu,{value:s,hideIndicator:!0,className:"min-w-64 py-2",children:S("span",{className:"flex items-center gap-2",children:[u(l,{className:"size-4"}),i.label]})},s)}),a?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:t("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Qe,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):o.label})]}),a?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:t("runtimeMode.appliesNextTurn")}):null]})}function iD(e){return u(Vx,{...e})}function Wx(e){let{t}=fe();if(!e.showInteractionModeToggle)return null;let n=e.interactionMode==="plan",o=t(n?"composer.planModeTooltip":"composer.defaultModeTooltip");return S(je,{children:[S(Xe,{render:u(Ro,{"data-composer-plan-toggle":"true",className:K("shrink-0 whitespace-nowrap",n?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":o}),children:[n?u(Eo,{icon:Dd,className:"text-current opacity-100"}):u(Eo,{icon:Fs,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t(n?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),u(Qe,{side:"top",children:o})]})}function lD(e){return u(Wx,{...e})}ie();var I6=(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"),w6=e=>{e.preventDefault()},id=Ce(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:s,sendDisabledReason:i,isEnvironmentUnavailable:l,isPreparingWorktree:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:f=!1,showSendWhileRunning:p=!1,onPreviousPendingQuestion:m,onInterrupt:g,interruptArmed:h=!1,onImplementPlanInNewThread:v,shellCommandMode:y=!1,shellCommandUnavailableReason:C=null}){let{t:x}=fe(),b=Et(),T=f?{onPointerDown:w6}:void 0,I=b.settings.useEnvironmentIdentificationMode(),k=i!==null,P=b.devBackdrop.useVisible(I==="artwork"),w=A=>u("button",{type:"button",className:K("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",h?"h-8 px-3 text-xs font-medium whitespace-nowrap ring-2 ring-destructive/60":A?"size-8 sm:size-7":p&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...T,onClick:g,"data-interrupt-armed":h?"":void 0,"aria-label":x(h?"primaryActions.confirmStopEsc":"primaryActions.stopGeneration"),children:h?x("primaryActions.confirmStopEsc"):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 S("div",{className:K("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?w(!0):null,n.questionIndex>0?t?u(ce,{size:"icon-sm",variant:"outline",className:"rounded-full",...T,onClick:m,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(Bs,{})}):u(ce,{size:"sm",variant:"outline",className:"rounded-full",...T,onClick:m,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(ce,{type:"submit",size:"sm",className:K("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...T,disabled:l||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:I6(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(y){let A=u("button",{type:"submit","data-shell-command-run":"true",className:"flex h-9 w-9 items-center justify-center rounded-full bg-message-action text-message-action-foreground shadow-xs shadow-message-action/24 transition-[background-color,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 hover:bg-message-action-hover active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",...T,disabled:C!==null||!c,"aria-label":C??x("primaryActions.runInTerminal"),children:u(Io,{"aria-hidden":"true",className:"size-4"})});return o?S(we,{children:[w(!1),A]}):A}if(r)return a?u(ce,{type:"submit",size:"sm",className:K("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"),...T,disabled:s||k||l,children:x(s?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):S("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ce,{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",...T,disabled:s||k||l,children:x(s?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),S(mo,{children:[u(ho,{render:u(ce,{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"),...T,disabled:s||k||l}),children:u(Zt,{})}),u(go,{align:"end",side:"top",children:u(Uo,{disabled:s||k||l,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let L=S("button",{type:"submit",className:K("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",P?"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"),...T,disabled:s||k||l||!c,"aria-label":l?x("primaryActions.environmentDisconnected"):i||x(d?"primaryActions.preparingWorktree":s?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[P?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(pS,{compact:!0})}):null,s?u($u,{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?S(we,{children:[w(!1),p&&c?L:null]}):L});function ku(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return u("span",{"data-conversation-slot":e.name,children:t??e.fallback})}function Ea(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 T6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function dD(e){let{t}=fe(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:s,compactDisabledReason:i}=e,l=T6(n.usedPercentage),d=Math.max(0,Math.min(100,n.usedPercentage??0)),c=9.75,f=2*Math.PI*c,p=f*(1-d/100),m=n.totalProcessedTokens??null,g=m!==null&&m>0,v=d>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return S(Wa,{children:[u(ja,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(ce,{size:"icon-sm",variant:"ghost-muted","data-context-window-meter":"true",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&l?t("contextWindow.usedPercentAria",{percentage:l}):t("contextWindow.usedTokensAria",{tokens:Ea(n.usedTokens)}),children:u("span",{className:"relative flex size-5 items-center justify-center",children:S("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:c,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:v,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:f,strokeDashoffset:p})]})})})}),u(Ga,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:S("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[S("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&&l?S("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:l}),u("span",{className:"mx-1",children:"\xB7"}),S("span",{children:[Ea(n.usedTokens),"/",Ea(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:Ea(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(d),"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:`${d}%`,backgroundColor:v}})}):null,o?S("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[S("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"system",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.system")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Ea(o.systemTokens)})]}),S("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"tools",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Ea(o.toolsTokens)})]}),S("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"messages",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Ea(o.messageTokens)})]})]}):null,g?S("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:Ea(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:uM(t,r,n.autoCompactThreshold)}):null,a?S(we,{children:[S(ce,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:s,onClick:a,children:[u(Nd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),s&&i?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:i}):null]}):null]})})]})}ie();var cD=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,i={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,i);return i},uD=(e=>e?cD(e):cD);ie();var P6=e=>e;function k6(e,t=P6){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 fD=e=>{let t=uD(e),n=o=>k6(t,o);return Object.assign(n,t),n},pD=(e=>e?fD(e):fD);var Gx=pD(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 mD(e){return Gx(t=>e===null?null:t.presetIdByDraftId[e]??null)}function jx(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var Qx="__none__",gD=Ce(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=fe(),s=Et().presets.useThreadPresets(t),i=mD(n),l=Gx(c=>c.setDraftPresetId);if(n===null){let f=jx(s,o)?.displayName??o;return f===null?null:S(Ro,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(Eo,{icon:oa}),u("span",{className:"min-w-0 truncate",children:f})]})}if(s.length===0)return null;let d=jx(s,i);return S(mo,{children:[u(ho,{render:u(Ro,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:S("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(Eo,{icon:oa}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(qr,{})]})}),u(go,{align:"start",children:S(Ji,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),S(ar,{value:i??Qx,onValueChange:c=>{l(n,c===Qx?null:c)},children:[u(wo,{value:Qx,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),s.map(c=>u(wo,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:S("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))]})]})})]})});var L6=Ce(function(t){let{data:n,target:o}=Ho(),r=n.useContextUsage(o);return r?.window==null?null:u(dD,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),A6=Ce(function(t){let{t:n}=fe();return S(we,{children:[u(L6,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:n("composer.preparingWorktree")}):null,u(id,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})});function hD(e){let{t}=fe(),{isComposerFooterCompact:n,isComposerPrimaryActionsCompact:o,isMobileViewport:r,showMobilePendingAnswerActions:a,hasPendingUserInputs:s,projectSelectionRequired:i,noProviderAvailable:l,composerAttachmentInputRef:d,onComposerAttachmentInputChange:c,slots:f,selectedInstanceId:p,unavailableAgentInstanceId:m,agentNotChosen:g,agentUnavailable:h,providerInstanceEntries:v,lockedProvider:y,lockedContinuationGroupKey:C,onAgentInstanceChange:x,selectedModelForPickerWithCustomFallback:b,selectedModelStatus:T,keybindings:I,modelOptionsByInstance:k,terminalOpen:P,isComposerModelPickerOpen:w,setIsComposerModelPickerOpen:L,composerProviderState:A,getModelDisabledReason:M,getModelContinuationLabel:R,onContinueInModel:D,onProviderModelSelect:H,canSelectPluginAction:W,pluginOptions:F,selectedPluginAction:J,onSelectPluginAction:O,onManagePlugins:B,isPluginComposer:Y,environmentId:U,routeKind:j,draftId:oe,activeThread:Q,interactionMode:ne,runtimeMode:re,composerProviderControls:Z,composerNativeMode:te,canSwitchNativeMode:ue,providerTraitsMenuContent:Me,providerTraitsPicker:Oe,toggleInteractionMode:ke,handleRuntimeModeChange:Ee,handleComposerNativeModeChange:ee,inlineTasksBadge:Se,inlineStashBadge:X,activeThreadModelDisplayName:de,pendingPrimaryAction:le,phase:se,showPlanFollowUpPrompt:$e,composerDraft:Tt,isSendBusy:gt,sendDisabledReason:Lt,environmentUnavailable:it,isPreparingWorktree:ct,previousUserInputQuestion:ht,handleInterruptPrimaryAction:lt,interruptArmed:pt,handleImplementPlanInNewThreadPrimaryAction:Pt,shellCommandMode:Ft,shellCommandUnavailableReason:gn,compactDisabled:rt,resolvedCompactDisabledReason:At,compactThreadContext:Bt}=e;return S("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":n?"true":"false",className:K("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s&&"pt-2",n?"gap-1.5":"gap-2 sm:gap-0",a&&"hidden sm:flex"),children:[S("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:d,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:c}),S(je,{children:[u(Xe,{render:u(ce,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:i||s,"aria-label":t("attachments.add"),onClick:()=>d.current?.click()}),children:u(oo,{})}),u(Qe,{side:"top",children:t("attachments.add")})]}),l?S(ce,{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(hn,{className:"size-4"}),t("composer.noProviderAvailable")]}):S(we,{children:[u(ku,{name:"conversation.input.agent",...f===void 0?{}:{slots:f},owner:{activeInstanceId:p,unavailableInstanceId:m,notChosen:g,instanceEntries:v,lockedProvider:y,lockedContinuationGroupKey:C,compact:n,onInstanceChange:x},fallback:u(qC,{activeInstanceId:p,unavailableInstanceId:m,notChosen:g,instanceEntries:v,lockedProvider:y,lockedContinuationGroupKey:C,compact:n,onInstanceChange:x})}),h||g?null:u(oD,{...f===void 0?{}:{slots:f},compact:n,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:p,model:b,modelStatus:T,lockedProvider:y,lockedContinuationGroupKey:C,instanceEntries:v,keybindings:I,modelOptionsByInstance:k,terminalOpen:P,open:w,...A.modelPickerIconClassName?{activeProviderIconClassName:A.modelPickerIconClassName}:{},onOpenChange:en=>{L(en)},getModelDisabledReason:M,getModelContinuationLabel:R,onContinueInModel:D,onInstanceModelChange:H,...W?{pluginActions:F,selectedPluginActionKey:J?.id??null,onSelectPluginAction:O,onManagePlugins:B}:{}})]}),Y?null:S(we,{children:[u(gD,{environmentId:U,draftId:j==="draft"?oe:null,threadPresetId:Q?.presetId??null,compact:n}),n?u(ZM,{interactionMode:ne,runtimeMode:re,runtimeModeSwitch:Z.runtimeModeSwitch,nativeMode:te,canSwitchNativeMode:ue,showInteractionModeToggle:Z.showInteractionModeToggle,traitsMenuContent:Me,onToggleInteractionMode:ke,onRuntimeModeChange:Ee,onNativeModeChange:ee}):S(we,{children:[Oe?u(ku,{name:"conversation.input.effort",...f===void 0?{}:{slots:f},fallback:Oe}):null,te===null&&Z.showInteractionModeToggle?u(ku,{name:"conversation.input.plan",...f===void 0?{}:{slots:f},owner:{interactionMode:ne,showInteractionModeToggle:Z.showInteractionModeToggle,onToggleInteractionMode:ke},fallback:u(Wx,{interactionMode:ne,showInteractionModeToggle:Z.showInteractionModeToggle,onToggleInteractionMode:ke})}):null,u(ku,{name:"conversation.input.permission",...f===void 0?{}:{slots:f},owner:{runtimeMode:re,runtimeModeSwitch:Z.runtimeModeSwitch,nativeMode:te,canSwitchNativeMode:ue,onRuntimeModeChange:Ee,onNativeModeChange:ee},fallback:u(Vx,{runtimeMode:re,runtimeModeSwitch:Z.runtimeModeSwitch,nativeMode:te,canSwitchNativeMode:ue,onRuntimeModeChange:Ee,onNativeModeChange:ee})})]})]})]}),S("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":o?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[a?null:Se,a?null:X,u(A6,{compact:o,activeThreadModelDisplayName:de,pendingAction:le,isRunning:se==="running",showPlanFollowUpPrompt:!s&&$e,promptHasText:Tt.promptHasText,isSendBusy:gt,sendDisabledReason:Lt,isEnvironmentUnavailable:it!==null||l||i,isPreparingWorktree:ct,hasSendableContent:Tt.hasSendableContent,preserveComposerFocusOnPointerDown:r,showSendWhileRunning:r,onPreviousPendingQuestion:ht,onInterrupt:lt,interruptArmed:pt,onImplementPlanInNewThread:Pt,shellCommandMode:Ft,shellCommandUnavailableReason:gn,compactDisabled:rt||l||gt,compactDisabledReason:At,onCompactContext:Bt})]})]})}var R6=e=>e.prompt.trim();function E6(e){let{t}=fe(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,R6),o=e.pendingCustomAnswer!==null;return u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(o?e.pendingCustomAnswer:n)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:o?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):n||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}function vD(e){let{api:t,composerDraftTarget:n,pendingCustomAnswer:o,noProviderAvailable:r,onExpand:a,inlineTasksBadge:s,inlineStashBadge:i,submitDisabled:l,submitLabel:d,onSubmit:c}=e;return S("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u(E6,{api:t,composerDraftTarget:n,pendingCustomAnswer:o,noProviderAvailable:r,onExpand:a}),s,i,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:l,"aria-label":d,onPointerDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),c()},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"})})})]})}ie();ie();var yD={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},CD=Ce(function(t){let{t:n}=fe(),o=N(null);return be(()=>{if(!t.activeItemId||!o.current)return;o.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(uf,{autoHighlight:!1,mode:"none",onItemHighlighted:r=>{t.onHighlightedItemChange(typeof r=="string"?r:null)},children:u("div",{ref:o,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(mf,{className:"max-h-72 scroll-pb-6",children:u(ff,{children:t.items.map((r,a)=>u(M6,{sectionTitle:r.section!==void 0&&t.items[a-1]?.section!==r.section?r.section:null,item:r,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===r.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},r.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"?n("composer.searchingSkills"):n("composer.searchingFiles"):t.emptyStateText??(t.triggerKind==="skill"?n("composer.noSkillsFound"):t.triggerKind==="path"?n("composer.noMatchingFiles"):n("composer.noMatchingCommand"))})})})})}),M6=Ce(function(t){let{t:n}=fe(),o=t.item.type==="skill"?UR(t.item.skill):null,r=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return S(we,{children:[t.sectionTitle!==null?u("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:n(yD[t.sectionTitle]??yD.recent)}):null,S(pf,{value:t.item.id,"data-composer-item-id":t.item.id,className:K("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:a=>{a.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Rm,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,S("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:r?S(we,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),Yo(r)]}):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}),o?u(D6,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),N6={app:Cd,repo:Ha,project:Ha,personal:Dr,system:Bd,other:_d},_6={app:"slashMenu.skillSource.app",repo:"slashMenu.skillSource.repo",project:"slashMenu.skillSource.project",personal:"slashMenu.skillSource.personal",system:"slashMenu.skillSource.system",other:"slashMenu.skillSource.other"};function D6(e){let{t}=fe(),n=N6[e.kind],o=t(_6[e.kind]);return S(Or,{className:"ms-auto",variant:"secondary",children:[u(n,{"aria-hidden":"true",className:"text-current"}),e.showSkillSuffix?t("slashMenu.skillSourceWithSuffix",{source:o}):o]})}ie();function O6(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function xD(e,t){let n=O6(e);if(!n)return"";let o=Date.now()-n.getTime();if(o<0)return t("relativeTime.justNow");let r=Math.floor(o/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let s=Math.floor(a/60);return s<24?t("relativeTime.hoursAgo",{count:s}):t("relativeTime.daysAgo",{count:Math.floor(s/24)})}var bD=90;function SD(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function F6(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>bD?`${n.slice(0,bD)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var ID=Ce(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:s}=fe(),i=Et(),l=N(null),[d,c]=G(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return q(()=>{let p=m=>{let g=l.current;g&&m.composedPath().includes(g)||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]),i.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(y=>y.id===d),g=p.key==="ArrowDown"?1:-1,v=((m>=0?m:g===1?-1:0)+g+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(uf,{autoHighlight:!1,mode:"none",children:S("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(ce,{variant:"ghost-muted",size:"icon-micro","aria-label":s("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(Qt,{className:"size-3"})})}),u(mf,{className:"max-h-64 scroll-pb-6",children:u(ff,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:s("stash.empty")}):n.map(p=>S(pf,{value:p.id,className:K("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:F6(p,s)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:s("stash.savingImage",{count:p.pendingImageCount})}):SD(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:s("stash.imagesDropped",{count:SD(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:xD(p.createdAt,s)}),u(ce,{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":s("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(Qt,{className:"stroke-2"})})]},p.id))})})]})})});ie();function Xx(e,t){let n=e.name.toLowerCase(),o=Yo(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",s=e.scope?.toLowerCase()??"",i=[wr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),wr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),wr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),wr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),wr({value:s,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return i.length===0?null:Math.min(...i)}function wD(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(wC),r=to(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let s of o){let i=Xx(s,r);i!==null&&Pg(a,{item:s,score:i,tieBreaker:`${Yo(s).toLowerCase()}\0${s.name}`},n)}return a.map(s=>s.item)}function B6(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,s=a?Xx(e.skill,a):0;return s!==null?s:"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=[wr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),wr({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 TD(e,t,n=[]){let o=to(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let s=B6(a,o);if(s===null)continue;let i=n.includes(a.id)?s-1:s;Pg(r,{item:a,score:i,tieBreaker:a.type==="slash-command"?`0\0${a.command}`:a.type==="provider-slash-command"?`1\0${a.command.name}\0${a.provider}`:`2\0${a.skill.name}\0${a.provider}`},Number.POSITIVE_INFINITY)}return r.map(a=>a.item)}function PD(e,t){let n=new Map(e.map(i=>[i.id,i])),o=t.map(i=>n.get(i)).filter(i=>i!==void 0).slice(0,3).map(i=>({...i,section:"recent"})),r=new Set(o.map(i=>i.id)),a=e.filter(i=>!r.has(i.id)),s=i=>i.type==="slash-command"?"builtIn":i.type==="provider-slash-command"?"provider":"skills";return[...o,...a.map(i=>({...i,section:s(i)}))]}function Yx(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}var kD=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t;function kg(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function LD({prompt:e,selectedProvider:t,selectedProviderStatus:n,planModeUiEnabled:o,showSkillsInSlashMenu:r,recentSlashCommandIds:a,environmentId:s,gitCwd:i,useComposerPathSearch:l,readComposerSnapshot:d,applyPromptReplacement:c,onInteractionModeChange:f,onOpenModelPicker:p,onSlashCommandUsed:m}){let{t:g}=fe(),[h,v]=G(()=>Yn(e,e.length)),[y,C]=G(null),[x,b]=G(null),[T,I]=G(null),k=y!==null&&kg(h)===y?null:h,P=k?.kind==="path"?k.query:"",w=k?.kind==="path",L=l({environmentId:s,cwd:w?i:null,query:w?P:null}),A=V(()=>{if(!k)return[];if(k.kind==="path")return L.entries.map(Y=>({id:`path:${Y.kind}:${Y.path}`,type:"path",path:Y.path,pathKind:Y.kind,label:U6(Y.path),description:Y.path.slice(0,Math.max(0,Y.path.lastIndexOf("/")))}));if(k.kind==="slash-command"){let Y=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:g("composer.switchModelDesc")},...o?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:g("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:g("composer.defaultDesc")}]:[]],U=FR(n?.skills??[],r),j=BR(n?.slashCommands??[],n?.skills??[]).map(re=>({id:`provider-slash-command:${t}:${re.name}`,type:"provider-slash-command",provider:t,command:re,label:`/${re.name}`,description:re.description??re.input?.hint??g("composer.runProviderCommand")})),oe=k.query.trim().toLowerCase(),Q=U.map(re=>({id:`skill:${t}:${re.name}`,type:"skill",provider:t,skill:re,label:`/skill:${re.name}`,description:re.shortDescription??re.description??(re.scope?g("composer.skillScopeDescription",{scope:re.scope}):"")})),ne=[...Y,...j,...Q];return oe===""?PD(ne,a):TD(ne,oe,a)}return k.kind==="skill"?wD(n?.skills??[],k.query).map(Y=>({id:`skill:${t}:${Y.name}`,type:"skill",provider:t,skill:Y,label:Yo(Y),description:Y.shortDescription??Y.description??(Y.scope?g("composer.skillScopeDescription",{scope:Y.scope}):g("composer.runProviderSkill"))})):[]},[k,o,a,t,n,r,g,L.entries]),M=!!k,R=k?`${k.kind}:${k.query.trim().toLowerCase()}`:null,D=V(()=>{let Y=Yx({items:A,highlightedItemId:x,currentSearchKey:R,highlightedSearchKey:T});return A.find(U=>U.id===Y)??null},[A,x,R,T]),H=E(()=>{let Y=d(),U=Yn(Y.value,Y.expandedCursor),j=y!==null&&kg(U)===y?null:U;return{snapshot:Y,trigger:j}},[d,y]),W=E(Y=>{let{snapshot:U,trigger:j}=H();if(!j)return;if((Y.type==="slash-command"||Y.type==="provider-slash-command"||Y.type==="skill")&&m?.(Y.id),Y.type==="path"){let re=`${Ai(Y.path)} `,Z=kD(U.value,j.rangeEnd,re);c(j.rangeStart,Z,re,{expectedText:U.value.slice(j.rangeStart,Z)})&&b(null);return}if(Y.type==="slash-command"){if(Y.command==="model"){c(j.rangeStart,j.rangeEnd,"",{expectedText:U.value.slice(j.rangeStart,j.rangeEnd),focusEditorAfterReplace:!1})&&(b(null),p());return}f(Y.command==="plan"?"plan":"default"),c(j.rangeStart,j.rangeEnd,"",{expectedText:U.value.slice(j.rangeStart,j.rangeEnd)})&&b(null);return}let oe=Y.type==="provider-slash-command"?`/${Y.command.name} `:`$${Y.skill.name} `,Q=kD(U.value,j.rangeEnd,oe);c(j.rangeStart,Q,oe,{expectedText:U.value.slice(j.rangeStart,Q)})&&b(null)},[c,f,p,m,H]);q(()=>{if(!M){b(null),I(null);return}let Y=Yx({items:A,highlightedItemId:x,currentSearchKey:R,highlightedSearchKey:T});b(U=>U===Y?U:Y),I(U=>U===R?U:R)},[x,T,A,M,R]);let F=E(Y=>{b(Y),I(R)},[R]),J=E(()=>{let{trigger:Y}=H();return Y===null?!1:(C(kg(Y)),b(null),!0)},[H]),O=E((Y,U)=>{let j=Ao(Y,U),oe=Yn(Y,j);v(oe);let Q=kg(oe);C(ne=>ne!==null&&ne!==Q?null:ne),b(null),I(null)},[]),B=E(()=>{b(null)},[]);return{composerTrigger:h,menuTrigger:k,composerMenuItems:A,composerMenuOpen:M,composerMenuSearchKey:R,activeComposerMenuItem:D,resolveActiveComposerTrigger:H,onSelectComposerItem:W,onComposerMenuItemHighlighted:F,onMenuEscape:J,resetForDocumentChange:O,dismissTrigger:B,workspaceEntries:L,highlightedItemId:x,setTrigger:v,setHighlightedItemId:b,setHighlightedSearchKey:I}}function U6(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function z6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function AD(e){let t=Et(),n=Nu(),o=t.pane.useActive(),[r,a]=G(null);return be(()=>{if(!o)return;let s=e.anchor;if(!s){a(null);return}let i=!0,l=()=>{if(!i)return;let c=s.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??s).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(c??s).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,y={bottom:window.innerHeight-p.top-v,left:p.left+h,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-h*2),overlap:v};a(C=>C&&z6(C,y)?C:y)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(s);for(let c=s.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{i=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:n,"data-composer-drawer-layer":"true",style:{position:"fixed",zIndex:45,pointerEvents:"auto",clipPath:`inset(0 0 ${r.overlap}px 0)`,bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var H6=[],K6=[],$6=e=>e.prompt,q6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},V6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),RD=Ce(function(t){let{handleRef:n,api:o,composerDraftTarget:r,composerDocumentKey:a,promptRef:s,editorRef:i,menuAnchor:l,resolvedTheme:d,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,onSlashCommandUsed:y,onOpenModelPicker:C,onInteractionModeChange:x,onToggleInteractionMode:b,activePendingProgress:T,activePendingRequestId:I,hasPendingUserInputs:k,changeUserInputCustomAnswer:P,terminalContexts:w,showTerminalContexts:L,showEditor:A,isApprovalState:M,editorClassName:R,placeholder:D,disabled:H,onPaste:W,onSubmit:F,isMobileViewport:J,isDraftRoute:O,stashMenuOpen:B,stashEntries:Y,onRestoreStashEntry:U,onDeleteStashEntry:j,onCloseStashMenu:oe,onPromptEdited:Q,onUnclaimedEscape:ne}=t,{t:re}=fe(),Z=o.draft.useThreadDraftSelector(r,$6),te=o.draft.useStore,ue=te(Te=>Te.setPrompt),Me=te(Te=>Te.setTerminalContexts),Oe=te(Te=>Te.removeTerminalContext),ke=Vn(Z,Z.length),Ee=Ia(a,Z,{cursor:ke,expandedCursor:Z.length}),[ee,Se]=G(()=>({documentKey:a,cursor:Ee.cursor})),X=ee.documentKey===a?ee.cursor:Ee.cursor,de=E(Te=>{Se(Ke=>{let qe=Ke.documentKey===a?Ke.cursor:Ia(a,s.current).cursor,ut=typeof Te=="function"?Te(qe):Te,tt=s.current,nt=Ao(tt,ut);return KR(a,tt,ut,nt),Ke.documentKey===a&&Ke.cursor===ut?Ke:{documentKey:a,cursor:ut}})},[a,s]),le=N(!1),se=N(!1),$e=N([]),Tt=N(null),gt=E(Te=>{ue(r,Te)},[r,ue]),Lt=E((Te,Ke,qe,ut,tt)=>{P(Te,Ke,qe,ut,tt),s.current=Ke},[P,s]),it=E((Te,Ke,qe,ut)=>{let tt=s.current,nt=Math.max(0,Math.min(tt.length,Te)),St=Math.max(nt,Math.min(tt.length,Ke));if(ut?.expectedText!==void 0&&tt.slice(nt,St)!==ut.expectedText)return!1;let Ut=bR(s.current,Te,Ke,qe),bn=Vn(Ut.text,Ut.cursor),ln=Ao(Ut.text,bn);s.current=Ut.text;let un=T?.activeQuestion;return un&&k?Lt(un.id,Ut.text,bn,ln,!1):gt(Ut.text),de(bn),Vt(Yn(Ut.text,ln)),ut?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{i.current?.focusAt(bn)}),!0},[T?.activeQuestion,i,k,Lt,s,de,gt]),ct=E(()=>{let Te=i.current?.readSnapshot();return Te||{value:s.current,cursor:X,expandedCursor:Ao(s.current,X),terminalContextIds:w.map(Ke=>Ke.id)}},[X,i,s,w]),ht=LD({prompt:Z,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,useComposerPathSearch:o.pathSearch.useComposerPathSearch,readComposerSnapshot:ct,applyPromptReplacement:it,onInteractionModeChange:x,onOpenModelPicker:C,onSlashCommandUsed:y}),{composerTrigger:lt,composerMenuItems:pt,composerMenuOpen:Pt,activeComposerMenuItem:Ft,resolveActiveComposerTrigger:gn,onComposerMenuItemHighlighted:rt,onMenuEscape:At,workspaceEntries:Bt,highlightedItemId:en,setTrigger:Vt,setHighlightedItemId:Wt}=ht,vn=lt?.kind??null,$=lt?.kind==="path"?lt.query:"",pe=T?T.customAnswer:Z,ge=M?"":pe,ye=ht.resetForDocumentChange;q(()=>{ye(pe,X)},[a,ye,pe,X]),se.current=Pt,$e.current=pt,Tt.current=Ft;let Pe=vn==="path"&&$.length>0&&Bt.isPending===!0,at=V(()=>re(vn==="skill"?"composer.noSkillsFound":vn==="path"?"composer.noMatchingFiles":"composer.noMatchingCommand"),[vn]),tn=E(Te=>{let Ke=w.findIndex(tt=>tt.id===Te);if(Ke<0)return;let qe=o.terminalContext.removeInlinePlaceholder(s.current,Ke);s.current=qe.prompt,gt(qe.prompt),Oe(r,Te);let ut=Vn(qe.prompt,qe.cursor);de(ut),Vt(Yn(qe.prompt,qe.cursor))},[o.terminalContext,r,s,Oe,de,gt,w,Vt]);be(()=>{s.current=Z,de(Te=>jo(Z,Te))},[a,Z,s,de]),q(()=>{Q(Z)},[Q,Z]),q(()=>{Pt&&oe()},[Pt,oe]);let bt=N(null);q(()=>{let Te=T?.customAnswer;if(typeof Te!="string"){if(bt.current!==null){s.current=Z;let St=Vn(Z,Z.length);de(St),Vt(Yn(Z,Ao(Z,St)))}bt.current=null;return}let Ke=I,qe=T?.activeQuestion?.id??null,ut=bt.current?.requestId!==Ke||bt.current?.questionId!==qe,tt=s.current!==Te;if(bt.current={requestId:Ke,questionId:qe},!ut&&!tt)return;s.current=Te;let nt=Vn(Te,Te.length);de(nt),Vt(Yn(Te,Ao(Te,nt))),Wt(null)},[T?.customAnswer,T?.activeQuestion?.id,I,Z,s]);let cn=E((Te,Ke,qe,ut,tt)=>{if(T?.activeQuestion&&k){if(T.activeQuestion.allowFreeform===!1)return;de(Ke),Vt(ut?null:Yn(Te,qe)),Lt(T.activeQuestion.id,Te,Ke,qe,ut);return}s.current=Te,gt(Te),V6(w,tt)||Me(r,q6(w,tt)),de(Ke),Vt(ut?null:Yn(Te,qe))},[T?.activeQuestion,k,Lt,s,de,gt,r,w,Me,Vt]),st=ht.onSelectComposerItem,Je=E(Te=>{le.current||(le.current=!0,window.requestAnimationFrame(()=>{le.current=!1}),st(Te))},[st]),Rt=E(Te=>{if(pt.length===0)return;let Ke=pt.findIndex(St=>St.id===en),tt=((Ke>=0?Ke:Te==="ArrowDown"?-1:0)+(Te==="ArrowDown"?1:-1)+pt.length)%pt.length,nt=pt[tt];Wt(nt?.id??null)},[en,pt,Wt]),nn=(Te,Ke)=>{if(Te==="Escape")return Ke.isComposing||Ke.keyCode===229?!1:At()||(ne?.()??!1);if(Te==="Tab"&&Ke.shiftKey)return p?(b(),!0):!1;let{trigger:qe}=gn();if(se.current||qe!==null){let nt=$e.current,St=Tt.current??nt[0];if(Te==="ArrowDown"&&nt.length>0)return Rt("ArrowDown"),!0;if(Te==="ArrowUp"&&nt.length>0)return Rt("ArrowUp"),!0;if((Te==="Enter"||Te==="Tab")&&St)return Je(St),!0}let tt=Te==="Enter"?yR({isMobileViewport:J,shiftKey:Ke.shiftKey,modifierKey:Ke.metaKey||Ke.ctrlKey,isDraftThread:O}):null;return tt?(F(void 0,tt),!0):!1};return Oo(n,()=>({readSnapshot:ct,readDraftPrompt:()=>Z,applyPromptReplacement:it,syncCursor:(Te,Ke)=>{de(Te),Vt(Ke)},resetCursorState:Te=>{let Ke=Te?.prompt??s.current,qe=jo(Ke,Te?.cursor??0);Wt(null),de(qe),Vt(Te?.detectTrigger?Yn(Ke,Ao(Ke,qe)):null)}}),[it,Z,s,ct,de,Wt,Vt]),S(we,{children:[B&&!Pt&&!M&&u(AD,{anchor:l,children:u(ID,{entries:Y,onRestore:U,onDelete:j,onClose:oe})}),Pt&&!M&&u(AD,{anchor:l,children:u(CD,{items:pt,resolvedTheme:d,isLoading:Pe,triggerKind:vn,emptyStateText:at,activeItemId:Ft?.id??null,onHighlightedItemChange:rt,onSelect:Je})}),A?u(Ql,{editorRef:i,documentKey:a,value:ge,cursor:X,terminalContexts:L?w:H6,skills:f?.skills??K6,...R?{className:R}:{},onRemoveTerminalContext:tn,onChange:cn,onCommandKeyDown:nn,onPaste:W,placeholder:D,disabled:H}):null]})});function ED({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 MD(e){let{t}=fe(),{message:n,pluginBlockMessage:o,agentNotChosen:r,agentUnavailable:a,agentUnavailableNoChoice:s,modelSendBlock:i,selectedModelStatus:l,onChooseModel:d}=e;return S(we,{children:[u(ED,{message:n}),o===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:o}),r?u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:t("composer.agentNotChosen")}):null,a?u("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:t(s?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,i===null?null:S("p",{role:"status",className:"flex flex-wrap items-center gap-2 px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-blocked":l,children:[t(i.blockKey),i.canChooseModel?u(ce,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{d()},children:t("modelPicker.chooseModel")}):null]})]})}var W6=[];function ND(e){let{t}=fe(),{props:n,model:o,status:r,submit:a,badges:s,traits:i,composerDraft:l}=e,d=e.pendingUserInputs.length>0,c=V(()=>e.composerImages.filter(C=>Vm(C)==="image"),[e.composerImages]),f=V(()=>new Set(e.nonPersistedComposerImageIds),[e.nonPersistedComposerImageIds]),p=e.isMobileViewport&&!e.isComposerCollapsedMobile&&e.pendingPrimaryAction!==null,m=r.phase==="running"||r.isSendBusy||o.isSendDisabled||o.noProviderAvailable||r.projectSelectionRequired||r.environmentUnavailable!==null||!l.hasSendableContent,g=!e.isComposerCollapsedMobile&&!e.isComposerApprovalState,h=XM({machineUnavailable:r.environmentUnavailable!==null,sessionStarted:r.activeThread?.session!=null,sessionDisconnected:r.phase==="disconnected"}),v=YM(h),y=JM({t,tailPlaceholderKey:v,isComposerApprovalState:e.isComposerApprovalState,approvalDetail:e.approvalDetail,activePendingProgress:e.activePendingProgress!==null,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:o.noProviderAvailable});return u("div",{"data-chat-composer-main-surface":"true",className:K("group relative z-10 rounded-[22px] p-px transition-colors duration-200",e.composerProviderState.composerFrameClassName),children:S("div",{ref:e.surfaceRef,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":e.isComposerCollapsedMobile?"true":"false",className:K("rounded-[20px] transition-[background-color] duration-200",e.isDragOverComposer?"bg-accent/45 ring-1 ring-primary/70":null,r.projectSelectionRequired?"opacity-75":null,e.composerProviderState.composerSurfaceClassName),children:[n.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:n.firstRow}):null,u(qM,{hidden:e.isComposerApprovalState}),e.showCollapsedMobilePromptRow?u(vD,{api:n.api,composerDraftTarget:n.composerDraftTarget,pendingCustomAnswer:e.activePendingProgress?e.activePendingProgress.customAnswer:null,noProviderAvailable:o.noProviderAvailable,onExpand:e.expandMobileComposer,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,submitDisabled:m,submitLabel:t("composer.sendMessage"),onSubmit:()=>a.submitComposerOrShellCommand()}):null,u(G6,{input:e,pendingUserInputs:d,showMobilePendingAnswerActions:p,composerPreviewableImages:c,nonPersistedComposerImageIdSet:f,composerPlaceholder:y}),u(MD,{message:e.providerInputSubmissionError??a.composerSubmissionError,pluginBlockMessage:o.pluginBlockMessage,agentNotChosen:r.agentNotChosen,agentUnavailable:o.agentUnavailable,agentUnavailableNoChoice:o.agentUnavailableNoChoice,modelSendBlock:o.modelSendBlock,selectedModelStatus:o.selectedModelStatus,onChooseModel:e.openModelPicker}),g?u(hD,{isComposerFooterCompact:e.isComposerFooterCompact,isComposerPrimaryActionsCompact:e.isComposerPrimaryActionsCompact,isMobileViewport:e.isMobileViewport,showMobilePendingAnswerActions:p,hasPendingUserInputs:d,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:o.noProviderAvailable,composerAttachmentInputRef:e.composerAttachmentInputRef,onComposerAttachmentInputChange:e.onComposerAttachmentInputChange,slots:n.slots,selectedInstanceId:o.selectedInstanceId,unavailableAgentInstanceId:r.unavailableAgentInstanceId,agentNotChosen:r.agentNotChosen,agentUnavailable:o.agentUnavailable,providerInstanceEntries:o.providerInstanceEntries,lockedProvider:r.lockedProvider,lockedContinuationGroupKey:o.lockedContinuationGroupKey,onAgentInstanceChange:o.onAgentInstanceChange,selectedModelForPickerWithCustomFallback:o.selectedModelForPickerWithCustomFallback,selectedModelStatus:o.selectedModelStatus,keybindings:n.keybindings,modelOptionsByInstance:o.modelOptionsByInstance,terminalOpen:n.terminalOpen,isComposerModelPickerOpen:e.isComposerModelPickerOpen,setIsComposerModelPickerOpen:e.setIsComposerModelPickerOpen,composerProviderState:e.composerProviderState,getModelDisabledReason:n.getModelDisabledReason,getModelContinuationLabel:n.getModelContinuationLabel,onContinueInModel:n.onContinueInModel,onProviderModelSelect:n.onProviderModelSelect,canSelectPluginAction:o.canSelectPluginAction,pluginOptions:o.pluginOptions,selectedPluginAction:o.selectedPluginAction,onSelectPluginAction:n.onSelectPluginAction,onManagePlugins:n.onManagePlugins,isPluginComposer:o.isPluginComposer,environmentId:n.environmentId,routeKind:n.routeKind,draftId:n.draftId,activeThread:r.activeThread,interactionMode:r.interactionMode,runtimeMode:r.runtimeMode,composerProviderControls:o.composerProviderControls,composerNativeMode:o.composerNativeMode,canSwitchNativeMode:o.canSwitchNativeMode,providerTraitsMenuContent:i.providerTraitsMenuContent,providerTraitsPicker:i.providerTraitsPicker,toggleInteractionMode:n.toggleInteractionMode,handleRuntimeModeChange:n.handleRuntimeModeChange,handleComposerNativeModeChange:o.handleComposerNativeModeChange,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,activeThreadModelDisplayName:o.activeThreadModelDisplayName,pendingPrimaryAction:e.pendingPrimaryAction,phase:r.phase,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,composerDraft:l,isSendBusy:r.isSendBusy,sendDisabledReason:o.sendDisabledReason,environmentUnavailable:r.environmentUnavailable,isPreparingWorktree:r.isPreparingWorktree,previousUserInputQuestion:e.actions.previousUserInputQuestion,handleInterruptPrimaryAction:e.actions.handleInterruptPrimaryAction,interruptArmed:r.interruptArmed,handleImplementPlanInNewThreadPrimaryAction:e.actions.handleImplementPlanInNewThreadPrimaryAction,shellCommandMode:a.shellCommandMode,shellCommandUnavailableReason:a.hostShellCommand?.unavailableReason??null,compactDisabled:e.compactDisabled,resolvedCompactDisabledReason:o.resolvedCompactDisabledReason,compactThreadContext:e.compactThreadContext}):null]})})}function G6(e){let{t}=fe(),{input:n,pendingUserInputs:o,showMobilePendingAnswerActions:r}=e,{props:a,model:s,status:i,submit:l,stash:d,composerDraft:c}=n,f=n.activePendingProgress?.activeQuestion?.allowFreeform===!1;return S("div",{ref:n.setComposerMenuAnchor,className:K("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",n.isComposerApprovalState&&"pb-3 sm:pb-4",n.isComposerCollapsedMobile&&"hidden"),children:[u(QM,{api:a.api,environmentId:a.environmentId,composerDraftTarget:a.composerDraftTarget,isComposerCollapsedMobile:n.isComposerCollapsedMobile,isComposerApprovalState:n.isComposerApprovalState,hasPendingUserInputs:o,supportsAttachmentUploads:a.supportsAttachmentUploads,uploadsByImageId:n.uploadsByImageId,composerImages:n.composerImages,composerPreviewableImages:e.composerPreviewableImages,composerPreviewAnnotations:c.previewAnnotations,composerReviewComments:c.reviewComments,composerElementContexts:c.elementContexts,nonPersistedComposerImageIdSet:e.nonPersistedComposerImageIdSet,removeComposerDraftPreviewAnnotation:n.removeComposerDraftPreviewAnnotation,removeComposerDraftReviewComment:n.removeComposerDraftReviewComment,removeComposerDraftElementContext:n.removeComposerDraftElementContext,removeComposerImage:n.removeComposerImage,onExpandImage:a.onExpandImage}),u(j6,{mode:l.shellCommandMode,label:t("composer.shellCommand.mode"),hint:l.hostShellCommand?.unavailableReason??t("composer.shellCommand.hint")}),S("div",{className:"relative",children:[u(RD,{handleRef:n.promptInputRef,api:a.api,composerDraftTarget:a.composerDraftTarget,composerDocumentKey:n.composerDocumentKey,promptRef:a.promptRef,editorRef:n.composerEditorRef,menuAnchor:n.composerMenuAnchor,resolvedTheme:a.resolvedTheme,selectedProvider:s.selectedProvider,selectedProviderStatus:s.selectedProviderStatus,planModeUiEnabled:s.planModeUiEnabled,showSkillsInSlashMenu:a.settings.showSkillsInSlashMenu,recentSlashCommandIds:a.recentSlashCommandIds??W6,environmentId:a.environmentId,gitCwd:a.gitCwd,onSlashCommandUsed:a.onSlashCommandUsed,onOpenModelPicker:n.openModelPicker,onInteractionModeChange:n.switchInteractionMode,onToggleInteractionMode:a.toggleInteractionMode,activePendingProgress:n.activePendingProgress,activePendingRequestId:n.pendingUserInputs[0]?.requestId??null,hasPendingUserInputs:o,changeUserInputCustomAnswer:n.changeUserInputCustomAnswer,terminalContexts:c.terminalContexts,showTerminalContexts:!n.isComposerApprovalState&&!o,showEditor:!f,isApprovalState:n.isComposerApprovalState,editorClassName:r?"max-sm:pb-11":void 0,placeholder:e.composerPlaceholder,disabled:n.isComposerApprovalState||i.projectSelectionRequired,onPaste:n.handleComposerPaste,onSubmit:n.handleComposerSubmit,isMobileViewport:n.isMobileViewport,isDraftRoute:a.routeKind==="draft",stashMenuOpen:n.isStashMenuOpen,stashEntries:d.stashQueue,onRestoreStashEntry:d.restoreStashEntry,onDeleteStashEntry:d.deleteStashEntry,onCloseStashMenu:d.closeStashMenu,onPromptEdited:n.onPromptEdited,onUnclaimedEscape:n.handleUnclaimedEscape}),r?u(Q6,{input:n}):null]})]})}function j6(e){return e.mode?S("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-center gap-1.5 px-1 pb-1 text-xs",children:[u(Io,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-primary"}),u("span",{className:"shrink-0 font-medium text-primary",children:e.label}),u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.hint})]}):null}function Q6(e){let{input:t}=e,{model:n,status:o,badges:r}=t;return S("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[r.inlineTasksBadge,r.inlineStashBadge,u(id,{compact:!0,pendingAction:t.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:o.isSendBusy,sendDisabledReason:n.sendDisabledReason,isEnvironmentUnavailable:o.environmentUnavailable!==null||n.noProviderAvailable||o.projectSelectionRequired,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:t.actions.previousUserInputQuestion,onInterrupt:t.actions.handleInterruptPrimaryAction,interruptArmed:o.interruptArmed,onImplementPlanInNewThread:t.actions.handleImplementPlanInNewThreadPrimaryAction})]})}function _D(e){let{formRef:t,onSubmit:n,onFocusCapture:o,onBlurCapture:r,dragHandlers:a,onDragLeaveCapture:s,badges:i,stashQueueLength:l,isStashMenuOpen:d,stashPulse:c,toggleStashMenu:f,drawers:p,children:m}=e;return S("form",{ref:t,onSubmit:n,onFocusCapture:o,onBlurCapture:r,onDragEnterCapture:a.onDragEnter,onDragOverCapture:a.onDragOver,onDragLeaveCapture:s,onDropCapture:a.onDrop,className:K("mx-auto w-full min-w-0 max-w-3xl",i.hasShoulderTab&&"pt-7"),"data-chat-composer-form":"true",children:[p,S("div",{className:"relative",children:[i.showShoulderTabs&&i.visibleTasksProgress&&i.visibleTaskSteps?u(jm,{expanded:!1,hasTrailingShoulder:l>0,onDismiss:i.dismissTasks,onToggle:i.toggleTasksDrawer,progress:i.visibleTasksProgress,steps:i.visibleTaskSteps}):null,i.showShoulderTabs?u(Gm,{count:l,menuOpen:d,pulseKey:c.key,pulsing:c.active,onToggleMenu:f}):null,m]})]})}function DD(e){let{t}=fe(),n=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:S("div",{"data-chat-composer-mobile-pending-compact":"true",className:K("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",!n&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!n&&"px-3 py-2"),onPointerDown:o=>o.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?u(id,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function OD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}ie();var X6=2e3,Y6="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",J6=e=>[{decision:"cancel",label:e("composer.cancel")},{decision:"decline",label:e("composer.decline")},{decision:"acceptForSession",label:e("composer.alwaysAllowSession")},{decision:"accept",label:e("composer.approve")}];function Z6(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 FD=Ce(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:s}){let{t:i}=fe(),l=o??J6(i),d=Et(),c=a==="native"||a==="queued",[f,p]=G(""),m=N([]);q(()=>{p("")},[t]);let g=E(v=>{let y=v==="decline"?f.trim():"";s(t,v,y.length>0?y:void 0)},[f,s,t]),h=E(v=>{let y=m.current.filter(b=>b!==null);if(y.length===0)return;let C=y.findIndex(b=>b===document.activeElement),x=C===-1?v===1?0:y.length-1:(C+v+y.length)%y.length;y[x]?.focus()},[]);return d.pane.useKeydown(v=>{if(n||d.terminalFocus.getOwner()!==null||v.isComposing||v.keyCode===229)return;let y=Xa(v.target);if(r&&(!y||v.metaKey||v.ctrlKey||v.altKey)){let b=d.keybindings.approvalDecisionFromCommand(d.keybindings.resolveShortcutCommand(v,r));if(b!==null&&l.some(T=>T.decision===b)){v.preventDefault(),g(b);return}}if(y)return;let C=LS(v,l);if(C===null)return;if(v.preventDefault(),C.type==="move"){h(C.delta);return}let x=l[C.index];x&&g(x.decision)},{target:"document"}),u(we,{children:l.map((v,y)=>{let C=y<9?y+1:null,x=S(ce,{ref:b=>{m.current[y]=b},size:"xs",variant:v.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":Z6(v.decision,y),className:`${Y6}${v.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>g(v.decision),children:[u("span",{className:"min-w-0 break-words",children:v.label}),C===null?null:u(cf,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:C})]},v.decision);return v.decision!=="decline"||!c?x:S(Ba,{children:[u(Yi,{type:"text",value:f,disabled:n,maxLength:X6,placeholder:i(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":i("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:b=>p(b.target.value),onKeyDown:b=>{if(b.key==="Enter"){b.preventDefault(),g("decline");return}b.key==="Escape"&&(b.preventDefault(),f.length>0?p(""):b.currentTarget.blur())}}),x]},v.decision)})})});ie();var e8=["command","cmd"],t8=["file_path","filePath","path","notebook_path","notebookPath"],n8=["url"],o8=["query","q"],r8=["name","skill","skill_name","skillName"],BD=["toolName","tool_name"],UD=["description"],a8=[],s8=[];function Ma(e,t,n){for(let o of t){let a=e.find(s=>s.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function i8(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function l8(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function HD(e){let t=e.args??a8,n=e.fileChanges??s8,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},s=null,i=a,l=null;switch(e.requestKind){case"command":{let d=Ma(t,e8,o);d!==null&&(i={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Ma(t,t8,o)??l8(n);d!==null&&(s=i8(d),i=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Ma(t,n8,o);d!==null&&(i={shape:"url",url:d});break}case"web-search":{let d=Ma(t,o8,o);d!==null&&(i={shape:"query",query:d});break}case"skill":{s=Ma(t,r8,o)??Ma(t,BD,o),l=Ma(t,UD,o),t.length>0&&(i={shape:"none"});break}case"mcp-tool":case"tool":{s=Ma(t,BD,o),l=Ma(t,UD,o),t.length>0&&(i={shape:"none"});break}case"mcp-elicitation":{s=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:s,body:i,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var d8={"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"},c8={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"},u8={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"},f8={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function KD(e,t){let n=e.subject!==null?d8[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(c8[e.kind])}function $D(e,t){return t(u8[e])}function qD(e,t){return t(f8[e])}function VD(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=zD(t.oldText??""),o=zD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3795
+ ${U.prompt}`:U.prompt,oe=te!==G;if(oe&&(r.current=te,d(l,te),a.current?.syncCursor(lo(te,te.length),null)),U.attachments.length>0){let ee=new Set(i.current.map(Se=>Se.id)),fe=new Set(i.current.map(Se=>`${Se.mimeType}\0${Se.sizeBytes}\0${Se.name}`)),Re=U.attachments.filter(Se=>!ee.has(Se.id)&&!fe.has(`${Se.mimeType}\0${Se.sizeBytes}\0${Se.name}`)),Be=t.draft.hydrateImagesFromPersisted(Re);Be.length>0&&c(l,Be)}let Z=[];U.droppedImageNames.length>0&&Z.push(n("composer.stashImagesTooLarge",{names:U.droppedImageNames.join(", ")})),U.unreadableImageNames&&U.unreadableImageNames.length>0&&Z.push(n("composer.stashImagesUnreadable",{names:U.unreadableImageNames.join(", ")})),Z.length>0&&t.notify.warning(n("composer.someImagesNotRestored"),Z.join(" ")),oe&&window.requestAnimationFrame(()=>{s.current?.focusAtEnd()})},[c,l,i,r,d,n,R]),F=E(U=>{let{durable:X}=R(U.id);X||t.notify.warning(n("composer.stashEntryMayReturn"),n("composer.storageRejectedDelete"))},[n,R]),J=E(async()=>{let U=r.current.split(ta).join("").trim(),X=[...i.current];if(U.length===0&&X.length===0){p(oe=>!oe);return}let re=`${DC(l)}\0${U}\0${X.map(oe=>oe.id).join(",")}`;if(T.current.has(re))return;T.current.add(re);let G=l,te=Pi();try{let{evicted:oe,written:Z,durable:ee}=M({id:te,createdAt:new Date().toISOString(),prompt:U,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:X.length});if(!Z){t.notify.error(n("composer.couldNotStash"),n("composer.storageRejectedWrite"));return}ee||t.notify.warning(n("composer.stashNotSurvive"),n("composer.storageUnavailableMemory")),r.current="",f(G);for(let j of X)t.uploads.release(j.id);a.current?.syncCursor(0,null),H(),oe&&t.notify.warning(n("composer.oldestStashDiscarded"),n("composer.oldestStashDiscardedDetail",{count:t.stash.maxEntries}));let fe=[],Re=[],Be=[];for(let j of X){let ue=await t.imageCompression.compressForStash(j.file);if(!ue.ok){(ue.reason==="too-large"?Re:Be).push(j.name);continue}fe.push({id:j.id,name:j.name,mimeType:ue.image.mimeType,sizeBytes:ue.image.sizeBytes,dataUrl:ue.image.dataUrl})}let{kept:Se,droppedNames:Ee}=t.stash.partitionAttachments(fe),{attached:ne,durable:we}=D(te,{attachments:Se,droppedImageNames:[...Re,...Ee],unreadableImageNames:Be});ne?!we&&ee&&X.length>0&&t.notify.warning(n("composer.stashImagesNotSaved"),n("composer.stashImagesMissingOnReload")):Se.length>0&&t.notify.warning(n("composer.stashImagesDidNotAttach"),n("composer.stashImagesDidNotAttachDetail",{count:Se.length}))}finally{T.current.delete(re)}},[f,l,i,D,r,H,M,n]),O=E(()=>{p(U=>!U)},[]),B=E(()=>{if(g){h(),p(!0);return}O()},[h,g,O]),Y=E(()=>{p(!1)},[]);return t.pane.useKeydown(U=>{if(t.keybindings.resolveShortcutCommand(U,v,{context:{terminalFocus:t.terminalFocus.getOwner()!==null,terminalOpen:y,modelPickerOpen:C}})==="composer.stash"&&(U.preventDefault(),U.stopPropagation(),!t.commandPalette.isOpen())){if(x&&!b){p(re=>!re);return}b||w||I||J()}},{capture:!0}),{stashQueue:A,restoreStashEntry:W,deleteStashEntry:F,toggleStashMenu:O,toggleInlineStashMenu:B,closeStashMenu:Y}}le();function OE(e,t,n){return{...FC({id:Pi(),name:t.name||e.t("attachments.defaultFileName"),mimeType:t.type||"application/octet-stream",sizeBytes:t.size,...n?{source:n}:{}}),previewUrl:URL.createObjectURL(t),file:t}}async function FE(e,t,n){let{t:o,supportsAttachmentUploads:r,inlineAttachmentMaxBytes:a}=e;if(!e.activeThreadId||t.length===0)return;if(e.answerQuestionsFirst){e.notifyError(o("attachments.answerQuestionsFirst"));return}let s=e.activeThreadId,i=e.attachmentDocumentKey,l=e.pendingCompressions,d=l.get(i)??0,c=[],f=null;for(let p of t){if(p.size<=0){f=o("attachments.empty",{name:p.name});continue}c.push(p)}if(e.setThreadError(s,f),c.length!==0){l.set(i,d+c.length);try{let p=[],m=null;for(let g of c){if(!(e.imageCompression.isHeicFile(g)||OC(g.type))){if(!r&&g.size>a){m=o("attachments.tooLarge",{name:g.name,limit:Xl(a)});continue}p.push(OE(e,g,n?.source));continue}let v=await e.imageCompression.prepareForAttachment(g,r?Number.POSITIVE_INFINITY:a);if(!v.ok){if(r){p.push(OE(e,g));continue}m=v.reason==="unreadable"?o("attachments.unreadableImage",{name:g.name}):o("attachments.imageTooLarge",{name:g.name});continue}let y=v.file;p.push({...FC({id:Pi(),name:y.name||o("attachments.defaultImageName"),mimeType:y.type,sizeBytes:y.size}),previewUrl:URL.createObjectURL(y),file:y})}p.length===1&&p[0]?e.addImage(p[0]):p.length>1&&e.addImages(p),m!==null&&e.setThreadError(s,m)}finally{let p=(l.get(i)??0)-c.length;p>0?l.set(i,p):l.delete(i)}}}function BE(e){let{api:t,t:n,limits:o,setThreadError:r,activeThreadId:a,answerQuestionsFirst:s,attachmentTarget:i,attachmentDocumentKey:l,supportsAttachmentUploads:d,pendingImageCompressionsRef:c,addComposerDraftImage:f,addComposerDraftImages:p,removeComposerDraftImage:m}=e,g=E(b=>{f(i,b)},[i,f]),h=E(b=>{p(i,b)},[i,p]),v=E(b=>{t.uploads.release(b),m(i,b)},[t.uploads,i,m]),y=(b,w)=>FE({activeThreadId:a,answerQuestionsFirst:s,notifyError:I=>t.notify.error(I),t:n,setThreadError:r,attachmentDocumentKey:l,pendingCompressions:c.current,supportsAttachmentUploads:d,inlineAttachmentMaxBytes:o.inlineAttachmentMaxBytes,imageCompression:t.imageCompression,addImage:g,addImages:h},b,w);return{addComposerImages:y,removeComposerImage:b=>{v(b)},onComposerAttachmentInputChange:b=>{let w=Array.from(b.target.files??[]);b.target.value="",w.length!==0&&y(w)}}}le();var UE=e=>({images:e.images,nonPersistedImageIds:e.nonPersistedImageIds});function sV(e){let{supported:t,attachments:n,environmentId:o,threadId:r,requestId:a,question:s,responding:i}=e,l=s?.id,d=s?.allowFreeform;return V(()=>t&&a!==null&&l!==void 0&&d!==!1&&!i&&r?n.questionDraftTarget({environmentId:o,threadId:r,requestId:a,questionId:l}):null,[d,n,o,l,a,i,t,r])}function zE(e){let t=sV(e),n=t??e.composerDraftTarget,o=t?[e.environmentId,e.composerDraftTarget,"question",t].join("\0"):[e.environmentId,e.composerDraftTarget].join("\0");return{questionAttachmentTarget:t,attachmentTarget:n,attachmentDocumentKey:o}}le();le();var Cr=["approval-required","auto-accept-edits","auto","full-access"];var iV={"approval-required":Ed,"auto-accept-edits":Er,auto:ja,"full-access":Wa},lV={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Vm(){let{t:e}=pe();return E(t=>{let n=lV[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:iV[t]}},[e])}function HE(e,t){let n=Cr.indexOf(e);if(n===-1)return Cr[0];let o=(n+t+Cr.length)%Cr.length;return Cr[o]??Cr[0]}function KE(e){let{composerRef:t,sendContextRef:n,api:o,t:r,limits:a,composerData:s,refs:i,composerDraftTarget:l,activeThread:d,addComposerImages:c,addDroppedFolders:f,focusComposer:p,insertComposerTextAtEnd:m,insertComposerDraftTerminalContext:g,composerPreviewAnnotations:h,composerReviewComments:v,isComposerApprovalState:y,pendingUserInputCount:C,projectSelectionRequired:x,noProviderAvailable:b,modelState:w,handleRuntimeModeChange:I,runtimeMode:k,setIsComposerModelPickerOpen:P,setProviderInputSubmissionError:T}=e,{composerEditorRef:L,promptInputRef:A,promptRef:M,composerImagesRef:R,composerTerminalContextsRef:D,composerElementContextsRef:H,providerInputRejectedRef:W}=i,{selectedModel:F,selectedModelOptionsForDispatch:J,selectedModelSelection:O,selectedModelStatus:B,selectedNativeModeId:Y,selectedProvider:U,selectedProviderEntry:X,selectedProviderModels:re,selectedPluginAction:G,pluginBlockMessage:te,composerNativeMode:oe,canSwitchNativeMode:Z,handleComposerNativeModeChange:ee}=w,fe=E(()=>A.current?.readSnapshot()??{value:M.current,cursor:lo(M.current,M.current.length),expandedCursor:M.current.length,terminalContextIds:D.current.map(Be=>Be.id)},[D,M]),Re=()=>({prompt:M.current,images:R.current,terminalContexts:D.current,elementContexts:H.current,previewAnnotations:h,reviewComments:v,selectedModelOptionsForDispatch:J,selectedModelSelection:O,...Y?{selectedNativeModeId:Y}:{},providerAvailable:X!==void 0,selectedProvider:U,selectedModel:F,selectedModelStatus:B,selectedProviderModels:re,selectedPluginAction:G});n.current=Re,Bo(t,()=>({focusAtEnd:()=>{L.current?.focusAtEnd()},focusAt:Se=>{L.current?.focusAt(Se)},addDroppedFiles:Se=>{c(Se),p()},addDroppedFolders:Se=>{f(Se),p()},insertTextAtEnd:m,toggleModelPicker:()=>{P(Se=>!Se)},cyclePermissionMode:Se=>{if(oe===null){I(HE(k,Se));return}let{modes:Ee,current:ne}=oe;if(!Z||Ee.length<2)return;let we=Ee.findIndex(ue=>ue.id===ne.id),j=Ee[(we+Se+Ee.length)%Ee.length];j!==void 0&&ee(j.id)},readSnapshot:fe,resetCursorState:Se=>{A.current?.resetCursorState(Se)},addTerminalContext:Se=>{if(!d)return;let Ee=fe(),ne=o.terminalContext.insertInlinePlaceholder(Ee.value,Ee.expandedCursor),we=lo(ne.prompt,ne.cursor);g(l,ne.prompt,{id:Pi(),threadId:d.id,createdAt:new Date().toISOString(),...Se},ne.contextIndex)&&(M.current=ne.prompt,A.current?.syncCursor(we,xo(ne.prompt,ne.cursor)),window.requestAnimationFrame(()=>{L.current?.focusAt(we)}))},readSendIdentity:()=>({pluginActionId:G?.id??null,prompt:M.current}),getSendContext:Re,validateProviderInput:Se=>{let Ee=te??RC({prompt:M.current,providerInput:s.assistantQuotes.expandForProvider(Se),submissionTarget:"provider-turn",maxInputChars:a.maxInputChars,t:r});return W.current=Ee!==null,T(Ee),Ee===null}}),[d,c,l,g,M,R,D,H,h,v,p,y,C,x,fe,F,J,O,Y,b,U,re,G,te,s,Re,n,a.maxInputChars,oe,Z,ee,I,k,r])}le();function $E(e){let{composerImages:t,composerImagesRef:n,composerTerminalContexts:o,composerTerminalContextsRef:r,composerElementContexts:a,composerElementContextsRef:s}=e;xe(()=>{n.current=t},[t,n]),xe(()=>{r.current=o},[o,r]),xe(()=>{s.current=a},[a,s])}le();var dV=['[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(",");function cV(e){return e.closest(dV)!==null}function qE(e){let{isMobileViewport:t,forceExpandedOnMobile:n,composerEditorRef:o,composerSurfaceRef:r,composerFormRef:a}=e,[s,i]=Q(!1),l=t&&!n&&!s,d=N(null),c=N(null),f=N(null),p=N(!1),m=E(()=>{if(!t)return;d.current!==null&&(window.cancelAnimationFrame(d.current),d.current=null);let y=document.activeElement;y instanceof HTMLElement&&y.blur(),i(!1)},[t]),g=E(()=>{d.current!==null&&(window.cancelAnimationFrame(d.current),d.current=null),c.current!==null&&window.cancelAnimationFrame(c.current),f.current!==null&&window.cancelAnimationFrame(f.current),p.current=!0,i(!0),c.current=window.requestAnimationFrame(()=>{c.current=null,o.current?.focusAtEnd(),f.current=window.requestAnimationFrame(()=>{f.current=null,p.current=!1})})},[]),h=E(()=>{t&&(p.current||(d.current!==null&&window.cancelAnimationFrame(d.current),d.current=window.requestAnimationFrame(()=>{if(d.current=null,p.current)return;let y=r.current,C=a.current,x=document.activeElement;x instanceof Element&&cV(x)||x instanceof Node&&(y&&y.contains(x)||C&&C.contains(x))||i(!1)})))},[t]);return q(()=>()=>{d.current!==null&&window.cancelAnimationFrame(d.current),c.current!==null&&window.cancelAnimationFrame(c.current),f.current!==null&&window.cancelAnimationFrame(f.current)},[]),{isComposerCollapsedMobile:l,blurMobileComposerAfterSend:m,expandMobileComposer:g,scheduleComposerCollapseCheck:h,handleFormFocusCapture:y=>{let C=y.target;l&&C instanceof HTMLElement&&C.closest('[data-chat-composer-collapsed-controls="true"]')||(d.current!==null&&(window.cancelAnimationFrame(d.current),d.current=null),i(!0))}}}le();function VE(e){let{t,threadId:n,setThreadError:o,promptRef:r,promptInputRef:a,respondToApproval:s,respondToDecision:i,selectUserInputOption:l,advanceUserInput:d,activePendingProgress:c,activePendingIsResponding:f,activePendingResolvedAnswers:p}=e,m=V(()=>c?{questionIndex:c.questionIndex,isLastQuestion:c.isLastQuestion,canAdvance:c.canAdvance,isResponding:f,isComplete:!!p}:null,[f,c,p]),g=E((C,x)=>{l(C,x),r.current="",a.current?.resetCursorState({cursor:0})},[r,l]),h=E(async(C,x,b)=>{try{await s(C,x,b)}catch(w){o(n,w instanceof Error?w.message:t("approval.respondFailed"))}},[n,s,o,t]),v=E((C,x)=>{i(C,x).then(b=>{b!==null&&o(n,b)})},[n,i,o]),y=E(()=>{d().then(C=>{C!==null&&o(n,C)})},[d,n,o]);return{pendingPrimaryAction:m,onSelectActivePendingUserInputOption:g,onRespondToApproval:h,onRespondToComposerDecision:v,onAdvanceActivePendingUserInput:y}}le();function WE(e){return e.startsWith("!")}function GE(e){return e.slice(1).trim()}function jE(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function uV(){return null}function QE(){let{data:e,target:t,threadKey:n}=$o();return(e.useShellCommand??uV)({target:t,threadKey:n})}le();function XE({promptRef:e,maxInputChars:t,noProviderAvailable:n,isSendDisabled:o,sendDisabledReason:r,isModelSendBlocked:a,onModelSendBlocked:s,activeThreadId:i,activePendingProgress:l,composerDocumentKey:d,pendingImageCompressionsRef:c,onSend:f,onProviderInputRejectedReset:p,wasProviderInputRejected:m,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:v}){let{t:y}=pe(),[C,x]=Q(null);q(()=>x(null),[d]);let b=E(I=>{x(k=>k===null?k:su(I,t,y))},[t,y]),w=E((I,k="foreground")=>{if(n||o){I?.preventDefault();return}if(a){I?.preventDefault(),s();return}if(i&&(c.current.get(d)??0)>0){I?.preventDefault(),g();return}let P=YR({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:I,onSend:T=>(p(),f(T,k),!m())});x(P.validationMessage),P.didDispatch&&h()&&v()},[l,i,v,d,a,o,t,n,s,p,f,g,c,e,r,h,y,m]);return{composerSubmissionError:C,setComposerSubmissionError:x,revalidatePromptLength:b,submitComposer:w}}function YE(e){let{api:t,t:n,limits:o,composerDraftTarget:r,composerDraft:a,composerDocumentKey:s,promptRef:i,promptInputRef:l,providerInputRejectedRef:d,pendingImageCompressionsRef:c,setComposerDraftPrompt:f,setModelSendBlockShown:p,onSend:m,onCompactContext:g,blurMobileComposerAfterSend:h,isMobileViewport:v,isComposerApprovalState:y,activePendingApproval:C,activePendingProgress:x,activePendingResolvedAnswers:b,pendingUserInputCount:w,activeThreadId:I,phase:k,isSendBusy:P,environmentUnavailable:T,compactDisabled:L,noProviderAvailable:A,isSendDisabled:M,sendDisabledReason:R,isModelSendBlocked:D,showPlanFollowUpPrompt:H}=e,W=QE(),F=t.draft.useThreadDraftSelector(r,ee=>WE(ee.prompt)),J=W!==null&&F&&!y&&x===null,O=E(()=>!v||P||M||A||T!==null||k==="running"?!1:x?x.isLastQuestion&&!!b:H||a.hasSendableContent,[x,b,a.hasSendableContent,T,v,P,M,A,k,H]),{composerSubmissionError:B,setComposerSubmissionError:Y,revalidatePromptLength:U,submitComposer:X}=XE({promptRef:i,maxInputChars:o.maxInputChars,noProviderAvailable:A,isSendDisabled:M,sendDisabledReason:R,isModelSendBlocked:D,onModelSendBlocked:()=>{p(!0)},activeThreadId:I,activePendingProgress:x,composerDocumentKey:s,pendingImageCompressionsRef:c,onSend:m,onProviderInputRejectedReset:()=>{d.current=!1},wasProviderInputRejected:()=>d.current,onStillCompressing:()=>{t.notify.info(n("composer.stillCompressing"),n("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:O,blurMobileComposerAfterSend:h}),re=N(!1),G=E(ee=>{if(ee?.preventDefault(),W===null||re.current)return;if(W.unavailableReason!==null){Y(W.unavailableReason);return}let fe=i.current,Re=GE(fe),Be=jE(Re);if(Be==="empty")return;if(Be==="multiline"){Y(n("composer.shellCommand.singleLine"));return}Y(null),re.current=!0;let Se=r;W.run(Re).then(Ee=>{!Ee||i.current!==fe||(i.current="",f(Se,""),l.current?.syncCursor(0,null))}).finally(()=>{re.current=!1})},[r,W,i,f,Y,n]),te=E((ee,fe)=>{if(J){G(ee);return}X(ee,fe)},[G,J,X]),oe=E(()=>{if(!J)return!1;let ee=i.current.slice(1);return i.current=ee,f(r,ee),l.current?.resetCursorState({prompt:ee,cursor:ee.length}),!0},[r,i,f,J]),Z=E(()=>{L||A||C!==null||w>0||k==="running"||P||!I||g()},[C,I,L,P,A,g,w,k]);return{composerSubmissionError:B,revalidatePromptLength:U,submitComposerOrShellCommand:te,exitShellCommandMode:oe,compactThreadContext:Z,hostShellCommand:W,shellCommandMode:J}}le();le();var Wm=ye(function(t){let{t:n}=pe();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:K("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?S(ce,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:K("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(Wi,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):S("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:K("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(Wi,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});le();function ZE(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 JE({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:K("flex w-10 shrink-0 items-center gap-0.5",e),children:ZE(t).map(({key:n,step:o})=>u("span",{className:K("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 Gm=ye(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:s,steps:i}){let{t:l}=pe();if(s.totalSteps<=0)return null;let d=s.completedSteps>=s.totalSteps,c=l("tasksBadge.ariaLabel",{completed:s.completedSteps,total:s.totalSteps,step:s.step});return a==="inline"?S("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[S(ce,{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(Us,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(JE,{steps:i}),S("span",{className:K("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Xt,{"aria-hidden":!0,className:"size-2.5"})})]}):S("div",{className:K("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:[S("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(Us,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:l("tasksBadge.label")}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:s.step}),S("span",{className:K("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]}),u(JE,{className:"w-20",steps:i})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Xt,{"aria-hidden":!0,className:"size-3"})})]})}),eM=ye(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=pe();return S("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[S("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[S("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:s=>s.preventDefault(),children:[u(Us,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),S("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:s=>s.preventDefault(),children:u(Xt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:ZE(r).map(({key:s,step:i})=>S("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:K("w-3 shrink-0 text-center font-mono text-[10px]",i.status==="completed"?"text-success":i.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:i.status==="completed"?"\u2713":i.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:K("min-w-0 flex-1",i.status==="completed"?"text-muted-foreground/55":i.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:i.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:i.durationMs!==void 0?sa(i.durationMs):i.status==="inProgress"?a("tasksBadge.now"):null})]},s))})]})});function tM(e){let{activeThreadId:t,activeThread:n,activeTasksProgress:o,activeTaskSteps:r,isTasksDrawerOpen:a,setIsTasksDrawerOpen:s,dismissedTasksTurnId:i,setDismissedTasksTurnId:l,stashQueue:d,isStashMenuOpen:c,stashPulse:f,toggleInlineStashMenu:p,isComposerApprovalState:m,externalDrawerAttached:g,showComposerTopDrawer:h,isComposerCollapsedMobile:v,hasBlockingComposerTopDrawer:y}=e,C=E(()=>{s(D=>!D)},[]),x=n?.latestTurn?.turnId??null,b=x!==null&&i===x,w=b?null:o,I=b?null:r,k=E(()=>{x!==null&&l(x),s(!1)},[x]),T=d.length>0&&!m&&(g||h||a||v)?u(Wm,{count:d.length,menuOpen:c,placement:"inline",pulseKey:f.key,pulsing:f.active,onToggleMenu:p}):null,A=w!==null&&I!==null&&!a&&!y&&(g||h||v)?u(Gm,{expanded:!1,onDismiss:k,onToggle:C,placement:"inline",progress:w,steps:I}):null,M=!g&&!h&&!a&&!v,R=M&&(d.length>0||w!==null&&I!==null&&w.totalSteps>0);return q(()=>{(w===null||I===null)&&s(!1)},[I,w]),q(()=>{y&&s(!1)},[y]),q(()=>{s(!1)},[t]),{toggleTasksDrawer:C,dismissTasks:k,visibleTasksProgress:w,visibleTaskSteps:I,inlineStashBadge:T,inlineTasksBadge:A,showShoulderTabs:M,hasShoulderTab:R}}le();function nM(e){return e==="ready"}function oM(e){return e==="ready"||e==="unchecked"||e==="checking"}function rM(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 jm(e){return e.enabled&&oM(e.readiness)}function iu(e){return e.enabled}function aM(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 sM=e=>e.enabled;function iM(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}function fV(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pV(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${fV(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function zC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return pV(n,e.subProvider)}function Yl(e){return zC(e,{preferShortName:!0})}function lM(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?Yl(n):e.model}function dM(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}le();var cM="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 Eo({className:e,size:t="sm",variant:n="ghost",...o}){return u(ce,{className:K(cM,e),size:t,variant:n,...o})}function Mo({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:K("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function Hr(){return u(tn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function Qm({className:e,size:t="sm",variant:n="ghost",...o}){return u(jb,{className:K(cM,e),icon:u(Hr,{}),size:t,variant:n,...o})}function HC(e,t){if(!e)return t("composer.agentPickerLabel");let n=e.agentName?.trim(),o=e.displayName.trim();return n?!o||o===n?n:`${n} \xB7 ${o}`:o}function KC(e,t){let n=e.filter(iu),o=t.lockedProvider;if(o==null||o.length===0)return n;let r=t.lockedContinuationGroupKey;return n.filter(a=>a.driverKind===o&&(!r||a.continuationGroupKey===r))}var $C=ye(function(t){let{t:n}=pe(),o=t.instanceEntries.filter(iu),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(c=>c.instanceId===r)??null,s=t.notChosen===!0&&r===null,i=r!==null||s?null:o.find(c=>c.instanceId===t.activeInstanceId)??null,l=t.lockedProvider!=null&&t.lockedProvider.length>0,d=r!==null||s?KC(t.instanceEntries,t):o;return S(go,{children:[S(vo,{render:u(Eo,{"aria-label":n("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||l&&r===null||d.length===0,className:K("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[r!==null?u(hn,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):s?null:i?u(nr,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?S("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?r:HC(a,n)," \xB7 ",n("composer.agentUnavailableBadge")]}):s?u("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:n("composer.agentChoosePlaceholder")}):u("span",{className:"min-w-0 truncate",children:HC(i,n)}),u(Hr,{})]}),u(ho,{align:"start",children:u(or,{value:r!==null||s?"":t.activeInstanceId,onValueChange:c=>{!c||r===null&&!s&&c===t.activeInstanceId||t.onInstanceChange(c)},children:d.map(c=>u(To,{value:c.instanceId,children:HC(c,n)},c.instanceId))})})]})});function uM(e){return u($C,{...e})}function Xm(e){switch(e){case"probing":return{seatKey:"modelPicker.fetchingModels",blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{seatKey:"modelPicker.chooseModel",blockKey:"composer.modelMissing",canChooseModel:!0};default:return null}}function fM(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function mV(e){return typeof e!="string"?null:e.trim()||null}function gV(e){if(e.type!=="select"||!e.promptInjectedValues?.includes("ultrathink"))return e;let t=e.options.filter(r=>r.id!=="ultrathink"),n=e.currentValue==="ultrathink"?void 0:e.currentValue,o=t.length===0?e.promptInjectedValues:e.promptInjectedValues.filter(r=>r!=="ultrathink");return{id:e.id,label:e.label,...e.description?{description:e.description}:{},type:"select",options:t,...n?{currentValue:n}:{},...o.length>0?{promptInjectedValues:o}:{}}}function hV(e){let t=gV(e);return t.type==="select"?{...t,options:[...t.options],...t.promptInjectedValues?{promptInjectedValues:[...t.promptInjectedValues]}:{}}:{...t}}function vV(e,t){return e?.find(o=>o.id===t)?.value}function pM(e,t){let n=mV(t);return n?e.options.length===0?n==="ultrathink"&&e.promptInjectedValues?.includes(n)?void 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 yV(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?pM(e,t):pM(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function lu(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(hV).map(r=>yV(r,vV(n,r.id)??r.currentValue))}function Ri(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function qC(e){if(!e)return;let t=Ri(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function CV(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Ri(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function Ym(e,t){if(!t||t.length===0)return;let n=new Set(t.map(r=>r.id)),o=CV(e)?.filter(r=>n.has(r.id));return o&&o.length>0?o:void 0}le();function Jm(e,t,n){if(e!=="opencode"||t.length===0)return!1;let o=n?.trim();return o?!t.some(r=>r.slug===o):!1}function Zm(e,t){if(e)return t?e:e.filter(n=>n.id!=="agent"||n.value!=="plan")}var mM={agent:"traits.savedOption.agent",effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant"};function xV(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function gM(e,t){return Object.hasOwn(mM,t)?e(mM[t]):xV(t)}function hM(e,t){return(e??[]).map(n=>typeof n.value=="boolean"?{id:n.id,label:t(n.id),type:"boolean",currentValue:n.value}:{id:n.id,label:t(n.id),type:"select",options:[{id:n.value,label:n.value}],currentValue:n.value})}function bV(){let{t:e}=pe();return u(Nr,{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 SV(e,t,n){return Ym(e,[...t??[],{id:n}])}function vM(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 IV(e){if(!e)return null;let t=Ri(e);return typeof t=="string"?t:null}function yM(){let{t:e}=pe();return t=>gM(e,t)}var wV=e=>e;function TV(e,t,n,o,r,a,s){let i=e.getModelCapabilities(n,o,a),l=Jm(t,n,o),d=l?hM(Zm(r,a),s):lu({caps:i,selections:r}),c=d.filter(y=>y.type==="select"),f=d.filter(y=>y.type==="boolean"),p=c[0]??null,m=c.find(y=>y.id==="contextWindow")??null,g=c.find(y=>y.id==="agent")??null,h=f.find(y=>y.id==="fastMode")??null,v=f.find(y=>y.id==="thinking")??null;return{caps:i,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:g,fastModeDescriptor:h,thinkingDescriptor:v,modelIsUnavailable:l}}function VC(e){let t=TV(e.modelApi,e.provider,e.models,e.model,e.modelOptions,e.planModeEnabled,e.labelOf??wV),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,s=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:s,hasAnyControls:n||o||r||a||s||t.modelIsUnavailable&&t.descriptors.length>0}}function WC(e){return VC(e).hasAnyControls}var GC=ye(function({provider:t,instanceId:n,models:o,model:r,modelOptions:a,planModeEnabled:s,...i}){let{t:l}=pe(),d=yM(),c=Et(),f=c.draft.useStore(b=>b.setProviderModelOptions),p=E(b=>{if("onModelOptionsChange"in i){i.onModelOptionsChange(b);return}let w=i.threadRef??i.draftId;w&&f(w,t,b,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,i,t,f]),{descriptors:m,selectDescriptors:g,booleanDescriptors:h,hasAnyControls:v,modelIsUnavailable:y}=VC({modelApi:c.model,provider:t,models:o,model:r,modelOptions:a,planModeEnabled:s,labelOf:d}),C=(b,w)=>{p(SV(b,a,w))},x=(b,w)=>{w&&C(vM(m,b.id,w),b.id)};return v?y?u(Ie,{children:m.map((b,w)=>{let I=b.type==="boolean"?l(b.currentValue===!0?"traits.on":"traits.off"):qC(b);return I?S("div",{children:[w>0?u(aa,{}):null,S(Xi,{children:[u(Yb,{children:b.label}),u("div",{className:"px-2 pb-1.5 text-ui-sm text-muted-foreground",children:I})]})]},b.id):null})}):S(Ie,{children:[g.map((b,w)=>{let I=IV(b)??"";return S("div",{children:[w>0?u(aa,{}):null,S(Xi,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:b.label}),u(or,{value:I,onValueChange:k=>x(b,k),children:b.options.map(k=>u(To,{value:k.id,hideIndicator:!0,closeOnClick:!0,children:S("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:S("span",{className:"min-w-0 truncate",children:[k.label,k.isDefault?S(Ie,{children:[" ",u(bV,{})]}):null]})}),k.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:k.description}):null]})},k.id))})]})]},b.id)}),h.map((b,w)=>{let I=b.currentValue===!0?"on":"off";return S("div",{children:[w>0||g.length>0?u(aa,{}):null,S(Xi,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:b.label}),u(or,{value:I,onValueChange:k=>{C(vM(m,b.id,k==="on"),b.id)},children:["on","off"].map(k=>u(To,{value:k,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:l(k==="on"?"traits.on":"traits.off")})})},k))})]})]},b.id)})]}):null});function PV(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 i=Ri(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(i==="default"||i===l.id)){o=i===l.id,n=a.options.find(({id:d})=>d===i)?.label??e(o?"traits.fast":"traits.normal");continue}}let s=a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):qC(a);typeof s=="string"&&s.length>0&&r.push(s)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var CM=ye(function({provider:t,instanceId:n,models:o,model:r,modelOptions:a,planModeEnabled:s,triggerVariant:i,triggerClassName:l,...d}){let[c,f]=Q(!1),{t:p}=pe(),m=yM(),g=Et().model,{descriptors:h}=VC({modelApi:g,provider:t,models:o,model:r,modelOptions:a,planModeEnabled:s,labelOf:m});if(!WC({modelApi:g,provider:t,models:o,model:r,modelOptions:a,planModeEnabled:s}))return null;let{label:v,showFastModeIcon:y}=PV(p,{provider:t,descriptors:h}),C=y?S(Ie,{children:[u(Mo,{icon:Gs,className:K("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:p("traits.fastModeOn")})]}):null,x=t==="codex";return S(go,{open:c,onOpenChange:b=>{f(b)},children:[u(vo,{render:u(Eo,{variant:i??"ghost",className:K(x?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",l)}),children:x?S("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[C,u("span",{className:"min-w-0 truncate",children:v}),u(Hr,{})]}):S(Ie,{children:[C,u("span",{children:v}),u(Hr,{})]})}),u(ho,{align:"start",children:u(GC,{provider:t,...n?{instanceId:n}:{},models:o,model:r,modelOptions:a,planModeEnabled:s,...d})})]})});function xM(e,t){let{provider:n,model:o,models:r,modelOptions:a,planModeEnabled:s}=e;if(Jm(n,r,o)){let m=Zm(a,s);return{provider:n,modelOptionsForDispatch:m&&m.length>0?[...m]:void 0}}let i=t.getModelCapabilities(r,o,s),l=lu({caps:i,selections:a}),d=r.find(m=>m.slug===o)?.capabilities?.optionDescriptors?.find(m=>m.type==="select"&&m.id==="effort"),c=i.optionDescriptors?.find(m=>m.type==="select"&&m.id==="effort"),p=n==="claudeAgent"&&a?.some(m=>m.id==="effort"&&m.value==="ultrathink")&&(d?.type==="select"&&d.promptInjectedValues?.includes("ultrathink")?!0:c?.type==="select"&&(c.promptInjectedValues?.includes("ultrathink")||c.options.length>0&&!c.options.some(m=>m.id==="ultrathink")))?a?.filter(m=>m.id!=="effort"):a;return{provider:n,modelOptionsForDispatch:Ym(l,[...p??[],...s?[]:kV(r,o,t)])}}function kV(e,t,n){let o=lu({caps:n.getModelCapabilities(e,t,!0),selections:void 0}).find(r=>r.type==="select"&&r.id==="agent");return o&&Ri(o)==="plan"?[{id:o.id}]:[]}function bM(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:s,models:i,modelOptions:l,planModeEnabled:d}=t;return!(r!==void 0||a!==void 0)||!WC({modelApi:t.modelApi,provider:n,models:i,model:s,modelOptions:l,planModeEnabled:d})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:i,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:s,modelOptions:l,planModeEnabled:d})}function SM(e){return bM(GC,e)}function IM(e){return bM(CM,e)}le();function wM(e){let{threadId:t,isLocalDraftThread:n,selection:o,selectionsEqual:r,onChosen:a}=e,s=N(null);q(()=>{let i=s.current;s.current={threadId:t,selection:o},!(i===null||i.threadId!==t||n)&&(r(i.selection,o)||a?.(o))},[t,n,o,r,a])}le();function TM(e){let{api:t,providerStatus:n,instanceId:o,environmentId:r,cwd:a,threadId:s}=e,i=t.providerInventory.useWorkspaceInventory({environmentId:r,instanceId:o,cwd:a,threadId:s});return V(()=>n===null||i===null?n:{...n,slashCommands:i.slashCommands,skills:i.skills},[n,i])}function PM(e){let{api:t,t:n,settings:o,composerDraft:r,composerDraftTarget:a,environmentId:s,gitCwd:i,routeKind:l,threadId:d,activeThread:c,isLocalDraftThread:f,unavailableAgentInstanceId:p,agentNotChosen:m,runtimeMode:g,lockedProvider:h,providerStatuses:v,projectId:y,activeProjectDefaultModelSelection:C,activeThreadModelSelection:x,compactDisabledReason:b,externalSendDisabledReason:w,attachmentBlockReason:I,answeringQuestion:k,setComposerDraftNativeMode:P,handleNativeModeChange:T,onProviderInstanceSelect:L,onModelSelectionChosen:A}=e,M=V(()=>aM(t.model.applyInstanceSettings(t.model.deriveInstanceEntries(v),o)),[t.model,v,o]),R=r.activeProvider??null,D=c?.session?.providerInstanceId??x?.instanceId??C?.instanceId??null,W=iM(M,R??D)??t.model.makeDriverKind("unconfigured"),F=h??W,J=V(()=>{if(!h||!c)return null;let ae=c.session?.providerInstanceId??x?.instanceId;return ae?M.find(de=>de.instanceId===ae)?.continuationGroupKey??null:null},[c,x?.instanceId,h,M]),O=V(()=>{if(p!==null)return p;let ae=[r.activeProvider,c?.session?.providerInstanceId,x?.instanceId,C?.instanceId];for(let de of ae){if(!de)continue;let Pe=M.find(_e=>_e.instanceId===de&&sM(_e));if(Pe){if(h&&Pe.driverKind!==h||J&&Pe.continuationGroupKey!==J)continue;return Pe.instanceId}}return t.model.noProviderSelection.instanceId},[C?.instanceId,c?.session?.providerInstanceId,x?.instanceId,r.activeProvider,J,h,M,p]),B=p!==null,Y=V(()=>B||m?void 0:M.find(ae=>ae.instanceId===O),[m,B,M,O]),U=Y===void 0&&!B&&!m,X=B&&KC(M,{lockedProvider:h,lockedContinuationGroupKey:J}).length===0,re=b??(U?n("composer.compactingUnavailable"):null),G=Y?.driverKind??F,{modelOptions:te,selectedModel:oe,selectedModelStatus:Z}=t.draft.useEffectiveModelState({threadRef:a,providers:v,selectedProvider:G,selectedInstanceId:O,threadModelSelection:x,projectModelSelection:C,settings:o}),ee=V(()=>Y?.snapshot??null,[Y]),fe=TM({api:t,providerStatus:ee,instanceId:Y?.instanceId??null,environmentId:s,cwd:i,threadId:l==="server"?d:null}),Re=V(()=>Y?.models??[],[Y]),Be=V(()=>xM({provider:G,model:oe,models:Re,modelOptions:te?.[O],planModeEnabled:o.planModeEnabled},t.model),[te,O,oe,G,Re,o.planModeEnabled]),Se=Be.modelOptionsForDispatch,Ee=o.planModeEnabled,ne=V(()=>({showInteractionModeToggle:Ee&&t.model.getInteractionModeToggle(v,G),runtimeModeSwitch:fe?.runtimeModeSwitch??"next-turn"}),[Ee,v,G,fe]),we=fe?.supportsNativeModeSwitch===!0,j=f&&we?r.nativeModeByProvider?.[O]??null:null,ue=V(()=>t.model.resolveNativeMode(fe,{runtimeMode:g,nativeModeId:f?j:c?.nativeModeId??null}),[t.model,c?.nativeModeId,fe,g,f,j]),ge=j&&ue?.current.id===j?j:void 0,ie=E(ae=>{f&&P(a,O,ae),T(ae)},[f,P,a,O,T]),He=V(()=>t.model.createSelection(O,oe,Se),[t.model,O,oe,Se]);wM({threadId:c?.id??null,isLocalDraftThread:f,selection:He,selectionsEqual:t.model.selectionsEqual,onChosen:B||m?void 0:A});let Pt=E(ae=>L(ae,He),[L,He]),ct=oe,gt=V(()=>{let ae=new Map;for(let de of M)ae.set(de.instanceId,t.model.getAppModelOptionsForInstance(o,de,de.instanceId===O?ct:null));return ae},[t.model,M,O,ct,o]),bt=V(()=>(gt.get(O)??[]).some(de=>de.slug===ct)?ct:t.model.normalizeSlug(ct)??ct,[t.model,gt,O,ct,G]),ut=f&&h===null,mt=t.pluginComposer.useOptions(ut?s:null,y),st=mt.options,lt=ut?r.selectedPluginActionKey:null,At=V(()=>lt===null?null:st.find(ae=>ae.id===lt)??null,[lt,st]),Wt=lt!==null,fn=Wt&&At===null?n(mt.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,at=w??fn??(k?null:I),Mt=at!==null,[Ht,nn]=Q(!1);q(()=>{nn(!1)},[O]);let Kt=Xm(Z),jt=fM({status:Z,submissionTarget:k?"pending-user-input":"provider-turn"}),yn=Ht&&jt?Kt:null,$=V(()=>lM(x,gt),[x,gt]);return{providerInstanceEntries:M,lockedContinuationGroupKey:J,selectedInstanceId:O,agentUnavailable:B,selectedProviderEntry:Y,noProviderAvailable:U,agentUnavailableNoChoice:X,resolvedCompactDisabledReason:re,selectedProvider:G,composerModelOptions:te,selectedModel:oe,selectedModelStatus:Z,selectedProviderStatus:fe,selectedProviderModels:Re,composerProviderState:Be,selectedModelOptionsForDispatch:Se,planModeUiEnabled:Ee,composerProviderControls:ne,canSwitchNativeMode:we,composerNativeMode:ue,selectedNativeModeId:ge,handleComposerNativeModeChange:ie,selectedModelSelection:He,onAgentInstanceChange:Pt,modelOptionsByInstance:gt,selectedModelForPickerWithCustomFallback:bt,canSelectPluginAction:ut,pluginOptions:st,selectedPluginAction:At,isPluginComposer:Wt,pluginBlockMessage:fn,sendDisabledReason:at,isSendDisabled:Mt,setModelSendBlockShown:nn,isModelSendBlocked:jt,modelSendBlock:yn,activeThreadModelDisplayName:$}}function kM(e){let{api:t,settings:n,routeKind:o,routeThreadRef:r,draftId:a,selectedProvider:s,selectedInstanceId:i,selectedModel:l,selectedProviderModels:d,composerModelOptions:c}=e,f={modelApi:t.model,provider:s,instanceId:i,...o==="server"?{threadRef:r}:{},...o==="draft"&&a?{draftId:a}:{},model:l,models:d,modelOptions:c?.[i],planModeEnabled:n.planModeEnabled};return{providerTraitsMenuContent:SM(f),providerTraitsPicker:IM(f)}}le();le();le();function LM(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function LV(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.instanceId===t.instanceId&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function AM(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function jC(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function eg(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 QC(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function RM(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=jC(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 EM(e,t){let n=[];for(let o of e){let r=RM(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,display:r,nativeLabel:o.nativeLabel,durationMs:o.windowMs,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:QC(o,t)})}return n}function MM(e){return e.filter(t=>t.kind==="rate-limit"&&RM(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function NM(e){return e.snapshot===null||e.credentialIdentity===null?null:LV(e.snapshot,e)?e.snapshot:null}function _M(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function DM(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}le();function OM(e,t){let n=N(e),o=N(0),r=N(!1),[a,s]=Q(e),[i,l]=Q(null),[d,c]=Q(!1);a!==e&&(s(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=E(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let g=await t();if(o.current!==p||n.current!==m)return;l(g)}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:i,refreshing:d,refresh:f}}function FM(e){let t=e===null?Number.NaN:Date.parse(e),[n,o]=Q(()=>Date.now());q(()=>{let a=Date.now();if(o(a),!Number.isFinite(t)||t<=a)return;let s=setTimeout(()=>o(Date.now()),Math.min(2147483647,t-a));return()=>clearTimeout(s)},[t]);let r=Number.isFinite(t)&&t>n;return{active:r,retryAt:r?e:null}}var AV={reset:"accountUsage.redeemOutcomeReset",nothingToReset:"accountUsage.redeemOutcomeNothingToReset",noCredit:"accountUsage.redeemOutcomeNoCredit",alreadyRedeemed:"accountUsage.redeemOutcomeAlreadyRedeemed",failed:"accountUsage.redeemFailed"};function RV({instanceLabel:e,resetCredits:t,onRedeemReset:n,onResult:o,t:r}){let[a,s]=Q(!1),[i,l]=Q(!1),d=async()=>{s(!1),l(!0);try{o(await n())}catch{o("failed")}finally{l(!1)}};return S(Ie,{children:[u(ce,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":r("accountUsage.redeemAria",{instance:e}),disabled:i,onClick:()=>s(!0),children:r(i?"accountUsage.redeeming":"accountUsage.redeemAction")}),u(Gu,{open:a,onOpenChange:s,children:S(Ju,{className:"max-w-lg",children:[S(Yu,{children:[u(Zu,{children:r("accountUsage.redeemConfirmTitle")}),u(Qu,{children:r("accountUsage.redeemConfirmDescription",{count:t,instance:e})})]}),S(Xu,{children:[u(ju,{render:u(ce,{variant:"ghost"}),children:r("accountUsage.redeemCancel")}),u(ce,{variant:"destructive-outline",disabled:i,onClick:()=>{d()},children:r("accountUsage.redeemConfirm")})]})]})})]})}function YC(e,t){switch(e.unit){case"days":return t("accountUsage.windowDays",{count:e.count});case"hours":return t("accountUsage.windowHours",{count:e.count});case"minutes":return t("accountUsage.windowMinutes",{count:e.count});case"seconds":return t("accountUsage.windowSeconds",{count:e.count})}}function JC(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=eg(e.durationMs);return o!==null?YC(o,t):_V(e.kind,t)}function EV(e,t){switch(e.kind){case"unlimited":return t("accountUsage.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("accountUsage.percentUsed",{value:e.amount}):t("accountUsage.percentRemaining",{value:e.amount})}}function MV(e,t){let n=EV(e.display,t);if(e.kind==="quota-window")return`${JC(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function NV(e,t,n){let o=JC({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:e.durationMs},t),r=eg(e.durationMs);return r!==null?`${o} \xB7 ${YC(r,t)}`:e.resetsAt!==null?`${o} \xB7 ${t("accountUsage.resetsAt",{time:Ei(e.resetsAt,n)})}`:o}function _V(e,t){switch(e){case"balance":return t("accountUsage.kindBalance");case"credits":return t("accountUsage.kindCredits");case"quota-window":return t("accountUsage.kindQuotaWindow");case"spend-cap":return t("accountUsage.kindSpendCap");case"rate-limit":return t("accountUsage.kindRateLimit")}}function DV(e,t){switch(e){case"account":return t("accountUsage.scopeAccount");case"org":return t("accountUsage.scopeOrg")}}var BM=new Map;function Ei(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let o=BM.get(t);return o===void 0&&(o=new Intl.DateTimeFormat(t,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),BM.set(t,o)),o.format(n)}function OV(e,t,n){switch(e.outcome){case"fresh":return t("accountUsage.outcomeFresh");case"partial":return t("accountUsage.outcomePartial");case"joined-inflight":return t("accountUsage.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("accountUsage.outcomeRateLimited"):t("accountUsage.outcomeRateLimitedUntil",{time:Ei(e.retryAt,n)});case"offline":return t("accountUsage.outcomeOffline");case"unsupported":return t("accountUsage.outcomeUnsupported");case"error":return t("accountUsage.outcomeError")}}function FV(e,t){switch(e){case"credential-unavailable":return t("accountUsage.unsupportedSignedOut");case"instance-disabled":return t("accountUsage.unsupportedDisabled");case"unsupported-driver":return t("accountUsage.unsupportedNoChannel");default:return t("accountUsage.unsupported")}}function BV(e,t){switch(e){case"rate-limited":return t("accountUsage.outcomeRateLimited");case"auth-rejected":return t("accountUsage.errorAuthRejected");case"unreachable":return t("accountUsage.errorUnreachable");case"response-invalid":return t("accountUsage.errorResponseInvalid");case"reader-unloaded":return t("accountUsage.errorReaderUnloaded");case"never-read":return t("accountUsage.neverRead");case"missing-credentials":return t("accountUsage.errorMissingCredentials");case"custom-endpoint":return t("accountUsage.errorCustomEndpoint");case"unsupported-login":return t("accountUsage.errorUnsupportedLogin");default:return t("accountUsage.outcomeError")}}function UV(e,t,n){return e.capability.status==="unsupported"?FV(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?BV(e.error,n):e.credentialIdentity===null||e.capability.status==="unknown"?n("accountUsage.unknown"):n("accountUsage.noData")}function XC(e,t){let n=jC(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 UM(e){let[t,n]=Q(!1);return u(zV,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function zV(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=pe(),s=Et().i18n.useLanguage(),i=LM(r),{feedback:l,refreshing:d,refresh:c}=OM(i,o),[f,p]=Q(null),m=f?.key===i?f.outcome:null,g=r.capability.status==="supported"&&r.credentialIdentity!==null?NM(r):null,h=g?.metrics??[],v=EM(h,r.error),y=v.some(M=>M.stale)||r.error!==null&&g!==null,C=_M(v),x=DM(h),b=FM(r.retryAt??null),w=d||b.active,I=r.error==="never-read",k=UV(r,v,a),P=AM(r),L=`${kr()}-account-usage-details`,A=[...v.map(M=>({key:M.metricId,text:MV(M,a)})),...MM(h).map(M=>({key:`${M.metricId}\0status`,text:NV(M,a,s)})),...C===null?[]:[{key:"resets-at",text:a("accountUsage.resetsAt",{time:Ei(C,s)})}]];return S("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-account-usage":"true","data-refresh-outcome":l?.outcome??"",children:[S("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ce,{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":L,"aria-label":a(t?"accountUsage.hideDetails":"accountUsage.showDetails"),onClick:n,children:S("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[S("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.instanceLabel}),y?u("span",{className:"text-ui-xs text-muted-foreground","data-composer-account-usage-stale":"true",children:a("accountUsage.stale")}):null,u(tn,{"aria-hidden":"true",className:K("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-ui-xs tabular-nums text-secondary-label",children:A.length>0?A.map((M,R)=>S("span",{children:[R>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,M.text]},M.key)):k})]})}),P?u(ce,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("accountUsage.refreshAria",{instance:r.instanceLabel}),disabled:w,onClick:()=>{p(null),c()},children:a(d?"accountUsage.refreshing":I?"accountUsage.read":"accountUsage.refresh")}):null,r.onRedeemReset!==void 0&&(r.resetCredits??0)>0?u(RV,{instanceLabel:r.instanceLabel,resetCredits:r.resetCredits??0,onRedeemReset:r.onRedeemReset,onResult:M=>p({key:i,outcome:M}),t:a}):null]}),t?S("div",{id:L,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-account-usage-details":"true",children:[h.length===0?u("p",{className:"text-ui-xs text-secondary-label",children:k??a("accountUsage.noData")}):h.map(M=>u(HV,{metric:M,queryError:r.error,t:a,language:s},M.metricId)),x!==null?u("p",{className:"text-ui-xs text-secondary-label",children:a("accountUsage.collectedAt",{time:Ei(x,s)})}):null]}):null,b.active&&b.retryAt!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground",children:a("accountUsage.outcomeRateLimitedUntil",{time:Ei(b.retryAt,s)})}):m!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground","data-composer-account-usage-redeem":m,children:a(AV[m])}):l!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground",children:OV(l,a,s)}):r.error!==null&&g!==null?u("p",{role:"status",className:"px-1 pb-1 text-ui-xs text-muted-foreground",children:a("accountUsage.errorKeepLast")}):null]})}function HV({metric:e,queryError:t,t:n,language:o}){let r=XC(e,e.used),a=e.unlimited===!0?n("accountUsage.unlimited"):XC(e,e.remaining),s=XC(e,e.limit),i=n("accountUsage.sharedScope",{scope:DV(e.scope,n)}),l=QC(e,t),d=e.windowMs,c=eg(d),f=JC({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return S("div",{className:"text-ui-xs text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-window-ms":d===null?void 0:String(d),children:[S("div",{className:"font-medium text-foreground",children:[f,l?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("accountUsage.stale")}):null]}),S("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[r!==null?S("span",{children:[r," ",n("accountUsage.used")]}):null,a!==null?S("span",{children:[a," ",e.unlimited===!0?null:n("accountUsage.remaining")]}):null,s!==null?S("span",{children:[s," ",n("accountUsage.limit")]}):null]}),u("div",{className:"mt-0.5",children:i}),e.fetchedAt!==null?u("div",{children:n("accountUsage.collectedAt",{time:Ei(e.fetchedAt,o)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:Ei(e.resetsAt,o)})}):null,c!==null?u("div",{children:YC(c,n)}):null]})}var zM=ye(function(t){let{data:n,target:o}=$o(),r=Ub(),a=n.useAccountUsage({target:o,active:r&&!t.hidden});return t.hidden||a===void 0?null:u(UM,{...a},a.queryKey)});function HM(e){switch(e){case"image":return Bs;case"pdf":return Fs;case"text":return Os;case"file":return no}}function KV(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(`
3796
+ `)}function $V({context:e,onRemove:t}){let{t:n}=pe(),o=Et().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return S(Qe,{children:[u(Ye,{render:S("span",{className:K(zr,"pr-1"),children:[u(Rr,{className:K(Yo,"size-icon-1")}),u("span",{className:Jo,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:km,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(e.id)},children:u(Xt,{className:"size-3","aria-hidden":!0})})]})}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:KV(e,o.formatLabel,o.formatSourceLabel)})]})}function KM({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(o=>u($V,{context:o,onRemove:t},o.id))})}function $M({comments:e,onRemove:t,className:n}){let{t:o}=pe();return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,s=S("span",{className:K(zr,"pr-1"),children:[u(zs,{className:K(Yo,"size-icon-1")}),u("span",{className:Jo,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:km,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(r.id)},children:u(Xt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?s:S(Qe,{children:[u(Ye,{render:s}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function tg(e){let{t}=pe(),n=t(e.tooltipKey,{count:e.count});return S(Qe,{children:[u(Ye,{render:S("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:n})]})}function qM({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:s}){let{t:i}=pe(),l=Et().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:K("flex flex-wrap gap-1.5",s),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(g=>{let h=l.normalizeSelection(g.element);return h?[{id:g.id,label:l.formatLabel(h)}]:[]});return S("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":i("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:i("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(Rr,{className:"size-icon-2"})}),S("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,S("div",{className:K("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?S("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:g,label:h})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:h},g)),m.length>2?S("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,S("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(tg,{icon:u(Rr,{className:"size-3"}),count:c.elements.length,tooltipKey:"previewAnnotation.elementCount"}):null,c.regions.length>0?u(tg,{icon:u(wd,{className:"size-3"}),count:c.regions.length,tooltipKey:"previewAnnotation.regionCount"}):null,c.strokes.length>0?u(tg,{icon:u(Er,{className:"size-3"}),count:c.strokes.length,tooltipKey:"previewAnnotation.drawingCount"}):null,c.styleChanges.length>0?u(tg,{icon:u(Ks,{className:"size-3"}),count:c.styleChanges.length,tooltipKey:"previewAnnotation.styleChangeCount"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:$m(p.progress)}):null,p?.status==="failed"&&f&&a?S(Qe,{children:[u(Ye,{render:u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":i("attachments.retryUpload",{name:f.name}),onClick:()=>a(f)}),children:u(qs,{className:"size-3"})}),u(Xe,{side:"top",children:Km(p,i)})]}):null]})]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":i("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(Xt,{className:"size-3"})})]},c.id)})})}function ZC(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 VM(e){let{t}=pe(),{api:n,environmentId:o,composerDraftTarget:r,isComposerCollapsedMobile:a,isComposerApprovalState:s,hasPendingUserInputs:i,supportsAttachmentUploads:l,uploadsByImageId:d,composerImages:c,composerPreviewableImages:f,composerPreviewAnnotations:p,composerReviewComments:m,composerElementContexts:g,nonPersistedComposerImageIdSet:h,removeComposerDraftPreviewAnnotation:v,removeComposerDraftReviewComment:y,removeComposerDraftElementContext:C,removeComposerImage:x,onExpandImage:b}=e;return S(Ie,{children:[!a&&!s&&!i&&p.length>0&&u(qM,{annotations:p,images:c,...l?{uploadsByImageId:d,onRetryUpload:w=>n.uploads.retry({environmentId:o,image:w})}:{},onRemove:w=>{n.uploads.release(w),v(r,w)},onExpandImage:w=>{let I=ZC(f,w);I&&b(I)},className:"mb-3"}),!a&&!s&&!i&&m.length>0&&u($M,{comments:m,onRemove:w=>y(r,w),className:"mb-3"}),!a&&!s&&!i&&g.length>0&&u(KM,{contexts:g,onRemove:w=>C(r,w),className:"mb-3"}),!a&&!s&&!i&&c.some(w=>!p.some(I=>I.id===w.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:c.filter(w=>!p.some(I=>I.id===w.id)).map(w=>{let I=l?d[w.id]:void 0,k=qm(w),P=HM(k),T=k==="image"&&!!w.previewUrl;return S("div",{className:K("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",T?"w-16":"w-44 max-w-full"),children:[T?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":t("attachments.preview",{name:w.name}),onClick:()=>{let L=ZC(f,w.id);L&&b(L)},children:u("img",{src:w.previewUrl,alt:w.name,className:"h-full w-full object-cover"})}):S("a",{href:w.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":t("attachments.open",{name:w.name}),children:[u(P,{className:"size-4 shrink-0 text-secondary-label"}),S("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:w.name}),u("span",{className:"block text-[10px] text-secondary-label",children:Xl(w.sizeBytes)})]})]}),h.has(w.id)&&S(Qe,{children:[u(Ye,{render:u("span",{role:"img","aria-label":t("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(hn,{className:"size-3"})})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:t("attachments.draftMayNotPersistDetail")})]}),I?.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:$m(I.progress)}),I?.status==="failed"&&S(Qe,{children:[u(Ye,{render:u(ce,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>n.uploads.retry({environmentId:o,image:w}),"aria-label":t("attachments.retryUpload",{name:w.name})}),children:u(qs,{})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Km(I,t)})]}),u(ce,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>x(w.id),"aria-label":t("attachments.remove",{name:w.name}),children:u(Xt,{})})]},w.id)})})]})}function WM(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function GM(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}function jM(e){return e.isComposerApprovalState?e.approvalDetail??e.t("composer.resolveApprovalToContinue"):e.activePendingProgress?e.t("composer.typeOwnAnswer"):e.showPlanFollowUpPrompt?e.t("composer.addFeedbackRefinePlan"):e.projectSelectionRequired?e.t("composer.chooseProjectToStart"):e.noProviderAvailable?e.t("composer.enableProviderToSend"):e.t(e.tailPlaceholderKey??"composer.askAnythingFull")}le();le();var QM=ye(function(t){let{t:n}=pe(),o=Vm();return S(go,{children:[u(vo,{render:u(ce,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":n("composer.moreComposerControls")}),children:u(zo,{"aria-hidden":"true",className:"size-4"})}),S(ho,{align:"start",children:[t.traitsMenuContent?S(Ie,{children:[t.traitsMenuContent,u(aa,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?S(Ie,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.modeMenuTitle")}),S(or,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(To,{value:"default",children:n("composer.interactionModeChat")}),u(To,{value:"plan",children:n("composer.interactionModePlan")})]}),u(aa,{})]}):null,t.nativeMode===null?S(Ie,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),u(or,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Cr.map(r=>u(To,{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]}):S(Ie,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?S(Ie,{children:[u(or,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(To,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):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})]})]})]})});le();le();le();var yx=ud(ZM(),1),DN=ud(nc(),1),ON=ud(nc(),1);Nn(function(t,n){return Me("div",{ref:n,...t})});var ug=Nn(function(t,n){return Me("div",{ref:n,...t})}),er=ug,La={OS:"web"};function Mi(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function Cx(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 FN(){return"normal"}function ZV(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:FN()}function eW(e){var t;return(t=e?.rtl)!=null?t:!1}function Ra(e){return xx(e?.props)}function xx(e){return!!e?.horizontal&&eW(e)}function bx(e){return e?.horizontal?(xx(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function tW(e,t){var n;return(n=Cx(e,t))!=null?n:0}function eN(e,t){return t&&(Ra(e)?t.left:t.right)||0}function nW(e,t,n,o){return!Ra(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function Sx(e,t,n){if(!e||!Ra(e))return t;let o=Cx(e,n),r=Mi(t,o),a=ZV(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Mi(o-r,o):r}function oW(e,t,n){if(!Ra(e))return e.horizontalRTLScrollType=void 0,t;let o=Cx(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Mi(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let s=e.horizontalRTLScrollType;if(s==="inverted")return Mi(a,o);if(s==="normal")return Mi(r,o);if(!e.hasScrolled){let f=FN();return e.horizontalRTLScrollType=f,Mi(r,o)}let i=e.scroll,l=Math.abs(r-i),c=Math.abs(a-i)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Mi(c?a:r,o)}var rW=e=>e,fg=yt(null),BN="\0",aW=0;function sW({children:e}){let[t]=Q(()=>({animatedScrollY:rW(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:aW++,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 Me(fg.Provider,{value:t},e)}function br(){return Ot(fg)}function UN(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let s=0;s<t.length;s++){let i=be(e,t[s]);r.push(i),i!==o[s]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let s of t)a.push(Pa(e,s,r));return()=>{for(let s of a)s()}}}}function iW(e){return e.length===1?e[0]:e.join(BN)}function lW(e){return e.split(BN)}function Pa(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 be(e,t){let{values:n}=e;return n.get(t)}function Fe(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 s of a)s(n)}}function dW(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 cW(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function _o(e){let t=Ot(fg),n=iW(e),{subscribe:o,get:r}=V(()=>UN(t,lW(n)),[t,n]);return(0,yx.useSyncExternalStore)(o,r,r)}function uW(e,t){let n=Ot(fg),{subscribe:o,get:r}=V(()=>UN(n,[e]),[n,e]),a=E(()=>t(r()[0]),[r,t]);return(0,yx.useSyncExternalStore)(o,a,a)}function fW(e){return Math.max(0,e??0)}function _i(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,s=r.contentInset,i=s??o.nativeContentInset,l=(a?eN(o,i):i?.bottom)||0,d=fW(t??r.contentInsetEndAdjustment),c=be(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let g={bottom:0,left:0,right:0,...i,...p};return Math.max(((a?eN(o,g):g.bottom)||0)+d,f)}return Math.max(m,f)}function Zn(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,s=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,i=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=_i(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+i+s+(c||0)}var Zl=({children:e})=>Me(ug,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ye(function(){let t=br(),[n=0,o=0,r=0,a=0,s=0,i=0,l=!1]=_o(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=Zn(t),[,c]=ea(f=>f+1,0);return pW(()=>{c()},100),Me(ug,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Me(Zl,null,Me(er,null,"TotalSize:"),Me(er,null,n.toFixed(2))),Me(Zl,null,Me(er,null,"ContentSize:"),Me(er,null,d.toFixed(2))),Me(Zl,null,Me(er,null,"At end:"),Me(er,null,String(l))),Me(Zl,null,Me(er,null,"ScrollAdjust:"),Me(er,null,o.toFixed(2))),Me(Zl,null,Me(er,null,"RawScroll: "),Me(er,null,r.toFixed(2))),Me(Zl,null,Me(er,null,"ComputedScroll: "),Me(er,null,a.toFixed(2))))});function pW(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var Ix=!0,zN=new WeakMap;function mW(e){return zN.get(e)}function gW(e,t){zN.set(e,t)}var hW=typeof __DEV__<"u"?__DEV__:void 0,tN,nN=typeof process<"u"&&typeof process.env=="object"&&process.env?(tN="production")!=null?tN:process.env.MODE:void 0,oN=typeof nN=="string"?nN.toLowerCase()!=="production":void 0,rN,No=(rN=oN??hW)!=null?rN:!1,ed=-1e7,HN=1,vW=No&&!1,yW=No&&!1;function pg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function KN(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 CW(e){pg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,KN(e)}function xW(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function bW(e,t){var n,o,r,a;let s=e.state,i=s.deferredPublicOnScrollEvent;s.deferredPublicOnScrollEvent=void 0,i&&((a=(r=s.props).onScroll)==null||a.call(r,xW(s,i,(o=(n=t??s.scrollPending)!=null?n:s.scroll)!=null?o:0)))}var tx=1;function SW(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function aN(e){e.initialScrollSession=void 0}function ix(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 ng(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=ix({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=ix({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var mg={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){ng(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){ng(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=ng(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},jn={clear(e){jn.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=tx},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>tx},isAtZeroTargetOffset(e){return e<=tx},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=ng(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Aa(e,t={}){var n,o,r,a;let s=e.initialScrollSession,i=(n=t.kind)!=null?n:s?.kind,l=s?.completion,d=s?.kind==="bootstrap"?s.bootstrap:void 0,c=i==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!i||!e.initialScroll&&!c&&!SW(l))return aN(e);let f=(a=(r=t.previousDataLength)!=null?r:s?.previousDataLength)!=null?a:0;return e.initialScrollSession=ix({bootstrap:c,completion:l,kind:i,previousDataLength:f}),e.initialScrollSession}var IW=1.3;function lx(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*IW||!t&&n<=0&&o>0}var $N=(e,t,n,o,r,a,s,i)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{i({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?lx(e,t,n)?(i(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(s(e),c(),!0):!1};function wW(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function qN(e){let t=e.state;if(!t.edgeReachedGate)return;let n=Zn(e),o=n-t.scroll-t.scrollLength-_i(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,s=t.props.onEndReachedThreshold*t.scrollLength,i=lx(t.scroll,!1,a),l=lx(o,r,s);i&&l&&(t.edgeReachedGate=void 0)}function VN(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function WN(e){e.state.edgeReachedGate="closed"}function sN(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function TW(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",wW(e,o),o}function uu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function GN(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:s,scroll:i,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=Zn(e);if(qN(e),f>0&&a){let p=_i(e),m=f-i-s-p,g=f<s;Fe(e,"isAtEnd",g||m<=HN),Fe(e,"isNearEnd",g||m<=c*s),Fe(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*s),uu(r)||l||(r.isEndReached=$N(m,g,c*s,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:i},v=>{var y,C;VN(e,"end",t,n)&&(WN(e),(C=(y=r.props).onEndReached)==null||C.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function PW(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:s},scroll:i,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=s*l;qN(e),r&&p>0&&i>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Fe(e,"isAtStart",i<=HN),Fe(e,"isNearStart",i<=p),uu(o)||o.scrollingTo||(o.isStartReached=$N(i,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:i},g=>{var h,v;VN(e,"start",t,n)&&(WN(e),(v=(h=o.props).onStartReached)==null||v.call(h,{distanceFromStart:g}))},g=>{o.startReachedSnapshot=g}))}function gg(e,t){let n=!e.state.edgeReachedGate;GN(e,t,n),PW(e,t,n)}function jN(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),gg(e)}var kW=6,LW=3,AW=250;function QN(e){e.state.scheduledWork.cancel("adaptiveRender")}function iN(e,t){let n=e.state;QN(e),t<=0?gu(e,"normal","scroll"):n.scheduledWork.timeout(()=>gu(e,"normal","scroll"),t,"adaptiveRender")}function gu(e,t,n){var o,r;be(e,"adaptiveRender")!==t&&(Fe(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function wx(e){var t,n;QN(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";be(e,"adaptiveRender")!==o&&gu(e,o,"initial")}function RW(e,t,n){var o,r,a;let s=e.state,i=s.props.adaptiveRender,l=be(e,"adaptiveRender");if(be(e,"readyToRender"))if(i){let d=(o=i.enterVelocity)!=null?o:kW,c=(r=i.exitVelocity)!=null?r:LW,f=(a=i.exitDelay)!=null?a:AW,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",g=s.scheduledWork.has("adaptiveRender")?"normal":l;m!==g&&(m==="light"?(gu(e,"light","scroll"),iN(e,f)):l==="light"&&iN(e,f))}else wx(e)}var Tx=50;function XN(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"&&!be(e,"readyToRender")&&!a?Math.min(o,Tx):o}function YN(e){let{state:t}=e;t.props.drawDistance<=Tx||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function Px(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Fe(e,"readyToRender",!1),wx(e)}function kx(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&&!be(e,"readyToRender")&&(Fe(e,"readyToRender",!0),gu(e,"normal","ready"),o.props.drawDistance>Tx&&YN(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var EW=2e3;function lN(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function JN(e){e.scheduledWork.cancel("preservedInitialScroll")}function td(e){JN(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Aa(e)}function dN(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&&(pg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),mg.resetFlags(r),Aa(r,{bootstrap:null}),nd(e))}function nd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)lN(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let i=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof i=="number"&&Number.isFinite(i)&&lN(a,i)}let s=()=>{var i,l,d,c,f;let p=((i=a.initialScrollSession)==null?void 0:i.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;jn.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Aa(a),JN(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||td(a)},EW,"preservedInitialScroll")):td(a),t?.recalculateItems&&jN(e),kx(e,{didInitialScroll:!0}),p&&bW(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(s);return}s()}function hg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function MW(e){let{state:t}=e;return(t.props.horizontal?(Ra(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:be(e,"stylePaddingTop")||0)+(be(e,"alignItemsAtEndPadding")||0)+(be(e,"headerSize")||0)}function Vt(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 NW(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 _W(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-NW(e)-_i(e)):0}function Bi(e){let t=be(e,"alignItemsAtEndPadding")||0,n=_W(e);t!==n&&Fe(e,"alignItemsAtEndPadding",n)}function fu(e,t,n,o=!0){let r=e.state,a=r.totalSize,s=r.totalSize;t===null?(s=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):s+=n,a!==s?(r.pendingTotalSize=void 0,r.totalSize=s,o&&Fe(e,"totalSize",s),Bi(e)):o&&e.values.get("totalSize")!==s&&Fe(e,"totalSize",s)}function dx(e,t,n,o=!0){let r=e.state,{sizes:a}=r,s=a.get(t),i=s!==void 0?n-s:n;i!==0&&fu(e,t,i,o),a.set(t,n)}function ZN(e){return typeof e=="function"}function vg(e){return Array.isArray(e)}var cN=new Set;function Ni(e,t){No&&!cN.has(e)&&(cN.add(e),console.warn(`[legend-list] ${t}`))}function hu(e){return Math.floor(e*8)/8}function pu(e){return e==null}function uN(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 uN(e,n)+uN(t,n)}function cx(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=be(e,"numContainers");for(let s=0;s<a;s++)if(be(e,`containerItemKey${s}`)===t)return s;return-1}function e_(e,t,n,o,r){var a,s;let i=e.state,{getFixedItemSize:l,getItemType:d}=i.props,c=t?i.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(s=r?.itemType)!=null?s:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,i.sizesKnown.set(t,c))}return c}function t_(e,t){let n=Vt(e.state,t);return e_(e,n,t,e.state.props.data[t])}function DW(e,t,n){for(let o=t;o<=n;o++)if(t_(e,o)===void 0)return!1;return!0}function eo(e,t,n,o,r,a,s,i){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:g,props:{estimatedItemSize:h,getItemType:v},scrollingTo:y}=p,C=p.sizesKnown.get(t);if(C!==void 0)return C;let x,b=m.get(t);if(a&&b!==void 0)return b;if(x=e_(e,t,n,o,i),x!==void 0)return dx(e,t,x,s),x;let w=(d=i?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!y){let I=(c=g[w])==null?void 0:c.avg;I!==void 0&&(x=hu(I))}if(x===void 0&&b!==void 0)return b;if(x===void 0&&r&&y){let I=(f=y.averageSizeSnapshot)==null?void 0:f[w];I!==void 0&&(x=hu(I))}return x===void 0&&(x=h+e.scrollAxisGap),dx(e,t,x,s),x}function Lx(e,t){if(t===void 0||t<0)return;let n=Vt(e.state,t);return eo(e,n,t,e.state.props.data[t])}function yg(e,t,n){var o;let r=e.state,{index:a,viewOffset:s,viewPosition:i}=n,l=t;if(s&&(l-=s),a!==void 0){let d=MW(e);d&&(l+=d)}if(i!==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:eo(e,Vt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),g=_i(e);if(l-=i*(r.scrollLength-g-m),!c&&a===r.props.data.length-1){let h=be(e,"footerSize")||0;l+=h}}return l}function ws(e,t,n){let o=e.state,r=Zn(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&La.OS!=="android"){let s=Math.max(0,r-o.scrollLength),i=n?.viewOffset,l=typeof i=="number"&&i<0?-i:0,d=s+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function vu(e){var t,n;let o=e.state;if(o?.scrollingTo){pg(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&&fu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let s=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",i=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;nd(e,{onFinished:()=>{r?.()},preserveTarget:s&&o.props.data.length===0||i,recalculateItems:!0,schedulePreservedTargetClear:i,syncObservedOffset:s,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}jN(e),r?.()}}var OW=80,FW=1500,BW=320,UW=1;function zW(e,t){var n,o;let r=e.state,{animated:a,horizontal:s,offset:i}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!s,p=f?Zn(e):void 0,m=f?Sx(r,i,p):0,g=f?0:i;if(l.scrollTo({animated:c,x:m,y:g}),c){let h=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;HW(e,{readOffset:()=>l.getCurrentScrollOffset(),target:h,targetOffset:i})}else{r.scroll=i;let h=r.scrollingTo;r.scheduledWork.timeout(()=>{h===r.scrollingTo&&vu(e)},100,"platformScrollCompletion")}}function HW(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){vu(e);return}let a="onscrollend"in o,s,i=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),FW),f=()=>{o.removeEventListener("scroll",g),a&&o.removeEventListener("scrollend",h),s!==void 0&&clearTimeout(s),clearTimeout(c)},p=()=>{i||(i=!0,f())},m=v=>{if(i)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let y=n(),C=Math.abs(y-r)<=UW;v==="scrollend"&&!C||(l.cancel("platformScrollCompletion"),vu(e))},g=()=>{s!==void 0&&clearTimeout(s),s=setTimeout(()=>m("idle"),OW)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):s=setTimeout(()=>m("idle"),BW),l.register("platformScrollCompletion",p)}function od(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,i=!!(be(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=i,!1;if(i){if(t.pendingMaintainScrollAtEnd=!1,Zn(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=be(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let g=r.current;if(t.props.horizontal&&Ra(t)){let h=Zn(e),v=tW(t,h),y=Sx(t,v,h);g?.scrollTo({animated:a.animated,x:y,y:0})}else g?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&od(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function Ui(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,be(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var co=.1,KW=300,$W=2,qW=1;function VW(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,s=e.indexByKey.get(r.id)===void 0;if(a||s||!n){e.mvcpAnchorLock=void 0;return}return r}function WW(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:s}=t,i=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!i||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(s)<=co&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=$W){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+KW,id:n,position:o,quietPasses:c}}}function GW(e,t,n,o,r,a){return!1}function jW(e,t,n){if(Math.abs(t)<=co)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 QW(e,t){return e<0?-t:t}function nx(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>co&&Ui(e,r)}function XW(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>co)return;let o=Zn(e),r=jW(t,n.amount,o);if(Math.abs(r)<=co)return;let a=n.amount-r;Math.abs(a)<=co||(n.manualApplied=a,Ui(e,a),n.furthestProgressTowardAmount=0)}function YW(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),s=r<0&&a>co||r>0&&a<-co,i=QW(r,a);if(Math.abs(r)<=co)return n.pendingNativeMVCPAdjust=void 0,!0;if(s)return n.pendingNativeMVCPAdjust=void 0,!1;if(i+co>=Math.abs(r))return nx(e,r,a),!0;let l=Math.max(0,Zn(e)-n.scrollLength);return Math.abs(t-l)<=qW||n.pendingMaintainScrollAtEnd&&be(e,"isWithinMaintainScrollAtEndThreshold")&&i>co?(nx(e,r,a),!0):i>o.furthestProgressTowardAmount+co?(o.furthestProgressTowardAmount=i,!1):(o.furthestProgressTowardAmount>co&&i<o.furthestProgressTowardAmount-co&&(n.pendingNativeMVCPAdjust=void 0),!1)}function JW(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:s,size:i,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=VW(n,c,s,d),m,g,h=[],v=f?.index,y=f?.viewPosition,C=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(y??0)>0,x=t?s:i,b=n.indexByKey,w=n.scroll;if(Zn(e),x){if(p&&v===void 0?(g=p.id,m=p.position):v!==void 0?g=Vt(n,v):o.length>0&&n.didContainersLayout&&!t&&(g=o.find(I=>b.get(I)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let I=0;I<o.length;I++){let k=o[I],P=b.get(k);if(P!==void 0){let T=r[P];T!==void 0&&h.push({id:k,position:T})}}if(g!==void 0&&m===void 0){let I=b.get(g);I!==void 0&&(m=r[I])}return()=>{let I=0,k=p?.id,P,T=!1,L=n.props.data;if(t&&s&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let R=b.get(g);if(R!==void 0){let D=L[R];T=D===void 0||!l(D,R,L),T&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&s&&v===void 0&&(()=>{if(g===void 0||T)return!0;let R=b.get(g);return R===void 0||r[R]===void 0})())for(let R=0;R<h.length;R++){let{id:D,position:H}=h[R],W=b.get(D);if(W!==void 0&&l){let J=L[W];if(J===void 0||!l(J,W,L))continue}let F=W!==void 0?r[W]:void 0;if(F!==void 0){I=F-H,k=D,P=F;break}}if(!T&&g!==void 0&&m!==void 0){let R=b.get(g),D=R!==void 0?r[R]:void 0;if(D!==void 0){let H=Zn(e),W=D-m;if(W!==0&&C&&n.scroll+n.scrollLength>H)if(W>0)W=Math.max(0,H-n.scroll-n.scrollLength);else{let F=Math.max(0,H-n.scrollLength);n.scroll=F,n.scrollPending=F,W=0}I=W,k=g,P=D}}if(y&&y>0){let R=eo(e,g,v,n.props.data[v]),D=f?.itemSize;if(R!==void 0&&D!==void 0&&R!==D){let H=R-D;H!==0&&(I+=H*y,f.itemSize=R)}}if(WW(n,{anchorId:k,anchorPosition:P,dataChanged:t,now:d,positionDiff:I}),GW()){n.pendingNativeMVCPAdjust={amount:I,furthestProgressTowardAmount:0,manualApplied:0,startScroll:w},XW(e);return}Math.abs(I)>co&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&be(e,"isWithinMaintainScrollAtEndThreshold")||Ui(e,I))}}}var fN=1e3,ZW=200,Cg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>fN)return 0;let r=0,a=0,s=0;for(let i=n;i>0;i--){let l=t[i],d=t[i-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>fN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/ZW);a+=c/f*g,s+=g}return s>0?a/s:0};function e4(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Su(e){return e.dataChangeNeedsScrollUpdate||e4(e)}function Di(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:s,lastScrollAdjustForHistory:i,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(),g=i!==void 0&&Math.abs(m-i)>.1;if(g&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(g||d.push({scroll:t,time:p})),d.length>5&&d.shift(),s&&!c){let{lt:T,gt:L}=s;if(T&&t<T||L&&t>L){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let h=Math.abs(t-f),y=!!o?.fromNativeScrollEvent&&h>.1&&!g&&c===void 0&&!a.pendingNativeMVCPAdjust?TW(e,t-f):void 0,C=YW(e,t),x=a.scrollLength,b=x>0&&c===void 0&&h>x&&!a.pendingNativeMVCPAdjust,w=Cg(a);RW(e,w,{forceLight:b});let I=a.scrollLastCalculate;if(Su(a)||C||y!==void 0||n||I===void 0||Math.abs(a.scroll-I)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=h;let T=()=>{var A;let M={doMVCP:c!==void 0,scrollVelocity:w};b&&(M.drawDistanceMode="visible-first"),(A=a.triggerCalculateItemsInView)==null||A.call(a,M),gg(e,y)};b?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,ON.flushSync)(T),YN(e)):T();let L=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);C&&L&&(a.pendingMaintainScrollAtEnd=!1,od(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function t4(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 n4(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,s=jn.get(e),i=!e.didFinishInitialScroll&&(o||!!s)&&jn.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!s&&jn.isAtZeroTargetOffset(r);if(i){e.hasScrolled=!1,jn.set(e,{startScroll:(n=s?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&jn.clear(e)}function o4(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,s;for(;r<=a;){let i=Math.floor((r+a)/2),l=n.positions[i];l===void 0?a=i-1:l<=t?(s=i,r=i+1):a=i-1}return s}function pN(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=Lx(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function r4(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),s=Math.max(a,t+o.scrollLength),i=n!==void 0?Math.max(0,Math.min(r-1,n)):o4(e,a);if(i===void 0)return;if(n!==void 0&&o.positions[i]===void 0)return{end:i,start:i};if(n===void 0){let d=pN(e,i);if(d===void 0||d<=a)return}for(;i>0;){let d=o.positions[i];if(d===void 0||d<=a||o.positions[i-1]===void 0)break;i--}for(;i>0;){let d=pN(e,i-1);if(d===void 0||d<=a)break;i--}let l=i;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>s)break;l++}return{end:l,start:i}}function a4(e,t,n){let o=r4(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function xg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:s,...i}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=i,{props:{horizontal:m}}=r;pg(r);let g=f?c:yg(e,c,i),h=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=ws(e,g,i),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&mg.resetFlags(r);let C=t4(r);r.scrollingTo={...i,...C?{averageSizeSnapshot:C}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||a4(e,v,i.index)}r.scrollPending=v,n4(r,{isInitialScroll:d,requestedOffset:y,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):Di(e,v,!0,{markHasScrolled:!1})),s||!d||La.OS==="android"?zW(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function n_(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function og(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:s}){let i=e.state,{data:l}=i.props;t=n_(t,l.length);let d=Lx(e,t),c=hg(e,t);t===l.length-1&&s===void 0&&(s=1),i.scrollForNextCalculateItemsInView=void 0,xg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:s??0})}function bg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,s=r.index,i=s!==void 0?n_(s,e.state.props.data.length):void 0,l=Lx(e,i);xg(e,{animated:!1,forceScroll:n,index:i!==void 0&&i>=0?i:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Oi(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&Px(e,{resetInitialScroll:!0}),Aa(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function xr(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?hg(e,t.index):0,s=yg(e,a,t);return ws(e,s,t)}function o_(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,s=!!r?.isInitialScroll,i=!!t?.requiresMeasuredLayout&&!o&&!s;if(!(!a||i||n||r&&!s))return{initialScroll:a,isInitialScrollInProgress:s,queuedInitialLayout:o,scrollingTo:r}}function s4(e,t){var n,o,r;let a=e.state,s=o_(a,{requiresMeasuredLayout:!0});if(!s)return!1;let{initialScroll:i,isInitialScrollInProgress:l,queuedInitialLayout:d}=s,c=l?s.scrollingTo:void 0,f=xr(e,i),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=i.contentOffset===void 0||Math.abs(i.contentOffset-f)>1,g=p!==void 0&&Math.abs(p-f)>1,h=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!g||t?.forceScroll&&h)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Oi(e,{...i,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return bg(e,{forceScroll:v,resolvedOffset:f,target:i}),!0}function i4(e,t){var n,o;let r=e.state,a=o_(r);if(!a)return!1;let{initialScroll:s,queuedInitialLayout:i}=a,l=(n=s.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||!!i;return bg(e,{forceScroll:f,resolvedOffset:l,target:s}),!0}function yu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?i4(e,{forceScroll:t?.forceScroll}):s4(e,{forceScroll:t?.forceScroll})}function mu(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 s=Vt(e,a);if(s===void 0||!e.sizesKnown.has(s))return!1}}return o}var Sg=1,l4=8,d4=24,c4="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function tr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function zi(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function u4(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 f4(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:s}=e,i=o+a,l=[],d=s!==void 0?Math.max(0,Math.min(t-1,s)):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<i&&c+f>o)l.push(d);else if(l.length>0&&c>=i)break}}return l}function p4(e){let{mountFrameCount:t,maxFrames:n=l4,maxPasses:o=d4,passCount:r}=e;return t>=n||r>=o}function r_(e,t){return p4(t)?(No&&console.warn(c4),P4(e),!0):!1}function Cu(e){var t;let n=tr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Aa(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function a_(e,t){var n,o,r;let a=tr(e);Aa(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 m4(e,t){var n,o,r;let a=tr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,Aa(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&a_(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function ux(e){requestAnimationFrame(()=>{var t;tr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function Ax(e){let t=e.state,n=tr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=tr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!r_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&Ax(e))};n.frameHandle=requestAnimationFrame(o)}function ig(e,t){m4(e.state,t),Ax(e),ux(e.state)}function Rx(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 g4(e){return!!e?.preserveForBottomPadding}function Fi(e){return!!e?.preserveForFooterLayout}function s_(e){return!!(e&&e.viewPosition===1&&(g4(e)||Fi(e)))}function h4(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,s=Fi(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:s,viewOffset:-r-(s?n:0),viewPosition:1}}function v4(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function lg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Fi(r))return;let a=Rx({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Oi(e,a)}function y4(e){td(e)}function Ex(e,t,n=Sg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=xu(o);return Math.abs(r-xr(e,t))>n}function xu(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 i_(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||zi(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:xu(n);return xr(e,o)-r}function l_(e){return i_(e)===void 0?!1:(d_(e,{}),!0)}function d_(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=i_(e);if(a===void 0||Math.abs(a)<=Sg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Ui(e,a)),d_(e,t)})}function C4(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||Ex(e,o)&&(s_(o)&&be(e,"isAtEnd")||(Fi(o)?lg(e,{dataLength:n.props.data.length,stylePaddingEnd:bx(n.props),target:o}):y4(n)))}function x4(e,t){var n,o,r;let{initialScrollAtEnd:a,target:s}=t,i=e.state,l=xr(e,s),d=l===0&&!a&&(zi(i)?Math.abs((n=s.contentOffset)!=null?n:0)<=1:s.index===0&&((o=s.viewPosition)!=null?o:0)===0&&Math.abs((r=s.viewOffset)!=null?r:0)<=1),c=i.props.data.length===0&&s.index!==void 0;d?(Cu(i),nd(e,{resolvedOffset:l})):c?(Cu(i),nd(e,{preserveTarget:!0,resolvedOffset:l})):(a_(i,{scroll:l,seedContentOffset:0,targetIndexSeed:s.index}),Ax(e))}function b4(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:s}=t,i=e.state,l=i.initialScroll;if(zi(i)||!l)return;let d=!!(i.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=tr(i);if(!r&&o&&n>0&&i.didFinishInitialScroll&&!c&&!d){td(i);return}let p=n>0&&(r||s_(l));if(!(!o&&!d&&!p)){if(p){let m=r?Rx({dataLength:n,footerSize:be(e,"footerSize")||0,preserveForFooterLayout:Fi(l),stylePaddingEnd:s}):h4({dataLength:n,footerSize:be(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:s,target:l});if(!d&&Ex(e,l)){lg(e,{dataLength:n,stylePaddingEnd:s,target:l});return}if(!v4(l,m)||c||d||o){Oi(e,m,{resetDidFinish:d}),ig(e,{scroll:xr(e,m),seedContentOffset:d&&!c?xu(i):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Oi(e,l,{resetDidFinish:d}),ig(e,{scroll:xr(e,l),seedContentOffset:d&&!c?xu(i):void 0,targetIndexSeed:l.index}))}}function S4(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,s=e.state;if(!r)return;let i=s.initialScroll;if(!(zi(s)||n===0||!i||!(tr(s)||Fi(i))))if(Ex(e,i))lg(e,{dataLength:n,stylePaddingEnd:a,target:i});else{let d=Rx({dataLength:n,footerSize:o,preserveForFooterLayout:Fi(i),stylePaddingEnd:a});if(!(i.index!==d.index||i.viewPosition!==d.viewPosition||i.viewOffset!==d.viewOffset))lg(e,{dataLength:n,stylePaddingEnd:a,target:i});else{let f=!!s.didFinishInitialScroll;Oi(e,d,{resetDidFinish:f}),ig(e,{scroll:xr(e,d),targetIndexSeed:d.index})}}}function I4(e){var t,n,o;let r=e.state,a=r.initialScroll,s=tr(r);if(a&&r.props.data.length>0&&!zi(r)&&(s||a.viewPosition===1)){let i=xr(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!s&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:xu(r),c=i-d;if(Math.abs(c)>Sg){if(r.didFinishInitialScroll)l_(e);else if(l){let f=jn.get(r);l.offset=i,l.targetOffset=i,r.initialScroll={...a,contentOffset:i},r.hasScrolled=!1,jn.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:i}),Ui(e,c)}}}else ig(e,{scroll:i,targetIndexSeed:a.index})}}function w4(e){var t,n;let o=e.state,r=tr(o),a=o.initialScroll;if(!r||!a||zi(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,r_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let s=xr(e,a),i=mu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-s)>1,{data:d}=o.props,c=f4({dataLength:d.length,getSize:h=>{var v,y;let C=(v=o.idCache[h])!=null?v:Vt(o,h);return(y=o.sizes.get(C))!=null?y:eo(e,C,h,d[h])},offset:s,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(h=>{var v;let y=(v=o.idCache[h])!=null?v:Vt(o,h);return o.sizesKnown.has(y)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=s,r.visibleIndices=c,l){r.scroll=s,ux(o);return}if(!i||!f)return;if(!(p!==void 0&&Math.abs(p-s)<=Sg&&u4(m,c))){ux(o);return}Cu(o),bg(e,{forceScroll:!0,resolvedOffset:s,target:a,waitForCompletionFrame:La.OS==="web"})}function T4(e,t){var n;let o=e.state;Cu(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;nd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function P4(e){var t,n,o,r;let a=e.state,s=tr(a),i=a.initialScroll;s&&i&&!zi(a)&&a.refScroller.current?(Cu(a),bg(e,{forceScroll:!0,resolvedOffset:s.scroll,target:i,waitForCompletionFrame:La.OS==="web"})):T4(e,(r=(o=(n=(t=tr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function c_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function k4(e,t,n,o){var r,a;let{getFixedItemSize:s,getItemType:i}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===i&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=i?(r=i(o,n))!=null?r:"":void 0;d=c_(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==s&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=s),s&&!d.didResolveFixedItemSize&&(d.fixedItemSize=s(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function u_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var L4=20,A4=1,R4=1,ox=16;function Mx(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!Nx(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>D4(e),"checkFinishedScrollFrame")}function E4(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=A4}function M4(e,t){return!!t?.isInitialScroll&&mg.didDispatchNativeScroll(e)&&!e.hasScrolled}function f_(e){var t;return(t=jn.get(e))==null?void 0:t.targetOffset}function p_(e){let t=f_(e);return!e.didFinishInitialScroll&&jn.hasNonZeroTargetOffset(t)}function mN(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 jn.hasNonZeroTargetOffset(r)&&mg.didDispatchNativeScroll(e)&&!e.hasScrolled||jn.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||p_(e)}function gN(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&Zn(e)<=n.scrollLength&&n.scrollPending<=R4}function N4(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function _4(e,t){var n;let o=t.index,a=N4(e,t)&&o!==void 0?yg(e,hg(e,o),t):(n=t.targetOffset)!=null?n:ws(e,t.offset-(t.viewOffset||0),t);return ws(e,a,t)}function Nx(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=_4(e,t),s=ws(e,o,t),i=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||La.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-s)<1&&(i<1||c&&d<1)}}function D4(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=Nx(e,t);o.isAtResolvedTarget&&E4(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&vu(e)}function O4(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 F4(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=gN(e),r=M4(t,n),a=n!==void 0?mN(t,n):!1,s=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,i=o||a?0:r?ox:s?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let g=p_(t)&&!t.hasScrolled,h=r?5:g?L4:5,v=gN(e),y=mN(t,m),C=Nx(e,m),x=La.OS==="android",b=t.hasScrolled&&(!m.isInitialScroll||C.isAtResolvedTarget),w=m.isInitialScroll&&!C.isAtResolvedTarget&&l<=h;if(v||b||y||x||l>h)vu(e);else if((g||w)&&l<=h){let I=(p=(f=f_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;O4(e,I),d(r?ox:100)}else d(r?ox:100)}};d(i)}function m_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?l_(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:yu(e,{forceScroll:!0})}function B4(e){var t;if(!e.state.initialScroll)return;let n=()=>yu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),Mx(e,{onlyIfAligned:!0})}function U4(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:s,initialContentOffset:i,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=i??0,m=d&&l&&s;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Oi(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){x4(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?nd(e,{resolvedOffset:p}):kx(e,{didInitialScroll:!0}))}function z4(e,t){var n,o,r;let{dataLength:a,didDataChange:s,didStartFreshData:i,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,g=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,h=a>0&&(!m.hasHadNonEmptyData||i);if(a>0&&(m.hasHadNonEmptyData=!0),h&&(d?(Oi(e,d),Aa(m,{kind:c,previousDataLength:g})):td(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Aa(m),p){b4(e,{dataLength:a,didDataChange:s,initialScrollAtEnd:l,previousDataLength:g,stylePaddingEnd:f});return}let v=g===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;g!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&Px(e,{resetInitialScroll:!0}),yu(e))}function g_(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function H4(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 s=o.containerItemKeys.get(a);s!==void 0&&r.add(s)}}return r}function dg(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 s of t)a.add(s);e.pendingContainerIds=a}if(!o){let a=((n=be(e,"containerLayoutEpoch"))!=null?n:0)+1;Fe(e,"containerLayoutEpoch",a)}}function K4(e,t,n,o){var r,a,s,i,l,d,c,f,p;let m=e.state,{columns:g,columnSpans:h,positions:v,props:{data:y,itemsAreEqual:C,keyExtractor:x}}=m,b=y[n];if(b===void 0)return{didChangePosition:!1,didRefreshData:!1};let w=(r=m.idCache[n])!=null?r:Vt(m,n),I=(a=o?.updateLayout)!=null?a:!0,k=!1,P=!1;if(I){let M=v[n];if(M===void 0)return Fe(e,`containerPosition${t}`,ed),{didChangePosition:!1,didRefreshData:!1};let R=(M||0)-((s=o?.scrollAdjustPending)!=null?s:0),D=(i=m.sizes.get(w))!=null?i:eo(e,w,n,b),H=nW(m,R,D,be(e,"totalSize")),W=g[n]||1,F=h[n]||1,J=be(e,`containerPosition${t}`),O=be(e,`containerColumn${t}`),B=be(e,`containerSpan${t}`);H>ed&&H!==J&&(Fe(e,`containerPosition${t}`,H),k=!0),W>=0&&W!==O&&Fe(e,`containerColumn${t}`,W),F!==B&&Fe(e,`containerSpan${t}`,F)}be(e,`containerItemIndex${t}`)!==n&&Fe(e,`containerItemIndex${t}`,n);let L=be(e,`containerItemData${t}`),A=()=>{Fe(e,`containerItemData${t}`,b),P=!0};if(L!==b){let M=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===y?m.pendingDataComparison:void 0,R=(c=M?.byIndex[n])!=null?c:0;if(R===2)A();else if(R!==1){let D=(f=be(e,`containerItemKey${t}`))!=null?f:w,H=x?.(L,n);if(L===void 0||!x||H!==D)A();else if(!C)A();else{let W=C(L,b,n,y);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==y)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:y,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=W?1:2),W||A()}}}return{didChangePosition:k,didRefreshData:P}}function $4(e,t,n){var o;let r=e.state,a=be(e,"numColumns"),s=t;r.columns[t]!==1&&(s=hN(r,a,t));let l=0,d=r.columns[s];if(s>0){let c=s-1,f=(o=r.positions[c])!=null?o:0,p=hN(r,a,c),m=q4(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:s}}function hN(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 q4(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let s=0;for(let i=t;i<=n;i++){if(i<0||i>=a.length)continue;let l=r.idCache[i],d=eo(e,l,i,a[i],o);d>s&&(s=d)}return s}function V4(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,s=(t=be(e,"numColumns"))!=null?t:1;if(a.length===0)fu(e,null,0);else{let i=a.length-1,l=Vt(o,i),d=r[i];if(l!==void 0&&d!==void 0)if(s>1){let c=i;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<=i;p++){let m=(n=o.idCache[p])!=null?n:Vt(o,p),g=eo(e,m,p,a[p]);g>f&&(f=g)}fu(e,null,d+f)}else{let c=eo(e,l,i,a[i]);if(c!==void 0){let f=d+c;fu(e,null,f)}}}}function h_(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?Zn(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let s=n[a];Vt(t,s);let i=t.positions[s];r[a]=Sx(t,i,o)}Fe(e,"snapToOffsets",r)}function v_(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:s,startIndex:i}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,g=e.positionListeners.size>0,{columns:h,columnSpans:v,indexByKey:y,positions:C,idCache:x,sizesKnown:b,props:{data:w,overrideItemLayout:I,snapToIndices:k},scrollingTo:P}=m,T=w.length,L=(l=be(e,"numColumns"))!=null?l:1,A=L>1,M=No?new Map:void 0,R=be(e,"extraData"),D=I?{span:1}:void 0,H=m.lastScrollDelta,W=s??Cg(m),F=!o&&!t&&(r||Math.abs(W)>0||m.scrollLength>0&&H>m.scrollLength),J=a+1e3,O=!0,B=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==0,Y=!1,U=0,X=1,re=0;if(t&&(v.length=0),A||(h.length&&(h.length=0),v.length&&(v.length=0)),i>0){if(A){let{startIndex:ee,currentRowTop:fe}=$4(e,i,O);i=ee,U=fe}else if(i<T){let ee=i-1,fe=Vt(m,ee),Re=(c=C[ee])!=null?c:0,Be=(f=b.get(fe))!=null?f:eo(e,fe,ee,w[ee],O,B,Y);U=Re+Be}}let G=t||y.size===0,te=A&&!!I&&!!D,oe=!1,Z;for(let ee=i;ee<T;ee++){if(F&&Z!==void 0&&ee>Z){oe=!0;break}F&&Z===void 0&&!P&&!t&&U>J&&(Z=ee+(A?L:1)+10);let fe=(p=x[ee])!=null?p:Vt(m,ee),Re=1;if(te){D.span=1,I(D,w[ee],ee,L,R);let Ee=D.span;Ee!==void 0&&Number.isFinite(Ee)&&(Re=Math.max(1,Math.min(L,Math.round(Ee))))}A&&X+Re-1>L&&(U+=re,X=1,re=0);let Be=b.get(fe),Se=Be!==void 0?Be:eo(e,fe,ee,w[ee],O,B,Y);No&&G&&(M.has(fe)&&console.error(`[legend-list] Error: Detected overlapping key (${fe}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),M.set(fe,ee)),U!==C[ee]&&(C[ee]=U,g&&cW(e,fe,U)),G&&y.set(fe,ee),A?(h[ee]=X,v[ee]=Re,Se>re&&(re=Se),X+=Re,X>L&&(U+=re,X=1,re=0)):U+=Se}oe||V4(e),k&&h_(e)}function y_(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 W4(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function C_(e,t,n,o,r,a,s=r,i=a){let{props:{data:l}}=e;for(let d of n){let c=y_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=s,c.endBuffered=i,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>vN(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):vN(l,d,e,t,o)}}function vN(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:s}=t,i=a.id,l=y_(o,i),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[C,x]of o.mapViewabilityAmountValues)x_(n,o,a,C,x.key,r,x.item,x.index).sizeVisible<0&&(g??(g=[]),g.push(C));let h=[],v=new Set;if(d)for(let C of d){v.add(C.key);let x=n.indexByKey.get(C.key),b=x!==void 0?e[x]:void 0,w=cx(o,C.key),I=!1;x!==void 0&&b!==void 0&&(I=CN(n,o,a,w,C.key,r,b,x)),I||h.push({...C,index:x??C.index,isViewable:!1,item:b??C.item})}let y=[];for(let C=c;C<=f;C++){let x=e[C];if(x){let b=Vt(n,C),w=cx(o,b);if(CN(n,o,a,w,b,r,x,C)){let I={containerId:w,index:C,isViewable:!0,item:x,key:b};y.push(I),v.has(I.key)||h.push(I)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:y}),h.length>0){l.viewableItems=y;for(let C=0;C<h.length;C++){let x=h[C];G4(o,i,x.containerId,x)}s&&s({changed:h,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:y})}if(g)for(let C of g){let x=o.mapViewabilityAmountValues.get(C);x&&x.sizeVisible<0&&o.mapViewabilityAmountValues.delete(C)}}function yN(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 x_(e,t,n,o,r,a,s,i){let{sizes:l,scroll:d}=e,c=(be(t,"stylePaddingTop")||0)+(be(t,"alignItemsAtEndPadding")||0)+(be(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,g=m?p:f,h=d-c,v=e.positions[i],y=l.get(r)||0;if(v===void 0){let M={containerId:o,index:i,isViewable:!1,item:s,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:y,sizeVisible:-1},R=t.mapViewabilityAmountValues.get(o);if(!yN(R,M)){t.mapViewabilityAmountValues.set(o,M);let D=t.mapViewabilityAmountCallbacks.get(o);D&&D(M)}return M}let C=v-h,x=C+y,b=C>=0&&x<=a&&x>C,w=b?y:Math.min(x,a)-Math.max(C,0),I=y?b?100:100*(w/y):0,k=y?100*(w/a):0,T=(b?100:m?k:I)>=g,L={containerId:o,index:i,isViewable:T,item:s,key:r,percentOfScroller:k,percentVisible:I,scrollSize:a,size:y,sizeVisible:w},A=t.mapViewabilityAmountValues.get(o);if(!yN(A,L)){t.mapViewabilityAmountValues.set(o,L);let M=t.mapViewabilityAmountCallbacks.get(o);M&&M(L)}return L}function CN(e,t,n,o,r,a,s,i){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==i)&&(l=x_(e,t,n,o,r,a,s,i)),l.isViewable}function G4(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var xN=DN.unstable_batchedUpdates,j4=typeof xN=="function"?xN:e=>e(),Q4=32,X4=64,Y4=3;function J4(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*Y4),o=t+X4,r=Math.max(t,Math.min(n,o),Math.min(e,Q4)),a=Math.max(e,t);return Math.min(a,r)}function Z4(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function eG(e,t,n,o,r,a,s){var i;let l=t.length;if(l===0)return[];let d=be(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,g=r.length>0?new Set(r):void 0,h=t.map((L,A)=>({isSticky:c.props.stickyHeaderIndicesSet.has(L),itemIndex:L,itemType:a?.(L),order:A})),v=h.filter(L=>!L.isSticky),y=h.filter(L=>L.isSticky),C=[],x=[];for(let L=0;L<d;L++){let A=be(e,`containerItemKey${L}`),M=!!g?.has(L);if(!(A&&s?.has(A)&&c.indexByKey.has(A))){if(p.has(L))(A===void 0||M)&&x.push({containerIndex:L,distance:Number.POSITIVE_INFINITY});else if(A===void 0||M)C.push({containerIndex:L,distance:Number.POSITIVE_INFINITY});else if(!m){let D=c.indexByKey.get(A);if(D!==void 0&&(D<n||D>o)){let H=D<n?n-D:D-o;C.push({containerIndex:L,distance:H})}}}}C.sort(tG);let b=new Array(l),w=d,I=!1,k=(L,A)=>{b[L.order]={containerIndex:A,itemIndex:L.itemIndex,itemType:L.itemType},g?.delete(A)&&(I=!0)},P=(L,A,M)=>{for(let R of L){if(b[R.order])continue;let D=A.findIndex(H=>{var W;return M((W=f.get(H.containerIndex))==null?void 0:W.itemType,R.itemType)});if(D!==-1){let[H]=A.splice(D,1);k(R,H.containerIndex)}}},T=(L,A,M)=>{a&&P(L,A,(R,D)=>D!==void 0&&R===D),P(L,A,R=>R===void 0),M&&P(L,A,()=>!0)};T(v,C,!0),T(y,x,!1);for(let L of h){if(b[L.order])continue;let A=w++;L.isSticky&&p.add(A),k(L,A)}if(I&&(r.length=0,g))for(let L of g)r.push(L);if(No){let L=(i=be(e,"numContainersPooled"))!=null?i:Number.POSITIVE_INFINITY;w>L&&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:L,numNeeded:l,stillNeeded:w-d}})}return b}function tG(e,t){return t.distance-e.distance}function nG(e){let t=e.state;t.queuedInitialLayout=!0,GN(e),kx(e,{didLayout:!0})}var oG=4,rG=100;function aG(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/oG);return Math.sign(e)*t*n}function sG(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},rG,"renderRangeProjection")}function iG(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],s=o[a];if(s!==void 0&&t>=s)return r}return-1}function lG(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=be(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function dG(e,t,n,o,r,a,s){var i;let l=e.state;Fe(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(lG(e,f))continue;let p=(i=l.idCache[f])!=null?i:Vt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>s)&&!r.has(f)&&(r.add(f),o.push(f))}}function cG(e,t,n,o,r,a,s){var i,l;let d=e.state;for(let c of d.stickyContainerPool){let f=be(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||s(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Fe(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let h=t[m+1],v=!1;if(h){let y=d.positions[h];v=y!==void 0&&n>y+o*2}else{let y=(i=d.idCache[p])!=null?i:Vt(d,p);if(y){let C=d.positions[p],x=(l=d.sizes.get(y))!=null?l:eo(e,y,p,d.props.data[p]);v=C!==void 0&&n>C+x+o*3}}v&&a.push(c)}}function b_(e,t,n,o,r,a){let s=!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:s=!0),s}function S_(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let s=a;s<=t.endNoBuffer;s++){let i=(o=e.idCache[s])!=null?o:Vt(e,s);r.push(i)}return r}function fx(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:Vt(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 uG(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:s,positions:i,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=s[f])!=null?n:Vt(r,f),m=(o=d.get(p))!=null?o:eo(e,p,f,l[f]);if(i[f]+m>t)return f}return null}function fG(e,t,n,o,r){var a,s;let i=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=i;if(m===null||l===null||m<0||l<m)return;let g={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let h=m;h<=l&&h<f.length;h++){let v=(a=d[h])!=null?a:Vt(i,h),y=(s=p.get(v))!=null?s:eo(e,v,h,f[h]),C=c[h];if(b_(g,h,C,y,o,r))break}Object.assign(i,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:S_(i,g),startNoBuffer:g.startNoBuffer}),fx(i,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&C_(i,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function ka(e,t={}){let n=e.state;j4(()=>{var o,r,a,s,i,l,d,c,f,p,m,g,h,v,y,C,x,b,w,I,k;let{columns:P,containerItemKeys:T,enableScrollForNextCalculateItemsInView:L,idCache:A,indexByKey:M,minIndexSizeChanged:R,positions:D,props:{alwaysRenderIndicesArr:H,alwaysRenderIndicesSet:W,getItemType:F,keyExtractor:J,onStickyHeaderChange:O},scrollForNextCalculateItemsInView:B,scrollLength:Y,sizes:U,startBufferedId:X,viewabilityConfigCallbackPairs:re}=n,{data:G}=n.props,te=n.props.stickyHeaderIndicesArr||[],oe=n.props.stickyHeaderIndicesSet||new Set,Z=XN(e,t.drawDistanceMode),{dataChanged:ee,doMVCP:fe,forceFullItemPositions:Re}=t,Be=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,Se=!!Be,Ee=be(e,"numContainers");if(!G||Y===0||!Ee)return;let ne=Zn(e),we,j=be(e,"stylePaddingTop")+be(e,"alignItemsAtEndPadding")+be(e,"headerSize"),ue=be(e,"numColumns"),ge=(r=t.scrollVelocity)!=null?r:Cg(n),ie=0,{initialScroll:He,queuedInitialLayout:Pt}=n,ct=Se?(a=Be?.scroll)!=null?a:n.scroll:!Pt&&uu(n)&&He?xr(e,He):n.scroll,gt=0,bt=0,ut=0,mt=0,st=0,lt=0,At=ct,Wt=Ce=>{var Ze;At=Ce,gt=(Ze=be(e,"scrollAdjustPending"))!=null?Ze:0,bt=gt-j,ut=Math.round(Ce+ie+bt),ut+Y>ne&&(ut=Math.max(0,ne-Y))};Wt(ct);let fn=be(e,"activeStickyIndex"),at=()=>{let Ce=te.length>0?iG(te,ut,n):-1,Ze=Ce>=0?te[Ce]:-1,_t=fn!==Ze;(Ce>=0||fn>=0)&&Fe(e,"activeStickyIndex",Ze);let vt=!!O&&te.length>0&&_t;return{currentStickyIdx:Ce,finishCalculateItemsInView:vt?()=>{let cn=G[Ze];cn!==void 0&&O?.({index:Ze,item:cn})}:void 0}},Mt=ee?void 0:at(),Ht=Z,nn=Z;ge>0||ge===0&&ut<Math.max(50,Z)?(Ht=Z*.5,nn=Z*1.5):(Ht=Z*1.5,nn=Z*.5);let jt=!ee&&!Re&&!Se&&!uu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!be(e,"readyToRender")?aG(ge,Math.min(Ht,nn)):0,yn=()=>{let Ce=Math.max(0,ut),Ze=Math.max(0,-At);st=Math.max(Ce,ut+Y+Ze),mt=Ce-Ht+jt,lt=st+nn+jt};if(yn(),jt!==0&&sG(e),L&&!Se&&!ee&&!Re&&B){let{top:Ce,bottom:Ze}=B;if(Ce===null&&Ze===null)n.scrollForNextCalculateItemsInView=void 0;else if((Ce===null||mt>Ce)&&(Ze===null||lt<Ze)&&!Su(n)){re?fG(e,re,Y,ut,st):n.props.onFirstVisibleItemChanged&&fx(n,uG(e,ut)),(s=Mt?.finishCalculateItemsInView)==null||s.call(Mt);return}}let $=fe&&!Se?JW(e,ee):void 0;ee&&g_(n);let ae=Re||ee?0:(i=R??n.startBuffered)!=null?i:0,de=!Re&&!ee&&ue>1&&R!==void 0;v_(e,ee,{doMVCP:fe,forceFullUpdate:!!Re,optimizeForVisibleWindow:de,scrollBottomBuffered:lt,scrollVelocity:ge,startIndex:ae}),ne=Zn(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let Pe;if(ee&&fe&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let Ce=n.props.maintainVisibleContentPosition.shouldRestorePosition;Pe=new Set;for(let Ze of n.idsInView){let _t=M.get(Ze);_t!==void 0&&(Ce&&!Ce(G[_t],_t,G)||Pe.add(Ze))}}let _e=n.scroll,ft=(l=be(e,"scrollAdjustPending"))!=null?l:0;$?.(),$&&(n.scroll!==_e||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==ft)&&(Wt(n.scroll),yn()),ee&&(Mt=at());let St=null,ht=null,kt=null,je=(c=Se?Be?.targetIndexSeed:void 0)!=null?c:!ee&&X&&M.get(X)||0;for(let Ce=je;Ce>=0;Ce--){let Ze=(f=A[Ce])!=null?f:Vt(n,Ce),_t=D[Ce],vt=(p=U.get(Ze))!=null?p:eo(e,Ze,Ce,G[Ce]);if(_t+vt>mt)je=Ce;else break}if(ue>1)for(;je>0;){let Ce=P[je];if(Ce===1||Ce===void 0)break;je-=1}let Qt=!1,Zt,Te,$e=0;for(let Ce=0;Ce<Ee;Ce++){let Ze=be(e,`containerItemKey${Ce}`);if(Ze!==void 0){let _t=M.get(Ze);$e=Math.max($e,_t)}}let qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},ot=G.length;for(let Ce=Math.max(0,je);Ce<ot&&(!Qt||Ce<=$e);Ce++){let Ze=(m=A[Ce])!=null?m:Vt(n,Ce),_t=(g=U.get(Ze))!=null?g:eo(e,Ze,Ce,G[Ce]),vt=D[Ce];Qt||(b_(qe,Ce,vt,_t,ut,st),St===null&&vt+_t>mt&&(St=Ce,ht=Ze,mt<0?Zt=null:Zt=vt),qe.startNoBuffer!==null&&(vt<=lt?(kt=Ce,lt>ne?Te=null:Te=vt+_t):Qt=!0))}Object.assign(n,{endBuffered:kt,endNoBuffer:qe.endNoBuffer,firstFullyOnScreenIndex:qe.firstFullyOnScreenIndex,idsInView:S_(n,qe),startBuffered:St,startBufferedId:ht,startNoBuffer:qe.startNoBuffer}),L&&Zt!==void 0&&Te!==void 0&&(n.scrollForNextCalculateItemsInView=pu(Zt)&&pu(Te)?void 0:{bottom:Te,top:Zt});let rt=Ee,tt=[];if(ee)for(let Ce=0;Ce<rt;Ce++){let Ze=be(e,`containerItemKey${Ce}`);(!J||Ze&&M.get(Ze)===void 0)&&tt.push(Ce)}let It=n.scrollTargetPinnedRange,Bt=0,wn=-1;It&&(Bt=Math.max(0,Math.min(It.start,It.end)),wn=Math.min(ot-1,Math.max(It.start,It.end)));let on=Bt<=wn,mn=Ce=>W.has(Ce)||on&&Ce>=Bt&&Ce<=wn;if(St!==null&&kt!==null){let Ce=[],Ze=new Set,_t=vt=>{var cn;if(vt>=0&&vt<ot){let vn=(cn=A[vt])!=null?cn:Vt(n,vt),ln=T.get(vn);ln!==void 0?n.stickyContainerPool.add(ln):!pu(vn)&&!Ze.has(vt)&&(Ze.add(vt),Ce.push(vt))}};for(let vt=St;vt<=kt;vt++){let cn=(h=A[vt])!=null?h:Vt(n,vt);T.has(cn)||(Ze.add(vt),Ce.push(vt))}for(let vt of H)_t(vt);if(on)for(let vt=Bt;vt<=wn;vt++)_t(vt);if(te.length>0?dG(e,te,(v=Mt?.currentStickyIdx)!=null?v:-1,Ce,Ze,St,kt):fn!==-1&&Fe(e,"activeStickyIndex",-1),Ce.length>0){let cn=eG(e,Ce,St,kt,tt,F?vn=>{let ln=F(G[vn],vn);return ln!==void 0?String(ln):""}:void 0,Pe);for(let vn of cn){let ln=vn.itemIndex,en=vn.containerIndex,Kn=(y=A[ln])!=null?y:Vt(n,ln),Dt=be(e,`containerItemKey${en}`);Dt&&Dt!==Kn&&T.delete(Dt),Dt!==Kn&&(we??(we=new Set),we.add(en),n.containerItemGenerations[en]=((C=n.containerItemGenerations[en])!=null?C:0)+1),Fe(e,`containerItemKey${en}`,Kn),Fe(e,`containerItemIndex${en}`,ln),Fe(e,`containerItemData${en}`,G[ln]),n.containerItemMetadata.set(en,c_(n,ln,G[ln],vn.itemType)),T.set(Kn,en),(x=n.userScrollAnchorReset)==null||x.keys.add(Kn);let Tn=`containerSticky${en}`,Qn=oe.has(ln),$r=mn(ln);Qn?(Fe(e,Tn,!0),n.stickyContainerPool.add(en)):(be(e,Tn)&&Fe(e,Tn,!1),$r?n.stickyContainerPool.add(en):n.stickyContainerPool.delete(en)),en>=rt&&(rt=en+1)}rt!==Ee&&(Fe(e,"numContainers",rt),rt>be(e,"numContainersPooled")&&Fe(e,"numContainersPooled",Z4(ot,rt)))}((b=n.userScrollAnchorReset)==null?void 0:b.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&cG(e,te,ut,Z,(w=Mt?.currentStickyIdx)!=null?w:-1,tt,mn);let Hn=tt.length>0?new Set(tt):void 0,En=!1;for(let Ce=0;Ce<rt;Ce++){let Ze=be(e,`containerItemKey${Ce}`);if(Hn?.has(Ce))Ze!==void 0&&(T.delete(Ze),we??(we=new Set),we.add(Ce),n.containerItemGenerations[Ce]=((I=n.containerItemGenerations[Ce])!=null?I:0)+1),n.containerItemMetadata.delete(Ce),n.stickyContainerPool.has(Ce)&&(Fe(e,`containerSticky${Ce}`,!1),n.stickyContainerPool.delete(Ce)),Fe(e,`containerItemKey${Ce}`,void 0),Fe(e,`containerItemIndex${Ce}`,void 0),Fe(e,`containerItemData${Ce}`,void 0),Fe(e,`containerPosition${Ce}`,ed),Fe(e,`containerColumn${Ce}`,-1),Fe(e,`containerSpan${Ce}`,1);else{let _t=M.get(Ze);_t!==void 0&&(En=K4(e,Ce,_t,{scrollAdjustPending:gt,updateLayout:!0}).didChangePosition||En)}}if(we&&Ix&&dg(e,we),En&&Fe(e,"lastPositionUpdate",Date.now()),Se){w4(e);return}fx(n,qe.startNoBuffer),!Pt&&!n.didContainersLayout&&(uu(n)?mu(n,n.startBuffered,n.endBuffered):mu(n,n.startNoBuffer,n.endNoBuffer)||mu(n,n.startBuffered,n.endBuffered))&&(nG(e),B4(e)),re&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&C_(e.state,e,re,Y,qe.startNoBuffer,qe.endNoBuffer,St??qe.startNoBuffer,kt??qe.endNoBuffer),(k=Mt?.finishCalculateItemsInView)==null||k.call(Mt)})}function cg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=be(e,"anchoredEndSpaceSize"),s=o.anchoredEndSpaceReadyAnchorIndex,i=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:h,anchorMaxSize:v,anchorOffset:y=0}=r,{data:C}=o.props;if(h>=0&&h<C.length&&o.scrollLength>0){d=Vt(o,h);let x=0,b=!1;for(let I=h;I<C.length;I++){let k=t_(e,I),P=I===h&&v!==void 0?Math.min(k||0,Math.max(0,v)):k;k===void 0&&(b=!0),P!=null&&P>0&&(x+=P)}x=Math.max(0,x-e.scrollAxisGap),x+=(e.values.get("footerSize")||0)+bx(o.props),c=!b;let w=Math.max(0,o.scrollLength-x-y);f=b?Math.min(a||0,w):w}else h>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(s!==l||i!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Fe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Bi(e),Di(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Fe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Di(e,o.scroll,!0,{markHasScrolled:!1})),f}function pG(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 bN(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=be(e,"otherAxisSize");(!a||r>a)&&Fe(e,"otherAxisSize",r)}}var Ta;function I_(e){let t=Ta===void 0;Ta??(Ta=new Map);try{e()}finally{if(t){let n=Ta;Ta=void 0;for(let[o,r]of n)_x(o,r)}}}function mG(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 gG(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,pG(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&cg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&od(e)}function w_(e,t){if(Ta){let n=Ta.get(e);n?n.push(t):Ta.set(e,[t])}else _x(e,[t])}function _x(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||be(e,`containerItemKey${a.containerId}`)===a.itemKey){let i=o.indexByKey.get(a.itemKey),l=i===void 0||(n=o.props.data)==null?void 0:n[i],d=a.containerId!==void 0&&i!==void 0&&l!==void 0?k4(o,a.containerId,i,l):void 0,c=hG(e,a.itemKey,a.size,d);mG(r,c)}gG(e,r)}function hG(e,t,n,o){var r,a;let s=e.state,i=s.userScrollAnchorReset,l=!!i?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:g,data:h,maintainScrollAtEnd:v}}=s;if(!h)return{didMeasureUserScrollAnchorResetItem:l};let y=s.indexByKey.get(t);if(f){if(y===void 0)return{didMeasureUserScrollAnchorResetItem:l};let P=s.props.data[y];if(P===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let L=(a=o?.itemType)!=null?a:p&&(r=p(P,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(P,y,L),itemType:L}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return bN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let C=!d,x=!1,b,w=s.sizesKnown.get(t),I=vG(e,t,n,o),k=hu(m?n.width:n.height);if(I!==0){b=b!==void 0?Math.min(b,y):y;let{startBuffered:P,endBuffered:T}=s;C||(C=y>=P&&y<=T),!C&&s.containerItemKeys.has(t)&&(C=!0),(w===void 0||Math.abs(w-k)>5)&&(x=!0),g?.({index:y,itemData:s.props.data[y],itemKey:t,previous:k-I,size:k})}if(b!==void 0&&(s.minIndexSizeChanged=s.minIndexSizeChanged!==void 0?Math.min(s.minIndexSizeChanged,b):b),bN(e,n,m),d||mu(s,s.startBuffered,s.endBuffered)){let P=x&&!!v?.onItemLayout;return{didChange:I!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:C,shouldMaintainScrollAtEnd:P}}return{didChange:I!==0,didMeasureUserScrollAnchorResetItem:l}}function vG(e,t,n,o){var r,a;let s=e.state,{indexByKey:i,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=s;if(!c)return 0;let g=i.get(t),h=c[g],v=o?.itemType,y=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(h,g))!=null?r:"",y=m(h,g,v));let C=o?.didResolveFixedItemSize||v!==void 0||y!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:y,itemType:v}:void 0,x=eo(e,t,g,h,void 0,void 0,void 0,C),b=f?n.width:n.height,w=l.get(t),I=Math.round(b);if(l.set(t,I),y===void 0&&I>0){v??(v=p&&(a=p(h,g))!=null?a:"");let k=d[v];k||(k=d[v]={avg:0,num:0}),k.num===0?(k.avg=I,k.num++):w!==void 0&&w>0?k.avg+=(I-w)/k.num:(k.avg=(k.avg*k.num+I)/(k.num+1),k.num++)}return!x||Math.abs(x-I)>.1?(dx(e,t,I),I-x):0}function yG(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),s=be(e,`containerItemKey${r}`),i=a?.current;if(s!==void 0&&i){let l=i.getBoundingClientRect();gW(i,l),n.push({containerId:r,itemKey:s,size:{height:l.height,width:l.width}})}}n.length>0&&_x(e,n)}var T_=Nn,Kr=ye,CG=Kr(function({children:t}){let n=br(),[o]=_o(["containerLayoutEpoch"]);return xe(()=>{{let r=H4(n);r!==void 0&&yG(n,r)}},[n,o]),t}),rg=e=>Dg(e)?e:e?Me(e,null):null,xG=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),px={contain:"paint layout style",...xG?{display:"flex",flexDirection:"column"}:{}},bG=Kr(function({id:t,horizontal:n,style:o,refView:r,...a}){let[s=ed]=_o([`containerPosition${t}`]),i=vg(o)?Object.assign({},...o):o,l=n?{...px,...i,left:s}:{...px,...i,top:s},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Me("div",{ref:r,...m,style:l})}),SG=Kr(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:s,onLayout:i,onLayoutChange:l,children:d,...c}){let[f=ed,p,m]=_o([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),g=V(()=>{var y;return(y=vg(o)?Object.assign({},...o):o)!=null?y:{}},[o]),h=V(()=>{var y;let C={...px,...g};delete C.transform;let x=(y=s?.offset)!=null?y:0,b=p===m;return C.position=b?"sticky":"absolute",C.zIndex=m+1e3,n?C.left=b?x:f:C.top=b?x:f,C},[g,n,f,m,p,s?.offset]),v=V(()=>s?.backdropComponent?Me("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},rg(s.backdropComponent)):null,[s?.backdropComponent]);return Me("div",{ref:r,style:h,...c},v,d)}),IG=bG;function wG(e){Q(()=>e())}var P_=yt(null),TG=-1;function PG(){return Ot(P_)}function kG(){var e;let t=PG(),n=(e=t?.containerId)!=null?e:TG,[o]=_o([`containerItemKey${n}`]);return uW("lastItemKeys",a=>t&&!pu(o)&&a?.includes(o)||!1)}function LG({ItemSeparatorComponent:e,leadingItem:t}){return kG()?null:Me(e,{leadingItem:t})}var rx=null;function AG(){return rx||(rx=new ResizeObserver(e=>{I_(()=>{for(let t of e){let n=ag.get(t.target);if(n)for(let o of n)o(t)}})})),rx}var ag=new WeakMap;function RG(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=AG(),r=(n=ag.get(e))!=null?n:new Set;return r.size===0&&(ag.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(ag.delete(e),o.unobserve(e))}}function Dx({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return xe(()=>{var s,i;let l=e.current,c=((i=(s=l?.getScrollableNode)==null?void 0:s.call(l))!=null?i:null)||l;if(!c)return;let f=(m,g)=>{m.height===0&&m.width===0||(o(m,g),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(SN(m),!0),p=m}return RG(c,m=>{var g;let h=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,y=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(g=h?.getBoundingClientRect())!=null?g:m.contentRect,C=p??mW(c),x=C===void 0||y.width!==C.width||y.height!==C.height;p=y;let b=!!r?.();(x||b)&&f(SN(y),!1)})},[t,...a||[]]),{}}function SN(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var sg=new Map,ax;function k_(e){sg.delete(e)}function EG(e,t){sg.set(e,t),ax===void 0&&(ax=requestAnimationFrame(()=>{let n=Array.from(sg.values());sg.clear(),ax=void 0,I_(()=>{for(let o of n)o()})}))}function MG({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,s=r.itemKey;r.didLayout=!0;let i=n,l=r.horizontal?"width":"height",d=hu(n[l]);r.lastSize&&hu(r.lastSize[l]);let f=a.sizesKnown.get(s),p=()=>{r.lastSize=i,w_(t,{containerId:e,itemKey:s,size:i})};!Su(a)&&f!==void 0&&d+1<f?EG(r,()=>{var g;if(r.itemKey===s){let h=o.current,v=(g=h?.getBoundingClientRect)==null?void 0:g.call(h);v&&(i={height:v.height,width:v.width}),p()}}):(k_(r),p())}function NG({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=N({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[s,i]=Q(0),l=E(f=>{MG({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=E(()=>{dg(t,e)},[e,t]);xe(()=>(t.containerLayoutTriggers.set(e,d),()=>{k_(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),xe(()=>{dg(t,e)});let{onLayout:c}=Dx({measureInLayoutEffect:!Ix,onLayoutChange:l,ref:r,webLayoutResync:()=>Su(t.state)},[o,s]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function _G({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:s,otherAxisSize:i}){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&&La.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:i,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:s,...l||{}}:{boxSizing:l?"border-box":void 0,left:s,position:"absolute",right:a>1?null:0,top:0,width:i,...l||{}}}var DG=Kr(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:s,stickyHeaderConfig:i}){let l=br(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Ra(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[g=0,h=1,v,y=1,C,x]=_o([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),b=N(null),{onLayout:w,triggerLayout:I}=NG({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:b}),k=g>0?g:1,P=Math.min(Math.max(h||1,1),y),T=y>1?`${(k-1)/y*100}%`:0,L=y>1?`${P/y*100}%`:void 0,A=V(()=>_G({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!s,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:T,otherAxisSize:L}),[r,f,T,L,d,l.state.props.contentContainerAlignItems,y,s]),M=V(()=>n!==void 0?a(n):null,[n,v,C]),{renderedItem:R}=M||{},D=V(()=>(l.viewRefs.set(t,b),{containerId:t,triggerLayout:I}),[t,I]);return Me(x?m||SG:p||IG,{animatedScrollY:x?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:w,refView:b,stickyHeaderConfig:i,style:A},Me(P_.Provider,{value:D},R,M&&s&&Me(LG,{ItemSeparatorComponent:s,leadingItem:M.item})))});function OG({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:s=DG}){let[i]=_o([`containerItemKey${e}`]);return i===void 0?null:Me(s,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:i,recycleItems:n,stickyHeaderConfig:a})}var FG=Kr(function(t){return Me(OG,{...t})});function BG(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)),s=UG(a),i=new Set(s);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!i.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],g=n.indexOf(m);if(i.has(g)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function UG(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let i=0;i<t;i++){let l=e[i],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(i)):(n[d]=l,r[d]=i),d>0&&(o[i]=r[d-1])}let a=[],s=r[r.length-1];for(;s!==-1;)a.unshift(s),s=o[s];return a}function zG(e){let t=br(),n=N(void 0);q(()=>{let o=Pa(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[s,i]of t.viewRefs){let l=i.current,d=be(t,`containerItemIndex${s}`);l&&d!==void 0&&a.set(l,d)}BG(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function HG(e,t){let[n,o]=Q(t),r=n!==t;return xe(()=>{o(t)},[t]),e&&!r}var KG=Kr(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=N(null),s=br(),i=s.columnWrapperStyle,l=Ra(s.state),[d,c,f]=_o(["otherAxisSize","readyToRender","totalSize"]),p=HG(!!c,t);zG(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"),i&&o>1){let{columnGap:g,rowGap:h,gap:v}=i,y=g||v||0,C=h||v||0;n?(C&&(m.marginTop=m.marginBottom=-C/2),y&&(m.marginRight=-y)):C&&(m.marginBottom=-C)}return Me("div",{ref:a,style:m},Me(CG,null,r))}),$G=Kr(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:s}){let[i,l]=_o(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<i;c++)d.push(Me(FG,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:s}));return Me(KG,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function qG(e){return vg(e)?Object.assign({},...e.filter(Boolean)):e}var bu={create:e=>e,flatten:e=>qG(e)};function mx(e){let t=N(e);return t.current=e,t}function VG(e){let t=mx(e),n=N(void 0),o=V(()=>({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 gx="legend-list-content-container",L_="legend-list-scrollbar-x-hidden",A_="legend-list-scrollbar-y-hidden";function WG(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function hx(){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 IN(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 R_(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function GG(e,t,n){return R_(n?t:e)}function wN(e,t,n){var o,r,a,s,i,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:(s=(a=d?.width)!=null?a:e?.clientWidth)!=null?s:window.innerWidth}}return{height:(i=e?.clientHeight)!=null?i:0,width:(l=e?.clientWidth)!=null?l:0}}function TN(e,t){return Math.max(0,Math.min(e,t))}function PN(e,t){return t?e.width:e.height}function jG(e,t,n){return Math.max(0,PN(e,n)-PN(t,n))}function kN(e,t){return t&&WG()||e}function QG(e,t){return t&&typeof window<"u"?window:e}function XG(e,t,n){let o=e.getBoundingClientRect(),r=hx();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 YG({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var LN="legend-list-scrollbar-axis-hidden-style",JG=200,ZG=`.${A_}::-webkit-scrollbar:vertical{width:0;display:none;}.${L_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function ej(){if(typeof document>"u"||document.getElementById(LN))return;let e=document.createElement("style");e.id=LN,e.textContent=ZG,document.head.appendChild(e)}function tj(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 nj(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 oj(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 AN=Nn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:s,maintainVisibleContentPosition:i,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:g=!1,onLayout:h,...v},y){var C,x,b;let w=br(),[I]=_o(["anchoredEndSpaceSize"]),k=N(null),P=N(null),T=g,L=E(()=>QG(k.current,T),[T]),A=E(()=>{let j=k.current,ue=GG(j,P.current,T),ge=wN(j,T,a);return jG(ue,ge,a)},[a,T]),M=E(()=>{let j=k.current;if(T){let ue=A(),ge=hx(),ie=IN(j,ge),He=a?ge.x-ie.left:ge.y-ie.top;return TN(He,ue)}return j?a?j.scrollLeft:j.scrollTop:0},[A,a,T]),R=E((j,ue)=>{let ge=k.current,ie=L();if(!ie||typeof ie.scrollTo!="function")return;let He=A(),Pt=TN(j,He),gt={behavior:ue?"smooth":"auto"};if(T){let bt=hx(),ut=IN(ge,bt),{left:mt,top:st}=YG({clampedOffset:Pt,horizontal:a,listPos:ut,scroll:bt});gt.left=mt,gt.top=st}else a?gt.left=Pt:gt.top=Pt;ie.scrollTo(gt)},[A,L,a,T]);Bo(y,()=>({getBoundingClientRect:()=>{var ue;return(ue=k.current)==null?void 0:ue.getBoundingClientRect()},getCurrentScrollOffset:M,getScrollableNode:()=>kN(k.current,T),getScrollEventTarget:()=>L(),getScrollResponder:()=>kN(k.current,T),isWindowScroll:()=>T,scrollBy:(ue,ge)=>{let ie=L();!ie||typeof ie.scrollBy!="function"||ie.scrollBy({behavior:"auto",left:ue,top:ge})},scrollTo:ue=>{let{x:ge=0,y:ie=0,animated:He=!0}=ue;R(a?ge:ie,He)},scrollToEnd:(ue={})=>{let{animated:ge=!0}=ue,ie=A();R(ie,ge)},scrollToOffset:ue=>{let{offset:ge,animated:ie=!0}=ue;R(ge,ie)}}),[M,A,L,a,T,R]);let D=E(()=>{if(!l||!k.current)return;let j=R_(P.current),ue=wN(k.current,T,a),ge=M(),ie={nativeEvent:{contentOffset:{x:a?ge:0,y:a?0:ge},contentSize:{height:j.height,width:j.width},layoutMeasurement:{height:ue.height,width:ue.width}}};l(ie)},[M,a,T,l]),H=VG(D),W=N(void 0),F=E(()=>{let j=W.current;j!==void 0&&(clearTimeout(j),W.current=void 0),H.flush(),d?.()},[d,H]),J=E(j=>{if(!l)return;let ue=w.state;if(!!ue?.scrollingTo||!!ue?.initialScrollSession&&!ue.didFinishInitialScroll||!!ue?.initialScroll&&!ue.didFinishInitialScroll||!!ue&&Su(ue)?H.flush():H.schedule(),d){let ie=W.current;ie!==void 0&&clearTimeout(ie),W.current=setTimeout(F,JG)}},[w.state,F,d,l,H]);xe(()=>{let j=L();if(j)return j.addEventListener("scroll",J,{passive:!0}),"onscrollend"in j&&j.addEventListener("scrollend",F),()=>{j.removeEventListener("scroll",J),"onscrollend"in j&&j.removeEventListener("scrollend",F);let ue=W.current;ue!==void 0&&(clearTimeout(ue),W.current=void 0),H.cancel()}},[F,L,J,H]),q(()=>{let j=()=>{s&&R(a?s.x||0:s.y||0,!1)};j(),requestAnimationFrame(j)},[s?.x,s?.y,a,R]),xe(()=>{if(!h||!k.current)return;let j=k.current,ue=()=>{h({nativeEvent:{layout:XG(j,T,a)}})};ue();let ge=new ResizeObserver(()=>{ue()});ge.observe(j);let ie=()=>{ue()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",ie),()=>{ge.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",ie)}},[T,h]);let O=!T&&(a?!f&&L_:!p&&A_);xe(()=>{O&&ej()},[O]);let B={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...bu.flatten(n),...i?{overflowAnchor:"none"}:{}},Y=tj(w),U=(x=(C=w.state)==null?void 0:C.props)!=null&&x.anchoredEndSpace&&I?I:0,X=Math.max(0,Y-U),re=X?a?{flexShrink:0,width:X}:{height:X}:void 0,G={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...bu.flatten(r),...i?{overflowAnchor:"none"}:{}},te=o?`${gx} ${o}`:gx,{contentContainerClassName:oe,contentInset:Z,scrollEventThrottle:ee,ScrollComponent:fe,snapToOffsets:Re,useWindowScroll:Be,className:Se,...Ee}=v,ne=T?[]:nj(Re);ne.length>0&&(B.scrollSnapType=a?"x mandatory":"y mandatory",G.position=(b=G.position)!=null?b:"relative");let we=O?Se?`${Se} ${O}`:O:Se;return No&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${Se??""}`)&&Ni("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."),Me("div",{className:we,ref:k,...Ee,style:B},m,Me("div",{className:te,ref:P,style:G},ne.map(j=>Me("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":j,key:`snap-${j}`,style:oj(j,a)})),t,re?Me("div",{"aria-hidden":!0,style:re}):null))});function rj({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function RN(e,t){let n=br();xe(()=>Pa(n,e,r=>{t(r)}),[t,n,e])}function aj(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function sj(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,s=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,i=null;return s&&(i=t?.isConnected&&t.parentElement===s?t:s.querySelector(`:scope > .${gx}`)),s?{contentNode:i,scrollElement:s}:null}function ij(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function lj(){let e=br(),t=N(0),n=N(0),o=N(void 0),r=N(void 0),a=N(null),s=E(()=>{let i=be(e,"scrollAdjust"),l=be(e,"scrollAdjustUserOffset"),d=(i||0)+(l||0);if(d-t.current!==0){let f=sj(e,a.current);if(f){let p=!!e.state.props.horizontal,m=aj(p),{contentNode:g,scrollElement:h}=f,v=p?h.scrollLeft:h.scrollTop,y=(l||0)-n.current,x=(y!==0?v+y:e.state.scroll)-v,b=Math.abs(x)>.01,w=()=>ij(h,m.x*x,m.y*x);if(a.current=g,b&&g){let I=g[m.contentSizeKey],k=h[m.viewportSizeKey],P=v+x;if(x>0&&!e.state.adjustingFromInitialMount&&I<P+k){let L=g.style[m.paddingEndProp],A=r.current,M=A?.value===L?A.baseline:L,R=(P+k-I)*2,H=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+R}px`;g.style[m.paddingEndProp]=H,r.current={baseline:M,value:g.style[m.paddingEndProp]},g.offsetHeight,w(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let W=r.current;o.current=void 0,r.current=void 0,g.style[m.paddingEndProp]===W?.value&&(g.style[m.paddingEndProp]=W.baseline)})}else w()}else b&&w()}t.current=d,n.current=l||0}},[e]);return RN("scrollAdjust",s),RN("scrollAdjustUserOffset",s),null}var dj=Nn(function({ScrollComponent:t,...n},o){let[r]=_o(["snapToOffsets"]);return Me(t,{...n,ref:o,snapToOffsets:r})}),vx=.1;function cj(e,t,n){let o=be(e,t)!==n;return o&&(Fe(e,t,n),Bi(e)),o}function uj(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:s,scrollingTo:i}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!i&&s>=c-vx&&Math.abs(l)>vx}function EN(e,t){let{state:n}=e,o=be(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>vx;r&&(Fe(e,"headerSize",t),Bi(e),a&&uj(e,o,t)&&Ui(e,t-o)),n.didMeasureHeader=!0}function fj(e,t){let n=cj(e,"footerSize",t);return n&&cg(e),n}function pj(e,t){var n,o,r,a,s,i,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)&&((s=e?.left)!=null?s:0)===((i=t?.left)!=null?i:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function mj(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!pj(o,r);return n.contentInsetOverride=r,a&&Bi(e),a}function gj(e,t){let n=mx(e),o=mx(t);return V(()=>Nn((r,a)=>{var s,i;return(i=(s=n.current)==null?void 0:s.call(n,o.current(r,a)))!=null?i:null}),[o,n])}var MN=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=N(null),a=t??r;return Dx({onLayoutChange:e,ref:a}),Me("div",{...o,ref:a},n)},hj=Kr(function({horizontal:t}){let[n=0]=_o(["alignItemsAtEndPadding"]);return n<=0?null:Me(ug,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),vj=Kr(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:s,recycleItems:i,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:g,ListFooterComponentStyle:h,ListEmptyComponent:v,getRenderedItem:y,refScrollView:C,renderScrollComponent:x,onLayoutFooter:b,onInternalScrollBeginDrag:w,onInternalScrollEnd:I,scrollAdjustHandler:k,snapToIndices:P,stickyHeaderConfig:T,stickyHeaderIndices:L,useWindowScroll:A=!1,...M}){let R=br(),D=R.state.props.maintainVisibleContentPosition,[H=0,W=0]=_o(["anchoredEndSpaceSize","otherAxisSize"]),F=R.state.props.alignItemsAtEndPaddingEnabled,J=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&H>0,O;if(J){let oe=a?Ra(R.state)?"Left":"Right":"Bottom",Z=bu.flatten(r);O={[`padding${oe}`]:cu({},Z||{},oe)+H}}let B=rj({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:W}),Y=gj(x,(oe,Z)=>({...oe,ref:Z})),U=x?Y:AN,X=P?dj:U,re=E((oe,Z)=>{var ee;let fe=fj(R,oe);Z?.(),fe&&((ee=R.state.props.maintainScrollAtEnd)!=null&&ee.onFooterLayout)&&od(R)},[R]);xe(()=>{p||EN(R,0),g||re(0)},[p,g,R,re]);let G=E(oe=>{let Z=oe[a?"width":"height"];EN(R,Z)},[R,a]),te=E((oe,Z)=>{let ee=oe[a?"width":"height"];re(ee,()=>{b?.(oe,Z)})},[a,b,re]);return Me(X,{...M,...U===AN?{onInternalScrollEnd:I,useWindowScroll:A}:{},contentContainerStyle:[a?{height:"100%"}:{},r,O,{boxSizing:"border-box"}],contentOffset:s!==void 0?a?{x:s,y:0}:{x:0,y:s}:void 0,horizontal:a,maintainVisibleContentPosition:D.size||D.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:C,ScrollComponent:P?U:void 0,style:B?[B,o]:o},Me(lj,null),p&&Me(MN,{onLayoutChange:G,style:m},rg(p)),v&&rg(v),F&&Me(hj,{horizontal:a}),t&&!v&&Me($G,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:i,stickyHeaderConfig:T}),g&&Me(MN,{onLayoutChange:te,style:h},rg(g)),No&&vW)}),yj=100,Cj=.9,xj=.9;function bj(e){let t=br(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:s,useWindowScroll:i}=e,l=!!n;q(()=>{l&&(a??1)>1&&Ni("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),q(()=>{i&&s&&Ni("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[s,i]),q(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Ni("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<yj)return;let p=()=>{let g=be(t,"readyToRender"),h=be(t,"numContainers")||0,v=be(t,"totalSize")||0,y=t.state.scrollLength||0;if(!g||v<=0||y<=0)return;let C=h>=Math.ceil(c*Cj),x=y>=v*xj;C&&x&&Ni("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=[Pa(t,"numContainers",p),Pa(t,"readyToRender",p),Pa(t,"totalSize",p)];return()=>{for(let g of m)g()}},[t])}function Sj(e){}var Ij=No?bj:Sj;function wj(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),u_(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 i=!n&&a?.onDataChange&&od(e);!i&&r&&t.length>r.length&&(o.isEndReached=!1),i||gg(e),delete o.previousData}function Tj(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:s}}=e,i;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!s)return i&&(e.pendingDataComparison={byIndex:i,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:s(n[l],l),c=s(t[l],l);if(d!==c)return i&&(e.pendingDataComparison={byIndex:i,nextData:t,previousData:n}),!0;if(!a)return i&&(e.pendingDataComparison={byIndex:i,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(i??(i=[]),i[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:i,nextData:t,previousData:n},!0}return!1}function E_(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:s,getItemType:i,numColumns:l,estimatedItemSize:d}}=o,c=XN(e),f=be(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(s){let g=0,h=Math.min(20,a.length);for(let v=0;v<h;v++){let y=a[v];if(y!==void 0){let C=(t=i?.(y,v))!=null?t:"";g+=((n=s(y,v,C))!=null?n:d)+e.scrollAxisGap}}p=g/h}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let g=0;g<m;g++)Fe(e,`containerPosition${g}`,ed),Fe(e,`containerColumn${g}`,-1),Fe(e,`containerSpan${g}`,1);return Fe(e,"numContainers",m),Fe(e,"numContainersPooled",J4(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{ka(e,{dataChanged:!0,doMVCP:!0})}):ka(e,{dataChanged:!0,doMVCP:!0})),!0}}function Pj(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function kj(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,s=o.props.horizontal?"width":"height",i=o.props.horizontal?"height":"width",l=t;if(a){let v=Pj()[s];l=v>0?{...t,[s]:v}:t}let d=l[s],c=o.scrollLength,f=d>0?d:c,p=l[i],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let g=o.otherAxisSize,h=f!==o.scrollLength||p!==g;if(h){if(o.scrollLength=f,o.otherAxisSize=p,Bi(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&E_(e),m&&ka(e,{doMVCP:!0}),(h||p!==g)&&Fe(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&od(e),gg(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}No&&d===0&&Ni("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 Lj(e,t){let n=jn.get(e);if(!!n&&jn.didReachTarget(t,n)){jn.clear(e);return}n&&(e.hasScrolled=!1,jn.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function Aj(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function Rj(e){return{...e,nativeEvent:{...e.nativeEvent}}}function Ej(e,t){var n,o,r,a,s,i;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=oW(l,f,(s=t.nativeEvent.contentSize)==null?void 0:s.width)),l.didFinishInitialScroll&&((i=l.initialScroll)==null?void 0:i.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=ws(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,xg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Di(e,f,c,{fromNativeScrollEvent:!0}),Lj(l,f),C4(e),l.scrollingTo&&Mx(e),l.props.onScroll&&(Aj(l)?l.deferredPublicOnScrollEvent=Rj(t):l.props.onScroll(t))}var Mj=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()}},Nj=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,Fe(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Fe(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&Mx(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=hg(this.ctx,e.index);o=yg(this.ctx,a,e),o=ws(this.ctx,o,e)}else o=ws(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,Fe(this.ctx,"scrollAdjust",this.appliedAdjust)),Fe(this.ctx,"scrollAdjustPending",0),ka(this.ctx)}}}};function _j(e,t){let n=e.state,o=_i(e,t),a=_i(e)-o;if(a!==0){let s=!!be(e,"isWithinMaintainScrollAtEndThreshold");Di(e,n.scroll,!0,{markHasScrolled:!1}),!m_(e)&&s&&a>0&&Ui(e,a)}}function sx(e){return V(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var Dj=(...e)=>E(n=>{for(let o of e)o&&(ZN(o)?o(n):o.current=n)},e);function Oj(e){return null}function Fj(e,t,n,o){return o}function Bj(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 Uj(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,s=be(e,"footerSize")||0;return og(e,{...t,index:r,viewOffset:-a-s+(t?.viewOffset||0),viewPosition:1}),!0}var zj="default";function Hj(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||zj]={average:o.avg,count:o.num})}return t}function Kj(e){dg(e)}function $j(e,t){let n=e.state,o=800,r=2,a=0,s=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,i=(h,v=!1)=>{var y;let C=n.props,x=C.data.length,b=(y=C.anchoredEndSpace)==null?void 0:y.anchorIndex;return h<0?v:h>=x?!1:b===void 0||b<0||b>=x||h<b?!0:DW(e,b,x-1)},l=(h,v,y)=>{let C=Date.now(),x=0,b=()=>{if(h!==a)return;s()||!y()?x=0:x+=1;let w=Date.now()-C>=o;if(x>=r||w){v();return}n.scheduledWork.frame(b,"imperativeScrollReady")};n.scheduledWork.frame(b,"imperativeScrollReady")},d=(h,v,y,C=()=>!0)=>{let x=()=>{if(h!==a)return;(!y()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};s()||!C()?l(h,x,C):x()},c=h=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return KN(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let C=c(y);dN(e),d(C,y,h,v)});n.runPendingScrollToEnd=()=>{let h=n.pendingScrollToEnd;h&&(n.pendingScrollToEnd=void 0,h.token===a&&d(h.token,h.resolve,()=>Uj(e,h.options),()=>i(n.props.data.length-1,!0)))};let p=h=>{if(n){let{index:v,...y}=h,{startNoBuffer:C,endNoBuffer:x}=n;if(v<C||v>x){let b=v<C?0:1;return og(e,{...y,index:v,viewPosition:b}),!0}}return!1},m=n.refScroller;return{clearCaches:h=>{var v,y;let C=(v=h?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),u_(n);for(let x in n.averageSizes)delete n.averageSizes[x];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Fe(e,"totalSize",0),C==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),Kj(e),(y=n.triggerCalculateItemsInView)==null||y.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var h,v,y;return(y=(v=(h=m.current).getNativeScrollRef)==null?void 0:v.call(h))!=null?y:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:be(e,"activeStickyIndex"),contentLength:Zn(e),data:n.props.data,elementAtIndex:h=>{var v;return(v=e.viewRefs.get(cx(e,Vt(n,h))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>Hj(n),indexByKey:h=>n.indexByKey.get(h),isAtEnd:be(e,"isAtEnd"),isAtStart:be(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:be(e,"isNearEnd"),isNearStart:be(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:be(e,"isWithinMaintainScrollAtEndThreshold"),listen:(h,v)=>Pa(e,h,v),listenToPosition:(h,v)=>dW(e,h,v),positionAtIndex:h=>n.positions[h],positionByKey:h=>{let v=n.indexByKey.get(h);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Cg(n),sizeAtIndex:h=>n.sizesKnown.get(Vt(n,h)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:h=>{let v=mj(e,h);Di(e,n.scroll,!0,{markHasScrolled:!1}),v&&m_(e)},scrollIndexIntoView:h=>f(()=>p(h)),scrollItemIntoView:({item:h,...v})=>f(()=>{let C=n.props.data.indexOf(h);return C!==-1?(p({index:C,...v}),!0):!1}),scrollToEnd:h=>new Promise(v=>{var y;let C=c(v);n.pendingScrollToEnd={options:h,resolve:v,token:C},t?.(),dN(e),t||(y=n.runPendingScrollToEnd)==null||y.call(n)}),scrollToIndex:h=>f(()=>(og(e,h),!0),h.index>=0?()=>i(h.index):void 0),scrollToItem:({item:h,...v})=>f(()=>{let C=n.props.data.indexOf(h);return C!==-1?(og(e,{index:C,...v}),!0):!1}),scrollToOffset:h=>f(()=>(xg(e,h),!0)),setItemSize:(h,v)=>{w_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=ZN(h)?h(be(e,"scrollAdjustUserOffset")||0):h;Fe(e,"scrollAdjustUserOffset",v)}}}var qj=(e,t)=>e-t,NN=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,du=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function Vj(e,t,n,o){var r,a;if(t.length===0)return[];let s=new Set,i=t.length,l=NN(e?.top);if(l>0)for(let f=0;f<Math.min(l,i);f++)du(s,i,f);let d=NN(e?.bottom);if(d>0)for(let f=Math.max(0,i-d);f<i;f++)du(s,i,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&du(s,i,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<i&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(du(s,i,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:i;p<i;p++)du(s,i,p)}let c=Array.from(s);return c.sort(qj),c}function Wj(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:s,renderItem:i}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=be(e,"extraData"),f=a[l];if(i&&!pu(f)){let p={data:a,extraData:c,index:l,item:f,type:s&&(n=s(f,l))!=null?n:""};d=i(p)}return{index:l,item:a[l],renderedItem:d}}function _N(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 Gj(e){var t;return e?e===!0?{..._N(void 0,!1),animated:!1}:{..._N(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function jj(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 Qj(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=be(e,"stylePaddingTop")||0;if(t<o){let r=be(e,"totalSize")||0;Fe(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=be(e,"totalSize")||0,Fe(e,"totalSize",r-o)},16)}Fe(e,"stylePaddingTop",t)}}function Xj(e){let t=N(null),n=N(0),o=N(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return E((s,i,...l)=>{{let d=Date.now();o.current=l,d-n.current>=i?(n.current=d,s(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),s(...o.current),t.current=null,o.current=null)},i-(d-n.current)))}},[e])}function Yj(e,t){let n=Xj("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var Jj=Kr(T_(function(t,n){let{children:o,data:r,renderItem:a,...s}=t,l=o!==void 0&&r===void 0?{...s,childrenMode:!0,data:(vg(o)?o:Ng.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...s,data:r||[],renderItem:a};return Me(sW,null,Me(Zj,{...l,ref:n}))})),Zj=T_(function(t,n){var o,r,a,s,i,l,d,c,f,p,m,g,h,v,y,C,x,b,w;let I=E(Ve=>{},[]);t.recycleItems===void 0&&Ni("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:k=!1,anchoredEndSpace:P,alwaysRender:T,columnWrapperStyle:L,contentContainerStyle:A,contentInset:M,data:R=[],dataKey:D,dataVersion:H,drawDistance:W=250,contentInsetEndAdjustment:F,estimatedItemSize:J=100,estimatedListSize:O,extraData:B,getFixedItemSize:Y,getItemType:U,horizontal:X,rtl:re,estimatedHeaderSize:G,initialScrollAtEnd:te=!1,initialScrollIndex:oe,initialScrollOffset:Z,experimental_adaptiveRender:ee,itemsAreEqual:fe,keyExtractor:Re,ListEmptyComponent:Be,ListFooterComponent:Se,ListFooterComponentStyle:Ee,ListHeaderComponent:ne,maintainScrollAtEnd:we=!1,maintainScrollAtEndThreshold:j=.1,maintainVisibleContentPosition:ue,numColumns:ge=1,overrideItemLayout:ie,onEndReached:He,onEndReachedThreshold:Pt=.5,onItemSizeChanged:ct,onMetricsChange:gt,onLayout:bt,onLoad:ut,onMomentumScrollEnd:mt,onRefresh:st,onScroll:lt,onScrollBeginDrag:At,onStartReached:Wt,onStartReachedThreshold:fn=.5,onStickyHeaderChange:at,onFirstVisibleItemChanged:Mt,onViewableItemsChanged:Ht,progressViewOffset:nn,recycleItems:Kt=!1,refreshControl:jt,refreshing:yn,refScrollView:$,renderScrollComponent:ae,renderItem:de,scrollEventThrottle:Pe,snapToIndices:_e,stickyHeaderIndices:ft,style:pn,useWindowScroll:St=!1,viewabilityConfig:ht,viewabilityConfigCallbackPairs:kt,...je}=t,Qt=t.animatedPropsInternal,Zt=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",Te=t.positionComponentInternal,$e=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:qe,positionComponentInternal:ot,stickyPositionComponentInternal:rt,...tt}=je,It=bu.flatten(A),Bt=k&&!X&&It?.minHeight==null&&R.length>0,wn=k&&!Bt&&(X?It?.minWidth==null:It?.minHeight==null),on={...It,...k&&!Bt?{display:"flex",flexDirection:X?"row":"column",...wn?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},mn={...bu.flatten(pn)},Hn=cu(mn,on,"Top"),En=cu(mn,on,"Bottom"),Ce=cu(mn,on,"Left"),Ze=cu(mn,on,"Right"),_t=bx({horizontal:X,rtl:re,stylePaddingBottom:En,stylePaddingLeft:Ce,stylePaddingRight:Ze}),vt=Gj(we),cn=jj(ue),vn=oe!=null,ln=Z!=null,en=!te&&!vn&&!ln&&xx({horizontal:X,rtl:re}),Kn=!te&&!vn&&(ln||en),Dt=te||vn,Tn=te?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-_t,viewPosition:1}:vn?typeof oe=="object"?{index:(r=oe.index)!=null?r:0,preserveForBottomPadding:oe.viewOffset===void 0&&oe.viewPosition===1?!0:void 0,viewOffset:(a=oe.viewOffset)!=null?a:oe.viewPosition===1?-_t:0,viewPosition:(s=oe.viewPosition)!=null?s:0}:{index:oe??0,viewOffset:Z??0}:Kn?{contentOffset:Z??0,index:0,viewOffset:0}:void 0,[Qn,$r]=Q(!Ix),[,Na]=ea(Ve=>Ve+1,0),ze=br();ze.columnWrapperStyle=L||(on?Bj(on):void 0);let qr=X?(d=(i=ze.columnWrapperStyle)==null?void 0:i.columnGap)!=null?d:(l=ze.columnWrapperStyle)==null?void 0:l.gap:(p=(c=ze.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=ze.columnWrapperStyle)==null?void 0:f.gap,Do=typeof qr=="number"&&Number.isFinite(qr)?qr:0,Vr=N(null),Ts=Dj(Vr,$),Oo=Re??((Ve,Rt)=>Rt.toString()),Cn=ft,Ir=F,Wr=N(Ir),Ps=V(()=>{let Ve=Vj(T,R,Oo,P?.anchorIndex);return{arr:Ve,set:new Set(Ve)}},[P?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(g=T?.keys)==null?void 0:g.join(","),R,D,H,Oo]),uo=!!St&&!ae,Mn=N(void 0),Gr=!!ie,jr=N(Gr);if(!Mn.current){if(!ze.state){let Ve=(O??{height:0,width:0})[X?"width":"height"];ze.values.set("adaptiveRender",(h=ee?.initialMode)!=null?h:"normal"),ze.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:Tn,initialScrollSession:Tn?{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 Mj,scroll:0,scrollAdjustHandler:new Nj(ze),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:Ve,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 Rt=ze.state;Rt.triggerCalculateItemsInView=dn=>ka(ze,dn),Rt.reprocessCurrentScroll=()=>Di(ze,Rt.scroll,!0),Fe(ze,"maintainVisibleContentPosition",cn),Fe(ze,"extraData",B),G!==void 0&&Fe(ze,"headerSize",G)}Mn.current=ze.state}let Ke=Mn.current,fo=Ke.isFirst,_a=Ke.props.adaptiveRender,Da=Ke.props.numColumns,Oa=!fo&&ze.scrollAxisGap!==Do;ze.scrollAxisGap=Do,Ke.didColumnsChange=ge!==Da||Oa;let wr=(y=(v=Ke.props.data)==null?void 0:v.length)!=null?y:0,ks=Ke.props.data!==R,Fo=Ke.props.dataKey!==D,Tr=Ke.props.dataVersion!==H,Pn=Fo||Tr||ks&&Tj(Ke,R,Ke.props.data),Pr=!fo&&Pn&&Ke.hasHadNonEmptyData&&(Fo||wr===0)&&R.length>0;Pn&&!te&&Ke.didFinishInitialScroll&&((C=Ke.initialScroll)==null?void 0:C.viewPosition)===1&&Ke.props.data.length>0&&td(Ke),Pn&&(Ke.dataChangeEpoch+=1,Ke.dataChangeNeedsScrollUpdate=!0,Ke.didDataChange=!0,Ke.previousData=Ke.props.data),Pr&&(Ke.freshDataTransitionEpoch+=1);let Qr=Yj(lt??I,Pe??0),Hi=Pe&&lt?Qr:lt,Ls=!fo&&!Pn&&((x=Ke.props.anchoredEndSpace)==null?void 0:x.anchorIndex)!==P?.anchorIndex;Ke.props={adaptiveRender:ee,alignItemsAtEnd:k,alignItemsAtEndPaddingEnabled:Bt,alwaysRender:T,alwaysRenderIndicesArr:Ps.arr,alwaysRenderIndicesSet:Ps.set,anchoredEndSpace:P,anchoredEndSpaceOwner:Zt,animatedProps:Qt,contentContainerAlignItems:on.alignItems,contentInset:M,contentInsetEndAdjustment:Ir,data:R,dataKey:D,dataVersion:H,drawDistance:W,estimatedItemSize:J,getFixedItemSize:sx(Y),getItemType:sx(U),horizontal:!!X,itemsAreEqual:fe,keyExtractor:sx(Oo),maintainScrollAtEnd:vt,maintainScrollAtEndThreshold:j,maintainVisibleContentPosition:cn,numColumns:ge,onEndReached:He,onEndReachedThreshold:Pt,onFirstVisibleItemChanged:Mt,onItemSizeChanged:ct,onLoad:ut,onMomentumScrollEnd:mt,onScroll:Hi,onScrollBeginDrag:At,onStartReached:Wt,onStartReachedThreshold:fn,onStickyHeaderChange:at,overrideItemLayout:ie,positionComponentInternal:Te,recycleItems:!!Kt,renderItem:de,rtl:re,snapToIndices:_e,stickyHeaderIndicesArr:Cn??[],stickyHeaderIndicesSet:V(()=>new Set(Cn??[]),[Cn?.join(",")]),stickyPositionComponentInternal:$e,stylePaddingBottom:En,stylePaddingLeft:Ce,stylePaddingRight:Ze,stylePaddingTop:Hn,useWindowScroll:uo},Ke.refScroller=Vr,!fo&&_a&&!ee&&wx(ze);let As=V(()=>R.length?Array.from({length:Math.min(ge,R.length)},(Ve,Rt)=>Vt(Ke,R.length-1-Rt)):[],[R,D,H,ge]),gn=Ve=>{Fe(ze,"lastItemKeys",As),Fe(ze,"numColumns",ge);let Rt=be(ze,"stylePaddingTop");Qj(ze,{stylePaddingTop:Hn}),Mn.current.props.stylePaddingBottom=En,Bi(ze);let dn=Hn-Rt;Ve&&cn.size&&dn&&Rt!==void 0&&La.OS};fo&&(gn(!1),g_(Ke),v_(ze,!0));let Ki=V(()=>{var Ve,Rt;let dn=Ke.initialScroll;if(!dn)return;let xn=(Ve=dn.contentOffset)!=null?Ve:xr(ze,dn);return Dt&&((Rt=Ke.initialScrollSession)==null?void 0:Rt.kind)==="bootstrap"&&La.OS==="web"?void 0:xn},[Dt]);xe(()=>{U4(ze,{alwaysDispatchInitialScroll:en,dataLength:R.length,hasFooterComponent:!!Se,initialContentOffset:Ki,initialScrollAtEnd:te,useBootstrapInitialScroll:Dt})},[]),(fo||Pn||Ke.didColumnsChange)&&(Mn.current.lastBatchingAction=Date.now(),!Re&&!fo&&Pn&&(Mn.current.sizes.clear(),Mn.current.positions.length=0,Mn.current.totalSize=0,Fe(ze,"totalSize",0))),No&&Ij(t),xe(()=>{Pr&&Px(ze,{resetInitialScroll:!!Tn,resetLayout:!0}),z4(ze,{dataLength:R.length,didDataChange:Pn,didStartFreshData:Pr,initialScrollAtEnd:te,latestInitialScroll:Tn,latestInitialScrollSessionKind:Kn?"offset":"bootstrap",stylePaddingEnd:_t,useBootstrapInitialScroll:Dt})},[R.length,D,Pn,Pr,te,_t,Dt]),xe(()=>{var Ve;Ls&&(Ke.scrollForNextCalculateItemsInView=void 0,(Ve=Ke.triggerCalculateItemsInView)==null||Ve.call(Ke)),cg(ze)},[ze,R,H,P?.anchorIndex,P?.anchorMaxSize,P?.anchorOffset,Ls,X,ge,re,En,Ce,Ze]),xe(()=>{let Ve=Wr.current;Wr.current=Ir,_j(ze,Ve)},[ze,Ir]);let Xr=E(Ve=>{Dt&&S4(ze,{dataLength:R.length,footerSize:Ve[X?"width":"height"],initialScrollAtEnd:te,stylePaddingEnd:_t})},[R.length,te,X,_t,Dt]),Rs=E((Ve,Rt)=>{let dn=Ke.scrollLength,xn=Ke.otherAxisSize;kj(ze,Ve,$r),cg(ze);let Ba=dn!==Ke.scrollLength||xn!==Ke.otherAxisSize;Dt&&!Rt&&Ba&&I4(ze),!Dt&&yu(ze)},[R.length,te,_t,Dt]),{onLayout:ld}=Dx({onLayoutChange:Rs,onLayoutProp:bt,ref:Vr});xe(()=>{_e&&h_(ze)},[_e]),xe(()=>gn(!0),[D,H,As.join(","),ge,Do,En,Hn,Bt]),xe(()=>{let{didColumnsChange:Ve,didDataChange:Rt,isFirst:dn,props:{data:xn}}=Ke;!(xn.length>0&&E_(ze))&&!dn&&(Rt||Ve)&&wj(ze,xn,{didColumnsChange:Ve}),Rt&&(Ke.pendingDataComparison=void 0),Ke.didColumnsChange=!1,Ke.didDataChange=!1,Ke.isFirst=!1},[R,D,H,ge,Do]),xe(()=>{var Ve;Fe(ze,"extraData",B);let Rt=jr.current!==Gr;jr.current=Gr,(Gr||Rt)&&ge>1&&((Ve=Ke.triggerCalculateItemsInView)==null||Ve.call(Ke,{forceFullItemPositions:!0}))},[B,Gr,ge]),q(()=>{if(!gt)return;let Ve,Rt=()=>{let xn={footerSize:be(ze,"footerSize")||0,headerSize:be(ze,"headerSize")||0};(!Ve||xn.headerSize!==Ve.headerSize||xn.footerSize!==Ve.footerSize)&&(Ve=xn,gt(xn))};Rt();let dn=[Pa(ze,"headerSize",Rt),Pa(ze,"footerSize",Rt)];return()=>{for(let xn of dn)xn()}},[ze,gt]),q(()=>{let Ve=W4({onViewableItemsChanged:Ht,viewabilityConfig:ht,viewabilityConfigCallbackPairs:kt});Ke.viewabilityConfigCallbackPairs=Ve,Ke.enableScrollForNextCalculateItemsInView=!0,Ve&&(Ke.scrollForNextCalculateItemsInView=void 0)},[ht,kt,Ht]),wG(()=>{}),Bo(n,()=>$j(ze,Na),[]),q(()=>()=>{CW(Ke),Ke.scheduledWork.dispose()},[Ke]),xe(()=>{var Ve;(Ve=Ke.runPendingScrollToEnd)==null||Ve.call(Ke)}),q(()=>{Dt||yu(ze)},[ze,Dt]);let po=V(()=>({getRenderedItem:Ve=>Wj(ze,Ve),onMomentumScrollEnd:Ve=>{F4(ze),Ke.props.onMomentumScrollEnd&&Ke.props.onMomentumScrollEnd(Ve)},onScroll:Ve=>Ej(ze,Ve),onScrollBeginDrag:Ve=>{var Rt,dn;sN(ze),(dn=(Rt=Ke.props).onScrollBeginDrag)==null||dn.call(Rt,Ve)},onScrollEnd:()=>sN(ze)}),[]),Fa=Fj(Cn,X,ze,po.onScroll),Xn=jt;return Me(Ha,null,Me(vj,{...tt,alignItemsAtEnd:k,canRender:Qn,contentContainerStyle:on,contentInset:M,freshDataTransitionEpoch:Ke.freshDataTransitionEpoch,getRenderedItem:po.getRenderedItem,horizontal:X,initialContentOffset:Ki,ListEmptyComponent:R.length===0?Be:void 0,ListFooterComponent:Se,ListFooterComponentStyle:Ee,ListHeaderComponent:ne,onInternalScrollBeginDrag:po.onScrollBeginDrag,onInternalScrollEnd:po.onScrollEnd,onLayout:ld,onLayoutFooter:Xr,onMomentumScrollEnd:po.onMomentumScrollEnd,onScroll:Fa,recycleItems:Kt,refreshControl:Xn?Hn>0?Ru(Xn,{progressViewOffset:((b=Xn.props.progressViewOffset)!=null?b:0)+Hn}):Xn:st&&Me(Oj,{onRefresh:st,progressViewOffset:(nn||0)+Hn,refreshing:!!yn}),refScrollView:Ts,renderScrollComponent:ae,scrollAdjustHandler:(w=Mn.current)==null?void 0:w.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:_e,stickyHeaderIndices:Cn,style:mn,useWindowScroll:uo}),No&&yW)});var e6=Jj;var M_=e6;le();le();var Ox="model:",Fx="unavailable-models:",Bx="action:",rd="pluginActions:manage";function Iu(e,t){return`${Ox}${e.length}:${e}${t}`}function Ux(e){if(!e.startsWith(Ox))return null;let t=e.slice(Ox.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 N_(e){return`${Fx}${e}`}function __(e){return e.startsWith(Fx)?e.slice(Fx.length):null}function wu(e){return`${Bx}${e}`}function D_(e){if(!e.startsWith(Bx))return null;let t=e.slice(Bx.length);return t.length>0?t:null}var O_=ye(function(t){let{t:n}=pe(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.model.subProvider,t.providerAccountEmail].filter(i=>typeof i=="string"&&i.length>0).join(" \xB7 "),a=S(Yi,{hideIndicator:!0,index:t.index,value:Iu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:K("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:[S("div",{className:"min-w-0 flex-1 text-left",children:[S("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?Yl(t.model):zC(t.model,t.preferShortName?{preferShortName:!0}:void 0)}),t.model.isUnavailable?u(Nr,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]}),t.showProvider&&S("div",{className:"mt-1 flex items-center gap-1.5",children:[u(nr,{driver:t.driver,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})]})]}),S("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(df,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,S(Qe,{children:[u(Ye,{render:u(ce,{size:"icon-xs",variant:"ghost",className:K("-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:i=>{i.stopPropagation(),t.onToggleFavorite()},onKeyDown:i=>{i.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(Ws,{className:K("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Xe,{side:"top",align:"center",children:o})]})]})]}),s=t.disabledReason??t.actionLabel;return s?S(Qe,{children:[u(Ye,{render:a}),u(Xe,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:s})]}):a});le();function t6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(nM(o))return n;let r=rM(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 n6="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",o6="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 ",r6=`${o6} text-update-foreground`,F_="left",B_=8,U_="max-w-64 text-balance font-normal leading-snug",z_=ye(function(t){let{t:n}=pe(),{t:o}=pe(),r=Et().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},s=t.showFavorites??!0,[i,l]=Q(null),d=N(null),[c,f]=Q(null);return xe(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(g=>g.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,s]),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:S("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:K(n6,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,s?S(Ie,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:S(Qe,{children:[u(Ye,{render:u("button",{className:K("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(Ws,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Xe,{side:F_,sideOffset:B_,align:"center",className:U_,children:n("modelPicker.favorites")})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!jm(p),g=t.disabledInstanceIds?.has(p.instanceId)??!1,h=m||g,v=t.selectedInstanceId===p.instanceId,y=i===p.instanceId,C=r(p.snapshot),x=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),b=m?t6(p,o):g?t.getDisabledInstanceTooltip?.(p)??p.displayName:C?`${p.displayName} \u2014 ${x}`:p.displayName,w=S("button",{className:K("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))]",h&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!h&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(k=>k===p.instanceId?null:k),onFocus:()=>l(p.instanceId),onBlur:()=>l(k=>k===p.instanceId?null:k),disabled:h,type:"button","aria-label":h?b:p.displayName,children:[u(nr,{driver:p.driverKind,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:y&&!h?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),C?u("span",{className:r6,"aria-hidden":!0,children:u(Ku,{className:"size-2.5"})}):null]}),I=h?u("span",{className:"relative block w-full",children:w}):w;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:S(Qe,{children:[u(Ye,{render:I}),S(Xe,{side:F_,sideOffset:B_,align:"center",className:U_,children:[b,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function H_(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}function K_(e){return e.instanceReady?!0:e.entry.enabled&&e.entry.driverKind==="opencode"&&e.instanceId===e.activeInstanceId&&e.option.slug===e.activeModel&&e.option.isUnavailable===!0}function to(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function a6(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let s=0;s<e.length;s+=1)if(e[s]===t[n]&&(o===-1&&(o=s),r!==-1&&(a+=s-r-1),r=s,n+=1,n===t.length)){let i=s-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+i+l}return null}function zx(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function s6(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let s=a+r.length;(o===null||s<o)&&(o=s)}return o}function Sr(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+zx(t,n);if(e.boundaryBase!==void 0){let o=s6(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+zx(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+zx(t,n)}if(e.fuzzyBase!==void 0){let o=a6(t,n);if(o!==null)return e.fuzzyBase+o}return null}function i6(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function l6(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;i6(t,a)<0?o=r:n=r+1}return n}function Ig(e,t,n){if(n<=0)return;let o=l6(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var d6=24;function c6(e){return[to(e.name),...e.shortName?[to(e.shortName)]:[],...e.subProvider?[to(e.subProvider)]:[],to(e.driverKind),to(e.providerDisplayName),...e.providerAccountEmail?[to(e.providerAccountEmail)]:[],Hx(e),...e.slug?[to(e.slug)]:[]]}function u6(e,t,n){return Sr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function Hx(e){return to([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function $_(e,t){let n=to(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 s=0;s<e.length;s+=1){let i=u6(e[s],r,s*10);i!==null&&a.push(i)}if(a.length===0)return null;o+=Math.min(...a)}return o}function q_(e,t){let n=$_(c6(e),t);return n===null?null:e.isFavorite?n-d6:n}function V_(e,t){return $_([to(e.title),to(e.description??"")],t)}function W_({top:e,bottom:t}){if(!(!e&&!t))return K("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 G_(e,t){return`${e}:${t}`}var j_=new Map,Q_=[],f6=[],p6=[];function Tu(e){return Iu(e.instanceId,e.slug)}function X_(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function m6(){return u("div",{className:"h-0.5"})}function Kx(e){return e?.trim()||null}function Y_({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 g6=ye(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=pe(),s=Kx(o.description);return S(Ie,{children:[r?u(Y_,{label:a("modelPicker.plugins")}):null,S(Yi,{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($s,{className:"size-4 shrink-0 text-muted-foreground/70"}),S("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:s})]})]})]})}),h6=ye(function({index:t,showSectionHeader:n}){let{t:o}=pe();return S(Ie,{children:[n?u(Y_,{label:o("modelPicker.plugins")}):null,S(Yi,{hideIndicator:!0,index:t,value:rd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(hd,{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")})]})]})}),J_=ye(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,hideInstanceRail:a=!1,getModelDisabledReason:s,getModelContinuationLabel:i,onContinueInModel:l,onInstanceModelChange:d,onManagePlugins:c,onSelectPluginAction:f}=t,p=t.pluginActions??Q_,m=t.selectedPluginActionKey??null,{t:g}=pe(),{t:h}=pe(),v=Et(),[y,C]=Q(""),[x,b]=Q(!1),[w,I]=Q(!1),k=N(null),P=N(null),T=N(null),L=v.environment.useActiveEnvironmentId(),A=v.settings.useClientSettings($=>$.favorites??[]),M=V(()=>L===null?p6:A.filter($=>$.environmentId===L),[L,A]),R=(o.get(t.activeInstanceId)??[]).some($=>$.slug===t.model&&$.isUnavailable===!0),[D,H]=Q(()=>t.lockedProvider!==null||R?t.activeInstanceId:M.length>0?"favorites":t.activeInstanceId),[W,F]=Q(()=>new Set),J=V(()=>n??[],[n]),O=v.settings.useUpdateClientSettings(),B=E(()=>{k.current?.focus({preventScroll:!0})},[]),Y=E($=>{H($),window.requestAnimationFrame(()=>{B()})},[B]);xe(()=>{B();let $=window.requestAnimationFrame(()=>{B()}),ae=window.setTimeout(()=>{B()},0);return()=>{window.cancelAnimationFrame($),window.clearTimeout(ae)}},[B]);let U=V(()=>new Set(M.map($=>G_($.instanceId,$.model))),[M]),X=E($=>L===null?!1:M.some(ae=>X_($,ae,L)),[L,M]),re=V(()=>new Map(r.map($=>[$.instanceId,$])),[r]),G=E($=>t.lockedProvider===null?!0:$.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?$.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),te=V(()=>{let $=new Set;for(let ae of r)jm(ae)&&$.add(ae.instanceId);return $},[r]),oe=V(()=>{let $=[];for(let[ae,de]of o){let Pe=re.get(ae);if(!Pe)continue;let _e=te.has(ae);for(let ft of de)K_({entry:Pe,instanceReady:_e,instanceId:ae,option:ft,activeInstanceId:t.activeInstanceId,activeModel:t.model})&&$.push({slug:ft.slug,name:ft.name,...ft.shortName?{shortName:ft.shortName}:{},...ft.subProvider?{subProvider:ft.subProvider}:{},...ft.isUnavailable?{isUnavailable:!0}:{},instanceId:ae,driverKind:Pe.driverKind,instanceDisplayName:Pe.displayName,...Pe.accentColor?{instanceAccentColor:Pe.accentColor}:{},...Pe.accountEmail?{instanceAccountEmail:Pe.accountEmail}:{},...Pe.continuationGroupKey?{continuationGroupKey:Pe.continuationGroupKey}:{}})}return $},[o,re,te,t.activeInstanceId,t.model]),Z=t.lockedProvider!==null,ee=y.trim().length>0,fe=V(()=>{if(!Z)return;let $=new Set;for(let ae of r)G(ae)||$.add(ae.instanceId);return $},[r,Z,G]),Re=V(()=>{let $=r.filter(iu);if(!Z)return $;let ae=[],de=[];for(let Pe of $)G(Pe)?ae.push(Pe):de.push(Pe);return[...ae,...de]},[r,Z,G]),Be=!a&&!ee&&Re.length>0,Se=V(()=>r.map($=>$.instanceId),[r]),Ee=V(()=>{let $=oe;if(y.trim()){let ae=$.map(de=>({model:de,score:q_({name:de.name,...de.shortName?{shortName:de.shortName}:{},...de.subProvider?{subProvider:de.subProvider}:{},driverKind:de.driverKind,providerDisplayName:de.instanceDisplayName,...de.instanceAccountEmail?{providerAccountEmail:de.instanceAccountEmail}:{},isFavorite:X(de)},y),isFavorite:X(de),tieBreaker:Hx({name:de.name,...de.shortName?{shortName:de.shortName}:{},...de.subProvider?{subProvider:de.subProvider}:{},driverKind:de.driverKind,providerDisplayName:de.instanceDisplayName,...de.instanceAccountEmail?{providerAccountEmail:de.instanceAccountEmail}:{}})})).filter(de=>de.score!==null);if(t.lockedProvider!==null){let de=[];for(let Pe of ae)G(Pe.model)&&de.push(Pe);return de.toSorted((Pe,_e)=>{let ft=Pe.score-_e.score;return ft!==0?ft:Pe.isFavorite!==_e.isFavorite?Pe.isFavorite?-1:1:Pe.tieBreaker.localeCompare(_e.tieBreaker)}).map(Pe=>Pe.model)}return ae.toSorted((de,Pe)=>{let _e=de.score-Pe.score;return _e!==0?_e:de.isFavorite!==Pe.isFavorite?de.isFavorite?-1:1:de.tieBreaker.localeCompare(Pe.tieBreaker)}).map(de=>de.model)}return t.lockedProvider!==null?($=$.filter(ae=>G(ae)),D==="favorites"?$=$.filter(ae=>X(ae)):$=$.filter(ae=>ae.instanceId===D)):D==="favorites"?$=$.filter(ae=>X(ae)):$=$.filter(ae=>ae.instanceId===D),v.model.sortProviderModelItems($,{favoriteModelKeys:U,groupFavorites:D!=="favorites",instanceOrder:D==="favorites"?Se:[]})},[U,oe,Se,G,t.lockedProvider,y,D,X]),ne=E(($,ae)=>v.model.resolvePickerRowAction({disabledReason:s?.($,ae)??null,continuationLabel:l?i?.($,ae)??null:null}),[i,s,l]),we=E($=>ne($.instanceId,$.slug),[ne]),j=V(()=>H_(Ee,$=>we($).kind==="blocked"),[Ee,we]),ue=V(()=>j.unavailable.length===0?null:{key:N_(D),models:j.unavailable,isExpanded:W.has(D)},[W,j,D]),ge=V(()=>[...j.current,...ue?.isExpanded?ue.models:[]],[j,ue]),ie=f!==void 0,He=V(()=>{if(!ie)return Q_;let $=y.trim();return $.length===0?p:p.map(ae=>({action:ae,score:V_(ae,$)})).filter(ae=>ae.score!==null).toSorted((ae,de)=>ae.score-de.score||ae.action.title.localeCompare(de.action.title)).map(ae=>ae.action)},[y,p,ie]),Pt=ie&&(!ee||He.length>0),ct=V(()=>Pt?[...He.map($=>wu($.id)),rd]:f6,[Pt,He]),gt=V(()=>new Map(He.map($=>[wu($.id),$])),[He]),bt=ct[0]??null,ut=E($=>{F(ae=>{let de=new Set(ae);return de.has($)?de.delete($):de.add($),de})},[]),mt=E(($,ae)=>{let de=ne(ae,$);if(de.kind==="blocked")return;if(de.kind==="continue"){l?.(ae,$);return}let Pe=o.get(ae);if(!Pe||!re.has(ae))return;let _e=v.model.resolveSelectableModel($,Pe);_e&&d(ae,_e)},[re,o,l,d,ne]),st=E($=>{let ae=__($);if(ae){ut(ae);return}if($===rd){c?.();return}let de=D_($);if(de!==null){f?.(de);return}let Pe=ge.find(ft=>Tu(ft)===$);if(!Pe||we(Pe).kind==="blocked")return;let _e=Ux($);_e&&mt(_e.slug,_e.instanceId)},[mt,c,f,ut,ge,we]),lt=E($=>{if(L===null)return;let ae=A.findIndex(Pe=>X_($,Pe,L)),de=[...A];ae>=0?de.splice(ae,1):de.push({environmentId:L,instanceId:$.instanceId,model:$.slug}),O({favorites:de})},[L,A,O]),At=V(()=>{let $=new Map,ae=0;for(let de of ge){if(ne(de.instanceId,de.slug).kind==="blocked")continue;let Pe=v.keybindings.modelPickerJumpCommandForIndex(ae);if(!Pe)return $;$.set(Tu(de),Pe),ae+=1}return $},[ne,ge]),Wt=V(()=>[...At.keys()],[At]),fn=V(()=>[...oe.map($=>Tu($)),...ue?[ue.key]:[],...ie?[...p.map($=>wu($.id)),rd]:[]],[oe,p,ie,ue]),at=V(()=>{let $=ge.map(ae=>Tu(ae));return ue&&$.splice(j.current.length,0,ue.key),ct.length>0?[...$,...ct]:$},[ue,j,ct,ge]),Mt=V(()=>new Map(ge.map($=>[Tu($),$])),[ge]),Ht=E(()=>{let $=P.current?.getScrollableNode();if(!($ instanceof HTMLElement))return;let ae=Math.max(0,$.scrollHeight-$.clientHeight);b($.scrollTop>1),I(ae-$.scrollTop>1)},[]),nn=V(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Kt=V(()=>{if(At.size===0)return j_;let $={platform:navigator.platform,context:nn},ae=new Map;for(let[de,Pe]of At){let _e=v.keybindings.shortcutLabelForCommand(J,Pe,$);_e&&ae.set(de,_e)}return ae.size>0?ae:j_},[J,At,nn]),jt=m===null?Iu(t.activeInstanceId,t.model):wu(m),yn=V(()=>({favoritesSet:U,modelJumpLabelByKey:Kt,selectedItemKey:jt}),[U,Kt,jt]);return v.pane.useKeydown($=>{if($.defaultPrevented||$.repeat)return;let ae=v.keybindings.resolveShortcutCommand($,J,{platform:navigator.platform,context:nn}),de=v.keybindings.modelPickerJumpIndexFromCommand(ae??"");if(de===null)return;let Pe=Wt[de];if(!Pe)return;let _e=Ux(Pe);_e&&($.preventDefault(),$.stopPropagation(),mt(_e.slug,_e.instanceId))},{capture:!0}),xe(()=>{b(!1),I(at.length>5);let $=0,ae=window.requestAnimationFrame(()=>{Ht(),$=window.requestAnimationFrame(Ht)});return()=>{window.cancelAnimationFrame(ae),window.cancelAnimationFrame($)}},[at,Ht]),u(lS,{delay:0,children:S("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:[Be&&u(z_,{selectedInstanceId:D,onSelectInstance:Y,instanceEntries:Re,showFavorites:!0,...fe?{disabledInstanceIds:fe,getDisabledInstanceTooltip:$=>h("instance.lockedToThread",{name:$.displayName})}:{}}),u(rS,{inline:!0,items:fn,filteredItems:at,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:jt,onItemHighlighted:($,ae)=>{T.current=typeof $=="string"?$:null,ae.reason==="keyboard"&&ae.index>=0&&P.current?.scrollIndexIntoView?.({index:ae.index,animated:!1})},onValueChange:$=>{typeof $=="string"&&st($)},children:S("div",{className:K("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",Be&&"border-l border-border/70"),children:[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(sS,{ref:k,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:g("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(Vs,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:y,onChange:$=>C($.target.value),onKeyDown:$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),t.onRequestClose?.();return}if($.key==="Enter"&&T.current){$.preventBaseUIHandler?.(),$.preventDefault(),$.stopPropagation(),st(T.current);return}$.stopPropagation()},onMouseDown:$=>$.stopPropagation(),onTouchStart:$=>$.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(iS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(M_,{ref:P,data:at,extraData:yn,keyExtractor:$=>$,renderItem:({item:$,index:ae})=>{let de=ue?.key===$?{label:g("modelPicker.unavailableModels"),count:ue.models.length,isExpanded:ue.isExpanded}:null;if(de)return S(Yi,{hideIndicator:!0,index:ae,value:$,"aria-expanded":de.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[S("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:de.label}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:g("modelPicker.modelCount",{count:de.count})})]}),u(Io,{className:K("size-4 transition-transform",de.isExpanded&&"rotate-90")})]});let Pe=gt.get($);if(Pe)return u(g6,{index:ae,itemKey:$,action:Pe,showSectionHeader:$===bt});if($===rd)return u(h6,{index:ae,showSectionHeader:$===bt});let _e=Mt.get($);if(!_e)return null;let ft=we(_e);return u(O_,{index:ae,model:_e,instanceId:_e.instanceId,driver:_e.driverKind,providerDisplayName:_e.instanceDisplayName,providerAccentColor:_e.instanceAccentColor,providerAccountEmail:_e.instanceAccountEmail,isFavorite:X(_e),isSelected:$===jt,showProvider:!0,preferShortName:!Z,useTriggerLabel:!1,jumpLabel:Kt.get($)??null,disabledReason:ft.kind==="blocked"?ft.reason:null,actionLabel:ft.kind==="continue"?ft.label:null,onToggleFavorite:()=>lt(_e)},$)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:m6,onLayout:Ht,onScroll:Ht,className:K("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",W_({top:x,bottom:w}))})})}),u(aS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:g("modelPicker.noModelsFound")})]})})]})})});function v6(e){let t=e.unknownModelLabel?.trim();if(t)return t;let n=e.catalogOptions.find(o=>o.slug===e.model);return n?Yl(n):e.model}var $x=ye(function(t){let{t:n}=pe(),[o,r]=Q(!1),s=Ar()&&(t.open??o),i=V(()=>t.instanceEntries.find(b=>b.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=Xm(t.modelStatus??"known"),f=v6({model:t.model,catalogOptions:d,unknownModelLabel:c?n(c.seatKey):null}),p=c===null&&d.some(b=>b.slug===t.model&&b.isUnavailable===!0),m=b=>{t.onOpenChange?.(b),t.open===void 0&&r(b)};q(()=>{if(!s)return;let{documentElement:b,body:w}=document,I=b.style.overscrollBehavior,k=w.style.overflow,P=w.style.paddingRight,T=window.innerWidth-b.clientWidth;b.style.overscrollBehavior="contain",w.style.overflow="hidden",T>0&&(w.style.paddingRight=`${T}px`);let L=R=>R instanceof Element&&R.closest("[data-model-picker-content]"),A=R=>{L(R.target)||R.preventDefault()},M=R=>{L(R.target)||R.preventDefault()};return document.addEventListener("wheel",A,{capture:!0,passive:!1}),document.addEventListener("touchmove",M,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",A,{capture:!0}),document.removeEventListener("touchmove",M,{capture:!0}),b.style.overscrollBehavior=I,w.style.overflow=k,w.style.paddingRight=P}},[s]);let g=(b,w)=>{t.disabled||(t.onInstanceModelChange(b,w),m(!1))},h=(b,w)=>{t.disabled||(t.onContinueInModel?.(b,w),m(!1))},v=b=>{t.disabled||(t.onSelectPluginAction?.(b),m(!1))},y=()=>{t.onManagePlugins?.(),m(!1)},C=t.selectedPluginActionKey==null?null:t.pluginActions?.find(b=>b.id===t.selectedPluginActionKey)??null,x=C?Kx(C.description):null;return S(Qa,{open:s,onOpenChange:b=>{if(t.disabled){m(!1);return}m(b)},children:[S(Ya,{render:u(Eo,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:K("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:C?S(Ie,{children:[u($s,{className:"size-4 shrink-0"}),S(Qe,{children:[S(Ye,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:C.title}),x?S("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",x]}):null]}),u(Xe,{side:"top",children:x?`${C.title} \xB7 ${x}`:C.title})]})]}):S(Ie,{children:[t.showInstanceOnTrigger!==!1&&i?u(nr,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:K("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,S(Qe,{children:[u(Ye,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:f}),u(Xe,{side:"top",children:p?n("modelPicker.unavailableLabel",{name:f}):f})]}),p?u(Nr,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(Hr,{})})]}),u(Xa,{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(J_,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.hideInstanceRail?{hideInstanceRail:!0}:{},...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>m(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:g,...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:v}:{},...t.onManagePlugins?{onManagePlugins:y}:{}})})]})});function Z_(e){let{slots:t,...n}=e,o=u($x,{...n,hideInstanceRail:!0,showInstanceOnTrigger:!1}),r=t?.renderSlot("conversation.input.model",n,o);return u("span",{"data-conversation-slot":"conversation.input.model",children:r??o})}function eD(e){return u($x,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}le();function tD(e){return e.description??e.name}var nD=ye(function(t){let{t:n}=pe(),{current:o,modes:r}=t.nativeMode,a=tD(o);return!t.canSwitch||r.length<2?S(Qe,{children:[S(Ye,{render:u(Eo,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Mo,{icon:Gi}),u("span",{children:o.name})]}),S(Xe,{side:"top",children:[u("span",{className:"block font-medium",children:a}),r.length>1?u("span",{className:"mt-1 block text-muted-foreground text-xs",children:n("composer.agentModesList",{modes:r.map(s=>s.name).join(", ")})}):null]})]}):S(Ie,{children:[S(Qe,{children:[S($u,{value:o.id,onValueChange:s=>t.onNativeModeChange(s),children:[S(Ye,{render:u(Qm,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Mo,{icon:Gi}),u(Wu,{children:o.name})]}),S(Vu,{alignItemWithTrigger:!1,children:[r.map(s=>u(qu,{value:s.id,hideIndicator:!0,className:"min-w-56 py-2",children:S("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:s.name}),s.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:s.description}):null]})},s.id)),t.appliesNextTurn?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Xe,{side:"top",children:t.appliesNextTurn?`${a} ${n("runtimeMode.appliesNextTurnHint")}`:a})]}),t.appliesNextTurn?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:n("runtimeMode.appliesNextTurn")}):null]})});function qx(e){let{t}=pe(),n=Vm();if(e.nativeMode)return u(nD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let o=n(e.runtimeMode),r=o.icon,a=e.runtimeModeSwitch==="next-turn";return S(Ie,{children:[S(Qe,{children:[S($u,{value:e.runtimeMode,onValueChange:s=>e.onRuntimeModeChange(s),children:[S(Ye,{render:u(Qm,{"data-composer-permission":"true","data-composer-runtime-mode-switch":e.runtimeModeSwitch,className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[u(Mo,{icon:r}),u(Wu,{children:o.label})]}),S(Vu,{alignItemWithTrigger:!1,children:[Cr.map(s=>{let i=n(s),l=i.icon;return u(qu,{value:s,hideIndicator:!0,className:"min-w-64 py-2",children:S("span",{className:"flex items-center gap-2",children:[u(l,{className:"size-4"}),i.label]})},s)}),a?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:t("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Xe,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):o.label})]}),a?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:t("runtimeMode.appliesNextTurn")}):null]})}function oD(e){return u(qx,{...e})}function Vx(e){let{t}=pe();if(!e.showInteractionModeToggle)return null;let n=e.interactionMode==="plan",o=t(n?"composer.planModeTooltip":"composer.defaultModeTooltip");return S(Qe,{children:[S(Ye,{render:u(Eo,{"data-composer-plan-toggle":"true",className:K("shrink-0 whitespace-nowrap",n?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":o}),children:[n?u(Mo,{icon:_d,className:"text-current opacity-100"}):u(Mo,{icon:Ns,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t(n?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),u(Xe,{side:"top",children:o})]})}function rD(e){return u(Vx,{...e})}le();var y6=(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"),C6=e=>{e.preventDefault()},ad=ye(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:s,sendDisabledReason:i,isEnvironmentUnavailable:l,isPreparingWorktree:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:f=!1,showSendWhileRunning:p=!1,onPreviousPendingQuestion:m,onInterrupt:g,interruptArmed:h=!1,onImplementPlanInNewThread:v,shellCommandMode:y=!1,shellCommandUnavailableReason:C=null}){let{t:x}=pe(),b=Et(),w=f?{onPointerDown:C6}:void 0,I=b.settings.useEnvironmentIdentificationMode(),k=i!==null,P=b.devBackdrop.useVisible(I==="artwork"),T=A=>u("button",{type:"button",className:K("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",h?"h-8 px-3 text-xs font-medium whitespace-nowrap ring-2 ring-destructive/60":A?"size-8 sm:size-7":p&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...w,onClick:g,"data-interrupt-armed":h?"":void 0,"aria-label":x(h?"primaryActions.confirmStopEsc":"primaryActions.stopGeneration"),children:h?x("primaryActions.confirmStopEsc"):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 S("div",{className:K("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?T(!0):null,n.questionIndex>0?t?u(ce,{size:"icon-sm",variant:"outline",className:"rounded-full",...w,onClick:m,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(_s,{})}):u(ce,{size:"sm",variant:"outline",className:"rounded-full",...w,onClick:m,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(ce,{type:"submit",size:"sm",className:K("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...w,disabled:l||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:y6(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(y){let A=u("button",{type:"submit","data-shell-command-run":"true",className:"flex h-9 w-9 items-center justify-center rounded-full bg-message-action text-message-action-foreground shadow-xs shadow-message-action/24 transition-[background-color,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 hover:bg-message-action-hover 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",...w,disabled:C!==null||!c,"aria-label":C??x("primaryActions.runInTerminal"),children:u(wo,{"aria-hidden":"true",className:"size-4"})});return o?S(Ie,{children:[T(!1),A]}):A}if(r)return a?u(ce,{type:"submit",size:"sm",className:K("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"),...w,disabled:s||k||l,children:x(s?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):S("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ce,{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",...w,disabled:s||k||l,children:x(s?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),S(go,{children:[u(vo,{render:u(ce,{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"),...w,disabled:s||k||l}),children:u(tn,{})}),u(ho,{align:"end",side:"top",children:u(Ho,{disabled:s||k||l,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let L=S("button",{type:"submit",className:K("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",P?"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"),...w,disabled:s||k||l||!c,"aria-label":l?x("primaryActions.environmentDisconnected"):i||x(d?"primaryActions.preparingWorktree":s?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[P?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(cS,{compact:!0})}):null,s?u(Ku,{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?S(Ie,{children:[T(!1),p&&c?L:null]}):L});function Pu(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return u("span",{"data-conversation-slot":e.name,children:t??e.fallback})}function Ea(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 x6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function aD(e){let{t}=pe(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:s,compactDisabledReason:i}=e,l=x6(n.usedPercentage),d=Math.max(0,Math.min(100,n.usedPercentage??0)),c=9.75,f=2*Math.PI*c,p=f*(1-d/100),m=n.totalProcessedTokens??null,g=m!==null&&m>0,v=d>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return S(Qa,{children:[u(Ya,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(ce,{size:"icon-sm",variant:"ghost-muted","data-context-window-meter":"true",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&l?t("contextWindow.usedPercentAria",{percentage:l}):t("contextWindow.usedTokensAria",{tokens:Ea(n.usedTokens)}),children:u("span",{className:"relative flex size-5 items-center justify-center",children:S("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:c,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:v,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:f,strokeDashoffset:p})]})})})}),u(Xa,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:S("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[S("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&&l?S("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:l}),u("span",{className:"mx-1",children:"\xB7"}),S("span",{children:[Ea(n.usedTokens),"/",Ea(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:Ea(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(d),"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:`${d}%`,backgroundColor:v}})}):null,o?S("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[S("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"system",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.system")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Ea(o.systemTokens)})]}),S("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"tools",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Ea(o.toolsTokens)})]}),S("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"messages",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Ea(o.messageTokens)})]})]}):null,g?S("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:Ea(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:dM(t,r,n.autoCompactThreshold)}):null,a?S(Ie,{children:[S(ce,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:s,onClick:a,children:[u(Md,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),s&&i?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:i}):null]}):null]})})]})}le();var sD=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,i={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,i);return i},iD=(e=>e?sD(e):sD);le();var b6=e=>e;function S6(e,t=b6){let n=un.useSyncExternalStore(e.subscribe,un.useCallback(()=>t(e.getState()),[e,t]),un.useCallback(()=>t(e.getInitialState()),[e,t]));return un.useDebugValue(n),n}var lD=e=>{let t=iD(e),n=o=>S6(t,o);return Object.assign(n,t),n},dD=(e=>e?lD(e):lD);var Wx=dD(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 cD(e){return Wx(t=>e===null?null:t.presetIdByDraftId[e]??null)}function Gx(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var jx="__none__",uD=ye(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=pe(),s=Et().presets.useThreadPresets(t),i=cD(n),l=Wx(c=>c.setDraftPresetId);if(n===null){let f=Gx(s,o)?.displayName??o;return f===null?null:S(Eo,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(Mo,{icon:oa}),u("span",{className:"min-w-0 truncate",children:f})]})}if(s.length===0)return null;let d=Gx(s,i);return S(go,{children:[u(vo,{render:u(Eo,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:S("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(Mo,{icon:oa}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(Hr,{})]})}),u(ho,{align:"start",children:S(Xi,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),S(or,{value:i??jx,onValueChange:c=>{l(n,c===jx?null:c)},children:[u(To,{value:jx,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),s.map(c=>u(To,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:S("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))]})]})})]})});var I6=ye(function(t){let{data:n,target:o}=$o(),r=n.useContextUsage(o);return r?.window==null?null:u(aD,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),w6=ye(function(t){let{t:n}=pe();return S(Ie,{children:[u(I6,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:n("composer.preparingWorktree")}):null,u(ad,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})});function fD(e){let{t}=pe(),{isComposerFooterCompact:n,isComposerPrimaryActionsCompact:o,isMobileViewport:r,showMobilePendingAnswerActions:a,hasPendingUserInputs:s,projectSelectionRequired:i,noProviderAvailable:l,composerAttachmentInputRef:d,onComposerAttachmentInputChange:c,slots:f,selectedInstanceId:p,unavailableAgentInstanceId:m,agentNotChosen:g,agentUnavailable:h,providerInstanceEntries:v,lockedProvider:y,lockedContinuationGroupKey:C,onAgentInstanceChange:x,selectedModelForPickerWithCustomFallback:b,selectedModelStatus:w,keybindings:I,modelOptionsByInstance:k,terminalOpen:P,isComposerModelPickerOpen:T,setIsComposerModelPickerOpen:L,getModelDisabledReason:A,getModelContinuationLabel:M,onContinueInModel:R,onProviderModelSelect:D,canSelectPluginAction:H,pluginOptions:W,selectedPluginAction:F,onSelectPluginAction:J,onManagePlugins:O,isPluginComposer:B,environmentId:Y,routeKind:U,draftId:X,activeThread:re,interactionMode:G,runtimeMode:te,composerProviderControls:oe,composerNativeMode:Z,canSwitchNativeMode:ee,providerTraitsMenuContent:fe,providerTraitsPicker:Re,toggleInteractionMode:Be,handleRuntimeModeChange:Se,handleComposerNativeModeChange:Ee,inlineTasksBadge:ne,inlineStashBadge:we,activeThreadModelDisplayName:j,pendingPrimaryAction:ue,phase:ge,showPlanFollowUpPrompt:ie,composerDraft:He,isSendBusy:Pt,sendDisabledReason:ct,environmentUnavailable:gt,isPreparingWorktree:bt,previousUserInputQuestion:ut,handleInterruptPrimaryAction:mt,interruptArmed:st,handleImplementPlanInNewThreadPrimaryAction:lt,shellCommandMode:At,shellCommandUnavailableReason:Wt,compactDisabled:fn,resolvedCompactDisabledReason:at,compactThreadContext:Mt}=e;return S("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":n?"true":"false",className:K("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s&&"pt-2",n?"gap-1.5":"gap-2 sm:gap-0",a&&"hidden sm:flex"),children:[S("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:d,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:c}),S(Qe,{children:[u(Ye,{render:u(ce,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:i||s,"aria-label":t("attachments.add"),onClick:()=>d.current?.click()}),children:u(no,{})}),u(Xe,{side:"top",children:t("attachments.add")})]}),l?S(ce,{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(hn,{className:"size-4"}),t("composer.noProviderAvailable")]}):S(Ie,{children:[u(Pu,{name:"conversation.input.agent",...f===void 0?{}:{slots:f},owner:{activeInstanceId:p,unavailableInstanceId:m,notChosen:g,instanceEntries:v,lockedProvider:y,lockedContinuationGroupKey:C,compact:n,onInstanceChange:x},fallback:u($C,{activeInstanceId:p,unavailableInstanceId:m,notChosen:g,instanceEntries:v,lockedProvider:y,lockedContinuationGroupKey:C,compact:n,onInstanceChange:x})}),h||g?null:u(Z_,{...f===void 0?{}:{slots:f},compact:n,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:p,model:b,modelStatus:w,lockedProvider:y,lockedContinuationGroupKey:C,instanceEntries:v,keybindings:I,modelOptionsByInstance:k,terminalOpen:P,open:T,onOpenChange:Ht=>{L(Ht)},getModelDisabledReason:A,getModelContinuationLabel:M,onContinueInModel:R,onInstanceModelChange:D,...H?{pluginActions:W,selectedPluginActionKey:F?.id??null,onSelectPluginAction:J,onManagePlugins:O}:{}})]}),B?null:S(Ie,{children:[u(uD,{environmentId:Y,draftId:U==="draft"?X:null,threadPresetId:re?.presetId??null,compact:n}),n?u(QM,{interactionMode:G,runtimeMode:te,runtimeModeSwitch:oe.runtimeModeSwitch,nativeMode:Z,canSwitchNativeMode:ee,showInteractionModeToggle:oe.showInteractionModeToggle,traitsMenuContent:fe,onToggleInteractionMode:Be,onRuntimeModeChange:Se,onNativeModeChange:Ee}):S(Ie,{children:[Re?u(Pu,{name:"conversation.input.effort",...f===void 0?{}:{slots:f},fallback:Re}):null,Z===null&&oe.showInteractionModeToggle?u(Pu,{name:"conversation.input.plan",...f===void 0?{}:{slots:f},owner:{interactionMode:G,showInteractionModeToggle:oe.showInteractionModeToggle,onToggleInteractionMode:Be},fallback:u(Vx,{interactionMode:G,showInteractionModeToggle:oe.showInteractionModeToggle,onToggleInteractionMode:Be})}):null,u(Pu,{name:"conversation.input.permission",...f===void 0?{}:{slots:f},owner:{runtimeMode:te,runtimeModeSwitch:oe.runtimeModeSwitch,nativeMode:Z,canSwitchNativeMode:ee,onRuntimeModeChange:Se,onNativeModeChange:Ee},fallback:u(qx,{runtimeMode:te,runtimeModeSwitch:oe.runtimeModeSwitch,nativeMode:Z,canSwitchNativeMode:ee,onRuntimeModeChange:Se,onNativeModeChange:Ee})})]})]})]}),S("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":o?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[a?null:ne,a?null:we,u(w6,{compact:o,activeThreadModelDisplayName:j,pendingAction:ue,isRunning:ge==="running",showPlanFollowUpPrompt:!s&&ie,promptHasText:He.promptHasText,isSendBusy:Pt,sendDisabledReason:ct,isEnvironmentUnavailable:gt!==null||l||i,isPreparingWorktree:bt,hasSendableContent:He.hasSendableContent,preserveComposerFocusOnPointerDown:r,showSendWhileRunning:r,onPreviousPendingQuestion:ut,onInterrupt:mt,interruptArmed:st,onImplementPlanInNewThread:lt,shellCommandMode:At,shellCommandUnavailableReason:Wt,compactDisabled:fn||l||Pt,compactDisabledReason:at,onCompactContext:Mt})]})]})}var T6=e=>e.prompt.trim();function P6(e){let{t}=pe(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,T6),o=e.pendingCustomAnswer!==null;return u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(o?e.pendingCustomAnswer:n)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:o?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):n||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}function pD(e){let{api:t,composerDraftTarget:n,pendingCustomAnswer:o,noProviderAvailable:r,onExpand:a,inlineTasksBadge:s,inlineStashBadge:i,submitDisabled:l,submitLabel:d,onSubmit:c}=e;return S("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u(P6,{api:t,composerDraftTarget:n,pendingCustomAnswer:o,noProviderAvailable:r,onExpand:a}),s,i,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:l,"aria-label":d,onPointerDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),c()},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"})})})]})}le();le();var mD={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},gD=ye(function(t){let{t:n}=pe(),o=N(null);return xe(()=>{if(!t.activeItemId||!o.current)return;o.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(cf,{autoHighlight:!1,mode:"none",onItemHighlighted:r=>{t.onHighlightedItemChange(typeof r=="string"?r:null)},children:u("div",{ref:o,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(pf,{className:"max-h-72 scroll-pb-6",children:u(uf,{children:t.items.map((r,a)=>u(k6,{sectionTitle:r.section!==void 0&&t.items[a-1]?.section!==r.section?r.section:null,item:r,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===r.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},r.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"?n("composer.searchingSkills"):n("composer.searchingFiles"):t.emptyStateText??(t.triggerKind==="skill"?n("composer.noSkillsFound"):t.triggerKind==="path"?n("composer.noMatchingFiles"):n("composer.noMatchingCommand"))})})})})}),k6=ye(function(t){let{t:n}=pe(),o=t.item.type==="skill"?OR(t.item.skill):null,r=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return S(Ie,{children:[t.sectionTitle!==null?u("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:n(mD[t.sectionTitle]??mD.recent)}):null,S(ff,{value:t.item.id,"data-composer-item-id":t.item.id,className:K("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:a=>{a.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Am,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,S("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:r?S(Ie,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),Zo(r)]}):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}),o?u(R6,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),L6={app:yd,repo:qa,project:qa,personal:Mr,system:Fd,other:Nd},A6={app:"slashMenu.skillSource.app",repo:"slashMenu.skillSource.repo",project:"slashMenu.skillSource.project",personal:"slashMenu.skillSource.personal",system:"slashMenu.skillSource.system",other:"slashMenu.skillSource.other"};function R6(e){let{t}=pe(),n=L6[e.kind],o=t(A6[e.kind]);return S(Nr,{className:"ms-auto",variant:"secondary",children:[u(n,{"aria-hidden":"true",className:"text-current"}),e.showSkillSuffix?t("slashMenu.skillSourceWithSuffix",{source:o}):o]})}le();function E6(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function hD(e,t){let n=E6(e);if(!n)return"";let o=Date.now()-n.getTime();if(o<0)return t("relativeTime.justNow");let r=Math.floor(o/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let s=Math.floor(a/60);return s<24?t("relativeTime.hoursAgo",{count:s}):t("relativeTime.daysAgo",{count:Math.floor(s/24)})}var vD=90;function yD(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function M6(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>vD?`${n.slice(0,vD)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var CD=ye(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:s}=pe(),i=Et(),l=N(null),[d,c]=Q(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return q(()=>{let p=m=>{let g=l.current;g&&m.composedPath().includes(g)||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]),i.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(y=>y.id===d),g=p.key==="ArrowDown"?1:-1,v=((m>=0?m:g===1?-1:0)+g+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(cf,{autoHighlight:!1,mode:"none",children:S("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(ce,{variant:"ghost-muted",size:"icon-micro","aria-label":s("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(Xt,{className:"size-3"})})}),u(pf,{className:"max-h-64 scroll-pb-6",children:u(uf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:s("stash.empty")}):n.map(p=>S(ff,{value:p.id,className:K("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:M6(p,s)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:s("stash.savingImage",{count:p.pendingImageCount})}):yD(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:s("stash.imagesDropped",{count:yD(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:hD(p.createdAt,s)}),u(ce,{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":s("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(Xt,{className:"stroke-2"})})]},p.id))})})]})})});le();function Qx(e,t){let n=e.name.toLowerCase(),o=Zo(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",s=e.scope?.toLowerCase()??"",i=[Sr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Sr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Sr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Sr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Sr({value:s,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return i.length===0?null:Math.min(...i)}function xD(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(SC),r=to(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let s of o){let i=Qx(s,r);i!==null&&Ig(a,{item:s,score:i,tieBreaker:`${Zo(s).toLowerCase()}\0${s.name}`},n)}return a.map(s=>s.item)}function N6(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,s=a?Qx(e.skill,a):0;return s!==null?s:"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=[Sr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Sr({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 bD(e,t,n=[]){let o=to(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let s=N6(a,o);if(s===null)continue;let i=n.includes(a.id)?s-1:s;Ig(r,{item:a,score:i,tieBreaker:a.type==="slash-command"?`0\0${a.command}`:a.type==="provider-slash-command"?`1\0${a.command.name}\0${a.provider}`:`2\0${a.skill.name}\0${a.provider}`},Number.POSITIVE_INFINITY)}return r.map(a=>a.item)}function SD(e,t){let n=new Map(e.map(i=>[i.id,i])),o=t.map(i=>n.get(i)).filter(i=>i!==void 0).slice(0,3).map(i=>({...i,section:"recent"})),r=new Set(o.map(i=>i.id)),a=e.filter(i=>!r.has(i.id)),s=i=>i.type==="slash-command"?"builtIn":i.type==="provider-slash-command"?"provider":"skills";return[...o,...a.map(i=>({...i,section:s(i)}))]}function Xx(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}var ID=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t;function wg(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function wD({prompt:e,selectedProvider:t,selectedProviderStatus:n,planModeUiEnabled:o,showSkillsInSlashMenu:r,recentSlashCommandIds:a,environmentId:s,gitCwd:i,useComposerPathSearch:l,readComposerSnapshot:d,applyPromptReplacement:c,onInteractionModeChange:f,onOpenModelPicker:p,onSlashCommandUsed:m}){let{t:g}=pe(),[h,v]=Q(()=>xo(e,e.length)),[y,C]=Q(null),[x,b]=Q(null),[w,I]=Q(null),k=y!==null&&wg(h)===y?null:h,P=k?.kind==="path"?k.query:"",T=k?.kind==="path",L=l({environmentId:s,cwd:T?i:null,query:T?P:null}),A=V(()=>{if(!k)return[];if(k.kind==="path")return L.entries.map(Y=>({id:`path:${Y.kind}:${Y.path}`,type:"path",path:Y.path,pathKind:Y.kind,label:_6(Y.path),description:Y.path.slice(0,Math.max(0,Y.path.lastIndexOf("/")))}));if(k.kind==="slash-command"){let Y=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:g("composer.switchModelDesc")},...o?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:g("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:g("composer.defaultDesc")}]:[]],U=_R(n?.skills??[],r),X=DR(n?.slashCommands??[],n?.skills??[]).map(oe=>({id:`provider-slash-command:${t}:${oe.name}`,type:"provider-slash-command",provider:t,command:oe,label:`/${oe.name}`,description:oe.description??oe.input?.hint??g("composer.runProviderCommand")})),re=k.query.trim().toLowerCase(),G=U.map(oe=>({id:`skill:${t}:${oe.name}`,type:"skill",provider:t,skill:oe,label:`/skill:${oe.name}`,description:oe.shortDescription??oe.description??(oe.scope?g("composer.skillScopeDescription",{scope:oe.scope}):"")})),te=[...Y,...X,...G];return re===""?SD(te,a):bD(te,re,a)}return k.kind==="skill"?xD(n?.skills??[],k.query).map(Y=>({id:`skill:${t}:${Y.name}`,type:"skill",provider:t,skill:Y,label:Zo(Y),description:Y.shortDescription??Y.description??(Y.scope?g("composer.skillScopeDescription",{scope:Y.scope}):g("composer.runProviderSkill"))})):[]},[k,o,a,t,n,r,g,L.entries]),M=!!k,R=k?`${k.kind}:${k.query.trim().toLowerCase()}`:null,D=V(()=>{let Y=Xx({items:A,highlightedItemId:x,currentSearchKey:R,highlightedSearchKey:w});return A.find(U=>U.id===Y)??null},[A,x,R,w]),H=E(()=>{let Y=d(),U=xo(Y.value,Y.expandedCursor),X=y!==null&&wg(U)===y?null:U;return{snapshot:Y,trigger:X}},[d,y]),W=E(Y=>{let{snapshot:U,trigger:X}=H();if(!X)return;if((Y.type==="slash-command"||Y.type==="provider-slash-command"||Y.type==="skill")&&m?.(Y.id),Y.type==="path"){let oe=`${Ti(Y.path)} `,Z=ID(U.value,X.rangeEnd,oe);c(X.rangeStart,Z,oe,{expectedText:U.value.slice(X.rangeStart,Z)})&&b(null);return}if(Y.type==="slash-command"){if(Y.command==="model"){c(X.rangeStart,X.rangeEnd,"",{expectedText:U.value.slice(X.rangeStart,X.rangeEnd),focusEditorAfterReplace:!1})&&(b(null),p());return}f(Y.command==="plan"?"plan":"default"),c(X.rangeStart,X.rangeEnd,"",{expectedText:U.value.slice(X.rangeStart,X.rangeEnd)})&&b(null);return}let re=Y.type==="provider-slash-command"?`/${Y.command.name} `:`$${Y.skill.name} `,G=ID(U.value,X.rangeEnd,re);c(X.rangeStart,G,re,{expectedText:U.value.slice(X.rangeStart,G)})&&b(null)},[c,f,p,m,H]);q(()=>{if(!M){b(null),I(null);return}let Y=Xx({items:A,highlightedItemId:x,currentSearchKey:R,highlightedSearchKey:w});b(U=>U===Y?U:Y),I(U=>U===R?U:R)},[x,w,A,M,R]);let F=E(Y=>{b(Y),I(R)},[R]),J=E(()=>{let{trigger:Y}=H();return Y===null?!1:(C(wg(Y)),b(null),!0)},[H]),O=E((Y,U)=>{let X=Ro(Y,U),re=xo(Y,X);v(re);let G=wg(re);C(te=>te!==null&&te!==G?null:te),b(null),I(null)},[]),B=E(()=>{b(null)},[]);return{composerTrigger:h,menuTrigger:k,composerMenuItems:A,composerMenuOpen:M,composerMenuSearchKey:R,activeComposerMenuItem:D,resolveActiveComposerTrigger:H,onSelectComposerItem:W,onComposerMenuItemHighlighted:F,onMenuEscape:J,resetForDocumentChange:O,dismissTrigger:B,workspaceEntries:L,highlightedItemId:x,setTrigger:v,setHighlightedItemId:b,setHighlightedSearchKey:I}}function _6(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function D6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function TD(e){let t=Et(),n=Mu(),o=t.pane.useActive(),[r,a]=Q(null);return xe(()=>{if(!o)return;let s=e.anchor;if(!s){a(null);return}let i=!0,l=()=>{if(!i)return;let c=s.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??s).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(c??s).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,y={bottom:window.innerHeight-p.top-v,left:p.left+h,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-h*2),overlap:v};a(C=>C&&D6(C,y)?C:y)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(s);for(let c=s.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{i=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:n,"data-composer-drawer-layer":"true",style:{position:"fixed",zIndex:45,pointerEvents:"auto",clipPath:`inset(0 0 ${r.overlap}px 0)`,bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var O6=[],F6=[],B6=e=>e.prompt,U6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},z6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),PD=ye(function(t){let{handleRef:n,api:o,composerDraftTarget:r,composerDocumentKey:a,promptRef:s,editorRef:i,menuAnchor:l,resolvedTheme:d,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,onSlashCommandUsed:y,onOpenModelPicker:C,onInteractionModeChange:x,onToggleInteractionMode:b,activePendingProgress:w,activePendingRequestId:I,hasPendingUserInputs:k,changeUserInputCustomAnswer:P,terminalContexts:T,showTerminalContexts:L,showEditor:A,isApprovalState:M,editorClassName:R,placeholder:D,disabled:H,onPaste:W,onSubmit:F,isMobileViewport:J,isDraftRoute:O,stashMenuOpen:B,stashEntries:Y,onRestoreStashEntry:U,onDeleteStashEntry:X,onCloseStashMenu:re,onPromptEdited:G,onUnclaimedEscape:te}=t,{t:oe}=pe(),Z=o.draft.useThreadDraftSelector(r,B6),ee=o.draft.useStore,fe=ee(Te=>Te.setPrompt),Re=ee(Te=>Te.setTerminalContexts),Be=ee(Te=>Te.removeTerminalContext),Se=lo(Z,Z.length),Ee=Ia(a,Z,{cursor:Se,expandedCursor:Z.length}),[ne,we]=Q(()=>({documentKey:a,cursor:Ee.cursor})),j=ne.documentKey===a?ne.cursor:Ee.cursor,ue=E(Te=>{we($e=>{let qe=$e.documentKey===a?$e.cursor:Ia(a,s.current).cursor,ot=typeof Te=="function"?Te(qe):Te,rt=s.current,tt=Ro(rt,ot);return UR(a,rt,ot,tt),$e.documentKey===a&&$e.cursor===ot?$e:{documentKey:a,cursor:ot}})},[a,s]),ge=N(!1),ie=N(!1),He=N([]),Pt=N(null),ct=E(Te=>{fe(r,Te)},[r,fe]),gt=E((Te,$e,qe,ot,rt)=>{P(Te,$e,qe,ot,rt),s.current=$e},[P,s]),bt=E((Te,$e,qe,ot)=>{let rt=s.current,tt=Math.max(0,Math.min(rt.length,Te)),It=Math.max(tt,Math.min(rt.length,$e));if(ot?.expectedText!==void 0&&rt.slice(tt,It)!==ot.expectedText)return!1;let Bt=yR(s.current,Te,$e,qe),wn=lo(Bt.text,Bt.cursor),on=Ro(Bt.text,wn);s.current=Bt.text;let mn=w?.activeQuestion;return mn&&k?gt(mn.id,Bt.text,wn,on,!1):ct(Bt.text),ue(wn),Kt(xo(Bt.text,on)),ot?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{i.current?.focusAt(wn)}),!0},[w?.activeQuestion,i,k,gt,s,ue,ct]),ut=E(()=>{let Te=i.current?.readSnapshot();return Te||{value:s.current,cursor:j,expandedCursor:Ro(s.current,j),terminalContextIds:T.map($e=>$e.id)}},[j,i,s,T]),mt=wD({prompt:Z,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,useComposerPathSearch:o.pathSearch.useComposerPathSearch,readComposerSnapshot:ut,applyPromptReplacement:bt,onInteractionModeChange:x,onOpenModelPicker:C,onSlashCommandUsed:y}),{composerTrigger:st,composerMenuItems:lt,composerMenuOpen:At,activeComposerMenuItem:Wt,resolveActiveComposerTrigger:fn,onComposerMenuItemHighlighted:at,onMenuEscape:Mt,workspaceEntries:Ht,highlightedItemId:nn,setTrigger:Kt,setHighlightedItemId:jt}=mt,yn=st?.kind??null,$=st?.kind==="path"?st.query:"",ae=w?w.customAnswer:Z,de=M?"":ae,Pe=mt.resetForDocumentChange;q(()=>{Pe(ae,j)},[a,Pe,ae,j]),ie.current=At,He.current=lt,Pt.current=Wt;let _e=yn==="path"&&$.length>0&&Ht.isPending===!0,ft=V(()=>oe(yn==="skill"?"composer.noSkillsFound":yn==="path"?"composer.noMatchingFiles":"composer.noMatchingCommand"),[yn]),pn=E(Te=>{let $e=T.findIndex(rt=>rt.id===Te);if($e<0)return;let qe=o.terminalContext.removeInlinePlaceholder(s.current,$e);s.current=qe.prompt,ct(qe.prompt),Be(r,Te);let ot=lo(qe.prompt,qe.cursor);ue(ot),Kt(xo(qe.prompt,qe.cursor))},[o.terminalContext,r,s,Be,ue,ct,T,Kt]);xe(()=>{s.current=Z,ue(Te=>Xo(Z,Te))},[a,Z,s,ue]),q(()=>{G(Z)},[G,Z]),q(()=>{At&&re()},[At,re]);let St=N(null);q(()=>{let Te=w?.customAnswer;if(typeof Te!="string"){if(St.current!==null){s.current=Z;let It=lo(Z,Z.length);ue(It),Kt(xo(Z,Ro(Z,It)))}St.current=null;return}let $e=I,qe=w?.activeQuestion?.id??null,ot=St.current?.requestId!==$e||St.current?.questionId!==qe,rt=s.current!==Te;if(St.current={requestId:$e,questionId:qe},!ot&&!rt)return;s.current=Te;let tt=lo(Te,Te.length);ue(tt),Kt(xo(Te,Ro(Te,tt))),jt(null)},[w?.customAnswer,w?.activeQuestion?.id,I,Z,s]);let ht=E((Te,$e,qe,ot,rt)=>{if(w?.activeQuestion&&k){if(w.activeQuestion.allowFreeform===!1)return;ue($e),Kt(ot?null:xo(Te,qe)),gt(w.activeQuestion.id,Te,$e,qe,ot);return}s.current=Te,ct(Te),z6(T,rt)||Re(r,U6(T,rt)),ue($e),Kt(ot?null:xo(Te,qe))},[w?.activeQuestion,k,gt,s,ue,ct,r,T,Re,Kt]),kt=mt.onSelectComposerItem,je=E(Te=>{ge.current||(ge.current=!0,window.requestAnimationFrame(()=>{ge.current=!1}),kt(Te))},[kt]),Qt=E(Te=>{if(lt.length===0)return;let $e=lt.findIndex(It=>It.id===nn),rt=(($e>=0?$e:Te==="ArrowDown"?-1:0)+(Te==="ArrowDown"?1:-1)+lt.length)%lt.length,tt=lt[rt];jt(tt?.id??null)},[nn,lt,jt]),Zt=(Te,$e)=>{if(Te==="Escape")return $e.isComposing||$e.keyCode===229?!1:Mt()||(te?.()??!1);if(Te==="Tab"&&$e.shiftKey)return p?(b(),!0):!1;let{trigger:qe}=fn();if(ie.current||qe!==null){let tt=He.current,It=Pt.current??tt[0];if(Te==="ArrowDown"&&tt.length>0)return Qt("ArrowDown"),!0;if(Te==="ArrowUp"&&tt.length>0)return Qt("ArrowUp"),!0;if((Te==="Enter"||Te==="Tab")&&It)return je(It),!0}let rt=Te==="Enter"?gR({isMobileViewport:J,shiftKey:$e.shiftKey,modifierKey:$e.metaKey||$e.ctrlKey,isDraftThread:O}):null;return rt?(F(void 0,rt),!0):!1};return Bo(n,()=>({readSnapshot:ut,readDraftPrompt:()=>Z,applyPromptReplacement:bt,syncCursor:(Te,$e)=>{ue(Te),Kt($e)},resetCursorState:Te=>{let $e=Te?.prompt??s.current,qe=Xo($e,Te?.cursor??0);jt(null),ue(qe),Kt(Te?.detectTrigger?xo($e,Ro($e,qe)):null)}}),[bt,Z,s,ut,ue,jt,Kt]),S(Ie,{children:[B&&!At&&!M&&u(TD,{anchor:l,children:u(CD,{entries:Y,onRestore:U,onDelete:X,onClose:re})}),At&&!M&&u(TD,{anchor:l,children:u(gD,{items:lt,resolvedTheme:d,isLoading:_e,triggerKind:yn,emptyStateText:ft,activeItemId:Wt?.id??null,onHighlightedItemChange:at,onSelect:je})}),A?u(Gl,{editorRef:i,documentKey:a,value:de,cursor:j,terminalContexts:L?T:O6,skills:f?.skills??F6,...R?{className:R}:{},onRemoveTerminalContext:pn,onChange:ht,onCommandKeyDown:Zt,onPaste:W,placeholder:D,disabled:H}):null]})});function kD({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 LD(e){let{t}=pe(),{message:n,pluginBlockMessage:o,agentNotChosen:r,agentUnavailable:a,agentUnavailableNoChoice:s,modelSendBlock:i,selectedModelStatus:l,onChooseModel:d}=e;return S(Ie,{children:[u(kD,{message:n}),o===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:o}),r?u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:t("composer.agentNotChosen")}):null,a?u("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:t(s?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,i===null?null:S("p",{role:"status",className:"flex flex-wrap items-center gap-2 px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-blocked":l,children:[t(i.blockKey),i.canChooseModel?u(ce,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{d()},children:t("modelPicker.chooseModel")}):null]})]})}var H6=[];function AD(e){let{t}=pe(),{props:n,model:o,status:r,submit:a,badges:s,traits:i,composerDraft:l}=e,d=e.pendingUserInputs.length>0,c=V(()=>e.composerImages.filter(C=>qm(C)==="image"),[e.composerImages]),f=V(()=>new Set(e.nonPersistedComposerImageIds),[e.nonPersistedComposerImageIds]),p=e.isMobileViewport&&!e.isComposerCollapsedMobile&&e.pendingPrimaryAction!==null,m=r.phase==="running"||r.isSendBusy||o.isSendDisabled||o.noProviderAvailable||r.projectSelectionRequired||r.environmentUnavailable!==null||!l.hasSendableContent,g=!e.isComposerCollapsedMobile&&!e.isComposerApprovalState,h=WM({machineUnavailable:r.environmentUnavailable!==null,sessionStarted:r.activeThread?.session!=null,sessionDisconnected:r.phase==="disconnected"}),v=GM(h),y=jM({t,tailPlaceholderKey:v,isComposerApprovalState:e.isComposerApprovalState,approvalDetail:e.approvalDetail,activePendingProgress:e.activePendingProgress!==null,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:o.noProviderAvailable});return u("div",{"data-chat-composer-main-surface":"true",className:"group relative z-10 rounded-[22px] p-px transition-colors duration-200",children:S("div",{ref:e.surfaceRef,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":e.isComposerCollapsedMobile?"true":"false",className:K("rounded-[20px] transition-[background-color] duration-200",e.isDragOverComposer?"bg-accent/45 ring-1 ring-primary/70":null,r.projectSelectionRequired?"opacity-75":null),children:[n.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:n.firstRow}):null,u(zM,{hidden:e.isComposerApprovalState}),e.showCollapsedMobilePromptRow?u(pD,{api:n.api,composerDraftTarget:n.composerDraftTarget,pendingCustomAnswer:e.activePendingProgress?e.activePendingProgress.customAnswer:null,noProviderAvailable:o.noProviderAvailable,onExpand:e.expandMobileComposer,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,submitDisabled:m,submitLabel:t("composer.sendMessage"),onSubmit:()=>a.submitComposerOrShellCommand()}):null,u(K6,{input:e,pendingUserInputs:d,showMobilePendingAnswerActions:p,composerPreviewableImages:c,nonPersistedComposerImageIdSet:f,composerPlaceholder:y}),u(LD,{message:e.providerInputSubmissionError??a.composerSubmissionError,pluginBlockMessage:o.pluginBlockMessage,agentNotChosen:r.agentNotChosen,agentUnavailable:o.agentUnavailable,agentUnavailableNoChoice:o.agentUnavailableNoChoice,modelSendBlock:o.modelSendBlock,selectedModelStatus:o.selectedModelStatus,onChooseModel:e.openModelPicker}),g?u(fD,{isComposerFooterCompact:e.isComposerFooterCompact,isComposerPrimaryActionsCompact:e.isComposerPrimaryActionsCompact,isMobileViewport:e.isMobileViewport,showMobilePendingAnswerActions:p,hasPendingUserInputs:d,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:o.noProviderAvailable,composerAttachmentInputRef:e.composerAttachmentInputRef,onComposerAttachmentInputChange:e.onComposerAttachmentInputChange,slots:n.slots,selectedInstanceId:o.selectedInstanceId,unavailableAgentInstanceId:r.unavailableAgentInstanceId,agentNotChosen:r.agentNotChosen,agentUnavailable:o.agentUnavailable,providerInstanceEntries:o.providerInstanceEntries,lockedProvider:r.lockedProvider,lockedContinuationGroupKey:o.lockedContinuationGroupKey,onAgentInstanceChange:o.onAgentInstanceChange,selectedModelForPickerWithCustomFallback:o.selectedModelForPickerWithCustomFallback,selectedModelStatus:o.selectedModelStatus,keybindings:n.keybindings,modelOptionsByInstance:o.modelOptionsByInstance,terminalOpen:n.terminalOpen,isComposerModelPickerOpen:e.isComposerModelPickerOpen,setIsComposerModelPickerOpen:e.setIsComposerModelPickerOpen,getModelDisabledReason:n.getModelDisabledReason,getModelContinuationLabel:n.getModelContinuationLabel,onContinueInModel:n.onContinueInModel,onProviderModelSelect:n.onProviderModelSelect,canSelectPluginAction:o.canSelectPluginAction,pluginOptions:o.pluginOptions,selectedPluginAction:o.selectedPluginAction,onSelectPluginAction:n.onSelectPluginAction,onManagePlugins:n.onManagePlugins,isPluginComposer:o.isPluginComposer,environmentId:n.environmentId,routeKind:n.routeKind,draftId:n.draftId,activeThread:r.activeThread,interactionMode:r.interactionMode,runtimeMode:r.runtimeMode,composerProviderControls:o.composerProviderControls,composerNativeMode:o.composerNativeMode,canSwitchNativeMode:o.canSwitchNativeMode,providerTraitsMenuContent:i.providerTraitsMenuContent,providerTraitsPicker:i.providerTraitsPicker,toggleInteractionMode:n.toggleInteractionMode,handleRuntimeModeChange:n.handleRuntimeModeChange,handleComposerNativeModeChange:o.handleComposerNativeModeChange,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,activeThreadModelDisplayName:o.activeThreadModelDisplayName,pendingPrimaryAction:e.pendingPrimaryAction,phase:r.phase,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,composerDraft:l,isSendBusy:r.isSendBusy,sendDisabledReason:o.sendDisabledReason,environmentUnavailable:r.environmentUnavailable,isPreparingWorktree:r.isPreparingWorktree,previousUserInputQuestion:e.actions.previousUserInputQuestion,handleInterruptPrimaryAction:e.actions.handleInterruptPrimaryAction,interruptArmed:r.interruptArmed,handleImplementPlanInNewThreadPrimaryAction:e.actions.handleImplementPlanInNewThreadPrimaryAction,shellCommandMode:a.shellCommandMode,shellCommandUnavailableReason:a.hostShellCommand?.unavailableReason??null,compactDisabled:e.compactDisabled,resolvedCompactDisabledReason:o.resolvedCompactDisabledReason,compactThreadContext:e.compactThreadContext}):null]})})}function K6(e){let{t}=pe(),{input:n,pendingUserInputs:o,showMobilePendingAnswerActions:r}=e,{props:a,model:s,status:i,submit:l,stash:d,composerDraft:c}=n,f=n.activePendingProgress?.activeQuestion?.allowFreeform===!1;return S("div",{ref:n.setComposerMenuAnchor,className:K("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",n.isComposerApprovalState&&"pb-3 sm:pb-4",n.isComposerCollapsedMobile&&"hidden"),children:[u(VM,{api:a.api,environmentId:a.environmentId,composerDraftTarget:a.composerDraftTarget,isComposerCollapsedMobile:n.isComposerCollapsedMobile,isComposerApprovalState:n.isComposerApprovalState,hasPendingUserInputs:o,supportsAttachmentUploads:a.supportsAttachmentUploads,uploadsByImageId:n.uploadsByImageId,composerImages:n.composerImages,composerPreviewableImages:e.composerPreviewableImages,composerPreviewAnnotations:c.previewAnnotations,composerReviewComments:c.reviewComments,composerElementContexts:c.elementContexts,nonPersistedComposerImageIdSet:e.nonPersistedComposerImageIdSet,removeComposerDraftPreviewAnnotation:n.removeComposerDraftPreviewAnnotation,removeComposerDraftReviewComment:n.removeComposerDraftReviewComment,removeComposerDraftElementContext:n.removeComposerDraftElementContext,removeComposerImage:n.removeComposerImage,onExpandImage:a.onExpandImage}),u($6,{mode:l.shellCommandMode,label:t("composer.shellCommand.mode"),hint:l.hostShellCommand?.unavailableReason??t("composer.shellCommand.hint")}),S("div",{className:"relative",children:[u(PD,{handleRef:n.promptInputRef,api:a.api,composerDraftTarget:a.composerDraftTarget,composerDocumentKey:n.composerDocumentKey,promptRef:a.promptRef,editorRef:n.composerEditorRef,menuAnchor:n.composerMenuAnchor,resolvedTheme:a.resolvedTheme,selectedProvider:s.selectedProvider,selectedProviderStatus:s.selectedProviderStatus,planModeUiEnabled:s.planModeUiEnabled,showSkillsInSlashMenu:a.settings.showSkillsInSlashMenu,recentSlashCommandIds:a.recentSlashCommandIds??H6,environmentId:a.environmentId,gitCwd:a.gitCwd,onSlashCommandUsed:a.onSlashCommandUsed,onOpenModelPicker:n.openModelPicker,onInteractionModeChange:n.switchInteractionMode,onToggleInteractionMode:a.toggleInteractionMode,activePendingProgress:n.activePendingProgress,activePendingRequestId:n.pendingUserInputs[0]?.requestId??null,hasPendingUserInputs:o,changeUserInputCustomAnswer:n.changeUserInputCustomAnswer,terminalContexts:c.terminalContexts,showTerminalContexts:!n.isComposerApprovalState&&!o,showEditor:!f,isApprovalState:n.isComposerApprovalState,editorClassName:r?"max-sm:pb-11":void 0,placeholder:e.composerPlaceholder,disabled:n.isComposerApprovalState||i.projectSelectionRequired,onPaste:n.handleComposerPaste,onSubmit:n.handleComposerSubmit,isMobileViewport:n.isMobileViewport,isDraftRoute:a.routeKind==="draft",stashMenuOpen:n.isStashMenuOpen,stashEntries:d.stashQueue,onRestoreStashEntry:d.restoreStashEntry,onDeleteStashEntry:d.deleteStashEntry,onCloseStashMenu:d.closeStashMenu,onPromptEdited:n.onPromptEdited,onUnclaimedEscape:n.handleUnclaimedEscape}),r?u(q6,{input:n}):null]})]})}function $6(e){return e.mode?S("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-center gap-1.5 px-1 pb-1 text-xs",children:[u(wo,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-primary"}),u("span",{className:"shrink-0 font-medium text-primary",children:e.label}),u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.hint})]}):null}function q6(e){let{input:t}=e,{model:n,status:o,badges:r}=t;return S("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[r.inlineTasksBadge,r.inlineStashBadge,u(ad,{compact:!0,pendingAction:t.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:o.isSendBusy,sendDisabledReason:n.sendDisabledReason,isEnvironmentUnavailable:o.environmentUnavailable!==null||n.noProviderAvailable||o.projectSelectionRequired,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:t.actions.previousUserInputQuestion,onInterrupt:t.actions.handleInterruptPrimaryAction,interruptArmed:o.interruptArmed,onImplementPlanInNewThread:t.actions.handleImplementPlanInNewThreadPrimaryAction})]})}function RD(e){let{formRef:t,onSubmit:n,onFocusCapture:o,onBlurCapture:r,dragHandlers:a,onDragLeaveCapture:s,badges:i,stashQueueLength:l,isStashMenuOpen:d,stashPulse:c,toggleStashMenu:f,drawers:p,children:m}=e;return S("form",{ref:t,onSubmit:n,onFocusCapture:o,onBlurCapture:r,onDragEnterCapture:a.onDragEnter,onDragOverCapture:a.onDragOver,onDragLeaveCapture:s,onDropCapture:a.onDrop,className:K("mx-auto w-full min-w-0 max-w-3xl",i.hasShoulderTab&&"pt-7"),"data-chat-composer-form":"true",children:[p,S("div",{className:"relative",children:[i.showShoulderTabs&&i.visibleTasksProgress&&i.visibleTaskSteps?u(Gm,{expanded:!1,hasTrailingShoulder:l>0,onDismiss:i.dismissTasks,onToggle:i.toggleTasksDrawer,progress:i.visibleTasksProgress,steps:i.visibleTaskSteps}):null,i.showShoulderTabs?u(Wm,{count:l,menuOpen:d,pulseKey:c.key,pulsing:c.active,onToggleMenu:f}):null,m]})]})}function ED(e){let{t}=pe(),n=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:S("div",{"data-chat-composer-mobile-pending-compact":"true",className:K("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",!n&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!n&&"px-3 py-2"),onPointerDown:o=>o.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?u(ad,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function MD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}le();var V6=2e3,W6="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",G6=e=>[{decision:"cancel",label:e("composer.cancel")},{decision:"decline",label:e("composer.decline")},{decision:"acceptForSession",label:e("composer.alwaysAllowSession")},{decision:"accept",label:e("composer.approve")}];function j6(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 ND=ye(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:s}){let{t:i}=pe(),l=o??G6(i),d=Et(),c=a==="native"||a==="queued",[f,p]=Q(""),m=N([]);q(()=>{p("")},[t]);let g=E(v=>{let y=v==="decline"?f.trim():"";s(t,v,y.length>0?y:void 0)},[f,s,t]),h=E(v=>{let y=m.current.filter(b=>b!==null);if(y.length===0)return;let C=y.findIndex(b=>b===document.activeElement),x=C===-1?v===1?0:y.length-1:(C+v+y.length)%y.length;y[x]?.focus()},[]);return d.pane.useKeydown(v=>{if(n||d.terminalFocus.getOwner()!==null||v.isComposing||v.keyCode===229)return;let y=Za(v.target);if(r&&(!y||v.metaKey||v.ctrlKey||v.altKey)){let b=d.keybindings.approvalDecisionFromCommand(d.keybindings.resolveShortcutCommand(v,r));if(b!==null&&l.some(w=>w.decision===b)){v.preventDefault(),g(b);return}}if(y)return;let C=TS(v,l);if(C===null)return;if(v.preventDefault(),C.type==="move"){h(C.delta);return}let x=l[C.index];x&&g(x.decision)},{target:"document"}),u(Ie,{children:l.map((v,y)=>{let C=y<9?y+1:null,x=S(ce,{ref:b=>{m.current[y]=b},size:"xs",variant:v.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":j6(v.decision,y),className:`${W6}${v.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>g(v.decision),children:[u("span",{className:"min-w-0 break-words",children:v.label}),C===null?null:u(df,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:C})]},v.decision);return v.decision!=="decline"||!c?x:S(Ha,{children:[u(Qi,{type:"text",value:f,disabled:n,maxLength:V6,placeholder:i(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":i("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:b=>p(b.target.value),onKeyDown:b=>{if(b.key==="Enter"){b.preventDefault(),g("decline");return}b.key==="Escape"&&(b.preventDefault(),f.length>0?p(""):b.currentTarget.blur())}}),x]},v.decision)})})});le();var Q6=["command","cmd"],X6=["file_path","filePath","path","notebook_path","notebookPath"],Y6=["url"],J6=["query","q"],Z6=["name","skill","skill_name","skillName"],_D=["toolName","tool_name"],DD=["description"],e8=[],t8=[];function Ma(e,t,n){for(let o of t){let a=e.find(s=>s.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function n8(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function o8(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function FD(e){let t=e.args??e8,n=e.fileChanges??t8,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},s=null,i=a,l=null;switch(e.requestKind){case"command":{let d=Ma(t,Q6,o);d!==null&&(i={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Ma(t,X6,o)??o8(n);d!==null&&(s=n8(d),i=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Ma(t,Y6,o);d!==null&&(i={shape:"url",url:d});break}case"web-search":{let d=Ma(t,J6,o);d!==null&&(i={shape:"query",query:d});break}case"skill":{s=Ma(t,Z6,o)??Ma(t,_D,o),l=Ma(t,DD,o),t.length>0&&(i={shape:"none"});break}case"mcp-tool":case"tool":{s=Ma(t,_D,o),l=Ma(t,DD,o),t.length>0&&(i={shape:"none"});break}case"mcp-elicitation":{s=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:s,body:i,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var r8={"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"},a8={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"},s8={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"},i8={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function BD(e,t){let n=e.subject!==null?r8[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(a8[e.kind])}function UD(e,t){return t(s8[e])}function zD(e,t){return t(i8[e])}function HD(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=OD(t.oldText??""),o=OD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3848
3797
  +++ b/${e.path}
3849
3798
  `,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
3850
3799
  `,s=[...n.map(i=>`-${i}`),...o.map(i=>`+${i}`)];return`${r}${a}${s.join(`
3851
3800
  `)}
3852
- `}function zD(e){if(e.length===0)return[];let t=e.split(`
3853
- `);return t.at(-1)===""?t.slice(0,-1):t}function WD(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 GD(e){return{additions:e.additions??0,deletions:e.deletions??0}}ie();ie();var xxe=(()=>{try{return!1}catch{return!1}})(),jD=/(?=^From [a-f0-9]+ .+$)/m,Jx=/(?=^diff --git)/gm;var QD=/^(---|\+\+\+)\s+([^\t\r\n]+)/,XD=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,YD=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,JD=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var p8={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},bxe={...p8,hunkLineCount:1};var Sxe=Object.freeze({fromStart:0,fromEnd:0});function Zx(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var m8=new TextEncoder,g8=new TextDecoder("utf-8",{ignoreBOM:!0}),h8=/[\uD800-\uDFFF]/,eb=1024,ld=new Uint8Array(eb);function ZD(){ld.length!==eb&&(ld=new Uint8Array(eb))}function Tn(e){if(e.length===0)return e;if(h8.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;ld.length<t&&(ld=new Uint8Array(t));let{written:n}=m8.encodeInto(e,ld);return g8.decode(ld.subarray(0,n))}function t1(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=y8(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}v8(t,e)}}function v8(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 s=r.additions>0,i=s?t.additionLines:t.deletionLines,l=s?r.additionLineIndex:r.deletionLineIndex,d=s?r.additions:r.deletions,c=i[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(i[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,g=r.deletionLineIndex+r.deletions,h=n[o+1];h?.type==="context"?(h.lines+=p,h.additionLineIndex=m,h.deletionLineIndex=g):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:g}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function y8(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,s=Math.min(n,o),i=Math.abs(o-n);if(s===0||i===0||s*(i+1)>4096)return null;let l=[];for(let h=0;h<n;h++)l.push(e1(e.deletionLines[r+h]??""));let d=[];for(let h=0;h<o;h++)d.push(e1(e.additionLines[a+h]??""));let c=o>n,f=0,p=-1;for(let h=0;h<=i;h++){let v=0;for(let y=0;y<s;y++)v+=x8(l[y+(c?0:h)],d[y+(c?h:0)]);h===0?p=v+s*.5:v>p&&(p=v,f=h)}if(f===0)return null;let m=[],g=(h,v,y,C)=>{(h>0||v>0)&&m.push({type:"change",deletions:h,additions:v,deletionLineIndex:y,additionLineIndex:C})};return c?(g(0,f,r,a),g(s,s,r,a+f),g(0,o-s-f,r+s,a+f+s)):(g(f,0,r,a),g(s,s,r+f,a),g(n-s-f,0,r+f+s,a+s)),m}var C8=/\s+/g;function e1(e){return e.replace(C8,"")}function x8(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 b8(e,t,n){try{return S8(e,t,n)}finally{ZD()}}function S8(e,t,n=!1){let o=E8(e),r=o?T8(e):P8(e),a,s=[];for(let i of r){if(o&&!Jx.test(i)){if(a==null)a=Tn(i);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",i)}continue}else if(!o&&!k8(i)){if(a==null)a=Tn(i);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",i)}continue}let l=I8(i,{cacheKey:t!=null?`${t}-${s.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&s.push(l)}return{patchMetadata:a,files:s}}function I8(e,{cacheKey:t,isGitDiff:n=Jx.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let s=0,i=c1(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of i){let m=i1(p),g=m[0];if(g==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let h=d1(g),v=0,y=0;if(h==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?n1(r.contents):[],deletionLines:!d&&o!=null&&r!=null?n1(o.contents):[],cacheKey:a1(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let w of m){if(w.startsWith("diff --git")){let A=w.trim().match(YD),M=A?.[1]??A?.[2],R=A?.[3]??A?.[4];if(M==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",w);continue}l.name=Tn(R.trim()),M!==R&&(l.prevName=Tn(M.trim()));continue}let L=w.startsWith("---")||w.startsWith("+++")?w.match(n?XD:QD):null;if(L!=null){let[,A,M]=L;if(A==="---"&&M!=="/dev/null"){let R=Tn(M.trim());l.prevName=R,l.name=R}else A==="+++"&&M!=="/dev/null"&&(l.name=Tn(M.trim()))}else if(n){if(w.startsWith("new mode ")&&(l.mode=Tn(w.slice(8).trim())),w.startsWith("old mode ")&&(l.prevMode=Tn(w.slice(8).trim())),w.startsWith("new file mode")&&(l.type="new",l.mode=Tn(w.slice(13).trim())),w.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Tn(w.slice(17).trim())),w.startsWith("similarity index")&&(w.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),w.startsWith("index ")){let[,A,M,R]=w.trim().match(JD)??[];A!=null&&(l.prevObjectId=Tn(A)),M!=null&&(l.newObjectId=Tn(M)),R!=null&&(l.mode=Tn(R))}w.startsWith("rename from ")&&(l.prevName=Tn(w.slice(12).trim())),w.startsWith("rename to ")&&(l.name=Tn(w.slice(10).trim()))}}continue}let C,x;for(;m.length>0&&(m[m.length-1]===`
3801
+ `}function OD(e){if(e.length===0)return[];let t=e.split(`
3802
+ `);return t.at(-1)===""?t.slice(0,-1):t}function KD(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 $D(e){return{additions:e.additions??0,deletions:e.deletions??0}}le();le();var gxe=(()=>{try{return!1}catch{return!1}})(),qD=/(?=^From [a-f0-9]+ .+$)/m,Yx=/(?=^diff --git)/gm;var VD=/^(---|\+\+\+)\s+([^\t\r\n]+)/,WD=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,GD=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,jD=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var l8={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},hxe={...l8,hunkLineCount:1};var vxe=Object.freeze({fromStart:0,fromEnd:0});function Jx(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var d8=new TextEncoder,c8=new TextDecoder("utf-8",{ignoreBOM:!0}),u8=/[\uD800-\uDFFF]/,Zx=1024,sd=new Uint8Array(Zx);function QD(){sd.length!==Zx&&(sd=new Uint8Array(Zx))}function In(e){if(e.length===0)return e;if(u8.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;sd.length<t&&(sd=new Uint8Array(t));let{written:n}=d8.encodeInto(e,sd);return c8.decode(sd.subarray(0,n))}function YD(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=p8(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}f8(t,e)}}function f8(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 s=r.additions>0,i=s?t.additionLines:t.deletionLines,l=s?r.additionLineIndex:r.deletionLineIndex,d=s?r.additions:r.deletions,c=i[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(i[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,g=r.deletionLineIndex+r.deletions,h=n[o+1];h?.type==="context"?(h.lines+=p,h.additionLineIndex=m,h.deletionLineIndex=g):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:g}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function p8(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,s=Math.min(n,o),i=Math.abs(o-n);if(s===0||i===0||s*(i+1)>4096)return null;let l=[];for(let h=0;h<n;h++)l.push(XD(e.deletionLines[r+h]??""));let d=[];for(let h=0;h<o;h++)d.push(XD(e.additionLines[a+h]??""));let c=o>n,f=0,p=-1;for(let h=0;h<=i;h++){let v=0;for(let y=0;y<s;y++)v+=g8(l[y+(c?0:h)],d[y+(c?h:0)]);h===0?p=v+s*.5:v>p&&(p=v,f=h)}if(f===0)return null;let m=[],g=(h,v,y,C)=>{(h>0||v>0)&&m.push({type:"change",deletions:h,additions:v,deletionLineIndex:y,additionLineIndex:C})};return c?(g(0,f,r,a),g(s,s,r,a+f),g(0,o-s-f,r+s,a+f+s)):(g(f,0,r,a),g(s,s,r+f,a),g(n-s-f,0,r+f+s,a+s)),m}var m8=/\s+/g;function XD(e){return e.replace(m8,"")}function g8(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 h8(e,t,n){try{return v8(e,t,n)}finally{QD()}}function v8(e,t,n=!1){let o=P8(e),r=o?x8(e):b8(e),a,s=[];for(let i of r){if(o&&!Yx.test(i)){if(a==null)a=In(i);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",i)}continue}else if(!o&&!S8(i)){if(a==null)a=In(i);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",i)}continue}let l=y8(i,{cacheKey:t!=null?`${t}-${s.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&s.push(l)}return{patchMetadata:a,files:s}}function y8(e,{cacheKey:t,isGitDiff:n=Yx.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let s=0,i=s1(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of i){let m=o1(p),g=m[0];if(g==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let h=a1(g),v=0,y=0;if(h==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?JD(r.contents):[],deletionLines:!d&&o!=null&&r!=null?JD(o.contents):[],cacheKey:t1(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(GD),M=A?.[1]??A?.[2],R=A?.[3]??A?.[4];if(M==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",T);continue}l.name=In(R.trim()),M!==R&&(l.prevName=In(M.trim()));continue}let L=T.startsWith("---")||T.startsWith("+++")?T.match(n?WD:VD):null;if(L!=null){let[,A,M]=L;if(A==="---"&&M!=="/dev/null"){let R=In(M.trim());l.prevName=R,l.name=R}else A==="+++"&&M!=="/dev/null"&&(l.name=In(M.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=In(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=In(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=In(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=In(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,M,R]=T.trim().match(jD)??[];A!=null&&(l.prevObjectId=In(A)),M!=null&&(l.newObjectId=In(M)),R!=null&&(l.mode=In(R))}T.startsWith("rename from ")&&(l.prevName=In(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=In(T.slice(10).trim()))}}continue}let C,x;for(;m.length>0&&(m[m.length-1]===`
3854
3803
  `||m[m.length-1]==="\r"||m[m.length-1]===`\r
3855
- `||m[m.length-1]==="");)m.pop();let{additionStart:b,deletionStart:T}=h;c=d?c:T-1,f=d?f:b-1;let I={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:h.additionCount,additionStart:b,additionLines:v,deletionCount:h.deletionCount,deletionStart:T,deletionLines:y,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:a1(h.hunkContext),hunkSpecs:Tn(g),noEOFCRAdditions:!1,noEOFCRDeletions:!1},k=0,P=0;for(let w=1;w<m.length;w++){let L=m[w];if(k>=I.additionCount&&P>=I.deletionCount&&!L.startsWith("\\")){if(a&&L8(L)&&!A8(L))throw Error("parsePatchContent: hunk has more lines than expected");break}let A=L[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${L}"`),console.error("processFile: invalid rawLine:",L);continue}let M=M8(A);if(M==="addition"){if(a&&k>=I.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=tb(L);(C==null||C.type!=="change")&&(C=nb("change",c,f),I.hunkContent.push(C)),f++,k++,d&&l.additionLines.push(R),C.additions++,v++,x="addition"}else if(M==="deletion"){if(a&&P>=I.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=tb(L);(C==null||C.type!=="change")&&(C=nb("change",c,f),I.hunkContent.push(C)),c++,P++,d&&l.deletionLines.push(R),C.deletions++,y++,x="deletion"}else if(M==="context"){if(a&&(P>=I.deletionCount||k>=I.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=tb(L);(C==null||C.type!=="context")&&(C=nb("context",c,f),I.hunkContent.push(C)),f++,c++,k++,P++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),C.lines++,x="context"}else if(M==="metadata"&&C!=null){if(C.type==="context"?(I.noEOFCRAdditions=!0,I.noEOFCRDeletions=!0):x==="deletion"?I.noEOFCRDeletions=!0:x==="addition"&&(I.noEOFCRAdditions=!0),d&&(x==="addition"||x==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=Zx(l.additionLines[R]))}if(d&&(x==="deletion"||x==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=Zx(l.deletionLines[R]))}}}if(a&&(k!==I.additionCount||P!==I.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");I.additionLines=v,I.deletionLines=y,I.collapsedBefore=Math.max(I.additionStart-1-s,0),l.hunks.push(I),s=I.additionStart+I.additionCount-1;for(let w of I.hunkContent)w.type==="context"?(I.splitLineCount+=w.lines,I.unifiedLineCount+=w.lines):(I.splitLineCount+=Math.max(w.additions,w.deletions),I.unifiedLineCount+=w.deletions+w.additions);I.splitLineStart=l.splitLineCount+I.collapsedBefore,I.unifiedLineStart=l.unifiedLineCount+I.collapsedBefore,l.splitLineCount+=I.collapsedBefore+I.splitLineCount,l.unifiedLineCount+=I.collapsedBefore+I.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,g=l.additionLines.length,h=Math.max(g-m,0);l.splitLineCount+=h,l.unifiedLineCount+=h}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),t1(l),l}}function s1(e,t,n=!1){let o=[],r=w8(e)?e.split(jD):[e];for(let a of r)try{o.push(b8(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(s){if(n)throw s;console.error(s)}return o}function w8(e){return e.startsWith("From ")||e.includes(`
3856
- From `)}function n1(e){let t=i1(e);for(let n=0;n<t.length;n++)t[n]=Tn(t[n]);return t}function i1(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3857
- `,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 T8(e){return c1(e,"diff --git")}function P8(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,s=!1;for(;o<e.length;){let i=ob(e,o);if(r<=0&&a<=0){if(l1(e,o)){o>n&&t.push(e.slice(n,o)),n=o,s=!0,o=ob(e,i);continue}if(s&&e.startsWith("@@ -",o)){let d=d1(e.slice(o,i));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=i;continue}let l=e[o];if(l==="\\"){o=i;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=i}return t.push(e.slice(n)),t}function k8(e){return l1(e,0)}function l1(e,t){let n=ob(e,t);return o1(e,t,"---")&&o1(e,n,"+++")}function o1(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===`
3858
- `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function ob(e,t){let n=e.indexOf(`
3859
- `,t);return n===-1?e.length:n+1}function L8(e){let t=e[0];return t==="+"||t==="-"||t===" "}function A8(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3860
- `&&n!=="\r")return!1}return!0}function d1(e){if(!e.startsWith("@@ -"))return;let t=4,n=Lg(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Lg(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Lg(e,t);if(a==null)return;let s=a.value;t=a.endIndex;let i=1;if(e[t]===","){let c=Lg(e,t+1);if(c==null)return;i=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=R8(e.slice(d+1))),{additionCount:i,additionStart:s,deletionCount:r,deletionStart:o,hunkContext:l}}function Lg(e,t){let n=t,o=0;for(;n<e.length;n++){let r=e.charCodeAt(n)-48;if(r<0||r>9)break;o=o*10+r}if(n!==t)return{value:o,endIndex:n}}function R8(e){return e.endsWith(`\r
3804
+ `||m[m.length-1]==="");)m.pop();let{additionStart:b,deletionStart:w}=h;c=d?c:w-1,f=d?f:b-1;let I={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:h.additionCount,additionStart:b,additionLines:v,deletionCount:h.deletionCount,deletionStart:w,deletionLines:y,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:t1(h.hunkContext),hunkSpecs:In(g),noEOFCRAdditions:!1,noEOFCRDeletions:!1},k=0,P=0;for(let T=1;T<m.length;T++){let L=m[T];if(k>=I.additionCount&&P>=I.deletionCount&&!L.startsWith("\\")){if(a&&I8(L)&&!w8(L))throw Error("parsePatchContent: hunk has more lines than expected");break}let A=L[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${L}"`),console.error("processFile: invalid rawLine:",L);continue}let M=k8(A);if(M==="addition"){if(a&&k>=I.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=eb(L);(C==null||C.type!=="change")&&(C=tb("change",c,f),I.hunkContent.push(C)),f++,k++,d&&l.additionLines.push(R),C.additions++,v++,x="addition"}else if(M==="deletion"){if(a&&P>=I.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=eb(L);(C==null||C.type!=="change")&&(C=tb("change",c,f),I.hunkContent.push(C)),c++,P++,d&&l.deletionLines.push(R),C.deletions++,y++,x="deletion"}else if(M==="context"){if(a&&(P>=I.deletionCount||k>=I.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=eb(L);(C==null||C.type!=="context")&&(C=tb("context",c,f),I.hunkContent.push(C)),f++,c++,k++,P++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),C.lines++,x="context"}else if(M==="metadata"&&C!=null){if(C.type==="context"?(I.noEOFCRAdditions=!0,I.noEOFCRDeletions=!0):x==="deletion"?I.noEOFCRDeletions=!0:x==="addition"&&(I.noEOFCRAdditions=!0),d&&(x==="addition"||x==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=Jx(l.additionLines[R]))}if(d&&(x==="deletion"||x==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=Jx(l.deletionLines[R]))}}}if(a&&(k!==I.additionCount||P!==I.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");I.additionLines=v,I.deletionLines=y,I.collapsedBefore=Math.max(I.additionStart-1-s,0),l.hunks.push(I),s=I.additionStart+I.additionCount-1;for(let T of I.hunkContent)T.type==="context"?(I.splitLineCount+=T.lines,I.unifiedLineCount+=T.lines):(I.splitLineCount+=Math.max(T.additions,T.deletions),I.unifiedLineCount+=T.deletions+T.additions);I.splitLineStart=l.splitLineCount+I.collapsedBefore,I.unifiedLineStart=l.unifiedLineCount+I.collapsedBefore,l.splitLineCount+=I.collapsedBefore+I.splitLineCount,l.unifiedLineCount+=I.collapsedBefore+I.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,g=l.additionLines.length,h=Math.max(g-m,0);l.splitLineCount+=h,l.unifiedLineCount+=h}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),YD(l),l}}function n1(e,t,n=!1){let o=[],r=C8(e)?e.split(qD):[e];for(let a of r)try{o.push(h8(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(s){if(n)throw s;console.error(s)}return o}function C8(e){return e.startsWith("From ")||e.includes(`
3805
+ From `)}function JD(e){let t=o1(e);for(let n=0;n<t.length;n++)t[n]=In(t[n]);return t}function o1(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3806
+ `,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 x8(e){return s1(e,"diff --git")}function b8(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,s=!1;for(;o<e.length;){let i=nb(e,o);if(r<=0&&a<=0){if(r1(e,o)){o>n&&t.push(e.slice(n,o)),n=o,s=!0,o=nb(e,i);continue}if(s&&e.startsWith("@@ -",o)){let d=a1(e.slice(o,i));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=i;continue}let l=e[o];if(l==="\\"){o=i;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=i}return t.push(e.slice(n)),t}function S8(e){return r1(e,0)}function r1(e,t){let n=nb(e,t);return ZD(e,t,"---")&&ZD(e,n,"+++")}function ZD(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===`
3807
+ `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function nb(e,t){let n=e.indexOf(`
3808
+ `,t);return n===-1?e.length:n+1}function I8(e){let t=e[0];return t==="+"||t==="-"||t===" "}function w8(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3809
+ `&&n!=="\r")return!1}return!0}function a1(e){if(!e.startsWith("@@ -"))return;let t=4,n=Tg(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Tg(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Tg(e,t);if(a==null)return;let s=a.value;t=a.endIndex;let i=1;if(e[t]===","){let c=Tg(e,t+1);if(c==null)return;i=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=T8(e.slice(d+1))),{additionCount:i,additionStart:s,deletionCount:r,deletionStart:o,hunkContext:l}}function Tg(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 T8(e){return e.endsWith(`\r
3861
3810
  `)?e.slice(0,-2):e.endsWith(`
3862
- `)?e.slice(0,-1):e}function E8(e){return e.startsWith("diff --git")||e.includes(`
3863
- diff --git`)}function c1(e,t){if(e.length===0)return[""];let n=`
3864
- ${t}`,o=e.startsWith(t)?0:r1(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let s=r1(e,n,a+1);if(s===-1)break;r.push(e.slice(a,s)),a=s}return r.push(e.slice(a)),r}function r1(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function a1(e){return e==null?e:Tn(e)}function M8(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function tb(e){let t=e.slice(1);return Tn(t===""?`
3865
- `:t)}function nb(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 u1={light:"vscode-light-modern",dark:"vscode-dark-modern"};function p1(e){return e==="dark"?u1.dark:u1.light}var m1=2166136261,g1=16777619,N8=2654435769,_8=2246822507;function f1(e,t=m1,n=g1){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 D8(e,t="diff-panel"){let n=e.trim(),o=f1(n,m1,g1).toString(36),r=f1(n,N8,_8).toString(36);return`${t}:${n.length}:${o}:${r}`}function rb(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 h1(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=s1(o,D8(o,t)).flatMap(s=>n.compactPartialHunkOffsets?s.files.map(rb):s.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 v1(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function y1({fileChange:e,onOpenDiff:t}){let{t:n}=fe(),[o,r]=G(!1),a=V(()=>VD(e),[e]),s=GD(e);return S("div",{className:"min-w-0",children:[S("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:s.additions,deletions:s.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):S(ce,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(i=>!i),children:[o?u(Zt,{className:"size-3 shrink-0"}):u(So,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(ce,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(O8,{path:e.path,unifiedDiff:a}):null]})}function O8({path:e,unifiedDiff:t}){let n=Et().theme.useResolvedTheme(),o=V(()=>{let r=h1(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:v1(rb(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(fS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:p1(n),themeType:n,stickyHeaders:!1}})})}var F8="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",C1=Ce(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=fe(),s=HD(t),{body:i}=s,l=WD(s.fileChanges);return S("div",{"aria-label":$D(s.kind,a),className:K("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[S("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:KD(s,a)}),n>1?S("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),i.shape==="none"?null:u("code",{"aria-label":qD(i.shape,a),className:K(F8,i.shape==="path"||i.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:i.shape==="command"?i.command:i.shape==="path"?i.path:i.shape==="url"?i.url:i.shape==="query"?i.query:i.text}),s.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:s.description}),s.fileChanges.map((d,c)=>u(y1,{fileChange:d,onOpenDiff:o},l[c])),s.args.length===0?null:S("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:s.args.map(d=>S("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 ab=Ce(function(t){return u(C1,{...t})});ie();var sb=Ce(function(t){let{t:n}=fe(),[o,r]=G(!1),[a,s]=G(!1),i=t.decision,l=i.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=i.askedBy.kind==="plugin"?i.askedBy.pluginId:null;return S("div",{className:K("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[S("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(i.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),i.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),i.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?i.detail.text.slice(0,4e3):i.detail.text.split(`
3866
- `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:i.options.map(f=>u(ce,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{s(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function B8(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function ib(e,t){if(t?.attachmentsBlocked)return null;let n=B8(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=DC(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?o.length>0?o:r?"":null:o[0]??(r?"":null)}function U8(e,t){let n={};for(let o of e){let r=ib(o,t[o.id]);if(r===null)return null;n[o.id]=r}return n}function z8(e,t){return e.reduce((n,o)=>ib(o,t[o.id])!==null?n+1:n,0)}function x1(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,s=r?ib(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",l=z8(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?DC(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:U8(e,t)!==null,canAdvance:s!==null}}var H8={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function b1(e,t,n){let o=t.kind==="plan"&&n.planAction!==void 0?H8[n.planAction]:void 0;return o===void 0?{label:n.label,description:n.description??""}:{label:e(o.label),description:e(o.description)}}ie();var S1=Ce(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){if(t.length===0)return null;let i=t[0];return i?u(K8,{prompt:i,isResponding:n.includes(i.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:s},i.requestId):null}),K8=Ce(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){let{t:i}=fe(),l=Et(),d=x1(t.questions,o,r),c=d.activeQuestion,f=N(null),p=N(s),[m,g]=G(null),[h,v]=G(null),y=h!==null&&h===c?.id;q(()=>{p.current=s},[s]),q(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){g(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&g(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),q(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let C=E((b,T)=>{if(c?.multiSelect){a(b,T);return}g({questionId:b,optionLabel:T}),a(b,T),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(b=>{if(!c||n||y||b.metaKey||b.ctrlKey||b.altKey||b.isComposing||b.keyCode===229||Xa(b.target))return;let T=Jg(b.key,c.options.length);if(T===null)return;let I=c.options[T];I&&(b.preventDefault(),C(c.id,Yl(I)))},{target:"document"}),!c)return null;let x=d.customAnswer.trim().length>0;return S(rS,{className:"py-2",open:!y,onOpenChange:b=>{v(b?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:S(sS,{title:i(y?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":y?"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?S("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,y?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(Zt,{"aria-hidden":"true",className:K("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",y&&"rotate-180")})]})}),u(aS,{className:"px-3 sm:px-4",children:S("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(zo,{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:i("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((b,T)=>{let I=Yl(b),k=b1(i,c,b),w=m?.questionId===c.id&&m.optionLabel===I||!x&&d.selectedOptionLabels.includes(I),L=T<9?T+1:null,A=K("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",w?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),M=S(we,{children:[S("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:k.label}),k.description&&k.description!==k.label?u("span",{className:"text-secondary-label text-[11px]",children:k.description}):null]}),w?u(Hn,{className:"size-icon-2 shrink-0 text-primary"}):L!==null?u("kbd",{className:K("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:L}):null]});return u("button",{type:"button","aria-pressed":w,disabled:n,onClick:()=>{C(c.id,I)},className:A,children:M},`${c.id}:${I}`)})})]})})]})});ie();var I1=Ce(function({planTitle:t}){let{t:n}=fe();return u("div",{className:"px-3 py-2 sm:px-4",children:S("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 w1(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(FD,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function T1(e){return e.occupant.kind!=="user-input"?null:u(S1,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var P1={approval:{expanded:e=>e.occupant.kind!=="approval"?null:S("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(ab,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:w1(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:S("div",{"data-chat-composer-collapsed-controls":"true",children:[u(ab,{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:w1(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(sb,{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(sb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:T1,collapsed:e=>S("div",{"data-chat-composer-collapsed-controls":"true",children:[T1(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(I1,{planTitle:OD(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function k1(e,t){let n=P1[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var Ebe=Object.keys(P1);function L1(e){let{composerOccupant:t,showComposerTopDrawer:n,hasBlockingComposerTopDrawer:o,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:c,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:g,activePendingProgress:h,isPendingUserInputChoiceOnly:v,expandMobileComposer:y,badges:C,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:T,environmentUnavailable:I,noProviderAvailable:k,projectSelectionRequired:P,previousUserInputQuestion:w,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:A}=e,{inlineTasksBadge:M,inlineStashBadge:R,visibleTasksProgress:D,visibleTaskSteps:H,dismissTasks:W,toggleTasksDrawer:F}=C;return S(we,{children:[n&&(!r||o)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":t?.kind==="approval"?"warning":"info","data-occupant":t?.kind??"none",children:t===null?null:k1({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:c,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:g,collapsedPendingRow:u(DD,{activePendingProgress:h,isPendingUserInputChoiceOnly:v,expandMobileComposer:y,inlineTasksBadge:M,inlineStashBadge:R,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:T,isEnvironmentUnavailable:I!==null||k||P,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:A})},a)}):null,r&&!o&&D&&H?u(nM,{onDismiss:W,onCollapse:F,progress:D,steps:H}):null]})}function A1(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,promptInjection:IM(e.prompt),hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}function R1(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(n=>n.setPrompt),setComposerDraftNativeMode:t(n=>n.setNativeMode),addComposerDraftImage:t(n=>n.addImage),addComposerDraftImages:t(n=>n.addImages),removeComposerDraftImage:t(n=>n.removeImage),insertComposerDraftTerminalContext:t(n=>n.insertTerminalContext),removeComposerDraftElementContext:t(n=>n.removeElementContext),removeComposerDraftPreviewAnnotation:t(n=>n.removePreviewAnnotation),removeComposerDraftReviewComment:t(n=>n.removeReviewComment),clearComposerDraftPromptAndImages:t(n=>n.clearComposerPromptAndImages)}}ie();function E1(e){let{onComposerPaste:t,submitComposer:n,exitShellCommandMode:o}=e,r=N({onComposerPaste:t,submitComposer:n,exitShellCommandMode:o});r.current={onComposerPaste:t,submitComposer:n,exitShellCommandMode:o};let a=E(l=>{r.current.onComposerPaste(l)},[]),s=E((l,d)=>{r.current.submitComposer(l,d)},[]),i=E(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}ie();var M1=yt(null);function N1({children:e}){let{data:t,target:n,threadKey:o}=Ho(),r=t.useComposerStatus({target:n,threadKey:o});return u(M1.Provider,{value:r,children:e})}function _1(){let e=Dt(M1);if(e===null)throw new Error("Composer status has not been provided.");return e}var D1=Ce(function(t){let n=CE(),{data:o,target:r,threadKey:a}=Ho(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:c,activePendingDraftAnswers:f,activePendingQuestionIndex:p,questionAttachmentsSupported:m,respondingRequestIds:g,occupants:h,respondToApproval:v,respondToDecision:y,selectUserInputOption:C,changeUserInputCustomAnswer:x,advanceUserInput:b,previousUserInputQuestion:T}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:I,interactionMode:k,lockedProvider:P,providerStatuses:w,activeProjectDefaultModelSelection:L,projectId:A,activeThreadModelSelection:M}=o.useComposerModelContext(r),{activeThreadId:R,activeThread:D,isLocalDraftThread:H,projectSelectionRequired:W,phase:F,isSendBusy:J,sendDisabledReason:O,unavailableAgentInstanceId:B=null,noAgentChosen:Y=!1,isPreparingWorktree:U,environmentUnavailable:j,compactDisabled:oe,compactDisabledReason:Q}=_1(),{t:ne}=fe(),{composerDraftTarget:re,environmentId:Z,attachmentUploadsCapabilityKnown:te,supportsAttachmentUploads:ue,routeKind:Me,routeThreadRef:Oe,draftId:ke,forceExpandedOnMobile:Ee,settings:ee,keybindings:Se,terminalOpen:X,gitCwd:de,promptRef:le,composerRef:se,composerImagesRef:$e,composerTerminalContextsRef:Tt,composerElementContextsRef:gt,sendContextRef:Lt,onSend:it,onInterrupt:ct,interruptArmed:ht=!1,onCompactContext:lt,onImplementPlanInNewThread:pt,onProviderInstanceSelect:Pt,onModelSelectionChosen:Ft,handleRuntimeModeChange:gn,handleInteractionModeChange:rt,handleNativeModeChange:At,focusComposer:Bt,scheduleComposerFocus:en,setThreadError:Vt}=t,Wt=o.useComposerPlan(r),vn=Wt.proposedPlan,$=Wt.tasksProgress,pe=Wt.taskSteps,ge=i.length===0&&k==="plan"&&vn!==null,ye=N(null),{pendingPrimaryAction:Pe,onSelectActivePendingUserInputOption:at,onRespondToApproval:tn,onRespondToComposerDecision:bt,onAdvanceActivePendingUserInput:cn}=GE({t:ne,threadId:r.threadId,setThreadError:Vt,promptRef:le,promptInputRef:ye,respondToApproval:v,respondToDecision:y,selectUserInputOption:C,advanceUserInput:b,activePendingProgress:l,activePendingIsResponding:c,activePendingResolvedAnswers:d}),st=t.api,{limits:Je}=t.attachments,Rt=st.draft.useThreadDraftSelector(re,xo=>A1(xo,st.chat.deriveComposerSendState)),nn=i[0]??null,{questionAttachmentTarget:Te,attachmentTarget:Ke,attachmentDocumentKey:qe}=KE({supported:m,attachments:t.attachments,environmentId:Z,threadId:R,requestId:nn?.requestId??null,question:l?.activeQuestion??null,responding:c,composerDraftTarget:re}),ut=st.draft.useThreadDraftSelector(Ke,HE),tt=ut.images,nt=Rt.terminalContexts,St=Rt.elementContexts,Ut=Rt.previewAnnotations,bn=Rt.reviewComments,ln=ut.nonPersistedImageIds,un=st.uploads.useStore(xo=>xo.uploadsByImageId),Gn=ue?SE({imageIds:tt.map(xo=>xo.id),uploadsByImageId:un,environmentId:Z},ne):null,{setComposerDraftPrompt:Sn,setComposerDraftNativeMode:xe,addComposerDraftImage:Ze,addComposerDraftImages:Mt,removeComposerDraftImage:vt,insertComposerDraftTerminalContext:fn,removeComposerDraftElementContext:yn,removeComposerDraftPreviewAnnotation:dn,removeComposerDraftReviewComment:Jt,clearComposerDraftPromptAndImages:jn}=R1(st);q(()=>{if(te){if(!ue){for(let xo of tt)st.uploads.release(xo.id);return}st.draft.restoreAttachments();for(let xo of tt)st.uploads.start({environmentId:Z,image:xo})}},[te,tt,Z,ue]);let zt=l!==null,Cn=RM({api:st,t:ne,settings:ee,composerDraft:Rt,composerDraftTarget:re,environmentId:Z,gitCwd:de,routeKind:Me,threadId:r.threadId,activeThread:D,isLocalDraftThread:H,unavailableAgentInstanceId:B,agentNotChosen:Y,runtimeMode:I,lockedProvider:P,providerStatuses:w,projectId:A,activeProjectDefaultModelSelection:L,activeThreadModelSelection:M,compactDisabledReason:Q,externalSendDisabledReason:O,attachmentBlockReason:Gn,answeringQuestion:zt,setComposerDraftNativeMode:xe,handleNativeModeChange:At,onProviderInstanceSelect:Pt,onModelSelectionChosen:Ft}),{selectedInstanceId:uo,noProviderAvailable:Tr,selectedProvider:Wr,composerModelOptions:ze,selectedModel:Pr,composerPromptInjectionState:er,composerProviderState:Gr,selectedPromptEffort:Is,selectedProviderModels:_o,sendDisabledReason:no,isSendDisabled:jr,setModelSendBlockShown:qi,isModelSendBlocked:ws}=Cn,zn=`${String(Z)}\0${String(re)}`,[Pn,Do]=G(!1),[Ts,He]=G(null),[Co,Ps]=G(null),[kr,Qr]=G(!1),[Na,ks]=G(!1),[tr,Xr]=G(null),[En,nr]=G({key:0,active:!1}),Ls=N(zn);be(()=>{Ls.current!==zn&&(Ls.current=zn,Do(!1),He(null),Qr(!1),ks(!1),Xr(null),nr({key:En.key,active:!1}))},[zn,En.key]);let As=Jf("max-sm"),Lr=N(null),Vi=N(null),xn=N(null),Rs=N(null),_a=N(!1),Da=N(new Map),{isComposerCollapsedMobile:Yr,blurMobileComposerAfterSend:fo,expandMobileComposer:Ar,scheduleComposerCollapseCheck:or,handleFormFocusCapture:Ve}=WE({isMobileViewport:As,forceExpandedOnMobile:Ee,composerEditorRef:Lr,composerSurfaceRef:Rs,composerFormRef:xn}),Nt=E(()=>{Do(!0)},[]),pn=E(xo=>{rt(xo)},[rt]),on=s!==null,Es=l?.activeQuestion?.allowFreeform===!1,Ms=h[0]??null,{showTopDrawer:Wi,showCollapsedPromptRow:Oa,hasBlocking:Ns}=bE(Ms?.kind??null,Yr),Ag=ge||l!==null,{isComposerFooterCompact:cd,isComposerPrimaryActionsCompact:Rg}=TE(xn,Ag),Eg=EM({api:st,settings:ee,routeKind:Me,routeThreadRef:Oe,draftId:ke,promptRef:le,promptInputRef:ye,composerDraftTarget:re,setComposerDraftPrompt:Sn,scheduleComposerFocus:en,answeringQuestion:zt,selectedProvider:Wr,selectedInstanceId:uo,selectedModel:Pr,selectedProviderModels:_o,composerModelOptions:ze,composerPromptInjectionState:er});q(()=>{He(null)},[St,Ut,bn,nt,Pr,Is,Wr]),VE({composerImages:tt,composerImagesRef:$e,composerTerminalContexts:nt,composerTerminalContextsRef:Tt,composerElementContexts:St,composerElementContextsRef:gt});let Jr=ZE({api:st,t:ne,limits:Je,composerDraftTarget:re,composerDraft:Rt,composerDocumentKey:zn,promptRef:le,promptInputRef:ye,providerInputRejectedRef:_a,pendingImageCompressionsRef:Da,setComposerDraftPrompt:Sn,setModelSendBlockShown:qi,onSend:it,onCompactContext:lt,blurMobileComposerAfterSend:fo,isMobileViewport:As,isComposerApprovalState:on,activePendingApproval:s,activePendingProgress:l,activePendingResolvedAnswers:d,pendingUserInputCount:i.length,activeThreadId:R,phase:F,isSendBusy:J,environmentUnavailable:j,compactDisabled:oe,noProviderAvailable:Tr,isSendDisabled:jr,sendDisabledReason:no,isModelSendBlocked:ws,showPlanFollowUpPrompt:ge}),_s=FE({api:st,t:ne,limits:Je,promptRef:le,promptInputRef:ye,composerEditorRef:Lr,composerImagesRef:$e,composerDraftTarget:re,setComposerDraftPrompt:Sn,addComposerDraftImages:Mt,clearComposerDraftPromptAndImages:jn,setIsStashMenuOpen:Qr,setStashPulse:nr,isComposerCollapsedMobile:Yr,expandMobileComposer:Ar,keybindings:Se,terminalOpen:X,isComposerModelPickerOpen:Pn,hasPendingUserInputs:i.length>0,isComposerApprovalState:on,projectSelectionRequired:W,answeringQuestion:zt}),ud=oM({activeThreadId:R,activeThread:D,activeTasksProgress:$,activeTaskSteps:pe,isTasksDrawerOpen:Na,setIsTasksDrawerOpen:ks,dismissedTasksTurnId:tr,setDismissedTasksTurnId:Xr,stashQueue:_s.stashQueue,isStashMenuOpen:kr,stashPulse:En,toggleInlineStashMenu:_s.toggleInlineStashMenu,isComposerApprovalState:on,externalDrawerAttached:n,showComposerTopDrawer:Wi,isComposerCollapsedMobile:Yr,hasBlockingComposerTopDrawer:Ns}),Mg=E(xo=>{He(null),Jr.revalidatePromptLength(xo),Qr(!1)},[Jr.revalidatePromptLength]),{addComposerImages:Lu,removeComposerImage:Ng,onComposerAttachmentInputChange:z}=zE({api:st,t:ne,limits:Je,setThreadError:Vt,activeThreadId:R,answerQuestionsFirst:i.length>0&&Te===null,attachmentTarget:Ke,attachmentDocumentKey:qe,supportsAttachmentUploads:ue,pendingImageCompressionsRef:Da,addComposerDraftImage:Ze,addComposerDraftImages:Mt,removeComposerDraftImage:vt}),{onComposerPaste:Ae,insertComposerTextAtEnd:ot,addDroppedFolders:Gt,isDragOverComposer:Qn,composerMentionDragHandlers:Fa,onComposerMentionDragLeaveCapture:_g}=OE({api:st,t:ne,addComposerImages:Lu,attachments:t.attachments,promptRef:le,promptInputRef:ye,composerEditorRef:Lr,composerFormRef:xn,composerThreadKey:a,attachmentDocumentKey:qe,attachmentImagesRef:$e,limits:Je,supportsAttachmentUploads:ue,composerDocumentKey:zn,isComposerApprovalState:on,pasteBlocked:i.length>0&&Te===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:W,environmentId:Z}),lb=E(()=>{ct()},[ct]),db=E(()=>{pt()},[pt]),{handleComposerPaste:q1,handleComposerSubmit:V1,handleUnclaimedEscape:W1}=E1({onComposerPaste:Ae,submitComposer:Jr.submitComposerOrShellCommand,exitShellCommandMode:Jr.exitShellCommandMode});return qE({composerRef:se,sendContextRef:Lt,api:st,t:ne,limits:Je,composerData:o,refs:{composerEditorRef:Lr,promptInputRef:ye,promptRef:le,composerImagesRef:$e,composerTerminalContextsRef:Tt,composerElementContextsRef:gt,providerInputRejectedRef:_a},composerDraftTarget:re,activeThread:D,addComposerImages:Lu,addDroppedFolders:Gt,focusComposer:Bt,insertComposerTextAtEnd:ot,insertComposerDraftTerminalContext:fn,composerPreviewAnnotations:Ut,composerReviewComments:bn,isComposerApprovalState:on,pendingUserInputCount:i.length,projectSelectionRequired:W,noProviderAvailable:Tr,modelState:Cn,handleRuntimeModeChange:gn,runtimeMode:I,setIsComposerModelPickerOpen:Do,setProviderInputSubmissionError:He}),u(_D,{formRef:xn,onSubmit:Jr.submitComposerOrShellCommand,onFocusCapture:Ve,onBlurCapture:or,dragHandlers:Fa,onDragLeaveCapture:_g,badges:ud,stashQueueLength:_s.stashQueue.length,isStashMenuOpen:kr,stashPulse:En,toggleStashMenu:_s.toggleStashMenu,drawers:u(L1,{composerOccupant:Ms,showComposerTopDrawer:Wi,hasBlockingComposerTopDrawer:Ns,isTasksDrawerOpen:Na,isComposerCollapsedMobile:Yr,respondingRequestIds:g,keybindings:Se,onRespondToApproval:tn,onRespondToDecision:bt,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:at,onAdvanceActivePendingUserInput:cn,activeProposedPlan:vn,activePendingProgress:l,isPendingUserInputChoiceOnly:Es,expandMobileComposer:Ar,badges:ud,pendingPrimaryAction:Pe,isSendBusy:J,sendDisabledReason:no,environmentUnavailable:j,noProviderAvailable:Tr,projectSelectionRequired:W,previousUserInputQuestion:T,handleInterruptPrimaryAction:lb,handleImplementPlanInNewThreadPrimaryAction:db}),children:u(ND,{props:t,composerDraft:Rt,composerProviderState:Gr,model:Cn,traits:Eg,submit:Jr,stash:_s,badges:ud,uploadsByImageId:un,composerImages:tt,nonPersistedComposerImageIds:ln,removeComposerImage:Ng,removeComposerDraftPreviewAnnotation:dn,removeComposerDraftReviewComment:Jt,removeComposerDraftElementContext:yn,onComposerAttachmentInputChange:z,surfaceRef:Rs,composerAttachmentInputRef:Vi,promptInputRef:ye,composerEditorRef:Lr,composerMenuAnchor:Co,setComposerMenuAnchor:Ps,composerDocumentKey:zn,isComposerCollapsedMobile:Yr,expandMobileComposer:Ar,isDragOverComposer:Qn,isComposerApprovalState:on,showCollapsedMobilePromptRow:Oa,activePendingProgress:l,pendingUserInputs:i,changeUserInputCustomAnswer:x,pendingPrimaryAction:Pe,approvalDetail:s?.detail??null,handleComposerPaste:q1,handleComposerSubmit:V1,onPromptEdited:Mg,handleUnclaimedEscape:W1,openModelPicker:Nt,switchInteractionMode:pn,providerInputSubmissionError:Ts,isStashMenuOpen:kr,isComposerFooterCompact:cd,isComposerPrimaryActionsCompact:Rg,isMobileViewport:As,isComposerModelPickerOpen:Pn,setIsComposerModelPickerOpen:Do,showPlanFollowUpPrompt:ge,compactDisabled:oe,compactThreadContext:Jr.compactThreadContext,status:{projectSelectionRequired:W,isSendBusy:J,environmentUnavailable:j,interruptArmed:ht,agentNotChosen:Y,unavailableAgentInstanceId:B,lockedProvider:P,phase:F,isPreparingWorktree:U,activeThread:D,interactionMode:k,runtimeMode:I},actions:{previousUserInputQuestion:T,handleInterruptPrimaryAction:lb,handleImplementPlanInNewThreadPrimaryAction:db}})})});function O1(e){let{composerRef:t,...n}=e,o=n;return u(Am,{value:o.api,children:u(D1,{...o,composerRef:t})})}function dd({section:e,resetKey:t,children:n}){return u(ll,{resetKey:t,fallback:o=>$8(e,o),children:n})}function $8(e,t){return u(q8,{section:e,error:t})}function q8({section:e,error:t}){let{t:n}=ft();return S("div",{role:"status","data-conversation-section-error":e,className:e==="composer"||e==="queue"?"pointer-events-auto mx-auto flex w-full max-w-3xl items-start gap-2 rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm":"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",children:[u(hn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive"}),S("div",{className:"min-w-0",children:[u("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),u("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function F1({hostVersion:e,scopeClass:t}){let{t:n}=ft();return S("div",{role:"status","data-conversation-host-data-mismatch":!0,className:K("flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",t),children:[u(hn,{"aria-hidden":!0,className:"size-5 text-destructive"}),u("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),u("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:md})})]})}function B1(e){let{data:t}=e;return t?.version!==md?u(F1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(zu.Provider,{value:e.scope.active,children:u(G8,{...e,data:t})})}var V8=Ce(function({threadKey:t,onModeChange:n}){let[o]=Ot("turn-navigator",t,null),r=E(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:u(CS,{...o,placement:"inline",onSelect:r})});function W8({slots:e,children:t}){let{data:n,target:o,threadKey:r}=Ho(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function G8(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:s}=e,[,i]=Ot("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,c=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,g=V(()=>l?S(we,{children:[d,u("div",{className:"min-w-0 flex-1"}),c]}):S(we,{children:[d,u(gS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(V8,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,c,f,p,m,t.threadKey]),{belowSlot:h,draftHero:v,onOverlayElementChange:y,sessionActions:C,terminalControl:x,agentsControl:b,contextStrip:T,...I}=a,k=u(O1,{...I,attachments:e.attachments,firstRow:g}),P=V(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[w,L]=Ot("trajectory-reveal",t.threadKey,null),A=E(Q=>{n.onModeChange("chat"),L(ne=>({rowId:Q,nonce:(ne?.nonce??0)+1}))},[n,L]),M=E(()=>L(null),[L]),R=N(null),{t:D}=fe(),H=N(a.api);H.current=a.api;let W=E(Q=>H.current.notify.warning(D(`timeline.quote.${Q}`)),[D]),[F,J]=Ot("timeline-quote-reveal",t.threadKey,null);q(()=>{let Q=R.current;if(!Q)return;let ne=re=>{let Z=re.detail?.quote;if(Z){if(Z.environmentId!==P.environmentId||Z.threadId!==P.threadId){W("otherThread");return}n.onModeChange("chat"),J({quote:Z})}};return Q.addEventListener($g,ne),()=>Q.removeEventListener($g,ne)},[n,J,P.environmentId,P.threadId,W]);let O=E(Q=>{J(null),Q==="message-missing"&&W("messageMissing"),Q==="passage-missing"&&W("passageMissing")},[J,W]),B=V(()=>({data:s,target:P,threadKey:t.threadKey}),[s,P,t.threadKey]),{controlRef:Y,...U}=o,j=s.useChatWindow({target:P,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),oe=gw({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:j.onReturnToLatest,controlRef:Y});return S("div",{ref:R,className:K("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(PS,{data:s,target:P,threadKey:t.threadKey,surfaceRef:R}),u(hS,{chat:S(dd,{section:"chat",resetKey:t.threadKey,children:[u(iw,{data:s,target:P,visible:t.visible,...U,paneActive:t.active,liveFollowEnabled:oe.liveFollowEnabled,scrollerRef:oe.bindTimelineHandle,onRowsChange:oe.onRowsChange,onIsAtEndChange:oe.onIsAtEndChange,onManualNavigation:oe.onManualNavigation,onDisclosureNavigation:oe.onDisclosureNavigation,loadEarlier:j.loadEarlier,loadLater:j.loadLater,pagingBlockedByInteraction:j.pagingBlockedByInteraction,onVisibleTurnRangeChange:j.onVisibleTurnRangeChange,onReturnToLatest:j.loadLater===null?null:oe.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:w,revealQuoteRequest:F,onRevealQuoteDone:O,onRevealMessageHandled:M}),u(uw,{data:s,target:P,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:oe.showScrollToEnd,onScrollToEnd:oe.returnToEnd})]},"chat"),mode:n.mode,trajectory:u(dd,{section:"trajectory",resetKey:t.threadKey,children:u(xw,{data:s,target:P,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:A})},"trajectory"),visible:t.visible}),u(xE,{data:s,target:P,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(dd,{section:"composer",resetKey:t.threadKey,children:u(Ff,{value:B,children:u(N1,{children:u(W8,{slots:a.slots,children:k})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,questions:u(dd,{section:"composer",resetKey:t.threadKey,children:u(fE,{data:s,target:P})}),queue:u(dd,{section:"queue",resetKey:t.threadKey,children:u(uE,{data:s,target:P,inputKey:t.threadKey,attachments:e.attachments})})})]})}ie();var j8=[],Q8=[],X8="prompt-font-preview",U1="max-h-40 min-h-12";function z1(){}function Y8(e){let t=0;return ba(e).map(n=>{let o=t;return t+=n.type==="text"?n.text.length:n.type==="mention"?n.source.length:n.type==="skill"?n.name.length+1:1,{key:o,segment:n}})}function J8(e){return u("div",{className:RC,children:u("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:K(EC,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:u("p",{children:Y8(e.prompt).map(({key:t,segment:n})=>n.type==="mention"?u("span",{className:Sa,children:u(Em,{path:n.path,theme:e.theme})},t):n.type==="skill"?u("span",{className:Sa,children:u(Mm,{label:Yo({name:n.name})})},t):n.type==="text"?u("span",{children:n.text},t):null)})})})}function H1(){let{t:e}=fe(),t=e("composer.idlePlaceholder"),n=Et().theme.useResolvedTheme()==="dark"?"dark":"light",o=e("composer.fontPreviewSample"),r=N(null),[a,s]=G(null),i=a?.prompt??o,l=a?.cursor??o.length,[d,c]=G(!1),f=E((m,g)=>{s({prompt:m,cursor:g})},[]),p=E(()=>c(!0),[]);return q(()=>{d&&r.current?.focusAtEnd()},[d]),u("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:d?u(Ql,{documentKey:X8,editorRef:r,value:i,cursor:l,terminalContexts:j8,skills:Q8,disabled:!1,placeholder:t,className:U1,onRemoveTerminalContext:z1,onChange:f,onPaste:z1}):u(J8,{className:U1,onActivate:p,placeholder:t,prompt:i,theme:n})})}var Z8=".ycodium-conversation-ui";function eQ(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function K1(e,t="conversation"){let n=eQ(),o=e.replaceAll(Z8,`.${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 tQ(e){let t=K1(fb);return{views:{[_u]:nQ(t,e),[Hg]:oQ(t,e)},viewCapabilities:{[_u]:[Kg,hb]},slots:[{name:"conversation.input.agent",order:0,component:pM},{name:"conversation.input.model",order:0,component:rD},{name:"conversation.input.plan",order:0,component:lD},{name:"conversation.input.permission",order:0,component:iD}]}}function nQ(e,t){return function(o){let a=o[Du]??t,s={...o};return delete s[Du],S(Ug,{value:a,children:[u($1,{retain:e.retain}),u(zg,{value:e.scopeClass,children:u(B1,{...s,scopeClass:e.scopeClass})})]})}}function oQ(e,t){return function(o){return S(Ug,{value:t,children:[u($1,{retain:e.retain}),u(zg,{value:e.scopeClass,children:u(Am,{value:o.api,children:u("div",{className:e.scopeClass,children:u(H1,{})})})})]})}}function $1({retain:e}){return pd(()=>e(),[e]),null}export{tQ as default};
3811
+ `)?e.slice(0,-1):e}function P8(e){return e.startsWith("diff --git")||e.includes(`
3812
+ diff --git`)}function s1(e,t){if(e.length===0)return[""];let n=`
3813
+ ${t}`,o=e.startsWith(t)?0:e1(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let s=e1(e,n,a+1);if(s===-1)break;r.push(e.slice(a,s)),a=s}return r.push(e.slice(a)),r}function e1(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function t1(e){return e==null?e:In(e)}function k8(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function eb(e){let t=e.slice(1);return In(t===""?`
3814
+ `:t)}function tb(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 i1={light:"vscode-light-modern",dark:"vscode-dark-modern"};function d1(e){return e==="dark"?i1.dark:i1.light}var c1=2166136261,u1=16777619,L8=2654435769,A8=2246822507;function l1(e,t=c1,n=u1){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 R8(e,t="diff-panel"){let n=e.trim(),o=l1(n,c1,u1).toString(36),r=l1(n,L8,A8).toString(36);return`${t}:${n.length}:${o}:${r}`}function ob(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 f1(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=n1(o,R8(o,t)).flatMap(s=>n.compactPartialHunkOffsets?s.files.map(ob):s.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 p1(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function m1({fileChange:e,onOpenDiff:t}){let{t:n}=pe(),[o,r]=Q(!1),a=V(()=>HD(e),[e]),s=$D(e);return S("div",{className:"min-w-0",children:[S("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:s.additions,deletions:s.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):S(ce,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(i=>!i),children:[o?u(tn,{className:"size-3 shrink-0"}):u(Io,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(ce,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(E8,{path:e.path,unifiedDiff:a}):null]})}function E8({path:e,unifiedDiff:t}){let n=Et().theme.useResolvedTheme(),o=V(()=>{let r=f1(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:p1(ob(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(dS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:d1(n),themeType:n,stickyHeaders:!1}})})}var M8="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",g1=ye(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=pe(),s=FD(t),{body:i}=s,l=KD(s.fileChanges);return S("div",{"aria-label":UD(s.kind,a),className:K("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[S("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:BD(s,a)}),n>1?S("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),i.shape==="none"?null:u("code",{"aria-label":zD(i.shape,a),className:K(M8,i.shape==="path"||i.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:i.shape==="command"?i.command:i.shape==="path"?i.path:i.shape==="url"?i.url:i.shape==="query"?i.query:i.text}),s.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:s.description}),s.fileChanges.map((d,c)=>u(m1,{fileChange:d,onOpenDiff:o},l[c])),s.args.length===0?null:S("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:s.args.map(d=>S("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 rb=ye(function(t){return u(g1,{...t})});le();var ab=ye(function(t){let{t:n}=pe(),[o,r]=Q(!1),[a,s]=Q(!1),i=t.decision,l=i.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=i.askedBy.kind==="plugin"?i.askedBy.pluginId:null;return S("div",{className:K("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[S("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(i.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),i.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),i.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?i.detail.text.slice(0,4e3):i.detail.text.split(`
3815
+ `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:i.options.map(f=>u(ce,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{s(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function N8(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function sb(e,t){if(t?.attachmentsBlocked)return null;let n=N8(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=NC(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?o.length>0?o:r?"":null:o[0]??(r?"":null)}function _8(e,t){let n={};for(let o of e){let r=sb(o,t[o.id]);if(r===null)return null;n[o.id]=r}return n}function D8(e,t){return e.reduce((n,o)=>sb(o,t[o.id])!==null?n+1:n,0)}function h1(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,s=r?sb(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",l=D8(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?NC(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:_8(e,t)!==null,canAdvance:s!==null}}var O8={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function v1(e,t,n){let o=t.kind==="plan"&&n.planAction!==void 0?O8[n.planAction]:void 0;return o===void 0?{label:n.label,description:n.description??""}:{label:e(o.label),description:e(o.description)}}le();var y1=ye(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){if(t.length===0)return null;let i=t[0];return i?u(F8,{prompt:i,isResponding:n.includes(i.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:s},i.requestId):null}),F8=ye(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){let{t:i}=pe(),l=Et(),d=h1(t.questions,o,r),c=d.activeQuestion,f=N(null),p=N(s),[m,g]=Q(null),[h,v]=Q(null),y=h!==null&&h===c?.id;q(()=>{p.current=s},[s]),q(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){g(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&g(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),q(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let C=E((b,w)=>{if(c?.multiSelect){a(b,w);return}g({questionId:b,optionLabel:w}),a(b,w),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(b=>{if(!c||n||y||b.metaKey||b.ctrlKey||b.altKey||b.isComposing||b.keyCode===229||Za(b.target))return;let w=Xg(b.key,c.options.length);if(w===null)return;let I=c.options[w];I&&(b.preventDefault(),C(c.id,Ql(I)))},{target:"document"}),!c)return null;let x=d.customAnswer.trim().length>0;return S(tS,{className:"py-2",open:!y,onOpenChange:b=>{v(b?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:S(oS,{title:i(y?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":y?"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?S("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,y?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(tn,{"aria-hidden":"true",className:K("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",y&&"rotate-180")})]})}),u(nS,{className:"px-3 sm:px-4",children:S("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(Ko,{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:i("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((b,w)=>{let I=Ql(b),k=v1(i,c,b),T=m?.questionId===c.id&&m.optionLabel===I||!x&&d.selectedOptionLabels.includes(I),L=w<9?w+1:null,A=K("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",T?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),M=S(Ie,{children:[S("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:k.label}),k.description&&k.description!==k.label?u("span",{className:"text-secondary-label text-[11px]",children:k.description}):null]}),T?u(qn,{className:"size-icon-2 shrink-0 text-primary"}):L!==null?u("kbd",{className:K("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:L}):null]});return u("button",{type:"button","aria-pressed":T,disabled:n,onClick:()=>{C(c.id,I)},className:A,children:M},`${c.id}:${I}`)})})]})})]})});le();var C1=ye(function({planTitle:t}){let{t:n}=pe();return u("div",{className:"px-3 py-2 sm:px-4",children:S("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 x1(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(ND,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function b1(e){return e.occupant.kind!=="user-input"?null:u(y1,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var S1={approval:{expanded:e=>e.occupant.kind!=="approval"?null:S("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(rb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:x1(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:S("div",{"data-chat-composer-collapsed-controls":"true",children:[u(rb,{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:x1(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(ab,{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(ab,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:b1,collapsed:e=>S("div",{"data-chat-composer-collapsed-controls":"true",children:[b1(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(C1,{planTitle:MD(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function I1(e,t){let n=S1[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var Pbe=Object.keys(S1);function w1(e){let{composerOccupant:t,showComposerTopDrawer:n,hasBlockingComposerTopDrawer:o,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:c,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:g,activePendingProgress:h,isPendingUserInputChoiceOnly:v,expandMobileComposer:y,badges:C,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:w,environmentUnavailable:I,noProviderAvailable:k,projectSelectionRequired:P,previousUserInputQuestion:T,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:A}=e,{inlineTasksBadge:M,inlineStashBadge:R,visibleTasksProgress:D,visibleTaskSteps:H,dismissTasks:W,toggleTasksDrawer:F}=C;return S(Ie,{children:[n&&(!r||o)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":t?.kind==="approval"?"warning":"info","data-occupant":t?.kind??"none",children:t===null?null:I1({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:c,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:g,collapsedPendingRow:u(ED,{activePendingProgress:h,isPendingUserInputChoiceOnly:v,expandMobileComposer:y,inlineTasksBadge:M,inlineStashBadge:R,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:w,isEnvironmentUnavailable:I!==null||k||P,onPreviousActivePendingUserInputQuestion:T,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:A})},a)}):null,r&&!o&&D&&H?u(eM,{onDismiss:W,onCollapse:F,progress:D,steps:H}):null]})}function T1(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}function P1(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(n=>n.setPrompt),setComposerDraftNativeMode:t(n=>n.setNativeMode),addComposerDraftImage:t(n=>n.addImage),addComposerDraftImages:t(n=>n.addImages),removeComposerDraftImage:t(n=>n.removeImage),insertComposerDraftTerminalContext:t(n=>n.insertTerminalContext),removeComposerDraftElementContext:t(n=>n.removeElementContext),removeComposerDraftPreviewAnnotation:t(n=>n.removePreviewAnnotation),removeComposerDraftReviewComment:t(n=>n.removeReviewComment),clearComposerDraftPromptAndImages:t(n=>n.clearComposerPromptAndImages)}}le();function k1(e){let{onComposerPaste:t,submitComposer:n,exitShellCommandMode:o}=e,r=N({onComposerPaste:t,submitComposer:n,exitShellCommandMode:o});r.current={onComposerPaste:t,submitComposer:n,exitShellCommandMode:o};let a=E(l=>{r.current.onComposerPaste(l)},[]),s=E((l,d)=>{r.current.submitComposer(l,d)},[]),i=E(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}le();var L1=yt(null);function A1({children:e}){let{data:t,target:n,threadKey:o}=$o(),r=t.useComposerStatus({target:n,threadKey:o});return u(L1.Provider,{value:r,children:e})}function R1(){let e=Ot(L1);if(e===null)throw new Error("Composer status has not been provided.");return e}var E1=ye(function(t){let n=hE(),{data:o,target:r,threadKey:a}=$o(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:c,activePendingDraftAnswers:f,activePendingQuestionIndex:p,questionAttachmentsSupported:m,respondingRequestIds:g,occupants:h,respondToApproval:v,respondToDecision:y,selectUserInputOption:C,changeUserInputCustomAnswer:x,advanceUserInput:b,previousUserInputQuestion:w}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:I,interactionMode:k,lockedProvider:P,providerStatuses:T,activeProjectDefaultModelSelection:L,projectId:A,activeThreadModelSelection:M}=o.useComposerModelContext(r),{activeThreadId:R,activeThread:D,isLocalDraftThread:H,projectSelectionRequired:W,phase:F,isSendBusy:J,sendDisabledReason:O,unavailableAgentInstanceId:B=null,noAgentChosen:Y=!1,isPreparingWorktree:U,environmentUnavailable:X,compactDisabled:re,compactDisabledReason:G}=R1(),{t:te}=pe(),{composerDraftTarget:oe,environmentId:Z,attachmentUploadsCapabilityKnown:ee,supportsAttachmentUploads:fe,routeKind:Re,routeThreadRef:Be,draftId:Se,forceExpandedOnMobile:Ee,settings:ne,keybindings:we,terminalOpen:j,gitCwd:ue,promptRef:ge,composerRef:ie,composerImagesRef:He,composerTerminalContextsRef:Pt,composerElementContextsRef:ct,sendContextRef:gt,onSend:bt,onInterrupt:ut,interruptArmed:mt=!1,onCompactContext:st,onImplementPlanInNewThread:lt,onProviderInstanceSelect:At,onModelSelectionChosen:Wt,handleRuntimeModeChange:fn,handleInteractionModeChange:at,handleNativeModeChange:Mt,focusComposer:Ht,setThreadError:nn}=t,Kt=o.useComposerPlan(r),jt=Kt.proposedPlan,yn=Kt.tasksProgress,$=Kt.taskSteps,ae=i.length===0&&k==="plan"&&jt!==null,de=N(null),{pendingPrimaryAction:Pe,onSelectActivePendingUserInputOption:_e,onRespondToApproval:ft,onRespondToComposerDecision:pn,onAdvanceActivePendingUserInput:St}=VE({t:te,threadId:r.threadId,setThreadError:nn,promptRef:ge,promptInputRef:de,respondToApproval:v,respondToDecision:y,selectUserInputOption:C,advanceUserInput:b,activePendingProgress:l,activePendingIsResponding:c,activePendingResolvedAnswers:d}),ht=t.api,{limits:kt}=t.attachments,je=ht.draft.useThreadDraftSelector(oe,bo=>T1(bo,ht.chat.deriveComposerSendState)),Qt=i[0]??null,{questionAttachmentTarget:Zt,attachmentTarget:Te,attachmentDocumentKey:$e}=zE({supported:m,attachments:t.attachments,environmentId:Z,threadId:R,requestId:Qt?.requestId??null,question:l?.activeQuestion??null,responding:c,composerDraftTarget:oe}),qe=ht.draft.useThreadDraftSelector(Te,UE),ot=qe.images,rt=je.terminalContexts,tt=je.elementContexts,It=je.previewAnnotations,Bt=je.reviewComments,wn=qe.nonPersistedImageIds,on=ht.uploads.useStore(bo=>bo.uploadsByImageId),mn=fe?xE({imageIds:ot.map(bo=>bo.id),uploadsByImageId:on,environmentId:Z},te):null,{setComposerDraftPrompt:Hn,setComposerDraftNativeMode:En,addComposerDraftImage:Ce,addComposerDraftImages:Ze,removeComposerDraftImage:_t,insertComposerDraftTerminalContext:vt,removeComposerDraftElementContext:cn,removeComposerDraftPreviewAnnotation:vn,removeComposerDraftReviewComment:ln,clearComposerDraftPromptAndImages:en}=P1(ht);q(()=>{if(ee){if(!fe){for(let bo of ot)ht.uploads.release(bo.id);return}ht.draft.restoreAttachments();for(let bo of ot)ht.uploads.start({environmentId:Z,image:bo})}},[ee,ot,Z,fe]);let Kn=l!==null,Dt=PM({api:ht,t:te,settings:ne,composerDraft:je,composerDraftTarget:oe,environmentId:Z,gitCwd:ue,routeKind:Re,threadId:r.threadId,activeThread:D,isLocalDraftThread:H,unavailableAgentInstanceId:B,agentNotChosen:Y,runtimeMode:I,lockedProvider:P,providerStatuses:T,projectId:A,activeProjectDefaultModelSelection:L,activeThreadModelSelection:M,compactDisabledReason:G,externalSendDisabledReason:O,attachmentBlockReason:mn,answeringQuestion:Kn,setComposerDraftNativeMode:En,handleNativeModeChange:Mt,onProviderInstanceSelect:At,onModelSelectionChosen:Wt}),{selectedInstanceId:Tn,noProviderAvailable:Qn,selectedProvider:$r,composerModelOptions:Na,selectedModel:ze,selectedProviderModels:qr,sendDisabledReason:Do,isSendDisabled:Vr,setModelSendBlockShown:Ts,isModelSendBlocked:Oo}=Dt,Cn=CE(Z,oe),[Ir,Wr]=Q(!1),[Ps,uo]=Q(null),[Mn,Gr]=Q(null),[jr,Ke]=Q(!1),[fo,_a]=Q(!1),[Da,Oa]=Q(null),[wr,ks]=Q({key:0,active:!1}),Fo=N(Cn);xe(()=>{Fo.current!==Cn&&(Fo.current=Cn,Wr(!1),uo(null),Ke(!1),_a(!1),Oa(null),ks({key:wr.key,active:!1}))},[Cn,wr.key]);let Tr=Yf("max-sm"),Pn=N(null),Pr=N(null),Qr=N(null),Hi=N(null),Ls=N(!1),As=N(new Map),{isComposerCollapsedMobile:gn,blurMobileComposerAfterSend:Ki,expandMobileComposer:Xr,scheduleComposerCollapseCheck:Rs,handleFormFocusCapture:ld}=qE({isMobileViewport:Tr,forceExpandedOnMobile:Ee,composerEditorRef:Pn,composerSurfaceRef:Hi,composerFormRef:Qr}),po=E(()=>{Wr(!0)},[]),Fa=E(bo=>{at(bo)},[at]),Xn=s!==null,Ve=l?.activeQuestion?.allowFreeform===!1,Rt=h[0]??null,{showTopDrawer:dn,showCollapsedPromptRow:xn,hasBlocking:Ba}=yE(Rt?.kind??null,gn),$i=ae||l!==null,{isComposerFooterCompact:dd,isComposerPrimaryActionsCompact:Ua}=IE(Qr,$i),qi=kM({api:ht,settings:ne,routeKind:Re,routeThreadRef:Be,draftId:Se,selectedProvider:$r,selectedInstanceId:Tn,selectedModel:ze,selectedProviderModels:qr,composerModelOptions:Na});q(()=>{uo(null)},[tt,It,Bt,rt,ze,Dt.selectedModelOptionsForDispatch,$r]),$E({composerImages:ot,composerImagesRef:He,composerTerminalContexts:rt,composerTerminalContextsRef:Pt,composerElementContexts:tt,composerElementContextsRef:ct});let Yr=YE({api:ht,t:te,limits:kt,composerDraftTarget:oe,composerDraft:je,composerDocumentKey:Cn,promptRef:ge,promptInputRef:de,providerInputRejectedRef:Ls,pendingImageCompressionsRef:As,setComposerDraftPrompt:Hn,setModelSendBlockShown:Ts,onSend:bt,onCompactContext:st,blurMobileComposerAfterSend:Ki,isMobileViewport:Tr,isComposerApprovalState:Xn,activePendingApproval:s,activePendingProgress:l,activePendingResolvedAnswers:d,pendingUserInputCount:i.length,activeThreadId:R,phase:F,isSendBusy:J,environmentUnavailable:X,compactDisabled:re,noProviderAvailable:Qn,isSendDisabled:Vr,sendDisabledReason:Do,isModelSendBlocked:Oo,showPlanFollowUpPrompt:ae}),Jr=DE({api:ht,t:te,limits:kt,promptRef:ge,promptInputRef:de,composerEditorRef:Pn,composerImagesRef:He,composerDraftTarget:oe,setComposerDraftPrompt:Hn,addComposerDraftImages:Ze,clearComposerDraftPromptAndImages:en,setIsStashMenuOpen:Ke,setStashPulse:ks,isComposerCollapsedMobile:gn,expandMobileComposer:Xr,keybindings:we,terminalOpen:j,isComposerModelPickerOpen:Ir,hasPendingUserInputs:i.length>0,isComposerApprovalState:Xn,projectSelectionRequired:W,answeringQuestion:Kn}),cd=tM({activeThreadId:R,activeThread:D,activeTasksProgress:yn,activeTaskSteps:$,isTasksDrawerOpen:fo,setIsTasksDrawerOpen:_a,dismissedTasksTurnId:Da,setDismissedTasksTurnId:Oa,stashQueue:Jr.stashQueue,isStashMenuOpen:jr,stashPulse:wr,toggleInlineStashMenu:Jr.toggleInlineStashMenu,isComposerApprovalState:Xn,externalDrawerAttached:n,showComposerTopDrawer:dn,isComposerCollapsedMobile:gn,hasBlockingComposerTopDrawer:Ba}),Pg=E(bo=>{uo(null),Yr.revalidatePromptLength(bo),Ke(!1)},[Yr.revalidatePromptLength]),{addComposerImages:ku,removeComposerImage:kg,onComposerAttachmentInputChange:Lg}=BE({api:ht,t:te,limits:kt,setThreadError:nn,activeThreadId:R,answerQuestionsFirst:i.length>0&&Zt===null,attachmentTarget:Te,attachmentDocumentKey:$e,supportsAttachmentUploads:fe,pendingImageCompressionsRef:As,addComposerDraftImage:Ce,addComposerDraftImages:Ze,removeComposerDraftImage:_t}),{onComposerPaste:Ag,insertComposerTextAtEnd:Rg,addDroppedFolders:Eg,isDragOverComposer:z,composerMentionDragHandlers:Le,onComposerMentionDragLeaveCapture:nt}=_E({api:ht,t:te,addComposerImages:ku,attachments:t.attachments,promptRef:ge,promptInputRef:de,composerEditorRef:Pn,composerFormRef:Qr,composerThreadKey:a,attachmentDocumentKey:$e,attachmentImagesRef:He,limits:kt,supportsAttachmentUploads:fe,composerDocumentKey:Cn,isComposerApprovalState:Xn,pasteBlocked:i.length>0&&Zt===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:W,environmentId:Z}),$t=E(()=>{ut()},[ut]),$n=E(()=>{lt()},[lt]),{handleComposerPaste:za,handleComposerSubmit:Mg,handleUnclaimedEscape:z1}=k1({onComposerPaste:Ag,submitComposer:Yr.submitComposerOrShellCommand,exitShellCommandMode:Yr.exitShellCommandMode});return KE({composerRef:ie,sendContextRef:gt,api:ht,t:te,limits:kt,composerData:o,refs:{composerEditorRef:Pn,promptInputRef:de,promptRef:ge,composerImagesRef:He,composerTerminalContextsRef:Pt,composerElementContextsRef:ct,providerInputRejectedRef:Ls},composerDraftTarget:oe,activeThread:D,addComposerImages:ku,addDroppedFolders:Eg,focusComposer:Ht,insertComposerTextAtEnd:Rg,insertComposerDraftTerminalContext:vt,composerPreviewAnnotations:It,composerReviewComments:Bt,isComposerApprovalState:Xn,pendingUserInputCount:i.length,projectSelectionRequired:W,noProviderAvailable:Qn,modelState:Dt,handleRuntimeModeChange:fn,runtimeMode:I,setIsComposerModelPickerOpen:Wr,setProviderInputSubmissionError:uo}),u(RD,{formRef:Qr,onSubmit:Yr.submitComposerOrShellCommand,onFocusCapture:ld,onBlurCapture:Rs,dragHandlers:Le,onDragLeaveCapture:nt,badges:cd,stashQueueLength:Jr.stashQueue.length,isStashMenuOpen:jr,stashPulse:wr,toggleStashMenu:Jr.toggleStashMenu,drawers:u(w1,{composerOccupant:Rt,showComposerTopDrawer:dn,hasBlockingComposerTopDrawer:Ba,isTasksDrawerOpen:fo,isComposerCollapsedMobile:gn,respondingRequestIds:g,keybindings:we,onRespondToApproval:ft,onRespondToDecision:pn,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:_e,onAdvanceActivePendingUserInput:St,activeProposedPlan:jt,activePendingProgress:l,isPendingUserInputChoiceOnly:Ve,expandMobileComposer:Xr,badges:cd,pendingPrimaryAction:Pe,isSendBusy:J,sendDisabledReason:Do,environmentUnavailable:X,noProviderAvailable:Qn,projectSelectionRequired:W,previousUserInputQuestion:w,handleInterruptPrimaryAction:$t,handleImplementPlanInNewThreadPrimaryAction:$n}),children:u(AD,{props:t,composerDraft:je,model:Dt,traits:qi,submit:Yr,stash:Jr,badges:cd,uploadsByImageId:on,composerImages:ot,nonPersistedComposerImageIds:wn,removeComposerImage:kg,removeComposerDraftPreviewAnnotation:vn,removeComposerDraftReviewComment:ln,removeComposerDraftElementContext:cn,onComposerAttachmentInputChange:Lg,surfaceRef:Hi,composerAttachmentInputRef:Pr,promptInputRef:de,composerEditorRef:Pn,composerMenuAnchor:Mn,setComposerMenuAnchor:Gr,composerDocumentKey:Cn,isComposerCollapsedMobile:gn,expandMobileComposer:Xr,isDragOverComposer:z,isComposerApprovalState:Xn,showCollapsedMobilePromptRow:xn,activePendingProgress:l,pendingUserInputs:i,changeUserInputCustomAnswer:x,pendingPrimaryAction:Pe,approvalDetail:s?.detail??null,handleComposerPaste:za,handleComposerSubmit:Mg,onPromptEdited:Pg,handleUnclaimedEscape:z1,openModelPicker:po,switchInteractionMode:Fa,providerInputSubmissionError:Ps,isStashMenuOpen:jr,isComposerFooterCompact:dd,isComposerPrimaryActionsCompact:Ua,isMobileViewport:Tr,isComposerModelPickerOpen:Ir,setIsComposerModelPickerOpen:Wr,showPlanFollowUpPrompt:ae,compactDisabled:re,compactThreadContext:Yr.compactThreadContext,status:{projectSelectionRequired:W,isSendBusy:J,environmentUnavailable:X,interruptArmed:mt,agentNotChosen:Y,unavailableAgentInstanceId:B,lockedProvider:P,phase:F,isPreparingWorktree:U,activeThread:D,interactionMode:k,runtimeMode:I},actions:{previousUserInputQuestion:w,handleInterruptPrimaryAction:$t,handleImplementPlanInNewThreadPrimaryAction:$n}})})});function M1(e){let{composerRef:t,...n}=e;return u(Lm,{value:n.api,children:u(E1,{...n,composerRef:t})})}function id({section:e,resetKey:t,children:n}){return u(sl,{resetKey:t,fallback:o=>B8(e,o),children:n})}function B8(e,t){return u(U8,{section:e,error:t})}function U8({section:e,error:t}){let{t:n}=dt();return S("div",{role:"status","data-conversation-section-error":e,className:e==="composer"||e==="queue"?"pointer-events-auto mx-auto flex w-full max-w-3xl items-start gap-2 rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm":"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",children:[u(hn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive"}),S("div",{className:"min-w-0",children:[u("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),u("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function N1({hostVersion:e,scopeClass:t}){let{t:n}=dt();return S("div",{role:"status","data-conversation-host-data-mismatch":!0,className:K("flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",t),children:[u(hn,{"aria-hidden":!0,className:"size-5 text-destructive"}),u("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),u("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:pd})})]})}function _1(e){let{data:t}=e;return t?.version!==pd?u(N1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(Uu.Provider,{value:e.scope.active,children:u(K8,{...e,data:t})})}var z8=ye(function({threadKey:t,onModeChange:n}){let[o]=Ft("turn-navigator",t,null),r=E(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:u(hS,{...o,placement:"inline",onSelect:r})});function H8({slots:e,children:t}){let{data:n,target:o,threadKey:r}=$o(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function K8(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:s}=e,[,i]=Ft("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,c=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,g=V(()=>l?S(Ie,{children:[d,u("div",{className:"min-w-0 flex-1"}),c]}):S(Ie,{children:[d,u(fS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(z8,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,c,f,p,m,t.threadKey]),{belowSlot:h,draftHero:v,onOverlayElementChange:y,sessionActions:C,terminalControl:x,agentsControl:b,contextStrip:w,...I}=a,k=u(M1,{...I,attachments:e.attachments,firstRow:g}),P=V(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[T,L]=Ft("trajectory-reveal",t.threadKey,null),A=E(G=>{n.onModeChange("chat"),L(te=>({rowId:G,nonce:(te?.nonce??0)+1}))},[n,L]),M=E(()=>L(null),[L]),R=N(null),{t:D}=pe(),H=N(a.api);H.current=a.api;let W=E(G=>H.current.notify.warning(D(`timeline.quote.${G}`)),[D]),[F,J]=Ft("timeline-quote-reveal",t.threadKey,null);q(()=>{let G=R.current;if(!G)return;let te=oe=>{let Z=oe.detail?.quote;if(Z){if(Z.environmentId!==P.environmentId||Z.threadId!==P.threadId){W("otherThread");return}n.onModeChange("chat"),J({quote:Z})}};return G.addEventListener(Hg,te),()=>G.removeEventListener(Hg,te)},[n,J,P.environmentId,P.threadId,W]);let O=E(G=>{J(null),G==="message-missing"&&W("messageMissing"),G==="passage-missing"&&W("passageMissing")},[J,W]),B=V(()=>({data:s,target:P,threadKey:t.threadKey}),[s,P,t.threadKey]),{controlRef:Y,...U}=o,X=s.useChatWindow({target:P,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),re=fw({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:X.onReturnToLatest,controlRef:Y});return S("div",{ref:R,className:K("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(IS,{data:s,target:P,threadKey:t.threadKey,surfaceRef:R}),u(pS,{chat:S(id,{section:"chat",resetKey:t.threadKey,children:[u(rw,{data:s,target:P,visible:t.visible,...U,paneActive:t.active,liveFollowEnabled:re.liveFollowEnabled,scrollerRef:re.bindTimelineHandle,onRowsChange:re.onRowsChange,onIsAtEndChange:re.onIsAtEndChange,onManualNavigation:re.onManualNavigation,onDisclosureNavigation:re.onDisclosureNavigation,loadEarlier:X.loadEarlier,loadLater:X.loadLater,pagingBlockedByInteraction:X.pagingBlockedByInteraction,onVisibleTurnRangeChange:X.onVisibleTurnRangeChange,onReturnToLatest:X.loadLater===null?null:re.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:T,revealQuoteRequest:F,onRevealQuoteDone:O,onRevealMessageHandled:M}),u(lw,{data:s,target:P,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:re.showScrollToEnd,onScrollToEnd:re.returnToEnd})]},"chat"),mode:n.mode,trajectory:u(id,{section:"trajectory",resetKey:t.threadKey,children:u(vw,{data:s,target:P,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:A})},"trajectory"),visible:t.visible}),u(vE,{data:s,target:P,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(id,{section:"composer",resetKey:t.threadKey,children:u(Of,{value:B,children:u(A1,{children:u(H8,{slots:a.slots,children:k})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,questions:u(id,{section:"composer",resetKey:t.threadKey,children:u(dE,{data:s,target:P})}),queue:u(id,{section:"queue",resetKey:t.threadKey,children:u(lE,{data:s,target:P,inputKey:t.threadKey,attachments:e.attachments})})})]})}le();var $8=[],q8=[],V8="prompt-font-preview",D1="max-h-40 min-h-12";function O1(){}function W8(e){let t=0;return ba(e).map(n=>{let o=t;return t+=n.type==="text"?n.text.length:n.type==="mention"?n.source.length:n.type==="skill"?n.name.length+1:1,{key:o,segment:n}})}function G8(e){return u("div",{className:LC,children:u("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:K(AC,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:u("p",{children:W8(e.prompt).map(({key:t,segment:n})=>n.type==="mention"?u("span",{className:Sa,children:u(Rm,{path:n.path,theme:e.theme})},t):n.type==="skill"?u("span",{className:Sa,children:u(Em,{label:Zo({name:n.name})})},t):n.type==="text"?u("span",{children:n.text},t):null)})})})}function F1(){let{t:e}=pe(),t=e("composer.idlePlaceholder"),n=Et().theme.useResolvedTheme()==="dark"?"dark":"light",o=e("composer.fontPreviewSample"),r=N(null),[a,s]=Q(null),i=a?.prompt??o,l=a?.cursor??o.length,[d,c]=Q(!1),f=E((m,g)=>{s({prompt:m,cursor:g})},[]),p=E(()=>c(!0),[]);return q(()=>{d&&r.current?.focusAtEnd()},[d]),u("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:d?u(Gl,{documentKey:V8,editorRef:r,value:i,cursor:l,terminalContexts:$8,skills:q8,disabled:!1,placeholder:t,className:D1,onRemoveTerminalContext:O1,onChange:f,onPaste:O1}):u(G8,{className:D1,onActivate:p,placeholder:t,prompt:i,theme:n})})}var j8=".ycodium-conversation-ui";function Q8(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function B1(e,t="conversation"){let n=Q8(),o=e.replaceAll(j8,`.${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 X8(e){let t=B1(db);return{views:{[Nu]:Y8(t,e),[Ug]:J8(t,e)},viewCapabilities:{[Nu]:[zg,pb]},slots:[{name:"conversation.input.agent",order:0,component:uM},{name:"conversation.input.model",order:0,component:eD},{name:"conversation.input.plan",order:0,component:rD},{name:"conversation.input.permission",order:0,component:oD}]}}function Y8(e,t){return function(o){let a=o[_u]??t,s={...o};return delete s[_u],S(Fg,{value:a,children:[u(U1,{retain:e.retain}),u(Bg,{value:e.scopeClass,children:u(_1,{...s,scopeClass:e.scopeClass})})]})}}function J8(e,t){return function(o){return S(Fg,{value:t,children:[u(U1,{retain:e.retain}),u(Bg,{value:e.scopeClass,children:u(Lm,{value:o.api,children:u("div",{className:e.scopeClass,children:u(F1,{})})})})]})}}function U1({retain:e}){return fd(()=>e(),[e]),null}export{X8 as default};