@ycodium-ai/plugin-conversation 0.2.5029 → 0.2.5100
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 +63 -81
- package/dist/index.js +1 -1
- package/locales/en.json +0 -1
- package/locales/zh-CN.json +0 -1
- package/package.json +8 -4
package/assets/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var yO=Object.create;var Cu=Object.defineProperty;var vO=Object.getOwnPropertyDescriptor;var CO=Object.getOwnPropertyNames;var xO=Object.getPrototypeOf,bO=Object.prototype.hasOwnProperty;var Ix=(e,t,o)=>()=>{if(o)throw o[0];try{return e&&(t=e(e=0)),t}catch(n){throw o=[n],n}};var Sx=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(o){throw t=0,o}},Ut=(e,t)=>{for(var o in t)Cu(e,o,{get:t[o],enumerable:!0})},kx=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of CO(t))!bO.call(e,r)&&r!==o&&Cu(e,r,{get:()=>t[r],enumerable:!(n=vO(t,r))||n.enumerable});return e};var Lx=(e,t,o)=>(o=e!=null?yO(xO(e)):{},kx(t||!e||!e.__esModule?Cu(o,"default",{value:e,enumerable:!0}):o,e)),wO=e=>kx(Cu({},"__esModule",{value:!0}),e);var Mx={};Ut(Mx,{Activity:()=>IO,Children:()=>SO,Component:()=>ur,Fragment:()=>Aa,Profiler:()=>kO,PureComponent:()=>LO,StrictMode:()=>PO,Suspense:()=>vg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>RO,__COMPILER_RUNTIME:()=>EO,act:()=>MO,cache:()=>AO,cacheSignal:()=>NO,captureOwnerStack:()=>DO,cloneElement:()=>Ex,createContext:()=>qe,createElement:()=>vn,createRef:()=>_O,default:()=>Zt,forwardRef:()=>$n,isValidElement:()=>OO,lazy:()=>FO,memo:()=>pe,startTransition:()=>BO,unstable_useCacheRefresh:()=>HO,use:()=>xe,useActionState:()=>UO,useCallback:()=>R,useContext:()=>Pt,useDebugValue:()=>$O,useDeferredValue:()=>zO,useEffect:()=>H,useEffectEvent:()=>Cg,useId:()=>ho,useImperativeHandle:()=>pr,useInsertionEffect:()=>Rl,useLayoutEffect:()=>fe,useMemo:()=>W,useOptimistic:()=>KO,useReducer:()=>Na,useRef:()=>E,useState:()=>q,useSyncExternalStore:()=>Go,useTransition:()=>qO,version:()=>WO});var Rx,Zt,IO,SO,ur,Aa,kO,LO,PO,vg,RO,EO,MO,AO,NO,DO,Ex,qe,vn,_O,$n,OO,FO,pe,BO,HO,xe,UO,R,Pt,$O,zO,H,Cg,ho,pr,Rl,fe,W,KO,Na,E,q,Go,qO,WO,$=Ix(()=>{Rx=window.__ycodiumPluginHost.react,Zt=Rx,{Activity:IO,Children:SO,Component:ur,Fragment:Aa,Profiler:kO,PureComponent:LO,StrictMode:PO,Suspense:vg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:RO,__COMPILER_RUNTIME:EO,act:MO,cache:AO,cacheSignal:NO,captureOwnerStack:DO,cloneElement:Ex,createContext:qe,createElement:vn,createRef:_O,forwardRef:$n,isValidElement:OO,lazy:FO,memo:pe,startTransition:BO,unstable_useCacheRefresh:HO,use:xe,useActionState:UO,useCallback:R,useContext:Pt,useDebugValue:$O,useDeferredValue:zO,useEffect:H,useEffectEvent:Cg,useId:ho,useImperativeHandle:pr,useInsertionEffect:Rl,useLayoutEffect:fe,useMemo:W,useOptimistic:KO,useReducer:Na,useRef:E,useState:q,useSyncExternalStore:Go,useTransition:qO,version:WO}=Rx});var jS=Sx(Io=>{"use strict";var m$=($(),wO(Mx));function GS(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)t+="&args[]="+encodeURIComponent(arguments[o])}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 oa(){}var To={d:{f:oa,r:function(){throw Error(GS(522))},D:oa,C:oa,L:oa,m:oa,X:oa,S:oa,M:oa},p:0,findDOMNode:null},f$=Symbol.for("react.portal");function g$(e,t,o){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f$,key:n==null?null:""+n,children:e,containerInfo:t,implementation:o}}var Ud=m$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Dp(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Io.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=To;Io.createPortal=function(e,t){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(GS(299));return g$(e,t,null,o)};Io.flushSync=function(e){var t=Ud.T,o=To.p;try{if(Ud.T=null,To.p=2,e)return e()}finally{Ud.T=t,To.p=o,To.d.f()}};Io.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,To.d.C(e,t))};Io.prefetchDNS=function(e){typeof e=="string"&&To.d.D(e)};Io.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var o=t.as,n=Dp(o,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;o==="style"?To.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:r,fetchPriority:a}):o==="script"&&To.d.X(e,{crossOrigin:n,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Io.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var o=Dp(t.as,t.crossOrigin);To.d.M(e,{crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&To.d.M(e)};Io.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var o=t.as,n=Dp(o,t.crossOrigin);To.d.L(e,o,{crossOrigin:n,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})}};Io.preloadModule=function(e,t){if(typeof e=="string")if(t){var o=Dp(t.as,t.crossOrigin);To.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else To.d.m(e)};Io.requestFormReset=function(e){To.d.r(e)};Io.unstable_batchedUpdates=function(e,t){return e(t)};Io.useFormState=function(e,t,o){return Ud.H.useFormState(e,t,o)};Io.useFormStatus=function(){return Ud.H.useHostTransitionStatus()};Io.version="19.2.6"});var gh=Sx((xle,QS)=>{"use strict";function VS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(VS)}catch(e){console.error(e)}}VS(),QS.exports=jS()});var Pke,v_,ZC,C_,x_,MG,Rke,Eke,Mke,b_=Ix(()=>{Pke=(()=>{try{return!1}catch{return!1}})(),v_=/(?=^From [a-f0-9]+ .+$)/m,ZC=/(?=^diff --git)/gm,C_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,x_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,MG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Rke={...MG,hunkLineCount:1},Eke=Object.freeze({fromStart:0,fromEnd:0}),Mke=Object.freeze([])});var Px=`/*! 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 {
|
|
@@ -685,9 +685,6 @@ var dO=Object.create;var Tu=Object.defineProperty;var cO=Object.getOwnPropertyDe
|
|
|
685
685
|
.max-w-xl:where(:scope, *) {
|
|
686
686
|
max-width: var(--container-xl, 36rem);
|
|
687
687
|
}
|
|
688
|
-
.max-w-xs:where(:scope, *) {
|
|
689
|
-
max-width: var(--container-xs, 20rem);
|
|
690
|
-
}
|
|
691
688
|
.min-w-0:where(:scope, *) {
|
|
692
689
|
min-width: calc(var(--spacing, 0.25rem) * 0);
|
|
693
690
|
}
|
|
@@ -754,9 +751,6 @@ var dO=Object.create;var Tu=Object.defineProperty;var cO=Object.getOwnPropertyDe
|
|
|
754
751
|
.animate-\\[prompt-stash-count-enter_180ms_ease-out_both\\]:where(:scope, *) {
|
|
755
752
|
animation: prompt-stash-count-enter 180ms ease-out both;
|
|
756
753
|
}
|
|
757
|
-
.animate-status-pulse:where(:scope, *) {
|
|
758
|
-
animation: status-pulse 2s infinite;
|
|
759
|
-
}
|
|
760
754
|
.cursor-\\[var\\(--control-cursor\\)\\]:where(:scope, *) {
|
|
761
755
|
cursor: var(--control-cursor);
|
|
762
756
|
}
|
|
@@ -1751,6 +1745,9 @@ var dO=Object.create;var Tu=Object.defineProperty;var cO=Object.getOwnPropertyDe
|
|
|
1751
1745
|
.whitespace-pre-wrap:where(:scope, *) {
|
|
1752
1746
|
white-space: pre-wrap;
|
|
1753
1747
|
}
|
|
1748
|
+
.text-\\[var\\(--control-disabled-foreground\\)\\]:where(:scope, *) {
|
|
1749
|
+
color: var(--control-disabled-foreground);
|
|
1750
|
+
}
|
|
1754
1751
|
.text-accent-foreground:where(:scope, *) {
|
|
1755
1752
|
color: var(--contrast-accent-foreground);
|
|
1756
1753
|
}
|
|
@@ -3442,19 +3439,6 @@ var dO=Object.create;var Tu=Object.defineProperty;var cO=Object.getOwnPropertyDe
|
|
|
3442
3439
|
background-color: color-mix(in oklab, var(--color-primary) 30%, transparent);
|
|
3443
3440
|
}
|
|
3444
3441
|
}
|
|
3445
|
-
@keyframes status-pulse {
|
|
3446
|
-
0%, 40% {
|
|
3447
|
-
opacity: 1;
|
|
3448
|
-
animation-timing-function: steps(6);
|
|
3449
|
-
}
|
|
3450
|
-
50%, 90% {
|
|
3451
|
-
opacity: 0.5;
|
|
3452
|
-
animation-timing-function: steps(6);
|
|
3453
|
-
}
|
|
3454
|
-
100% {
|
|
3455
|
-
opacity: 1;
|
|
3456
|
-
}
|
|
3457
|
-
}
|
|
3458
3442
|
@layer properties {
|
|
3459
3443
|
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
3460
3444
|
*, ::before, ::after, ::backdrop {
|
|
@@ -3530,89 +3514,87 @@ var dO=Object.create;var Tu=Object.defineProperty;var cO=Object.getOwnPropertyDe
|
|
|
3530
3514
|
}
|
|
3531
3515
|
}
|
|
3532
3516
|
}
|
|
3533
|
-
`;$();$();var _x=qe(null),Ks=_x.Provider,Ox=qe(""),Iu=Ox.Provider;function Su(){return Rt(Ox)}function Nt(){let e=Rt(_x);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var ku="ycodium:assistant-quote-open",qs="ycodium:thread-reference-open";var Lu="conversation",kg="conversation.prompt-preview";var Ru="__ycodiumConversationBridge",Lg="ycodium.conversation.rebindable-bridge.v1",Rg="conversation.pendingRequests";var Dl=18,Fx=`ycodium.conversation.host-data.v${Dl}`,Bx=80,gr="\uFFFC";$();function Hx(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(o=Hx(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function Ux(){for(var e,t,o=0,n="",r=arguments.length;o<r;o++)(e=arguments[o])&&(t=Hx(e))&&(n&&(n+=" "),n+=t);return n}var $x=Ux;var BO=(e,t)=>{let o=new Array(e.length+t.length);for(let n=0;n<e.length;n++)o[n]=e[n];for(let n=0;n<t.length;n++)o[e.length+n]=t[n];return o},HO=(e,t)=>({classGroupId:e,validator:t}),Qx=(e=new Map,t=null,o)=>({nextPart:e,validators:t,classGroupId:o});var zx=[],UO="arbitrary..",$O=e=>{let t=KO(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return zO(s);let i=s.split("-"),d=i[0]===""&&i.length>1?1:0;return Xx(i,d,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let d=n[s],c=o[s];return d?c?BO(c,d):d:c||zx}return o[s]||zx}}},Xx=(e,t,o)=>{if(e.length-t===0)return o.classGroupId;let r=e[t],a=o.nextPart.get(r);if(a){let c=Xx(e,t+1,a);if(c)return c}let s=o.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),d=s.length;for(let c=0;c<d;c++){let u=s[c];if(u.validator(i))return u.classGroupId}},zO=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),o=t.indexOf(":"),n=t.slice(0,o);return n?UO+n:void 0})(),KO=e=>{let{theme:t,classGroups:o}=e;return qO(o,t)},qO=(e,t)=>{let o=Qx();for(let n in e){let r=e[n];Mg(r,o,n,t)}return o},Mg=(e,t,o,n)=>{let r=e.length;for(let a=0;a<r;a++){let s=e[a];WO(s,t,o,n)}},WO=(e,t,o,n)=>{if(typeof e=="string"){GO(e,t,o);return}if(typeof e=="function"){jO(e,t,o,n);return}VO(e,t,o,n)},GO=(e,t,o)=>{let n=e===""?t:Yx(t,e);n.classGroupId=o},jO=(e,t,o,n)=>{if(QO(e)){Mg(e(n),t,o,n);return}t.validators===null&&(t.validators=[]),t.validators.push(HO(o,e))},VO=(e,t,o,n)=>{let r=Object.entries(e),a=r.length;for(let s=0;s<a;s++){let[i,d]=r[s];Mg(d,Yx(t,i),o,n)}},Yx=(e,t)=>{let o=e,n=t.split("-"),r=n.length;for(let a=0;a<r;a++){let s=n[a],i=o.nextPart.get(s);i||(i=Qx(),o.nextPart.set(s,i)),o=i}return o},QO=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,XO=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=Object.create(null),n=Object.create(null),r=(a,s)=>{o[a]=s,t++,t>e&&(t=0,n=o,o=Object.create(null))};return{get(a){let s=o[a];if(s!==void 0)return s;if((s=n[a])!==void 0)return r(a,s),s},set(a,s){a in o?o[a]=s:r(a,s)}}};var YO=[],Kx=(e,t,o,n,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:o,maybePostfixModifierPosition:n,isExternal:r}),JO=e=>{let{prefix:t,experimentalParseClassName:o}=e,n=r=>{let a=[],s=0,i=0,d=0,c,u=r.length;for(let h=0;h<u;h++){let y=r[h];if(s===0&&i===0){if(y===":"){a.push(r.slice(d,h)),d=h+1;continue}if(y==="/"){c=h;continue}}y==="["?s++:y==="]"?s--:y==="("?i++:y===")"&&i--}let m=a.length===0?r:r.slice(d),p=m,f=!1;m.endsWith("!")?(p=m.slice(0,-1),f=!0):m.startsWith("!")&&(p=m.slice(1),f=!0);let g=c&&c>d?c-d:void 0;return Kx(a,f,p,g)};if(t){let r=t+":",a=n;n=s=>s.startsWith(r)?a(s.slice(r.length)):Kx(YO,!1,s,void 0,!0)}if(o){let r=n;n=a=>o({className:a,parseClassName:r})}return n},ZO=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((o,n)=>{t.set(o,1e6+n)}),o=>{let n=[],r=[];for(let a=0;a<o.length;a++){let s=o[a],i=s[0]==="[",d=t.has(s);i||d?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(s)):r.push(s)}return r.length>0&&(r.sort(),n.push(...r)),n}},e2=e=>({cache:XO(e.cacheSize),parseClassName:JO(e),sortModifiers:ZO(e),postfixLookupClassGroupIds:t2(e),...$O(e)}),t2=e=>{let t=Object.create(null),o=e.postfixLookupClassGroups;if(o)for(let n=0;n<o.length;n++)t[o[n]]=!0;return t},o2=/\s+/,n2=(e,t)=>{let{parseClassName:o,getClassGroupId:n,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:s}=t,i=[],d=e.trim().split(o2),c="";for(let u=d.length-1;u>=0;u-=1){let m=d[u],{isExternal:p,modifiers:f,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:y}=o(m);if(p){c=m+(c.length>0?" "+c:c);continue}let x=!!y,C;if(x){let I=h.substring(0,y);C=n(I);let T=C&&s[C]?n(h):void 0;T&&T!==C&&(C=T,x=!1)}else C=n(h);if(!C){if(!x){c=m+(c.length>0?" "+c:c);continue}if(C=n(h),!C){c=m+(c.length>0?" "+c:c);continue}x=!1}let b=f.length===0?"":f.length===1?f[0]:a(f).join(":"),L=g?b+"!":b,w=L+C;if(i.indexOf(w)>-1)continue;i.push(w);let k=r(C,x);for(let I=0;I<k.length;++I){let T=k[I];i.push(L+T)}c=m+(c.length>0?" "+c:c)}return c},r2=(...e)=>{let t=0,o,n,r="";for(;t<e.length;)(o=e[t++])&&(n=Jx(o))&&(r&&(r+=" "),r+=n);return r},Jx=e=>{if(typeof e=="string")return e;let t,o="";for(let n=0;n<e.length;n++)e[n]&&(t=Jx(e[n]))&&(o&&(o+=" "),o+=t);return o},qx=(e,...t)=>{let o,n,r,a,s=d=>{let c=t.reduce((u,m)=>m(u),e());return o=e2(c),n=o.cache.get,r=o.cache.set,a=i,i(d)},i=d=>{let c=n(d);if(c)return c;let u=n2(d,o);return r(d,u),u};return a=s,(...d)=>a(r2(...d))},a2=[],Wt=e=>{let t=o=>o[e]||a2;return t.isThemeGetter=!0,t},Zx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,s2=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,i2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,l2=/\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$/,d2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,c2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,u2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ur=e=>s2.test(e),We=e=>!!e&&!Number.isNaN(Number(e)),Gn=e=>!!e&&Number.isInteger(Number(e)),Pg=e=>e.endsWith("%")&&We(e.slice(0,-1)),hr=e=>i2.test(e),tb=()=>!0,p2=e=>l2.test(e)&&!d2.test(e),Ag=()=>!1,m2=e=>c2.test(e),f2=e=>u2.test(e),g2=e=>!Ie(e)&&!Se(e),h2=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)),y2=e=>$r(e,rb,Ag),Ie=e=>Zx.test(e),Oa=e=>$r(e,ab,p2),Wx=e=>$r(e,S2,We),v2=e=>$r(e,ib,tb),C2=e=>$r(e,sb,Ag),Gx=e=>$r(e,ob,Ag),x2=e=>$r(e,nb,f2),Pu=e=>$r(e,lb,m2),Se=e=>eb.test(e),_l=e=>Fa(e,ab),b2=e=>Fa(e,sb),jx=e=>Fa(e,ob),w2=e=>Fa(e,rb),T2=e=>Fa(e,nb),Eu=e=>Fa(e,lb,!0),I2=e=>Fa(e,ib,!0),$r=(e,t,o)=>{let n=Zx.exec(e);return n?n[1]?t(n[1]):o(n[2]):!1},Fa=(e,t,o=!1)=>{let n=eb.exec(e);return n?n[1]?t(n[1]):o:!1},ob=e=>e==="position"||e==="percentage",nb=e=>e==="image"||e==="url",rb=e=>e==="length"||e==="size"||e==="bg-size",ab=e=>e==="length",S2=e=>e==="number",sb=e=>e==="family-name",ib=e=>e==="number"||e==="weight",lb=e=>e==="shadow";var Vx=()=>{let e=Wt("color"),t=Wt("font"),o=Wt("text"),n=Wt("font-weight"),r=Wt("tracking"),a=Wt("leading"),s=Wt("breakpoint"),i=Wt("container"),d=Wt("spacing"),c=Wt("radius"),u=Wt("shadow"),m=Wt("inset-shadow"),p=Wt("text-shadow"),f=Wt("drop-shadow"),g=Wt("blur"),h=Wt("perspective"),y=Wt("aspect"),x=Wt("ease"),C=Wt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...L(),Se,Ie],k=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],T=()=>[Se,Ie,d],S=()=>[Ur,"full","auto",...T()],R=()=>[Gn,"none","subgrid",Se,Ie],A=()=>["auto",{span:["full",Gn,Se,Ie]},Gn,Se,Ie],N=()=>[Gn,"auto",Se,Ie],B=()=>["auto","min","max","fr",Se,Ie],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...T()],D=()=>[Ur,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],X=()=>[Ur,"screen","full","dvw","lvw","svw","min","max","fit",...T()],j=()=>[Ur,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],E=()=>[e,Se,Ie],Y=()=>[...L(),jx,Gx,{position:[Se,Ie]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Z=()=>["auto","cover","contain",w2,y2,{size:[Se,Ie]}],J=()=>[Pg,_l,Oa],ne=()=>["","none","full",c,Se,Ie],te=()=>["",We,_l,Oa],le=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[We,Pg,jx,Gx],ee=()=>["","none",g,Se,Ie],ve=()=>["none",We,Se,Ie],he=()=>["none",We,Se,Ie],Ne=()=>[We,Se,Ie],De=()=>[Ur,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hr],breakpoint:[hr],color:[tb],container:[hr],"drop-shadow":[hr],ease:["in","out","in-out"],font:[g2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hr],shadow:[hr],spacing:["px",We],text:[hr],"text-shadow":[hr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ur,Ie,Se,y]}],container:["container"],"container-type":[{"@container":["","normal","size",Se,Ie]}],"container-named":[h2],columns:[{columns:[We,Ie,Se,i]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[Gn,"auto",Se,Ie]}],basis:[{basis:[Ur,"full","auto",i,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[We,Ur,"auto","initial","none",Ie]}],grow:[{grow:["",We,Se,Ie]}],shrink:[{shrink:["",We,Se,Ie]}],order:[{order:[Gn,"first","last","none",Se,Ie]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...X()]}],"min-inline-size":[{"min-inline":["auto",...X()]}],"max-inline-size":[{"max-inline":["none",...X()]}],"block-size":[{block:["auto",...j()]}],"min-block-size":[{"min-block":["auto",...j()]}],"max-block-size":[{"max-block":["none",...j()]}],w:[{w:[i,"screen",...D()]}],"min-w":[{"min-w":[i,"screen","none",...D()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",o,_l,Oa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,I2,v2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Pg,Ie]}],"font-family":[{font:[b2,C2,t]}],"font-features":[{"font-features":[Ie]}],"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,Se,Ie]}],"line-clamp":[{"line-clamp":[We,"none",Se,Wx]}],leading:[{leading:[a,...T()]}],"list-image":[{"list-image":["none",Se,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[We,"from-font","auto",Se,Oa]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[We,"auto",Se,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[Gn,Se,Ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,Ie]}],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",Se,Ie]}],"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:F()}],"bg-size":[{bg:Z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gn,Se,Ie],radial:["",Se,Ie],conic:[Gn,Se,Ie]},T2,x2]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"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:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[We,Se,Ie]}],"outline-w":[{outline:["",We,_l,Oa]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",u,Eu,Pu]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",m,Eu,Pu]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[We,Oa]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",p,Eu,Pu]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[We,Se,Ie]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[We]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Se,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[We]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:Z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,Ie]}],filter:[{filter:["","none",Se,Ie]}],blur:[{blur:ee()}],brightness:[{brightness:[We,Se,Ie]}],contrast:[{contrast:[We,Se,Ie]}],"drop-shadow":[{"drop-shadow":["","none",f,Eu,Pu]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",We,Se,Ie]}],"hue-rotate":[{"hue-rotate":[We,Se,Ie]}],invert:[{invert:["",We,Se,Ie]}],saturate:[{saturate:[We,Se,Ie]}],sepia:[{sepia:["",We,Se,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,Ie]}],"backdrop-blur":[{"backdrop-blur":ee()}],"backdrop-brightness":[{"backdrop-brightness":[We,Se,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[We,Se,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",We,Se,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[We,Se,Ie]}],"backdrop-invert":[{"backdrop-invert":["",We,Se,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[We,Se,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[We,Se,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",We,Se,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[We,"initial",Se,Ie]}],ease:[{ease:["linear","initial",x,Se,Ie]}],delay:[{delay:[We,Se,Ie]}],animate:[{animate:["none",C,Se,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Se,Ie]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[Se,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:De()}],"translate-x":[{"translate-x":De()}],"translate-y":[{"translate-y":De()}],"translate-z":[{"translate-z":De()}],"translate-none":["translate-none"],zoom:[{zoom:[Gn,Se,Ie]}],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"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",Se,Ie]}],"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":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",Se,Ie]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[We,_l,Oa,Wx]}],stroke:[{stroke:["none",...E()]}],"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"]}},k2=(e,{cacheSize:t,prefix:o,experimentalParseClassName:n,extend:r={},override:a={}})=>(Ws(e,"cacheSize",t),Ws(e,"prefix",o),Ws(e,"experimentalParseClassName",n),Mu(e.theme,a.theme),Mu(e.classGroups,a.classGroups),Mu(e.conflictingClassGroups,a.conflictingClassGroups),Mu(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Ws(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Ws(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Au(e.theme,r.theme),Au(e.classGroups,r.classGroups),Au(e.conflictingClassGroups,r.conflictingClassGroups),Au(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Eg(e,r,"postfixLookupClassGroups"),Eg(e,r,"orderSensitiveModifiers"),e),Ws=(e,t,o)=>{o!==void 0&&(e[t]=o)},Mu=(e,t)=>{if(t)for(let o in t)Ws(e,o,t[o])},Au=(e,t)=>{if(t)for(let o in t)Eg(e,t,o)},Eg=(e,t,o)=>{let n=t[o];n!==void 0&&(e[o]=e[o]?e[o].concat(n):n)},db=(e,...t)=>typeof e=="function"?qx(Vx,e,...t):qx(()=>k2(Vx(),e),...t);var L2=db({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 G(...e){return L2($x(e))}$();var Nu=qe(!0);function cb(){return xe(Nu)}var Ng=qe(void 0);function Tn(){let e=xe(Nu);return xe(Ng)??e}$();var Du=(...e)=>e.filter((t,o,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===o).join(" ").trim();var ub=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var pb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,o,n)=>n?n.toUpperCase():o.toLowerCase());var Dg=e=>{let t=pb(e);return t.charAt(0).toUpperCase()+t.slice(1)};$();var mb={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 fb=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var gb=Wn(({color:e="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:s,...i},d)=>wn("svg",{ref:d,...mb,width:t,height:t,stroke:e,strokeWidth:n?Number(o)*24/Number(t):o,className:Du("lucide",r),...!a&&!fb(i)&&{"aria-hidden":"true"},...i},[...s.map(([c,u])=>wn(c,u)),...Array.isArray(a)?a:[a]]));var Q=(e,t)=>{let o=Wn(({className:n,...r},a)=>wn(gb,{ref:a,iconNode:t,className:Du(`lucide-${ub(Dg(e))}`,`lucide-${e}`,n),...r}));return o.displayName=Dg(e),o};var R2=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],Ol=Q("app-window",R2);var P2=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Ba=Q("archive",P2);var E2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Fl=Q("arrow-down",E2);var M2=[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]],Bl=Q("arrow-up-to-line",M2);var A2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Hl=Q("arrow-up",A2);var N2=[["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"}]],Ha=Q("blocks",N2);var D2=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Ul=Q("book-open",D2);var _2=[["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"}]],Gs=Q("bookmark",_2);var O2=[["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"}]],Ua=Q("bot",O2);var F2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],wo=Q("check",F2);var B2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tt=Q("chevron-down",B2);var H2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],$l=Q("chevron-left",H2);var U2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yo=Q("chevron-right",U2);var $2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],zl=Q("chevrons-left",$2);var z2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Kl=Q("chevrons-right",z2);var K2=[["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"}]],Dt=Q("circle-alert",K2);var q2=[["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"}]],$a=Q("copy",q2);var W2=[["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"}]],Ao=Q("ellipsis",W2);var G2=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ql=Q("eye-off",G2);var j2=[["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"}]],Wl=Q("eye",j2);var V2=[["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"}]],Gl=Q("file-code",V2);var Q2=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],In=Q("file-headphone",Q2);var X2=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],zr=Q("file-pen",X2);var Y2=[["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:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],Kr=Q("file-play",Y2);var J2=[["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"}]],za=Q("file-text",J2);var Z2=[["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:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],jl=Q("file-type",Z2);var eF=[["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"}]],Vl=Q("file",eF);var tF=[["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"}]],qr=Q("folder",tF);var oF=[["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"}]],Ql=Q("frame",oF);var nF=[["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"}]],Xl=Q("git-branch-plus",nF);var rF=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Yl=Q("git-branch",rF);var aF=[["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"}]],Ka=Q("globe",aF);var sF=[["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"}]],Jl=Q("grip-vertical",sF);var iF=[["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"}]],Zl=Q("hammer",iF);var lF=[["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"}]],ed=Q("image",lF);var dF=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],td=Q("info",dF);var cF=[["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"}]],Wr=Q("layers",cF);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"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],od=Q("list-checks",uF);var pF=[["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"}]],nd=Q("list-ordered",pF);var mF=[["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"}]],qa=Q("list-todo",mF);var fF=[["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=Q("list",fF);var gF=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Gr=Q("loader-circle",gF);var hF=[["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"}]],jr=Q("lock-open",hF);var yF=[["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"}]],ad=Q("lock",yF);var vF=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],js=Q("maximize",vF);var CF=[["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"}]],jn=Q("message-circle-question-mark",CF);var xF=[["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"}]],Wa=Q("message-circle",xF);var bF=[["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"}]],Ga=Q("message-square",bF);var wF=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],yr=Q("messages-square",wF);var TF=[["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"}]],sd=Q("minimize-2",TF);var IF=[["path",{d:"M5 12h14",key:"1ays0h"}]],id=Q("minus",IF);var SF=[["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"}]],Vn=Q("mouse-pointer-click",SF);var kF=[["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"}]],ld=Q("package",kF);var LF=[["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"}]],ja=Q("paintbrush",LF);var RF=[["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"}]],Yo=Q("paperclip",RF);var PF=[["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"}]],Qn=Q("pen-line",PF);var EF=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],dd=Q("pencil-ruler",EF);var MF=[["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"}]],cd=Q("pencil",MF);var AF=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ud=Q("plus",AF);var NF=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],pd=Q("puzzle",NF);var DF=[["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"}]],Va=Q("rotate-ccw",DF);var _F=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qa=Q("search",_F);var OF=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],md=Q("send",OF);var FF=[["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=Q("settings",FF);var BF=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Vs=Q("skip-forward",BF);var HF=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Qs=Q("sliders-horizontal",HF);var UF=[["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"}]],Xn=Q("sparkles",UF);var $F=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],No=Q("square-pen",$F);var zF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],gd=Q("square",zF);var KF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],To=Q("terminal",KF);var qF=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],vr=Q("text-quote",qF);var WF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Cr=Q("user-round",WF);var GF=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Vr=Q("wrench",GF);var jF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ot=Q("x",jF);var VF=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],hd=Q("zap",VF);$();function z(){return{t:Nt().i18n.usePluginTranslation()}}$();$();var Qr=qe(null),yd=qe(null);function Xs(e,t){let o=xe(yd);fe(()=>{if(!(!t||e===null||o===null))return o(e)},[o,t,e])}function vd(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,o)=>{e.set(t,(e.get(t)??0)+1),o();let n=!0;return()=>{if(!n)return;n=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),o()}}}}var hb=new Set(["Select","AlertDialog","Dialog","Menu","Popover","Tooltip","ProviderModelPicker","TraitsPicker"]);function de(e){let t=hb.has(e),o=n=>{let r=Nt(),a=Su(),s=Tn(),i=r.ui[e],d={};if(t){let c=xe(Qr),[u,m]=q(n.defaultOpen===!0),p=typeof n.open=="boolean"?n.open:u;Xs(c,s&&p),fe(()=>{s||m(!1)},[s]),d={open:s&&p,onOpenChange:(f,...g)=>{m(f),typeof n.onOpenChange=="function"&&n.onOpenChange(f,...g)}}}return i===void 0&&["MachineName","ProjectName","ProviderName","ThreadName","PluginName"].includes(e)?null:wn(i,{...n,...d,...hb.has(e)&&!s?{open:!1}:{},className:`${a} ${typeof n.className=="string"?n.className:""}`})};return o.displayName=e,o}var $7=de("useLinkContextMenu"),Ys=de("ProviderInstanceIcon"),yb=de("MachineName"),vb=de("ProjectName"),Cb=de("ProviderName"),Cd=de("ThreadName"),Do=de("PluginName"),xb=de("ProviderModelPicker"),bb=de("TraitsPicker"),wb=de("TraitsMenuContent"),Yn=de("ComposerControl"),Jn=de("ComposerControlIcon"),_u=de("ComposerControlChevron"),Ou=de("ComposerSelectControl");function Zn(e,t,o){return Nt().usePluginName?.(e,t,o)??null}function Tb(e,t){return Nt().useThreadName?.(e,t)??null}var Ib=de("UserAvatar"),Xr=de("Badge"),z7=de("InlineTag"),_g=de("Meter"),K=de("Button"),Fu=de("Label"),Yr=de("Input"),Sb=de("SearchInput"),Jr=de("EmptyInline"),kb=de("Textarea"),Bu=de("Switch"),K7=de("Separator"),Og=de("Skeleton"),Js=de("Spinner"),q7=de("ScrollArea"),W7=de("Card"),G7=de("CardAction"),j7=de("CardPanel"),V7=de("CardDescription"),Q7=de("CardFooter"),X7=de("CardHeader"),Y7=de("CardTitle"),J7=de("Empty"),Z7=de("EmptyContent"),e9=de("EmptyDescription"),t9=de("EmptyHeader"),o9=de("EmptyMedia"),n9=de("EmptyTitle"),r9=de("InputGroup"),a9=de("InputGroupAddon"),s9=de("InputGroupInput"),i9=de("DocumentPanel"),l9=de("MasterDetail"),Zs=de("Select"),Xa=de("SelectItem"),ei=de("SelectPopup"),Lb=de("SelectTrigger"),Hu=de("SelectValue"),Zr=de("Toggle"),Uu=de("ToggleGroup"),ti=de("Dialog"),d9=de("DialogClose"),oi=de("DialogDescription"),$u=de("DialogFooter"),zu=de("DialogHeader"),ni=de("DialogPopup"),Rb=de("DialogPanel"),ri=de("DialogTitle"),c9=de("DialogTrigger"),_o=de("Menu"),Pb=de("MenuGroup"),vo=de("MenuItem"),Oo=de("MenuPopup"),ea=de("MenuRadioGroup"),er=de("MenuRadioItem"),xd=de("MenuSeparator"),Fo=de("MenuTrigger"),ln=de("Popover"),dn=de("PopoverPopup"),cn=de("PopoverTrigger"),Eb=de("Table"),Mb=de("TableBody"),Sn=de("TableCell"),Ya=de("TableHead"),Ab=de("TableHeader"),ta=de("TableRow"),Re=de("Tooltip"),Pe=de("TooltipPopup"),Ee=de("TooltipTrigger"),bd=de("Alert"),wd=de("AlertAction"),Ku=de("AlertDescription"),Fg=de("AlertTitle"),ai=de("Kbd"),xr=de("DecisionCard"),qu=de("ChoiceList"),Wu=de("Command"),Gu=de("CommandGroup"),ju=de("CommandItem"),Vu=de("CommandList"),Nb=de("StyledDiffCodeView"),Db=de("DevBackdropArt"),Io=de("Markdown"),_b=de("DiffView"),Ob=de("MediaPlayer");var{jsx:l,jsxs:v,Fragment:oe}=window.__ycodiumPluginHost.jsxRuntime;var QF="sr-only @min-[30rem]/composer-first-row:not-sr-only";function Bb({mode:e,onModeChange:t}){let{t:o}=z();return l("div",{className:"flex shrink-0 items-center gap-1",children:v(Uu,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":o("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:n=>{let r=n[0];(r==="chat"||r==="trajectory")&&t(r)},children:[l(Fb,{value:"chat",label:o("trajectory.toggleChat"),icon:l(Ga,{"aria-hidden":!0})}),l(Fb,{value:"trajectory",label:o("trajectory.toggleTrajectory"),icon:l(nd,{"aria-hidden":!0})})]})})}function Fb({value:e,label:t,icon:o}){return v(Re,{children:[v(Ee,{render:l(Zr,{value:e,"aria-label":t}),children:[o,l("span",{className:QF,children:t})]}),l(Pe,{side:"top",children:t})]})}function Hb({mode:e,visible:t,chat:o,trajectory:n}){return l("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":e,"data-pane-visible":t?"true":"false",children:l(Ng,{value:t,children:e==="chat"?o:n})})}$();function Ub(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,o=e.inputTokens;if(t===void 0||o===void 0)return null;let n=t+o;if(n<=0)return null;if(t>=n)return"100%";let r=t/n*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 $b(e){let t,o,n,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&&(o=(o??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(n=(n??0)+s.cachedInputTokens));if(!(t===void 0&&o===void 0&&n===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...o!==void 0?{inputTokens:o}:{},...n!==void 0?{cachedInputTokens:n}:{}}}$();$();var zb=qe(null);function Kb({data:e,target:t,children:o}){let n=P(r=>e.readTurnChanges(t,r),[e,t.environmentId,t.threadId]);return l(zb,{value:e.readTurnChanges?n:null,children:o})}function qb({turnId:e,filePath:t,onClose:o}){let n=xe(zb),r=M(n),a=M(o);a.current=o;let{t:s}=z(),[i,d]=q(0),[c,u]=q(0),[m,p]=q(null),[f,g]=q("loading");return H(()=>{if(n!==r.current){a.current();return}let h=!0;if(g("loading"),!n){g("ready");return}return n({turnId:e,filePath:t,textOffset:i}).then(y=>{h&&(p(x=>({...y,text:i===0?y.text:(x?.text??"")+y.text})),g("ready"))},()=>{h&&g("failed")}),()=>{h=!1}},[n,e,t,i,c]),l(ti,{open:!0,onOpenChange:h=>{h||o()},children:v(ni,{className:"flex max-h-[80vh] w-[min(90vw,60rem)] flex-col gap-3",children:[l(ri,{children:s("turnOverview.recordedChanges")}),l(oi,{children:t}),l("p",{className:"text-xs text-muted-foreground",children:m||f==="ready"?s(m?.machineUpdateRequired?"turnOverview.changesUpgradeMachine":`turnOverview.changesSource.${m?.source??"unavailable"}`):null}),f==="loading"?l("p",{role:"status",children:s("turnOverview.changesLoading")}):null,f==="failed"?l(K,{onClick:()=>u(h=>h+1),children:s("turnOverview.changesRetry")}):null,m?.text?l("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-all text-xs",tabIndex:0,children:m.text}):null,m?.truncated?l("p",{children:s("turnOverview.changesTruncated")}):null,m?.textWindow?.nextOffset!=null?l(K,{disabled:f==="loading",onClick:()=>d(m.textWindow.nextOffset),children:s("turnOverview.changesMore")}):null,l(K,{onClick:o,children:s("turnOverview.changesClose")})]})})}$();$();function Td(e,t){if(!Number.isFinite(e)||e<0)return t.milliseconds("0");if(e<1e3)return t.milliseconds(String(Math.max(1,Math.round(e))));if(e<1e4){let i=Math.round(e/100)/10;return t.seconds(i>=10?"10":i.toFixed(1))}if(e<6e4)return t.seconds(String(Math.round(e/1e3)));let o=Math.round(e/1e3),n=Math.floor(o/3600),r=Math.floor(o%3600/60),a=o%60,s=[];return n>0&&s.push(t.hours(String(n))),r>0&&s.push(t.minutes(String(r))),a>0&&s.push(t.seconds(String(a))),s.reduce((i,d)=>t.pair(i,d))}function Wb(e,t){return!Number.isFinite(e)||e<=0?t.seconds("0"):Td(e,t)}function Bo(){let{t:e}=z();return W(()=>{let t={milliseconds:o=>e("duration.milliseconds",{value:o}),seconds:o=>e("duration.seconds",{value:o}),minutes:o=>e("duration.minutes",{value:o}),hours:o=>e("duration.hours",{value:o}),pair:(o,n)=>e("duration.pair",{left:o,right:n})};return{units:t,formatDuration:o=>Td(o,t),formatCountedDuration:o=>Wb(o,t)}},[e])}function XF({fact:e,ownerId:t,onLocate:o,turnId:n}){let{t:r}=z(),{formatDuration:a}=Bo(),[s,i]=q(!1),[d,c]=q(null);Xs(t,s||d!==null);let u=r(`turnOverview.${e.kind}`,{count:e.value,duration:a(e.value)}),m=e.targets[0];return e.targets.length===1&&m?.filePath===void 0?l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs",title:r("turnOverview.locate"),onClick:()=>m&&o(m.rowId),disabled:!m,children:u}):v(oe,{children:[v(ln,{open:s,onOpenChange:i,children:[l(cn,{render:l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs"}),children:u}),v(dn,{className:"flex max-h-72 w-80 flex-col gap-1 overflow-auto p-2",children:[e.partial?l("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:r("turnOverview.loadedFacts")}):null,e.targets.map((p,f)=>v("div",{className:"flex min-w-0 items-center gap-1",children:[p.filePath?l(K,{variant:"ghost",size:"sm",className:"min-w-0 flex-1 justify-start whitespace-normal break-all text-left",title:r("turnOverview.recordedChanges"),onClick:()=>{i(!1),c(p.filePath)},children:p.filePath}):l("span",{className:"min-w-0 flex-1 px-2 text-xs",children:r("turnOverview.step",{index:f+1})}),l(K,{size:"xs",variant:"outline",onClick:()=>{i(!1),o(p.rowId)},children:r("turnOverview.locate")})]},`${p.rowId}:${p.filePath??f}`))]})]}),d!==null?l(qb,{turnId:n,filePath:d,onClose:()=>c(null)},`${n}:${d}`):null]})}function Qu({summary:e,...t}){let{t:o}=z();return v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5 text-muted-foreground","data-turn-facts":e.turnId,children:[e.facts.map(n=>l(XF,{fact:n,turnId:e.turnId,ownerId:`turn:${e.turnId}`,...t},n.kind)),e.facts.some(n=>n.partial)?l(Gb,{className:"px-1 text-ui-2xs",detail:o("turnOverview.loadedFacts"),children:o("turnOverview.loaded")}):null]})}function Xu({summary:e}){let{t}=z();return e.hasCompaction?v(Gb,{className:"inline-flex shrink-0 items-center text-muted-foreground",detail:t("turnOverview.compaction"),children:[l(Ba,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:t("turnOverview.compaction")})]}):null}function Gb({children:e,detail:t,className:o}){return v(Re,{children:[l(Ee,{render:l("span",{className:o}),children:e}),l(Pe,{children:t})]})}$();var Vb=100,YF=new Map,jb=new Map,Yu=e=>typeof e=="function"?e():e,Qb=(e,t)=>typeof t=="function"?t(e):t;function JF(e,t,o){let n=e.get(t);return n===void 0&&(n={values:new Map,limit:Math.max(1,o)},e.set(t,n)),n}function ZF(e,t){let o=jb.get(e);return o===void 0&&(o={values:new Map,limit:Math.max(1,t)},jb.set(e,o)),o}function eB(e,t){if(!(e.values.size<=e.limit)){for(let[o,n]of e.values){if(e.values.size<=e.limit)return;n===t||n.committed||n.leases>0||(e.values.delete(o),n.alive=!1,n.subscribers.clear())}for(let[o,n]of e.values){if(e.values.size<=e.limit)return;n===t||n.leases>0||(e.values.delete(o),n.alive=!1,n.subscribers.clear())}}}function Bg(e,t,o){e.values.get(t)===o&&(e.values.delete(t),e.values.set(t,o))}function Xb(e,t,o){let n=e.values.get(t);return n===void 0&&(n={value:Yu(o),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,n)),n}function Id(e){queueMicrotask(()=>eB(e))}function Ge(e,t,o,n=Vb){let r=Math.max(1,n),a=JF(YF,e,r),s=Xb(a,t,o),i=P(m=>s.alive?(a.limit=r,s.committed=!0,Bg(a,t,s),s.leases+=1,s.subscribers.add(m),Id(a),()=>{s.subscribers.delete(m),s.leases=Math.max(0,s.leases-1),Id(a)}):()=>{},[r,s,a,t]),d=P(()=>s.value,[s]),c=Xo(i,d,d),u=P(m=>{if(!s.alive||a.values.get(t)!==s)return;let p=s.value,f=Qb(p,m);if(!Object.is(f,p)){s.value=f,Bg(a,t,s);for(let g of s.subscribers)g();Id(a)}},[s,a,t]);return[c,u]}function Yb(e,t){let o=M(null);(o.current===null||o.current.key!==e)&&(o.current={key:e,value:Yu(t)});let[,n]=_a(a=>a+1,0),r=P(a=>{let s=o.current;if(s===null||s.key!==e)return;let i=Qb(s.value,a);Object.is(i,s.value)||(s.value=i,n())},[e]);return[o.current.value,r]}function $e(e,t,o,n=Vb){let r=Math.max(1,n),a=ZF(e,r),s=Xb(a,t,()=>({current:Yu(o)}));return H(()=>{if(!(!s.alive||a.values.get(t)!==s))return a.limit=r,s.committed=!0,Bg(a,t,s),s.leases+=1,Id(a),()=>{s.leases=Math.max(0,s.leases-1),Id(a)}},[r,s,a,t]),s.value}function Jo(e,t){let o=M(null);return(o.current===null||o.current.key!==e)&&(o.current={key:e,ref:{current:Yu(t)}}),o.current.ref}$();var Hg="trajectory-summary-reveal";function Jb({inputKey:e,rows:t,groupRows:o,paneVisible:n,resetFilter:r}){let[a,s]=Ge("trajectory-turn-disclosure",e,{}),[i,d]=Ge("trajectory-routine-disclosure",e,()=>new Set),[c,u]=Ge("trajectory-expand-all",e,!1),[m,p]=Ge(Hg,e,null),[f,g]=Ge("trajectory-summary-highlight",e,null),h=$e("trajectory-default-open",e,()=>new Set),y=W(()=>o?.(t,c)??null,[o,t,c]),x=W(()=>{let I=new Map,T=new Map;if(y===null)return{rows:t,headers:I,routines:T};let S=y.findLast(N=>N.turnId!==null),R=new Set(y.map(N=>N.id));if(h.current.size>200)for(let N of h.current)R.has(N)||h.current.delete(N);n&&S&&h.current.add(S.id);let A=[];for(let N of y){let B=N.items[0],O=B?.kind==="step"?B.row:B?.rows[0];if(!O)continue;let V=c||(a[N.id]??(N.turnId===null||h.current.has(N.id)||N.summary?.state==="running"));if(I.set(N.id,{group:N,expanded:V}),A.push({...O,id:N.id,kind:"turn-header",turnId:N.turnId,createdAt:N.summary?.startedAt??O.createdAt}),!!V)for(let U of N.items){if(U.kind==="step"){A.push(U.row);continue}let D=i.has(U.id);T.set(U.id,{count:U.rows.length,expanded:D}),A.push({...U.rows[0],id:U.id,kind:"routine-header"}),D&&A.push(...U.rows)}}return{rows:A,headers:I,routines:T}},[y,t,n,h,c,a,i]),C=M(x.headers);C.current=x.headers;let b=P(I=>{u(!1),s(T=>({...T,[I]:!C.current.get(I)?.expanded}))},[u,s]),L=P(I=>d(T=>{let S=new Set(T);return S.has(I)?S.delete(I):S.add(I),S}),[d]),w=P(I=>p(T=>({rowId:I,nonce:(T?.nonce??0)+1})),[p]);fe(()=>{if(!n||m===null)return;r();let I=y?.find(S=>S.id===m.rowId||S.items.some(R=>R.kind==="step"?R.row.id===m.rowId:R.rows.some(A=>A.id===m.rowId)));if(!I||I.id===m.rowId)return;x.headers.get(I.id)?.expanded||s(S=>({...S,[I.id]:!0}));let T=I.items.find(S=>S.kind==="routine"&&S.rows.some(R=>R.id===m.rowId));T&&!i.has(T.id)&&d(S=>new Set([...S,T.id]))},[n,m,r,y,x.headers,i,s,d]);let k=P(I=>{g(I.rowId),p(T=>T===I?null:T)},[g,p]);return{...x,expandAll:c,setExpandAll:u,toggleTurn:b,toggleRoutine:L,locate:w,request:m,completeReveal:k,highlighted:f}}function si(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Zb({rows:e,usageByTurnId:t,onSelect:o,summaries:n,actions:r}){let{t:a}=z();return e.map(({item:s,ordinal:i})=>{let d=s.attachmentPreview,c=s.isSystemMessage?a("turnNavigator.systemWake"):d===void 0?s.userText:d.count===1?d.name:a("forkRelations.attachmentPreview",d),u=s.turnId===null?void 0:n.get(s.turnId),m=s.turnId===null?void 0:t.get(s.turnId);return v("div",{className:"rounded-md hover:bg-accent/50",children:[v("button",{type:"button","data-turn-navigator-row":s.sectionKey,onClick:()=>o(s),className:"flex w-full cursor-[var(--control-cursor)] items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[l("span",{className:"shrink-0 pt-px font-mono text-ui-2xs text-muted-foreground tabular-nums",children:i}),v("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[v("span",{className:"flex items-start gap-1",children:[l("span",{className:"line-clamp-2 min-w-0 flex-1 font-medium text-chat leading-snug",children:c}),u?l(Xu,{summary:u}):null]}),s.assistantText?l("span",{className:"line-clamp-1 text-ui-xs text-muted-foreground leading-snug",children:s.assistantText}):null,m?.outputTokens!==void 0?l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:si(m.outputTokens)}):null]})]}),u&&r?l("div",{className:"pb-1 pl-7 pr-2",children:l(Qu,{summary:u,...r})}):null]},s.sectionKey)})}function tB({context:e,useSummaries:t,...o}){let n=t(e.target),r=W(()=>new Map(n.map(s=>[s.turnId,s])),[n]),[,a]=Ge(Hg,e.threadKey,null);return l(Zb,{...o,summaries:r,actions:{onLocate:s=>{a(i=>({rowId:s,nonce:(i?.nonce??0)+1})),o.onClose(),e.openTrajectory()},onOpenFileDiff:e.onOpenFileDiff}})}var oB=new Map;function ew(e){let t=e.summaryContext;return t?.data.useTurnSummaries?l(tB,{...e,context:t,useSummaries:t.data.useTurnSummaries}):l(Zb,{...e,summaries:oB})}function nB({totals:e}){let{t}=z();if(!e)return null;let o=Ub(e),n=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:si(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:si(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:o===null?si(e.cachedInputTokens):`${si(e.cachedInputTokens)} (${o})`}].filter(r=>r!==null);return n.length===0?null:v("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),n.map(r=>v("span",{className:"shrink-0 font-mono text-ui-2xs text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var rB=pe(function({getText:t,size:o="xs",variant:n="outline",className:r}){let{t:a}=z(),s=Nt().writeClipboard,[i,d]=q(!1),c=a("turnNavigator.copyMarkdown");return v(Re,{children:[l(Ee,{render:l(K,{"aria-label":c,disabled:i,onClick:()=>{s(t()).then(()=>{d(!0),window.setTimeout(()=>d(!1),1e3)})},type:"button",size:o,variant:n,className:G("text-muted-foreground hover:text-foreground",r)}),children:i?l(wo,{className:"size-3 text-primary"}):l($a,{className:"size-3"})}),l(Pe,{children:l("p",{children:c})})]})});function tw({items:e,totalTurnCount:t,bottomInset:o,usageByTurnId:n,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float",summaryContext:d}){let{t:c}=z(),[u,m]=q(!1),p=W(()=>e.map((y,x)=>({item:y,ordinal:x+1})).reverse(),[e]),f=W(()=>$b(p.map(({item:y})=>y.turnId===null?void 0:n.get(y.turnId))),[p,n]);if(e.length===0)return null;let g=t??e.length,h=c("turnNavigator.open",{count:g});return v(ln,{onOpenChange:m,open:u,children:[v(cn,{render:l(K,{"aria-label":h,className:G("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:o+12}:void 0,title:h,variant:"glass"}),children:[l(rd,{"aria-hidden":!0}),l("span",{className:"font-mono font-semibold tabular-nums",children:g})]}),l(dn,{align:"end",className:"w-80 flex-col",side:"top",children:v("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[v("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.title")}),l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:g})]}),l("div",{className:G("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:l(ew,{rows:p,usageByTurnId:n,summaryContext:d,onSelect:y=>{m(!1),r(y)},onClose:()=>m(!1)})}),l(nB,{totals:f}),v("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.export")}),l(rB,{size:"icon-xs",getText:a,variant:"ghost"}),l(K,{"aria-label":c("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:c("turnNavigator.downloadMarkdown"),variant:"ghost",children:l("span",{className:"font-mono",children:".md"})}),l(K,{"aria-label":c("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:c("turnNavigator.downloadJson"),variant:"ghost",children:l("span",{className:"font-mono",children:".json"})})]})]})})]})}$();function Sd(e){return e.replace(/\s+/g," ")}function aB(e,t){let o=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(o)&&(o=o.slice(1)),o}function sB(e,t){let o=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(o)&&(o=o.slice(0,-1)),o}function Ju(e){let o=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return o?.closest('[data-message-role="assistant"]')?o:null}function ow(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),o=Ju(t.startContainer);if(o===null||Ju(t.endContainer)!==o)return null;let n=o.closest("[data-message-id]")?.dataset.messageId;if(!n)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(o),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(o),s.setStart(t.endContainer,t.endOffset);let i=Sd(t.toString()),d=i.length>i.trimStart().length?" ":"",c=i.length>i.trimEnd().length?" ":"",u=Sd(a.toString()+d),m=Sd(c+s.toString()),p=u.length,f=p+i.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),y=g[g.length-1]??h;return{messageId:n,text:r,start:p,end:f,prefix:aB(u,32),suffix:sB(m,32),anchor:{x:y.right,top:h.top,bottom:y.bottom}}}var Zu="assistant-quote-inserter",ep="assistant-quote-open-comment";var iB=300;function nw(e){let{data:t,target:o,threadKey:n,surfaceRef:r}=e,{t:a}=z(),s=$e(Zu,n,null),[,i]=Ge(ep,n,null),[d,c]=q(null),u=M(null);if(H(()=>{let h,y=()=>{let k=r.current,I=document.getSelection(),T=I&&I.rangeCount>0?I.getRangeAt(0):null;if(!k||!T||!k.contains(T.commonAncestorContainer)){c(null);return}let S=ow(I);if(S===null){c(null);return}let R=t.assistantQuotes.serialize({version:1,environmentId:o.environmentId,threadId:o.threadId,messageId:S.messageId,text:S.text,start:S.start,end:S.end,prefix:S.prefix,suffix:S.suffix});c({source:R,...S.anchor})},x=k=>{u.current?.contains(k.target)||(clearTimeout(h),h=setTimeout(y,iB))},C=k=>{u.current?.contains(k.target)||(clearTimeout(h),c(null))},b=()=>c(null),L=k=>{k.key==="Escape"&&c(null)},w=()=>{(document.getSelection()?.isCollapsed??!0)&&c(null)};return document.addEventListener("pointerup",x,!0),document.addEventListener("keyup",x,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",L,!0),document.addEventListener("selectionchange",w),window.addEventListener("scroll",b,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",x,!0),document.removeEventListener("keyup",x,!0),document.removeEventListener("pointerdown",C,!0),document.removeEventListener("keydown",L,!0),document.removeEventListener("selectionchange",w),window.removeEventListener("scroll",b,!0)}},[t,r,o.environmentId,o.threadId]),d===null)return null;let m=d.source,p=Math.max(8,Math.min(window.innerWidth-200,d.x-12)),f=d.bottom+6,g=f+40<=window.innerHeight?f:Math.max(8,d.top-40);return l("div",{ref:u,className:"fixed z-50 rounded-control-3 bg-background",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:v(K,{size:"sm",variant:"outline",className:"shadow-md",disabled:m===null,title:m===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{m!==null&&s.current?.(m)===!0&&(i(m),document.getSelection()?.removeAllRanges(),c(null))},children:[l(vr,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}$();$();function rw(e){let t=e.map(n=>({key:n.key,turnId:n.turnId,firstRowIndex:n.firstRowIndex,endRowIndex:n.firstRowIndex+n.rowIds.length})),o=new Map;for(let n of e)for(let[r,a]of n.rowIds.entries())o.set(a,{turnId:n.turnId,index:n.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(n=>[n.key,n])),byRowId:o}}function tp({index:e,visibleSectionKeys:t,protectedRowIds:o,selectionRows:n}){let r=t.flatMap(c=>{let u=e.bySectionKey.get(c)?.turnId;return u==null?[]:[u]}),a=o.flatMap(c=>{let u=e.byRowId.get(c)?.turnId;return u==null?[]:[u]}),s=n?e.byRowId.get(n.firstRowId)?.index:void 0,i=n?e.byRowId.get(n.lastRowId)?.index:void 0,d=s===void 0||i===void 0?[]:e.sections.flatMap(c=>c.turnId!==null&&c.endRowIndex>Math.min(s,i)&&c.firstRowIndex<=Math.max(s,i)?[c.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:d.length>0?{firstTurnId:d[0],lastTurnId:d.at(-1)}:null}}function aw(e,t,o,n){if(!n)return o;let r=e.findIndex(a=>t.has(a));return r<0?o:Math.max(o,e.length-r)}$();$();function Ug(e,t){for(let o of e.querySelectorAll("[data-timeline-row-id]"))if(o.dataset.timelineRowId===t)return o;return null}function Ja(e,t){let o=0,n=e.length,r=-1;for(;o<n;){let a=Math.floor((o+n)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,n=a):o=a+1}return r}function lB(e){let t=e.getBoundingClientRect().top,o=e.querySelectorAll("[data-timeline-turn-section]"),n=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Ja(s,t),d=i<0?void 0:s[i],c=d?.dataset.timelineRowId;return!d||c===void 0?null:{rowId:c,offsetPx:Math.round(t-d.getBoundingClientRect().top)}};if(o.length===0)return n(e);let r=Ja(o,t);if(r<0)return null;for(let a=r;a<o.length;a+=1){let s=n(o[a]);if(s)return s}return null}function sw(e,t){let o=0,n=e;for(;n&&n!==t;)o+=n.offsetTop,n=n.offsetParent;return o}var $g=class extends mr{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function iw({inputKey:e,onBeforeInputChange:t,handleRef:o,onAttach:n,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let d=M(null),c=M({inputKey:e,store:vd()});c.current.inputKey!==e&&(c.current={inputKey:e,store:vd()});let u=M(i);u.current=i;let m=P(f=>{let g=c.current;return g.store.acquire(f,()=>{c.current===g&&u.current?.(g.store.rows())})},[]);fe(()=>{i?.(c.current.store.rows())},[e,i]),fr(o,()=>({get node(){return d.current},measure:()=>{let f=d.current;return f?{scroll:f.scrollTop,scrollLength:f.clientHeight,contentLength:f.scrollHeight,topOf:g=>{let h=Ug(f,g);return h===null?null:sw(h,f)},heightOf:g=>{let h=Ug(f,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>lB(f)}:null},scrollToEnd:f=>{let g=d.current;if(g){if(f?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(f,g)=>{let h=d.current;if(!h)return!1;let y=Ug(h,f);return y?(h.scrollTop=Math.max(0,sw(y,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:f=>{let g=d.current;g&&(g.scrollTop=Math.max(0,f))}}),[]);let p=P(f=>{d.current=f,n(f)},[n]);return l($g,{inputKey:e,onBeforeInputChange:t,children:l(yd,{value:m,children:l("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function li(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),o=e.getAttribute?.("contenteditable");if(t==="textarea"||o==="true"||o===""||o==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let n=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(n))return!0}return e.matches?.(":focus-visible")??!1}function ii(e,t){let n=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return n&&t.contains(n)?n.dataset.timelineRowId??null:null}function op(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let o=null,n=null;for(let c=0;c<t.rangeCount;c+=1){let u=t.getRangeAt(c);u.intersectsNode(e)&&(o??=u,n=u)}if(!o||!n)return null;let r=ii(o.startContainer,e),a=ii(n.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,d=s[s.length-1]?.dataset.timelineRowId;return i&&d?{firstRowId:r??i,lastRowId:a??d}:null}function kd(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let o=0;o<t.rangeCount;o+=1)if(t.getRangeAt(o).intersectsNode(e))return!0;return!1}$();function oa(e){let t=M(e);t.current=e;let o=M(!1),n=M(null),r=M(null),a=M(0),s=P(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=P(()=>{if(!o.current||!t.current||r.current!==null||n.current===null)return;let u=++a.current;r.current=requestAnimationFrame(m=>{if(u!==a.current||(r.current=null,!o.current||!t.current))return;let p=n.current;n.current=null,p?.(m)})},[]),d=P(u=>{n.current=u,i()},[i]),c=P(()=>{n.current=null,s()},[s]);return fe(()=>(o.current=!0,i(),()=>{o.current=!1,s()}),[e,s,i]),W(()=>({request:d,cancel:c}),[d,c])}function lw({root:e,inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d}){let c=M({inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d});c.current={inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d};let u=oa(o),m=M(null),p=P(()=>{let g=c.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let y=h.top+g.topInset,x=h.bottom-g.bottomInset,C=e.querySelectorAll("[data-timeline-turn-section]"),b=Ja(C,y),L=[];if(b>=0)for(let S=b;S<C.length;S+=1){let R=C[S];if(R.getBoundingClientRect().top>=x)break;R.dataset.timelineTurnSection!==void 0&&L.push(R.dataset.timelineTurnSection)}let w=[...g.interactionRows()],k=e.ownerDocument.activeElement;if(li(k)){let S=ii(k,e);S&&w.push(S)}let I=tp({index:g.index,visibleSectionKeys:L,protectedRowIds:w,selectionRows:op(e)}),T=`${g.inputKey}:${JSON.stringify(I)}`;T!==m.current&&(m.current=T,g.onRangeChange?.(I))},[e]),f=P(()=>u.request(p),[u,p]);return fe(()=>{if(m.current=null,!o||!e)return;let g=t,h=!0,y=()=>{!h||c.current.inputKey!==g||!c.current.visible||(c.current.onSelectionChange(kd(e)),f())};e.addEventListener("scroll",y,{passive:!0}),e.addEventListener("focusin",y),e.addEventListener("focusout",y),e.ownerDocument.addEventListener("selectionchange",y);let x=typeof ResizeObserver>"u"?null:new ResizeObserver(y);return x?.observe(e),e.firstElementChild&&x?.observe(e.firstElementChild),y(),()=>{h=!1,u.cancel(),x?.disconnect(),e.removeEventListener("scroll",y),e.removeEventListener("focusin",y),e.removeEventListener("focusout",y),e.ownerDocument.removeEventListener("selectionchange",y),i?.(null)}},[u,t,i,f,e,o]),fe(()=>{o&&f()},[n,f,o]),f}$();var dw=pe(function({sectionKey:t,rowKeyPrefix:o,rowIds:n,renderRow:r,sectionRef:a}){return l("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:n.map(s=>l("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${o}:${s}`))})});var dB=400;function cw({root:e,minimumCount:t,keepAbovePx:o=0,canCompact:n,onCompact:r}){let a=e.ownerDocument,s=new Set,i,d=!1,c=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,u=()=>{if(i=void 0,a.hidden||s.size>0||!n()||e.clientHeight<=0||!c()||kd(e))return;let L=e.querySelectorAll("[data-timeline-turn-section]"),w=e.getBoundingClientRect().top-32-o,k=0,I=Math.max(0,L.length-t);for(;k<I;){let S=Math.floor((k+I)/2),R=L[S].getBoundingClientRect().bottom;if(!Number.isFinite(R))return;R<=w?k=S+1:I=S}if(k===0)return;let T=a.activeElement;if(T&&li(T)){for(let S=0;S<k;S+=1)if(L[S].contains(T))return}r(L.length-k)},m=!1,p=()=>{if(a.hidden||s.size>0||!n()||m){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(u,dB))},f=()=>{clearTimeout(i),i=void 0,p()},g=()=>{let L=c();!L||!d?f():p(),d=L},h=L=>{s.add(L.pointerId),f()},y=L=>{s.delete(L.pointerId),f()},x=()=>{m=kd(e),f()},C=()=>{s.clear(),f()},b=["wheel","keydown","focusin","focusout"];for(let L of b)e.addEventListener(L,f,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",y,!0),a.addEventListener("pointercancel",y,!0),a.addEventListener("selectionchange",x),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",C),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let L of b)e.removeEventListener(L,f);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",y,!0),a.removeEventListener("pointercancel",y,!0),a.removeEventListener("selectionchange",x),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",C)}}}$();function uw({root:e,topInsetPx:t,onActiveSectionChange:o,onActiveStartHiddenChange:n,active:r}){let a=M(r);a.current=r;let s=oa(r),i=M(new Map),d=M(null),c=M(null),u=M(o);u.current=o;let m=M(n);m.current=n;let p=M(null),f=M(null),g=P(()=>{if(!a.current||!e)return;let b=e.scrollTop+t,L=null,w=Number.NEGATIVE_INFINITY,k=null,I=Number.POSITIVE_INFINITY;for(let[A,N]of i.current){if(!N.isConnected)continue;let B=N.offsetTop;B<I&&(I=B,k=A),B<=b&&B>=w&&(w=B,L=A)}let T=L??k;T!==c.current&&(c.current=T,u.current(T));let S=T===null?null:i.current.get(T)?.firstElementChild??null,R=S!==null&&S.getBoundingClientRect().bottom<=e.getBoundingClientRect().top+1;R!==p.current&&(p.current=R,m.current?.(R))},[e,t]),h=P(()=>{a.current&&s.request(g)},[s,g]);H(()=>{if(!r||!e||typeof IntersectionObserver>"u")return;let b=!0,L=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});d.current=L;for(let k of i.current.values())L.observe(k);let w=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,threshold:0});f.current=w;for(let k of i.current.values())k.firstElementChild&&w.observe(k.firstElementChild);return h(),()=>{b=!1,L.disconnect(),d.current=null,w.disconnect(),f.current=null,s.cancel()}},[r,s,h,e,t]);let y=M(new Map),x=P(b=>{let L=y.current.get(b);if(L)return L;let w=k=>{let I=i.current.get(b);I&&I!==k&&(d.current?.unobserve(I),I.firstElementChild&&f.current?.unobserve(I.firstElementChild),i.current.delete(b)),k?(i.current.set(b,k),d.current?.observe(k),k.firstElementChild&&f.current?.observe(k.firstElementChild)):y.current.get(b)===w&&y.current.delete(b)};return y.current.set(b,w),w},[]),C=P(()=>{a.current&&(c.current=null,p.current=null,h())},[h]);return W(()=>({observeSection:x,refresh:C}),[x,C])}function np(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&&e.effortLevel===t.effortLevel}function pw(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function mw(e,t){return e.turnId===t.turnId&&e.createdAt===t.createdAt&&np(e.badge,t.badge)}function fw(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":return mw(e,t);case"turn-summary":{let o=t;return e.createdAt===o.createdAt&&e.copyText===o.copyText&&e.cardAnchor===o.cardAnchor&&e.footer===o.footer&&(e.identity===void 0?o.identity===void 0:o.identity!==void 0&&mw(e.identity,o.identity))}case"tool-group":{let o=t;return e.createdAt===o.createdAt&&e.groupId===o.groupId&&pw(e.entries,o.entries)}case"working":{let o=t;return e.createdAt===o.createdAt&&e.turnId===o.turnId&&e.compacting===o.compacting&&np(e.modelBadge,o.modelBadge)}case"continuation-check":{let o=t;return e.createdAt===o.createdAt&&e.pluginIds.length===o.pluginIds.length&&e.pluginIds.every((n,r)=>n===o.pluginIds[r])}case"model-switch":{let o=t;return e.createdAt===o.createdAt&&e.pending===o.pending&&np(e.badge,o.badge)}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let o=t;return e.createdAt===o.createdAt&&e.turnPlan.plan===o.turnPlan.plan}case"work":{let o=t;return e.isExpandedToolGroupEntry===o.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===o.isLastExpandedToolGroupEntry&&pw(e.groupedEntries,o.groupedEntries)}case"message":{let o=t;return e.message===o.message&&e.presentation===o.presentation&&e.textTone===o.textTone&&e.durationStart===o.durationStart&&e.showAssistantMeta===o.showAssistantMeta&&e.showAssistantCopyButton===o.showAssistantCopyButton&&e.copyInFooter===o.copyInFooter&&e.assistantCopyStreaming===o.assistantCopyStreaming&&np(e.modelBadge,o.modelBadge)}}}function cB(e,t,o){for(let n=t;n<o;n+=1){let r=e[n];switch(r.kind){case"turn-identity":return r.turnId;case"working":if(r.turnId!=null)return r.turnId;break;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!=null)return r.entries[0].turnId;break;case"work":if(r.groupedEntries[0]?.turnId!=null)return r.groupedEntries[0].turnId;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 gw(e,t,o=[]){let n=new Map(o.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let s=cB(e,a.start,a.end),i=n.get(a.key);if(i!==void 0&&i.turnId===s&&uB(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(d=>d.id)})}return r}function uB(e,t,o,n){if(e.firstRowIndex!==o||e.rowIds.length!==n-o)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[o+r].id)return!1;return!0}function hw(e,t){let o=Math.max(0,Math.min(t,e)),n=e-o;return{startIndex:n,hasHiddenOlder:n>0}}function Za(e,t,o){let n=e.findIndex(r=>r.rowIds.includes(t));return n<0?o:Math.max(o,e.length-n)}function pB(e,t){let o=t.historyWindow,{status:n}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,turnSummaries:t.turnSummaries,latestTurn:o?null:n.latestTurn,runningTurnId:o?null:n.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!o&&n.isWorking,activeTurnStartedAt:o?null:n.activeTurnStartedAt,continuationCheck:o?null:n.continuationCheck??null,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:o?null:n.pendingModelSelection},a=e.deriveGroups(r),s=n.latestTurn;if(o&&s&&s.completedAt!==null){let i=s.turnId;if(a.rows.some(c=>c.kind==="message"?c.message.role==="assistant"&&c.message.turnId===i:c.kind==="work"?c.groupedEntries.some(u=>u.turnId===i):c.kind==="tool-group"&&c.entries.some(u=>u.turnId===i)))return e.deriveGroups({...r,latestTurn:s})}return a}var mB=new Map,fB={markdown:()=>"",download(){}},gB=[],hB={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:gB},yB={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:hB,usageByTurnId:mB,exportApi:fB,finalAssistantMessageReceived:!1},version:0};function vB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function CB(e,t,o,n){let r=pB(o,e),a=xB(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 y=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],x=y!==void 0&&fw(y,g)?y:g;return x!==y&&n.add(g.id),x});if(!a)for(let g of t.indexById.keys())s.has(g)||n.add(g);let d=gw(i,r.turnGroups,t.structure.sections),c=a?t.structure.rowIds:i.map(g=>g.id),u=a&&vB(t.structure.sections,d)?t.structure:{rowIds:c,sections:d},m=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===m?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:m},f=n.size>0||u!==t.structure||p!==t.meta;return{inputs:e,structure:u,indexById:s,rows:i,meta:p,version:f?t.version+1:t.version}}function xB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o].id)return!1;return!0}function di(e){return e.getStructure().rowIds.some(t=>e.getRow(t)?.kind==="message")}function yw(){let e=null,t=null,o=yB,n=new Set,r=0,a=new Set,s=new Map,i=()=>{if(e===null||o.inputs===e)return o;t??=e.derive.createRowsCache();let d=new Set;o=CB(e,o,t,d);for(let c of d)n.add(c);return o};return{setInputs(d){e=d},hasInputs:()=>e!==null,flush(){if(a.size===0&&s.size===0||e===null)return;let{version:d}=i();if(d===r&&n.size===0)return;r=d;let c=[...n];n.clear();for(let u of c){let m=s.get(u);if(m!==void 0)for(let p of Array.from(m))p()}for(let u of Array.from(a))u()},subscribe(d){return a.add(d),()=>{a.delete(d)}},subscribeRow(d,c){let u=s.get(d);return u===void 0&&(u=new Set,s.set(d,u)),u.add(c),()=>{u.delete(c),u.size===0&&s.get(d)===u&&s.delete(d)}},getStructure:()=>i().structure,getRow(d){let{indexById:c,rows:u}=i(),m=c.get(d);return m===void 0?void 0:u[m]},getRows:()=>i().rows,getMeta:()=>i().meta,getVersion:()=>i().version}}$();function rp(e){return Xo(e.subscribe,e.getStructure,e.getStructure)}function vw(e,t){let o=P(r=>e.subscribeRow(t,r),[e,t]),n=P(()=>e.getRow(t),[e,t]);return Xo(o,n,n)}function Gt(e,t,o=Object.is){let n=M(null),r=P(()=>{let a=e.getVersion(),s=n.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),d=s!==null&&s.store===e&&o(s.value,i)?s.value:i;return n.current={store:e,select:t,version:a,value:d},d},[e,t,o]);return Xo(e.subscribe,r,r)}$();$();function Cw(e,t){return e.getFullYear()!==new Date(t).getFullYear()}function zg(e,t){return{month:e,day:"numeric",...t?{year:"numeric"}:{}}}function xw(e){let t=new Intl.DateTimeFormat(e,zg("numeric",!1)),o=new Intl.DateTimeFormat(e,zg("numeric",!0)),n=(r,a)=>(Cw(r,a)?o:t).format(r);return{ofDate:n,ofIso:(r,a)=>{let s=new Date(r);return Number.isNaN(s.getTime())?"":n(s,a)}}}function bw(e,t){let o=new Date(e);return Number.isNaN(o.getTime())?null:{date:o,formatParams:{date:zg("short",Cw(o,t))}}}function Tw(e,t){let o={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?o:{...o,hour12:e==="12-hour"}}function bB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function wB(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Iw=bB(wB()),ww=new Map;function Sw(e,t){let o=`${e}:${t?"seconds":"minutes"}`,n=ww.get(o);if(n)return n;let r=new Intl.DateTimeFormat(Iw,Tw(e,t));return ww.set(o,r),r}function Kg(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function kn(e,t,o){let n=Kg(e);return n?o("timeline.timestampTooltip",{date:n,formatParams:{date:{...Tw(t,!1),...t==="locale"?{hourCycle:Sw(t,!1).resolvedOptions().hourCycle}:{},year:"numeric",month:"long",day:"numeric"}}}):""}var kw=xw(Iw);function tr(e,t,o,n=Date.now()){let r=Kg(e);if(!r)return"";let a=Sw(t,!1).format(r),s=new Date(n),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),d=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),c=Math.round((i-d)/864e5);return c<=0?a:c===1?o("relativeTime.yesterdayAt",{time:a}):`${kw.ofDate(r,n)} ${a}`}function Lw(e,t=Date.now()){return kw.ofIso(e,t)}function Rw(e){let t=Kg(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:""}$();var Fe=qe(null),ap=qe(null);$();var ci=new Map,Pw=24,TB=4e3,IB=1024,Ew=16384;function qg(e){let t=ci.get(e);if(t)return t;let o={values:new Map,listeners:new Set,stringLength:0};if(ci.set(e,o),ci.size>Pw){for(let[n,r]of ci)if(r.listeners.size===0&&n!==e&&(ci.delete(n),ci.size<=Pw))break}return o}function Wg(e,t,o){return qg(e).values.get(t)??o}function Ld(e,t,o,n=!0){let r=qg(e);if(typeof o=="string"&&(o=o.slice(0,IB)),r.values.get(t)===o)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,o),typeof o=="string"&&(r.stringLength+=o.length),r.stringLength>Ew){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=Ew))break}if(r.values.size>TB){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)}}n&&r.listeners.forEach(s=>s())}function zt(e,t,o){let n=P(i=>{let d=qg(e);return d.listeners.add(i),()=>d.listeners.delete(i)},[e]),r=P(()=>Wg(e,t,o),[e,t,o]),a=Xo(n,r,r),s=P(i=>Ld(e,t,i),[e,t]);return[a,s]}function Me(){let e=Nt().i18n.usePluginTranslation();return{t:(t,o)=>e(t,o)}}function Mw(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function Aw(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var sp="chat-process-row flex w-full min-w-0 select-none items-center gap-1.5 px-2 text-left";function Rd({children:e}){return l("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function Pd({status:e}){return l("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:l("span",{className:G("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function ip({state:e,variant:t="inline",className:o,children:n}){return v("div",{"data-process-state":e,"data-process-kind":t,className:G("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",o),children:[e==="running"?l("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,n]})}$();$();var ui=class extends Error{reason;constructor(t,o,n){super(o,n),this.reason=t}};function SB(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 o=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 n=o?.focus;typeof n=="function"&&n.call(o)}}async function kB(e,t){let o=()=>new ui("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw o();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(SB(e))return!0;throw o()}try{return await navigator.clipboard.writeText(e),!0}catch(n){throw new ui("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:n})}}function lp({timeout:e=2e3,target:t="text",onCopy:o,onError:n}={}){let[r,a]=q(!1),s=M(null),i=M(o),d=M(n),c=M(t),u=M(e);i.current=o,d.current=n,c.current=t,u.current=e;let m=P((p,f)=>{kB(p,c.current).then(g=>{g&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(f),u.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},u.current)))},g=>{d.current?.(g instanceof Error?g:new Error(String(g)),f)})},[]);return H(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:m,isCopied:r}}var Nw=1e3,LB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"},na=pe(function({text:t,size:o="xs",variant:n="outline",className:r,toastAnchor:a="above",label:s}){let{t:i}=Me(),d=s??i("copyButton.copyToClipboard"),[c,u]=q(!1),[m,p]=q(null),f=M(null),g=(x,C)=>{f.current&&clearTimeout(f.current),p({title:x,description:C}),f.current=setTimeout(()=>{p(null),u(!1)},Nw)};H(()=>()=>{f.current&&clearTimeout(f.current)},[]);let{copyToClipboard:h,isCopied:y}=lp({onCopy:()=>g(i("copyButton.copied")),onError:x=>g(i("copyButton.failedToCopy"),x instanceof ui?i(LB[x.reason]):x.message),timeout:Nw});return v(Re,{open:m!==null||c,onOpenChange:u,children:[l(Ee,{render:l(K,{"aria-label":d,softDisabled:y,onClick:()=>h(t),type:"button",size:o,variant:n,className:G("text-muted-foreground hover:text-foreground",r)}),children:y?l(wo,{className:"size-3 text-primary"}):l($a,{className:"size-3"})}),v(Pe,{side:a==="above"?"top":"bottom",className:"max-w-72",role:m?"status":void 0,children:[l("span",{children:m?.title??d}),m?.description?l("span",{className:"block text-muted-foreground",children:m.description}):null]})]})});function dp({text:e,label:t,children:o}){return v("span",{className:"group/hover-copy inline-flex min-w-0 items-center gap-0.5",children:[o,l("span",{className:"inline-flex opacity-0 transition-opacity duration-(--control-duration) pointer-events-none group-focus-within/hover-copy:pointer-events-auto group-focus-within/hover-copy:opacity-100 group-hover/hover-copy:pointer-events-auto group-hover/hover-copy:opacity-100 [@media(pointer:coarse)]:pointer-events-auto [@media(pointer:coarse)]:opacity-100",children:l(na,{text:e,label:t,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"})})]})}$();var RB=[".m4v",".mov",".mp4",".ogv",".webm"],PB=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function Dw(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let o=e.name.slice(t).toLowerCase();return RB.includes(o)?"video":PB.includes(o)?"audio":null}var EB=["image/gif","image/jpeg","image/png","image/webp"],MB=new Set(EB);function AB(e){return MB.has(e.toLowerCase())}function NB(e){return AB(e)?"image":"file"}var DB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]),_B=[".doc",".docx",".odt",".ppt",".pptx",".odp",".xls",".xlsx",".ods"];function or(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();if(t==="image/svg+xml")return"svg";if(t==="application/pdf")return"pdf";let o=Dw(e);if(o)return o;let n=e.name.lastIndexOf(".");return n>0&&_B.includes(e.name.slice(n).toLowerCase())?"office":t.startsWith("text/")||DB.has(t)?"text":"file"}function br(e){let t=or(e);return t==="image"||t==="svg"}function pi(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 Gg(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return NB(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}function cp(e,t){let o=e.flatMap(r=>r.previewUrl?[{...r,src:r.previewUrl}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,attachmentId:r.id,...r.source===void 0?{}:{source:r.source},...r.type!==void 0&&r.mimeType!==void 0&&or({type:r.type,mimeType:r.mimeType,name:r.name})==="svg"?{svg:!0}:{}})),index:n}}function up(e){switch(e){case"image":case"svg":return ed;case"video":return Kr;case"audio":return In;case"pdf":return za;case"office":return jl;case"text":return Gl;case"file":return Yo}}function Ho(e){return e.source?._tag==="agent-artifact"?e.source:void 0}function jg({rowId:e,messageId:t,attachments:o}){let n=xe(Fe),[r,a]=zt(n.threadKey,`attachments:${t}`,!1),{t:s}=Me(),i=o.toSorted((c,u)=>+(Ho(u)?.delivered===!0)-+(Ho(c)?.delivered===!0)),d=r?i:i.slice(0,4);return o.length===0?null:v("div",{className:"mb-2 max-w-[420px]","data-assistant-attachments":"",children:[l("div",{className:"grid grid-cols-2 items-start gap-2",children:d.map(c=>l("div",{className:"min-w-0",children:br(c)?l(Ed,{images:[c],gallery:i.filter(br)}):l(Md,{attachment:c})},c.id))}),!r&&i.length>4?l(K,{variant:"ghost",size:"xs",className:"mt-1","aria-expanded":!1,onClick:()=>{n.onProcessDisclosureChange?.(e),a(!0)},children:s("attachments.showMore")}):null]})}function Ed({images:e,gallery:t}){let o=xe(Fe),{t:n}=Me();return e.length===0?null:l("div",{className:t?"grid":"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(r=>v("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:[r.previewUrl?l("button",{type:"button",className:"w-full cursor-zoom-in","data-attachment-action":"preview","data-attachment-name":r.name,"aria-label":n("attachments.preview",{name:r.name}),onClick:()=>{let a=cp(t??e,r.id);a&&o.onImageExpand(a)},children:l("img",{src:r.previewUrl,alt:r.name,loading:"lazy",decoding:"async",className:or(r)==="svg"?"block h-auto max-h-[220px] w-full bg-white object-contain":"block h-auto max-h-[220px] w-full object-cover object-top"})}):l("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:r.name}),Ho(r)?.delivered||Ho(r)?.title||Ho(r)?.note?v("div",{className:"px-2 py-1 text-chat-meta",children:[l("p",{className:"break-words font-medium",children:Ho(r)?.title||r.name}),Ho(r)?.note?l("p",{className:"whitespace-pre-wrap break-words text-secondary-label",children:Ho(r)?.note}):null]}):null]},r.id))})}function Md(e){let{t}=Me(),o=xe(Fe).onAttachmentDocumentOpen,n=or(e.attachment),r=up(n),a=t("attachments.open",{name:e.attachment.name}),s=v(oe,{children:[l(r,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0 flex-1",children:[l("span",{className:"block truncate font-medium text-foreground text-chat-row",children:Ho(e.attachment)?.title||e.attachment.name}),Ho(e.attachment)?.note?l("span",{className:"block whitespace-pre-wrap break-words text-secondary-label text-chat-meta",children:Ho(e.attachment)?.note}):null,l("span",{className:"block text-secondary-label text-chat-meta",children:Ho(e.attachment)?.fileCount?t("attachments.folderFiles",{count:Ho(e.attachment).fileCount}):pi(e.attachment.sizeBytes)})]})]});return!Ho(e.attachment)?.delivered&&e.attachment.previewUrl&&(n==="video"||n==="audio")?v("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:[l("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":a,className:"flex items-center gap-2 hover:underline",children:s}),l(Ob,{kind:n,src:e.attachment.previewUrl,title:e.attachment.name})]}):o?l("button",{type:"button","data-attachment-action":"open","data-attachment-name":e.attachment.name,"aria-label":a,onClick:()=>o({attachmentId:e.attachment.id,name:e.attachment.name,mimeType:e.attachment.mimeType}),className:"flex w-full cursor-[var(--control-cursor)] items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 text-start hover:bg-background/90",children:s}):e.attachment.previewUrl?l("a",{href:e.attachment.previewUrl,download:e.attachment.name,target:"_blank",rel:"noreferrer","aria-label":a,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:s}):l("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:s})}$();function OB({environmentId:e,pluginId:t}){let{t:o}=z();return Zn(e,t)??o("rewrite.unknownPlugin")}function pp({rewrite:e,text:t,environmentId:o}){let{t:n}=z(),[r,a]=q(!1);if(!e)return null;let s=[...new Set(e.steps.filter(c=>c.via==="before-send").map(c=>c.pluginId))],i=[...new Set(e.steps.filter(c=>c.via==="slash-command").map(c=>c.pluginId))],d=c=>c.map((u,m)=>v("span",{children:[m?", ":"",l(OB,{environmentId:o,pluginId:u})]},u));return v("div",{className:"max-w-full text-chat-row text-muted-foreground","data-message-rewrite":"",children:[l(K,{size:"xs",variant:"ghost",className:"h-auto min-h-6 max-w-full whitespace-normal text-xs","aria-expanded":r,"aria-label":n("rewrite.showReceived"),onClick:()=>a(c=>!c),children:v("span",{children:[i.length?v(oe,{children:[n("rewrite.expandedPrefix"),d(i),n("rewrite.expandedSuffix"),s.length?", ":""]}):null,s.length?v(oe,{children:[n("rewrite.changedPrefix"),d(s),n("rewrite.changedSuffix")]}):null]})}),r?v("div",{className:"mt-1 max-w-full rounded-md border border-border p-2",children:[l("p",{className:"mb-1 text-xs",children:n("rewrite.received")}),l("pre",{className:"whitespace-pre-wrap break-words font-sans text-xs [overflow-wrap:anywhere]",children:t})]}):null]})}$();$();var Ad=e=>e;function nr(){return Nt().useThreadDisplayTitle?.()??Ad}$();var _w=qe(null);function Ow({data:e,target:t,children:o}){let n=W(()=>({data:e,target:t}),[e,t]);return l(_w,{value:n,children:o})}function mi(){return xe(_w)}function Fw({messageId:e}){let t=mi(),o=t?.data.useMessageForks;return!t||!o?null:l(FB,{read:o,target:t.target,messageId:e})}function FB({read:e,target:t,messageId:o}){let{t:n}=z(),r=nr(),[a,s]=q(!1),{threads:i,openThread:d}=e(t,o);return i.length===0?null:v(ln,{open:a,onOpenChange:s,children:[l(cn,{render:l(K,{variant:"ghost",size:"xs"}),children:n("forkRelations.count",{count:i.length})}),l(dn,{"aria-label":n("forkRelations.listTitle"),className:"max-h-72 max-w-80 overflow-y-auto p-1",children:i.map(c=>v(K,{variant:"ghost",className:"h-auto w-full flex-col items-start gap-0.5 py-2",onClick:()=>{s(!1),d(c.threadId)},children:[l("span",{className:"max-w-full truncate",children:r(c.title)}),l("time",{className:"text-chat-dense text-muted-foreground",dateTime:c.createdAt,children:new Date(c.createdAt).toLocaleString()})]},c.threadId))})]})}$();function Bw({messageId:e,rowId:t}){let o=mi(),n=o?.data.useMessageMemory,r=o?.data.useMemoryExperience;return!o||!n||!r?null:l(BB,{readMemory:n,readExperience:r,target:o.target,messageId:e,rowId:t})}function BB({readMemory:e,readExperience:t,target:o,messageId:n,rowId:r}){let a=e(o,n);return a===null?null:l(HB,{experienceIds:a.experienceIds,readExperience:t,target:o,messageId:n,rowId:r})}function HB({experienceIds:e,readExperience:t,target:o,messageId:n,rowId:r}){let{t:a}=z(),s=xe(Fe),[i,d]=zt(s.threadKey,`memory-context:${n}`,!1),c=ho();return v("div",{className:"flex min-w-0 flex-col items-start gap-1.5 self-stretch","data-memory-context":"",children:[v(K,{variant:"ghost-muted",size:"xs",className:"-ms-1 gap-1.5 [&_svg]:mx-0","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>{s.onProcessDisclosureChange?.(r),d(!i)},children:[l(Tt,{"aria-hidden":!0,className:G("size-icon-1",!i&&"-rotate-90")}),l(Ul,{"aria-hidden":!0,className:"size-icon-1"}),a("memoryContext.included",{count:e.length})]}),i?l("ul",{id:c,className:"m-0 w-full max-w-xl list-none divide-y divide-border overflow-hidden rounded-xl border border-border bg-card p-0",children:e.map(u=>l(UB,{readExperience:t,target:o,experienceId:u},u))}):null]})}function UB({readExperience:e,target:t,experienceId:o}){let n=e(t,o);return v("li",{className:"flex min-w-0 items-center gap-2.5 py-2 ps-3 pe-2","data-memory-experience-state":n.state,children:[l($B,{experience:n}),l(zB,{experience:n})]})}function $B({experience:e}){let{t}=z();switch(e.state){case"loading":return v("div",{className:"min-w-0 flex-1","aria-busy":"true",children:[l("span",{className:"sr-only",children:t("memoryContext.loading")}),l(Og,{className:"h-4 w-3/4"}),l(Og,{className:"mt-1 h-3 w-1/2"})]});case"failed":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.loadFailed")});case"erased":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.erased")});case"active":case"forgotten":{let o=e.state==="forgotten",n=e.recordedAt===null?null:bw(e.recordedAt,Date.now());return v("div",{className:"min-w-0 flex-1",children:[l("p",{className:G("m-0 line-clamp-2 text-ui-sm",e.title===null?"text-muted-foreground":"font-medium",o&&"text-muted-foreground line-through"),children:e.title??t("memoryContext.textUnavailable")}),n===null?null:l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.recordedBy",{author:e.authorLabel??"",...n})}),o?l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.forgottenNote")}):null]})}}}function zB({experience:e}){let{t}=z();switch(e.state){case"loading":case"erased":return null;case"failed":return l(K,{variant:"ghost",size:"xs",onClick:e.retry,children:t("memoryContext.retry")});case"active":case"forgotten":{let o=e.state==="forgotten";return v("div",{className:"flex shrink-0 items-center gap-1.5",children:[o?l(Xr,{variant:"muted",size:"sm",children:t("memoryContext.forgotten")}):null,v(K,{variant:"ghost",size:"xs",disabled:e.pending,softDisabled:e.blockedReason!==null,title:e.blockedReason??void 0,onClick:o?e.restore:e.forget,children:[e.pending?l(Js,{}):null,t(o?"memoryContext.restore":"memoryContext.forget")]})]})}}}$();var KB=()=>null;function mp(e){let t=(e.useMachineLabel??KB)(e.reference.environmentId),o=nr();return v(oe,{children:[l("div",{className:"wrap-anywhere",children:o(e.reference.title)}),t===null?null:l("div",{className:"text-muted-foreground",children:t})]})}var qB=Object.freeze([]),WB=()=>qB;function Hw(e){return e.type==="file"&&e.source?._tag==="thread-reference"}function GB(e){return e.omitted===null?e.carried:v(oe,{children:[l("span",{className:"inline-block max-w-full",children:e.carried})," ",l("span",{className:"inline-block max-w-full",children:e.omitted})]})}function Uw(e){let t=xe(Fe),{t:o}=Me(),r=(t.threadReferences?.useDeliveries??WB)(t.activeThreadEnvironmentId,e).filter(a=>a.status!=="unreadable");return r.length===0?null:l("ul",{"aria-label":o("threadReference.listLabel"),className:"flex min-w-0 max-w-[min(70%,40rem)] flex-col gap-0.5 text-chat-dense text-muted-foreground",children:r.map(a=>l(jB,{delivery:a},`${a.reference.environmentId}:${a.reference.threadId}`))})}function jB(e){let{delivery:t}=e,o=xe(Fe),{t:n}=Me(),r=nr(),a=s=>{let i={reference:t.reference};s.dispatchEvent(new CustomEvent(qs,{bubbles:!0,detail:i}))};return l("li",{"data-thread-reference-delivery":t.status,className:"flex min-w-0",children:v(Re,{children:[v(Ee,{render:l("button",{type:"button",className:"relative flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-start gap-1 rounded-sm text-left hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:s=>a(s.currentTarget)}),children:[l("span",{className:"flex h-lh shrink-0 items-center",children:l(yr,{"aria-hidden":"true",className:"size-3.5"})}),v("span",{className:"flex min-w-0 flex-1 flex-wrap gap-x-1",children:[l("span",{className:"max-w-max min-w-0 grow basis-24 truncate",children:n("threadReference.title",{title:r(t.reference.title)})}),l("span",{className:"max-w-full",children:t.status==="carried"?l(GB,{carried:n("threadReference.carried",{count:t.carriedMessages}),omitted:t.omittedMessages>0?n("threadReference.omitted",{count:t.omittedMessages}):null}):t.status==="missing"?n("threadReference.missing"):n("threadReference.loading")})]})]}),l(Pe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(mp,{reference:t.reference,useMachineLabel:o.threadReferences?.useMachineLabel})})]})})}$();function VB(e){let t=e.match(/:(\d+)$/);if(!t?.[1])return{path:e,line:void 0,column:void 0};let o=e.slice(0,-t[0].length),n=o.match(/:(\d+)$/);return n?.[1]?{path:o.slice(0,-n[0].length),line:n[1],column:t[1]}:{path:o,line:t[1],column:void 0}}function Vg(e){return e.replaceAll("\\","/")}function Qg(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function QB(e){return Qg(Vg(e.replace(/[\\/]+$/,"")))}function XB(e){return e.slice(e.lastIndexOf("/")+1)}function YB(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function JB(e){return e.startsWith("\\\\")||/^[A-Za-z]:([/\\]|$)/.test(Qg(Vg(e)))}function fp(e,t){let{path:o,line:n,column:r}=VB(e),a=Qg(Vg(o)),s=a;if(t){let i=QB(t),d=XB(i),c=JB(t)?p=>p.toLowerCase():p=>p,u=c(a),m=c(i);if(u===m)s=d;else if(u.startsWith(`${m}/`))s=`${d}/${a.slice(i.length+1)}`;else if(!YB(a)){let p=a.replace(/^\.\/+/,"").replace(/^\/+/,"");s=u.startsWith(`${c(d)}/`)?a:`${d}/${p}`}}return n?`${s}:${n}${r?`:${r}`:""}`:s}var ZB=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,eH=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,tH=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function oH(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function nH(e){let t={};for(let o of e.matchAll(eH))t[o[1]]=oH(o[2]??"");return t}function $w(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function rH(e){let o=Array.from(e.matchAll(tH)).at(-1),n=o?.index;return{text:e.slice(0,n??e.length).trim(),language:o?.[2]?.trim()||"diff",contents:o?.[3]??""}}function aH(e,t,o){let n=nH(e),r=$w(n.startIndex),a=$w(n.endIndex),s=n.filePath?.trim(),i=n.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let d=rH(t);return{id:`review-comment:${o}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:n.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:n.rangeLabel?.trim()||null,text:d.text,diff:d.contents,fenceLanguage:d.language}}function fi(e){let t=[],o=0,n=0;for(let a of e.matchAll(ZB)){let s=a.index??0,i=e.slice(o,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:i});let d=aH(a[1]??"",a[2]??"",n);d?(t.push({kind:"review-comment",comment:d}),n+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),o=s+a[0].length}let r=e.slice(o);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:r}),t}function zw(e,t){let o=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),n="`".repeat(Math.max(3,o+1));return[`${n}${e}`,t.trimEnd(),n].join(`
|
|
3534
|
-
`)}function Kw(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 o=e.filePath.replaceAll("\\","/");return[`diff --git a/${o} b/${o}`,`--- a/${o}`,`+++ b/${o}`,t].join(`
|
|
3535
|
-
`)}var Nd="[a-zA-Z][a-zA-Z0-9:_-]*";function gi(e){return e===" "||e===`
|
|
3536
|
-
`||e===" "||e==="\r"}function wr(e){return e.enabled&&e.userInvocable!==!1}var Ww="ycodium",qw=`${Ww}:`,sH=new RegExp(String.raw`(^|\s)([$/])(${Nd})(?=\s|$)`,"g");function Xg(e){return[...e.matchAll(sH)].map(t=>{let o=(t.index??0)+(t[1]?.length??0),n=t[3]??"";return{sigil:t[2],name:n,start:o,end:o+n.length+1}})}var LJ=new RegExp(String.raw`([$/])(${Nd})(?=\s|$)`,"y");function Gw(e,t){let o=t.get(e);if(o!==void 0)return o;if(!e.startsWith(qw))return;let n=t.get(e.slice(qw.length));return n?.scope===Ww?n:void 0}function jw(e,t,o,n=gi){if(t.length!==e.length+1)return null;let r=0;for(;r<e.length&&e[r]===t[r];)r+=1;let a=t.charAt(r);if(!gi(a)||r<e.length&&n(e.charAt(r))||t.slice(r+1)!==e.slice(r))return null;let s=r;for(;s>0&&!n(t.charAt(s-1));)s-=1;let d=iH.exec(t.slice(s,r))?.[1];return d===void 0||Gw(d,o)===void 0?null:{start:s,end:r+1,replacement:`$${d}${a}`}}var iH=new RegExp(String.raw`^/(${Nd})$`);function gp(e){return new Map(e.map(t=>[t.name,t]))}function Vw(e,t){return t.size===0?[]:Xg(e).flatMap(o=>{let n=Gw(o.name,t);return n===void 0?[]:[{...o,skill:n}]})}var lH="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",dH=`${lH} border border-border/70 bg-accent/40 text-foreground`,hp=`${dH} text-control-1`,yp="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",vp="truncate",Qw='<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 Xw="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",Yw=`${Xw} border border-border/70 bg-accent/40 text-foreground`,cH=`${Yw} text-control-1`,un=`${Yw} text-[0.86em] leading-none select-none`,Ln="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-['']",Uo="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Jw="truncate",$o="block self-center truncate leading-tight select-none",Yg="border-skill-chip-border bg-skill-chip text-skill-chip-foreground",Zw=`${Xw} select-none border ${Yg} text-[0.86em] leading-none`,eT='<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>',Cp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground";function uH(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function pH(e){let t=e.displayName?.trim();return t||uH(e.name)}function tT(e){let t=[],o=0;for(let n of Vw(e.text,e.index))n.start>o&&t.push(e.text.slice(o,n.start)),t.push(l(mH,{skill:n.skill,rawText:e.text.slice(n.start,n.end)},`${n.start}:${n.name}`)),o=n.end;return o===0?l(oe,{children:e.text}):(o<e.text.length&&t.push(e.text.slice(o)),l(oe,{children:t}))}function mH(e){return l("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:v("span",{className:G(hp,Yg),children:[l("span",{"aria-hidden":"true",className:yp,dangerouslySetInnerHTML:{__html:Qw}}),l("span",{className:vp,children:pH(e.skill)})]})})}function oT(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Re,{children:[v(Ee,{render:l("span",{className:G(hp,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0}),children:[l(To,{className:G(yp,"size-icon-1",n&&"opacity-100")}),l("span",{className:vp,children:t})]}),l(Pe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}var fH=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function ra(e){let t=fH.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let o=e.slice(0,t.index).replace(/\n+$/,""),n=gH(t[1]??"");return{promptText:o,contextCount:n.length,contexts:n}}function gH(e){let t=[],o=null,n=()=>{o&&(t.push({header:o.header,body:o.bodyLines.join(`
|
|
3537
|
-
`).trimEnd()}),o=null)};for(let r of e.split(`
|
|
3538
|
-
`)){let a=/^- (.+):$/.exec(r);if(a){n(),o={header:a[1],bodyLines:[]};continue}o&&(r.startsWith(" ")?o.bodyLines.push(r.slice(2)):r.length===0&&o.bodyLines.push(""))}return n(),t}var hH=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function yH(e){let t=[],o=null,n=()=>{o&&(t.push({header:o.header,body:o.bodyLines.join(`
|
|
3517
|
+
`;$();$();var Ax=qe(null),Bs=Ax.Provider,Nx=qe(""),xu=Nx.Provider;function bu(){return Pt(Nx)}function Nt(){let e=Pt(Ax);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var wu="ycodium:assistant-quote-open",Hs="ycodium:thread-reference-open";var Tu="conversation",xg="conversation.prompt-preview";var Iu="__ycodiumConversationBridge",bg="ycodium.conversation.rebindable-bridge.v1",wg="conversation.pendingRequests";var El=18,Dx=`ycodium.conversation.host-data.v${El}`,_x=80,mr="\uFFFC";$();function Ox(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(o=Ox(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function Fx(){for(var e,t,o=0,n="",r=arguments.length;o<r;o++)(e=arguments[o])&&(t=Ox(e))&&(n&&(n+=" "),n+=t);return n}var Bx=Fx;var GO=(e,t)=>{let o=new Array(e.length+t.length);for(let n=0;n<e.length;n++)o[n]=e[n];for(let n=0;n<t.length;n++)o[e.length+n]=t[n];return o},jO=(e,t)=>({classGroupId:e,validator:t}),Gx=(e=new Map,t=null,o)=>({nextPart:e,validators:t,classGroupId:o});var Hx=[],VO="arbitrary..",QO=e=>{let t=YO(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return XO(s);let i=s.split("-"),d=i[0]===""&&i.length>1?1:0;return jx(i,d,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let d=n[s],c=o[s];return d?c?GO(c,d):d:c||Hx}return o[s]||Hx}}},jx=(e,t,o)=>{if(e.length-t===0)return o.classGroupId;let r=e[t],a=o.nextPart.get(r);if(a){let c=jx(e,t+1,a);if(c)return c}let s=o.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),d=s.length;for(let c=0;c<d;c++){let u=s[c];if(u.validator(i))return u.classGroupId}},XO=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),o=t.indexOf(":"),n=t.slice(0,o);return n?VO+n:void 0})(),YO=e=>{let{theme:t,classGroups:o}=e;return JO(o,t)},JO=(e,t)=>{let o=Gx();for(let n in e){let r=e[n];Sg(r,o,n,t)}return o},Sg=(e,t,o,n)=>{let r=e.length;for(let a=0;a<r;a++){let s=e[a];ZO(s,t,o,n)}},ZO=(e,t,o,n)=>{if(typeof e=="string"){eF(e,t,o);return}if(typeof e=="function"){tF(e,t,o,n);return}oF(e,t,o,n)},eF=(e,t,o)=>{let n=e===""?t:Vx(t,e);n.classGroupId=o},tF=(e,t,o,n)=>{if(nF(e)){Sg(e(n),t,o,n);return}t.validators===null&&(t.validators=[]),t.validators.push(jO(o,e))},oF=(e,t,o,n)=>{let r=Object.entries(e),a=r.length;for(let s=0;s<a;s++){let[i,d]=r[s];Sg(d,Vx(t,i),o,n)}},Vx=(e,t)=>{let o=e,n=t.split("-"),r=n.length;for(let a=0;a<r;a++){let s=n[a],i=o.nextPart.get(s);i||(i=Gx(),o.nextPart.set(s,i)),o=i}return o},nF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,rF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=Object.create(null),n=Object.create(null),r=(a,s)=>{o[a]=s,t++,t>e&&(t=0,n=o,o=Object.create(null))};return{get(a){let s=o[a];if(s!==void 0)return s;if((s=n[a])!==void 0)return r(a,s),s},set(a,s){a in o?o[a]=s:r(a,s)}}};var aF=[],Ux=(e,t,o,n,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:o,maybePostfixModifierPosition:n,isExternal:r}),sF=e=>{let{prefix:t,experimentalParseClassName:o}=e,n=r=>{let a=[],s=0,i=0,d=0,c,u=r.length;for(let h=0;h<u;h++){let y=r[h];if(s===0&&i===0){if(y===":"){a.push(r.slice(d,h)),d=h+1;continue}if(y==="/"){c=h;continue}}y==="["?s++:y==="]"?s--:y==="("?i++:y===")"&&i--}let m=a.length===0?r:r.slice(d),p=m,f=!1;m.endsWith("!")?(p=m.slice(0,-1),f=!0):m.startsWith("!")&&(p=m.slice(1),f=!0);let g=c&&c>d?c-d:void 0;return Ux(a,f,p,g)};if(t){let r=t+":",a=n;n=s=>s.startsWith(r)?a(s.slice(r.length)):Ux(aF,!1,s,void 0,!0)}if(o){let r=n;n=a=>o({className:a,parseClassName:r})}return n},iF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((o,n)=>{t.set(o,1e6+n)}),o=>{let n=[],r=[];for(let a=0;a<o.length;a++){let s=o[a],i=s[0]==="[",d=t.has(s);i||d?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(s)):r.push(s)}return r.length>0&&(r.sort(),n.push(...r)),n}},lF=e=>({cache:rF(e.cacheSize),parseClassName:sF(e),sortModifiers:iF(e),postfixLookupClassGroupIds:dF(e),...QO(e)}),dF=e=>{let t=Object.create(null),o=e.postfixLookupClassGroups;if(o)for(let n=0;n<o.length;n++)t[o[n]]=!0;return t},cF=/\s+/,uF=(e,t)=>{let{parseClassName:o,getClassGroupId:n,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:s}=t,i=[],d=e.trim().split(cF),c="";for(let u=d.length-1;u>=0;u-=1){let m=d[u],{isExternal:p,modifiers:f,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:y}=o(m);if(p){c=m+(c.length>0?" "+c:c);continue}let x=!!y,C;if(x){let I=h.substring(0,y);C=n(I);let T=C&&s[C]?n(h):void 0;T&&T!==C&&(C=T,x=!1)}else C=n(h);if(!C){if(!x){c=m+(c.length>0?" "+c:c);continue}if(C=n(h),!C){c=m+(c.length>0?" "+c:c);continue}x=!1}let b=f.length===0?"":f.length===1?f[0]:a(f).join(":"),L=g?b+"!":b,w=L+C;if(i.indexOf(w)>-1)continue;i.push(w);let k=r(C,x);for(let I=0;I<k.length;++I){let T=k[I];i.push(L+T)}c=m+(c.length>0?" "+c:c)}return c},pF=(...e)=>{let t=0,o,n,r="";for(;t<e.length;)(o=e[t++])&&(n=Qx(o))&&(r&&(r+=" "),r+=n);return r},Qx=e=>{if(typeof e=="string")return e;let t,o="";for(let n=0;n<e.length;n++)e[n]&&(t=Qx(e[n]))&&(o&&(o+=" "),o+=t);return o},$x=(e,...t)=>{let o,n,r,a,s=d=>{let c=t.reduce((u,m)=>m(u),e());return o=lF(c),n=o.cache.get,r=o.cache.set,a=i,i(d)},i=d=>{let c=n(d);if(c)return c;let u=uF(d,o);return r(d,u),u};return a=s,(...d)=>a(pF(...d))},mF=[],qt=e=>{let t=o=>o[e]||mF;return t.isThemeGetter=!0,t},Xx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Yx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hF=/\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$/,yF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,CF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Br=e=>fF.test(e),We=e=>!!e&&!Number.isNaN(Number(e)),zn=e=>!!e&&Number.isInteger(Number(e)),Tg=e=>e.endsWith("%")&&We(e.slice(0,-1)),fr=e=>gF.test(e),Jx=()=>!0,xF=e=>hF.test(e)&&!yF.test(e),kg=()=>!1,bF=e=>vF.test(e),wF=e=>CF.test(e),TF=e=>!Ie(e)&&!Se(e),IF=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)),SF=e=>Hr(e,tb,kg),Ie=e=>Xx.test(e),Da=e=>Hr(e,ob,xF),zx=e=>Hr(e,NF,We),kF=e=>Hr(e,rb,Jx),LF=e=>Hr(e,nb,kg),Kx=e=>Hr(e,Zx,kg),PF=e=>Hr(e,eb,wF),Su=e=>Hr(e,ab,bF),Se=e=>Yx.test(e),Ml=e=>_a(e,ob),RF=e=>_a(e,nb),qx=e=>_a(e,Zx),EF=e=>_a(e,tb),MF=e=>_a(e,eb),ku=e=>_a(e,ab,!0),AF=e=>_a(e,rb,!0),Hr=(e,t,o)=>{let n=Xx.exec(e);return n?n[1]?t(n[1]):o(n[2]):!1},_a=(e,t,o=!1)=>{let n=Yx.exec(e);return n?n[1]?t(n[1]):o:!1},Zx=e=>e==="position"||e==="percentage",eb=e=>e==="image"||e==="url",tb=e=>e==="length"||e==="size"||e==="bg-size",ob=e=>e==="length",NF=e=>e==="number",nb=e=>e==="family-name",rb=e=>e==="number"||e==="weight",ab=e=>e==="shadow";var Wx=()=>{let e=qt("color"),t=qt("font"),o=qt("text"),n=qt("font-weight"),r=qt("tracking"),a=qt("leading"),s=qt("breakpoint"),i=qt("container"),d=qt("spacing"),c=qt("radius"),u=qt("shadow"),m=qt("inset-shadow"),p=qt("text-shadow"),f=qt("drop-shadow"),g=qt("blur"),h=qt("perspective"),y=qt("aspect"),x=qt("ease"),C=qt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...L(),Se,Ie],k=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],T=()=>[Se,Ie,d],S=()=>[Br,"full","auto",...T()],P=()=>[zn,"none","subgrid",Se,Ie],A=()=>["auto",{span:["full",zn,Se,Ie]},zn,Se,Ie],N=()=>[zn,"auto",Se,Ie],B=()=>["auto","min","max","fr",Se,Ie],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],j=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...T()],D=()=>[Br,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],J=()=>[Br,"screen","full","dvw","lvw","svw","min","max","fit",...T()],G=()=>[Br,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],M=()=>[e,Se,Ie],X=()=>[...L(),qx,Kx,{position:[Se,Ie]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",EF,SF,{size:[Se,Ie]}],Y=()=>[Tg,Ml,Da],ae=()=>["","none","full",c,Se,Ie],te=()=>["",We,Ml,Da],de=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[We,Tg,qx,Kx],Z=()=>["","none",g,Se,Ie],ve=()=>["none",We,Se,Ie],he=()=>["none",We,Se,Ie],Ae=()=>[We,Se,Ie],De=()=>[Br,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fr],breakpoint:[fr],color:[Jx],container:[fr],"drop-shadow":[fr],ease:["in","out","in-out"],font:[TF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fr],shadow:[fr],spacing:["px",We],text:[fr],"text-shadow":[fr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Br,Ie,Se,y]}],container:["container"],"container-type":[{"@container":["","normal","size",Se,Ie]}],"container-named":[IF],columns:[{columns:[We,Ie,Se,i]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[zn,"auto",Se,Ie]}],basis:[{basis:[Br,"full","auto",i,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[We,Br,"auto","initial","none",Ie]}],grow:[{grow:["",We,Se,Ie]}],shrink:[{shrink:["",We,Se,Ie]}],order:[{order:[zn,"first","last","none",Se,Ie]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[i,"screen",...D()]}],"min-w":[{"min-w":[i,"screen","none",...D()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",o,Ml,Da]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,AF,kF]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Tg,Ie]}],"font-family":[{font:[RF,LF,t]}],"font-features":[{"font-features":[Ie]}],"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,Se,Ie]}],"line-clamp":[{"line-clamp":[We,"none",Se,zx]}],leading:[{leading:[a,...T()]}],"list-image":[{"list-image":["none",Se,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[We,"from-font","auto",Se,Da]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[We,"auto",Se,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[zn,Se,Ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,Ie]}],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",Se,Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zn,Se,Ie],radial:["",Se,Ie],conic:[zn,Se,Ie]},MF,PF]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border: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:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[We,Se,Ie]}],"outline-w":[{outline:["",We,Ml,Da]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",u,ku,Su]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,ku,Su]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[We,Da]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,ku,Su]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[We,Se,Ie]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[We]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Se,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[We]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,Ie]}],filter:[{filter:["","none",Se,Ie]}],blur:[{blur:Z()}],brightness:[{brightness:[We,Se,Ie]}],contrast:[{contrast:[We,Se,Ie]}],"drop-shadow":[{"drop-shadow":["","none",f,ku,Su]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",We,Se,Ie]}],"hue-rotate":[{"hue-rotate":[We,Se,Ie]}],invert:[{invert:["",We,Se,Ie]}],saturate:[{saturate:[We,Se,Ie]}],sepia:[{sepia:["",We,Se,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,Ie]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[We,Se,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[We,Se,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",We,Se,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[We,Se,Ie]}],"backdrop-invert":[{"backdrop-invert":["",We,Se,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[We,Se,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[We,Se,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",We,Se,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[We,"initial",Se,Ie]}],ease:[{ease:["linear","initial",x,Se,Ie]}],delay:[{delay:[We,Se,Ie]}],animate:[{animate:["none",C,Se,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Se,Ie]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[Se,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:De()}],"translate-x":[{"translate-x":De()}],"translate-y":[{"translate-y":De()}],"translate-z":[{"translate-z":De()}],"translate-none":["translate-none"],zoom:[{zoom:[zn,Se,Ie]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Se,Ie]}],"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":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",Se,Ie]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[We,Ml,Da,zx]}],stroke:[{stroke:["none",...M()]}],"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"]}},DF=(e,{cacheSize:t,prefix:o,experimentalParseClassName:n,extend:r={},override:a={}})=>(Us(e,"cacheSize",t),Us(e,"prefix",o),Us(e,"experimentalParseClassName",n),Lu(e.theme,a.theme),Lu(e.classGroups,a.classGroups),Lu(e.conflictingClassGroups,a.conflictingClassGroups),Lu(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Us(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Us(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Pu(e.theme,r.theme),Pu(e.classGroups,r.classGroups),Pu(e.conflictingClassGroups,r.conflictingClassGroups),Pu(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Ig(e,r,"postfixLookupClassGroups"),Ig(e,r,"orderSensitiveModifiers"),e),Us=(e,t,o)=>{o!==void 0&&(e[t]=o)},Lu=(e,t)=>{if(t)for(let o in t)Us(e,o,t[o])},Pu=(e,t)=>{if(t)for(let o in t)Ig(e,t,o)},Ig=(e,t,o)=>{let n=t[o];n!==void 0&&(e[o]=e[o]?e[o].concat(n):n)},sb=(e,...t)=>typeof e=="function"?$x(Wx,e,...t):$x(()=>DF(Wx(),e),...t);var _F=sb({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 V(...e){return _F(Bx(e))}$();var Ru=qe(!0);function ib(){return xe(Ru)}var Lg=qe(void 0);function Cn(){let e=xe(Ru);return xe(Lg)??e}$();var Eu=(...e)=>e.filter((t,o,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===o).join(" ").trim();var lb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var db=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,o,n)=>n?n.toUpperCase():o.toLowerCase());var Pg=e=>{let t=db(e);return t.charAt(0).toUpperCase()+t.slice(1)};$();var cb={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 ub=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var pb=$n(({color:e="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:s,...i},d)=>vn("svg",{ref:d,...cb,width:t,height:t,stroke:e,strokeWidth:n?Number(o)*24/Number(t):o,className:Eu("lucide",r),...!a&&!ub(i)&&{"aria-hidden":"true"},...i},[...s.map(([c,u])=>vn(c,u)),...Array.isArray(a)?a:[a]]));var Q=(e,t)=>{let o=$n(({className:n,...r},a)=>vn(pb,{ref:a,iconNode:t,className:Eu(`lucide-${lb(Pg(e))}`,`lucide-${e}`,n),...r}));return o.displayName=Pg(e),o};var OF=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],Al=Q("app-window",OF);var FF=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Oa=Q("archive",FF);var BF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Nl=Q("arrow-down",BF);var HF=[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]],Dl=Q("arrow-up-to-line",HF);var UF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_l=Q("arrow-up",UF);var $F=[["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"}]],Fa=Q("blocks",$F);var zF=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Ol=Q("book-open",zF);var KF=[["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"}]],$s=Q("bookmark",KF);var qF=[["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"}]],Fl=Q("bot",qF);var WF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jo=Q("check",WF);var GF=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tt=Q("chevron-down",GF);var jF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bl=Q("chevron-left",jF);var VF=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yo=Q("chevron-right",VF);var QF=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Hl=Q("chevrons-left",QF);var XF=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Ul=Q("chevrons-right",XF);var YF=[["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"}]],eo=Q("circle-alert",YF);var JF=[["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"}]],Ba=Q("copy",JF);var ZF=[["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"}]],Eo=Q("ellipsis",ZF);var e2=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],$l=Q("eye-off",e2);var t2=[["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"}]],zl=Q("file-code",t2);var o2=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],xn=Q("file-headphone",o2);var n2=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],Ur=Q("file-pen",n2);var r2=[["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:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],$r=Q("file-play",r2);var a2=[["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"}]],Ha=Q("file-text",a2);var s2=[["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:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],Kl=Q("file-type",s2);var i2=[["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"}]],ql=Q("file",i2);var l2=[["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"}]],zr=Q("folder",l2);var d2=[["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"}]],Wl=Q("frame",d2);var c2=[["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"}]],Gl=Q("git-branch-plus",c2);var u2=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],jl=Q("git-branch",u2);var p2=[["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"}]],Vl=Q("globe",p2);var m2=[["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"}]],Ql=Q("grip-vertical",m2);var f2=[["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"}]],Xl=Q("image",f2);var g2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Yl=Q("info",g2);var h2=[["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"}]],Kr=Q("layers",h2);var y2=[["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"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Jl=Q("list-checks",y2);var v2=[["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"}]],Zl=Q("list-ordered",v2);var C2=[["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"}]],Ua=Q("list-todo",C2);var x2=[["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=Q("list",x2);var b2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],qr=Q("loader-circle",b2);var w2=[["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"}]],Wr=Q("lock-open",w2);var T2=[["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"}]],td=Q("lock",T2);var I2=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],zs=Q("maximize",I2);var S2=[["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"}]],Kn=Q("message-circle-question-mark",S2);var k2=[["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"}]],od=Q("message-circle",k2);var L2=[["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"}]],$a=Q("message-square",L2);var P2=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],gr=Q("messages-square",P2);var R2=[["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=Q("minimize-2",R2);var E2=[["path",{d:"M5 12h14",key:"1ays0h"}]],rd=Q("minus",E2);var M2=[["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"}]],qn=Q("mouse-pointer-click",M2);var A2=[["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"}]],ad=Q("package",A2);var N2=[["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"}]],za=Q("paintbrush",N2);var D2=[["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"}]],Vo=Q("paperclip",D2);var _2=[["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"}]],Wn=Q("pen-line",_2);var O2=[["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"}]],sd=Q("pencil-ruler",O2);var F2=[["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"}]],id=Q("pencil",F2);var B2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ld=Q("plus",B2);var H2=[["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"}]],dd=Q("puzzle",H2);var U2=[["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"}]],Ka=Q("rotate-ccw",U2);var $2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],cd=Q("search",$2);var z2=[["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"}]],ud=Q("send",z2);var K2=[["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"}]],pd=Q("settings",K2);var q2=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Ks=Q("skip-forward",q2);var W2=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],qs=Q("sliders-horizontal",W2);var G2=[["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"}]],Gn=Q("sparkles",G2);var j2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],md=Q("square",j2);var V2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Qo=Q("terminal",V2);var Q2=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],hr=Q("text-quote",Q2);var X2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],yr=Q("user-round",X2);var Y2=[["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"}]],Ws=Q("wrench",Y2);var J2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dt=Q("x",J2);$();function z(){return{t:Nt().i18n.usePluginTranslation()}}$();$();var Gr=qe(null),fd=qe(null);function Gs(e,t){let o=xe(fd);fe(()=>{if(!(!t||e===null||o===null))return o(e)},[o,t,e])}function gd(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,o)=>{e.set(t,(e.get(t)??0)+1),o();let n=!0;return()=>{if(!n)return;n=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),o()}}}}var mb=new Set(["Select","AlertDialog","Dialog","Menu","Popover","Tooltip","ProviderModelPicker","TraitsPicker","TimelineRowErrorFallback"]);function ie(e){let t=mb.has(e),o=n=>{let r=Nt(),a=bu(),s=Cn(),i=r.ui[e],d={};if(t){let c=xe(Gr),[u,m]=q(n.defaultOpen===!0),p=typeof n.open=="boolean"?n.open:u;Gs(c,s&&p),fe(()=>{s||m(!1)},[s]),d={open:s&&p,onOpenChange:(f,...g)=>{m(f),typeof n.onOpenChange=="function"&&n.onOpenChange(f,...g)}}}return i===void 0&&["MachineName","ProjectName","ProviderName","ThreadName","PluginName","TimelineRowErrorFallback"].includes(e)?null:vn(i,{...n,...d,...mb.has(e)&&!s?{open:!1}:{},className:`${a} ${typeof n.className=="string"?n.className:""}`})};return o.displayName=e,o}var _7=ie("useLinkContextMenu"),js=ie("ProviderInstanceIcon"),fb=ie("MachineName"),gb=ie("ProjectName"),hb=ie("ProviderName"),hd=ie("ThreadName"),Mo=ie("PluginName"),yb=ie("ProviderModelPicker"),vb=ie("TraitsPicker"),Cb=ie("TraitsMenuContent"),jn=ie("ComposerControl"),Vn=ie("ComposerControlIcon"),Mu=ie("ComposerControlChevron"),Au=ie("ComposerSelectControl"),xb=ie("TimelineRowErrorFallback"),Nu=ie("TimelineProcessShell"),yd=ie("ProcessRowIcon"),vd=ie("WorkEntryStatusDot"),Vs=ie("WorkEntryIcon");function Qn(e,t,o){return Nt().usePluginName?.(e,t,o)??null}function bb(e,t){return Nt().useThreadName?.(e,t)??null}var wb=ie("UserAvatar"),jr=ie("Badge"),O7=ie("InlineTag"),Rg=ie("Meter"),K=ie("Button"),Du=ie("Label"),Vr=ie("Input"),Tb=ie("SearchInput"),Qr=ie("EmptyInline"),Ib=ie("Textarea"),_u=ie("Switch"),F7=ie("Separator"),Eg=ie("Skeleton"),Qs=ie("Spinner"),B7=ie("ScrollArea"),H7=ie("Card"),U7=ie("CardAction"),$7=ie("CardPanel"),z7=ie("CardDescription"),K7=ie("CardFooter"),q7=ie("CardHeader"),W7=ie("CardTitle"),G7=ie("Empty"),j7=ie("EmptyContent"),V7=ie("EmptyDescription"),Q7=ie("EmptyHeader"),X7=ie("EmptyMedia"),Y7=ie("EmptyTitle"),J7=ie("InputGroup"),Z7=ie("InputGroupAddon"),e9=ie("InputGroupInput"),t9=ie("DocumentPanel"),o9=ie("MasterDetail"),Xs=ie("Select"),qa=ie("SelectItem"),Ys=ie("SelectPopup"),Sb=ie("SelectTrigger"),Ou=ie("SelectValue"),Xr=ie("Toggle"),Fu=ie("ToggleGroup"),Js=ie("Dialog"),n9=ie("DialogClose"),Zs=ie("DialogDescription"),Bu=ie("DialogFooter"),Hu=ie("DialogHeader"),ei=ie("DialogPopup"),kb=ie("DialogPanel"),ti=ie("DialogTitle"),r9=ie("DialogTrigger"),Ao=ie("Menu"),Lb=ie("MenuGroup"),vo=ie("MenuItem"),No=ie("MenuPopup"),Yr=ie("MenuRadioGroup"),Xn=ie("MenuRadioItem"),Cd=ie("MenuSeparator"),Do=ie("MenuTrigger"),rn=ie("Popover"),an=ie("PopoverPopup"),sn=ie("PopoverTrigger"),Pb=ie("Table"),Rb=ie("TableBody"),bn=ie("TableCell"),Wa=ie("TableHead"),Eb=ie("TableHeader"),Jr=ie("TableRow"),Pe=ie("Tooltip"),Re=ie("TooltipPopup"),Ee=ie("TooltipTrigger"),xd=ie("Alert"),bd=ie("AlertAction"),Uu=ie("AlertDescription"),Mg=ie("AlertTitle"),oi=ie("Kbd"),vr=ie("DecisionCard"),$u=ie("ChoiceList"),zu=ie("Command"),Ku=ie("CommandGroup"),qu=ie("CommandItem"),Wu=ie("CommandList"),Mb=ie("StyledDiffCodeView"),Ab=ie("DevBackdropArt"),wo=ie("Markdown"),Nb=ie("DiffView"),Db=ie("MediaPlayer");var{jsx:l,jsxs:v,Fragment:oe}=window.__ycodiumPluginHost.jsxRuntime;var Z2="sr-only @min-[30rem]/composer-first-row:not-sr-only";function Ob({mode:e,onModeChange:t}){let{t:o}=z();return l("div",{className:"flex shrink-0 items-center gap-1",children:v(Fu,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":o("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:n=>{let r=n[0];(r==="chat"||r==="trajectory")&&t(r)},children:[l(_b,{value:"chat",label:o("trajectory.toggleChat"),icon:l($a,{"aria-hidden":!0})}),l(_b,{value:"trajectory",label:o("trajectory.toggleTrajectory"),icon:l(Zl,{"aria-hidden":!0})})]})})}function _b({value:e,label:t,icon:o}){return v(Pe,{children:[v(Ee,{render:l(Xr,{value:e,"aria-label":t}),children:[o,l("span",{className:Z2,children:t})]}),l(Re,{side:"top",children:t})]})}function Fb({mode:e,visible:t,chat:o,trajectory:n}){return l("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":e,"data-pane-visible":t?"true":"false",children:l(Lg,{value:t,children:e==="chat"?o:n})})}$();function Bb(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,o=e.inputTokens;if(t===void 0||o===void 0)return null;let n=t+o;if(n<=0)return null;if(t>=n)return"100%";let r=t/n*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 Hb(e){let t,o,n,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&&(o=(o??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(n=(n??0)+s.cachedInputTokens));if(!(t===void 0&&o===void 0&&n===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...o!==void 0?{inputTokens:o}:{},...n!==void 0?{cachedInputTokens:n}:{}}}$();$();var Ub=qe(null);function $b({data:e,target:t,children:o}){let n=R(r=>e.readTurnChanges(t,r),[e,t.environmentId,t.threadId]);return l(Ub,{value:e.readTurnChanges?n:null,children:o})}function zb({turnId:e,filePath:t,onClose:o}){let n=xe(Ub),r=E(n),a=E(o);a.current=o;let{t:s}=z(),[i,d]=q(0),[c,u]=q(0),[m,p]=q(null),[f,g]=q("loading");return H(()=>{if(n!==r.current){a.current();return}let h=!0;if(g("loading"),!n){g("ready");return}return n({turnId:e,filePath:t,textOffset:i}).then(y=>{h&&(p(x=>({...y,text:i===0?y.text:(x?.text??"")+y.text})),g("ready"))},()=>{h&&g("failed")}),()=>{h=!1}},[n,e,t,i,c]),l(Js,{open:!0,onOpenChange:h=>{h||o()},children:v(ei,{className:"flex max-h-[80vh] w-[min(90vw,60rem)] flex-col gap-3",children:[l(ti,{children:s("turnOverview.recordedChanges")}),l(Zs,{children:t}),l("p",{className:"text-xs text-muted-foreground",children:m||f==="ready"?s(m?.machineUpdateRequired?"turnOverview.changesUpgradeMachine":`turnOverview.changesSource.${m?.source??"unavailable"}`):null}),f==="loading"?l("p",{role:"status",children:s("turnOverview.changesLoading")}):null,f==="failed"?l(K,{onClick:()=>u(h=>h+1),children:s("turnOverview.changesRetry")}):null,m?.text?l("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-all text-xs",tabIndex:0,children:m.text}):null,m?.truncated?l("p",{children:s("turnOverview.changesTruncated")}):null,m?.textWindow?.nextOffset!=null?l(K,{disabled:f==="loading",onClick:()=>d(m.textWindow.nextOffset),children:s("turnOverview.changesMore")}):null,l(K,{onClick:o,children:s("turnOverview.changesClose")})]})})}$();$();function wd(e,t){if(!Number.isFinite(e)||e<0)return t.milliseconds("0");if(e<1e3)return t.milliseconds(String(Math.max(1,Math.round(e))));if(e<1e4){let i=Math.round(e/100)/10;return t.seconds(i>=10?"10":i.toFixed(1))}if(e<6e4)return t.seconds(String(Math.round(e/1e3)));let o=Math.round(e/1e3),n=Math.floor(o/3600),r=Math.floor(o%3600/60),a=o%60,s=[];return n>0&&s.push(t.hours(String(n))),r>0&&s.push(t.minutes(String(r))),a>0&&s.push(t.seconds(String(a))),s.reduce((i,d)=>t.pair(i,d))}function Kb(e,t){return!Number.isFinite(e)||e<=0?t.seconds("0"):wd(e,t)}function _o(){let{t:e}=z();return W(()=>{let t={milliseconds:o=>e("duration.milliseconds",{value:o}),seconds:o=>e("duration.seconds",{value:o}),minutes:o=>e("duration.minutes",{value:o}),hours:o=>e("duration.hours",{value:o}),pair:(o,n)=>e("duration.pair",{left:o,right:n})};return{units:t,formatDuration:o=>wd(o,t),formatCountedDuration:o=>Kb(o,t)}},[e])}function eB({fact:e,ownerId:t,onLocate:o,turnId:n}){let{t:r}=z(),{formatDuration:a}=_o(),[s,i]=q(!1),[d,c]=q(null);Gs(t,s||d!==null);let u=r(`turnOverview.${e.kind}`,{count:e.value,duration:a(e.value)}),m=e.targets[0];return e.targets.length===1&&m?.filePath===void 0?l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs",title:r("turnOverview.locate"),onClick:()=>m&&o(m.rowId),disabled:!m,children:u}):v(oe,{children:[v(rn,{open:s,onOpenChange:i,children:[l(sn,{render:l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs"}),children:u}),v(an,{className:"flex max-h-72 w-80 flex-col gap-1 overflow-auto p-2",children:[e.partial?l("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:r("turnOverview.loadedFacts")}):null,e.targets.map((p,f)=>v("div",{className:"flex min-w-0 items-center gap-1",children:[p.filePath?l(K,{variant:"ghost",size:"sm",className:"min-w-0 flex-1 justify-start whitespace-normal break-all text-left",title:r("turnOverview.recordedChanges"),onClick:()=>{i(!1),c(p.filePath)},children:p.filePath}):l("span",{className:"min-w-0 flex-1 px-2 text-xs",children:r("turnOverview.step",{index:f+1})}),l(K,{size:"xs",variant:"outline",onClick:()=>{i(!1),o(p.rowId)},children:r("turnOverview.locate")})]},`${p.rowId}:${p.filePath??f}`))]})]}),d!==null?l(zb,{turnId:n,filePath:d,onClose:()=>c(null)},`${n}:${d}`):null]})}function Gu({summary:e,...t}){let{t:o}=z();return v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5 text-muted-foreground","data-turn-facts":e.turnId,children:[e.facts.map(n=>l(eB,{fact:n,turnId:e.turnId,ownerId:`turn:${e.turnId}`,...t},n.kind)),e.facts.some(n=>n.partial)?l(qb,{className:"px-1 text-ui-2xs",detail:o("turnOverview.loadedFacts"),children:o("turnOverview.loaded")}):null]})}function ju({summary:e}){let{t}=z();return e.hasCompaction?v(qb,{className:"inline-flex shrink-0 items-center text-muted-foreground",detail:t("turnOverview.compaction"),children:[l(Oa,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:t("turnOverview.compaction")})]}):null}function qb({children:e,detail:t,className:o}){return v(Pe,{children:[l(Ee,{render:l("span",{className:o}),children:e}),l(Re,{children:t})]})}$();var Ag=100;function Vu(e){return typeof e=="function"?e():e}function jb(e,t){return typeof t=="function"?t(e):t}var tB=new Map,Wb=new Map;function oB(e,t,o){let n=e.get(t);return n===void 0&&(n={values:new Map,limit:Math.max(1,o)},e.set(t,n)),n}function nB(e,t){let o=Wb.get(e);return o===void 0&&(o={values:new Map,limit:Math.max(1,t)},Wb.set(e,o)),o}function Gb(e){e.alive&&(e.alive=!1,e.dispose?.(e.value),e.subscribers.clear())}function rB(e,t){if(!(e.values.size<=e.limit)){for(let[o,n]of e.values){if(e.values.size<=e.limit)break;n===t||n.committed||n.leases>0||e.values.get(o)===n&&(e.values.delete(o),Gb(n))}for(let[o,n]of e.values){if(e.values.size<=e.limit)break;n===t||n.leases>0||n.retain?.(n.value)===!0||e.values.get(o)===n&&(e.values.delete(o),Gb(n))}}}function Ng(e,t,o){e.values.get(t)===o&&(e.values.delete(t),e.values.set(t,o))}function Td(e){queueMicrotask(()=>rB(e))}function Vb(e,t,o,n){let r=e.values.get(t);return r===void 0&&(r={value:Vu(o),subscribers:new Set,leases:0,alive:!0,committed:!1,dispose:n.dispose,retain:n.retain},e.values.set(t,r)),r}function Ge(e,t,o){"use no memo";let{cell:n,subscribe:r,setValue:a}=aB(e,t,o),s=R(()=>n.value,[n]);return[Go(r,s,s),a]}function aB(e,t,o){let n=oB(tB,o.namespace,o.limit??Ag),r=Vb(n,e,t,o),a=Math.max(1,o.limit??Ag),s=R(d=>r.alive?(n.limit=a,r.committed=!0,r.dispose=o.dispose,r.retain=o.retain,Ng(n,e,r),r.leases+=1,r.subscribers.add(d),Td(n),()=>{r.subscribers.delete(d),r.leases=Math.max(0,r.leases-1),Td(n)}):()=>{},[r,n,e,a,o.dispose,o.retain]),i=R(d=>{if(!r.alive||n.values.get(e)!==r)return;let c=r.value,u=jb(c,d);if(!Object.is(c,u)){r.value=u,Ng(n,e,r);for(let m of r.subscribers)m();Td(n)}},[r,n,e]);return{cell:r,subscribe:s,setValue:i}}function Qb(e,t){let o=E(null);(o.current===null||o.current.key!==e)&&(o.current={key:e,value:Vu(t)});let[,n]=Na(a=>a+1,0),r=R(a=>{let s=o.current;if(s===null||s.key!==e)return;let i=jb(s.value,a);Object.is(s.value,i)||(s.value=i,n())},[e]);return[o.current.value,r]}function $e(e,t,o){let n=Math.max(1,o.limit??Ag),r=nB(o.namespace,n),a=Vb(r,e,()=>({current:Vu(t)}),o);return H(()=>{if(!(!a.alive||r.values.get(e)!==a))return r.limit=n,a.committed=!0,a.dispose=o.dispose,a.retain=o.retain,Ng(r,e,a),a.leases+=1,Td(r),()=>{a.leases=Math.max(0,a.leases-1),Td(r)}},[a,r,e,n,o.dispose,o.retain]),a.value}function Xo(e,t){let o=E(null);return(o.current===null||o.current.key!==e)&&(o.current={key:e,ref:{current:Vu(t)}}),o.current.ref}$();var Dg="trajectory-summary-reveal";function Xb({inputKey:e,rows:t,groupRows:o,paneVisible:n,resetFilter:r}){let[a,s]=Ge(e,{},{namespace:"trajectory-turn-disclosure"}),[i,d]=Ge(e,()=>new Set,{namespace:"trajectory-routine-disclosure"}),[c,u]=Ge(e,!1,{namespace:"trajectory-expand-all"}),[m,p]=Ge(e,null,{namespace:Dg}),[f,g]=Ge(e,null,{namespace:"trajectory-summary-highlight"}),h=$e(e,()=>new Set,{namespace:"trajectory-default-open"}),y=W(()=>o?.(t,c)??null,[o,t,c]),x=W(()=>{let I=new Map,T=new Map;if(y===null)return{rows:t,headers:I,routines:T};let S=y.findLast(N=>N.turnId!==null),P=new Set(y.map(N=>N.id));if(h.current.size>200)for(let N of h.current)P.has(N)||h.current.delete(N);n&&S&&h.current.add(S.id);let A=[];for(let N of y){let B=N.items[0],O=B?.kind==="step"?B.row:B?.rows[0];if(!O)continue;let j=c||(a[N.id]??(N.turnId===null||h.current.has(N.id)||N.summary?.state==="running"));if(I.set(N.id,{group:N,expanded:j}),A.push({...O,id:N.id,kind:"turn-header",turnId:N.turnId,createdAt:N.summary?.startedAt??O.createdAt}),!!j)for(let U of N.items){if(U.kind==="step"){A.push(U.row);continue}let D=i.has(U.id);T.set(U.id,{count:U.rows.length,expanded:D}),A.push({...U.rows[0],id:U.id,kind:"routine-header"}),D&&A.push(...U.rows)}}return{rows:A,headers:I,routines:T}},[y,t,n,h,c,a,i]),C=E(x.headers);C.current=x.headers;let b=R(I=>{u(!1),s(T=>({...T,[I]:!C.current.get(I)?.expanded}))},[u,s]),L=R(I=>d(T=>{let S=new Set(T);return S.has(I)?S.delete(I):S.add(I),S}),[d]),w=R(I=>p(T=>({rowId:I,nonce:(T?.nonce??0)+1})),[p]);fe(()=>{if(!n||m===null)return;r();let I=y?.find(S=>S.id===m.rowId||S.items.some(P=>P.kind==="step"?P.row.id===m.rowId:P.rows.some(A=>A.id===m.rowId)));if(!I||I.id===m.rowId)return;x.headers.get(I.id)?.expanded||s(S=>({...S,[I.id]:!0}));let T=I.items.find(S=>S.kind==="routine"&&S.rows.some(P=>P.id===m.rowId));T&&!i.has(T.id)&&d(S=>new Set([...S,T.id]))},[n,m,r,y,x.headers,i,s,d]);let k=R(I=>{g(I.rowId),p(T=>T===I?null:T)},[g,p]);return{...x,expandAll:c,setExpandAll:u,toggleTurn:b,toggleRoutine:L,locate:w,request:m,completeReveal:k,highlighted:f}}function ni(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Yb({rows:e,usageByTurnId:t,onSelect:o,summaries:n,actions:r}){let{t:a}=z();return e.map(({item:s,ordinal:i})=>{let d=s.attachmentPreview,c=s.isSystemMessage?a("turnNavigator.systemWake"):d===void 0?s.userText:d.count===1?d.name:a("forkRelations.attachmentPreview",d),u=s.turnId===null?void 0:n.get(s.turnId),m=s.turnId===null?void 0:t.get(s.turnId);return v("div",{className:"rounded-md hover:bg-accent/50",children:[v("button",{type:"button","data-turn-navigator-row":s.sectionKey,onClick:()=>o(s),className:"flex w-full cursor-[var(--control-cursor)] items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[l("span",{className:"shrink-0 pt-px font-mono text-ui-2xs text-muted-foreground tabular-nums",children:i}),v("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[v("span",{className:"flex items-start gap-1",children:[l("span",{className:"line-clamp-2 min-w-0 flex-1 font-medium text-chat leading-snug",children:c}),u?l(ju,{summary:u}):null]}),s.assistantText?l("span",{className:"line-clamp-1 text-ui-xs text-muted-foreground leading-snug",children:s.assistantText}):null,m?.outputTokens!==void 0?l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:ni(m.outputTokens)}):null]})]}),u&&r?l("div",{className:"pb-1 pl-7 pr-2",children:l(Gu,{summary:u,...r})}):null]},s.sectionKey)})}function sB({context:e,useSummaries:t,...o}){let n=t(e.target),r=W(()=>new Map(n.map(s=>[s.turnId,s])),[n]),[,a]=Ge(e.threadKey,null,{namespace:Dg});return l(Yb,{...o,summaries:r,actions:{onLocate:s=>{a(i=>({rowId:s,nonce:(i?.nonce??0)+1})),o.onClose(),e.openTrajectory()},onOpenFileDiff:e.onOpenFileDiff}})}var iB=new Map;function Jb(e){let t=e.summaryContext;return t?.data.useTurnSummaries?l(sB,{...e,context:t,useSummaries:t.data.useTurnSummaries}):l(Yb,{...e,summaries:iB})}function lB({totals:e}){let{t}=z();if(!e)return null;let o=Bb(e),n=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:ni(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:ni(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:o===null?ni(e.cachedInputTokens):`${ni(e.cachedInputTokens)} (${o})`}].filter(r=>r!==null);return n.length===0?null:v("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),n.map(r=>v("span",{className:"shrink-0 font-mono text-ui-2xs text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var dB=pe(function({getText:t,size:o="xs",variant:n="outline",className:r}){let{t:a}=z(),s=Nt().writeClipboard,[i,d]=q(!1),c=a("turnNavigator.copyMarkdown");return v(Pe,{children:[l(Ee,{render:l(K,{"aria-label":c,disabled:i,onClick:()=>{s(t()).then(()=>{d(!0),window.setTimeout(()=>d(!1),1e3)})},type:"button",size:o,variant:n,className:V("text-muted-foreground hover:text-foreground",r)}),children:i?l(jo,{className:"size-3 text-primary"}):l(Ba,{className:"size-3"})}),l(Re,{children:l("p",{children:c})})]})});function Zb({items:e,totalTurnCount:t,bottomInset:o,usageByTurnId:n,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float",summaryContext:d}){let{t:c}=z(),[u,m]=q(!1),p=W(()=>e.map((y,x)=>({item:y,ordinal:x+1})).reverse(),[e]),f=W(()=>Hb(p.map(({item:y})=>y.turnId===null?void 0:n.get(y.turnId))),[p,n]);if(e.length===0)return null;let g=t??e.length,h=c("turnNavigator.open",{count:g});return v(rn,{onOpenChange:m,open:u,children:[v(sn,{render:l(K,{"aria-label":h,className:V("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:o+12}:void 0,title:h,variant:"glass"}),children:[l(ed,{"aria-hidden":!0}),l("span",{className:"font-mono font-semibold tabular-nums",children:g})]}),l(an,{align:"end",className:"w-80 flex-col",side:"top",children:v("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[v("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.title")}),l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:g})]}),l("div",{className:V("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:l(Jb,{rows:p,usageByTurnId:n,summaryContext:d,onSelect:y=>{m(!1),r(y)},onClose:()=>m(!1)})}),l(lB,{totals:f}),v("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.export")}),l(dB,{size:"icon-xs",getText:a,variant:"ghost"}),l(K,{"aria-label":c("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:c("turnNavigator.downloadMarkdown"),variant:"ghost",children:l("span",{className:"font-mono",children:".md"})}),l(K,{"aria-label":c("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:c("turnNavigator.downloadJson"),variant:"ghost",children:l("span",{className:"font-mono",children:".json"})})]})]})})]})}$();function Id(e){return e.replace(/\s+/g," ")}function cB(e,t){let o=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(o)&&(o=o.slice(1)),o}function uB(e,t){let o=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(o)&&(o=o.slice(0,-1)),o}function Qu(e){let o=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return o?.closest('[data-message-role="assistant"]')?o:null}function ew(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),o=Qu(t.startContainer);if(o===null||Qu(t.endContainer)!==o)return null;let n=o.closest("[data-message-id]")?.dataset.messageId;if(!n)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(o),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(o),s.setStart(t.endContainer,t.endOffset);let i=Id(t.toString()),d=i.length>i.trimStart().length?" ":"",c=i.length>i.trimEnd().length?" ":"",u=Id(a.toString()+d),m=Id(c+s.toString()),p=u.length,f=p+i.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),y=g[g.length-1]??h;return{messageId:n,text:r,start:p,end:f,prefix:cB(u,32),suffix:uB(m,32),anchor:{x:y.right,top:h.top,bottom:y.bottom}}}var Xu="assistant-quote-inserter",Yu="assistant-quote-open-comment";var pB=300;function tw(e){let{data:t,target:o,threadKey:n,surfaceRef:r}=e,{t:a}=z(),s=$e(n,null,{namespace:Xu}),[,i]=Ge(n,null,{namespace:Yu}),[d,c]=q(null),u=E(null);if(H(()=>{let h,y=()=>{let k=r.current,I=document.getSelection(),T=I&&I.rangeCount>0?I.getRangeAt(0):null;if(!k||!T||!k.contains(T.commonAncestorContainer)){c(null);return}let S=ew(I);if(S===null){c(null);return}let P=t.assistantQuotes.serialize({version:1,environmentId:o.environmentId,threadId:o.threadId,messageId:S.messageId,text:S.text,start:S.start,end:S.end,prefix:S.prefix,suffix:S.suffix});c({source:P,...S.anchor})},x=k=>{u.current?.contains(k.target)||(clearTimeout(h),h=setTimeout(y,pB))},C=k=>{u.current?.contains(k.target)||(clearTimeout(h),c(null))},b=()=>c(null),L=k=>{k.key==="Escape"&&c(null)},w=()=>{(document.getSelection()?.isCollapsed??!0)&&c(null)};return document.addEventListener("pointerup",x,!0),document.addEventListener("keyup",x,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",L,!0),document.addEventListener("selectionchange",w),window.addEventListener("scroll",b,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",x,!0),document.removeEventListener("keyup",x,!0),document.removeEventListener("pointerdown",C,!0),document.removeEventListener("keydown",L,!0),document.removeEventListener("selectionchange",w),window.removeEventListener("scroll",b,!0)}},[t,r,o.environmentId,o.threadId]),d===null)return null;let m=d.source,p=Math.max(8,Math.min(window.innerWidth-200,d.x-12)),f=d.bottom+6,g=f+40<=window.innerHeight?f:Math.max(8,d.top-40);return l("div",{ref:u,className:"fixed z-50 rounded-control-3 bg-background",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:v(K,{size:"sm",variant:"outline",className:"shadow-md",disabled:m===null,title:m===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{m!==null&&s.current?.(m)===!0&&(i(m),document.getSelection()?.removeAllRanges(),c(null))},children:[l(hr,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}$();$();function ow(e){let t=e.map(n=>({key:n.key,turnId:n.turnId,firstRowIndex:n.firstRowIndex,endRowIndex:n.firstRowIndex+n.rowIds.length})),o=new Map;for(let n of e)for(let[r,a]of n.rowIds.entries())o.set(a,{turnId:n.turnId,index:n.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(n=>[n.key,n])),byRowId:o}}function Ju({index:e,visibleSectionKeys:t,protectedRowIds:o,selectionRows:n}){let r=t.flatMap(c=>{let u=e.bySectionKey.get(c)?.turnId;return u==null?[]:[u]}),a=o.flatMap(c=>{let u=e.byRowId.get(c)?.turnId;return u==null?[]:[u]}),s=n?e.byRowId.get(n.firstRowId)?.index:void 0,i=n?e.byRowId.get(n.lastRowId)?.index:void 0,d=s===void 0||i===void 0?[]:e.sections.flatMap(c=>c.turnId!==null&&c.endRowIndex>Math.min(s,i)&&c.firstRowIndex<=Math.max(s,i)?[c.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:d.length>0?{firstTurnId:d[0],lastTurnId:d.at(-1)}:null}}function nw(e,t,o,n){if(!n)return o;let r=e.findIndex(a=>t.has(a));return r<0?o:Math.max(o,e.length-r)}$();$();function _g(e,t){for(let o of e.querySelectorAll("[data-timeline-row-id]"))if(o.dataset.timelineRowId===t)return o;return null}function Ga(e,t){let o=0,n=e.length,r=-1;for(;o<n;){let a=Math.floor((o+n)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,n=a):o=a+1}return r}function mB(e){let t=e.getBoundingClientRect().top,o=e.querySelectorAll("[data-timeline-turn-section]"),n=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Ga(s,t),d=i<0?void 0:s[i],c=d?.dataset.timelineRowId;return!d||c===void 0?null:{rowId:c,offsetPx:Math.round(t-d.getBoundingClientRect().top)}};if(o.length===0)return n(e);let r=Ga(o,t);if(r<0)return null;for(let a=r;a<o.length;a+=1){let s=n(o[a]);if(s)return s}return null}function rw(e,t){let o=0,n=e;for(;n&&n!==t;)o+=n.offsetTop,n=n.offsetParent;return o}var Og=class extends ur{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function aw({inputKey:e,onBeforeInputChange:t,handleRef:o,onAttach:n,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let d=E(null),c=E({inputKey:e,store:gd()});c.current.inputKey!==e&&(c.current={inputKey:e,store:gd()});let u=E(i);u.current=i;let m=R(f=>{let g=c.current;return g.store.acquire(f,()=>{c.current===g&&u.current?.(g.store.rows())})},[]);fe(()=>{i?.(c.current.store.rows())},[e,i]),pr(o,()=>({get node(){return d.current},measure:()=>{let f=d.current;return f?{scroll:f.scrollTop,scrollLength:f.clientHeight,contentLength:f.scrollHeight,topOf:g=>{let h=_g(f,g);return h===null?null:rw(h,f)},heightOf:g=>{let h=_g(f,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>mB(f)}:null},scrollToEnd:f=>{let g=d.current;if(g){if(f?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(f,g)=>{let h=d.current;if(!h)return!1;let y=_g(h,f);return y?(h.scrollTop=Math.max(0,rw(y,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:f=>{let g=d.current;g&&(g.scrollTop=Math.max(0,f))}}),[]);let p=R(f=>{d.current=f,n(f)},[n]);return l(Og,{inputKey:e,onBeforeInputChange:t,children:l(fd,{value:m,children:l("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function ai(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),o=e.getAttribute?.("contenteditable");if(t==="textarea"||o==="true"||o===""||o==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let n=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(n))return!0}return e.matches?.(":focus-visible")??!1}function ri(e,t){let n=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return n&&t.contains(n)?n.dataset.timelineRowId??null:null}function Zu(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let o=null,n=null;for(let c=0;c<t.rangeCount;c+=1){let u=t.getRangeAt(c);u.intersectsNode(e)&&(o??=u,n=u)}if(!o||!n)return null;let r=ri(o.startContainer,e),a=ri(n.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,d=s[s.length-1]?.dataset.timelineRowId;return i&&d?{firstRowId:r??i,lastRowId:a??d}:null}function Sd(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let o=0;o<t.rangeCount;o+=1)if(t.getRangeAt(o).intersectsNode(e))return!0;return!1}$();function Zr(e){let t=E(e);t.current=e;let o=E(!1),n=E(null),r=E(null),a=E(0),s=R(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=R(()=>{if(!o.current||!t.current||r.current!==null||n.current===null)return;let u=++a.current;r.current=requestAnimationFrame(m=>{if(u!==a.current||(r.current=null,!o.current||!t.current))return;let p=n.current;n.current=null,p?.(m)})},[]),d=R(u=>{n.current=u,i()},[i]),c=R(()=>{n.current=null,s()},[s]);return fe(()=>(o.current=!0,i(),()=>{o.current=!1,s()}),[e,s,i]),W(()=>({request:d,cancel:c}),[d,c])}function sw({root:e,inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d}){let c=E({inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d});c.current={inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d};let u=Zr(o),m=E(null),p=R(()=>{let g=c.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let y=h.top+g.topInset,x=h.bottom-g.bottomInset,C=e.querySelectorAll("[data-timeline-turn-section]"),b=Ga(C,y),L=[];if(b>=0)for(let S=b;S<C.length;S+=1){let P=C[S];if(P.getBoundingClientRect().top>=x)break;P.dataset.timelineTurnSection!==void 0&&L.push(P.dataset.timelineTurnSection)}let w=[...g.interactionRows()],k=e.ownerDocument.activeElement;if(ai(k)){let S=ri(k,e);S&&w.push(S)}let I=Ju({index:g.index,visibleSectionKeys:L,protectedRowIds:w,selectionRows:Zu(e)}),T=`${g.inputKey}:${JSON.stringify(I)}`;T!==m.current&&(m.current=T,g.onRangeChange?.(I))},[e]),f=R(()=>u.request(p),[u,p]);return fe(()=>{if(m.current=null,!o||!e)return;let g=t,h=!0,y=()=>{!h||c.current.inputKey!==g||!c.current.visible||(c.current.onSelectionChange(Sd(e)),f())};e.addEventListener("scroll",y,{passive:!0}),e.addEventListener("focusin",y),e.addEventListener("focusout",y),e.ownerDocument.addEventListener("selectionchange",y);let x=typeof ResizeObserver>"u"?null:new ResizeObserver(y);return x?.observe(e),e.firstElementChild&&x?.observe(e.firstElementChild),y(),()=>{h=!1,u.cancel(),x?.disconnect(),e.removeEventListener("scroll",y),e.removeEventListener("focusin",y),e.removeEventListener("focusout",y),e.ownerDocument.removeEventListener("selectionchange",y),i?.(null)}},[u,t,i,f,e,o]),fe(()=>{o&&f()},[n,f,o]),f}$();var iw=pe(function({sectionKey:t,rowKeyPrefix:o,rowIds:n,renderRow:r,sectionRef:a}){return l("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:n.map(s=>l("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${o}:${s}`))})});var fB=400;function lw({root:e,minimumCount:t,keepAbovePx:o=0,canCompact:n,onCompact:r}){let a=e.ownerDocument,s=new Set,i,d=!1,c=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,u=()=>{if(i=void 0,a.hidden||s.size>0||!n()||e.clientHeight<=0||!c()||Sd(e))return;let L=e.querySelectorAll("[data-timeline-turn-section]"),w=e.getBoundingClientRect().top-32-o,k=0,I=Math.max(0,L.length-t);for(;k<I;){let S=Math.floor((k+I)/2),P=L[S].getBoundingClientRect().bottom;if(!Number.isFinite(P))return;P<=w?k=S+1:I=S}if(k===0)return;let T=a.activeElement;if(T&&ai(T)){for(let S=0;S<k;S+=1)if(L[S].contains(T))return}r(L.length-k)},m=!1,p=()=>{if(a.hidden||s.size>0||!n()||m){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(u,fB))},f=()=>{clearTimeout(i),i=void 0,p()},g=()=>{let L=c();!L||!d?f():p(),d=L},h=L=>{s.add(L.pointerId),f()},y=L=>{s.delete(L.pointerId),f()},x=()=>{m=Sd(e),f()},C=()=>{s.clear(),f()},b=["wheel","keydown","focusin","focusout"];for(let L of b)e.addEventListener(L,f,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",y,!0),a.addEventListener("pointercancel",y,!0),a.addEventListener("selectionchange",x),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",C),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let L of b)e.removeEventListener(L,f);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",y,!0),a.removeEventListener("pointercancel",y,!0),a.removeEventListener("selectionchange",x),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",C)}}}$();function dw({root:e,topInsetPx:t,onActiveSectionChange:o,onActiveStartHiddenChange:n,active:r}){let a=E(r);a.current=r;let s=Zr(r),i=E(new Map),d=E(null),c=E(null),u=E(o);u.current=o;let m=E(n);m.current=n;let p=E(null),f=E(null),g=R(()=>{if(!a.current||!e)return;let b=e.scrollTop+t,L=null,w=Number.NEGATIVE_INFINITY,k=null,I=Number.POSITIVE_INFINITY;for(let[A,N]of i.current){if(!N.isConnected)continue;let B=N.offsetTop;B<I&&(I=B,k=A),B<=b&&B>=w&&(w=B,L=A)}let T=L??k;T!==c.current&&(c.current=T,u.current(T));let S=T===null?null:i.current.get(T)?.firstElementChild??null,P=S!==null&&S.getBoundingClientRect().bottom<=e.getBoundingClientRect().top+1;P!==p.current&&(p.current=P,m.current?.(P))},[e,t]),h=R(()=>{a.current&&s.request(g)},[s,g]);H(()=>{if(!r||!e||typeof IntersectionObserver>"u")return;let b=!0,L=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});d.current=L;for(let k of i.current.values())L.observe(k);let w=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,threshold:0});f.current=w;for(let k of i.current.values())k.firstElementChild&&w.observe(k.firstElementChild);return h(),()=>{b=!1,L.disconnect(),d.current=null,w.disconnect(),f.current=null,s.cancel()}},[r,s,h,e,t]);let y=E(new Map),x=R(b=>{let L=y.current.get(b);if(L)return L;let w=k=>{let I=i.current.get(b);I&&I!==k&&(d.current?.unobserve(I),I.firstElementChild&&f.current?.unobserve(I.firstElementChild),i.current.delete(b)),k?(i.current.set(b,k),d.current?.observe(k),k.firstElementChild&&f.current?.observe(k.firstElementChild)):y.current.get(b)===w&&y.current.delete(b)};return y.current.set(b,w),w},[]),C=R(()=>{a.current&&(c.current=null,p.current=null,h())},[h]);return W(()=>({observeSection:x,refresh:C}),[x,C])}function ep(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&&e.effortLevel===t.effortLevel}function cw(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function uw(e,t){return e.turnId===t.turnId&&e.createdAt===t.createdAt&&ep(e.badge,t.badge)}function pw(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":return uw(e,t);case"turn-summary":{let o=t;return e.createdAt===o.createdAt&&e.copyText===o.copyText&&e.cardAnchor===o.cardAnchor&&e.footer===o.footer&&(e.identity===void 0?o.identity===void 0:o.identity!==void 0&&uw(e.identity,o.identity))}case"tool-group":{let o=t;return e.createdAt===o.createdAt&&e.groupId===o.groupId&&cw(e.entries,o.entries)}case"working":{let o=t;return e.createdAt===o.createdAt&&e.turnId===o.turnId&&e.compacting===o.compacting&&ep(e.modelBadge,o.modelBadge)}case"continuation-check":{let o=t;return e.createdAt===o.createdAt&&e.pluginIds.length===o.pluginIds.length&&e.pluginIds.every((n,r)=>n===o.pluginIds[r])}case"model-switch":{let o=t;return e.createdAt===o.createdAt&&e.pending===o.pending&&ep(e.badge,o.badge)}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let o=t;return e.createdAt===o.createdAt&&e.turnPlan.plan===o.turnPlan.plan}case"work":{let o=t;return e.isExpandedToolGroupEntry===o.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===o.isLastExpandedToolGroupEntry&&cw(e.groupedEntries,o.groupedEntries)}case"message":{let o=t;return e.message===o.message&&e.presentation===o.presentation&&e.textTone===o.textTone&&e.durationStart===o.durationStart&&e.showAssistantMeta===o.showAssistantMeta&&e.showAssistantCopyButton===o.showAssistantCopyButton&&e.copyInFooter===o.copyInFooter&&e.assistantCopyStreaming===o.assistantCopyStreaming&&ep(e.modelBadge,o.modelBadge)}}}function gB(e,t,o){for(let n=t;n<o;n+=1){let r=e[n];switch(r.kind){case"turn-identity":return r.turnId;case"working":if(r.turnId!=null)return r.turnId;break;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!=null)return r.entries[0].turnId;break;case"work":if(r.groupedEntries[0]?.turnId!=null)return r.groupedEntries[0].turnId;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 mw(e,t,o=[]){let n=new Map(o.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let s=gB(e,a.start,a.end),i=n.get(a.key);if(i!==void 0&&i.turnId===s&&hB(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(d=>d.id)})}return r}function hB(e,t,o,n){if(e.firstRowIndex!==o||e.rowIds.length!==n-o)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[o+r].id)return!1;return!0}function fw(e,t){let o=Math.max(0,Math.min(t,e)),n=e-o;return{startIndex:n,hasHiddenOlder:n>0}}function ja(e,t,o){let n=e.findIndex(r=>r.rowIds.includes(t));return n<0?o:Math.max(o,e.length-n)}function yB(e,t){let o=t.historyWindow,{status:n}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,turnSummaries:t.turnSummaries,latestTurn:o?null:n.latestTurn,runningTurnId:o?null:n.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!o&&n.isWorking,activeTurnStartedAt:o?null:n.activeTurnStartedAt,continuationCheck:o?null:n.continuationCheck??null,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:o?null:n.pendingModelSelection},a=e.deriveGroups(r),s=n.latestTurn;if(o&&s&&s.completedAt!==null){let i=s.turnId;if(a.rows.some(c=>c.kind==="message"?c.message.role==="assistant"&&c.message.turnId===i:c.kind==="work"?c.groupedEntries.some(u=>u.turnId===i):c.kind==="tool-group"&&c.entries.some(u=>u.turnId===i)))return e.deriveGroups({...r,latestTurn:s})}return a}var vB=new Map,CB={markdown:()=>"",download(){}},xB=[],bB={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:xB},wB={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:bB,usageByTurnId:vB,exportApi:CB,finalAssistantMessageReceived:!1},version:0};function TB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function IB(e,t,o,n){let r=yB(o,e),a=SB(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 y=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],x=y!==void 0&&pw(y,g)?y:g;return x!==y&&n.add(g.id),x});if(!a)for(let g of t.indexById.keys())s.has(g)||n.add(g);let d=mw(i,r.turnGroups,t.structure.sections),c=a?t.structure.rowIds:i.map(g=>g.id),u=a&&TB(t.structure.sections,d)?t.structure:{rowIds:c,sections:d},m=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===m?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:m},f=n.size>0||u!==t.structure||p!==t.meta;return{inputs:e,structure:u,indexById:s,rows:i,meta:p,version:f?t.version+1:t.version}}function SB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o].id)return!1;return!0}function si(e){return e.getStructure().rowIds.some(t=>e.getRow(t)?.kind==="message")}function gw(){let e=null,t=null,o=wB,n=new Set,r=0,a=new Set,s=new Map,i=()=>{if(e===null||o.inputs===e)return o;t??=e.derive.createRowsCache();let d=new Set;o=IB(e,o,t,d);for(let c of d)n.add(c);return o};return{setInputs(d){e=d},hasInputs:()=>e!==null,flush(){if(a.size===0&&s.size===0||e===null)return;let{version:d}=i();if(d===r&&n.size===0)return;r=d;let c=[...n];n.clear();for(let u of c){let m=s.get(u);if(m!==void 0)for(let p of Array.from(m))p()}for(let u of Array.from(a))u()},subscribe(d){return a.add(d),()=>{a.delete(d)}},subscribeRow(d,c){let u=s.get(d);return u===void 0&&(u=new Set,s.set(d,u)),u.add(c),()=>{u.delete(c),u.size===0&&s.get(d)===u&&s.delete(d)}},getStructure:()=>i().structure,getRow(d){let{indexById:c,rows:u}=i(),m=c.get(d);return m===void 0?void 0:u[m]},getRows:()=>i().rows,getMeta:()=>i().meta,getVersion:()=>i().version}}$();function tp(e){return Go(e.subscribe,e.getStructure,e.getStructure)}function hw(e,t){let o=R(r=>e.subscribeRow(t,r),[e,t]),n=R(()=>e.getRow(t),[e,t]);return Go(o,n,n)}function Wt(e,t,o=Object.is){let n=E(null),r=R(()=>{let a=e.getVersion(),s=n.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),d=s!==null&&s.store===e&&o(s.value,i)?s.value:i;return n.current={store:e,select:t,version:a,value:d},d},[e,t,o]);return Go(e.subscribe,r,r)}$();$();function yw(e,t){return e.getFullYear()!==new Date(t).getFullYear()}function Fg(e,t){return{month:e,day:"numeric",...t?{year:"numeric"}:{}}}function vw(e){let t=new Intl.DateTimeFormat(e,Fg("numeric",!1)),o=new Intl.DateTimeFormat(e,Fg("numeric",!0)),n=(r,a)=>(yw(r,a)?o:t).format(r);return{ofDate:n,ofIso:(r,a)=>{let s=new Date(r);return Number.isNaN(s.getTime())?"":n(s,a)}}}function Cw(e,t){let o=new Date(e);return Number.isNaN(o.getTime())?null:{date:o,formatParams:{date:Fg("short",yw(o,t))}}}function bw(e,t){let o={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?o:{...o,hour12:e==="12-hour"}}function kB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function LB(){return globalThis.window?.desktopBridge?.getSystemLocale?.()??null}var ww=kB(LB()),xw=new Map;function Tw(e,t){let o=`${e}:${t?"seconds":"minutes"}`,n=xw.get(o);if(n)return n;let r=new Intl.DateTimeFormat(ww,bw(e,t));return xw.set(o,r),r}function Bg(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function PB(e){return{...bw(e,!1),...e==="locale"?{hourCycle:Tw(e,!1).resolvedOptions().hourCycle}:{}}}function wn(e,t,o){let n=Bg(e);return n?o("timeline.timestampTooltip",{date:n,formatParams:{date:{...PB(t),year:"numeric",month:"long",day:"numeric"}}}):""}var Iw=vw(ww);function Yn(e,t,o,n=Date.now()){let r=Bg(e);if(!r)return"";let a=Tw(t,!1).format(r),s=new Date(n),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),d=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),c=Math.round((i-d)/864e5);return c<=0?a:c===1?o("relativeTime.yesterdayAt",{time:a}):`${Iw.ofDate(r,n)} ${a}`}function Sw(e,t=Date.now()){return Iw.ofIso(e,t)}function kw(e){let t=Bg(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:""}$();var Fe=qe(null),op=qe(null);$();var ii=new Map,Lw=24,RB=4e3,EB=1024,Pw=16384;function Hg(e){let t=ii.get(e);if(t)return t;let o={values:new Map,listeners:new Set,stringLength:0};if(ii.set(e,o),ii.size>Lw){for(let[n,r]of ii)if(r.listeners.size===0&&n!==e&&(ii.delete(n),ii.size<=Lw))break}return o}function Ug(e,t,o){return Hg(e).values.get(t)??o}function kd(e,t,o,n=!0){let r=Hg(e);if(typeof o=="string"&&(o=o.slice(0,EB)),r.values.get(t)===o)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,o),typeof o=="string"&&(r.stringLength+=o.length),r.stringLength>Pw){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=Pw))break}if(r.values.size>RB){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)}}n&&r.listeners.forEach(s=>s())}function $t(e,t,o){let n=R(i=>{let d=Hg(e);return d.listeners.add(i),()=>d.listeners.delete(i)},[e]),r=R(()=>Ug(e,t,o),[e,t,o]),a=Go(n,r,r),s=R(i=>kd(e,t,i),[e,t]);return[a,s]}function Ne(){let e=Nt().i18n.usePluginTranslation();return{t:(t,o)=>e(t,o)}}var li="chat-process-row flex w-full min-w-0 select-none items-center gap-1.5 px-2 text-left";$();$();var Va=class extends Error{reason;target;constructor(t,o,n){super(MB(t,o),n),this.name="ClipboardError",this.reason=t,this.target=o}};function MB(e,t){switch(e){case"unavailable":return`Clipboard API is unavailable while copying ${t}.`;case"write-failed":return`Failed to copy ${t} to the clipboard.`;case"read-unavailable":return`Clipboard API is unavailable while reading ${t}.`;case"read-failed":return`Failed to read ${t} from the clipboard.`}}function AB(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 o=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 n=o?.focus;typeof n=="function"&&n.call(o)}}async function NB(e,t="text"){if(typeof window>"u")throw new Va("unavailable",t);if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(AB(e))return!0;throw new Va("unavailable",t)}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new Va("write-failed",t,{cause:o})}}function np({timeout:e=2e3,target:t="text",onCopy:o,onError:n}={}){let[r,a]=q(!1),s=E(null),i=E(o),d=E(n),c=E(t),u=E(e);i.current=o,d.current=n,c.current=t,u.current=e;let m=R((p,f)=>{NB(p,c.current).then(g=>{g&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(f),u.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},u.current)))},g=>{let h=g instanceof Error?g:new Error(String(g));console.error(h),d.current?.(h,f)})},[]);return H(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:m,isCopied:r}}var Rw=1e3,DB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"},ea=pe(function({text:t,size:o="xs",variant:n="outline",className:r,toastAnchor:a="above",label:s}){let{t:i}=Ne(),d=s??i("copyButton.copyToClipboard"),[c,u]=q(!1),[m,p]=q(null),f=E(null),g=(x,C)=>{f.current&&clearTimeout(f.current),p({title:x,description:C}),f.current=setTimeout(()=>{p(null),u(!1)},Rw)};H(()=>()=>{f.current&&clearTimeout(f.current)},[]);let{copyToClipboard:h,isCopied:y}=np({onCopy:()=>g(i("copyButton.copied")),onError:x=>g(i("copyButton.failedToCopy"),x instanceof Va&&(x.reason==="unavailable"||x.reason==="write-failed")?i(DB[x.reason]):x.message),timeout:Rw});return v(Pe,{open:m!==null||c,onOpenChange:u,children:[l(Ee,{render:l(K,{"aria-label":d,softDisabled:y,onClick:()=>h(t),type:"button",size:o,variant:n,className:V("text-muted-foreground hover:text-foreground",r)}),children:y?l(jo,{className:"size-3 text-primary"}):l(Ba,{className:"size-3"})}),v(Re,{side:a==="above"?"top":"bottom",className:"max-w-72",role:m?"status":void 0,children:[l("span",{children:m?.title??d}),m?.description?l("span",{className:"block text-muted-foreground",children:m.description}):null]})]})});function rp({text:e,label:t,children:o}){return v("span",{className:"group/hover-copy inline-flex min-w-0 items-center gap-0.5",children:[o,l("span",{className:"inline-flex opacity-0 transition-opacity duration-(--control-duration) pointer-events-none group-focus-within/hover-copy:pointer-events-auto group-focus-within/hover-copy:opacity-100 group-hover/hover-copy:pointer-events-auto group-hover/hover-copy:opacity-100 [@media(pointer:coarse)]:pointer-events-auto [@media(pointer:coarse)]:opacity-100",children:l(ea,{text:e,label:t,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"})})]})}$();var _B=[".m4v",".mov",".mp4",".ogv",".webm"],OB=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function Ew(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let o=e.name.slice(t).toLowerCase();return _B.includes(o)?"video":OB.includes(o)?"audio":null}var FB=["image/gif","image/jpeg","image/png","image/webp"],BB=new Set(FB);function HB(e){return BB.has(e.toLowerCase())}function UB(e){return HB(e)?"image":"file"}var $B=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]),zB=[".doc",".docx",".odt",".ppt",".pptx",".odp",".xls",".xlsx",".ods"];function Jn(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();if(t==="image/svg+xml")return"svg";if(t==="application/pdf")return"pdf";let o=Ew(e);if(o)return o;let n=e.name.lastIndexOf(".");return n>0&&zB.includes(e.name.slice(n).toLowerCase())?"office":t.startsWith("text/")||$B.has(t)?"text":"file"}function Cr(e){let t=Jn(e);return t==="image"||t==="svg"}function di(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 $g(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return UB(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}function ap(e,t){let o=e.flatMap(r=>r.previewUrl?[{...r,src:r.previewUrl}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,attachmentId:r.id,...r.source===void 0?{}:{source:r.source},...r.type!==void 0&&r.mimeType!==void 0&&Jn({type:r.type,mimeType:r.mimeType,name:r.name})==="svg"?{svg:!0}:{}})),index:n}}function sp(e){switch(e){case"image":case"svg":return Xl;case"video":return $r;case"audio":return xn;case"pdf":return Ha;case"office":return Kl;case"text":return zl;case"file":return Vo}}function Oo(e){return e.source?._tag==="agent-artifact"?e.source:void 0}function zg({rowId:e,messageId:t,attachments:o}){let n=xe(Fe),[r,a]=$t(n.threadKey,`attachments:${t}`,!1),{t:s}=Ne(),i=o.toSorted((c,u)=>+(Oo(u)?.delivered===!0)-+(Oo(c)?.delivered===!0)),d=r?i:i.slice(0,4);return o.length===0?null:v("div",{className:"mb-2 max-w-[420px]","data-assistant-attachments":"",children:[l("div",{className:"grid grid-cols-2 items-start gap-2",children:d.map(c=>l("div",{className:"min-w-0",children:Cr(c)?l(Ld,{images:[c],gallery:i.filter(Cr)}):l(Pd,{attachment:c})},c.id))}),!r&&i.length>4?l(K,{variant:"ghost",size:"xs",className:"mt-1","aria-expanded":!1,onClick:()=>{n.onProcessDisclosureChange?.(e),a(!0)},children:s("attachments.showMore")}):null]})}function Ld({images:e,gallery:t}){let o=xe(Fe),{t:n}=Ne();return e.length===0?null:l("div",{className:t?"grid":"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(r=>v("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:[r.previewUrl?l("button",{type:"button",className:"w-full cursor-zoom-in","data-attachment-action":"preview","data-attachment-name":r.name,"aria-label":n("attachments.preview",{name:r.name}),onClick:()=>{let a=ap(t??e,r.id);a&&o.onImageExpand(a)},children:l("img",{src:r.previewUrl,alt:r.name,loading:"lazy",decoding:"async",className:Jn(r)==="svg"?"block h-auto max-h-[220px] w-full bg-white object-contain":"block h-auto max-h-[220px] w-full object-cover object-top"})}):l("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:r.name}),Oo(r)?.delivered||Oo(r)?.title||Oo(r)?.note?v("div",{className:"px-2 py-1 text-chat-meta",children:[l("p",{className:"break-words font-medium",children:Oo(r)?.title||r.name}),Oo(r)?.note?l("p",{className:"whitespace-pre-wrap break-words text-secondary-label",children:Oo(r)?.note}):null]}):null]},r.id))})}function Pd(e){let{t}=Ne(),o=xe(Fe).onAttachmentDocumentOpen,n=Jn(e.attachment),r=sp(n),a=t("attachments.open",{name:e.attachment.name}),s=v(oe,{children:[l(r,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0 flex-1",children:[l("span",{className:"block truncate font-medium text-foreground text-chat-row",children:Oo(e.attachment)?.title||e.attachment.name}),Oo(e.attachment)?.note?l("span",{className:"block whitespace-pre-wrap break-words text-secondary-label text-chat-meta",children:Oo(e.attachment)?.note}):null,l("span",{className:"block text-secondary-label text-chat-meta",children:Oo(e.attachment)?.fileCount?t("attachments.folderFiles",{count:Oo(e.attachment).fileCount}):di(e.attachment.sizeBytes)})]})]});return!Oo(e.attachment)?.delivered&&e.attachment.previewUrl&&(n==="video"||n==="audio")?v("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:[l("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":a,className:"flex items-center gap-2 hover:underline",children:s}),l(Db,{kind:n,src:e.attachment.previewUrl,title:e.attachment.name})]}):o?l("button",{type:"button","data-attachment-action":"open","data-attachment-name":e.attachment.name,"aria-label":a,onClick:()=>o({attachmentId:e.attachment.id,name:e.attachment.name,mimeType:e.attachment.mimeType}),className:"flex w-full cursor-[var(--control-cursor)] items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 text-start hover:bg-background/90",children:s}):e.attachment.previewUrl?l("a",{href:e.attachment.previewUrl,download:e.attachment.name,target:"_blank",rel:"noreferrer","aria-label":a,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:s}):l("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:s})}$();function KB({environmentId:e,pluginId:t}){let{t:o}=z();return Qn(e,t)??o("rewrite.unknownPlugin")}function ip({rewrite:e,text:t,environmentId:o}){let{t:n}=z(),[r,a]=q(!1);if(!e)return null;let s=[...new Set(e.steps.filter(c=>c.via==="before-send").map(c=>c.pluginId))],i=[...new Set(e.steps.filter(c=>c.via==="slash-command").map(c=>c.pluginId))],d=c=>c.map((u,m)=>v("span",{children:[m?", ":"",l(KB,{environmentId:o,pluginId:u})]},u));return v("div",{className:"max-w-full text-chat-row text-muted-foreground","data-message-rewrite":"",children:[l(K,{size:"xs",variant:"ghost",className:"h-auto min-h-6 max-w-full whitespace-normal text-xs","aria-expanded":r,"aria-label":n("rewrite.showReceived"),onClick:()=>a(c=>!c),children:v("span",{children:[i.length?v(oe,{children:[n("rewrite.expandedPrefix"),d(i),n("rewrite.expandedSuffix"),s.length?", ":""]}):null,s.length?v(oe,{children:[n("rewrite.changedPrefix"),d(s),n("rewrite.changedSuffix")]}):null]})}),r?v("div",{className:"mt-1 max-w-full rounded-md border border-border p-2",children:[l("p",{className:"mb-1 text-xs",children:n("rewrite.received")}),l("pre",{className:"whitespace-pre-wrap break-words font-sans text-xs [overflow-wrap:anywhere]",children:t})]}):null]})}$();$();var Rd=e=>e;function Zn(){return Nt().useThreadDisplayTitle?.()??Rd}$();var Mw=qe(null);function Aw({data:e,target:t,children:o}){let n=W(()=>({data:e,target:t}),[e,t]);return l(Mw,{value:n,children:o})}function ci(){return xe(Mw)}function Nw({messageId:e}){let t=ci(),o=t?.data.useMessageForks;return!t||!o?null:l(qB,{read:o,target:t.target,messageId:e})}function qB({read:e,target:t,messageId:o}){let{t:n}=z(),r=Zn(),[a,s]=q(!1),{threads:i,openThread:d}=e(t,o);return i.length===0?null:v(rn,{open:a,onOpenChange:s,children:[l(sn,{render:l(K,{variant:"ghost",size:"xs"}),children:n("forkRelations.count",{count:i.length})}),l(an,{"aria-label":n("forkRelations.listTitle"),className:"max-h-72 max-w-80 overflow-y-auto p-1",children:i.map(c=>v(K,{variant:"ghost",className:"h-auto w-full flex-col items-start gap-0.5 py-2",onClick:()=>{s(!1),d(c.threadId)},children:[l("span",{className:"max-w-full truncate",children:r(c.title)}),l("time",{className:"text-chat-dense text-muted-foreground",dateTime:c.createdAt,children:new Date(c.createdAt).toLocaleString()})]},c.threadId))})]})}$();function Dw({messageId:e,rowId:t}){let o=ci(),n=o?.data.useMessageMemory,r=o?.data.useMemoryExperience;return!o||!n||!r?null:l(WB,{readMemory:n,readExperience:r,target:o.target,messageId:e,rowId:t})}function WB({readMemory:e,readExperience:t,target:o,messageId:n,rowId:r}){let a=e(o,n);return a===null?null:l(GB,{experienceIds:a.experienceIds,readExperience:t,target:o,messageId:n,rowId:r})}function GB({experienceIds:e,readExperience:t,target:o,messageId:n,rowId:r}){let{t:a}=z(),s=xe(Fe),[i,d]=$t(s.threadKey,`memory-context:${n}`,!1),c=ho();return v("div",{className:"flex min-w-0 flex-col items-start gap-1.5 self-stretch","data-memory-context":"",children:[v(K,{variant:"ghost-muted",size:"xs",className:"-ms-1 gap-1.5 [&_svg]:mx-0","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>{s.onProcessDisclosureChange?.(r),d(!i)},children:[l(Tt,{"aria-hidden":!0,className:V("size-icon-1",!i&&"-rotate-90")}),l(Ol,{"aria-hidden":!0,className:"size-icon-1"}),a("memoryContext.included",{count:e.length})]}),i?l("ul",{id:c,className:"m-0 w-full max-w-xl list-none divide-y divide-border overflow-hidden rounded-xl border border-border bg-card p-0",children:e.map(u=>l(jB,{readExperience:t,target:o,experienceId:u},u))}):null]})}function jB({readExperience:e,target:t,experienceId:o}){let n=e(t,o);return v("li",{className:"flex min-w-0 items-center gap-2.5 py-2 ps-3 pe-2","data-memory-experience-state":n.state,children:[l(VB,{experience:n}),l(QB,{experience:n})]})}function VB({experience:e}){let{t}=z();switch(e.state){case"loading":return v("div",{className:"min-w-0 flex-1","aria-busy":"true",children:[l("span",{className:"sr-only",children:t("memoryContext.loading")}),l(Eg,{className:"h-4 w-3/4"}),l(Eg,{className:"mt-1 h-3 w-1/2"})]});case"failed":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.loadFailed")});case"erased":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.erased")});case"active":case"forgotten":{let o=e.state==="forgotten",n=e.recordedAt===null?null:Cw(e.recordedAt,Date.now());return v("div",{className:"min-w-0 flex-1",children:[l("p",{className:V("m-0 line-clamp-2 text-ui-sm",e.title===null?"text-muted-foreground":"font-medium",o&&"text-muted-foreground line-through"),children:e.title??t("memoryContext.textUnavailable")}),n===null?null:l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.recordedBy",{author:e.authorLabel??"",...n})}),o?l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.forgottenNote")}):null]})}}}function QB({experience:e}){let{t}=z();switch(e.state){case"loading":case"erased":return null;case"failed":return l(K,{variant:"ghost",size:"xs",onClick:e.retry,children:t("memoryContext.retry")});case"active":case"forgotten":{let o=e.state==="forgotten";return v("div",{className:"flex shrink-0 items-center gap-1.5",children:[o?l(jr,{variant:"muted",size:"sm",children:t("memoryContext.forgotten")}):null,v(K,{variant:"ghost",size:"xs",disabled:e.pending,softDisabled:e.blockedReason!==null,title:e.blockedReason??void 0,onClick:o?e.restore:e.forget,children:[e.pending?l(Qs,{}):null,t(o?"memoryContext.restore":"memoryContext.forget")]})]})}}}$();var XB=()=>null;function lp(e){let t=(e.useMachineLabel??XB)(e.reference.environmentId),o=Zn();return v(oe,{children:[l("div",{className:"wrap-anywhere",children:o(e.reference.title)}),t===null?null:l("div",{className:"text-muted-foreground",children:t})]})}var YB=Object.freeze([]),JB=()=>YB;function _w(e){return e.type==="file"&&e.source?._tag==="thread-reference"}function ZB(e){return e.omitted===null?e.carried:v(oe,{children:[l("span",{className:"inline-block max-w-full",children:e.carried})," ",l("span",{className:"inline-block max-w-full",children:e.omitted})]})}function Ow(e){let t=xe(Fe),{t:o}=Ne(),r=(t.threadReferences?.useDeliveries??JB)(t.activeThreadEnvironmentId,e).filter(a=>a.status!=="unreadable");return r.length===0?null:l("ul",{"aria-label":o("threadReference.listLabel"),className:"flex min-w-0 max-w-[min(70%,40rem)] flex-col gap-0.5 text-chat-dense text-muted-foreground",children:r.map(a=>l(eH,{delivery:a},`${a.reference.environmentId}:${a.reference.threadId}`))})}function eH(e){let{delivery:t}=e,o=xe(Fe),{t:n}=Ne(),r=Zn(),a=s=>{let i={reference:t.reference};s.dispatchEvent(new CustomEvent(Hs,{bubbles:!0,detail:i}))};return l("li",{"data-thread-reference-delivery":t.status,className:"flex min-w-0",children:v(Pe,{children:[v(Ee,{render:l("button",{type:"button",className:"relative flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-start gap-1 rounded-sm text-left hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:s=>a(s.currentTarget)}),children:[l("span",{className:"flex h-lh shrink-0 items-center",children:l(gr,{"aria-hidden":"true",className:"size-3.5"})}),v("span",{className:"flex min-w-0 flex-1 flex-wrap gap-x-1",children:[l("span",{className:"max-w-max min-w-0 grow basis-24 truncate",children:n("threadReference.title",{title:r(t.reference.title)})}),l("span",{className:"max-w-full",children:t.status==="carried"?l(ZB,{carried:n("threadReference.carried",{count:t.carriedMessages}),omitted:t.omittedMessages>0?n("threadReference.omitted",{count:t.omittedMessages}):null}):t.status==="missing"?n("threadReference.missing"):n("threadReference.loading")})]})]}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(lp,{reference:t.reference,useMachineLabel:o.threadReferences?.useMachineLabel})})]})})}$();var tH=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/,oH=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/,nH=/\n*<browser_annotation>\n((?:(?!<browser_annotation>)[\s\S])*)\n<\/browser_annotation>\s*$/;function Fw(e){let t=[],o=null,n=()=>{o&&(t.push({header:o.header,body:o.bodyLines.join(`
|
|
3539
3518
|
`).trimEnd()}),o=null)};for(let r of e.split(`
|
|
3540
|
-
`)){let a=/^- (.+):$/.exec(r);if(a){n(),o={header:a[1],bodyLines:[]};continue}
|
|
3519
|
+
`)){let a=/^- (.+):$/.exec(r);if(a){n(),o={header:a[1],bodyLines:[]};continue}o&&(r.startsWith(" ")?o.bodyLines.push(r.slice(2)):r.length===0&&o.bodyLines.push(""))}return n(),t}function rH(e){return e.replace(/\r\n/g,`
|
|
3520
|
+
`).replace(/^\n+|\n+$/g,"")}function aH(e){return rH(e.text).length>0}function Bw(e){return!aH(e)}function Hw(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),o=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${o}`}function Qa(e){let t=oH.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let o=e.slice(0,t.index).replace(/\n+$/,""),n=Fw(t[1]??"");return{promptText:o,contextCount:n.length,contexts:n}}function sH(e){let t=tH.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let o=e.slice(0,t.index).replace(/\n+$/,""),n=Fw(t[1]??"");return{promptText:o,contextCount:n.length,previewTitle:n.length>0?n.map(({header:r,body:a})=>a.length>0?`${r}
|
|
3541
3521
|
${a}`:r).join(`
|
|
3542
3522
|
|
|
3543
|
-
`):null,contexts:n}}function
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
`)
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
`)){let
|
|
3551
|
-
|
|
3523
|
+
`):null,contexts:n}}function ui(e){let t=Qa(e),o=sH(t.promptText);return{visibleText:o.promptText,copyText:e,contextCount:o.contextCount,previewTitle:o.previewTitle,contexts:o.contexts,elementContexts:t.contexts}}function pi(e){let t=nH.exec(e);if(!t)return{promptText:e,annotation:null};let o=t[1]??"",n=o.split(`
|
|
3524
|
+
`),r=n.find(p=>p.startsWith("Page: ")),a=n.find(p=>p.startsWith("Id: ")),s=n.find(p=>p.startsWith("Comment: ")),i=n.find(p=>p.startsWith("Targets: ")),d=n.indexOf("Requested visual changes:"),c=n.slice(d+1),u=c.indexOf("<element_context>"),m=d<0?[]:c.slice(0,u<0?void 0:u).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()||"Browser annotation",comment:s?.slice(9).trim()||"",targetSummary:i?.slice(9).trim()||"",styleChanges:m,hasScreenshot:o.includes("The attached screenshot is the annotated browser crop.")}}}function iH(e){let t=e.match(/:(\d+)$/);if(!t?.[1])return{path:e,line:void 0,column:void 0};let o=e.slice(0,-t[0].length),n=o.match(/:(\d+)$/);return n?.[1]?{path:o.slice(0,-n[0].length),line:n[1],column:t[1]}:{path:o,line:t[1],column:void 0}}function Kg(e){return e.replaceAll("\\","/")}function qg(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function lH(e){return qg(Kg(e.replace(/[\\/]+$/,"")))}function dH(e){return e.slice(e.lastIndexOf("/")+1)}function cH(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function uH(e){return e.startsWith("\\\\")||/^[A-Za-z]:([/\\]|$)/.test(qg(Kg(e)))}function dp(e,t){let{path:o,line:n,column:r}=iH(e),a=qg(Kg(o)),s=a;if(t){let i=lH(t),d=dH(i),c=uH(t)?p=>p.toLowerCase():p=>p,u=c(a),m=c(i);if(u===m)s=d;else if(u.startsWith(`${m}/`))s=`${d}/${a.slice(i.length+1)}`;else if(!cH(a)){let p=a.replace(/^\.\/+/,"").replace(/^\/+/,"");s=u.startsWith(`${c(d)}/`)?a:`${d}/${p}`}}return n?`${s}:${n}${r?`:${r}`:""}`:s}var pH=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,mH=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,fH=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function gH(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function hH(e){let t={};for(let o of e.matchAll(mH))t[o[1]]=gH(o[2]??"");return t}function Uw(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function yH(e){let o=Array.from(e.matchAll(fH)).at(-1),n=o?.index;return{text:e.slice(0,n??e.length).trim(),language:o?.[2]?.trim()||"diff",contents:o?.[3]??""}}function vH(e,t,o){let n=hH(e),r=Uw(n.startIndex),a=Uw(n.endIndex),s=n.filePath?.trim(),i=n.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let d=yH(t);return{id:`review-comment:${o}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:n.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:n.rangeLabel?.trim()||null,text:d.text,diff:d.contents,fenceLanguage:d.language}}function mi(e){let t=[],o=0,n=0;for(let a of e.matchAll(pH)){let s=a.index??0,i=e.slice(o,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:i});let d=vH(a[1]??"",a[2]??"",n);d?(t.push({kind:"review-comment",comment:d}),n+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),o=s+a[0].length}let r=e.slice(o);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:r}),t}function $w(e,t){let o=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),n="`".repeat(Math.max(3,o+1));return[`${n}${e}`,t.trimEnd(),n].join(`
|
|
3525
|
+
`)}function zw(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 o=e.filePath.replaceAll("\\","/");return[`diff --git a/${o} b/${o}`,`--- a/${o}`,`+++ b/${o}`,t].join(`
|
|
3526
|
+
`)}$();var Ed="[a-zA-Z][a-zA-Z0-9:_-]*";function fi(e){return e===" "||e===`
|
|
3527
|
+
`||e===" "||e==="\r"}function xr(e){return e.enabled&&e.userInvocable!==!1}var qw="ycodium",Kw=`${qw}:`,CH=new RegExp(String.raw`(^|\s)([$/])(${Ed})(?=\s|$)`,"g");function Wg(e){return[...e.matchAll(CH)].map(t=>{let o=(t.index??0)+(t[1]?.length??0),n=t[3]??"";return{sigil:t[2],name:n,start:o,end:o+n.length+1}})}var xJ=new RegExp(String.raw`([$/])(${Ed})(?=\s|$)`,"y");function Ww(e,t){let o=t.get(e);if(o!==void 0)return o;if(!e.startsWith(Kw))return;let n=t.get(e.slice(Kw.length));return n?.scope===qw?n:void 0}function Gw(e,t,o,n=fi){if(t.length!==e.length+1)return null;let r=0;for(;r<e.length&&e[r]===t[r];)r+=1;let a=t.charAt(r);if(!fi(a)||r<e.length&&n(e.charAt(r))||t.slice(r+1)!==e.slice(r))return null;let s=r;for(;s>0&&!n(t.charAt(s-1));)s-=1;let d=xH.exec(t.slice(s,r))?.[1];return d===void 0||Ww(d,o)===void 0?null:{start:s,end:r+1,replacement:`$${d}${a}`}}var xH=new RegExp(String.raw`^/(${Ed})$`);function cp(e){return new Map(e.map(t=>[t.name,t]))}function bH(e,t){return t.size===0?[]:Wg(e).flatMap(o=>{let n=Ww(o.name,t);return n===void 0?[]:[{...o,skill:n}]})}function jw(e,t){let o=[],n=0;for(let r of bH(e,t))r.start>n&&o.push({kind:"text",text:e.slice(n,r.start)}),o.push({kind:"skill",key:`${r.start}:${r.name}`,skill:r.skill,raw:e.slice(r.start,r.end)}),n=r.end;return n===0?null:(n<e.length&&o.push({kind:"text",text:e.slice(n)}),o)}function Vw(e){let t=jw(e.text,e.index);return t===null?l(oe,{children:e.text}):l(oe,{children:t.map(o=>o.kind==="text"?o.text:l(Aa,{children:e.renderSkill(o.skill,o.raw)},o.key))})}var wH="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",TH=`${wH} border border-border/70 bg-accent/40 text-foreground`,up=`${TH} text-control-1`,pp="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",mp="truncate",Qw='<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 Xw="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",Yw=`${Xw} border border-border/70 bg-accent/40 text-foreground`,IH=`${Yw} text-control-1`,ln=`${Yw} text-[0.86em] leading-none select-none`,Md="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-['']",Fo="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Jw="truncate",Bo="block self-center truncate leading-tight select-none",Gg="border-skill-chip-border bg-skill-chip text-skill-chip-foreground",Zw=`${Xw} select-none border ${Gg} text-[0.86em] leading-none`,eT='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',fp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground";function SH(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function kH(e){let t=e.displayName?.trim();return t||SH(e.name)}function tT(e){return l(Vw,{text:e.text,index:e.index,renderSkill:LH})}function LH(e,t){return l(PH,{skill:e,rawText:t})}function PH(e){return l("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:v("span",{className:V(up,Gg),children:[l("span",{"aria-hidden":"true",className:pp,dangerouslySetInnerHTML:{__html:Qw}}),l("span",{className:mp,children:kH(e.skill)})]})})}function oT(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Pe,{children:[v(Ee,{render:l("span",{className:V(up,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0}),children:[l(Qo,{className:V(pp,"size-icon-1",n&&"opacity-100")}),l("span",{className:mp,children:t})]}),l(Re,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}var RH=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function nT(e){let t=[];for(let o of e){let n=o.header.trim();n.length>0&&t.push(gp(n))}return t.join(" ")}function gp(e){let t=e.trim(),o=RH.exec(t);if(!o)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let n=Number.parseInt(o[2]??"",10),r=Number.parseInt(o[3]??o[2]??"",10);return!Number.isFinite(n)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:Hw({terminalLabel:o[1]?.trim()||"terminal",lineStart:n,lineEnd:r})}function rT(e,t){let o=0;for(let n of t){let r=gp(n.header),a=e.indexOf(r,o);if(a===-1)return!1;o=a+r.length}return!0}var aT=pe(function(t){let o=t.context.body.length>0?`${t.context.header}
|
|
3528
|
+
${t.context.body}`:t.context.header;return l(oT,{label:t.context.header,tooltipText:o})}),iT=pe(function(t){let o=t.context.body?`${t.context.header}
|
|
3529
|
+
${t.context.body}`:t.context.header;return v(Pe,{children:[v(Ee,{render:l("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:[l(qn,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:t.context.header})]}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:o})]})});function lT(e){let t=xe(Fe),{t:o}=Ne();return v("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?l("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":o("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let n=ap([e.image],e.image.id);n&&t.onImageExpand(n)},children:l("img",{src:e.image.previewUrl,alt:o("browserAnnotation.cropAlt"),className:"size-full object-cover"})}):null,v("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?l("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,v("div",{className:V("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?l("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?v("span",{className:"inline-flex shrink-0 items-center gap-1",children:[l(za,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var EH=8,MH=600,AH=1.75,sT=`linear-gradient(to bottom, black calc(100% - ${AH}rem), transparent)`;function NH(e){return e.trim().length===0?!1:e.length>MH||e.split(`
|
|
3530
|
+
`).length>EH}var dT=pe(function(t){let o=xe(Fe),{t:n}=Ne(),[r,a]=$t(o.threadKey,`${t.disclosureKey}:expanded`,!1),s=t.text.trim().length>0||t.terminalContexts.length>0,i=s&&NH(t.text),d=i&&!r;return v("div",{children:[s?l("div",{className:V("relative",d&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":d?"true":"false","data-user-message-collapsible":i?"true":"false","data-user-message-fade":d?"true":"false",style:d?{WebkitMaskImage:sT,maskImage:sT}:void 0,children:l(DH,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,i||t.footer?v("div",{className:V("mt-1.5 flex items-center gap-2",i&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[i?l(K,{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:n(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?l("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),DH=pe(function(t){let o=xe(Fe),n=(a,s)=>{let i=/^\s+/.exec(a)?.[0]??"",d=a.slice(i.length),c=/\s+$/.exec(d)?.[0]??"",u=d.slice(0,d.length-c.length);return v(Aa,{children:[i?l("span",{"aria-hidden":"true",children:i}):null,u?l(wo,{disclosureKey:`${t.disclosureKey}:inline:${s}`,text:u,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,c?l("span",{"aria-hidden":"true",children:c}):null]},s)},r=mi(t.text);if(r.some(a=>a.kind==="review-comment"))return l("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?l("div",{className:"wrap-break-word",children:l(wo,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,text:a.text.trim(),cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:l(_H,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=rT(t.text,t.terminalContexts),s=nT(t.terminalContexts),i=[];if(a){let d=0;for(let c of t.terminalContexts){let u=gp(c.header),m=t.text.indexOf(u,d);if(m===-1){i.length=0;break}m>d&&i.push(n(t.text.slice(d,m),`user-terminal-context-inline-before:${c.header}:${d}`)),i.push(l(aT,{context:c},`user-terminal-context-inline:${c.header}`)),d=m+u.length}if(i.length>0)return d<t.text.length&&i.push(n(t.text.slice(d),`user-message-terminal-context-inline-rest:${d}`)),l("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}for(let d of t.terminalContexts)i.push(l(aT,{context:d},`user-terminal-context-inline:${d.header}`)),i.push(l("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${d.header}`));if(t.text.length>0)i.push(l(wo,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:o.onImageExpand},"user-message-terminal-context-inline-text"));else if(s.length===0)return null;return l("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}return t.text.length===0?null:l(wo,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:o.onImageExpand})});function _H({comment:e,disclosureKey:t}){let o=xe(Fe),{t:n}=Ne(),r=e.fenceLanguage??"diff",a=zw(e);return v("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[v("div",{className:"space-y-1",children:[l("div",{className:"text-message-foreground text-chat-row font-medium",children:dp(e.filePath,o.workspaceRoot)}),v("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??n("timeline.reviewCommentDefaultSection")," ",e.rangeLabel??n("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&l("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:l(tT,{text:e.text,index:o.skillIndex})}),r!=="diff"&&e.diff.trim().length>0&&l(wo,{disclosureKey:`${t}:fence`,text:$w(r,e.diff),cwd:o.markdownCwd,threadRef:o.threadRef??void 0,skills:o.skills,className:"text-message-foreground"}),a?l(Nb,{patch:a}):null]})}function jg({row:e,text:t}){let{t:o}=Ne(),n=xe(Fe),r=e.message.attachments??[],a=ui(e.message.rewrite?.original??t),s=a.contexts,i=[],d=a.visibleText;for(;;){let b=pi(d);if(!b.annotation)break;i.unshift(b.annotation),d=b.promptText}let c=Qa(d),u=[...a.elementContexts,...c.contexts],m=r.filter(b=>b.name.startsWith("browser-annotation-")),p=r.filter(b=>!b.name.startsWith("browser-annotation-")),f=p.filter(b=>Cr(b)),g=p.filter(b=>!Cr(b)&&!_w(b)),h=n.derive.messageSpeaker(e.message,n.selfUserId??null,n.ownsUnsignedMessages),y=h.kind==="person"?h:null,x=h.kind==="person"||h.kind==="automation"||h.kind==="unknown"&&n.ownsUnsignedMessages===!1,C=y!==null?o("message.saidBy",{name:y.displayName}):h.kind==="automation"?o("message.saidAutomatically"):o(x?"message.saidBySomeoneElse":"message.saidByYou");return v("div",{className:`group/user flex min-w-0 flex-col gap-1 ${x?"items-start":"items-end"}`,role:"group","aria-label":C,tabIndex:-1,children:[y!==null?l(OH,{speaker:y}):null,h.kind==="automation"&&h.schedule!==void 0?l(HH,{environmentId:n.activeThreadEnvironmentId,schedule:h.schedule}):null,v("div",{...x?{"data-teammate-bubble":""}:{"data-user-bubble":""},children:[l(Ld,{images:f}),g.length>0&&l("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(b=>l(Pd,{attachment:b},b.id))}),i.map((b,L)=>l(lT,{annotation:b,image:m[L]??null},b.id)),u.length>0?l("div",{className:"mb-2 flex flex-wrap gap-1.5",children:u.map(b=>l(iT,{context:b},`${b.header}:${b.body}`))}):null,l(dT,{disclosureKey:`message:${e.message.id}:user`,text:c.promptText,terminalContexts:s,skills:n.skills,markdownCwd:n.markdownCwd})]}),l(Ow,{text:t,attachments:r}),e.message.localDelivery!==void 0&&l(BH,{messageId:e.message.id,state:e.message.localDelivery,onRestore:n.onRestoreUnsentMessage??null}),l(ip,{rewrite:e.message.rewrite,text:e.message.text,environmentId:n.activeThreadEnvironmentId}),l(Nw,{messageId:e.message.id}),v("div",{"data-user-message-actions":"",className:"flex min-h-6 select-none items-center gap-0.5 text-chat-row text-muted-foreground opacity-0 transition-opacity duration-(--control-duration) group-focus-within/user:opacity-100 group-hover/user:opacity-100",children:[v(Pe,{children:[l(Ee,{render:l("span",{tabIndex:0,className:"me-1 rounded-sm tabular-nums"}),children:Yn(e.message.createdAt,n.timestampFormat,o)}),l(Re,{children:wn(e.message.createdAt,n.timestampFormat,o)})]}),n.onForkFromUserMessage!==null&&l(FH,{messageId:e.message.id,onFork:n.onForkFromUserMessage}),a.copyText&&l(ea,{text:a.copyText,variant:"ghost"})]}),l(Dw,{messageId:e.message.id,rowId:e.id})]})}function OH({speaker:e}){return v("div",{className:"flex min-w-0 max-w-[min(70%,40rem)] select-none items-center gap-1.5 text-chat-dense text-muted-foreground",children:[l(wb,{userId:e.userId??e.displayName,displayName:e.displayName,size:16}),l("span",{className:"min-w-0 truncate",children:e.displayName})]})}function FH({messageId:e,onFork:t}){let{t:o}=Ne(),n=o("fork.action");return v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":n}),children:l(Gl,{className:"size-3"})}),l(Re,{side:"top",children:n})]})}function BH({messageId:e,state:t,onRestore:o}){let{t:n}=Ne();return v("div",{"data-local-delivery":t,role:"status",className:"flex min-h-6 select-none items-center gap-1.5 text-chat-row text-muted-foreground",children:[l("span",{children:n(t==="unconfirmed"?"message.deliveryUnconfirmed":"message.deliveryNotSent")}),t==="not-sent"&&o!==null&&l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>o(e),children:n("message.putBackInMessageBox")})]})}function HH(e){let{t}=Ne(),o=Qn(e.schedule.pluginId===void 0?null:e.environmentId,e.schedule.pluginId??"");return l("span",{className:"text-chat-meta text-muted-foreground",children:e.schedule.pluginId===void 0?t("message.fromSchedule",{name:e.schedule.name}):t("message.fromPluginSchedule",{name:e.schedule.name,plugin:o??t("message.unknownPlugin")})})}var hp="<ycodium-system>",cT="</ycodium-system>",UH=e=>e.startsWith(hp),Xa=e=>UH(e)&&!(uT(e)&&e.includes(fT)&&gT(e)===null),Vg=`^(?:${hp}\\n)?`,$H=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g,zH=e=>e.match($H)??[],KH=`${hp}
|
|
3531
|
+
<preset-prefix `,uT=e=>e.startsWith(KH),pT=e=>{if(uT(e))return[e];let t=zH(e);return t.length>0?t:[e]},mT='esc="1"';var Ad=e=>e.replace(/ /g,`
|
|
3532
|
+
`).replace(/ /g,"\r").replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");var qH=/[ \t]*\(record [^\s()]+\)/g,WH=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/,GH=["thread-response","thread-handover","scheduled-wake","plugin-wake"];var jH=new RegExp(`^<(?:${GH.join("|")})(?:\\s[^>]*)? ${mT}>$`);var Nd=e=>{if(!Xa(e))return e;let t=!1,o=[];for(let n of e.split(`
|
|
3533
|
+
`)){let r=n.trim();if(!WH.test(r)){o.push(t?Ad(n):n);continue}t=!r.startsWith("</")&&jH.test(r)}return o.join(`
|
|
3534
|
+
`).replace(qH,"")};var fT=`
|
|
3552
3535
|
</preset-prefix>
|
|
3553
|
-
${uT}`,HH=new RegExp(`^${bp}\\n<preset-prefix id="([^"]*)">\\n([\\s\\S]*?)\\n</preset-prefix>\\n${uT}(?:\\n\\n([\\s\\S]*))?$`),hT=e=>{if(e.split(gT).length!==2)return null;let t=HH.exec(e);if(t===null)return null;let[,o,n,r]=t;return o?{presetId:o,prefix:n??"",body:r??""}:null},yT=e=>es(e)?hT(e)?.body||null:e,UH=["work","check-in","instructions","notice","continue"];var $H=new RegExp(`${Zg}<plugin-wake plugin="([^"]+)" reason="([^"]+)"(?: item="([^"]+)")?(?: round="(\\d+)" limit="(\\d+)")? ${fT}>\\n([\\s\\S]*?)\\n</plugin-wake>`),vT=e=>{let t=$H.exec(e);if(t===null)return null;let[,o,n,r,a,s,i]=t;if(!o||!n)return null;let d=UH.find(c=>c===Dd(n));return{pluginId:Dd(o),reason:d??"notice",...r?{item:Dd(r)}:{},...d==="continue"&&a&&s?{continuation:{round:Number(a),limit:Number(s),body:Dd(i??"")}}:{}}},CT=e=>{switch(e.reason){case"work":return e.item===void 0?{key:"work"}:{key:"workItem",item:e.item};case"check-in":return{key:"checkIn"};case"instructions":return{key:"instructions"};case"notice":return{key:"notice"};case"continue":return e.continuation===void 0?{key:"notice"}:{key:"continue",round:e.continuation.round,limit:e.continuation.limit}}};$();function xT({wake:e,blockKey:t}){let{t:o}=Me(),{activeThreadEnvironmentId:n,threadKey:r}=xe(Fe),a=CT(e),[s,i]=zt(r,`plugin-wake:${t}`,!1),d=e.continuation?.body;return v("div",{className:"flex flex-col items-center gap-1 py-1","data-plugin-wake":e.pluginId,children:[v("p",{className:"flex max-w-[80%] flex-wrap items-center justify-center gap-x-1.5 text-center text-chat-row text-muted-foreground",children:[l(Do,{environmentId:n,pluginId:e.pluginId}),l("span",{children:o(`pluginWake.${a.key}`,{item:a.item,round:a.round,limit:a.limit})}),d!==void 0&&d.length>0?l(K,{type:"button",variant:"link",size:"xs","aria-expanded":s,onClick:()=>i(!s),children:o(s?"pluginWake.hideReceived":"pluginWake.showReceived")}):null]}),s&&d!==void 0?l("p",{className:"max-w-[80%] whitespace-pre-wrap rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:d}):null]})}function bT({row:e}){let{t}=Me(),{activeThreadEnvironmentId:o}=xe(Fe),n=t("turnContinuation.nameSeparator");return v("p",{className:"flex flex-wrap items-center gap-x-1 px-1 pb-2 pt-1 text-chat-row text-muted-foreground","data-testid":"continuation-check-row",children:[e.pluginIds.map((r,a)=>v("span",{className:"inline-flex items-center",children:[a>0?n:null,l(Do,{environmentId:o,pluginId:r})]},r)),l("span",{children:t("turnContinuation.checking")})]})}var zH=new RegExp(`${Zg}<plugin-instruction>\\n([\\s\\S]*?)\\n<\\/plugin-instruction>`);function wT(e){let t=e.match(zH)?.[1];if(t===void 0)return null;try{let o=JSON.parse(t);if(o===null||typeof o!="object"||Array.isArray(o))return null;let n=o;return typeof n.pluginId!="string"||typeof n.title!="string"||typeof n.body!="string"?null:{pluginId:n.pluginId,title:n.title,body:n.body}}catch{return null}}$();var TT=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api"];if(!TT)throw new Error("This plugin needs a newer Ycodium app. Update the app.");var{COMMUNICATION_RECORDS_READ_LIMIT:UZ,HOST_TEAM_VIEW_PREFIX:$Z,MAX_PLUGIN_SESSION_PROJECTION_BYTES:zZ,MAX_PLUGIN_SKILL_COMPANION_FILE_BYTES:KZ,MAX_PLUGIN_SKILL_COMPANION_TOTAL_BYTES:qZ,MAX_PLUGIN_STREAM_BUFFER:WZ,MAX_PLUGIN_TOOL_PRESENTATION_BYTES:GZ,MAX_PLUGIN_WORKSPACE_WRITE_BYTES:jZ,MEMBER_INSTRUCTIONS_MAX_BYTES:VZ,MEMBER_NAME_MAX:QZ,MEMBER_RESPONSIBILITY_MAX:XZ,MEMBER_TITLE_MAX:YZ,MIN_PLUGIN_INTERVAL_MS:JZ,PLUGIN_API_MIN_VERSION:ZZ,PLUGIN_API_VERSION:eee,PLUGIN_PROXY_DIRECT:tee,PluginSignInRequiredError:oee,PluginSignInUnavailableError:nee,REASONING_OPTION_LABEL:ree,REQUEST_RESOLVED_TRIGGER_KIND:aee,TEAM_VIEW_KEY_PATTERN:see,THREAD_ACTIVITIES_LIST_LIMIT:iee,THREAD_MESSAGES_LIST_LIMIT:lee,TOOL_LIFECYCLE_ACTIVITY_KINDS:dee,TURN_PROGRESS_TRIGGER_KIND:cee,USER_INPUT_PENDING_TRIGGER_KIND:uee,acceptPluginToolPresentation:pee,definePlugin:mee,defineTeamView:fee,effortText:IT,findReasoningEffortDescriptor:gee,getDisplayModelName:hee,getTriggerDisplayModelName:ST,hasModelTraitControls:kT,isProviderSelectionAvailable:Od,isReadOnlyModelChoice:LT,isReasoningEffortOptionId:yee,isTeamViewKey:vee,isThreadNotFound:Cee,isWithinProviderSelectionLock:wp,knownEffortLevel:xee,mergeLaunchEnv:bee,modelCatalogNoticeOf:wee,modelChoiceTraitDescriptors:RT,modelOptionLabelKind:Tee,modelOptionTitle:PT,modelOptionsAfterChange:Iee,modelSelectionStringOption:See,modelTraitDescriptors:kee,nearestEffortLevel:Lee,parseRetryAfterMs:Ree,pluginJsonByteLength:Pee,projectOrNull:Eee,readRequestResolved:Mee,readThreadFailed:Aee,readTurnProgress:Nee,readUserInputPending:Dee,reasoningEffortLevel:ET,reasoningEffortShortLabel:_ee,relabelModelOptionDescriptors:Oee,resolveModelChoice:Fee,resolveModelOptions:Bee,resolveProviderDriverKindForInstanceSelection:MT,sortProviderInstanceEntries:AT,threadMessagesNewestFirst:Hee,threadOrNull:Uee}=TT;var KH={effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant",fastMode:"traits.savedOption.fastMode",agent:"traits.savedOption.agent",serviceTier:"traits.savedOption.serviceTier"},qH=e=>`traits.optionValue.${e}`;function NT(e,t){return PT(t,o=>e(KH[o]))}function eh(e,t){return t.effortDisplayKind==="standard-tier"?e("traits.standardTier"):IT(t,o=>e(qH(o)))}function vi({badge:e,compact:t=!1}){let{t:o}=Me(),n=eh(o,e);return v(oe,{children:[e.driverKind?l("span",{className:t?"flex size-5 shrink-0 items-center justify-center":"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:l(Ys,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,v("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?l("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,t?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}):l(dp,{text:e.modelLabel,label:o("copyButton.copyModelName"),children:l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel})}),n?v(oe,{children:[" ",l("span",{children:n})]}):null]})]})}function DT({badge:e,createdAt:t}){let o=xe(Fe),{t:n}=Me();return v("div",{className:"mb-3 flex min-w-0 select-none flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[l(vi,{badge:e})," ",v(Re,{children:[l(Ee,{render:l("span",{className:"shrink-0 tabular-nums"}),children:tr(t,o.timestampFormat,n)}),l(Pe,{children:kn(t,o.timestampFormat,n)})]})]})}function th({row:e}){let{t}=Me(),o=eh(t,e.badge),n=o?`${e.badge.modelLabel} (${o})`:e.badge.modelLabel,r=[e.badge.providerDisplayName,n].filter(s=>typeof s=="string"&&s.length>0).join(" "),a=e.pending?t("timeline.modelSwitchPending",{model:r}):t("timeline.modelSwitched",{model:r});return v("div",{role:"separator","aria-label":a,"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:[l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),v("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?l(Ys,{driver:e.badge.driverKind,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,l("span",{className:"truncate",children:a})]}),l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}function Ip({row:e}){let t=xe(Fe).derive;if(e.message.rewrite){let o=t.parsePresetPrefixText(e.message.rewrite.original);return o?v(oe,{children:[l(_T,{parsed:o}),l(Ip,{row:{...e,message:{...e.message,rewrite:{...e.message.rewrite,original:o.body}}}})]}):l(Jg,{row:e,text:e.message.rewrite.original})}if(es(e.message.text)){let o=t.parsePresetPrefixText(e.message.text);return o?v(oe,{children:[l(_T,{parsed:o}),o.body.length>0||(e.message.attachments?.length??0)>0?l(Ip,{row:{...e,message:{...e.message,text:o.body}}}):null]}):l(jH,{row:e})}return l(Jg,{row:e,text:e.message.text})}var WH={"child.settled":{tone:"success",label:"childThread.state.settled"},"child.failed":{tone:"error",label:"childThread.state.failed"},"child.approval":{tone:"attention",label:"childThread.state.approval"},"child.question":{tone:"attention",label:"childThread.state.question"},"child.stopped":{tone:"neutral",label:"childThread.state.stopped"},"child.resolved":{tone:"success",label:"childThread.state.resolved"}};function Tp({children:e}){return l("div",{className:"flex justify-center py-1",children:l("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 _T({parsed:e}){let{t}=Me();return v(Tp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var GH={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.question":"childThread.notification.question","child.stopped":"childThread.notification.stopped","child.resolved":"childThread.notification.resolved","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved","cookie-import.resolved":"childThread.notification.cookieImportResolved"};function jH({row:e}){let{t}=Me(),o=Nt(),{derive:n,activeThreadEnvironmentId:r}=xe(Fe),a=xe(Fe).SessionMessageCard,s=e.message.attachments??[],i=s.filter(m=>br(m)),d=s.filter(m=>!br(m)),c=(m,p)=>{let f=vT(m);if(f)return l(xT,{wake:f,blockKey:`${e.message.id}:${p}`});let g=wT(m);if(g)return v(Tp,{children:[l("p",{className:"font-medium text-foreground/80",children:g.title}),g.body.length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:g.body}):null]});let h=n.parseThreadHandoverText(m);if(h)return v(Tp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),l("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:h.includedTurns})}),l("p",{className:"mt-1 whitespace-pre-wrap",children:h.body})]});let y=n.parseSystemNotificationText(m);if(!y||y.recordId!==void 0)return null;let x=y.childThreadId&&n.notificationOpensChildThread(y.kind),C=()=>{y.childThreadId!==void 0&&o.openThread({environmentId:r,threadId:y.childThreadId})},b=WH[y.kind];if(a!==void 0&&b!==void 0&&y.childThreadId){let w=[y.kind==="child.resolved"&&y.resolution!==void 0?t(`childThread.resolution.${y.resolution}`):null,y.summary.trim()].filter(k=>k).join(`
|
|
3554
|
-
`);return l(a,{environmentId:r,threadId:y.childThreadId,fallbackName:y.title,status:{tone:b.tone,label:t(b.label)},text:w.length>0?w:t(b.label),action:x?{label:t("childThread.open"),onPress:C}:void 0})}return v(Tp,{children:[l("p",{className:"font-medium text-foreground/80",children:t(GH[y.kind],{title:y.title})}),y.kind==="child.resolved"&&y.resolution!==void 0?l("p",{className:"mt-1",children:t(`childThread.resolution.${y.resolution}`)}):null,y.summary.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:y.summary}):null,x?l(K,{type:"button",size:"xs",variant:"outline",className:"relative mt-2 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:C,children:t("childThread.open")}):null]})},u=mT(e.message.text).map(c).filter(m=>m!==null);return u.length===0&&s.length===0?null:v(oe,{children:[u.map((m,p)=>l(Al,{children:m},p)),s.length>0?v("div",{className:"min-w-0 px-3 py-2",children:[l(Ed,{images:i}),d.map(m=>l(Md,{attachment:m},m.id))]}):null]})}function OT(e,t){let o=t.parsePresetPrefixText(e??"")?.body??null;if(o===null&&es(e??""))return null;let r=hi(o??e??"").visibleText;for(;;){let i=yi(r);if(!i.annotation)break;r=i.promptText}let a=ra(r).promptText,s=fi(a).map(i=>i.kind==="text"?t.messageLinksToPreviewText(i.text):i.comment.text).join(" ").replace(/\s+/g," ").trim();return s.length>0?s:null}var FT=30,BT=8,oh=FT+BT,HT=pe(function({ref:t,textRef:o,initialText:n,onJump:r}){let{t:a}=Me(),s=a("timeline.pinnedTurnHeaderJump");return l("div",{ref:t,className:"pointer-events-none absolute inset-x-0 top-0 z-10 px-3 data-[visible=false]:hidden sm:px-5","data-timeline-turn-header":"true","data-visible":"false",children:l("div",{className:"transcript-col-wide",style:{paddingTop:BT},children:l("div",{className:"rounded-control-3 bg-background",children:v(K,{type:"button",variant:"outline",size:"sm",title:s,onClick:r,className:"pointer-events-auto w-full min-w-0 justify-start gap-2 bg-background px-2.5 text-xs font-normal text-muted-foreground shadow-xs hover:text-foreground",style:{height:FT},children:[l(Bl,{"aria-hidden":!0,className:"size-icon-2 shrink-0"}),l("span",{className:"sr-only",children:s}),l("span",{ref:o,className:"min-w-0 flex-1 truncate text-left",children:n})]})})})})});function UT({row:e}){let t=xe(Fe),{t:o}=Me(),[n,r]=zt(t.threadKey,`message:${e.message.id}`,!1);if(e.message.text.trim().length===0&&(e.message.attachments?.length??0)>0)return l(jg,{rowId:e.id,messageId:e.message.id,attachments:e.message.attachments},e.message.id);if(e.presentation==="compact"&&!n)return l(ip,{state:"idle",children:v("button",{type:"button",className:G(sp,"chat-process-text cursor-[var(--control-cursor)] text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":o("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[l(Pd,{status:null}),l(Rd,{children:l(vr,{className:"size-icon-1","aria-hidden":!0})}),l("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),l(Tt,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let s=e.message.attachments??[],i=e.message.text||(e.message.streaming||s.length>0?"":o("timeline.emptyResponse"));return l(oe,{children:v("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"?v("div",{className:"mb-1 flex items-center gap-2",children:[l("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:o("timeline.collapseMessage")}),e.copyInFooter?null:l(na,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?l(DT,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,i.trim().length>0?l("div",{"data-assistant-quote-body":"",children:l(Io,{disclosureKey:`message:${e.message.id}:assistant`,text:i,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(i),skills:t.skills,onImageExpand:t.onImageExpand,artifactTurnId:e.message.turnId})}):null,l(jg,{rowId:e.id,messageId:e.message.id,attachments:s},e.message.id),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?v("div",{className:"mt-1.5 flex select-none 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:[l(VH,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&v(Re,{children:[l(Ee,{render:l("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:tr(e.message.updatedAt,t.timestampFormat,o)}),l(Pe,{children:kn(e.message.updatedAt,t.timestampFormat,o)})]})]}):null]})})}function VH({row:e}){let o=xe(Fe).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return o.visible?l(na,{text:o.text??"",variant:"ghost"}):null}var nh=240,QH=/\s/u;function $T(e){if(!e)return null;let t=[],o=0,n=!1,r=()=>{for(;o>nh-1;)o-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),o-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(QH.test(a)){n=t.length>0;continue}if(n&&(t.push(" "),o+=1,n=!1,o>nh)||(t.push(a),o+=a.length,o>nh))return r()}return t.length>0?t.join(""):null}function XH(e,t,o){let n=t.find(p=>p.kind==="message"&&p.message.role==="user"),r=n?.kind==="message"?n.message:null,a=r?.rewrite?.original??r?.text??"",s=null;for(let p of t)p.kind==="message"&&p.message.role==="assistant"&&(s=p.message.text.trim()?p.message.text:(p.message.attachments??[]).map(f=>f.source?._tag==="agent-artifact"&&f.source.title?`${f.name} \u2014 ${f.source.title}`:f.name).join(", "));let i=r?.attachments??[],d=r!==null&&!a.trim()&&i[0]?{name:i[0].name,count:i.length}:void 0,c=r!==null&&es(a)&&o.parsePresetPrefixText(a)===null,u=r===null?null:OT(a,o),m=u===null&&!c&&i[0]?{name:i[0].name,count:i.length}:void 0;return{...d===void 0?{}:{attachmentPreview:d},...m===void 0?{}:{headerAttachment:m},...c?{isSystemMessage:!0}:{},id:e,sectionKey:e,anchorRowId:n?.id??t[0]?.id??e,userText:r===null?null:$T(o.parseSystemNotificationText(a)?.summary??o.parseThreadHandoverText(a)?.body??o.messageLinksToPreviewText(o.parsePresetPrefixText(a)?.body??a))??(d===void 0?null:""),assistantText:$T(s),headerText:u}}function YH(e){for(let t of e){let o=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(o!==null)return o}return null}function JH(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&&e.isSystemMessage===t.isSystemMessage&&e.attachmentPreview?.name===t.attachmentPreview?.name&&e.attachmentPreview?.count===t.attachmentPreview?.count}function ZH(e,t,o){for(let n=0;n<e.length;n+=1)if(e[n]!==o[t.firstRowIndex+n])return!1;return!0}function eU(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function tU(e){let t=new Map,o=null;return n=>{let r=n.getVersion();if(o!==null&&o.store===n&&o.version===r)return o.entries;let a=new Map,s=[],i=n.getRows();for(let c of n.getStructure().sections){let u=t.get(c.key);if(u!==void 0&&u.rowIds===c.rowIds&&ZH(u.rows,c,i)){a.set(c.key,u),s.push(u.entry);continue}let m=i.slice(c.firstRowIndex,c.firstRowIndex+c.rowIds.length),p=XH(c.key,m,e),{headerAttachment:f,...g}=p,h={...g,turnId:YH(m)},y=u?.entry.summary.headerAttachment,x=u!==void 0&&JH(u.entry.item,h)&&y?.name===f?.name&&y?.count===f?.count?u.entry:{summary:p,item:h};a.set(c.key,{rowIds:c.rowIds,rows:m,entry:x}),s.push(x)}t=a;let d=o!==null&&eU(o.entries,s)?o.entries:s;return o={store:n,version:r,entries:d},d}}var zT=new WeakMap;function WT(e,t){let o=zT.get(e);return(o===void 0||o.derive!==t)&&(o={derive:t,read:tU(t)},zT.set(e,o)),o.read(e)}var KT=new WeakMap;function GT(e,t){let o=WT(e,t),n=KT.get(o);if(n===void 0){let r=null;n=o.flatMap(({summary:a})=>{if(a.isSystemMessage===!0)return r===null?[]:[{...r,sectionKey:a.sectionKey,inherited:!0}];let s=a.headerAttachment;return a.headerText===null&&s===void 0?(r=null,[]):(r={sectionKey:a.sectionKey,text:a.headerText??"",...s===void 0?{}:{attachment:s},anchorRowId:a.anchorRowId,inherited:!1},[r])}),KT.set(o,n)}return n}function jT(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>{let r=t[n];return o.sectionKey===r.sectionKey&&o.text===r.text&&o.anchorRowId===r.anchorRowId&&o.attachment?.name===r.attachment?.name&&o.attachment?.count===r.attachment?.count&&o.inherited===r.inherited})}var qT=new WeakMap;function VT(e,t){let o=WT(e,t),n=qT.get(o);return n===void 0&&(n=o.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),qT.set(o,n)),n}function QT(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>o===t[n])}var oU=[],nU=e=>e.getMeta().usageByTurnId,rU=e=>e.getMeta().exportApi,aU=e=>e.getMeta().status.totalTurnCount??null,XT=pe(function({rowsStore:t,derive:o,paneVisible:n,bottomInset:r,onSelect:a,onTurnNavigatorChange:s}){let i=P(f=>n?VT(f,o):oU,[o,n]),d=Gt(t,i,QT),c=Gt(t,nU),u=Gt(t,rU),m=Gt(t,aU),p=W(()=>n?{items:d,totalTurnCount:m,bottomInset:r,usageByTurnId:c,onSelect:a,exportMarkdown:u.markdown,onDownload:u.download}:null,[r,u,d,a,n,m,c]);return H(()=>{p!==null&&s(p)},[s,p]),H(()=>{if(n)return()=>s(null)},[s,n]),null});function JT({timeline:e,previousOverlayHeight:t,overlayHeight:o,followingEnd:n}){e&&n&&o>t&&e.scrollToEnd({animated:!1})}function ZT(e,t){let o=e.topOf(t),n=e.heightOf(t);return typeof o!="number"||typeof n!="number"||!Number.isFinite(o)||!Number.isFinite(n)?null:o+Math.max(1,n)}function eI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}var YT="--chat-frozen-block-visibility";function Sp(e,t){let o=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),n=o.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=n<0?o:o.slice(0,n+1);for(let a of r)a.style.contentVisibility="visible",a.style.setProperty(YT,"visible");e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility"),a.style.removeProperty(YT)})}$();var sU=e=>e.getMeta().status.workingStepLabel??null,iU=e=>e.getMeta().status.waitingFor??null,lU=e=>e.getMeta().status.liveOutputTokens??null,dU=e=>e.getMeta().status.stall??null,cU=e=>e.getMeta().status.retry??null,tI=pe(function({rowsStore:t,historyWindow:o,children:n}){let r=Gt(t,sU),a=Gt(t,iU),s=Gt(t,lU),i=Gt(t,dU),d=Gt(t,cU),c=W(()=>o?{workingStepLabel:null,waitingFor:null,liveOutputTokens:null,stall:null,retry:null}:{workingStepLabel:r,waitingFor:a,liveOutputTokens:s,stall:i,retry:d},[o,s,d,i,a,r]);return l(ap,{value:c,children:n})});$();function kp(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var uU=1e3,Lp=150;function Rp(e,t=uU){let[o,n]=q(null);return H(()=>{if(e===null){n(null);return}let r=globalThis.setTimeout(()=>{n(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),o}var pU=5;function oI(e){let t=e.data.useThreadSyncPhase(e.target);return Rp(t,Lp)==="loading"?l(rh,{}):null}function rh(){let{t:e}=z();return v("div",{className:"pointer-events-none absolute inset-0 overflow-hidden bg-background px-3 pt-4 sm:px-5","data-timeline-loading-skeleton":"",role:"status",children:[l("span",{className:"sr-only",children:e(kp("loading"))}),l("div",{className:"transcript-col flex flex-col gap-6",children:Array.from({length:pU},(t,o)=>v("div",{"aria-hidden":"true",className:"flex flex-col gap-3",children:[l("div",{className:"h-9 self-end rounded-[18px] bg-muted-foreground/15",style:{width:`${44-o%2*14}%`}}),[92,84,61].map((n,r)=>l("div",{className:"h-3 rounded-control-1 bg-muted-foreground/15",style:{width:`${n-o%3*6}%`}},r))]},o))})]})}var nI=l("div",{className:"h-3 sm:h-4"}),rI=l("div",{className:"h-10 sm:h-12"});function aI({loading:e,blocked:t,onLoadEarlier:o,fade:n}){let{t:r}=Me();return l("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:o,disabled:e||t,className:"relative w-full select-none 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 sI({loading:e,blocked:t,onLoadLater:o,onReturnToLatest:n}){let{t:r}=Me();return v("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[l(K,{variant:"ghost",size:"sm",onClick:o,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),n?l(K,{variant:"ghost",size:"sm",onClick:n,children:r("timeline.returnToLatest")}):null]})}function iI({onReveal:e,fade:t}){let{t:o}=Me();return l("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:e,className:"relative w-full select-none 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:o("timeline.loadEarlier")})})})}var lI=l("div",{className:"h-3 sm:h-4"});$();var mU=Object.freeze([]),dI=e=>e.getMeta().status.scheduledWakes??mU;function cI(e,t){let o=M(e);return t&&(o.current=e),o.current}$();function Pp(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}$();function Ep(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 uI({badge:e,startedAt:t,completedAt:o,waitingLabel:n,timestampFormat:r}){let{t:a}=Me();if(e===null&&t===void 0)return null;let s=a("timeline.turnInfo");return v(ln,{children:[l(cn,{openOnHover:!0,delay:250,render:l(K,{type:"button",size:"icon-xs",variant:"ghost","data-turn-info":"","aria-label":s,className:"shrink-0 text-muted-foreground"}),children:l(td,{className:"size-3.5","aria-hidden":!0})}),l(dn,{side:"top",align:"start",className:"max-w-80",children:v("div",{className:"flex flex-col gap-2 text-chat-dense",children:[e!==null?l("div",{className:"flex min-w-0 items-center gap-2",children:l(vi,{badge:e})}):null,t!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnStarted",{time:kn(t,r,a)})}):null,o!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnFinished",{time:kn(o,r,a)})}):null,n!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:n}):null]})})]})}function fU(e,t,o,n){if(o===void 0||o<=0)return null;let r=t(o);return n!==void 0&&n>0?e("timeline.waitingWithApprovals",{waiting:r,approvals:t(n)}):e("timeline.waiting",{waiting:r})}function Mp({label:e,children:t}){let[o,n]=q(!1);return v(Re,{open:o,onOpenChange:n,children:[l(Ee,{render:l("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>n(r=>!r),children:t}),l(Pe,{children:e})]})}var pI=pe(function({footer:t,timestampFormat:o,copyText:n,identity:r}){let{t:a}=Me(),{formatCountedDuration:s}=Bo(),i=fU(a,s,t.waitingForYouMs,t.approvalWaitMs),d=t.state,c=d==="error"?a("timeline.error"):d==="interrupted"?a("timeline.interrupted"):null;return v("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:[v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[c!==null?v(Mp,{label:c,children:[d==="error"?l(ot,{className:"size-icon-1 text-destructive-foreground","aria-hidden":!0}):l(gd,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:c})]}):null,t.workingElapsedMs!==void 0?l(Mp,{label:a("timeline.workingTime",{duration:s(t.workingElapsedMs)}),children:s(t.workingElapsedMs)}):null,i!==null?v(oe,{children:[" ",l(Mp,{label:i,children:i})]}):null,(t.workingElapsedMs!==void 0||i!==null)&&t.outputTokens!==void 0?" ":null,t.outputTokens!==void 0?l(dp,{text:String(t.outputTokens),label:a("copyButton.copyTokenCount"),children:l(Mp,{label:`${a("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:a("timeline.outputTokenCount",{count:t.outputTokens,value:Ep(t.outputTokens)})})}):null]}),l(uI,{badge:r?.badge??null,startedAt:r?.createdAt,completedAt:t.completedAt,waitingLabel:i??void 0,timestampFormat:o}),n?l(na,{text:n,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});function Fd({plugins:e,environmentId:t}){let{t:o}=z(),n=Zn(t,e[0]??"");return l("span",{className:"chat-process-meta text-muted-foreground",children:o(e.length===1?"toolCall.rewrittenByOne":"toolCall.rewrittenByMany",{plugin:n??o("toolCall.unknownPlugin"),count:e.length})})}$();function gU(e){return e.toolLifecycleStatus==="interrupted"}function hU(e){let t=e?.stoppedByUser===!0;return e?.continuedAfterStop===!0?t?"toolGroup.interruptedByYouKeptRunning":"toolGroup.interruptedKeptRunning":e?.terminationConfirmed===!0?t?"toolGroup.interruptedByYou":"toolGroup.interrupted":t?"toolGroup.interruptedByYouMayStillRun":"toolGroup.interruptedMayStillRun"}function ah(e,t,o){if(!gU(e))return null;let n=e.toolInterrupt,r=t(hU(n)),a=[n?.durationMs===void 0?null:o(n.durationMs),e.toolIo?.exitCode===void 0?null:t("toolGroup.exitCode",{code:e.toolIo.exitCode})].filter(s=>s!==null);return a.length===0?r:`${r}, ${a.join(", ")}`}$();function mI(e){if(e<1e3)return String(e);if(e<1e6){let o=e/1e3;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}k`}if(e<1e9){let o=e/1e6;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var fI=pe(function(t){let{additions:o,deletions:n,className:r,showParentheses:a=!1,layout:s="aligned"}=t,{t:i}=Me(),d=new Intl.ListFormat(void 0,{type:"unit"}).format([i("changedFiles.additions",{count:o}),i("changedFiles.deletions",{count:n})]);return v(oe,{children:[a&&l("span",{className:"text-muted-foreground/70",children:"("}),v("span",{role:"group","aria-label":d,className:G(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:[v("span",{"aria-hidden":"true",className:"font-mono text-diff-addition",children:["+",mI(o)]}),v("span",{"aria-hidden":"true",className:"font-mono text-diff-deletion",children:["-",mI(n)]})]}),a&&l("span",{className:"text-muted-foreground/70",children:")"})]})});function Ci({name:e,className:t}){switch(e){case"bot":return l(Ua,{className:t,"aria-hidden":!0});case"check":return l(wo,{className:t,"aria-hidden":!0});case"circle-alert":return l(Dt,{className:t,"aria-hidden":!0});case"eye":return l(Wl,{className:t,"aria-hidden":!0});case"globe":return l(Ka,{className:t,"aria-hidden":!0});case"hammer":return l(Zl,{className:t,"aria-hidden":!0});case"message-circle":return l(Wa,{className:t,"aria-hidden":!0});case"search":return l(Qa,{className:t,"aria-hidden":!0});case"square-pen":return l(No,{className:t,"aria-hidden":!0});case"terminal":return l(To,{className:t,"aria-hidden":!0});case"wrench":return l(Vr,{className:t,"aria-hidden":!0});case"x":return l(ot,{className:t,"aria-hidden":!0});case"zap":return l(hd,{className:t,"aria-hidden":!0})}}function yU(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function sh(e,t){let o=new Map;for(let n of e){let r=t(n);o.set(r,(o.get(r)??0)+1)}return Array.from(o,([n,r])=>({action:n,icon:yU(n),count:r}))}function ih(e,t){let o;for(let n of sh(e,t))(!o||n.count>o.count)&&(o=n);return o?.icon??"wrench"}$();function gI({entries:e,failed:t,derive:o}){let{t:n}=Me(),r=W(()=>sh(e,o.toolGroupAction),[e,o]),a=r.length===1;return a&&r[0].count<2?null:l("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":n("toolGroup.calls",{count:e.length}),children:r.map(({action:s,icon:i,count:d})=>v("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:l(Ci,{name:i,className:G("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive-foreground":"text-icon-muted")}),d]},s))})}function vU(e){switch(e){case"command":return"command";case"edit":return"edit";case"read":return"read";case"search":case"code-search":return"search";default:return"other"}}function CU(e){return e.changedFiles&&e.changedFiles.length>0?e.changedFiles:e.toolLabel?.path?[e.toolLabel.path]:[]}function hI(e,t){let o=[],n=new Map,r=new Map,a=new Map;for(let p of e){let f=vU(t(p));if(o.includes(f)||o.push(f),n.set(f,(n.get(f)??0)+1),f!=="edit"&&f!=="read")continue;let g=CU(p);if(g.length===0){a.set(f,(a.get(f)??0)+1);continue}let h=r.get(f)??new Set;for(let y of g)h.add(y);r.set(f,h)}let i=o.map(p=>({kind:p,count:p==="edit"||p==="read"?(r.get(p)?.size??0)+(a.get(p)??0):n.get(p)??0})).filter(p=>p.count>0).slice().sort((p,f)=>f.count-p.count||o.indexOf(p.kind)-o.indexOf(f.kind)),d=i.slice(0,2),c=i.slice(2);if(c.length===0)return d;let u=c.reduce((p,f)=>p+(n.get(f.kind)??0),0),m=d.map(p=>p.kind==="other"?{kind:"other",count:p.count+u}:p);return d.some(p=>p.kind==="other")||m.push({kind:"other",count:u}),m}function yI(e){return typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null}function vI(e,t,o,n){if(t===void 0||o===void 0||o.length===0)return e;let r=e.trim();for(let a of[`mcp__ycodium__${t}`,`ycodium_${t}`,`ycodium ${t}`,t]){if(r===a)return o;if(!r.startsWith(`${a} `))continue;let s=r.slice(a.length).trim();return s.length===0?o:n!==void 0&&s.toLowerCase()==="started"?n(o):`${o} ${s}`}return e}function aa(e){return Pp(e)}function Ap(e,t,o,n,r,a){let s=e.toolLabel,i=o.resolveToolCommand(e);if(i&&s?.descriptive&&!s.path&&s.detail?.trim())return s.detail.replace(/\s+/g," ").trim();for(let y of[e.rawCommand,e.command]){let x=o.parseToolCommandInput(y)?.description;if(x)return x.replace(/\s+/g," ").trim()}if(i)return i.replace(/\s+/g," ").trim();let d=yI(e),c=typeof d?.toolName=="string"?d.toolName:typeof d?.name=="string"?d.name:void 0,u=e.builtinMcpTool||void 0,m=a??vI(s?.name??c??e.toolTitle??e.label,u,u===void 0?void 0:n?.get(u),r),p=s?.path??e.changedFiles?.[0],f=p?fp(p,t):void 0,g=[m.trim().toLowerCase()==="tool"?void 0:m,f,e.toolMetadata?.source==="ycodium"?void 0:s?.detail??e.detail],h=[];for(let y of g){let x=y?.replace(/\s+/g," ").trim();x&&!h.some(C=>C.toLowerCase()===x.toLowerCase())&&h.push(x)}return h.join(" ")||null}$();function Bd(e){let t=xe(Fe)?.toolPresentation;return e===void 0||t===void 0?null:t(e)}function CI(e){let t=xe(Fe)?.toolPresentation;return W(()=>{if(t===void 0||e.length===0)return null;let o=t(e[0]);if(o===null)return null;let n=e.map(r=>t(r));return n.every(r=>r?.groupKey===o.groupKey)?o:n.every(r=>r?.familyKey===o.familyKey)?{...o,groupName:o.familyName,origin:o.origin.kind==="ycodium"?{kind:"ycodium",area:"general"}:o.origin}:null},[e,t])}function lh({presentation:e,className:t}){let o=xe(Fe),n=o.ToolSourceIcon;return n===void 0?null:l(n,{environmentId:o.activeThreadEnvironmentId,origin:e.origin,className:t})}function Hd({presentation:e,fallback:t,environmentId:o}){return v(oe,{children:[e.sourceName!==null?v(oe,{children:[l("span",{className:"font-medium text-foreground","data-tool-source-name":"",children:e.sourceName}),l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"})]}):null,e.declared?l("span",{children:e.title}):t,e.declared&&e.summary!==null?l(xI,{text:e.summary}):null,e.declared&&e.summary===null&&e.entity?l(xU,{entity:e.entity,environmentId:o}):null,e.declared&&e.experienceId?l(bU,{experienceId:e.experienceId}):null]})}function xU({entity:e,environmentId:t}){let o=xe(Fe),n=t??o?.activeThreadEnvironmentId??"",r=e.kind==="machine"?e.environmentId:e.environmentId??n;return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"inline-flex min-w-0 tabular-nums","data-tool-entity":e.kind,children:e.kind==="thread"?l(Cd,{threadRef:{environmentId:r,threadId:e.threadId},fallbackName:e.fallbackName,showStatus:!1}):e.kind==="machine"?l(yb,{environmentId:r,fallbackName:e.fallbackName}):e.kind==="project"?l(vb,{projectRef:{environmentId:r,projectId:e.projectId},fallbackName:e.fallbackName}):l(Cb,{environmentId:r,instanceId:e.instanceId,fallbackName:e.fallbackName})})]})}function xI({text:e}){return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"tabular-nums",children:e})]})}function bU({experienceId:e}){let t=mi(),o=t?.data.useMemoryExperience;return!t||!o?null:l(wU,{readExperience:o,target:t.target,experienceId:e})}function wU({readExperience:e,target:t,experienceId:o}){let{title:n}=e(t,o);return n===null?null:l(xI,{text:n})}var xi=20,TU={failed:"toolGroup.showFailure",declined:"toolGroup.showDeclined",stopped:"toolGroup.showCancelled"},IU={command:"toolGroup.semanticCommands",edit:"toolGroup.semanticEdits",read:"toolGroup.semanticReads",search:"toolGroup.semanticSearches",other:"toolGroup.semanticOther"};function bI({entry:e,presentation:t}){let o=e.toolLabel?.diffStat;return!o||t==="failed"||t==="declined"||t==="stopped"?null:l(fI,{...o,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function wI({toolIcon:e,glyphClassName:t}){let o=xe(Fe),n=o.SiteIcon;return e.pageUrl!==void 0&&n!==void 0?l(n,{threadRef:o.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):l(Ci,{name:"globe",className:t})}function SU({entry:e,failed:t=!1,derive:o}){let n=xe(Fe),r=Bd(e);return t?l(Dt,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive-foreground"}):e.toolIcon!==void 0?l(wI,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):r!==null&&n.ToolSourceIcon!==void 0?l(lh,{presentation:r,className:"size-icon-1"}):l(Ci,{name:ih([e],o.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function TI({entry:e}){let t=xe(Fe),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,n=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=Bd(e),a=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:n,onOpenFileDiff:t.onOpenFileDiff});return v("div",{className:"min-w-0 space-y-2 p-3",children:[r!==null?l("p",{className:"chat-process-meta text-muted-foreground","data-tool-source-line":"",children:r.sourceLine}):null,a!==void 0?l(oe,{children:a}):l("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:o??""})]})}var kU=pe(function(t){let{entry:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}=t,s=xe(Fe),i=s.derive,{t:d}=Me(),{formatDuration:c}=Bo(),[u,m]=zt(n,`call:${aa(o)}`,!1),p=i.toolPresentationStatus(o),f=Bd(o),g=f?.declared===!0?null:Ap(o,r,i,s.declaredToolTitles,k=>d("toolGroup.declaredStarted",{title:k}),f?.title)??d("toolGroup.calls",{count:1}),h=p==="failed",y=p==="declined",x=p==="stopped",C=x?ah(o,d,c):null,b=i.resolveWorkEntryStatus(o),L=b==="failed"||b==="running"?b:null,w=ho();return v("div",{"data-tool-call-id":o.toolCallId??o.id,"data-tool-identity":aa(o),className:"border-b border-border/50 last:border-b-0",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":w,onClick:()=>{a?.(),m(!u)},className:G("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",h?"text-destructive-foreground":"text-muted-foreground"),children:[l(Pd,{status:L}),l(Rd,{children:l(SU,{entry:o,failed:h,derive:i})}),v("span",{className:"flex min-w-0 flex-1 items-center",children:[l("span",{className:"truncate",children:f!==null?l(Hd,{presentation:f,fallback:g}):g}),l(bI,{entry:o,presentation:p})]}),h||y||x||o.statusInferred?l("span",{className:"chat-process-meta shrink-0",children:o.statusInferred?d("toolGroup.statusUnknown"):h?d("toolGroup.failed",{count:1}):y?d("toolGroup.declined",{count:1}):C??d("toolGroup.cancelled",{count:1})}):null,o.rewrittenBy?.length?l(Fd,{plugins:o.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,l(Tt,{"aria-hidden":!0,className:G("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),u?l("div",{id:w,children:l(TI,{entry:o})}):null]})});function LU({threadKey:e,stateKey:t,maxHeight:o,children:n}){let r=M(null);return fe(()=>{let a=r.current;if(!a)return;a.scrollTop=Wg(e,`${t}:scroll`,0);let s=()=>{Ld(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",s,{passive:!0}),()=>a.removeEventListener("scroll",s)},[e,t]),l("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:o},children:n})}var II=pe(function({entries:t,groupId:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}){let s=xe(Fe),i=s.derive,{t:d}=Me(),{formatDuration:c}=Bo(),[u,m]=zt(n,`group:${o}`,!1),[p,f]=zt(n,`group-page:${o}`,0),g=ho(),h=M(null),[y,x]=q(null),C=t.at(-1),{failedCount:b,declinedCount:L,stoppedCount:w,issue:k,runningCount:I,unknownCount:T}=W(()=>({...i.summarizeToolGroup(t),unknownCount:t.filter(re=>re.statusInferred).length,runningCount:t.filter(re=>i.toolPresentationStatus(re)==="running").length}),[t,i]),S=k?.entry??C,R=Math.max(0,Math.ceil(t.length/xi)-1),A=Math.min(p,R),N=A*xi,B=t.slice(N,N+xi),O=t.length>1,V=t.every(re=>i.toolPresentationStatus(re)==="completed"),D=W(()=>O&&V&&k===null?hI(t,i.toolGroupAction):null,[t,i,O,V,k])?.map(re=>d(IU[re.kind],{count:re.count})).join(" \xB7 ")??null,X=CI(O?t:[]),j=Bd(O?void 0:C),E=O?X:j;if(fe(()=>{if(!y)return;let re=h.current,ee=Array.from(re?.querySelectorAll("[data-tool-identity]")??[]).find(he=>he.dataset.toolIdentity===y.id);if(!ee)return;let ve=ee.closest('[data-slot="scroll-area-viewport"]');ve&&(ve.scrollTop+=ee.getBoundingClientRect().top-ve.getBoundingClientRect().top),ee.querySelector("button")?.focus({preventScroll:!0})},[y]),!C||!S)return null;let Y=I>0&&k===null?t.find(re=>i.toolPresentationStatus(re)==="running")??S:S,F=D??Ap(Y,r,i,s.declaredToolTitles,re=>d("toolGroup.declaredStarted",{title:re}),j?.title)??d("toolGroup.calls",{count:1}),Z=re=>{a?.(),f(re)},J={threadKey:n,workspaceRoot:r,onDisclosureChange:a},ne=Aw(t.map(re=>Mw(i.resolveWorkEntryStatus(re)))),te=ih(t,i.toolGroupAction),le=O?null:ah(C,d,c),ge=ne==="failed"?"failed":ne==="running"?"running":L+w===t.length?null:"success";return l(ip,{state:ne,variant:"tool",children:v("section",{ref:h,"data-tool-group-id":o,className:"min-w-0",children:[v("div",{className:"flex min-w-0 items-center",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":g,onClick:()=>{a?.(),m(!u),!O&&!u&&Ld(n,`call:${aa(C)}`,!0)},className:G(sp,"flex-1",b>0?"text-destructive-foreground":"text-muted-foreground"),children:[l(Pd,{status:ge}),l(Rd,{children:E!==null&&s.ToolSourceIcon!==void 0&&b===0&&(O||C.toolIcon===void 0)?l(lh,{presentation:E,className:"size-icon-1"}):!O&&C.toolIcon!==void 0&&b===0?l(wI,{toolIcon:C.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):l(Ci,{name:te,className:G("size-icon-1 shrink-0 stroke-[1.8] opacity-70",b>0?"text-destructive-foreground":"text-icon-muted")})}),v("span",{className:G("flex min-w-0 flex-1 items-center",u&&O?"chat-process-text":"chat-tool-summary"),children:[l("span",{className:"truncate",children:X!==null?d("toolGroup.namedCalls",{name:X.groupName,count:t.length}):u&&O?d("toolGroup.calls",{count:t.length}):j!==null?l(Hd,{presentation:j,fallback:F}):F}),u&&O?null:D===null?l(bI,{entry:S,presentation:i.toolPresentationStatus(S)}):null]}),t.length===1&&S.rewrittenBy?.length?l(Fd,{plugins:S.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,T>0?l("span",{className:"chat-process-meta shrink-0",children:d("toolGroup.statusUnknown")}):null,I>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums text-info-foreground",children:d("toolGroup.running",{count:I})}):null,b>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.failed",{count:b})}):null,L>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.declined",{count:L})}):null,w>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.cancelled",{count:w})}):null,u&&O?null:D===null&&X===null?l(gI,{entries:t,failed:b>0,derive:i}):null,l(Tt,{"aria-hidden":!0,className:G("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),k&&O?l("button",{type:"button",className:G("chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 underline [@media(pointer:coarse)]:min-h-11",k.kind==="failed"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>{a?.(),m(!0),f(Math.floor(t.indexOf(k.entry)/xi)),Ld(n,`call:${aa(k.entry)}`,!0),x({id:aa(k.entry)})},children:d(TU[k.kind])}):null]}),u?l("div",{id:g,className:"border-t border-border/50",children:O?v(oe,{children:[t.length>xi?v("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[l("span",{className:"min-w-0 flex-1 tabular-nums",children:d("toolGroup.pageRange",{from:N+1,to:Math.min(N+xi,t.length),count:t.length})}),[{label:d("toolGroup.firstPage"),target:0,disabled:A===0,Icon:zl},{label:d("toolGroup.previousPage"),target:A-1,disabled:A===0,Icon:$l},{label:d("toolGroup.nextPage"),target:A+1,disabled:A===R,Icon:yo},{label:d("toolGroup.lastPage"),target:R,disabled:A===R,Icon:Kl}].map(({label:re,target:ee,disabled:ve,Icon:he})=>l("button",{type:"button","aria-label":re,disabled:ve,onClick:()=>Z(ee),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:l(he,{"aria-hidden":!0,className:"size-icon-1"})},re))]}):null,l(LU,{threadKey:n,stateKey:`group-scroll:${o}:${A}`,maxHeight:"min(320px, 50dvh)",children:l("div",{className:"space-y-0.5 py-1",children:B.map(re=>l(kU,{entry:re,...J},aa(re)))})})]}):v(oe,{children:[le?l("p",{className:"chat-process-meta px-3 pt-3 text-muted-foreground",children:l("span",{children:le})}):null,l(TI,{entry:C})]})}):null]})})});$();function SI(){let e=Nt(),t=r=>r instanceof Error?r.message:void 0,o=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,n=(r,a,s)=>e.notify(r,a,s);return{error:(r,a,s)=>{let i=s?.description??t(a);n(o(r,i),"error",i)},warning:(r,a,s)=>{let i=s?.description??t(a);n(o(r,i),"warning",i)},success:(r,a,s)=>{let i=a??s?.description;n(o(r,i),"success",i)}}}function Np(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function dh(e){let t=e.trimEnd().split(/\r?\n/),o=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;o[0]?.trim().length===0;)o.shift();if(o[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(o.shift();o[0]?.trim().length===0;)o.shift();return o.join(`
|
|
3555
|
-
`)}function
|
|
3556
|
-
`))}function
|
|
3557
|
-
`}function
|
|
3558
|
-
`).length,R=t.length>900||S>20,A=dh(t),N=R?kI(t,c,{maxLines:10}):null,B=LI(t),O=RI(t),V=()=>{PI(B,O)},U=()=>{w(O)},D=()=>{if(!i){u.error(c("proposedPlan.workspacePathUnavailable"),c("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&y(B.slice(0,_p)),g(!0)},X=()=>{if(L.current)return;let j=h.trim();if(!(!i||d===null)){if(!j){u.warning(c("proposedPlan.enterWorkspacePath"));return}if(j.length>_p){u.warning(c("proposedPlan.pathTooLong"));return}L.current=!0,C(!0),(async()=>{try{let E=await d({environmentId:r,workspaceRoot:i,relativePath:j,contents:O});if(!b.current)return;E.ok?(g(!1),u.success(c("proposedPlan.savedToWorkspace"),E.relativePath)):u.error(c("proposedPlan.couldNotSave"),void 0,{description:c("proposedPlan.saveErrorDescription")})}catch(E){b.current&&u.error(c("proposedPlan.couldNotSave"),E,{description:c("proposedPlan.saveErrorDescription")})}finally{L.current=!1,b.current&&C(!1)}})()}};return v("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v("div",{className:"flex min-w-0 items-center gap-2",children:[l(Xr,{variant:"secondary",children:c("proposedPlan.badge")}),l("p",{className:"truncate text-sm font-medium text-foreground",children:T})]}),v(_o,{children:[l(Fo,{render:l(K,{"aria-label":c("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:l(Ao,{"aria-hidden":"true",className:"size-4"})}),v(Oo,{align:"end",children:[l(vo,{onClick:U,children:c(k?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),l(vo,{onClick:V,children:c("proposedPlan.downloadAsMarkdown")}),d!==null?l(vo,{onClick:D,disabled:!i||x,children:c("proposedPlan.saveToWorkspace")}):null]})]})]}),v("div",{className:"mt-4",children:[v("div",{className:G("relative",R&&!m&&"max-h-104 overflow-hidden"),children:[R&&!m?l(Io,{disclosureKey:`proposed-plan:${n}:plan`,text:N??"",cwd:s,threadRef:a,isStreaming:!1}):l(Io,{disclosureKey:`proposed-plan:${n}:plan`,text:A,cwd:s,threadRef:a,isStreaming:!1}),R&&!m?l("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]}),R?l("div",{className:"mt-4 flex justify-center",children:l(K,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!m),children:c(m?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),l(ti,{open:f,onOpenChange:j=>{x||g(j)},children:v(ni,{className:"max-w-xl",children:[v(zu,{children:[l(ri,{children:c("proposedPlan.saveToWorkspace")}),l(oi,{children:Dp(c("proposedPlan.pathHint"),l("code",{children:i??c("proposedPlan.theWorkspace")}),"path")})]}),l(Rb,{className:"space-y-3",children:v("label",{htmlFor:I,className:"grid gap-1.5",children:[l("span",{className:"text-xs font-medium text-foreground",children:c("proposedPlan.workspacePath")}),l(Yr,{id:I,value:h,maxLength:_p,onChange:j=>y(j.target.value.slice(0,_p)),placeholder:B,spellCheck:!1,disabled:x})]})}),v($u,{children:[l(K,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:x,children:c("proposedPlan.cancel")}),l(K,{size:"sm",onClick:()=>{X()},disabled:x,children:c(x?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});$();var bi=class extends mr{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 PU({error:e,className:t}){let{t:o}=Me();return v(Re,{children:[v(Ee,{render:l("div",{className:G("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive-foreground",t)}),children:[l(Dt,{"aria-hidden":!0,className:"size-4 shrink-0"}),l("span",{className:"min-w-0 flex-1 truncate",children:o("timeline.entryUnavailable")})]}),l(Pe,{className:"max-w-xs whitespace-pre-wrap font-mono text-ui-sm",children:e.message})]})}function MI(e){return l(PU,{error:e})}$();var ch=qe(void 0);function AI(){return xe(ch)}function NI(e){let t=e.threadRef;if(typeof t=="object"&&t!==null&&"threadId"in t){let n=t.threadId;if(typeof n=="string"&&n.length>0)return n}let o=`${e.environmentId}:`;return e.threadKey.startsWith(o)&&e.threadKey.length>o.length?e.threadKey.slice(o.length):e.threadKey}$();function _I({row:e}){let{workingStepLabel:t,waitingFor:o,liveOutputTokens:n,stall:r,retry:a}=xe(ap),{t:s}=Me(),i=M(null),d=e.compacting?s("activity.compacting"):o==="approval"?s("activity.waitingForApproval"):o==="userInput"?s("activity.waitingForAnswer"):t;return v("div",{className:"border-b border-border/60 pb-2 pt-1",children:[v("div",{className:"working-status 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:[v("span",{ref:i,className:"working-glyph","data-waiting":o!==null?"":void 0,...o===null?{role:"img","aria-label":s("activity.working")}:{"aria-hidden":!0},children:[l("span",{}),l("span",{}),l("span",{})]}),d?l("span",{"data-working-part":"",className:"min-w-0",children:d}):null,e.createdAt?l(_U,{createdAt:e.createdAt,runSegments:e.runSegments,waitSpans:e.waitSpans,glyphRef:i}):null,n!==null?l("span",{"data-working-part":"",children:s("timeline.outputTokenCount",{count:n,value:Ep(n)})}):null]}),a?l(EU,{retry:a}):r&&!e.compacting?l(AU,{stall:r}):null]})}function EU({retry:e}){let{t}=Me(),o=xe(Fe);return v(bd,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[l(Ku,{children:o.derive.providerRetryMessage(e,(n,r)=>t(n,r))}),o.onInterrupt?l(wd,{children:l(K,{onClick:o.onInterrupt,disabled:o.stopping===!0,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:o.stopping===!0?t("stall.stopping"):t("stall.interrupt")})}):null]})}var MU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function AU({stall:e}){let{t}=Me(),{onInterrupt:o,stopping:n}=xe(Fe),r=t(MU[e.reason]);return v("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[l("span",{className:"tabular-nums",children:Dp(t("stall.noOutputForLive"),l(DU,{since:e.since}))})," ",l("span",{children:r}),o?l(K,{className:"h-5 px-1.5 text-chat-row",onClick:o,disabled:n===!0,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t(n===!0?"stall.stopping":"stall.interrupt")}):null]})}function NU(e,t,o){let n=Tn(),{workingClock:r}=xe(Fe).derive;H(()=>{let a=()=>{t.current&&(t.current.textContent=FI(e,o,r))};if(a(),!n)return;let s=setInterval(a,1e3);return document.addEventListener("visibilitychange",a),()=>{clearInterval(s),document.removeEventListener("visibilitychange",a)}},[n,e,t,o,r])}function DU({since:e}){let t=M(null),{units:o}=Bo(),{workingClock:n}=xe(Fe).derive;return NU(e,t,o),l("span",{className:"timeline-timer tabular-nums",ref:t,children:FI(e,o,n)})}function _U({createdAt:e,waitSpans:t,runSegments:o,glyphRef:n}){let r=M(null),a=Tn(),{units:s}=Bo(),{workingClock:i}=xe(Fe).derive,{paused:d}=i({startedAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o});return H(()=>{let c=()=>{let m=DI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s);r.current&&(r.current.textContent=m.text),n.current&&(n.current.dataset.tick=String(m.elapsedSeconds%3))};if(c(),!a||d)return;let u=setInterval(c,1e3);return document.addEventListener("visibilitychange",c),()=>{clearInterval(u),document.removeEventListener("visibilitychange",c)}},[e,n,a,d,o,s,t,i]),l("span",{ref:r,"data-working-part":"",className:"timeline-timer tabular-nums",children:DI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s).text})}function OI(e,t){if(!Number.isFinite(e)||e<0)return t.seconds("0");let o=Math.floor(e/1e3);return o<60?t.seconds(String(o)):Td(o*1e3,t)}function DI(e,t,o){let n=e({startedAt:t.createdAt,nowIso:t.nowIso,waitSpans:t.waitSpans,runSegments:t.runSegments}),r=n.elapsedMs??0,a=Number.isFinite(r)?Math.max(0,Math.floor(r/1e3)):0;return{text:a<1?"":OI(r,o),paused:n.paused,elapsedSeconds:a}}function FI(e,t,o){return OI(o({startedAt:e,nowIso:new Date().toISOString(),waitSpans:void 0,runSegments:void 0}).elapsedMs??0,t)}$();function BI({children:e}){let{t}=z(),[o,n]=q(!1);return v("div",{className:"py-2","data-context-compaction-divider":!0,children:[v("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l("span",{className:"h-px min-w-2 flex-1 bg-border"}),v(K,{size:"xs",variant:"ghost",className:"shrink-0 gap-1.5","aria-expanded":o,title:t("turnOverview.compressionDetails"),onClick:()=>n(r=>!r),children:[l(Ba,{className:"size-3","aria-hidden":!0}),t("turnOverview.compaction"),o?l(Tt,{className:"size-3","aria-hidden":!0}):l(yo,{className:"size-3","aria-hidden":!0})]}),l("span",{className:"h-px min-w-2 flex-1 bg-border"})]}),o?l("div",{className:"mt-1",children:e}):null]})}var HI=pe(function({rowsStore:t,rowId:o}){let n=vw(t,o),r=AI(),a=xe(Fe),{t:s}=Me();if(n===void 0)return null;let i=NI({threadKey:a.threadKey,environmentId:a.activeThreadEnvironmentId,threadRef:a.threadRef});return l(Qr,{value:n.id,children:l("div",{className:G("relative",n.kind==="message"&&n.message.role==="user"?"pb-6":n.kind==="message"&&n.message.role==="assistant"?n.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":n.kind==="turn-summary"?"pb-2 empty:pb-0":"pb-2"),"data-timeline-row-id":n.id,"data-timeline-row-kind":n.kind,"data-message-id":n.kind==="message"?n.message.id:void 0,"data-message-role":n.kind==="message"?n.message.role:void 0,children:v(bi,{resetKey:n.id,fallback:MI,children:[n.kind==="turn-summary"?v(oe,{children:[r?.renderDeliverableTools?.({turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i}),n.cardAnchor===!0?null:l(pI,{footer:n.footer,copyText:n.copyText,timestampFormat:a.timestampFormat,identity:n.identity}),r?.renderSlot("conversation.chat.turnTail",{turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i})]}):null,n.kind==="tool-group"?l(II,{entries:n.entries,groupId:n.groupId,threadKey:a.threadKey,workspaceRoot:a.workspaceRoot,onDisclosureChange:()=>a.onProcessDisclosureChange?.(n.id)}):null,n.kind==="work"?l(OU,{row:n}):null,n.kind==="model-switch"?l(th,{row:n}):null,n.kind==="turn-identity"?l("div",{"data-turn-identity":n.turnId,role:"group","aria-label":s("timeline.answeredBy",{name:n.badge.providerDisplayName??n.badge.modelLabel}),className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:l(vi,{badge:n.badge,compact:!0})}):null,n.kind==="message"&&n.message.role==="user"?l(Ip,{row:n}):null,n.kind==="message"&&n.message.role==="assistant"?l(UT,{row:n}):null,n.kind==="proposed-plan"?l(BU,{row:n}):null,n.kind==="turn-plan"?l(HU,{row:n}):null,n.kind==="working"?l(_I,{row:n}):null,n.kind==="continuation-check"?l(bT,{row:n}):null]})})})});function OU({row:e}){let t=xe(Fe),o=Tn(),n=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:o});return e.groupedEntries.some(r=>r.sourceActivityKind==="context-compaction")?l(BI,{children:n!==void 0?n:e.groupedEntries.map(r=>l("pre",{className:"max-h-72 overflow-auto text-xs whitespace-pre-wrap",children:r.detail??r.label},r.id))}):n!==void 0?l(oe,{children:n}):l("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>l(FU,{entry:r},r.id))})}function FU({entry:e}){let t=xe(Fe),[o,n]=zt(t.threadKey,`work-fallback:${Pp(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,a=e.toolMetadata?.source==="ycodium"?e.toolTitle??e.toolLabel?.name??e.label:e.label;return v("div",{children:[v("button",{type:"button","aria-expanded":o,className:G("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>n(!o),disabled:r===void 0,children:[l("span",{"aria-hidden":!0,className:G("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")}),l("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:a}),r!==void 0?l(Tt,{"aria-hidden":!0,className:G("size-icon-1 shrink-0",!o&&"-rotate-90")}):null]}),o&&r!==void 0?l("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=xe(Fe);return l("div",{className:"min-w-0 px-1 py-0.5",children:l(EI,{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 HU=pe(function({row:t}){let o=xe(Fe),{t:n}=Me(),[r,a]=zt(o.threadKey,`turn-plan:${t.id}`,!1),{steps:s}=t.turnPlan.plan,i=s.filter(m=>m.status==="completed").length,d=i===s.length,c=s.find(m=>m.status==="inProgress")?.step??s.find(m=>m.status==="pending")?.step??s.at(-1)?.step??n("proposedPlan.badge");return v("div",{className:"min-w-0 px-1 py-0.5",children:[v("button",{type:"button",className:"relative flex w-full min-w-0 cursor-[var(--control-cursor)] items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-control-1 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:[l(r?Tt:yo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),s.length>1?l("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:s.map(m=>l("span",{className:G("h-[3px] w-2.5 rounded-full",m.status==="completed"?"bg-success":m.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},m.step))}):null,l("span",{className:G("min-w-0 truncate",d?"text-muted-foreground/65":"font-medium text-foreground/85"),children:c}),s.length>1?v("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[i,"/",s.length]}):null]}),r?l("div",{className:"mt-0.5 space-y-px pl-6",children:s.map(m=>v("div",{className:"flex items-baseline gap-2 text-ui-sm",children:[l("span",{className:G("w-3 shrink-0 text-center font-mono text-chat-meta",m.status==="completed"?"text-success":m.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:m.status==="completed"?"\u2713":m.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:G("min-w-0",m.status==="completed"?"text-muted-foreground/55":m.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:m.step})]},m.step))}):null]})});$();var UU=e=>{let{latestTurn:t,latestReplyAt:o,continuationCheck:n}=e.getMeta().status;return n!=null?null:o||(t?.state==="completed"?t.completedAt:null)},$U=e=>e.getMeta().status.latestAssistantMessageId??null,zU=e=>e.getMeta().finalAssistantMessageReceived,UI=pe(function({rowsStore:t,useVisibleThreadCompletion:o,viewport:n,viewActive:r,threadKey:a,settledView:s,bottomInset:i}){let d=Gt(t,UU),c=Gt(t,$U),u=Gt(t,zU);return o({viewport:n,viewActive:r,threadKey:a,completedAt:s&&u?d:null,messageId:c,bottomInset:i}),null});$();var KU=[];function qU(){let e=Nt().i18n.usePluginTranslation();return P(t=>{let o=t.attachment;return o===void 0?t.text:o.count===1?o.name:e("forkRelations.attachmentPreview",o)},[e])}function $I({rowsStore:e,derive:t,paneVisible:o,routeThreadKey:n}){let r=P(u=>o?GT(u,t):KU,[t,o]),a=Gt(e,r,jT),s=M(a);s.current=a;let i=$e("timeline-active-header",n,null),d=a.at(-1)??null,c=qU();return{turnHeaders:a,turnHeadersRef:s,activeTurnHeaderKeyRef:i,initialTurnHeader:d,headerLabel:c,hasTurnHeaders:d!==null,pinnedTurnHeaderRef:M(null),pinnedTurnHeaderTextRef:M(null)}}function zI({turnHeadersRef:e,activeTurnHeaderKeyRef:t,pinnedTurnHeaderRef:o,pinnedTurnHeaderTextRef:n,headerLabel:r,jumpToTurnSection:a}){let s=M(!1),i=P(()=>{let f=t.current;return f===null?void 0:e.current.find(g=>g.sectionKey===f)},[t,e]),d=P(()=>{let f=o.current;if(!f)return;let g=i();f.dataset.visible=g!==void 0&&(g.inherited||s.current)?"true":"false"},[i,o]),c=P(()=>{let f=i();f&&n.current&&(n.current.textContent=r(f)),d()},[i,d,r,n]),u=P(f=>{f===null||f===t.current||(t.current=f,c())},[t,c]),m=P(f=>{s.current=f,d()},[d]),p=P(()=>{let f=i();f&&a({anchorRowId:f.anchorRowId})},[i,a]);return{applyActiveSection:u,applyActiveStartHidden:m,jumpToActiveTurn:p,writeActiveHeader:c}}function KI({paneVisible:e,turnHeaders:t,writeActiveHeader:o}){fe(()=>{e&&o()},[e,t,o])}$();function WU(e,t,o){let n=o-t;if(Math.abs(n)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+n));return Math.abs(r-e.scrollTop)<1?null:r}function qI(e){let{viewport:t,anchor:o,row:n,scrollToOffset:r}=e,a=o.getBoundingClientRect().top,s=!0,i=null,d=()=>{if(i=null,!s||!o.isConnected||!t.contains(o))return;let m=WU(t,a,o.getBoundingClientRect().top);m!==null&&r(m),a=o.getBoundingClientRect().top},c=()=>{s&&i===null&&(i=requestAnimationFrame(d))},u=typeof ResizeObserver>"u"?null:new ResizeObserver(c);return u?.observe(n),c(),{schedule:c,stop:()=>{s=!1,u?.disconnect(),i!==null&&cancelAnimationFrame(i),i=null}}}function WI(e){return Ge("timeline-disclosure-reading",e,!1)}function GI({routeThreadKey:e,listRef:t,liveFollowEnabled:o,onDisclosureNavigation:n,rowsStore:r,setDisclosureReading:a}){let s=Jo(e,null),i=Jo(e,null),d=Jo(e,null);H(()=>()=>{i.current?.stop()},[]);let c=P(()=>{i.current?.stop(),i.current=null,s.current=null,a(!1)},[s,i,a]),u=P(f=>{n(),s.current=f,a(!0),i.current?.stop();let g=t.current?.node??null;if(!g)return;let h=Array.from(g.querySelectorAll("[data-timeline-row-id]")).find(x=>x.dataset.timelineRowId===f);if(!h)return;let y=d.current;i.current=qI({viewport:g,row:h,anchor:y&&h.contains(y)?y:h,scrollToOffset:x=>{g.scrollTop=x}})},[n]),m=$e("timeline-live-follow-previous",e,o);fe(()=>{o&&!m.current&&c(),m.current=o},[o,c]);let p=P(f=>{let g=r.getRows().find(h=>h.id===f||h.kind==="work"&&h.groupedEntries.some(y=>y.id===f)||h.kind==="tool-group"&&h.entries.some(y=>y.id===f));u(g?.id??f)},[r,u]);return{disclosureButtonRef:d,releaseDisclosureAnchor:c,onProcessDisclosureChange:p}}$();var uh=1e4;function jI({routeThreadKey:e,routeThreadKeyRef:t,pagingBlockedRef:o,pagingBlockedByInteraction:n,loadEarlier:r,loadLater:a,hasHiddenOlder:s,visibleTurnSections:i,capturePrependAnchor:d,revealWindowRef:c,pendingNetworkPrependRef:u,turnSectionsRef:m}){let p=P(()=>{d(),c.current.revealOlder()},[d]),f=M(p);f.current=p;let g=M(s);g.current=s;let h=M(null),y=P(()=>{if(o.current||t.current!==e||r===null||r.loading)return;let C=i[0]?.key;C!==void 0&&(d(C),u.current={firstMountedSectionKey:C,loadingObserved:!1,sectionsWhileLoading:m.current,until:Date.now()+uh},r.onLoadEarlier())},[d,r,u,e,i]);h.current=r===null||r.loading||n?null:y;let x=P(()=>{o.current||t.current!==e||(d(),a?.onLoadLater())},[d,a,e]);return{revealOlderTurns:p,revealOlderTurnsRef:f,hasHiddenOlderRef:g,loadEarlierRef:h,handleLoadEarlier:y,handleLoadLater:x}}$();$();var ts=3,ph=ts;function VI(e){let[t,o]=Ge("timeline-reveal-window",e,ts),n=P(()=>{o(i=>i+ph)},[o]),r=P(i=>{o(d=>i>d?i:d)},[o]),a=P(()=>{o(ts)},[o]),s=P(i=>{o(d=>Math.min(d,Math.max(ts,i)))},[o]);return{revealedCount:t,revealOlder:n,revealAtLeast:r,compactTo:s,reset:a}}$();function XI(e){return e!==null&&"tagName"in e&&"closest"in e}function rr(e){return XI(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function YI(e){return XI(e)&&e.closest('button, a[href], summary, [role="button"], [role="menuitem"]')!==null}function Ud(e,t){if(!/^[1-9]$/.test(e))return null;let o=Number(e)-1;return o<t?o:null}function QI(e,t){let o=e.findIndex(n=>n.decision===t);return o===-1?null:{type:"respond",index:o}}function JI(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return QI(t,"accept");case"Escape":return QI(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let o=Ud(e.key,t.length);return o===null?null:{type:"respond",index:o}}}}var wi="h-4 min-w-3 bg-transparent px-0 text-ui-xs tabular-nums text-current opacity-70 pointer-coarse:hidden";var $d=600;function mh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let o=e;o&&o!==t;){if(o instanceof HTMLElement&&o.scrollHeight>o.clientHeight&&o.scrollTop>0)return!0;o=o.parentElement}return!1}function ZI({routeThreadKey:e,routeThreadKeyRef:t,paneVisibleRef:o,pagingBlockedRef:n,scrollRestorePendingRef:r,listRef:a,topRevealArmedRef:s,hasHiddenOlderRef:i,revealOlderTurnsRef:d,loadEarlierRef:c,networkPrependAwaitingUserNavigationRef:u,networkPrependScrollTopRef:m,topRevealTouchStartYRef:p,topRevealUserNavigationFrameRef:f}){let g=P(C=>{if(C>$d){s.current=!0;return}if(s.current){if(s.current=!1,i.current){d.current();return}c.current?.()}},[s]),h=P(()=>{u.current&&(u.current=!1,m.current=null,s.current=!0)},[u,m,s]),y=P(()=>{if(f.current!==null||n.current||!o.current||t.current!==e||r.current)return!1;let C=a.current?.measure();return!C||C.scroll>2||C.contentLength-C.scrollLength-C.scroll<=2||!i.current&&c.current===null?!1:(u.current=!1,m.current=null,s.current=!0,f.current=requestAnimationFrame(()=>{f.current=null}),g(C.scroll),!0)},[g,u,m,e,r,s,f]);return{maybeRevealOlderOnScroll:g,rearmNetworkPrependForUserNavigation:h,continueTopRevealAtTopForUserNavigation:y,contentGestureHandlers:{onWheel:C=>{C.defaultPrevented||C.deltaY>=0||rr(C.target)||mh(C.target,a.current?.node??null)||y()},onTouchStartCapture:C=>{p.current=C.touches[0]?.clientY??null},onTouchMove:C=>{let b=C.touches[0],L=p.current;C.defaultPrevented||rr(C.target)||mh(C.target,a.current?.node??null)||b===void 0||L===null||b.clientY<=L||y()&&(p.current=null)},onTouchEndCapture:()=>{p.current=null},onTouchCancelCapture:()=>{p.current=null},onKeyDown:C=>{C.defaultPrevented||C.repeat||C.metaKey||C.ctrlKey||C.altKey||C.shiftKey||rr(C.target)||mh(C.target,a.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(C.key)||y()}}}}function eS({paneVisible:e,paneVisibleRef:t,loadLater:o,liveFollowEnabled:n,disclosureReading:r,restoreInProgress:a,loadEarlier:s,scrollNode:i,revealWindow:d,turnSections:c,followEnabledRef:u,compactionStateRef:m,compactionRef:p,prependAnchorRef:f,interactionRowsRef:g,revealWindowRef:h,topRevealArmedRef:y,capturePrependAnchor:x}){let C=e&&o===null&&n&&!r&&!a;return u.current=C,m.current={followEnabled:C,restoreInProgress:a,loadEarlier:s},H(()=>{if(!i||!e)return;let b=cw({root:i,minimumCount:ts,keepAbovePx:$d,canCompact:()=>{let L=m.current,w=f.current;return L.followEnabled&&g.current.length===0&&!L.restoreInProgress&&!L.loadEarlier?.loading&&!(w&&w.until>Date.now())&&h.current.revealedCount>ts},onCompact:L=>{y.current=!0,x(),h.current.compactTo(L)}});return p.current=b,()=>{b.disconnect(),p.current=null}},[x,e,i]),H(()=>{p.current?.schedule()},[C,s?.loading,d.revealedCount,c.length]),H(()=>{if(!i||!e||typeof ResizeObserver>"u")return;let b=()=>{if(!t.current||!u.current)return;let k=i.scrollHeight-i.clientHeight;Math.abs(i.scrollTop-k)>.5&&(i.scrollTop=k)},L=new ResizeObserver(b);L.observe(i);let w=i.firstElementChild;return w&&L.observe(w),()=>L.disconnect()},[e,i]),{followEnabled:C}}$();function tS({hasHiddenOlder:e,loadEarlier:t,pagingBlockedByInteraction:o,topFadeEnabled:n,revealOlderTurns:r,handleLoadEarlier:a}){return W(()=>e?l(iI,{onReveal:r,fade:n}):t!==null?l(aI,{loading:t.loading,blocked:o,onLoadEarlier:a,fade:n}):n?rI:nI,[a,e,t,o,r,n])}$();$();function oS(e,t,o){let n=$e("timeline-last-requested-reveal",e,o);return fe(()=>{n.current=o}),t&&o>=n.current}function nS(e,t,o,n){if(t<e.revealedCount)e.compactTo(t);else{if(t<=e.revealedCount)return;o?requestAnimationFrame(()=>setTimeout(()=>{n()&&e.revealAtLeast(t)},0)):e.revealAtLeast(t)}}function rS(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"}var GU=new Set;function aS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,scrollSnapshotRef:a,structure:s,loadLater:i,loadEarlier:d,liveFollowEnabled:c,disclosureReading:u,nativeSelectionRef:m,interactionRowsRef:p}){let f=s.sections,g=VI(e),h=M(g);h.current=g;let y=$e("timeline-top-reveal-armed",e,!0),x=$e("timeline-network-prepend-awaiting-navigation",e,!1),C=M(null),b=M(null);fe(()=>()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null)},[e,o]);let L=$e("timeline-network-prepend-scroll-top",e,null),w=$e("timeline-mounted-section-keys",e,GU,3),k=Jo(e,null),I=k.current,T=I===null?-1:f.findIndex(F=>F.key===I.firstMountedSectionKey),S=T>0?f.length-Math.max(0,T-ph):g.revealedCount,R=T>0?S:g.revealedCount,A=i!==null||!c||u||m.current||p.current.length>0,N=oS(e,c,R),B=aw(f.map(F=>F.key),w.current,R,A||N),{startIndex:O,hasHiddenOlder:V}=hw(f.length,B),U=W(()=>f.slice(O),[O,f]),D=I!==null&&T>0&&O<T,X=M(f);X.current=f,fe(()=>{if(!o)return;if(w.current=new Set(U.map(Z=>Z.key)),I!==null){let Z=rS(I,{prefixMounted:D,loading:d===null?null:d.loading,sections:f,now:Date.now()});Z!=="waiting"&&(k.current=null),Z==="mounted"&&(x.current=!0)}let F=e;nS(h.current,B,!A,()=>t.current===F)},[x,d,o,I,D,k,w,A,B,e,f,U]);let j=Jo(e,null),E=P((F=null)=>{if(!n.current)return;let Z=r.current?.node;Z&&(j.current={scrollHeight:Z.scrollHeight,scrollTop:Z.scrollTop,row:r.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:F,until:Date.now()+uh})},[j]),Y=P(()=>{let F=j.current;if(F===null||F.firstMountedSectionKey===null||Date.now()>F.until)return;let Z=r.current?.node;if(!Z)return;let J=a.current;F.scrollHeight=Z.scrollHeight,F.scrollTop=Z.scrollTop,F.row=J?.threadKey===e?J.anchor:null},[j,e,a]);return fe(()=>{if(!o)return;let F=j.current;if(!F)return;if(Date.now()>F.until){j.current=null;return}if(F.firstMountedSectionKey!==null&&k.current!==null)return;j.current=null;let Z=r.current?.node;if(Z){if(F.row){Sp(Z,F.row.rowId);let J=r.current?.measure()?.topOf(F.row.rowId);J!=null&&(Z.scrollTop=J+F.row.offsetPx)}else Z.scrollTop=F.scrollTop+(Z.scrollHeight-F.scrollHeight);D&&(L.current=Z.scrollTop)}},[L,o,I,D,O,s]),{revealWindow:g,revealWindowRef:h,topRevealArmedRef:y,networkPrependAwaitingUserNavigationRef:x,topRevealTouchStartYRef:C,topRevealUserNavigationFrameRef:b,networkPrependScrollTopRef:L,pendingNetworkPrependRef:k,hasHiddenOlder:V,visibleTurnSections:U,turnSectionsRef:X,prependAnchorRef:j,capturePrependAnchor:E,refreshPendingPrependAnchor:Y}}$();function jU(e,t){let o=c=>c.replace(/\s+/g,""),n=o(t.text);if(n.length===0)return null;let r=(c,u)=>e.slice(Math.max(0,c-t.prefix.length),c)===t.prefix&&e.slice(u,u+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&o(e.slice(t.start,t.end))===n&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Sd(t.text).trim(),s=[];for(let c=e.indexOf(a);c>=0;c=e.indexOf(a,c+1))s.push(c);let i=s.filter(c=>r(c,c+a.length)),d=i.length===1?i[0]:i.length===0&&s.length===1?s[0]:null;return d===null?null:{start:d,end:d+a.length}}function iS(e,t){let o=e.querySelector("[data-assistant-quote-body]")??Ju(e);if(o===null)return null;let n=[],r="",a=document.createTreeWalker(o,NodeFilter.SHOW_TEXT);for(let u=a.nextNode();u;u=a.nextNode()){let m=u.data;for(let p=0;p<m.length;p+=1){let f=/\s/.test(m[p]);f&&r.endsWith(" ")||(r+=f?" ":m[p],n.push({node:u,offset:p}))}}let s=jU(r,t);if(s===null)return null;let i=n[s.start],d=n[s.end-1];if(!i||!d)return null;let c=document.createRange();return c.setStart(i.node,i.offset),c.setEnd(d.node,d.offset+1),c}var fh="assistant-quote",sS=2400;function lS(e){let t=globalThis.CSS?.highlights,o=globalThis.Highlight;if(t&&o){let r=new o(e);t.set(fh,r),setTimeout(()=>{t.get(fh)===r&&t.delete(fh)},sS);return}let n=document.getSelection();n&&(n.removeAllRanges(),n.addRange(e),setTimeout(()=>{let r=n.rangeCount>0?n.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&n.removeAllRanges()},sS))}var VU=20;function dS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,derive:n,rowsStore:r,structure:a,loadEarlier:s,loadEarlierRef:i,listRef:d,revealWindowRef:c,turnSectionsRef:u,scrollToRowWithRevealRef:m,onManualNavigation:p,releaseDisclosureAnchor:f,revealMessageRequest:g,onRevealMessageHandled:h,revealQuoteRequest:y,onRevealQuoteDone:x,messageReveal:C=null,onMessageRevealMissing:b,loadLater:L=null,onReturnToLatest:w,restoringHistory:k=!1,pagingBlockedByInteraction:I=!1,revealTurnRequest:T}){let S=M(!0);H(()=>(S.current=!0,()=>{S.current=!1}),[]);let R=M(o);R.current=o;let A=M(C?.request?.id??null);A.current=C?.request?.id??null;let N=M(null);H(()=>{let U=C?.request;if(!U||!C||!o)return;N.current?.id!==U.id&&(N.current={id:U.id,prepared:!1,latestRequested:!1,done:!1});let D=N.current;if(D.done)return;let j=r.getRows().some(Y=>Y.id===U.messageId);if(!D.prepared){if(C.pending||k||s?.loading||L?.loading||I)return;if(!j&&L!==null&&!C.unavailable){D.latestRequested||(D.latestRequested=!0,w?.());return}D.prepared=!0}let E=C.advance({found:j,ready:!C.pending&&!k,loading:s?.loading===!0,blocked:I,hasEarlier:!C.unavailable&&s!==null,windowKey:a.rowIds[0]??"empty"});if(E!=="wait"){if(f(),p(),E==="earlier"){i.current?.();return}if(D.done=!0,E==="missing"){b?.(),C.onHandled(U.id);return}c.current.revealAtLeast(Za(u.current,U.messageId,c.current.revealedCount)),requestAnimationFrame(()=>{if(S.current&&!(t.current!==e||N.current!==D)){if(!R.current||A.current!==U.id){D.done=!1;return}m.current(U.messageId,24),C.onHandled(U.id)}})}},[C,o,a,s,L,k,I,w,r,e,p,f,b]);let B=P(U=>{f(),p(),c.current.revealAtLeast(Za(u.current,U.anchorRowId,c.current.revealedCount));let D=e;requestAnimationFrame(()=>{t.current===D&&m.current(U.anchorRowId,24)})},[p,f,e]),O=M(void 0);H(()=>{if(!o||!T||O.current===T)return;let D=a.sections.find(X=>X.turnId===T.turnId)?.rowIds[0];D&&(O.current=T,B({anchorRowId:D}),T.onHandled?.())},[o,T,a,B]),H(()=>{if(g===null||!o)return;f(),p();let U=n.resolveToolGroupRevealRowId(r.getRows(),g.rowId);c.current.revealAtLeast(Za(u.current,U,c.current.revealedCount));let D=requestAnimationFrame(()=>{t.current===e&&(m.current(U,24),h?.())});return()=>cancelAnimationFrame(D)},[g,o,p,f,h,n,e,r]);let V=M(null);return H(()=>{if(y===null||!o)return;let U=V.current;if((U===null||U.request!==y)&&(U={request:y,pages:0,done:!1},V.current=U),U.done)return;let{quote:D}=y,X=D.messageId;if(!r.getRows().some(j=>j.id===X)){if(s?.loading)return;let j=i.current;if(j!==null&&U.pages<VU){U.pages+=1,j();return}U.done=!0,x?.("message-missing");return}U.done=!0,f(),p(),c.current.revealAtLeast(Za(u.current,X,c.current.revealedCount)),requestAnimationFrame(()=>{t.current===e&&(m.current(X,24),requestAnimationFrame(()=>{let j=d.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(X)}"]`),E=j?iS(j,D):null,Y=d.current?.node;if(E&&Y){let F=E.getBoundingClientRect().top-Y.getBoundingClientRect().top-Y.clientHeight/3;d.current?.scrollToOffset(Y.scrollTop+F)}E&&lS(E),x?.(E?"found":"passage-missing")}))})},[y,o,a,s,r,x,p,f,e]),{jumpToTurnSection:B}}$();function cS({timestampFormat:e,routeThreadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,environmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:R,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:V,SessionMessageCard:U}){let D=W(()=>gp(s),[s]);return W(()=>({timestampFormat:e,threadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,skillIndex:D,activeThreadEnvironmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:R,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:V,SessionMessageCard:U}),[e,t,o,n,r,a,s,D,i,d,c,u,m,p,f,g,h,y,x,C,b,L,w,k,I,T,S,R,A,N,B,O,V,U])}$();var QU=200;function uS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,derive:a,contentInsetEndAdjustment:s,onIsAtEndChange:i,loadLater:d,restoreInProgress:c,rowCount:u,followingEndRef:m,scrollRestorePendingRef:p,laterLoadArmedRef:f,pagingBlockedRef:g,lastScrollAnchorSaveAtRef:h,networkPrependAwaitingUserNavigationRef:y,networkPrependScrollTopRef:x,cacheScrollSnapshot:C,persistScrollSnapshot:b,refreshPendingPrependAnchor:L,maybeRevealOlderOnScroll:w,rearmNetworkPrependForUserNavigation:k,handleLoadLater:I}){let T=P(()=>{if(!n.current||t.current!==e)return;let S=r.current?.measure();if(!S||p.current)return;C(S);let R=x.current;y.current&&R!==null&&Math.abs(S.scroll-R)>.5&&k(),L();let A=a.resolveIsAtEnd({contentLength:S.contentLength,scroll:S.scroll,scrollLength:S.scrollLength},s);A!==void 0&&i(d===null&&A);let N=S.contentLength-S.scrollLength-S.scroll;!m.current&&N>2&&w(S.scroll),N>$d?f.current=!0:f.current&&d&&!d.loading&&!g.current&&(f.current=!1,I());let B=Date.now();B-h.current>=QU&&(h.current=B,b())},[C,s,a,w,i,b,L,e,d,f,I,y,x,k,p]);return H(()=>{if(!o)return;let S=requestAnimationFrame(T);return()=>cancelAnimationFrame(S)},[T,o,c,u]),{handleScroll:T}}$();function pS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,revealRequestRef:r,listRef:a,scrollSnapshotRef:s,rowCount:i,structure:d,loadScrollAnchor:c,loadLater:u,restoringHistory:m,onManualNavigation:p,onIsAtEndChange:f,revealWindowRef:g,turnSectionsRef:h,followingEndRef:y,followEnabledRef:x,compactionStateRef:C,scrollRestorePendingRef:b,persistScrollSnapshot:L,captureFinalScrollSnapshot:w}){let k=$e("timeline-scroll-restore",e,"cold");if(k.current===void 0||k.current==="cold"){let O=c(e);k.current=k.current==="cold"&&O===null?null:{anchor:O}}let[,I]=_a(O=>O+1,0),T=M(()=>{}),S=M(w);S.current=w;let R=$e("timeline-last-anchor-save",e,0),A=m||k.current!==null,N=k.current;b.current=A,fe(()=>{if(o)return()=>{t.current!==e?L():w(),k.current=void 0}},[o,e]),fe(()=>{if(!o||N==null)return;let O=N,V=()=>{let Y=s.current,F=a.current?.node?.clientWidth;Y?.threadKey===e&&F!==void 0&&(s.current={...Y,viewportWidth:F}),k.current=null,b.current=!1,I()};if(r.current!==null){V();return}let U=null,D=null,X=()=>{!n.current||t.current!==e||(a.current?.scrollToEnd(),V(),y.current=u===null,x.current=u===null,C.current={...C.current,followEnabled:!0,restoreInProgress:!1},f(u===null))},j=O.anchor,E=j!==null&&h.current.some(Y=>Y.rowIds.includes(j.rowId));return j===null?U=requestAnimationFrame(X):E?U=requestAnimationFrame(()=>{!n.current||t.current!==e||(p(),g.current.revealAtLeast(Za(h.current,j.rowId,g.current.revealedCount)),D=requestAnimationFrame(()=>{!n.current||t.current!==e||(T.current(j.rowId,-j.offsetPx),V())}))}):i>0&&!m&&(U=requestAnimationFrame(X)),()=>{U!==null&&cancelAnimationFrame(U),D!==null&&cancelAnimationFrame(D)}},[c,u,f,p,o,N,e,i,m,d]),fe(()=>{if(!o||typeof ResizeObserver>"u")return;let O=a.current?.node;if(!O)return;let V=!0,U=O.clientWidth,D=new ResizeObserver(()=>{if(!V||!n.current||t.current!==e)return;let X=O.clientWidth;if(!(X>0)||X===U)return;U=X;let j=s.current;j===null||j.threadKey!==e||(s.current={...j,viewportWidth:X},!(b.current||y.current||j.anchor===null)&&(T.current(j.anchor.rowId,-j.anchor.offsetPx),S.current()))});return D.observe(O),()=>{V=!1,D.disconnect()}},[o,e]);let B=P((O,V)=>{if(!n.current)return;let U=a.current?.node;U&&(Sp(U,O),a.current?.scrollToRow(O,{viewOffset:V}))},[]);return T.current=B,{restoreInProgress:A,lastScrollAnchorSaveAtRef:R,scrollToRowWithRevealRef:T}}$();function mS({routeThreadKey:e,listRef:t,followingEndRef:o,scrollRestorePendingRef:n,paneVisible:r,rowCount:a,derive:s,contentInsetEndAdjustment:i,saveScrollAnchor:d}){let c=$e("timeline-scroll-snapshot",e,null),u=$e("timeline-last-measured-scroll",e,null),m=P((g,h=o.current)=>{if(g.scrollLength<=0)return;let y=t.current?.node?.clientWidth,x=c.current;y!==void 0&&y>0&&x?.viewportWidth!==void 0&&x.viewportWidth>0&&y!==x.viewportWidth||(u.current=g.scroll,c.current={threadKey:e,anchor:eI({measurement:g,followingEnd:h}),...y===void 0?{}:{viewportWidth:y}})},[o,u,t,e,c]),p=P(()=>{let g=c.current;g&&d(g.threadKey,g.anchor)},[d,c]),f=P(()=>{if(!r||n.current)return;if(a===0){p();return}let g=t.current?.measure();if(g&&g.scrollLength>0){let h=u.current,y=h!==null&&Math.abs(g.scroll-h)>.5;m(g,o.current&&!(y&&s.resolveIsAtEnd(g,i)===!1)),p()}},[m,i,s,o,u,r,p,n,a]);return{scrollSnapshotRef:c,cacheScrollSnapshot:m,persistScrollSnapshot:p,captureFinalScrollSnapshot:f}}var gh="ycodium-select-all-copy";$();function XU(e,t){let o=e.detail;o===null||typeof o!="object"||!("text"in o)||(o.text=t)}function YU(e,t){let o=n=>{XU(n,t())};return e.addEventListener(gh,o),()=>e.removeEventListener(gh,o)}function fS({rowsStore:e}){let t=M(e);t.current=e;let o=M(null);return H(()=>{let n=o.current?.closest("[data-select-all-scope]");if(n!=null)return YU(n,()=>t.current.getMeta().exportApi.markdown())},[]),l("span",{ref:o,hidden:!0})}var gS=[],hS=()=>{},yS=()=>{};var vS=pe(function({derive:t,rowsStore:o,data:n,target:r,threadKey:a,threadRef:s,environmentId:i,onInterrupt:d=null,stopping:c=!1,onRespondToDecision:u=null,onCancelScheduledWake:m=null,agentPanelModel:p,onOpenAgents:f=hS,onOpenFileDiff:g,onForkFromUserMessage:h,onRestoreUnsentMessage:y=null,selfUserId:x=null,ownsUnsignedMessages:C=!0,onImageExpand:b,onAttachmentDocumentOpen:L,revealTurnRequest:w,markdownCwd:k,resolvedTheme:I,timestampFormat:T,workspaceRoot:S,skills:R=gS,onRowsChange:A,contentInsetEndAdjustment:N,liveFollowEnabled:B,awaitingUserDecision:O=!1,onIsAtEndChange:V,onManualNavigation:U,onDisclosureNavigation:D=U,topFadeEnabled:X=!1,scrollerRef:j,loadEarlier:E=null,loadLater:Y=null,restoringHistory:F=!1,pagingBlockedByInteraction:Z=!1,onReturnToLatest:J=null,onVisibleTurnRangeChange:ne=null,revealMessageRequest:te=null,messageReveal:le=null,onMessageRevealMissing:ge,onRevealMessageHandled:re,revealQuoteRequest:ee=null,onRevealQuoteDone:ve,renderWorkGroup:he,renderToolCallDetail:Ne,loadScrollAnchor:De,saveScrollAnchor:je,useVisibleThreadCompletion:nt,onSavePlanToWorkspace:me,paneActive:Ae,onTurnNavigatorChange:ue,declaredToolTitles:ce,threadSwitchStage:Ze=null}){let pt=Gt(o,dI),ze=Tn(),et=M(ze);et.current=ze;let Et=M(te);Et.current=te;let[ft,Ct]=WI(a),gt=M(a);gt.current=a;let _t=M(Z);_t.current=Z;let Mt=$e("timeline-following-end",a,!0);Mt.current=Y===null&&B;let se=$e("timeline-scroll-restore-pending",a,!1),Le=$e("timeline-content-inset",a,N),be=M(null),Ye=Jo(a,[]),xt=Jo(a,!1),tt=M(null),It=M(null),po=P(()=>Ye.current,[Ye]),jo=P(ht=>{Ye.current=ht,tt.current?.(),It.current?.schedule()},[Ye]),Xt=P(ht=>{xt.current=ht,It.current?.schedule()},[xt]),xn=P(ht=>{ht!==null&&(be.current=ht),j(ht)},[j]);fe(()=>{JT({timeline:be.current,previousOverlayHeight:Le.current,overlayHeight:N,followingEnd:ze&&Y===null&&B&&!ft}),Le.current=N},[N,ft,B,Y,ze]);let{disclosureButtonRef:At,releaseDisclosureAnchor:St,onProcessDisclosureChange:bt}=GI({routeThreadKey:a,listRef:be,liveFollowEnabled:B,onDisclosureNavigation:D,rowsStore:o,setDisclosureReading:Ct}),mo=cI(Y!==null,ze),kt=rp(o),Ot=kt.sections,Yt=kt.rowIds.length,rt=W(()=>di(o),[kt,o]),{scrollSnapshotRef:dt,cacheScrollSnapshot:Ht,persistScrollSnapshot:Ut,captureFinalScrollSnapshot:Jt}=mS({routeThreadKey:a,listRef:be,followingEndRef:Mt,scrollRestorePendingRef:se,paneVisible:ze,rowCount:Yt,derive:t,contentInsetEndAdjustment:N,saveScrollAnchor:je}),{revealWindow:Vo,revealWindowRef:fo,topRevealArmedRef:go,networkPrependAwaitingUserNavigationRef:Zt,topRevealTouchStartYRef:Kn,topRevealUserNavigationFrameRef:Ce,networkPrependScrollTopRef:Ue,pendingNetworkPrependRef:at,hasHiddenOlder:Lt,visibleTurnSections:wt,turnSectionsRef:Ft,prependAnchorRef:Mo,capturePrependAnchor:sn,refreshPendingPrependAnchor:Hr}=aS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,scrollSnapshotRef:dt,structure:kt,loadLater:Y,loadEarlier:E,liveFollowEnabled:B,disclosureReading:ft,nativeSelectionRef:xt,interactionRowsRef:Ye}),{revealOlderTurns:Pa,revealOlderTurnsRef:Fs,hasHiddenOlderRef:fg,loadEarlierRef:lu,handleLoadEarlier:gg,handleLoadLater:du}=jI({routeThreadKey:a,routeThreadKeyRef:gt,pagingBlockedRef:_t,pagingBlockedByInteraction:Z,loadEarlier:E,loadLater:Y,hasHiddenOlder:Lt,visibleTurnSections:wt,capturePrependAnchor:sn,revealWindowRef:fo,pendingNetworkPrependRef:at,turnSectionsRef:Ft}),Tl=M(!1),Il=M({followEnabled:!1,restoreInProgress:!1,loadEarlier:E}),{restoreInProgress:bn,lastScrollAnchorSaveAtRef:hg,scrollToRowWithRevealRef:Sl}=pS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,revealRequestRef:Et,listRef:be,scrollSnapshotRef:dt,rowCount:Yt,structure:kt,loadScrollAnchor:De,loadLater:Y,restoringHistory:F,onManualNavigation:U,onIsAtEndChange:V,revealWindowRef:fo,turnSectionsRef:Ft,followingEndRef:Mt,followEnabledRef:Tl,compactionStateRef:Il,scrollRestorePendingRef:se,persistScrollSnapshot:Ut,captureFinalScrollSnapshot:Jt}),{jumpToTurnSection:kl}=dS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,derive:t,rowsStore:o,structure:kt,loadEarlier:E,loadEarlierRef:lu,listRef:be,revealWindowRef:fo,turnSectionsRef:Ft,scrollToRowWithRevealRef:Sl,onManualNavigation:U,releaseDisclosureAnchor:St,revealMessageRequest:te,messageReveal:le,onMessageRevealMissing:ge,loadLater:Y,onReturnToLatest:J,restoringHistory:bn||Ze!==null,pagingBlockedByInteraction:Z,onRevealMessageHandled:re,revealQuoteRequest:ee,onRevealQuoteDone:ve,revealTurnRequest:w}),{turnHeaders:cu,turnHeadersRef:yg,activeTurnHeaderKeyRef:uu,initialTurnHeader:pu,headerLabel:mu,hasTurnHeaders:vg,pinnedTurnHeaderRef:Ll,pinnedTurnHeaderTextRef:qn}=$I({rowsStore:o,derive:t,paneVisible:ze,routeThreadKey:a}),[fu,Bs]=q(null),[Rl,Hs]=q(null),{followEnabled:Cg}=eS({paneVisible:ze,paneVisibleRef:et,loadLater:Y,liveFollowEnabled:B,disclosureReading:ft,restoreInProgress:bn,loadEarlier:E,scrollNode:Rl,revealWindow:Vo,turnSections:Ot,followEnabledRef:Tl,compactionStateRef:Il,compactionRef:It,prependAnchorRef:Mo,interactionRowsRef:Ye,revealWindowRef:fo,topRevealArmedRef:go,capturePrependAnchor:sn}),gu=kt.rowIds.at(-1)??null;H(()=>{A?.(gu)},[gu,A,a]);let Pl=$e("timeline-later-load-armed",a,!0),{maybeRevealOlderOnScroll:El,rearmNetworkPrependForUserNavigation:hu,continueTopRevealAtTopForUserNavigation:yu,contentGestureHandlers:xg}=ZI({routeThreadKey:a,routeThreadKeyRef:gt,paneVisibleRef:et,pagingBlockedRef:_t,scrollRestorePendingRef:se,listRef:be,topRevealArmedRef:go,hasHiddenOlderRef:fg,revealOlderTurnsRef:Fs,loadEarlierRef:lu,networkPrependAwaitingUserNavigationRef:Zt,networkPrependScrollTopRef:Ue,topRevealTouchStartYRef:Kn,topRevealUserNavigationFrameRef:Ce}),{applyActiveSection:vu,applyActiveStartHidden:Us,jumpToActiveTurn:Cu,writeActiveHeader:xu}=zI({turnHeadersRef:yg,activeTurnHeaderKeyRef:uu,pinnedTurnHeaderRef:Ll,pinnedTurnHeaderTextRef:qn,headerLabel:mu,jumpToTurnSection:kl}),Ea=uw({root:Rl,topInsetPx:oh,onActiveSectionChange:vu,onActiveStartHiddenChange:Us,active:ze}),Ma=W(()=>rw(Ot),[Ot]),bg=lw({root:Rl,inputKey:a,visible:ze,index:Ma,topInset:vg?oh:0,bottomInset:N,interactionRows:po,onRangeChange:ne,onSelectionChange:Xt});tt.current=bg,H(()=>{if(!ze){Ut();return}let ht=requestAnimationFrame(()=>{if(!et.current)return;let zs=be.current?.node;zs&&Tl.current&&(zs.scrollTop=zs.scrollHeight-zs.clientHeight),Ea.refresh()});return()=>cancelAnimationFrame(ht)},[Ut,Ea,ze]),KI({paneVisible:ze,turnHeaders:cu,writeActiveHeader:xu});let $s=tS({hasHiddenOlder:Lt,loadEarlier:E,pagingBlockedByInteraction:Z,topFadeEnabled:X,revealOlderTurns:Pa,handleLoadEarlier:gg}),{handleScroll:bu}=uS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,derive:t,contentInsetEndAdjustment:N,onIsAtEndChange:V,loadLater:Y,restoreInProgress:bn,rowCount:Yt,followingEndRef:Mt,scrollRestorePendingRef:se,laterLoadArmedRef:Pl,pagingBlockedRef:_t,lastScrollAnchorSaveAtRef:hg,networkPrependAwaitingUserNavigationRef:Zt,networkPrependScrollTopRef:Ue,cacheScrollSnapshot:Ht,persistScrollSnapshot:Ut,refreshPendingPrependAnchor:Hr,maybeRevealOlderOnScroll:El,rearmNetworkPrependForUserNavigation:hu,handleLoadLater:du}),wu=n.useToolPresentation??yS,Aa=cS({timestampFormat:T,routeThreadKey:a,threadRef:s,markdownCwd:k,resolvedTheme:I,workspaceRoot:S,skills:R,environmentId:i,onForkFromUserMessage:h,onRestoreUnsentMessage:y,selfUserId:x,ownsUnsignedMessages:C,onImageExpand:b,onAttachmentDocumentOpen:L,onOpenFileDiff:g,onProcessDisclosureChange:bt,agentPanelModel:p,onOpenAgents:f,onInterrupt:d,stopping:c,onRespondToDecision:u,scheduledWakes:pt,onCancelScheduledWake:m,derive:t,SiteIcon:n.SiteIcon,toolPresentation:wu(r),ToolSourceIcon:n.ToolSourceIcon,SessionMessageCard:n.SessionMessageCard,threadReferences:n.threadReferences,renderWorkGroup:he,renderToolCallDetail:Ne,onSavePlanToWorkspace:me,declaredToolTitles:ce}),wg=P(ht=>l(HI,{rowsStore:o,rowId:ht}),[o]);return l(Ow,{data:n,target:r,children:l(Fe,{value:Aa,children:v(tI,{rowsStore:o,historyWindow:mo,children:[l(XT,{rowsStore:o,derive:t,paneVisible:ze,bottomInset:N,onSelect:kl,onTurnNavigatorChange:ue}),l(UI,{rowsStore:o,useVisibleThreadCompletion:nt,viewport:fu,viewActive:Ae&&ze,threadKey:a,settledView:Y===null&&!bn,bottomInset:N}),v("div",{ref:Bs,onClickCapture:ht=>{At.current=ht.target instanceof Element?ht.target.closest("button"):null},onWheelCapture:St,onTouchMoveCapture:St,onPointerDownCapture:ht=>{ht.target===be.current?.node&&(St(),yu())},onKeyDownCapture:ht=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(ht.key)&&St()},className:"chat-timeline relative h-full min-h-0",inert:Ze!==null,"aria-busy":Ze!==null?!0:void 0,"data-timeline-switch-hold":Ze??void 0,"data-awaiting-user-decision":O?"true":"false","data-disclosure-reading":ft?"true":void 0,"data-timeline-follow-end":Cg?"true":"false","data-timeline-end-inset":N,children:[l(iw,{inputKey:a,onBeforeInputChange:Jt,handleRef:xn,onAttach:Hs,onInteractionRowsChange:jo,onScroll:bu,className:G("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",X&&"topbar-scroll-fade"),children:v("div",{"data-select-all-scope":"",style:{paddingBottom:N},...xg,children:[l(fS,{rowsStore:o}),$s,wt.map(ht=>l(dw,{sectionKey:ht.key,rowKeyPrefix:a,rowIds:ht.rowIds,renderRow:wg,sectionRef:Ea.observeSection(ht.key)},`${a}:${ht.key}`)),Y?l(sI,{loading:Y.loading,blocked:Z,onLoadLater:du,onReturnToLatest:J}):null,lI]})}),Ze==="covered"?l(rh,{}):rt?null:l(oI,{data:n,target:r}),pu!==null?l(HT,{ref:Ll,textRef:qn,initialText:mu(pu),onJump:Cu}):null]})]})})})});$();function CS(e){let[t,o]=q(null),n=M(null),r=t!==null&&t.toKey===e.threadKey?t:null;if(r===null&&!di(e.rowsStore)){let c=n.current;t!==null&&t.stage==="covered"?r={toKey:e.threadKey,stage:"covered"}:c!==null&&c.threadKey!==e.threadKey&&di(c.rowsStore)&&(r={toKey:e.threadKey,stage:"held",props:c})}r!==t&&o(r);let a=r!==null&&r.stage==="held"?r:null,s=a===null?e:a.props;fe(()=>{n.current=s});let i=P(()=>o(c=>c===null||c.stage!=="held"?c:{toKey:c.toKey,stage:"covered"}),[]),d=P(()=>o(c=>c===null||c.stage==="released"?c:{toKey:c.toKey,stage:"released"}),[]);return{props:s,stage:r===null||r.stage==="released"?null:r.stage,onSkeleton:i,onRelease:d}}function xS(e){let{onSkeleton:t,onRelease:o}=e,n=e.data.useThreadSyncPhase(e.target);rp(e.rowsStore);let r=n!=="loading"||di(e.rowsStore);return fe(()=>{r&&o()},[r,o]),H(()=>{if(r)return;let a=globalThis.setTimeout(t,Lp);return()=>globalThis.clearTimeout(a)},[r,t]),null}$();var JU=new Set;function bS({data:e,target:t,threadKey:o,visible:n,rowsStore:r,derive:a,resolveModelBadge:s,disclosure:i,historyWindow:d}){let c=e.useChatTimeline({target:t,threadKey:o,visible:n}),u=e.useTurnStatus({target:t,threadKey:o,visible:n}),m=Tn(),p=i.usePersistedExpandedTurnIds(o),[f,g]=Ge("timeline-auto-expanded-turns",o,JU),h=W(()=>a.resolveExpandedTurnIds(p??[],f),[f,a,p]),{latestTurn:y}=u,x=$e("timeline-latest-turn-previous",o,y);H(()=>{let b=x.current;if(x.current=y,!(!y||b?.turnId===void 0)){if(y.turnId===b.turnId){b.state==="running"&&y.state==="interrupted"&&g(L=>{let w=new Set(L);return w.add(y.turnId),w});return}g(L=>{if(!L.has(b.turnId))return L;let w=new Set(L);return w.delete(b.turnId),w})}},[y]);let C=W(()=>({derive:a,timelineEntries:c.timelineEntries,activities:c.activities,turnSummaries:c.turnSummaries,status:u,expandedTurnIds:h,resolveModelBadge:s,historyWindow:d,usageByTurnId:c.usageByTurnId,exportApi:c.export}),[c.activities,c.export,c.timelineEntries,c.turnSummaries,c.usageByTurnId,a,h,d,s,u]);return(m||!r.hasInputs())&&r.setInputs(C),fe(()=>{r.flush()}),null}var wS=pe(function({data:t,target:o,threadKey:n,visible:r,...a}){let s=$e("timeline-rows-store",n,null,3);s.current??=yw();let i=s.current,d=CS({...a,threadKey:n,rowsStore:i,data:t,target:o});return v(oe,{children:[l(bS,{data:t,target:o,threadKey:n,visible:r,rowsStore:i,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),l(vS,{...d.props,threadSwitchStage:d.stage}),d.stage===null?null:l(xS,{data:t,target:o,rowsStore:i,onSkeleton:d.onSkeleton,onRelease:d.onRelease},n)]})});function TS({phase:e}){let{t}=z(),o=t(kp(e));return v("div",{"aria-label":o,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:[l(Gr,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),l("span",{className:"truncate",children:o})]})}function IS({data:e,target:t,bottomInset:o,showScrollToEnd:n,onScrollToEnd:r}){let{t:a}=z(),s=Rp(e.useThreadSyncPhase(t));return s===null&&!n?null:v("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:o+4},children:[s!==null?l(TS,{phase:s}):null,n?v(K,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[l(Tt,{}),a("timeline.scrollToEnd")]}):null]})}$();function SS(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function kS(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var ZU=150,e$=16;function LS(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function RS({inputKey:e,visible:t,endInset:o,derive:n,onReturnToLatest:r,controlRef:a}){let[s,i]=Ge("timeline-live-follow-enabled",e,!0),[d,c]=Ge("timeline-show-scroll-to-end",e,!1),u=Jo(e,null),[m,p]=Yb(e,null),f=P(F=>{u.current=F;let Z=F?.node??null;p(J=>J===Z?J:Z)},[u,p]),g=$e("timeline-is-at-end",e,!0),h=Jo(e,null),y=P(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),x=P(()=>{y(),h.current=setTimeout(()=>{h.current=null,c(!0)},ZU)},[y,c,h]);H(()=>y,[y]);let C=P(()=>{let F=u.current?.measure();return F==null?void 0:{contentLength:F.contentLength,scroll:F.scroll,scrollLength:F.scrollLength}},[u]),b=$e("timeline-scroll-mode",e,"following-end"),L=oa(t);fe(()=>()=>L.cancel(),[L,e]);let w=$e("timeline-user-scroll-generation",e,0),k=$e("timeline-live-follow-generation",e,0),I=$e("timeline-disclosure-reading-lock",e,SS),T=$e("timeline-last-row-id",e,null),S=P(()=>{L.cancel(),w.current+=1,b.current="free-scrolling",k.current=null,i(!1)},[L,k,b,i,w]),R=P(()=>{I.current.lock(),S(),g.current=!1,y(),c(!0)},[y,g,S,I,c]),A=M(S);A.current=S;let N=P(()=>{let F=u.current?.measure(),Z=T.current;if(!F||Z===null)return!1;let J=ZT(F,Z);return J===null?!1:J>Math.max(0,F.scrollLength-o-e$)},[o,u,T]),B=P(F=>{I.current.resume();let Z=++w.current;g.current=!0,b.current="following-end",k.current=w.current,i(!0),y(),c(!1),L.request(()=>{kS({requestedGeneration:Z,currentGeneration:w.current,mode:b.current,readingLocked:I.current.isLocked()})&&u.current?.scrollToEnd({animated:F})})},[y,L,u,g,k,I,b,i,c,w]),O=M(r);O.current=r;let V=P((F=!1)=>{let Z=O.current;if(Z){Z(()=>B(F));return}B(F)},[B]),U=P(()=>V(!0),[V]),D=P(()=>{I.current.navigate(!0)&&(g.current=!1,n.resolveIsAtEnd(C(),o)===!0&&V())},[n,o,g,C,I,V]);H(()=>{if(!t||m===null)return;let F=null,Z=requestAnimationFrame(()=>{let J=()=>{A.current()},ne=ue=>{let ce=ue instanceof Element?ue:null;for(;ce&&ce!==m;){if(ce instanceof HTMLElement&&ce.scrollHeight>ce.clientHeight+1&&ce.scrollTop+ce.clientHeight<ce.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(ce).overflowY))return!1;ce=ce.parentElement}return ce===m},te=ue=>{I.current.isLocked()&&ne(ue)&&D()},le=null,ge=!1,re=m.scrollTop,ee=ue=>{le=ue.touches[0]?.clientY??null},ve=()=>{le=null,ge=!1},he=()=>{let ue=m.scrollTop;ge&&ue>re&&te(m),re=ue},Ne=()=>N(),De=()=>n.resolveIsAtEnd(C(),o)===!1,je=ue=>{ue.deltaY>0&&te(ue.target),ue.deltaY<0&&Ne()&&J()},nt=ue=>{let ce=ue.touches[0]?.clientY??null,Ze=le!==null&&ce!==null&&ce<le;le=ce,De()&&J(),Ze&&te(ue.target)},me=ue=>{if(ue.target===m){ge=!0,re=m.scrollTop,Ne()&&J();return}De()&&J()},Ae=ue=>{if(!(ue.target instanceof Element?ue.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ue.key){case"PageUp":case"Home":case"ArrowUp":Ne()&&J();break;case"PageDown":case"End":case"ArrowDown":te(ue.target);break;case" ":ue.shiftKey||te(ue.target);break;default:break}};m.addEventListener("wheel",je,{passive:!0}),m.addEventListener("touchmove",nt,{passive:!0}),m.addEventListener("touchstart",ee,{passive:!0}),m.addEventListener("touchend",ve,{passive:!0}),m.addEventListener("touchcancel",ve,{passive:!0}),m.addEventListener("scroll",he,{passive:!0}),window.addEventListener("pointerup",ve,{passive:!0}),window.addEventListener("pointercancel",ve,{passive:!0}),m.addEventListener("pointerdown",me,{passive:!0}),m.addEventListener("keydown",Ae),F=()=>{m.removeEventListener("wheel",je),m.removeEventListener("touchmove",nt),m.removeEventListener("touchstart",ee),m.removeEventListener("touchend",ve),m.removeEventListener("touchcancel",ve),m.removeEventListener("scroll",he),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve),m.removeEventListener("pointerdown",me),m.removeEventListener("keydown",Ae)}});return()=>{cancelAnimationFrame(Z),F?.()}},[N,n,o,e,C,I,D,m,t]);let X=P(F=>{T.current=F},[T]),j=P(F=>{if(I.current.isLocked()){g.current=!1,y(),c(!0);return}if(!F&&k.current===w.current){y(),c(!1);return}g.current!==F&&(g.current=F,F?(b.current="following-end",k.current=w.current,i(!0),y(),c(!1)):(b.current="free-scrolling",k.current=null,x()))},[y,g,k,I,x,b,i,c,w]),E=M(V);E.current=V;let Y=W(()=>({followEnd:F=>E.current(F?.animated??!1)}),[]);return fe(()=>(LS(a,Y),()=>LS(a,null)),[Y,a]),{liveFollowEnabled:s,showScrollToEnd:d,bindTimelineHandle:f,onRowsChange:X,onIsAtEndChange:j,onManualNavigation:S,onDisclosureNavigation:R,returnToEnd:U}}$();$();$();var PS=pe(function({group:t,expanded:o,onToggle:n,disabled:r,highlighted:a,callCounts:s,sourceFiltered:i=!1,...d}){let{t:c}=z(),u=t.items.flatMap(p=>p.kind==="step"?[p.row]:p.rows).find(p=>p.kind==="user-message"),m=t.summary?.state;return l(Qr,{value:t.id,children:l(ta,{"data-trajectory-row-id":t.id,"data-timeline-row-id":t.id,"data-turn-group-header":t.turnId??"unassigned",tabIndex:-1,className:G("bg-muted/25 hover:bg-muted/25",a&&"outline-2 outline-primary"),children:v(Sn,{colSpan:6,className:"whitespace-normal px-2 py-2",children:[v("div",{className:"flex min-w-0 items-start gap-2",children:[v(K,{variant:"ghost",size:"sm",className:"h-auto min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal",disabled:r,"aria-expanded":o,onClick:()=>n(t.id),title:c(o?"turnOverview.collapseTurn":"turnOverview.expandTurn"),children:[o?l(Tt,{className:"size-4 shrink-0","aria-hidden":!0}):l(yo,{className:"size-4 shrink-0","aria-hidden":!0}),l("span",{className:"min-w-0",children:u?.summary||c(t.turnId===null?"turnOverview.unassigned":"turnOverview.turn")})]}),t.summary?l(Xu,{summary:t.summary}):null,m==="error"||m==="interrupted"?l("span",{className:"shrink-0 py-1 text-xs text-destructive-foreground",children:c(m==="error"?"trajectory.status.failed":"trajectory.status.stopped")}):null]}),v("div",{className:"flex flex-wrap gap-x-3 gap-y-1 pl-5 text-xs text-muted-foreground","data-trajectory-call-counts":!0,children:[s?v(oe,{children:[l("span",{children:i?c("trajectory.sourceFilter.matchedCalls",{matched:s.matchedCalls,total:s.totalCalls}):c("trajectory.sourceFilter.totalCalls",{count:s.totalCalls})}),l("span",{children:i?c("trajectory.sourceFilter.matchedFailedCalls",{count:s.matchedFailedCalls}):c("trajectory.sourceFilter.failedCalls",{count:s.failedCalls})})]}):null,i?l("span",{children:c("trajectory.sourceFilter.hiddenSteps")}):null]}),t.summary?l("div",{className:"pl-5",children:l(Qu,{summary:t.summary,...d})}):null]})})})});function ES({id:e,count:t,expanded:o,onToggle:n,disabled:r}){let{t:a}=z();return l(ta,{"data-trajectory-row-id":e,"data-timeline-row-id":e,tabIndex:-1,"data-routine-group":e,children:l(Sn,{colSpan:6,className:"px-3 py-1",children:v(K,{variant:"ghost",size:"xs","aria-expanded":o,disabled:r,onClick:n,children:[o?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0}),a("turnOverview.routineSteps",{count:t})]})})})}$();$();var hh="max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap";function AS({useToolCallDetail:e,threadRef:t,toolCallId:o,turnId:n,fallback:r,revision:a,rewritten:s}){let{t:i}=z(),[d,c]=q(!1),u=e===void 0?null:e({threadRef:t,toolCallId:o,turnId:n??null,revision:a??r??"initial",...d?{original:!0}:{}}),m=u===null?[]:[u.input,u.output].filter(f=>f!==void 0&&f.length>0),p=u?.input!==void 0&&u?.output!==void 0?m.join(`
|
|
3536
|
+
${cT}`,VH=new RegExp(`^${hp}\\n<preset-prefix id="([^"]*)">\\n([\\s\\S]*?)\\n</preset-prefix>\\n${cT}(?:\\n\\n([\\s\\S]*))?$`),gT=e=>{if(e.split(fT).length!==2)return null;let t=VH.exec(e);if(t===null)return null;let[,o,n,r]=t;return o?{presetId:o,prefix:n??"",body:r??""}:null},hT=e=>Xa(e)?gT(e)?.body||null:e,QH=["work","check-in","instructions","notice","continue"];var XH=new RegExp(`${Vg}<plugin-wake plugin="([^"]+)" reason="([^"]+)"(?: item="([^"]+)")?(?: round="(\\d+)" limit="(\\d+)")? ${mT}>\\n([\\s\\S]*?)\\n</plugin-wake>`),yT=e=>{let t=XH.exec(e);if(t===null)return null;let[,o,n,r,a,s,i]=t;if(!o||!n)return null;let d=QH.find(c=>c===Ad(n));return{pluginId:Ad(o),reason:d??"notice",...r?{item:Ad(r)}:{},...d==="continue"&&a&&s?{continuation:{round:Number(a),limit:Number(s),body:Ad(i??"")}}:{}}},vT=e=>{switch(e.reason){case"work":return e.item===void 0?{key:"work"}:{key:"workItem",item:e.item};case"check-in":return{key:"checkIn"};case"instructions":return{key:"instructions"};case"notice":return{key:"notice"};case"continue":return e.continuation===void 0?{key:"notice"}:{key:"continue",round:e.continuation.round,limit:e.continuation.limit}}};$();function CT({wake:e,blockKey:t}){let{t:o}=Ne(),{activeThreadEnvironmentId:n,threadKey:r}=xe(Fe),a=vT(e),[s,i]=$t(r,`plugin-wake:${t}`,!1),d=e.continuation?.body;return v("div",{className:"flex flex-col items-center gap-1 py-1","data-plugin-wake":e.pluginId,children:[v("p",{className:"flex max-w-[80%] flex-wrap items-center justify-center gap-x-1.5 text-center text-chat-row text-muted-foreground",children:[l(Mo,{environmentId:n,pluginId:e.pluginId}),l("span",{children:o(`pluginWake.${a.key}`,{item:a.item,round:a.round,limit:a.limit})}),d!==void 0&&d.length>0?l(K,{type:"button",variant:"link",size:"xs","aria-expanded":s,onClick:()=>i(!s),children:o(s?"pluginWake.hideReceived":"pluginWake.showReceived")}):null]}),s&&d!==void 0?l("p",{className:"max-w-[80%] whitespace-pre-wrap rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:d}):null]})}function xT({row:e}){let{t}=Ne(),{activeThreadEnvironmentId:o}=xe(Fe),n=t("turnContinuation.nameSeparator");return v("p",{className:"flex flex-wrap items-center gap-x-1 px-1 pb-2 pt-1 text-chat-row text-muted-foreground","data-testid":"continuation-check-row",children:[e.pluginIds.map((r,a)=>v("span",{className:"inline-flex items-center",children:[a>0?n:null,l(Mo,{environmentId:o,pluginId:r})]},r)),l("span",{children:t("turnContinuation.checking")})]})}var YH=new RegExp(`${Vg}<plugin-instruction>\\n([\\s\\S]*?)\\n<\\/plugin-instruction>`);function bT(e){let t=e.match(YH)?.[1];if(t===void 0)return null;try{let o=JSON.parse(t);if(o===null||typeof o!="object"||Array.isArray(o))return null;let n=o;return typeof n.pluginId!="string"||typeof n.title!="string"||typeof n.body!="string"?null:{pluginId:n.pluginId,title:n.title,body:n.body}}catch{return null}}$();var wT=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api"];if(!wT)throw new Error("This plugin needs a newer Ycodium app. Update the app.");var{COMMUNICATION_RECORDS_READ_LIMIT:AZ,HOST_TEAM_VIEW_PREFIX:NZ,MAX_PLUGIN_SESSION_PROJECTION_BYTES:DZ,MAX_PLUGIN_SKILL_COMPANION_FILE_BYTES:_Z,MAX_PLUGIN_SKILL_COMPANION_TOTAL_BYTES:OZ,MAX_PLUGIN_STREAM_BUFFER:FZ,MAX_PLUGIN_TOOL_PRESENTATION_BYTES:BZ,MAX_PLUGIN_WORKSPACE_WRITE_BYTES:HZ,MEMBER_INSTRUCTIONS_MAX_BYTES:UZ,MEMBER_NAME_MAX:$Z,MEMBER_RESPONSIBILITY_MAX:zZ,MEMBER_TITLE_MAX:KZ,MIN_PLUGIN_INTERVAL_MS:qZ,PLUGIN_API_MIN_VERSION:WZ,PLUGIN_API_VERSION:GZ,PLUGIN_PROXY_DIRECT:jZ,PluginSignInRequiredError:VZ,PluginSignInUnavailableError:QZ,REASONING_OPTION_LABEL:XZ,REQUEST_RESOLVED_TRIGGER_KIND:YZ,TEAM_VIEW_KEY_PATTERN:JZ,THREAD_ACTIVITIES_LIST_LIMIT:ZZ,THREAD_MESSAGES_LIST_LIMIT:eee,TOOL_LIFECYCLE_ACTIVITY_KINDS:tee,TURN_PROGRESS_TRIGGER_KIND:oee,USER_INPUT_PENDING_TRIGGER_KIND:nee,acceptPluginToolPresentation:ree,definePlugin:aee,defineTeamView:see,effortText:TT,findReasoningEffortDescriptor:iee,getDisplayModelName:lee,getTriggerDisplayModelName:IT,hasModelTraitControls:ST,isProviderSelectionAvailable:Dd,isReadOnlyModelChoice:kT,isReasoningEffortOptionId:dee,isTeamViewKey:cee,isThreadNotFound:uee,isWithinProviderSelectionLock:yp,knownEffortLevel:pee,mergeLaunchEnv:mee,modelCatalogNoticeOf:fee,modelChoiceTraitDescriptors:LT,modelOptionLabelKind:gee,modelOptionTitle:PT,modelOptionsAfterChange:hee,modelSelectionStringOption:yee,modelTraitDescriptors:vee,nearestEffortLevel:Cee,parseRetryAfterMs:xee,pluginJsonByteLength:bee,projectOrNull:wee,readRequestResolved:Tee,readThreadFailed:Iee,readTurnProgress:See,readUserInputPending:kee,reasoningEffortLevel:RT,reasoningEffortShortLabel:Lee,relabelModelOptionDescriptors:Pee,resolveModelChoice:Ree,resolveModelOptions:Eee,resolveProviderDriverKindForInstanceSelection:ET,sortProviderInstanceEntries:MT,threadMessagesNewestFirst:Mee,threadOrNull:Aee}=wT;var JH={effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant",fastMode:"traits.savedOption.fastMode",agent:"traits.savedOption.agent",serviceTier:"traits.savedOption.serviceTier"},ZH=e=>`traits.optionValue.${e}`;function AT(e,t){return PT(t,o=>e(JH[o]))}function Qg(e,t){return t.effortDisplayKind==="standard-tier"?e("traits.standardTier"):TT(t,o=>e(ZH(o)))}function gi({badge:e,compact:t=!1}){let{t:o}=Ne(),n=Qg(o,e);return v(oe,{children:[e.driverKind?l("span",{className:t?"flex size-5 shrink-0 items-center justify-center":"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:l(js,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,v("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?l("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,t?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}):l(rp,{text:e.modelLabel,label:o("copyButton.copyModelName"),children:l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel})}),n?v(oe,{children:[" ",l("span",{children:n})]}):null]})]})}function NT({badge:e,createdAt:t}){let o=xe(Fe),{t:n}=Ne();return v("div",{className:"mb-3 flex min-w-0 select-none flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[l(gi,{badge:e})," ",v(Pe,{children:[l(Ee,{render:l("span",{className:"shrink-0 tabular-nums"}),children:Yn(t,o.timestampFormat,n)}),l(Re,{children:wn(t,o.timestampFormat,n)})]})]})}function Xg({row:e}){let{t}=Ne(),o=Qg(t,e.badge),n=o?`${e.badge.modelLabel} (${o})`:e.badge.modelLabel,r=[e.badge.providerDisplayName,n].filter(s=>typeof s=="string"&&s.length>0).join(" "),a=e.pending?t("timeline.modelSwitchPending",{model:r}):t("timeline.modelSwitched",{model:r});return v("div",{role:"separator","aria-label":a,"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:[l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),v("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?l(js,{driver:e.badge.driverKind,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,l("span",{className:"truncate",children:a})]}),l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}function Cp({row:e}){let t=xe(Fe).derive;if(e.message.rewrite){let o=t.parsePresetPrefixText(e.message.rewrite.original);return o?v(oe,{children:[l(DT,{parsed:o}),l(Cp,{row:{...e,message:{...e.message,rewrite:{...e.message.rewrite,original:o.body}}}})]}):l(jg,{row:e,text:e.message.rewrite.original})}if(Xa(e.message.text)){let o=t.parsePresetPrefixText(e.message.text);return o?v(oe,{children:[l(DT,{parsed:o}),o.body.length>0||(e.message.attachments?.length??0)>0?l(Cp,{row:{...e,message:{...e.message,text:o.body}}}):null]}):l(oU,{row:e})}return l(jg,{row:e,text:e.message.text})}var eU={"child.settled":{tone:"success",label:"childThread.state.settled"},"child.failed":{tone:"error",label:"childThread.state.failed"},"child.approval":{tone:"attention",label:"childThread.state.approval"},"child.question":{tone:"attention",label:"childThread.state.question"},"child.stopped":{tone:"neutral",label:"childThread.state.stopped"},"child.resolved":{tone:"success",label:"childThread.state.resolved"}};function vp({children:e}){return l("div",{className:"flex justify-center py-1",children:l("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 DT({parsed:e}){let{t}=Ne();return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var tU={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.question":"childThread.notification.question","child.stopped":"childThread.notification.stopped","child.resolved":"childThread.notification.resolved","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved","cookie-import.resolved":"childThread.notification.cookieImportResolved"};function oU({row:e}){let{t}=Ne(),o=Nt(),{derive:n,activeThreadEnvironmentId:r}=xe(Fe),a=xe(Fe).SessionMessageCard,s=e.message.attachments??[],i=s.filter(m=>Cr(m)),d=s.filter(m=>!Cr(m)),c=(m,p)=>{let f=yT(m);if(f)return l(CT,{wake:f,blockKey:`${e.message.id}:${p}`});let g=bT(m);if(g)return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:g.title}),g.body.length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:g.body}):null]});let h=n.parseThreadHandoverText(m);if(h)return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),l("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:h.includedTurns})}),l("p",{className:"mt-1 whitespace-pre-wrap",children:h.body})]});let y=n.parseSystemNotificationText(m);if(!y||y.recordId!==void 0)return null;let x=y.childThreadId&&n.notificationOpensChildThread(y.kind),C=()=>{y.childThreadId!==void 0&&o.openThread({environmentId:r,threadId:y.childThreadId})},b=eU[y.kind];if(a!==void 0&&b!==void 0&&y.childThreadId){let w=[y.kind==="child.resolved"&&y.resolution!==void 0?t(`childThread.resolution.${y.resolution}`):null,y.summary.trim()].filter(k=>k).join(`
|
|
3537
|
+
`);return l(a,{environmentId:r,threadId:y.childThreadId,fallbackName:y.title,status:{tone:b.tone,label:t(b.label)},text:w.length>0?w:t(b.label),action:x?{label:t("childThread.open"),onPress:C}:void 0})}return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t(tU[y.kind],{title:y.title})}),y.kind==="child.resolved"&&y.resolution!==void 0?l("p",{className:"mt-1",children:t(`childThread.resolution.${y.resolution}`)}):null,y.summary.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:y.summary}):null,x?l(K,{type:"button",size:"xs",variant:"outline",className:"relative mt-2 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:C,children:t("childThread.open")}):null]})},u=pT(e.message.text).map(c).filter(m=>m!==null);return u.length===0&&s.length===0?null:v(oe,{children:[u.map((m,p)=>l(Aa,{children:m},p)),s.length>0?v("div",{className:"min-w-0 px-3 py-2",children:[l(Ld,{images:i}),d.map(m=>l(Pd,{attachment:m},m.id))]}):null]})}function _T(e,t){let o=t.parsePresetPrefixText(e??"")?.body??null;if(o===null&&Xa(e??""))return null;let r=ui(o??e??"").visibleText;for(;;){let i=pi(r);if(!i.annotation)break;r=i.promptText}let a=Qa(r).promptText,s=mi(a).map(i=>i.kind==="text"?t.messageLinksToPreviewText(i.text):i.comment.text).join(" ").replace(/\s+/g," ").trim();return s.length>0?s:null}var OT=30,FT=8,Yg=OT+FT,BT=pe(function({ref:t,textRef:o,initialText:n,onJump:r}){let{t:a}=Ne(),s=a("timeline.pinnedTurnHeaderJump");return l("div",{ref:t,className:"pointer-events-none absolute inset-x-0 top-0 z-10 px-3 data-[visible=false]:hidden sm:px-5","data-timeline-turn-header":"true","data-visible":"false",children:l("div",{className:"transcript-col-wide",style:{paddingTop:FT},children:l("div",{className:"rounded-control-3 bg-background",children:v(K,{type:"button",variant:"outline",size:"sm",title:s,onClick:r,className:"pointer-events-auto w-full min-w-0 justify-start gap-2 bg-background px-2.5 text-xs font-normal text-muted-foreground shadow-xs hover:text-foreground",style:{height:OT},children:[l(Dl,{"aria-hidden":!0,className:"size-icon-2 shrink-0"}),l("span",{className:"sr-only",children:s}),l("span",{ref:o,className:"min-w-0 flex-1 truncate text-left",children:n})]})})})})});function HT({row:e}){let t=xe(Fe),{t:o}=Ne(),[n,r]=$t(t.threadKey,`message:${e.message.id}`,!1);if(e.message.text.trim().length===0&&(e.message.attachments?.length??0)>0)return l(zg,{rowId:e.id,messageId:e.message.id,attachments:e.message.attachments},e.message.id);if(e.presentation==="compact"&&!n)return l(Nu,{state:"idle",children:v("button",{type:"button",className:V(li,"chat-process-text cursor-[var(--control-cursor)] text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":o("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[l(vd,{status:null}),l(yd,{children:l(hr,{className:"size-icon-1","aria-hidden":!0})}),l("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),l(Tt,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let s=e.message.attachments??[],i=e.message.text||(e.message.streaming||s.length>0?"":o("timeline.emptyResponse"));return l(oe,{children:v("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"?v("div",{className:"mb-1 flex items-center gap-2",children:[l("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:o("timeline.collapseMessage")}),e.copyInFooter?null:l(ea,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?l(NT,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,i.trim().length>0?l("div",{"data-assistant-quote-body":"",children:l(wo,{disclosureKey:`message:${e.message.id}:assistant`,text:i,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(i),skills:t.skills,onImageExpand:t.onImageExpand,artifactTurnId:e.message.turnId})}):null,l(zg,{rowId:e.id,messageId:e.message.id,attachments:s},e.message.id),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?v("div",{className:"mt-1.5 flex select-none 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:[l(nU,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&v(Pe,{children:[l(Ee,{render:l("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:Yn(e.message.updatedAt,t.timestampFormat,o)}),l(Re,{children:wn(e.message.updatedAt,t.timestampFormat,o)})]})]}):null]})})}function nU({row:e}){let o=xe(Fe).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return o.visible?l(ea,{text:o.text??"",variant:"ghost"}):null}var Jg=240,rU=/\s/u;function UT(e){if(!e)return null;let t=[],o=0,n=!1,r=()=>{for(;o>Jg-1;)o-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),o-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(rU.test(a)){n=t.length>0;continue}if(n&&(t.push(" "),o+=1,n=!1,o>Jg)||(t.push(a),o+=a.length,o>Jg))return r()}return t.length>0?t.join(""):null}function aU(e,t,o){let n=t.find(p=>p.kind==="message"&&p.message.role==="user"),r=n?.kind==="message"?n.message:null,a=r?.rewrite?.original??r?.text??"",s=null;for(let p of t)p.kind==="message"&&p.message.role==="assistant"&&(s=p.message.text.trim()?p.message.text:(p.message.attachments??[]).map(f=>f.source?._tag==="agent-artifact"&&f.source.title?`${f.name} \u2014 ${f.source.title}`:f.name).join(", "));let i=r?.attachments??[],d=r!==null&&!a.trim()&&i[0]?{name:i[0].name,count:i.length}:void 0,c=r!==null&&Xa(a)&&o.parsePresetPrefixText(a)===null,u=r===null?null:_T(a,o),m=u===null&&!c&&i[0]?{name:i[0].name,count:i.length}:void 0;return{...d===void 0?{}:{attachmentPreview:d},...m===void 0?{}:{headerAttachment:m},...c?{isSystemMessage:!0}:{},id:e,sectionKey:e,anchorRowId:n?.id??t[0]?.id??e,userText:r===null?null:UT(o.parseSystemNotificationText(a)?.summary??o.parseThreadHandoverText(a)?.body??o.messageLinksToPreviewText(o.parsePresetPrefixText(a)?.body??a))??(d===void 0?null:""),assistantText:UT(s),headerText:u}}function sU(e){for(let t of e){let o=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(o!==null)return o}return null}function iU(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&&e.isSystemMessage===t.isSystemMessage&&e.attachmentPreview?.name===t.attachmentPreview?.name&&e.attachmentPreview?.count===t.attachmentPreview?.count}function lU(e,t,o){for(let n=0;n<e.length;n+=1)if(e[n]!==o[t.firstRowIndex+n])return!1;return!0}function dU(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function cU(e){let t=new Map,o=null;return n=>{let r=n.getVersion();if(o!==null&&o.store===n&&o.version===r)return o.entries;let a=new Map,s=[],i=n.getRows();for(let c of n.getStructure().sections){let u=t.get(c.key);if(u!==void 0&&u.rowIds===c.rowIds&&lU(u.rows,c,i)){a.set(c.key,u),s.push(u.entry);continue}let m=i.slice(c.firstRowIndex,c.firstRowIndex+c.rowIds.length),p=aU(c.key,m,e),{headerAttachment:f,...g}=p,h={...g,turnId:sU(m)},y=u?.entry.summary.headerAttachment,x=u!==void 0&&iU(u.entry.item,h)&&y?.name===f?.name&&y?.count===f?.count?u.entry:{summary:p,item:h};a.set(c.key,{rowIds:c.rowIds,rows:m,entry:x}),s.push(x)}t=a;let d=o!==null&&dU(o.entries,s)?o.entries:s;return o={store:n,version:r,entries:d},d}}var $T=new WeakMap;function qT(e,t){let o=$T.get(e);return(o===void 0||o.derive!==t)&&(o={derive:t,read:cU(t)},$T.set(e,o)),o.read(e)}var zT=new WeakMap;function WT(e,t){let o=qT(e,t),n=zT.get(o);if(n===void 0){let r=null;n=o.flatMap(({summary:a})=>{if(a.isSystemMessage===!0)return r===null?[]:[{...r,sectionKey:a.sectionKey,inherited:!0}];let s=a.headerAttachment;return a.headerText===null&&s===void 0?(r=null,[]):(r={sectionKey:a.sectionKey,text:a.headerText??"",...s===void 0?{}:{attachment:s},anchorRowId:a.anchorRowId,inherited:!1},[r])}),zT.set(o,n)}return n}function GT(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>{let r=t[n];return o.sectionKey===r.sectionKey&&o.text===r.text&&o.anchorRowId===r.anchorRowId&&o.attachment?.name===r.attachment?.name&&o.attachment?.count===r.attachment?.count&&o.inherited===r.inherited})}var KT=new WeakMap;function jT(e,t){let o=qT(e,t),n=KT.get(o);return n===void 0&&(n=o.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),KT.set(o,n)),n}function VT(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>o===t[n])}var uU=[],pU=e=>e.getMeta().usageByTurnId,mU=e=>e.getMeta().exportApi,fU=e=>e.getMeta().status.totalTurnCount??null,QT=pe(function({rowsStore:t,derive:o,paneVisible:n,bottomInset:r,onSelect:a,onTurnNavigatorChange:s}){let i=R(f=>n?jT(f,o):uU,[o,n]),d=Wt(t,i,VT),c=Wt(t,pU),u=Wt(t,mU),m=Wt(t,fU),p=W(()=>n?{items:d,totalTurnCount:m,bottomInset:r,usageByTurnId:c,onSelect:a,exportMarkdown:u.markdown,onDownload:u.download}:null,[r,u,d,a,n,m,c]);return H(()=>{p!==null&&s(p)},[s,p]),H(()=>{if(n)return()=>s(null)},[s,n]),null});function YT({timeline:e,previousOverlayHeight:t,overlayHeight:o,followingEnd:n}){e&&n&&o>t&&e.scrollToEnd({animated:!1})}function JT(e,t){let o=e.topOf(t),n=e.heightOf(t);return typeof o!="number"||typeof n!="number"||!Number.isFinite(o)||!Number.isFinite(n)?null:o+Math.max(1,n)}function ZT({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}var XT="--chat-frozen-block-visibility";function xp(e,t){let o=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),n=o.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=n<0?o:o.slice(0,n+1);for(let a of r)a.style.contentVisibility="visible",a.style.setProperty(XT,"visible");e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility"),a.style.removeProperty(XT)})}$();var gU=e=>e.getMeta().status.workingStepLabel??null,hU=e=>e.getMeta().status.waitingFor??null,yU=e=>e.getMeta().status.liveOutputTokens??null,vU=e=>e.getMeta().status.stall??null,CU=e=>e.getMeta().status.retry??null,eI=pe(function({rowsStore:t,historyWindow:o,children:n}){let r=Wt(t,gU),a=Wt(t,hU),s=Wt(t,yU),i=Wt(t,vU),d=Wt(t,CU),c=W(()=>o?{workingStepLabel:null,waitingFor:null,liveOutputTokens:null,stall:null,retry:null}:{workingStepLabel:r,waitingFor:a,liveOutputTokens:s,stall:i,retry:d},[o,s,d,i,a,r]);return l(op,{value:c,children:n})});$();function bp(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var xU=1e3,wp=150;function Tp(e,t=xU){let[o,n]=q(null);return H(()=>{if(e===null){n(null);return}let r=globalThis.setTimeout(()=>{n(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),o}var bU=5;function tI(e){let t=e.data.useThreadSyncPhase(e.target);return Tp(t,wp)==="loading"?l(Zg,{}):null}function Zg(){let{t:e}=z();return v("div",{className:"pointer-events-none absolute inset-0 overflow-hidden bg-background px-3 pt-4 sm:px-5","data-timeline-loading-skeleton":"",role:"status",children:[l("span",{className:"sr-only",children:e(bp("loading"))}),l("div",{className:"transcript-col flex flex-col gap-6",children:Array.from({length:bU},(t,o)=>v("div",{"aria-hidden":"true",className:"flex flex-col gap-3",children:[l("div",{className:"h-9 self-end rounded-[18px] bg-muted-foreground/15",style:{width:`${44-o%2*14}%`}}),[92,84,61].map((n,r)=>l("div",{className:"h-3 rounded-control-1 bg-muted-foreground/15",style:{width:`${n-o%3*6}%`}},r))]},o))})]})}var oI=l("div",{className:"h-3 sm:h-4"}),nI=l("div",{className:"h-10 sm:h-12"});function rI({loading:e,blocked:t,onLoadEarlier:o,fade:n}){let{t:r}=Ne();return l("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:o,disabled:e||t,className:"relative w-full select-none 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 aI({loading:e,blocked:t,onLoadLater:o,onReturnToLatest:n}){let{t:r}=Ne();return v("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[l(K,{variant:"ghost",size:"sm",onClick:o,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),n?l(K,{variant:"ghost",size:"sm",onClick:n,children:r("timeline.returnToLatest")}):null]})}function sI({onReveal:e,fade:t}){let{t:o}=Ne();return l("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:e,className:"relative w-full select-none 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:o("timeline.loadEarlier")})})})}var iI=l("div",{className:"h-3 sm:h-4"});$();var wU=Object.freeze([]),lI=e=>e.getMeta().status.scheduledWakes??wU;function dI(e,t){let o=E(e);return t&&(o.current=e),o.current}$();function Ip(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}$();function Sp(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 cI({badge:e,startedAt:t,completedAt:o,waitingLabel:n,timestampFormat:r}){let{t:a}=Ne();if(e===null&&t===void 0)return null;let s=a("timeline.turnInfo");return v(rn,{children:[l(sn,{openOnHover:!0,delay:250,render:l(K,{type:"button",size:"icon-xs",variant:"ghost","data-turn-info":"","aria-label":s,className:"shrink-0 text-muted-foreground"}),children:l(Yl,{className:"size-3.5","aria-hidden":!0})}),l(an,{side:"top",align:"start",className:"max-w-80",children:v("div",{className:"flex flex-col gap-2 text-chat-dense",children:[e!==null?l("div",{className:"flex min-w-0 items-center gap-2",children:l(gi,{badge:e})}):null,t!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnStarted",{time:wn(t,r,a)})}):null,o!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnFinished",{time:wn(o,r,a)})}):null,n!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:n}):null]})})]})}function TU(e,t,o,n){if(o===void 0||o<=0)return null;let r=t(o);return n!==void 0&&n>0?e("timeline.waitingWithApprovals",{waiting:r,approvals:t(n)}):e("timeline.waiting",{waiting:r})}function kp({label:e,children:t}){let[o,n]=q(!1);return v(Pe,{open:o,onOpenChange:n,children:[l(Ee,{render:l("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>n(r=>!r),children:t}),l(Re,{children:e})]})}var uI=pe(function({footer:t,timestampFormat:o,copyText:n,identity:r}){let{t:a}=Ne(),{formatCountedDuration:s}=_o(),i=TU(a,s,t.waitingForYouMs,t.approvalWaitMs),d=t.state,c=d==="error"?a("timeline.error"):d==="interrupted"?a("timeline.interrupted"):null;return v("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:[v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[c!==null?v(kp,{label:c,children:[d==="error"?l(dt,{className:"size-icon-1 text-destructive-foreground","aria-hidden":!0}):l(md,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:c})]}):null,t.workingElapsedMs!==void 0?l(kp,{label:a("timeline.workingTime",{duration:s(t.workingElapsedMs)}),children:s(t.workingElapsedMs)}):null,i!==null?v(oe,{children:[" ",l(kp,{label:i,children:i})]}):null,(t.workingElapsedMs!==void 0||i!==null)&&t.outputTokens!==void 0?" ":null,t.outputTokens!==void 0?l(rp,{text:String(t.outputTokens),label:a("copyButton.copyTokenCount"),children:l(kp,{label:`${a("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:a("timeline.outputTokenCount",{count:t.outputTokens,value:Sp(t.outputTokens)})})}):null]}),l(cI,{badge:r?.badge??null,startedAt:r?.createdAt,completedAt:t.completedAt,waitingLabel:i??void 0,timestampFormat:o}),n?l(ea,{text:n,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});function _d({plugins:e,environmentId:t}){let{t:o}=z(),n=Qn(t,e[0]??"");return l("span",{className:"chat-process-meta text-muted-foreground",children:o(e.length===1?"toolCall.rewrittenByOne":"toolCall.rewrittenByMany",{plugin:n??o("toolCall.unknownPlugin"),count:e.length})})}$();function IU(e){return e.toolLifecycleStatus==="interrupted"}function SU(e){let t=e?.stoppedByUser===!0;return e?.continuedAfterStop===!0?t?"toolGroup.interruptedByYouKeptRunning":"toolGroup.interruptedKeptRunning":e?.terminationConfirmed===!0?t?"toolGroup.interruptedByYou":"toolGroup.interrupted":t?"toolGroup.interruptedByYouMayStillRun":"toolGroup.interruptedMayStillRun"}function eh(e,t,o){if(!IU(e))return null;let n=e.toolInterrupt,r=t(SU(n)),a=[n?.durationMs===void 0?null:o(n.durationMs),e.toolIo?.exitCode===void 0?null:t("toolGroup.exitCode",{code:e.toolIo.exitCode})].filter(s=>s!==null);return a.length===0?r:`${r}, ${a.join(", ")}`}$();function th(e){if(e<1e3)return String(e);if(e<1e6){let o=e/1e3;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}k`}if(e<1e9){let o=e/1e6;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}function pI({additions:e,deletions:t,className:o,showParentheses:n=!1,layout:r="aligned",disabled:a=!1,showZero:s=!0,cn:i,t:d,language:c}){let u=s||e!==0,m=s||t!==0;if(!u&&!m)return null;let p=[];u&&p.push(d("changedFiles.additions",{count:e})),m&&p.push(d("changedFiles.deletions",{count:t}));let f=new Intl.ListFormat(c,{type:"unit"}).format(p),g=a?"text-[var(--control-disabled-foreground)]":null;return v(oe,{children:[n&&l("span",{className:"text-muted-foreground/70",children:"("}),v("span",{"aria-label":f,className:i(r==="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",o),"data-slot":"diff-stat",role:"group",children:[u?v("span",{"aria-hidden":"true",className:i("font-mono",g??"text-diff-addition"),children:["+",th(e)]}):null,m?v("span",{"aria-hidden":"true",className:i("font-mono",g??"text-diff-deletion"),children:["-",th(t)]}):null]}),n&&l("span",{className:"text-muted-foreground/70",children:")"})]})}var mI=pe(function(t){let{t:o}=Ne();return l(pI,{...t,cn:V,t:o,language:void 0})});function fI(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function gI(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}function kU(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 o=new Map;for(let n of e){let r=t(n);o.set(r,(o.get(r)??0)+1)}return Array.from(o,([n,r])=>({action:n,icon:kU(n),count:r}))}function nh(e,t){let o;for(let n of oh(e,t))(!o||n.count>o.count)&&(o=n);return o?.icon??"wrench"}$();function hI({entries:e,failed:t,derive:o}){let{t:n}=Ne(),r=W(()=>oh(e,o.toolGroupAction),[e,o]),a=r.length===1;return a&&r[0].count<2?null:l("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":n("toolGroup.calls",{count:e.length}),children:r.map(({action:s,icon:i,count:d})=>v("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:l(Vs,{name:i,className:V("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive-foreground":"text-icon-muted")}),d]},s))})}function LU(e){switch(e){case"command":return"command";case"edit":return"edit";case"read":return"read";case"search":case"code-search":return"search";default:return"other"}}function PU(e){return e.changedFiles&&e.changedFiles.length>0?e.changedFiles:e.toolLabel?.path?[e.toolLabel.path]:[]}function yI(e,t){let o=[],n=new Map,r=new Map,a=new Map;for(let p of e){let f=LU(t(p));if(o.includes(f)||o.push(f),n.set(f,(n.get(f)??0)+1),f!=="edit"&&f!=="read")continue;let g=PU(p);if(g.length===0){a.set(f,(a.get(f)??0)+1);continue}let h=r.get(f)??new Set;for(let y of g)h.add(y);r.set(f,h)}let i=o.map(p=>({kind:p,count:p==="edit"||p==="read"?(r.get(p)?.size??0)+(a.get(p)??0):n.get(p)??0})).filter(p=>p.count>0).slice().sort((p,f)=>f.count-p.count||o.indexOf(p.kind)-o.indexOf(f.kind)),d=i.slice(0,2),c=i.slice(2);if(c.length===0)return d;let u=c.reduce((p,f)=>p+(n.get(f.kind)??0),0),m=d.map(p=>p.kind==="other"?{kind:"other",count:p.count+u}:p);return d.some(p=>p.kind==="other")||m.push({kind:"other",count:u}),m}function vI(e){return typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null}function CI(e,t,o,n){if(t===void 0||o===void 0||o.length===0)return e;let r=e.trim();for(let a of[`mcp__ycodium__${t}`,`ycodium_${t}`,`ycodium ${t}`,t]){if(r===a)return o;if(!r.startsWith(`${a} `))continue;let s=r.slice(a.length).trim();return s.length===0?o:n!==void 0&&s.toLowerCase()==="started"?n(o):`${o} ${s}`}return e}function ta(e){return Ip(e)}function Lp(e,t,o,n,r,a){let s=e.toolLabel,i=o.resolveToolCommand(e);if(i&&s?.descriptive&&!s.path&&s.detail?.trim())return s.detail.replace(/\s+/g," ").trim();for(let y of[e.rawCommand,e.command]){let x=o.parseToolCommandInput(y)?.description;if(x)return x.replace(/\s+/g," ").trim()}if(i)return i.replace(/\s+/g," ").trim();let d=vI(e),c=typeof d?.toolName=="string"?d.toolName:typeof d?.name=="string"?d.name:void 0,u=e.builtinMcpTool||void 0,m=a??CI(s?.name??c??e.toolTitle??e.label,u,u===void 0?void 0:n?.get(u),r),p=s?.path??e.changedFiles?.[0],f=p?dp(p,t):void 0,g=[m.trim().toLowerCase()==="tool"?void 0:m,f,e.toolMetadata?.source==="ycodium"?void 0:s?.detail??e.detail],h=[];for(let y of g){let x=y?.replace(/\s+/g," ").trim();x&&!h.some(C=>C.toLowerCase()===x.toLowerCase())&&h.push(x)}return h.join(" ")||null}$();function Od(e){let t=xe(Fe)?.toolPresentation;return e===void 0||t===void 0?null:t(e)}function xI(e){let t=xe(Fe)?.toolPresentation;return W(()=>{if(t===void 0||e.length===0)return null;let o=t(e[0]);if(o===null)return null;let n=e.map(r=>t(r));return n.every(r=>r?.groupKey===o.groupKey)?o:n.every(r=>r?.familyKey===o.familyKey)?{...o,groupName:o.familyName,origin:o.origin.kind==="ycodium"?{kind:"ycodium",area:"general"}:o.origin}:null},[e,t])}function rh({presentation:e,className:t}){let o=xe(Fe),n=o.ToolSourceIcon;return n===void 0?null:l(n,{environmentId:o.activeThreadEnvironmentId,origin:e.origin,className:t})}function Fd({presentation:e,fallback:t,environmentId:o}){return v(oe,{children:[e.sourceName!==null?v(oe,{children:[l("span",{className:"font-medium text-foreground","data-tool-source-name":"",children:e.sourceName}),l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"})]}):null,e.declared?l("span",{children:e.title}):t,e.declared&&e.summary!==null?l(bI,{text:e.summary}):null,e.declared&&e.summary===null&&e.entity?l(RU,{entity:e.entity,environmentId:o}):null,e.declared&&e.experienceId?l(EU,{experienceId:e.experienceId}):null]})}function RU({entity:e,environmentId:t}){let o=xe(Fe),n=t??o?.activeThreadEnvironmentId??"",r=e.kind==="machine"?e.environmentId:e.environmentId??n;return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"inline-flex min-w-0 tabular-nums","data-tool-entity":e.kind,children:e.kind==="thread"?l(hd,{threadRef:{environmentId:r,threadId:e.threadId},fallbackName:e.fallbackName,showStatus:!1}):e.kind==="machine"?l(fb,{environmentId:r,fallbackName:e.fallbackName}):e.kind==="project"?l(gb,{projectRef:{environmentId:r,projectId:e.projectId},fallbackName:e.fallbackName}):l(hb,{environmentId:r,instanceId:e.instanceId,fallbackName:e.fallbackName})})]})}function bI({text:e}){return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"tabular-nums",children:e})]})}function EU({experienceId:e}){let t=ci(),o=t?.data.useMemoryExperience;return!t||!o?null:l(MU,{readExperience:o,target:t.target,experienceId:e})}function MU({readExperience:e,target:t,experienceId:o}){let{title:n}=e(t,o);return n===null?null:l(bI,{text:n})}var hi=20,AU={failed:"toolGroup.showFailure",declined:"toolGroup.showDeclined",stopped:"toolGroup.showCancelled"},NU={command:"toolGroup.semanticCommands",edit:"toolGroup.semanticEdits",read:"toolGroup.semanticReads",search:"toolGroup.semanticSearches",other:"toolGroup.semanticOther"};function wI({entry:e,presentation:t}){let o=e.toolLabel?.diffStat;return!o||t==="failed"||t==="declined"||t==="stopped"?null:l(mI,{...o,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function TI({toolIcon:e,glyphClassName:t}){let o=xe(Fe),n=o.SiteIcon;return e.pageUrl!==void 0&&n!==void 0?l(n,{threadRef:o.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):l(Vs,{name:"globe",className:t})}function DU({entry:e,failed:t=!1,derive:o}){let n=xe(Fe),r=Od(e);return t?l(eo,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive-foreground"}):e.toolIcon!==void 0?l(TI,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):r!==null&&n.ToolSourceIcon!==void 0?l(rh,{presentation:r,className:"size-icon-1"}):l(Vs,{name:nh([e],o.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function II({entry:e}){let t=xe(Fe),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,n=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=Od(e),a=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:n,onOpenFileDiff:t.onOpenFileDiff});return v("div",{className:"min-w-0 space-y-2 p-3",children:[r!==null?l("p",{className:"chat-process-meta text-muted-foreground","data-tool-source-line":"",children:r.sourceLine}):null,a!==void 0?l(oe,{children:a}):l("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:o??""})]})}var _U=pe(function(t){let{entry:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}=t,s=xe(Fe),i=s.derive,{t:d}=Ne(),{formatDuration:c}=_o(),[u,m]=$t(n,`call:${ta(o)}`,!1),p=i.toolPresentationStatus(o),f=Od(o),g=f?.declared===!0?null:Lp(o,r,i,s.declaredToolTitles,k=>d("toolGroup.declaredStarted",{title:k}),f?.title)??d("toolGroup.calls",{count:1}),h=p==="failed",y=p==="declined",x=p==="stopped",C=x?eh(o,d,c):null,b=i.resolveWorkEntryStatus(o),L=b==="failed"||b==="running"?b:null,w=ho();return v("div",{"data-tool-call-id":o.toolCallId??o.id,"data-tool-identity":ta(o),className:"border-b border-border/50 last:border-b-0",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":w,onClick:()=>{a?.(),m(!u)},className:V("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",h?"text-destructive-foreground":"text-muted-foreground"),children:[l(vd,{status:L}),l(yd,{children:l(DU,{entry:o,failed:h,derive:i})}),v("span",{className:"flex min-w-0 flex-1 items-center",children:[l("span",{className:"truncate",children:f!==null?l(Fd,{presentation:f,fallback:g}):g}),l(wI,{entry:o,presentation:p})]}),h||y||x||o.statusInferred?l("span",{className:"chat-process-meta shrink-0",children:o.statusInferred?d("toolGroup.statusUnknown"):h?d("toolGroup.failed",{count:1}):y?d("toolGroup.declined",{count:1}):C??d("toolGroup.cancelled",{count:1})}):null,o.rewrittenBy?.length?l(_d,{plugins:o.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),u?l("div",{id:w,children:l(II,{entry:o})}):null]})});function OU({threadKey:e,stateKey:t,maxHeight:o,children:n}){let r=E(null);return fe(()=>{let a=r.current;if(!a)return;a.scrollTop=Ug(e,`${t}:scroll`,0);let s=()=>{kd(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",s,{passive:!0}),()=>a.removeEventListener("scroll",s)},[e,t]),l("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:o},children:n})}var SI=pe(function({entries:t,groupId:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}){let s=xe(Fe),i=s.derive,{t:d}=Ne(),{formatDuration:c}=_o(),[u,m]=$t(n,`group:${o}`,!1),[p,f]=$t(n,`group-page:${o}`,0),g=ho(),h=E(null),[y,x]=q(null),C=t.at(-1),{failedCount:b,declinedCount:L,stoppedCount:w,issue:k,runningCount:I,unknownCount:T}=W(()=>({...i.summarizeToolGroup(t),unknownCount:t.filter(ne=>ne.statusInferred).length,runningCount:t.filter(ne=>i.toolPresentationStatus(ne)==="running").length}),[t,i]),S=k?.entry??C,P=Math.max(0,Math.ceil(t.length/hi)-1),A=Math.min(p,P),N=A*hi,B=t.slice(N,N+hi),O=t.length>1,j=t.every(ne=>i.toolPresentationStatus(ne)==="completed"),D=W(()=>O&&j&&k===null?yI(t,i.toolGroupAction):null,[t,i,O,j,k])?.map(ne=>d(NU[ne.kind],{count:ne.count})).join(" \xB7 ")??null,J=xI(O?t:[]),G=Od(O?void 0:C),M=O?J:G;if(fe(()=>{if(!y)return;let ne=h.current,Z=Array.from(ne?.querySelectorAll("[data-tool-identity]")??[]).find(he=>he.dataset.toolIdentity===y.id);if(!Z)return;let ve=Z.closest('[data-slot="scroll-area-viewport"]');ve&&(ve.scrollTop+=Z.getBoundingClientRect().top-ve.getBoundingClientRect().top),Z.querySelector("button")?.focus({preventScroll:!0})},[y]),!C||!S)return null;let X=I>0&&k===null?t.find(ne=>i.toolPresentationStatus(ne)==="running")??S:S,F=D??Lp(X,r,i,s.declaredToolTitles,ne=>d("toolGroup.declaredStarted",{title:ne}),G?.title)??d("toolGroup.calls",{count:1}),ee=ne=>{a?.(),f(ne)},Y={threadKey:n,workspaceRoot:r,onDisclosureChange:a},ae=gI(t.map(ne=>fI(i.resolveWorkEntryStatus(ne)))),te=nh(t,i.toolGroupAction),de=O?null:eh(C,d,c),ge=ae==="failed"?"failed":ae==="running"?"running":L+w===t.length?null:"success";return l(Nu,{state:ae,variant:"tool",children:v("section",{ref:h,"data-tool-group-id":o,className:"min-w-0",children:[v("div",{className:"flex min-w-0 items-center",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":g,onClick:()=>{a?.(),m(!u),!O&&!u&&kd(n,`call:${ta(C)}`,!0)},className:V(li,"flex-1",b>0?"text-destructive-foreground":"text-muted-foreground"),children:[l(vd,{status:ge}),l(yd,{children:M!==null&&s.ToolSourceIcon!==void 0&&b===0&&(O||C.toolIcon===void 0)?l(rh,{presentation:M,className:"size-icon-1"}):!O&&C.toolIcon!==void 0&&b===0?l(TI,{toolIcon:C.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):l(Vs,{name:te,className:V("size-icon-1 shrink-0 stroke-[1.8] opacity-70",b>0?"text-destructive-foreground":"text-icon-muted")})}),v("span",{className:V("flex min-w-0 flex-1 items-center",u&&O?"chat-process-text":"chat-tool-summary"),children:[l("span",{className:"truncate",children:J!==null?d("toolGroup.namedCalls",{name:J.groupName,count:t.length}):u&&O?d("toolGroup.calls",{count:t.length}):G!==null?l(Fd,{presentation:G,fallback:F}):F}),u&&O?null:D===null?l(wI,{entry:S,presentation:i.toolPresentationStatus(S)}):null]}),t.length===1&&S.rewrittenBy?.length?l(_d,{plugins:S.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,T>0?l("span",{className:"chat-process-meta shrink-0",children:d("toolGroup.statusUnknown")}):null,I>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums text-info-foreground",children:d("toolGroup.running",{count:I})}):null,b>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.failed",{count:b})}):null,L>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.declined",{count:L})}):null,w>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.cancelled",{count:w})}):null,u&&O?null:D===null&&J===null?l(hI,{entries:t,failed:b>0,derive:i}):null,l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),k&&O?l("button",{type:"button",className:V("chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 underline [@media(pointer:coarse)]:min-h-11",k.kind==="failed"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>{a?.(),m(!0),f(Math.floor(t.indexOf(k.entry)/hi)),kd(n,`call:${ta(k.entry)}`,!0),x({id:ta(k.entry)})},children:d(AU[k.kind])}):null]}),u?l("div",{id:g,className:"border-t border-border/50",children:O?v(oe,{children:[t.length>hi?v("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[l("span",{className:"min-w-0 flex-1 tabular-nums",children:d("toolGroup.pageRange",{from:N+1,to:Math.min(N+hi,t.length),count:t.length})}),[{label:d("toolGroup.firstPage"),target:0,disabled:A===0,Icon:Hl},{label:d("toolGroup.previousPage"),target:A-1,disabled:A===0,Icon:Bl},{label:d("toolGroup.nextPage"),target:A+1,disabled:A===P,Icon:yo},{label:d("toolGroup.lastPage"),target:P,disabled:A===P,Icon:Ul}].map(({label:ne,target:Z,disabled:ve,Icon:he})=>l("button",{type:"button","aria-label":ne,disabled:ve,onClick:()=>ee(Z),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:l(he,{"aria-hidden":!0,className:"size-icon-1"})},ne))]}):null,l(OU,{threadKey:n,stateKey:`group-scroll:${o}:${A}`,maxHeight:"min(320px, 50dvh)",children:l("div",{className:"space-y-0.5 py-1",children:B.map(ne=>l(_U,{entry:ne,...Y},ta(ne)))})})]}):v(oe,{children:[de?l("p",{className:"chat-process-meta px-3 pt-3 text-muted-foreground",children:l("span",{children:de})}):null,l(II,{entry:C})]})}):null]})})});$();function kI(e){return e instanceof Error?e.message:void 0}function Pp(e,t){return t!==void 0&&t.length>0?`${e}: ${t}`:e}function LI(e){return{error:(t,o,n)=>{let r=n?.description??kI(o);e(Pp(t,r),"error",r)},warning:(t,o,n)=>{let r=n?.description??kI(o);e(Pp(t,r),"warning",r)},success:(t,o,n)=>{let r=o??n?.description;e(Pp(t,r),"success",r)},info:(t,o,n)=>{let r=o??n?.description;e(Pp(t,r),"info",r)}}}function PI(){let e=Nt();return LI((t,o,n)=>e.notify(t,o,n))}function yi(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function ah(e){let t=e.trimEnd().split(/\r?\n/),o=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;o[0]?.trim().length===0;)o.shift();if(o[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(o.shift();o[0]?.trim().length===0;)o.shift();return o.join(`
|
|
3538
|
+
`)}function RI(e,t,o){let n=o?.maxLines??8,r=ah(e).trimEnd().split(/\r?\n/).map(d=>d.trimEnd()),a=[],s=0,i=!1;for(let d of r){let c=d.trim().length>0;if(c&&s>=n){i=!0;break}a.push(d),c&&(s+=1)}for(;a.length>0&&a.at(-1)?.trim().length===0;)a.pop();return a.length===0?yi(e)??t("proposedPlan.previewUnavailable"):(i&&a.push("","..."),a.join(`
|
|
3539
|
+
`))}function FU(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function EI(e){let t=yi(e);return`${FU(t??"plan")}.md`}function MI(e){return`${e.trimEnd()}
|
|
3540
|
+
`}function AI(e,t){let o=new Blob([t],{type:"text/markdown;charset=utf-8"}),n=URL.createObjectURL(o),r=document.createElement("a");r.href=n,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(n)},0)}function Rp(e,t,o="duration"){let n=`<${o}></${o}>`,r=`<${o}/>`,a=i=>{let d=e.indexOf(i);return d<0?null:[e.slice(0,d),e.slice(d+i.length)]},s=a(n)??a(r);return s===null?v(oe,{children:[e,t]}):v(oe,{children:[s[0],t,s[1]]})}var Ep=1024,NI=pe(function({planMarkdown:t,threadKey:o,rowId:n,environmentId:r,threadRef:a,cwd:s,workspaceRoot:i,onSavePlanToWorkspace:d}){let{t:c}=Ne(),u=PI(),[m,p]=$t(o,`proposed-plan:${n}:expanded`,!1),[f,g]=q(!1),[h,y]=$t(o,`proposed-plan:${n}:save-path`,""),[x,C]=q(!1);Gs(n,f||x);let b=E(!1),L=E(!1);fe(()=>(b.current=!0,()=>{b.current=!1}),[]);let{copyToClipboard:w,isCopied:k}=np({target:"plan",onError:G=>{u.error(c("proposedPlan.couldNotCopy"),G,{description:c("proposedPlan.copyErrorDescription")})}}),I=ho(),T=yi(t)??c("proposedPlan.defaultTitle"),S=t.split(`
|
|
3541
|
+
`).length,P=t.length>900||S>20,A=ah(t),N=P?RI(t,c,{maxLines:10}):null,B=EI(t),O=MI(t),j=()=>{AI(B,O)},U=()=>{w(O)},D=()=>{if(!i){u.error(c("proposedPlan.workspacePathUnavailable"),c("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&y(B.slice(0,Ep)),g(!0)},J=()=>{if(L.current)return;let G=h.trim();if(!(!i||d===null)){if(!G){u.warning(c("proposedPlan.enterWorkspacePath"));return}if(G.length>Ep){u.warning(c("proposedPlan.pathTooLong"));return}L.current=!0,C(!0),(async()=>{try{let M=await d({environmentId:r,workspaceRoot:i,relativePath:G,contents:O});if(!b.current)return;M.ok?(g(!1),u.success(c("proposedPlan.savedToWorkspace"),M.relativePath)):u.error(c("proposedPlan.couldNotSave"),void 0,{description:c("proposedPlan.saveErrorDescription")})}catch(M){b.current&&u.error(c("proposedPlan.couldNotSave"),M,{description:c("proposedPlan.saveErrorDescription")})}finally{L.current=!1,b.current&&C(!1)}})()}};return v("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v("div",{className:"flex min-w-0 items-center gap-2",children:[l(jr,{variant:"secondary",children:c("proposedPlan.badge")}),l("p",{className:"truncate text-sm font-medium text-foreground",children:T})]}),v(Ao,{children:[l(Do,{render:l(K,{"aria-label":c("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:l(Eo,{"aria-hidden":"true",className:"size-4"})}),v(No,{align:"end",children:[l(vo,{onClick:U,children:c(k?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),l(vo,{onClick:j,children:c("proposedPlan.downloadAsMarkdown")}),d!==null?l(vo,{onClick:D,disabled:!i||x,children:c("proposedPlan.saveToWorkspace")}):null]})]})]}),v("div",{className:"mt-4",children:[v("div",{className:V("relative",P&&!m&&"max-h-104 overflow-hidden"),children:[P&&!m?l(wo,{disclosureKey:`proposed-plan:${n}:plan`,text:N??"",cwd:s,threadRef:a,isStreaming:!1}):l(wo,{disclosureKey:`proposed-plan:${n}:plan`,text:A,cwd:s,threadRef:a,isStreaming:!1}),P&&!m?l("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]}),P?l("div",{className:"mt-4 flex justify-center",children:l(K,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!m),children:c(m?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),l(Js,{open:f,onOpenChange:G=>{x||g(G)},children:v(ei,{className:"max-w-xl",children:[v(Hu,{children:[l(ti,{children:c("proposedPlan.saveToWorkspace")}),l(Zs,{children:Rp(c("proposedPlan.pathHint"),l("code",{children:i??c("proposedPlan.theWorkspace")}),"path")})]}),l(kb,{className:"space-y-3",children:v("label",{htmlFor:I,className:"grid gap-1.5",children:[l("span",{className:"text-xs font-medium text-foreground",children:c("proposedPlan.workspacePath")}),l(Vr,{id:I,value:h,maxLength:Ep,onChange:G=>y(G.target.value.slice(0,Ep)),placeholder:B,spellCheck:!1,disabled:x})]})}),v(Bu,{children:[l(K,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:x,children:c("proposedPlan.cancel")}),l(K,{size:"sm",onClick:()=>{J()},disabled:x,children:c(x?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});$();var vi=class extends ur{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 DI(e){return l(xb,{error:e})}$();var sh=qe(void 0);function _I(){return xe(sh)}function OI(e){let t=e.threadRef;if(typeof t=="object"&&t!==null&&"threadId"in t){let n=t.threadId;if(typeof n=="string"&&n.length>0)return n}let o=`${e.environmentId}:`;return e.threadKey.startsWith(o)&&e.threadKey.length>o.length?e.threadKey.slice(o.length):e.threadKey}$();function BI({row:e}){let{workingStepLabel:t,waitingFor:o,liveOutputTokens:n,stall:r,retry:a}=xe(op),{t:s}=Ne(),i=E(null),d=e.compacting?s("activity.compacting"):o==="approval"?s("activity.waitingForApproval"):o==="userInput"?s("activity.waitingForAnswer"):t;return v("div",{className:"border-b border-border/60 pb-2 pt-1",children:[v("div",{className:"working-status 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:[v("span",{ref:i,className:"working-glyph","data-waiting":o!==null?"":void 0,...o===null?{role:"img","aria-label":s("activity.working")}:{"aria-hidden":!0},children:[l("span",{}),l("span",{}),l("span",{})]}),d?l("span",{"data-working-part":"",className:"min-w-0",children:d}):null,e.createdAt?l(KU,{createdAt:e.createdAt,runSegments:e.runSegments,waitSpans:e.waitSpans,glyphRef:i}):null,n!==null?l("span",{"data-working-part":"",children:s("timeline.outputTokenCount",{count:n,value:Sp(n)})}):null]}),a?l(BU,{retry:a}):r&&!e.compacting?l(UU,{stall:r}):null]})}function BU({retry:e}){let{t}=Ne(),o=xe(Fe);return v(xd,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[l(Uu,{children:o.derive.providerRetryMessage(e,(n,r)=>t(n,r))}),o.onInterrupt?l(bd,{children:l(K,{onClick:o.onInterrupt,disabled:o.stopping===!0,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:o.stopping===!0?t("stall.stopping"):t("stall.interrupt")})}):null]})}var HU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function UU({stall:e}){let{t}=Ne(),{onInterrupt:o,stopping:n}=xe(Fe),r=t(HU[e.reason]);return v("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[l("span",{className:"tabular-nums",children:Rp(t("stall.noOutputForLive"),l(zU,{since:e.since}))})," ",l("span",{children:r}),o?l(K,{className:"h-5 px-1.5 text-chat-row",onClick:o,disabled:n===!0,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t(n===!0?"stall.stopping":"stall.interrupt")}):null]})}function $U(e,t,o){let n=Cn(),{workingClock:r}=xe(Fe).derive;H(()=>{let a=()=>{t.current&&(t.current.textContent=UI(e,o,r))};if(a(),!n)return;let s=setInterval(a,1e3);return document.addEventListener("visibilitychange",a),()=>{clearInterval(s),document.removeEventListener("visibilitychange",a)}},[n,e,t,o,r])}function zU({since:e}){let t=E(null),{units:o}=_o(),{workingClock:n}=xe(Fe).derive;return $U(e,t,o),l("span",{className:"timeline-timer tabular-nums",ref:t,children:UI(e,o,n)})}function KU({createdAt:e,waitSpans:t,runSegments:o,glyphRef:n}){let r=E(null),a=Cn(),{units:s}=_o(),{workingClock:i}=xe(Fe).derive,{paused:d}=i({startedAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o});return H(()=>{let c=()=>{let m=FI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s);r.current&&(r.current.textContent=m.text),n.current&&(n.current.dataset.tick=String(m.elapsedSeconds%3))};if(c(),!a||d)return;let u=setInterval(c,1e3);return document.addEventListener("visibilitychange",c),()=>{clearInterval(u),document.removeEventListener("visibilitychange",c)}},[e,n,a,d,o,s,t,i]),l("span",{ref:r,"data-working-part":"",className:"timeline-timer tabular-nums",children:FI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s).text})}function HI(e,t){if(!Number.isFinite(e)||e<0)return t.seconds("0");let o=Math.floor(e/1e3);return o<60?t.seconds(String(o)):wd(o*1e3,t)}function FI(e,t,o){let n=e({startedAt:t.createdAt,nowIso:t.nowIso,waitSpans:t.waitSpans,runSegments:t.runSegments}),r=n.elapsedMs??0,a=Number.isFinite(r)?Math.max(0,Math.floor(r/1e3)):0;return{text:a<1?"":HI(r,o),paused:n.paused,elapsedSeconds:a}}function UI(e,t,o){return HI(o({startedAt:e,nowIso:new Date().toISOString(),waitSpans:void 0,runSegments:void 0}).elapsedMs??0,t)}$();function $I({children:e}){let{t}=z(),[o,n]=q(!1);return v("div",{className:"py-2","data-context-compaction-divider":!0,children:[v("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l("span",{className:"h-px min-w-2 flex-1 bg-border"}),v(K,{size:"xs",variant:"ghost",className:"shrink-0 gap-1.5","aria-expanded":o,title:t("turnOverview.compressionDetails"),onClick:()=>n(r=>!r),children:[l(Oa,{className:"size-3","aria-hidden":!0}),t("turnOverview.compaction"),o?l(Tt,{className:"size-3","aria-hidden":!0}):l(yo,{className:"size-3","aria-hidden":!0})]}),l("span",{className:"h-px min-w-2 flex-1 bg-border"})]}),o?l("div",{className:"mt-1",children:e}):null]})}var zI=pe(function({rowsStore:t,rowId:o}){let n=hw(t,o),r=_I(),a=xe(Fe),{t:s}=Ne();if(n===void 0)return null;let i=OI({threadKey:a.threadKey,environmentId:a.activeThreadEnvironmentId,threadRef:a.threadRef});return l(Gr,{value:n.id,children:l("div",{className:V("relative",n.kind==="message"&&n.message.role==="user"?"pb-6":n.kind==="message"&&n.message.role==="assistant"?n.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":n.kind==="turn-summary"?"pb-2 empty:pb-0":"pb-2"),"data-timeline-row-id":n.id,"data-timeline-row-kind":n.kind,"data-message-id":n.kind==="message"?n.message.id:void 0,"data-message-role":n.kind==="message"?n.message.role:void 0,children:v(vi,{resetKey:n.id,fallback:DI,children:[n.kind==="turn-summary"?v(oe,{children:[r?.renderDeliverableTools?.({turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i}),n.cardAnchor===!0?null:l(uI,{footer:n.footer,copyText:n.copyText,timestampFormat:a.timestampFormat,identity:n.identity}),r?.renderSlot("conversation.chat.turnTail",{turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i})]}):null,n.kind==="tool-group"?l(SI,{entries:n.entries,groupId:n.groupId,threadKey:a.threadKey,workspaceRoot:a.workspaceRoot,onDisclosureChange:()=>a.onProcessDisclosureChange?.(n.id)}):null,n.kind==="work"?l(qU,{row:n}):null,n.kind==="model-switch"?l(Xg,{row:n}):null,n.kind==="turn-identity"?l("div",{"data-turn-identity":n.turnId,role:"group","aria-label":s("timeline.answeredBy",{name:n.badge.providerDisplayName??n.badge.modelLabel}),className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:l(gi,{badge:n.badge,compact:!0})}):null,n.kind==="message"&&n.message.role==="user"?l(Cp,{row:n}):null,n.kind==="message"&&n.message.role==="assistant"?l(HT,{row:n}):null,n.kind==="proposed-plan"?l(GU,{row:n}):null,n.kind==="turn-plan"?l(jU,{row:n}):null,n.kind==="working"?l(BI,{row:n}):null,n.kind==="continuation-check"?l(xT,{row:n}):null]})})})});function qU({row:e}){let t=xe(Fe),o=Cn(),n=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:o});return e.groupedEntries.some(r=>r.sourceActivityKind==="context-compaction")?l($I,{children:n!==void 0?n:e.groupedEntries.map(r=>l("pre",{className:"max-h-72 overflow-auto text-xs whitespace-pre-wrap",children:r.detail??r.label},r.id))}):n!==void 0?l(oe,{children:n}):l("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>l(WU,{entry:r},r.id))})}function WU({entry:e}){let t=xe(Fe),[o,n]=$t(t.threadKey,`work-fallback:${Ip(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,a=e.toolMetadata?.source==="ycodium"?e.toolTitle??e.toolLabel?.name??e.label:e.label;return v("div",{children:[v("button",{type:"button","aria-expanded":o,className:V(li,e.tone==="error"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>n(!o),disabled:r===void 0,children:[l("span",{"aria-hidden":!0,className:V("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")}),l("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:a}),r!==void 0?l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!o&&"-rotate-90")}):null]}),o&&r!==void 0?l("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function GU({row:e}){let t=xe(Fe);return l("div",{className:"min-w-0 px-1 py-0.5",children:l(NI,{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 jU=pe(function({row:t}){let o=xe(Fe),{t:n}=Ne(),[r,a]=$t(o.threadKey,`turn-plan:${t.id}`,!1),{steps:s}=t.turnPlan.plan,i=s.filter(m=>m.status==="completed").length,d=i===s.length,c=s.find(m=>m.status==="inProgress")?.step??s.find(m=>m.status==="pending")?.step??s.at(-1)?.step??n("proposedPlan.badge");return v("div",{className:"min-w-0 px-1 py-0.5",children:[v("button",{type:"button",className:"relative flex w-full min-w-0 cursor-[var(--control-cursor)] items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-control-1 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:[l(r?Tt:yo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),s.length>1?l("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:s.map(m=>l("span",{className:V("h-[3px] w-2.5 rounded-full",m.status==="completed"?"bg-success":m.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},m.step))}):null,l("span",{className:V("min-w-0 truncate",d?"text-muted-foreground/65":"font-medium text-foreground/85"),children:c}),s.length>1?v("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[i,"/",s.length]}):null]}),r?l("div",{className:"mt-0.5 space-y-px pl-6",children:s.map(m=>v("div",{className:"flex items-baseline gap-2 text-ui-sm",children:[l("span",{className:V("w-3 shrink-0 text-center font-mono text-chat-meta",m.status==="completed"?"text-success":m.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:m.status==="completed"?"\u2713":m.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:V("min-w-0",m.status==="completed"?"text-muted-foreground/55":m.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:m.step})]},m.step))}):null]})});$();var VU=e=>{let{latestTurn:t,latestReplyAt:o,continuationCheck:n}=e.getMeta().status;return n!=null?null:o||(t?.state==="completed"?t.completedAt:null)},QU=e=>e.getMeta().status.latestAssistantMessageId??null,XU=e=>e.getMeta().finalAssistantMessageReceived,KI=pe(function({rowsStore:t,useVisibleThreadCompletion:o,viewport:n,viewActive:r,threadKey:a,settledView:s,bottomInset:i}){let d=Wt(t,VU),c=Wt(t,QU),u=Wt(t,XU);return o({viewport:n,viewActive:r,threadKey:a,completedAt:s&&u?d:null,messageId:c,bottomInset:i}),null});$();var YU=[];function JU(){let e=Nt().i18n.usePluginTranslation();return R(t=>{let o=t.attachment;return o===void 0?t.text:o.count===1?o.name:e("forkRelations.attachmentPreview",o)},[e])}function qI({rowsStore:e,derive:t,paneVisible:o,routeThreadKey:n}){let r=R(u=>o?WT(u,t):YU,[t,o]),a=Wt(e,r,GT),s=E(a);s.current=a;let i=$e(n,null,{namespace:"timeline-active-header"}),d=a.at(-1)??null,c=JU();return{turnHeaders:a,turnHeadersRef:s,activeTurnHeaderKeyRef:i,initialTurnHeader:d,headerLabel:c,hasTurnHeaders:d!==null,pinnedTurnHeaderRef:E(null),pinnedTurnHeaderTextRef:E(null)}}function WI({turnHeadersRef:e,activeTurnHeaderKeyRef:t,pinnedTurnHeaderRef:o,pinnedTurnHeaderTextRef:n,headerLabel:r,jumpToTurnSection:a}){let s=E(!1),i=R(()=>{let f=t.current;return f===null?void 0:e.current.find(g=>g.sectionKey===f)},[t,e]),d=R(()=>{let f=o.current;if(!f)return;let g=i();f.dataset.visible=g!==void 0&&(g.inherited||s.current)?"true":"false"},[i,o]),c=R(()=>{let f=i();f&&n.current&&(n.current.textContent=r(f)),d()},[i,d,r,n]),u=R(f=>{f===null||f===t.current||(t.current=f,c())},[t,c]),m=R(f=>{s.current=f,d()},[d]),p=R(()=>{let f=i();f&&a({anchorRowId:f.anchorRowId})},[i,a]);return{applyActiveSection:u,applyActiveStartHidden:m,jumpToActiveTurn:p,writeActiveHeader:c}}function GI({paneVisible:e,turnHeaders:t,writeActiveHeader:o}){fe(()=>{e&&o()},[e,t,o])}$();function ZU(e,t,o){let n=o-t;if(Math.abs(n)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+n));return Math.abs(r-e.scrollTop)<1?null:r}function jI(e){let{viewport:t,anchor:o,row:n,scrollToOffset:r}=e,a=o.getBoundingClientRect().top,s=!0,i=null,d=()=>{if(i=null,!s||!o.isConnected||!t.contains(o))return;let m=ZU(t,a,o.getBoundingClientRect().top);m!==null&&r(m),a=o.getBoundingClientRect().top},c=()=>{s&&i===null&&(i=requestAnimationFrame(d))},u=typeof ResizeObserver>"u"?null:new ResizeObserver(c);return u?.observe(n),c(),{schedule:c,stop:()=>{s=!1,u?.disconnect(),i!==null&&cancelAnimationFrame(i),i=null}}}function VI(e){return Ge(e,!1,{namespace:"timeline-disclosure-reading"})}function QI({routeThreadKey:e,listRef:t,liveFollowEnabled:o,onDisclosureNavigation:n,rowsStore:r,setDisclosureReading:a}){let s=Xo(e,null),i=Xo(e,null),d=Xo(e,null);H(()=>()=>{i.current?.stop()},[]);let c=R(()=>{i.current?.stop(),i.current=null,s.current=null,a(!1)},[s,i,a]),u=R(f=>{n(),s.current=f,a(!0),i.current?.stop();let g=t.current?.node??null;if(!g)return;let h=Array.from(g.querySelectorAll("[data-timeline-row-id]")).find(x=>x.dataset.timelineRowId===f);if(!h)return;let y=d.current;i.current=jI({viewport:g,row:h,anchor:y&&h.contains(y)?y:h,scrollToOffset:x=>{g.scrollTop=x}})},[n]),m=$e(e,o,{namespace:"timeline-live-follow-previous"});fe(()=>{o&&!m.current&&c(),m.current=o},[o,c]);let p=R(f=>{let g=r.getRows().find(h=>h.id===f||h.kind==="work"&&h.groupedEntries.some(y=>y.id===f)||h.kind==="tool-group"&&h.entries.some(y=>y.id===f));u(g?.id??f)},[r,u]);return{disclosureButtonRef:d,releaseDisclosureAnchor:c,onProcessDisclosureChange:p}}$();var ih=1e4;function XI({routeThreadKey:e,routeThreadKeyRef:t,pagingBlockedRef:o,pagingBlockedByInteraction:n,loadEarlier:r,loadLater:a,hasHiddenOlder:s,visibleTurnSections:i,capturePrependAnchor:d,revealWindowRef:c,pendingNetworkPrependRef:u,turnSectionsRef:m}){let p=R(()=>{d(),c.current.revealOlder()},[d]),f=E(p);f.current=p;let g=E(s);g.current=s;let h=E(null),y=R(()=>{if(o.current||t.current!==e||r===null||r.loading)return;let C=i[0]?.key;C!==void 0&&(d(C),u.current={firstMountedSectionKey:C,loadingObserved:!1,sectionsWhileLoading:m.current,until:Date.now()+ih},r.onLoadEarlier())},[d,r,u,e,i]);h.current=r===null||r.loading||n?null:y;let x=R(()=>{o.current||t.current!==e||(d(),a?.onLoadLater())},[d,a,e]);return{revealOlderTurns:p,revealOlderTurnsRef:f,hasHiddenOlderRef:g,loadEarlierRef:h,handleLoadEarlier:y,handleLoadLater:x}}$();$();var Ya=3,lh=Ya;function YI(e){let[t,o]=Ge(e,Ya,{namespace:"timeline-reveal-window"}),n=R(()=>{o(i=>i+lh)},[o]),r=R(i=>{o(d=>i>d?i:d)},[o]),a=R(()=>{o(Ya)},[o]),s=R(i=>{o(d=>Math.min(d,Math.max(Ya,i)))},[o]);return{revealedCount:t,revealOlder:n,revealAtLeast:r,compactTo:s,reset:a}}$();function ZI(e){return e!==null&&"tagName"in e&&"closest"in e}function er(e){return ZI(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function eS(e){return ZI(e)&&e.closest('button, a[href], summary, [role="button"], [role="menuitem"]')!==null}function Bd(e,t){if(!/^[1-9]$/.test(e))return null;let o=Number(e)-1;return o<t?o:null}function JI(e,t){let o=e.findIndex(n=>n.decision===t);return o===-1?null:{type:"respond",index:o}}function tS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return JI(t,"accept");case"Escape":return JI(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let o=Bd(e.key,t.length);return o===null?null:{type:"respond",index:o}}}}var Ci="h-4 min-w-3 bg-transparent px-0 text-ui-xs tabular-nums text-current opacity-70 pointer-coarse:hidden";var Hd=600;function dh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let o=e;o&&o!==t;){if(o instanceof HTMLElement&&o.scrollHeight>o.clientHeight&&o.scrollTop>0)return!0;o=o.parentElement}return!1}function oS({routeThreadKey:e,routeThreadKeyRef:t,paneVisibleRef:o,pagingBlockedRef:n,scrollRestorePendingRef:r,listRef:a,topRevealArmedRef:s,hasHiddenOlderRef:i,revealOlderTurnsRef:d,loadEarlierRef:c,networkPrependAwaitingUserNavigationRef:u,networkPrependScrollTopRef:m,topRevealTouchStartYRef:p,topRevealUserNavigationFrameRef:f}){let g=R(C=>{if(C>Hd){s.current=!0;return}if(s.current){if(s.current=!1,i.current){d.current();return}c.current?.()}},[s]),h=R(()=>{u.current&&(u.current=!1,m.current=null,s.current=!0)},[u,m,s]),y=R(()=>{if(f.current!==null||n.current||!o.current||t.current!==e||r.current)return!1;let C=a.current?.measure();return!C||C.scroll>2||C.contentLength-C.scrollLength-C.scroll<=2||!i.current&&c.current===null?!1:(u.current=!1,m.current=null,s.current=!0,f.current=requestAnimationFrame(()=>{f.current=null}),g(C.scroll),!0)},[g,u,m,e,r,s,f]);return{maybeRevealOlderOnScroll:g,rearmNetworkPrependForUserNavigation:h,continueTopRevealAtTopForUserNavigation:y,contentGestureHandlers:{onWheel:C=>{C.defaultPrevented||C.deltaY>=0||er(C.target)||dh(C.target,a.current?.node??null)||y()},onTouchStartCapture:C=>{p.current=C.touches[0]?.clientY??null},onTouchMove:C=>{let b=C.touches[0],L=p.current;C.defaultPrevented||er(C.target)||dh(C.target,a.current?.node??null)||b===void 0||L===null||b.clientY<=L||y()&&(p.current=null)},onTouchEndCapture:()=>{p.current=null},onTouchCancelCapture:()=>{p.current=null},onKeyDown:C=>{C.defaultPrevented||C.repeat||C.metaKey||C.ctrlKey||C.altKey||C.shiftKey||er(C.target)||dh(C.target,a.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(C.key)||y()}}}}function nS({paneVisible:e,paneVisibleRef:t,loadLater:o,liveFollowEnabled:n,disclosureReading:r,restoreInProgress:a,loadEarlier:s,scrollNode:i,revealWindow:d,turnSections:c,followEnabledRef:u,compactionStateRef:m,compactionRef:p,prependAnchorRef:f,interactionRowsRef:g,revealWindowRef:h,topRevealArmedRef:y,capturePrependAnchor:x}){let C=e&&o===null&&n&&!r&&!a;return u.current=C,m.current={followEnabled:C,restoreInProgress:a,loadEarlier:s},H(()=>{if(!i||!e)return;let b=lw({root:i,minimumCount:Ya,keepAbovePx:Hd,canCompact:()=>{let L=m.current,w=f.current;return L.followEnabled&&g.current.length===0&&!L.restoreInProgress&&!L.loadEarlier?.loading&&!(w&&w.until>Date.now())&&h.current.revealedCount>Ya},onCompact:L=>{y.current=!0,x(),h.current.compactTo(L)}});return p.current=b,()=>{b.disconnect(),p.current=null}},[x,e,i]),H(()=>{p.current?.schedule()},[C,s?.loading,d.revealedCount,c.length]),H(()=>{if(!i||!e||typeof ResizeObserver>"u")return;let b=()=>{if(!t.current||!u.current)return;let k=i.scrollHeight-i.clientHeight;Math.abs(i.scrollTop-k)>.5&&(i.scrollTop=k)},L=new ResizeObserver(b);L.observe(i);let w=i.firstElementChild;return w&&L.observe(w),()=>L.disconnect()},[e,i]),{followEnabled:C}}$();function rS({hasHiddenOlder:e,loadEarlier:t,pagingBlockedByInteraction:o,topFadeEnabled:n,revealOlderTurns:r,handleLoadEarlier:a}){return W(()=>e?l(sI,{onReveal:r,fade:n}):t!==null?l(rI,{loading:t.loading,blocked:o,onLoadEarlier:a,fade:n}):n?nI:oI,[a,e,t,o,r,n])}$();$();function aS(e,t,o){let n=$e(e,o,{namespace:"timeline-last-requested-reveal"});return fe(()=>{n.current=o}),t&&o>=n.current}function sS(e,t,o,n){if(t<e.revealedCount)e.compactTo(t);else{if(t<=e.revealedCount)return;o?requestAnimationFrame(()=>setTimeout(()=>{n()&&e.revealAtLeast(t)},0)):e.revealAtLeast(t)}}function iS(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"}var e$=new Set;function lS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,scrollSnapshotRef:a,structure:s,loadLater:i,loadEarlier:d,liveFollowEnabled:c,disclosureReading:u,nativeSelectionRef:m,interactionRowsRef:p}){let f=s.sections,g=YI(e),h=E(g);h.current=g;let y=$e(e,!0,{namespace:"timeline-top-reveal-armed"}),x=$e(e,!1,{namespace:"timeline-network-prepend-awaiting-navigation"}),C=E(null),b=E(null);fe(()=>()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null)},[e,o]);let L=$e(e,null,{namespace:"timeline-network-prepend-scroll-top"}),w=$e(e,e$,{namespace:"timeline-mounted-section-keys",limit:3}),k=Xo(e,null),I=k.current,T=I===null?-1:f.findIndex(F=>F.key===I.firstMountedSectionKey),S=T>0?f.length-Math.max(0,T-lh):g.revealedCount,P=T>0?S:g.revealedCount,A=i!==null||!c||u||m.current||p.current.length>0,N=aS(e,c,P),B=nw(f.map(F=>F.key),w.current,P,A||N),{startIndex:O,hasHiddenOlder:j}=fw(f.length,B),U=W(()=>f.slice(O),[O,f]),D=I!==null&&T>0&&O<T,J=E(f);J.current=f,fe(()=>{if(!o)return;if(w.current=new Set(U.map(ee=>ee.key)),I!==null){let ee=iS(I,{prefixMounted:D,loading:d===null?null:d.loading,sections:f,now:Date.now()});ee!=="waiting"&&(k.current=null),ee==="mounted"&&(x.current=!0)}let F=e;sS(h.current,B,!A,()=>t.current===F)},[x,d,o,I,D,k,w,A,B,e,f,U]);let G=Xo(e,null),M=R((F=null)=>{if(!n.current)return;let ee=r.current?.node;ee&&(G.current={scrollHeight:ee.scrollHeight,scrollTop:ee.scrollTop,row:r.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:F,until:Date.now()+ih})},[G]),X=R(()=>{let F=G.current;if(F===null||F.firstMountedSectionKey===null||Date.now()>F.until)return;let ee=r.current?.node;if(!ee)return;let Y=a.current;F.scrollHeight=ee.scrollHeight,F.scrollTop=ee.scrollTop,F.row=Y?.threadKey===e?Y.anchor:null},[G,e,a]);return fe(()=>{if(!o)return;let F=G.current;if(!F)return;if(Date.now()>F.until){G.current=null;return}if(F.firstMountedSectionKey!==null&&k.current!==null)return;G.current=null;let ee=r.current?.node;if(ee){if(F.row){xp(ee,F.row.rowId);let Y=r.current?.measure()?.topOf(F.row.rowId);Y!=null&&(ee.scrollTop=Y+F.row.offsetPx)}else ee.scrollTop=F.scrollTop+(ee.scrollHeight-F.scrollHeight);D&&(L.current=ee.scrollTop)}},[L,o,I,D,O,s]),{revealWindow:g,revealWindowRef:h,topRevealArmedRef:y,networkPrependAwaitingUserNavigationRef:x,topRevealTouchStartYRef:C,topRevealUserNavigationFrameRef:b,networkPrependScrollTopRef:L,pendingNetworkPrependRef:k,hasHiddenOlder:j,visibleTurnSections:U,turnSectionsRef:J,prependAnchorRef:G,capturePrependAnchor:M,refreshPendingPrependAnchor:X}}$();function t$(e,t){let o=c=>c.replace(/\s+/g,""),n=o(t.text);if(n.length===0)return null;let r=(c,u)=>e.slice(Math.max(0,c-t.prefix.length),c)===t.prefix&&e.slice(u,u+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&o(e.slice(t.start,t.end))===n&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Id(t.text).trim(),s=[];for(let c=e.indexOf(a);c>=0;c=e.indexOf(a,c+1))s.push(c);let i=s.filter(c=>r(c,c+a.length)),d=i.length===1?i[0]:i.length===0&&s.length===1?s[0]:null;return d===null?null:{start:d,end:d+a.length}}function cS(e,t){let o=e.querySelector("[data-assistant-quote-body]")??Qu(e);if(o===null)return null;let n=[],r="",a=document.createTreeWalker(o,NodeFilter.SHOW_TEXT);for(let u=a.nextNode();u;u=a.nextNode()){let m=u.data;for(let p=0;p<m.length;p+=1){let f=/\s/.test(m[p]);f&&r.endsWith(" ")||(r+=f?" ":m[p],n.push({node:u,offset:p}))}}let s=t$(r,t);if(s===null)return null;let i=n[s.start],d=n[s.end-1];if(!i||!d)return null;let c=document.createRange();return c.setStart(i.node,i.offset),c.setEnd(d.node,d.offset+1),c}var ch="assistant-quote",dS=2400;function uS(e){let t=globalThis.CSS?.highlights,o=globalThis.Highlight;if(t&&o){let r=new o(e);t.set(ch,r),setTimeout(()=>{t.get(ch)===r&&t.delete(ch)},dS);return}let n=document.getSelection();n&&(n.removeAllRanges(),n.addRange(e),setTimeout(()=>{let r=n.rangeCount>0?n.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&n.removeAllRanges()},dS))}var o$=20;function pS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,derive:n,rowsStore:r,structure:a,loadEarlier:s,loadEarlierRef:i,listRef:d,revealWindowRef:c,turnSectionsRef:u,scrollToRowWithRevealRef:m,onManualNavigation:p,releaseDisclosureAnchor:f,revealMessageRequest:g,onRevealMessageHandled:h,revealQuoteRequest:y,onRevealQuoteDone:x,messageReveal:C=null,onMessageRevealMissing:b,loadLater:L=null,onReturnToLatest:w,restoringHistory:k=!1,pagingBlockedByInteraction:I=!1,revealTurnRequest:T}){let S=E(!0);H(()=>(S.current=!0,()=>{S.current=!1}),[]);let P=E(o);P.current=o;let A=E(C?.request?.id??null);A.current=C?.request?.id??null;let N=E(null);H(()=>{let U=C?.request;if(!U||!C||!o)return;N.current?.id!==U.id&&(N.current={id:U.id,prepared:!1,latestRequested:!1,done:!1});let D=N.current;if(D.done)return;let G=r.getRows().some(X=>X.id===U.messageId);if(!D.prepared){if(C.pending||k||s?.loading||L?.loading||I)return;if(!G&&L!==null&&!C.unavailable){D.latestRequested||(D.latestRequested=!0,w?.());return}D.prepared=!0}let M=C.advance({found:G,ready:!C.pending&&!k,loading:s?.loading===!0,blocked:I,hasEarlier:!C.unavailable&&s!==null,windowKey:a.rowIds[0]??"empty"});if(M!=="wait"){if(f(),p(),M==="earlier"){i.current?.();return}if(D.done=!0,M==="missing"){b?.(),C.onHandled(U.id);return}c.current.revealAtLeast(ja(u.current,U.messageId,c.current.revealedCount)),requestAnimationFrame(()=>{if(S.current&&!(t.current!==e||N.current!==D)){if(!P.current||A.current!==U.id){D.done=!1;return}m.current(U.messageId,24),C.onHandled(U.id)}})}},[C,o,a,s,L,k,I,w,r,e,p,f,b]);let B=R(U=>{f(),p(),c.current.revealAtLeast(ja(u.current,U.anchorRowId,c.current.revealedCount));let D=e;requestAnimationFrame(()=>{t.current===D&&m.current(U.anchorRowId,24)})},[p,f,e]),O=E(void 0);H(()=>{if(!o||!T||O.current===T)return;let D=a.sections.find(J=>J.turnId===T.turnId)?.rowIds[0];D&&(O.current=T,B({anchorRowId:D}),T.onHandled?.())},[o,T,a,B]),H(()=>{if(g===null||!o)return;f(),p();let U=n.resolveToolGroupRevealRowId(r.getRows(),g.rowId);c.current.revealAtLeast(ja(u.current,U,c.current.revealedCount));let D=requestAnimationFrame(()=>{t.current===e&&(m.current(U,24),h?.())});return()=>cancelAnimationFrame(D)},[g,o,p,f,h,n,e,r]);let j=E(null);return H(()=>{if(y===null||!o)return;let U=j.current;if((U===null||U.request!==y)&&(U={request:y,pages:0,done:!1},j.current=U),U.done)return;let{quote:D}=y,J=D.messageId;if(!r.getRows().some(G=>G.id===J)){if(s?.loading)return;let G=i.current;if(G!==null&&U.pages<o$){U.pages+=1,G();return}U.done=!0,x?.("message-missing");return}U.done=!0,f(),p(),c.current.revealAtLeast(ja(u.current,J,c.current.revealedCount)),requestAnimationFrame(()=>{t.current===e&&(m.current(J,24),requestAnimationFrame(()=>{let G=d.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(J)}"]`),M=G?cS(G,D):null,X=d.current?.node;if(M&&X){let F=M.getBoundingClientRect().top-X.getBoundingClientRect().top-X.clientHeight/3;d.current?.scrollToOffset(X.scrollTop+F)}M&&uS(M),x?.(M?"found":"passage-missing")}))})},[y,o,a,s,r,x,p,f,e]),{jumpToTurnSection:B}}$();function mS({timestampFormat:e,routeThreadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,environmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:P,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:j,SessionMessageCard:U}){let D=W(()=>cp(s),[s]);return W(()=>({timestampFormat:e,threadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,skillIndex:D,activeThreadEnvironmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:P,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:j,SessionMessageCard:U}),[e,t,o,n,r,a,s,D,i,d,c,u,m,p,f,g,h,y,x,C,b,L,w,k,I,T,S,P,A,N,B,O,j,U])}$();var n$=200;function fS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,derive:a,contentInsetEndAdjustment:s,onIsAtEndChange:i,loadLater:d,restoreInProgress:c,rowCount:u,followingEndRef:m,scrollRestorePendingRef:p,laterLoadArmedRef:f,pagingBlockedRef:g,lastScrollAnchorSaveAtRef:h,networkPrependAwaitingUserNavigationRef:y,networkPrependScrollTopRef:x,cacheScrollSnapshot:C,persistScrollSnapshot:b,refreshPendingPrependAnchor:L,maybeRevealOlderOnScroll:w,rearmNetworkPrependForUserNavigation:k,handleLoadLater:I}){let T=R(()=>{if(!n.current||t.current!==e)return;let S=r.current?.measure();if(!S||p.current)return;C(S);let P=x.current;y.current&&P!==null&&Math.abs(S.scroll-P)>.5&&k(),L();let A=a.resolveIsAtEnd({contentLength:S.contentLength,scroll:S.scroll,scrollLength:S.scrollLength},s);A!==void 0&&i(d===null&&A);let N=S.contentLength-S.scrollLength-S.scroll;!m.current&&N>2&&w(S.scroll),N>Hd?f.current=!0:f.current&&d&&!d.loading&&!g.current&&(f.current=!1,I());let B=Date.now();B-h.current>=n$&&(h.current=B,b())},[C,s,a,w,i,b,L,e,d,f,I,y,x,k,p]);return H(()=>{if(!o)return;let S=requestAnimationFrame(T);return()=>cancelAnimationFrame(S)},[T,o,c,u]),{handleScroll:T}}$();function gS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,revealRequestRef:r,listRef:a,scrollSnapshotRef:s,rowCount:i,structure:d,loadScrollAnchor:c,loadLater:u,restoringHistory:m,onManualNavigation:p,onIsAtEndChange:f,revealWindowRef:g,turnSectionsRef:h,followingEndRef:y,followEnabledRef:x,compactionStateRef:C,scrollRestorePendingRef:b,persistScrollSnapshot:L,captureFinalScrollSnapshot:w}){let k=$e(e,"cold",{namespace:"timeline-scroll-restore"});if(k.current===void 0||k.current==="cold"){let O=c(e);k.current=k.current==="cold"&&O===null?null:{anchor:O}}let[,I]=Na(O=>O+1,0),T=E(()=>{}),S=E(w);S.current=w;let P=$e(e,0,{namespace:"timeline-last-anchor-save"}),A=m||k.current!==null,N=k.current;b.current=A,fe(()=>{if(o)return()=>{t.current!==e?L():w(),k.current=void 0}},[o,e]),fe(()=>{if(!o||N==null)return;let O=N,j=()=>{let X=s.current,F=a.current?.node?.clientWidth;X?.threadKey===e&&F!==void 0&&(s.current={...X,viewportWidth:F}),k.current=null,b.current=!1,I()};if(r.current!==null){j();return}let U=null,D=null,J=()=>{!n.current||t.current!==e||(a.current?.scrollToEnd(),j(),y.current=u===null,x.current=u===null,C.current={...C.current,followEnabled:!0,restoreInProgress:!1},f(u===null))},G=O.anchor,M=G!==null&&h.current.some(X=>X.rowIds.includes(G.rowId));return G===null?U=requestAnimationFrame(J):M?U=requestAnimationFrame(()=>{!n.current||t.current!==e||(p(),g.current.revealAtLeast(ja(h.current,G.rowId,g.current.revealedCount)),D=requestAnimationFrame(()=>{!n.current||t.current!==e||(T.current(G.rowId,-G.offsetPx),j())}))}):i>0&&!m&&(U=requestAnimationFrame(J)),()=>{U!==null&&cancelAnimationFrame(U),D!==null&&cancelAnimationFrame(D)}},[c,u,f,p,o,N,e,i,m,d]),fe(()=>{if(!o||typeof ResizeObserver>"u")return;let O=a.current?.node;if(!O)return;let j=!0,U=O.clientWidth,D=new ResizeObserver(()=>{if(!j||!n.current||t.current!==e)return;let J=O.clientWidth;if(!(J>0)||J===U)return;U=J;let G=s.current;G===null||G.threadKey!==e||(s.current={...G,viewportWidth:J},!(b.current||y.current||G.anchor===null)&&(T.current(G.anchor.rowId,-G.anchor.offsetPx),S.current()))});return D.observe(O),()=>{j=!1,D.disconnect()}},[o,e]);let B=R((O,j)=>{if(!n.current)return;let U=a.current?.node;U&&(xp(U,O),a.current?.scrollToRow(O,{viewOffset:j}))},[]);return T.current=B,{restoreInProgress:A,lastScrollAnchorSaveAtRef:P,scrollToRowWithRevealRef:T}}$();function hS({routeThreadKey:e,listRef:t,followingEndRef:o,scrollRestorePendingRef:n,paneVisible:r,rowCount:a,derive:s,contentInsetEndAdjustment:i,saveScrollAnchor:d}){let c=$e(e,null,{namespace:"timeline-scroll-snapshot"}),u=$e(e,null,{namespace:"timeline-last-measured-scroll"}),m=R((g,h=o.current)=>{if(g.scrollLength<=0)return;let y=t.current?.node?.clientWidth,x=c.current;y!==void 0&&y>0&&x?.viewportWidth!==void 0&&x.viewportWidth>0&&y!==x.viewportWidth||(u.current=g.scroll,c.current={threadKey:e,anchor:ZT({measurement:g,followingEnd:h}),...y===void 0?{}:{viewportWidth:y}})},[o,u,t,e,c]),p=R(()=>{let g=c.current;g&&d(g.threadKey,g.anchor)},[d,c]),f=R(()=>{if(!r||n.current)return;if(a===0){p();return}let g=t.current?.measure();if(g&&g.scrollLength>0){let h=u.current,y=h!==null&&Math.abs(g.scroll-h)>.5;m(g,o.current&&!(y&&s.resolveIsAtEnd(g,i)===!1)),p()}},[m,i,s,o,u,r,p,n,a]);return{scrollSnapshotRef:c,cacheScrollSnapshot:m,persistScrollSnapshot:p,captureFinalScrollSnapshot:f}}var uh="ycodium-select-all-copy";$();function r$(e,t){let o=e.detail;o===null||typeof o!="object"||!("text"in o)||(o.text=t)}function a$(e,t){let o=n=>{r$(n,t())};return e.addEventListener(uh,o),()=>e.removeEventListener(uh,o)}function yS({rowsStore:e}){let t=E(e);t.current=e;let o=E(null);return H(()=>{let n=o.current?.closest("[data-select-all-scope]");if(n!=null)return a$(n,()=>t.current.getMeta().exportApi.markdown())},[]),l("span",{ref:o,hidden:!0})}var vS=[],CS=()=>{},xS=()=>{};var bS=pe(function({derive:t,rowsStore:o,data:n,target:r,threadKey:a,threadRef:s,environmentId:i,onInterrupt:d=null,stopping:c=!1,onRespondToDecision:u=null,onCancelScheduledWake:m=null,agentPanelModel:p,onOpenAgents:f=CS,onOpenFileDiff:g,onForkFromUserMessage:h,onRestoreUnsentMessage:y=null,selfUserId:x=null,ownsUnsignedMessages:C=!0,onImageExpand:b,onAttachmentDocumentOpen:L,revealTurnRequest:w,markdownCwd:k,resolvedTheme:I,timestampFormat:T,workspaceRoot:S,skills:P=vS,onRowsChange:A,contentInsetEndAdjustment:N,liveFollowEnabled:B,awaitingUserDecision:O=!1,onIsAtEndChange:j,onManualNavigation:U,onDisclosureNavigation:D=U,topFadeEnabled:J=!1,scrollerRef:G,loadEarlier:M=null,loadLater:X=null,restoringHistory:F=!1,pagingBlockedByInteraction:ee=!1,onReturnToLatest:Y=null,onVisibleTurnRangeChange:ae=null,revealMessageRequest:te=null,messageReveal:de=null,onMessageRevealMissing:ge,onRevealMessageHandled:ne,revealQuoteRequest:Z=null,onRevealQuoteDone:ve,renderWorkGroup:he,renderToolCallDetail:Ae,loadScrollAnchor:De,saveScrollAnchor:je,useVisibleThreadCompletion:ot,onSavePlanToWorkspace:me,paneActive:Me,onTurnNavigatorChange:ue,declaredToolTitles:ce,threadSwitchStage:Ze=null}){let pt=Wt(o,lI),ze=Cn(),et=E(ze);et.current=ze;let Et=E(te);Et.current=te;let[ft,Ct]=VI(a),gt=E(a);gt.current=a;let Dt=E(ee);Dt.current=ee;let Mt=$e(a,!0,{namespace:"timeline-following-end"});Mt.current=X===null&&B;let se=$e(a,!1,{namespace:"timeline-scroll-restore-pending"}),Le=$e(a,N,{namespace:"timeline-content-inset"}),be=E(null),Xe=Xo(a,[]),xt=Xo(a,!1),tt=E(null),It=E(null),po=R(()=>Xe.current,[Xe]),Ko=R(ht=>{Xe.current=ht,tt.current?.(),It.current?.schedule()},[Xe]),Qt=R(ht=>{xt.current=ht,It.current?.schedule()},[xt]),hn=R(ht=>{ht!==null&&(be.current=ht),G(ht)},[G]);fe(()=>{YT({timeline:be.current,previousOverlayHeight:Le.current,overlayHeight:N,followingEnd:ze&&X===null&&B&&!ft}),Le.current=N},[N,ft,B,X,ze]);let{disclosureButtonRef:At,releaseDisclosureAnchor:St,onProcessDisclosureChange:bt}=QI({routeThreadKey:a,listRef:be,liveFollowEnabled:B,onDisclosureNavigation:D,rowsStore:o,setDisclosureReading:Ct}),mo=dI(X!==null,ze),kt=tp(o),_t=kt.sections,Xt=kt.rowIds.length,nt=W(()=>si(o),[kt,o]),{scrollSnapshotRef:lt,cacheScrollSnapshot:Bt,persistScrollSnapshot:Ht,captureFinalScrollSnapshot:Yt}=hS({routeThreadKey:a,listRef:be,followingEndRef:Mt,scrollRestorePendingRef:se,paneVisible:ze,rowCount:Xt,derive:t,contentInsetEndAdjustment:N,saveScrollAnchor:je}),{revealWindow:qo,revealWindowRef:fo,topRevealArmedRef:go,networkPrependAwaitingUserNavigationRef:Jt,topRevealTouchStartYRef:Hn,topRevealUserNavigationFrameRef:Ce,networkPrependScrollTopRef:Ue,pendingNetworkPrependRef:rt,hasHiddenOlder:Lt,visibleTurnSections:wt,turnSectionsRef:Ot,prependAnchorRef:Ro,capturePrependAnchor:nn,refreshPendingPrependAnchor:Fr}=lS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,scrollSnapshotRef:lt,structure:kt,loadLater:X,loadEarlier:M,liveFollowEnabled:B,disclosureReading:ft,nativeSelectionRef:xt,interactionRowsRef:Xe}),{revealOlderTurns:ka,revealOlderTurnsRef:As,hasHiddenOlderRef:lg,loadEarlierRef:ru,handleLoadEarlier:dg,handleLoadLater:au}=XI({routeThreadKey:a,routeThreadKeyRef:gt,pagingBlockedRef:Dt,pagingBlockedByInteraction:ee,loadEarlier:M,loadLater:X,hasHiddenOlder:Lt,visibleTurnSections:wt,capturePrependAnchor:nn,revealWindowRef:fo,pendingNetworkPrependRef:rt,turnSectionsRef:Ot}),xl=E(!1),bl=E({followEnabled:!1,restoreInProgress:!1,loadEarlier:M}),{restoreInProgress:yn,lastScrollAnchorSaveAtRef:cg,scrollToRowWithRevealRef:wl}=gS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,revealRequestRef:Et,listRef:be,scrollSnapshotRef:lt,rowCount:Xt,structure:kt,loadScrollAnchor:De,loadLater:X,restoringHistory:F,onManualNavigation:U,onIsAtEndChange:j,revealWindowRef:fo,turnSectionsRef:Ot,followingEndRef:Mt,followEnabledRef:xl,compactionStateRef:bl,scrollRestorePendingRef:se,persistScrollSnapshot:Ht,captureFinalScrollSnapshot:Yt}),{jumpToTurnSection:Tl}=pS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,derive:t,rowsStore:o,structure:kt,loadEarlier:M,loadEarlierRef:ru,listRef:be,revealWindowRef:fo,turnSectionsRef:Ot,scrollToRowWithRevealRef:wl,onManualNavigation:U,releaseDisclosureAnchor:St,revealMessageRequest:te,messageReveal:de,onMessageRevealMissing:ge,loadLater:X,onReturnToLatest:Y,restoringHistory:yn||Ze!==null,pagingBlockedByInteraction:ee,onRevealMessageHandled:ne,revealQuoteRequest:Z,onRevealQuoteDone:ve,revealTurnRequest:w}),{turnHeaders:su,turnHeadersRef:ug,activeTurnHeaderKeyRef:iu,initialTurnHeader:lu,headerLabel:du,hasTurnHeaders:pg,pinnedTurnHeaderRef:Il,pinnedTurnHeaderTextRef:Un}=qI({rowsStore:o,derive:t,paneVisible:ze,routeThreadKey:a}),[cu,Ns]=q(null),[Sl,Ds]=q(null),{followEnabled:mg}=nS({paneVisible:ze,paneVisibleRef:et,loadLater:X,liveFollowEnabled:B,disclosureReading:ft,restoreInProgress:yn,loadEarlier:M,scrollNode:Sl,revealWindow:qo,turnSections:_t,followEnabledRef:xl,compactionStateRef:bl,compactionRef:It,prependAnchorRef:Ro,interactionRowsRef:Xe,revealWindowRef:fo,topRevealArmedRef:go,capturePrependAnchor:nn}),uu=kt.rowIds.at(-1)??null;H(()=>{A?.(uu)},[uu,A,a]);let kl=$e(a,!0,{namespace:"timeline-later-load-armed"}),{maybeRevealOlderOnScroll:Ll,rearmNetworkPrependForUserNavigation:pu,continueTopRevealAtTopForUserNavigation:mu,contentGestureHandlers:fg}=oS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisibleRef:et,pagingBlockedRef:Dt,scrollRestorePendingRef:se,listRef:be,topRevealArmedRef:go,hasHiddenOlderRef:lg,revealOlderTurnsRef:As,loadEarlierRef:ru,networkPrependAwaitingUserNavigationRef:Jt,networkPrependScrollTopRef:Ue,topRevealTouchStartYRef:Hn,topRevealUserNavigationFrameRef:Ce}),{applyActiveSection:fu,applyActiveStartHidden:_s,jumpToActiveTurn:gu,writeActiveHeader:hu}=WI({turnHeadersRef:ug,activeTurnHeaderKeyRef:iu,pinnedTurnHeaderRef:Il,pinnedTurnHeaderTextRef:Un,headerLabel:du,jumpToTurnSection:Tl}),La=dw({root:Sl,topInsetPx:Yg,onActiveSectionChange:fu,onActiveStartHiddenChange:_s,active:ze}),Pa=W(()=>ow(_t),[_t]),gg=sw({root:Sl,inputKey:a,visible:ze,index:Pa,topInset:pg?Yg:0,bottomInset:N,interactionRows:po,onRangeChange:ae,onSelectionChange:Qt});tt.current=gg,H(()=>{if(!ze){Ht();return}let ht=requestAnimationFrame(()=>{if(!et.current)return;let Fs=be.current?.node;Fs&&xl.current&&(Fs.scrollTop=Fs.scrollHeight-Fs.clientHeight),La.refresh()});return()=>cancelAnimationFrame(ht)},[Ht,La,ze]),GI({paneVisible:ze,turnHeaders:su,writeActiveHeader:hu});let Os=rS({hasHiddenOlder:Lt,loadEarlier:M,pagingBlockedByInteraction:ee,topFadeEnabled:J,revealOlderTurns:ka,handleLoadEarlier:dg}),{handleScroll:yu}=fS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,derive:t,contentInsetEndAdjustment:N,onIsAtEndChange:j,loadLater:X,restoreInProgress:yn,rowCount:Xt,followingEndRef:Mt,scrollRestorePendingRef:se,laterLoadArmedRef:kl,pagingBlockedRef:Dt,lastScrollAnchorSaveAtRef:cg,networkPrependAwaitingUserNavigationRef:Jt,networkPrependScrollTopRef:Ue,cacheScrollSnapshot:Bt,persistScrollSnapshot:Ht,refreshPendingPrependAnchor:Fr,maybeRevealOlderOnScroll:Ll,rearmNetworkPrependForUserNavigation:pu,handleLoadLater:au}),vu=n.useToolPresentation??xS,Ra=mS({timestampFormat:T,routeThreadKey:a,threadRef:s,markdownCwd:k,resolvedTheme:I,workspaceRoot:S,skills:P,environmentId:i,onForkFromUserMessage:h,onRestoreUnsentMessage:y,selfUserId:x,ownsUnsignedMessages:C,onImageExpand:b,onAttachmentDocumentOpen:L,onOpenFileDiff:g,onProcessDisclosureChange:bt,agentPanelModel:p,onOpenAgents:f,onInterrupt:d,stopping:c,onRespondToDecision:u,scheduledWakes:pt,onCancelScheduledWake:m,derive:t,SiteIcon:n.SiteIcon,toolPresentation:vu(r),ToolSourceIcon:n.ToolSourceIcon,SessionMessageCard:n.SessionMessageCard,threadReferences:n.threadReferences,renderWorkGroup:he,renderToolCallDetail:Ae,onSavePlanToWorkspace:me,declaredToolTitles:ce}),hg=R(ht=>l(zI,{rowsStore:o,rowId:ht}),[o]);return l(Aw,{data:n,target:r,children:l(Fe,{value:Ra,children:v(eI,{rowsStore:o,historyWindow:mo,children:[l(QT,{rowsStore:o,derive:t,paneVisible:ze,bottomInset:N,onSelect:Tl,onTurnNavigatorChange:ue}),l(KI,{rowsStore:o,useVisibleThreadCompletion:ot,viewport:cu,viewActive:Me&&ze,threadKey:a,settledView:X===null&&!yn,bottomInset:N}),v("div",{ref:Ns,onClickCapture:ht=>{At.current=ht.target instanceof Element?ht.target.closest("button"):null},onWheelCapture:St,onTouchMoveCapture:St,onPointerDownCapture:ht=>{ht.target===be.current?.node&&(St(),mu())},onKeyDownCapture:ht=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(ht.key)&&St()},className:"chat-timeline relative h-full min-h-0",inert:Ze!==null,"aria-busy":Ze!==null?!0:void 0,"data-timeline-switch-hold":Ze??void 0,"data-awaiting-user-decision":O?"true":"false","data-disclosure-reading":ft?"true":void 0,"data-timeline-follow-end":mg?"true":"false","data-timeline-end-inset":N,children:[l(aw,{inputKey:a,onBeforeInputChange:Yt,handleRef:hn,onAttach:Ds,onInteractionRowsChange:Ko,onScroll:yu,className:V("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",J&&"topbar-scroll-fade"),children:v("div",{"data-select-all-scope":"",style:{paddingBottom:N},...fg,children:[l(yS,{rowsStore:o}),Os,wt.map(ht=>l(iw,{sectionKey:ht.key,rowKeyPrefix:a,rowIds:ht.rowIds,renderRow:hg,sectionRef:La.observeSection(ht.key)},`${a}:${ht.key}`)),X?l(aI,{loading:X.loading,blocked:ee,onLoadLater:au,onReturnToLatest:Y}):null,iI]})}),Ze==="covered"?l(Zg,{}):nt?null:l(tI,{data:n,target:r}),lu!==null?l(BT,{ref:Il,textRef:Un,initialText:du(lu),onJump:gu}):null]})]})})})});$();function wS(e){let[t,o]=q(null),n=E(null),r=t!==null&&t.toKey===e.threadKey?t:null;if(r===null&&!si(e.rowsStore)){let c=n.current;t!==null&&t.stage==="covered"?r={toKey:e.threadKey,stage:"covered"}:c!==null&&c.threadKey!==e.threadKey&&si(c.rowsStore)&&(r={toKey:e.threadKey,stage:"held",props:c})}r!==t&&o(r);let a=r!==null&&r.stage==="held"?r:null,s=a===null?e:a.props;fe(()=>{n.current=s});let i=R(()=>o(c=>c===null||c.stage!=="held"?c:{toKey:c.toKey,stage:"covered"}),[]),d=R(()=>o(c=>c===null||c.stage==="released"?c:{toKey:c.toKey,stage:"released"}),[]);return{props:s,stage:r===null||r.stage==="released"?null:r.stage,onSkeleton:i,onRelease:d}}function TS(e){let{onSkeleton:t,onRelease:o}=e,n=e.data.useThreadSyncPhase(e.target);tp(e.rowsStore);let r=n!=="loading"||si(e.rowsStore);return fe(()=>{r&&o()},[r,o]),H(()=>{if(r)return;let a=globalThis.setTimeout(t,wp);return()=>globalThis.clearTimeout(a)},[r,t]),null}$();var s$=new Set;function IS({data:e,target:t,threadKey:o,visible:n,rowsStore:r,derive:a,resolveModelBadge:s,disclosure:i,historyWindow:d}){let c=e.useChatTimeline({target:t,threadKey:o,visible:n}),u=e.useTurnStatus({target:t,threadKey:o,visible:n}),m=Cn(),p=i.usePersistedExpandedTurnIds(o),[f,g]=Ge(o,s$,{namespace:"timeline-auto-expanded-turns"}),h=W(()=>a.resolveExpandedTurnIds(p??[],f),[f,a,p]),{latestTurn:y}=u,x=$e(o,y,{namespace:"timeline-latest-turn-previous"});H(()=>{let b=x.current;if(x.current=y,!(!y||b?.turnId===void 0)){if(y.turnId===b.turnId){b.state==="running"&&y.state==="interrupted"&&g(L=>{let w=new Set(L);return w.add(y.turnId),w});return}g(L=>{if(!L.has(b.turnId))return L;let w=new Set(L);return w.delete(b.turnId),w})}},[y]);let C=W(()=>({derive:a,timelineEntries:c.timelineEntries,activities:c.activities,turnSummaries:c.turnSummaries,status:u,expandedTurnIds:h,resolveModelBadge:s,historyWindow:d,usageByTurnId:c.usageByTurnId,exportApi:c.export}),[c.activities,c.export,c.timelineEntries,c.turnSummaries,c.usageByTurnId,a,h,d,s,u]);return(m||!r.hasInputs())&&r.setInputs(C),fe(()=>{r.flush()}),null}var SS=pe(function({data:t,target:o,threadKey:n,visible:r,...a}){let s=$e(n,null,{namespace:"timeline-rows-store",limit:3});s.current??=gw();let i=s.current,d=wS({...a,threadKey:n,rowsStore:i,data:t,target:o});return v(oe,{children:[l(IS,{data:t,target:o,threadKey:n,visible:r,rowsStore:i,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),l(bS,{...d.props,threadSwitchStage:d.stage}),d.stage===null?null:l(TS,{data:t,target:o,rowsStore:i,onSkeleton:d.onSkeleton,onRelease:d.onRelease},n)]})});function kS({phase:e}){let{t}=z(),o=t(bp(e));return v("div",{"aria-label":o,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:[l(qr,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),l("span",{className:"truncate",children:o})]})}function LS({data:e,target:t,bottomInset:o,showScrollToEnd:n,onScrollToEnd:r}){let{t:a}=z(),s=Tp(e.useThreadSyncPhase(t));return s===null&&!n?null:v("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:o+4},children:[s!==null?l(kS,{phase:s}):null,n?v(K,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[l(Tt,{}),a("timeline.scrollToEnd")]}):null]})}$();function PS(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function RS(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var i$=150,l$=16;function ES(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function MS({inputKey:e,visible:t,endInset:o,derive:n,onReturnToLatest:r,controlRef:a}){let[s,i]=Ge(e,!0,{namespace:"timeline-live-follow-enabled"}),[d,c]=Ge(e,!1,{namespace:"timeline-show-scroll-to-end"}),u=Xo(e,null),[m,p]=Qb(e,null),f=R(F=>{u.current=F;let ee=F?.node??null;p(Y=>Y===ee?Y:ee)},[u,p]),g=$e(e,!0,{namespace:"timeline-is-at-end"}),h=Xo(e,null),y=R(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),x=R(()=>{y(),h.current=setTimeout(()=>{h.current=null,c(!0)},i$)},[y,c,h]);H(()=>y,[y]);let C=R(()=>{let F=u.current?.measure();return F==null?void 0:{contentLength:F.contentLength,scroll:F.scroll,scrollLength:F.scrollLength}},[u]),b=$e(e,"following-end",{namespace:"timeline-scroll-mode"}),L=Zr(t);fe(()=>()=>L.cancel(),[L,e]);let w=$e(e,0,{namespace:"timeline-user-scroll-generation"}),k=$e(e,0,{namespace:"timeline-live-follow-generation"}),I=$e(e,PS,{namespace:"timeline-disclosure-reading-lock"}),T=$e(e,null,{namespace:"timeline-last-row-id"}),S=R(()=>{L.cancel(),w.current+=1,b.current="free-scrolling",k.current=null,i(!1)},[L,k,b,i,w]),P=R(()=>{I.current.lock(),S(),g.current=!1,y(),c(!0)},[y,g,S,I,c]),A=E(S);A.current=S;let N=R(()=>{let F=u.current?.measure(),ee=T.current;if(!F||ee===null)return!1;let Y=JT(F,ee);return Y===null?!1:Y>Math.max(0,F.scrollLength-o-l$)},[o,u,T]),B=R(F=>{I.current.resume();let ee=++w.current;g.current=!0,b.current="following-end",k.current=w.current,i(!0),y(),c(!1),L.request(()=>{RS({requestedGeneration:ee,currentGeneration:w.current,mode:b.current,readingLocked:I.current.isLocked()})&&u.current?.scrollToEnd({animated:F})})},[y,L,u,g,k,I,b,i,c,w]),O=E(r);O.current=r;let j=R((F=!1)=>{let ee=O.current;if(ee){ee(()=>B(F));return}B(F)},[B]),U=R(()=>j(!0),[j]),D=R(()=>{I.current.navigate(!0)&&(g.current=!1,n.resolveIsAtEnd(C(),o)===!0&&j())},[n,o,g,C,I,j]);H(()=>{if(!t||m===null)return;let F=null,ee=requestAnimationFrame(()=>{let Y=()=>{A.current()},ae=ue=>{let ce=ue instanceof Element?ue:null;for(;ce&&ce!==m;){if(ce instanceof HTMLElement&&ce.scrollHeight>ce.clientHeight+1&&ce.scrollTop+ce.clientHeight<ce.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(ce).overflowY))return!1;ce=ce.parentElement}return ce===m},te=ue=>{I.current.isLocked()&&ae(ue)&&D()},de=null,ge=!1,ne=m.scrollTop,Z=ue=>{de=ue.touches[0]?.clientY??null},ve=()=>{de=null,ge=!1},he=()=>{let ue=m.scrollTop;ge&&ue>ne&&te(m),ne=ue},Ae=()=>N(),De=()=>n.resolveIsAtEnd(C(),o)===!1,je=ue=>{ue.deltaY>0&&te(ue.target),ue.deltaY<0&&Ae()&&Y()},ot=ue=>{let ce=ue.touches[0]?.clientY??null,Ze=de!==null&&ce!==null&&ce<de;de=ce,De()&&Y(),Ze&&te(ue.target)},me=ue=>{if(ue.target===m){ge=!0,ne=m.scrollTop,Ae()&&Y();return}De()&&Y()},Me=ue=>{if(!(ue.target instanceof Element?ue.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ue.key){case"PageUp":case"Home":case"ArrowUp":Ae()&&Y();break;case"PageDown":case"End":case"ArrowDown":te(ue.target);break;case" ":ue.shiftKey||te(ue.target);break;default:break}};m.addEventListener("wheel",je,{passive:!0}),m.addEventListener("touchmove",ot,{passive:!0}),m.addEventListener("touchstart",Z,{passive:!0}),m.addEventListener("touchend",ve,{passive:!0}),m.addEventListener("touchcancel",ve,{passive:!0}),m.addEventListener("scroll",he,{passive:!0}),window.addEventListener("pointerup",ve,{passive:!0}),window.addEventListener("pointercancel",ve,{passive:!0}),m.addEventListener("pointerdown",me,{passive:!0}),m.addEventListener("keydown",Me),F=()=>{m.removeEventListener("wheel",je),m.removeEventListener("touchmove",ot),m.removeEventListener("touchstart",Z),m.removeEventListener("touchend",ve),m.removeEventListener("touchcancel",ve),m.removeEventListener("scroll",he),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve),m.removeEventListener("pointerdown",me),m.removeEventListener("keydown",Me)}});return()=>{cancelAnimationFrame(ee),F?.()}},[N,n,o,e,C,I,D,m,t]);let J=R(F=>{T.current=F},[T]),G=R(F=>{if(I.current.isLocked()){g.current=!1,y(),c(!0);return}if(!F&&k.current===w.current){y(),c(!1);return}g.current!==F&&(g.current=F,F?(b.current="following-end",k.current=w.current,i(!0),y(),c(!1)):(b.current="free-scrolling",k.current=null,x()))},[y,g,k,I,x,b,i,c,w]),M=E(j);M.current=j;let X=W(()=>({followEnd:F=>M.current(F?.animated??!1)}),[]);return fe(()=>(ES(a,X),()=>ES(a,null)),[X,a]),{liveFollowEnabled:s,showScrollToEnd:d,bindTimelineHandle:f,onRowsChange:J,onIsAtEndChange:G,onManualNavigation:S,onDisclosureNavigation:P,returnToEnd:U}}$();$();$();var AS=pe(function({group:t,expanded:o,onToggle:n,disabled:r,highlighted:a,callCounts:s,sourceFiltered:i=!1,...d}){let{t:c}=z(),u=t.items.flatMap(p=>p.kind==="step"?[p.row]:p.rows).find(p=>p.kind==="user-message"),m=t.summary?.state;return l(Gr,{value:t.id,children:l(Jr,{"data-trajectory-row-id":t.id,"data-timeline-row-id":t.id,"data-turn-group-header":t.turnId??"unassigned",tabIndex:-1,className:V("bg-muted/25 hover:bg-muted/25",a&&"outline-2 outline-primary"),children:v(bn,{colSpan:6,className:"whitespace-normal px-2 py-2",children:[v("div",{className:"flex min-w-0 items-start gap-2",children:[v(K,{variant:"ghost",size:"sm",className:"h-auto min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal",disabled:r,"aria-expanded":o,onClick:()=>n(t.id),title:c(o?"turnOverview.collapseTurn":"turnOverview.expandTurn"),children:[o?l(Tt,{className:"size-4 shrink-0","aria-hidden":!0}):l(yo,{className:"size-4 shrink-0","aria-hidden":!0}),l("span",{className:"min-w-0",children:u?.summary||c(t.turnId===null?"turnOverview.unassigned":"turnOverview.turn")})]}),t.summary?l(ju,{summary:t.summary}):null,m==="error"||m==="interrupted"?l("span",{className:"shrink-0 py-1 text-xs text-destructive-foreground",children:c(m==="error"?"trajectory.status.failed":"trajectory.status.stopped")}):null]}),v("div",{className:"flex flex-wrap gap-x-3 gap-y-1 pl-5 text-xs text-muted-foreground","data-trajectory-call-counts":!0,children:[s?v(oe,{children:[l("span",{children:i?c("trajectory.sourceFilter.matchedCalls",{matched:s.matchedCalls,total:s.totalCalls}):c("trajectory.sourceFilter.totalCalls",{count:s.totalCalls})}),l("span",{children:i?c("trajectory.sourceFilter.matchedFailedCalls",{count:s.matchedFailedCalls}):c("trajectory.sourceFilter.failedCalls",{count:s.failedCalls})})]}):null,i?l("span",{children:c("trajectory.sourceFilter.hiddenSteps")}):null]}),t.summary?l("div",{className:"pl-5",children:l(Gu,{summary:t.summary,...d})}):null]})})})});function NS({id:e,count:t,expanded:o,onToggle:n,disabled:r}){let{t:a}=z();return l(Jr,{"data-trajectory-row-id":e,"data-timeline-row-id":e,tabIndex:-1,"data-routine-group":e,children:l(bn,{colSpan:6,className:"px-3 py-1",children:v(K,{variant:"ghost",size:"xs","aria-expanded":o,disabled:r,onClick:n,children:[o?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0}),a("turnOverview.routineSteps",{count:t})]})})})}$();$();var ph="max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap";function _S({useToolCallDetail:e,threadRef:t,toolCallId:o,turnId:n,fallback:r,revision:a,rewritten:s}){let{t:i}=z(),[d,c]=q(!1),u=e===void 0?null:e({threadRef:t,toolCallId:o,turnId:n??null,revision:a??r??"initial",...d?{original:!0}:{}}),m=u===null?[]:[u.input,u.output].filter(f=>f!==void 0&&f.length>0),p=u?.input!==void 0&&u?.output!==void 0?m.join(`
|
|
3559
3542
|
|
|
3560
3543
|
`):[r,...m].filter(Boolean).join(`
|
|
3561
3544
|
|
|
3562
|
-
`);return p.length===0&&!s?null:v("div",{className:"space-y-2",children:[s?v(Uu,{value:[d?"original":"received"],onValueChange:f=>{f[0]&&c(f[0]==="original")},"aria-label":i("toolCall.output"),children:[l(Zr,{value:"received",children:i("toolCall.agentReceived")}),l(Zr,{value:"original",children:i("toolCall.originalResult")})]}):null,l("pre",{className:hh,children:d?u?.original:p}),d&&u?.originalLoading?l("p",{role:"status",children:i("toolCall.originalLoading")}):null,d&&u?.originalTruncated?l("p",{children:i("toolCall.originalRetained")}):null,d&&u?.originalFailed?l("p",{role:"alert",children:i("toolCall.originalLoadFailed")}):null,d&&u?.loadMoreOriginal?l(K,{size:"sm",onClick:u.loadMoreOriginal,children:i("toolCall.originalMore")}):null]})}function NS({row:e,environmentId:t,presentation:o}){let{t:n}=z();if(e.childThread!==void 0)return l(Cd,{threadRef:{environmentId:t,threadId:e.childThread.threadId},fallbackName:e.childThread.fallbackName,showStatus:!1});let r=e.communication?.to;if(e.communication===void 0)return e.kind==="communication"?l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:n("trajectory.communication.unknownRecipient")})}):o!=null?l(Hd,{presentation:o,fallback:e.summary,environmentId:t}):l("span",{className:"break-words",children:e.kind==="tool-call"&&(e.source==="ycodium"||e.builtinMcpTool!==void 0)?e.toolName??n("trajectory.kinds.tool-call"):e.summary});if(r?.kind==="thread"){let[s="",i=""]=n("trajectory.communication.sentTo",{name:""}).split("");return v("span",{className:"break-words",children:[s,l(Cd,{threadRef:{environmentId:t,threadId:r.threadId},fallbackName:r.title??void 0,showStatus:!1}),i]})}let a=r==null?n("trajectory.communication.unknownRecipient"):r.kind==="work-item"?n("trajectory.communication.workItem"):r.displayName;return l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:a})})}var t$={replied:"trajectory.communication.phase.replied","picked-up":"trajectory.communication.phase.pickedUp",processed:"trajectory.communication.phase.processed",waiting:"trajectory.communication.phase.waiting",unknown:"trajectory.communication.phase.unknown",recorded:"trajectory.communication.phase.recorded",withdrawn:"trajectory.communication.phase.withdrawn",deleted:"trajectory.communication.phase.deleted"},MS={withdrawn:"trajectory.communication.body.withdrawn",deleted:"trajectory.communication.body.deleted",unavailable:"trajectory.communication.body.unavailable"};function DS({useCommunicationRecord:e,recordId:t,fallback:o,timestampFormat:n}){let{t:r}=z(),a=e===void 0?null:e(t);if(a===null)return o===void 0?null:l("pre",{className:hh,children:o});if(typeof a=="string")return l("span",{className:"px-1 text-xs text-muted-foreground","data-trajectory-communication":a,children:r(a==="unreadable"?MS.unavailable:a==="environment-outdated"?"trajectory.communication.environmentOutdated":a==="client-outdated"?"trajectory.communication.updateRequired":"trajectory.communication.notReceived")});let s=r(t$[a.phase]);return v("div",{className:"flex flex-col gap-1.5","data-trajectory-communication":a.recordId,children:[a.incomplete?l("span",{className:"px-1 text-xs text-muted-foreground",children:r("trajectory.communication.incomplete")}):null,a.bodyState==="present"?l("pre",{className:hh,children:a.text}):l("span",{className:"px-1 text-xs text-muted-foreground",children:r(MS[a.bodyState])}),l("span",{className:"px-1 text-xs text-muted-foreground",children:a.phaseAt===null?s:`${s} ${tr(a.phaseAt,n,r)}`})]})}var _S=pe(function({environmentId:t,toolPresentation:o,row:n,inputKey:r,expanded:a,highlighted:s,toggleExpanded:i,resolveChatAnchorMessageId:d,onOpenInChat:c,timestampFormat:u,threadRef:m,useToolCallDetail:p,useCommunicationRecord:f}){let{t:g}=z(),{formatDuration:h}=Bo(),y=W(()=>n.kind==="tool-call"?{toolMetadata:{source:n.source??"unknown",toolName:n.toolName,pluginId:n.pluginId,mcpServer:n.mcpServer,action:n.action,skillName:n.skillName},builtinMcpTool:n.builtinMcpTool,toolArgs:n.toolArgs}:void 0,[n]),x=y===void 0?null:o?.(y)??null,C=n.detail!==void 0||n.toolCallId!==void 0,b=d(n);return l(Qr,{value:n.id,children:[v(ta,{"data-trajectory-row-id":n.id,"data-timeline-row-id":n.id,tabIndex:-1,className:G(C&&"cursor-pointer",s&&"outline-2 outline-primary"),onClick:C?()=>i(n.id):void 0,children:[l(Sn,{className:"whitespace-nowrap text-muted-foreground",title:kn(n.createdAt,u,g),children:tr(n.createdAt,u,g)}),l(Sn,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${n.kind}`)}),v(Sn,{className:"max-w-0 whitespace-normal",children:[v("span",{className:"inline-flex items-start gap-1",children:[C?l(K,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(a?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":a,onClick:L=>{L.stopPropagation(),i(n.id)},children:a?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0})}):null,l(NS,{row:n,environmentId:t,presentation:x})]}),n.kind==="tool-call"?v("span",{className:"ml-2 inline-flex flex-wrap gap-x-2 text-xs text-muted-foreground","data-trajectory-source":!0,children:[l("span",{children:g(`trajectory.sources.${n.source??"unknown"}`)}),n.source==="plugin"&&n.pluginId?l(Do,{environmentId:t,pluginId:n.pluginId,iconClassName:"size-3"}):null,n.source==="mcp"&&n.mcpServer?l("span",{children:n.mcpServer}):null,n.action==="skill-read"?l("span",{children:n.skillName?g("trajectory.sourceFilter.skillReadNamed",{name:n.skillName}):g("trajectory.sourceFilter.skillRead")}):null]}):null]}),v(Sn,{className:"whitespace-nowrap",children:[g(`trajectory.status.${n.status}`),n.rewrittenBy?.length?l(Fd,{plugins:n.rewrittenBy,environmentId:t}):null]}),l(Sn,{className:"whitespace-nowrap text-muted-foreground",children:n.durationMs!==void 0?h(n.durationMs):g("trajectory.valueUnknown")}),l(Sn,{className:"whitespace-nowrap",children:b!==null?v(Re,{children:[l(Ee,{render:l(K,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:L=>{L.stopPropagation(),c(b)}}),children:l(Ga,{"aria-hidden":!0})}),l(Pe,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${r}:${n.id}`),a&&C?l(ta,{className:"hover:bg-transparent","data-trajectory-detail-row":n.id,"data-timeline-row-id":n.id,children:v(Sn,{colSpan:6,className:"whitespace-normal",children:[l("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),n.kind==="tool-call"&&n.toolCallId!==void 0?l(AS,{threadRef:m,rewritten:(n.rewrittenBy?.length??0)>0,useToolCallDetail:p,toolCallId:n.toolCallId,turnId:n.turnId,fallback:n.detail,revision:`${n.status}:${n.updatedActivityId??n.activityId??n.id}`}):n.communication!==void 0?l(DS,{useCommunicationRecord:f,recordId:n.communication.recordId,fallback:n.detail,timestampFormat:u}):n.detail!==void 0?l("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:n.detail}):null]})},`${r}:${n.id}:detail`):null]},`${r}:${n.id}:owner`)});var OS=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];$();var Op=class extends mr{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 yh(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let o=e.querySelector("thead"),n=t.top+(o?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=Ja(r,n),s=[];if(a<0)return s;for(let i=a;i<r.length;i+=1){let d=r[i];if(d.getBoundingClientRect().top>=t.bottom)break;let c=d.querySelectorAll("[data-timeline-row-id]"),u=Ja(c,n);if(!(u<0))for(let m=u;m<c.length;m++){let p=c[m];if(p.getBoundingClientRect().top>=t.bottom)break;s.push(p)}}return s}function Fp(e){return e?.source!==void 0||e?.pluginId!==void 0||e?.mcpServer!==void 0}function FS(e,t){if(t==="all")return e;let o=new Set(e.filter(n=>n.kind===t).map(n=>n.turnId??null));return e.filter(n=>n.kind===t||o.has(n.turnId??null)&&(n.kind==="user-message"||n.kind==="assistant-message"))}var o$=["native","ycodium","plugin","mcp","unknown"];function BS(e){let{t}=z(),o=Zn(e.environmentId,e.detail);return e.source!=="plugin"?l(oe,{children:e.detail}):o===null?l(oe,{children:t("trajectory.sources.plugin")}):l(Do,{environmentId:e.environmentId,pluginId:e.detail})}function HS({environmentId:e,filter:t,query:o,onChange:n}){let{t:r}=z(),a=Fp(t),s=t?.source,i=s==="plugin"?"pluginId":s==="mcp"?"mcpServer":null,d=i===null?void 0:t?.[i],c=i===null?[]:[...new Set(o.sources.flatMap(u=>u.source===s&&u[i]!==void 0?[u[i]]:[]))];return d!==void 0&&!c.includes(d)&&c.push(d),v("div",{className:"flex flex-wrap items-center gap-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":r("trajectory.sourceFilter.label"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:a?"ghost":"secondary","aria-pressed":!a,onClick:()=>n({}),children:r("trajectory.sourceFilter.all")}),o$.filter(u=>u===s||o.sources.some(m=>m.source===u)).map(u=>l(K,{size:"xs",variant:s===u?"secondary":"ghost","aria-pressed":s===u,onClick:()=>n({source:u}),children:r(`trajectory.sources.${u}`)},u))]}),i!==null?v(Zs,{value:d===void 0?"all":`detail:${d}`,onValueChange:u=>{u===null||s===void 0||n(u==="all"?{source:s}:{source:s,[i]:u.slice(7)})},children:[l(Lb,{size:"xs",className:"max-w-full","aria-label":r(s==="plugin"?"trajectory.sourceFilter.plugin":"trajectory.sourceFilter.mcp"),children:d!==void 0&&s!==void 0?l(BS,{environmentId:e,source:s,detail:d}):r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),v(ei,{children:[l(Xa,{value:"all",children:r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),c.map(u=>l(Xa,{value:`detail:${u}`,children:s===void 0?u:l(BS,{environmentId:e,source:s,detail:u})},u))]})]}):null,a?l(K,{size:"xs",variant:"ghost",onClick:()=>n({}),children:r("trajectory.sourceFilter.clear")}):null,o.loading?l("span",{role:"status",className:"text-xs text-muted-foreground",children:r("trajectory.sourceFilter.loading")}):null,o.error!==null?v("div",{role:"alert",className:"flex flex-wrap items-center gap-1 text-xs text-destructive-foreground",children:[l("span",{children:r("trajectory.sourceFilter.error",{error:o.error})}),l(K,{size:"xs",variant:"outline",disabled:o.loading,onClick:()=>o.retry(),children:r("trajectory.sourceFilter.retry")})]}):null]})}var US=50,n$=32;function r$(e){let t=[];for(let o=0;o<e.length;o+=US)t.push(e.slice(o,o+US));return t}var $S=pe(function({environmentId:t="",toolPresentation:o,inputKey:n,rows:r,groupRows:a,sourceQuery:s,toolFilter:i,onToolFilterChange:d,onOpenFileDiff:c,loadEarlier:u,loadLater:m=null,pagingBlockedByInteraction:p=!1,onReturnToLatest:f=null,onVisibleTurnRangeChange:g=null,timestampFormat:h,contentInsetEndAdjustment:y=0,paneVisible:x,useToolCallDetail:C,useCommunicationRecord:b,threadRef:L,resolveChatAnchorMessageId:w,onOpenInChat:k}){let{t:I}=z(),T=Fp(i),S=T?JSON.stringify([n,i?.source,i?.pluginId,i?.mcpServer]):n,[R,A]=Ge("trajectory-kind-filter",n,"all"),[N,B]=Ge("trajectory-expanded-rows",n,()=>new Set),[O,V]=Ge("trajectory-follow-latest",n,!0),U=W(()=>{let se=new Set(r.map(Le=>Le.kind));return OS.filter(Le=>se.has(Le))},[r]),D=W(()=>FS(r,R),[r,R]),X=M(null),j=M(!1);fe(()=>{j.current=!1},[S]);let E=P(()=>{A("all"),T&&d?.({})},[A,T,d]),Y=Jb({inputKey:n,rows:D,groupRows:a,paneVisible:x,resetFilter:E}),F=Y.rows,Z=W(()=>r$(F),[F]),J=se=>B(Le=>{let be=new Set(Le);return be.has(se)?be.delete(se):be.add(se),be}),ne=M(null),te=P(se=>{X.current=se,se&&(ne.current=se)},[]),le=$e("trajectory-at-end",S,!0),ge=$e("trajectory-scroll-top",S,0),re=$e("trajectory-row-anchor",S,null),ee=M({viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p});ee.current={viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p};let ve=M(null);fe(()=>{if(ve.current=null,!!x)return()=>{ve.current=null,g?.(null)}},[S,x,g]);let he=W(()=>({inputKey:n,store:vd()}),[n]),Ne=M(he);Ne.current=he;let De=M(()=>{}),je=P(se=>{let Le=Ne.current;return Le.store.acquire(se,()=>{Ne.current===Le&&De.current()})},[]),nt=W(()=>{let se=F.map((Le,be)=>({key:Le.id,turnId:Le.turnId??null,firstRowIndex:be,endRowIndex:be+1}));return{sections:se,bySectionKey:new Map(se.map(Le=>[Le.key,Le])),byRowId:new Map(se.map(Le=>[Le.key,{turnId:Le.turnId,index:Le.firstRowIndex}]))}},[F]),me=P((se,Le)=>Array.from(se.querySelectorAll("[data-trajectory-row-id]")).find(be=>be.dataset.trajectoryRowId===Le),[]),Ae=P((se,Le)=>{let be=Le[0]?.dataset.timelineRowId,Ye=be===void 0?void 0:me(se,be);Ye&&be!==void 0&&(re.current={rowId:be,offset:se.getBoundingClientRect().top-Ye.getBoundingClientRect().top})},[me,re]),ue=P(()=>{if(!x)return;let se=X.current??ne.current;se&&(ge.current=se.scrollTop,le.current=se.scrollHeight-se.scrollTop-se.clientHeight<=n$,F.length>0&&Ae(se,yh(se)))},[le,F.length,x,Ae,ge]),ce=P(()=>ee.current.viewportKey===S&&ee.current.paneVisible,[S]),Ze=P(()=>{if(!ce()||g===null)return;let se=X.current;if(!se||se.clientHeight<=0)return;let Le=yh(se);Ae(se,Le);let be=he.store.rows(),Ye=se.ownerDocument.activeElement;if(li(Ye)){let It=ii(Ye,se);It&&be.push(It)}let xt=tp({index:nt,visibleSectionKeys:Le.flatMap(It=>{let po=It.dataset.timelineRowId;return po===void 0?[]:[po]}),protectedRowIds:be,selectionRows:op(se)}),tt=JSON.stringify(xt);ve.current!==tt&&(ve.current=tt,g(xt))},[he,ce,g,nt,Ae]),pt=oa(x),ze=P(()=>{ce()&&g!==null&&pt.request(Ze)},[ce,g,pt,Ze]);De.current=ze;let et=P(se=>{let Le=re.current,be=Le===null?void 0:me(se,Le.rowId),Ye=be?.closest("[data-trajectory-chunk]"),xt=Ye?.style.contentVisibility;Ye&&(Ye.style.contentVisibility="visible");try{se.scrollTop=be===void 0?T?0:ge.current:se.scrollTop+be.getBoundingClientRect().top-se.getBoundingClientRect().top+Le.offset}finally{Ye&&(Ye.style.contentVisibility=xt??"")}},[me,re,ge,T]),Et=P(()=>{ce()&&(ue(),ze())},[ue,ce,ze]),ft=P(()=>{!ce()||ee.current.pagingBlockedByInteraction||u?.loading||(ue(),T&&(j.current=!0),u?.onLoadEarlier())},[ue,ce,u,T]),Ct=P(()=>{!ce()||ee.current.pagingBlockedByInteraction||m?.loading||(ue(),T&&(j.current=!0),m?.onLoadLater())},[ue,ce,m,T]),gt=P(()=>{ce()&&f?.(()=>{if(!ce())return;le.current=!0,V(!0);let se=X.current;se&&(se.scrollTop=se.scrollHeight)})},[ce,f,le,V]),_t=se=>{if(!(!ce()||T)){if(se&&m!==null){gt();return}se&&(le.current=!0),V(se)}},Mt=P(se=>{if(T&&j.current){se.scrollTop=0,ge.current=0,re.current=null,s?.loading||(j.current=!1);return}let Le=Y.request;if(Le!==null){le.current=!1,V(!1);let be=F.some(Ye=>Ye.id===Le.rowId)?me(se,Le.rowId):void 0;if(!be)return;be.scrollIntoView({block:"center"}),be.focus({preventScroll:!0}),ge.current=se.scrollTop,Ae(se,[be]),Y.completeReveal(Le);return}!T&&O&&le.current&&m===null?se.scrollTop=se.scrollHeight:et(se)},[Y.request,Y.completeReveal,le,V,F,me,ge,Ae,O,T,s?.loading,re,m,et]);return fe(()=>{if(!ce())return;let se=X.current;se&&(Mt(se),ze())},[Mt,y,le,N,F,O,n,ce,m,x,ze,et]),fe(()=>{let se=X.current;if(!ce()||g===null||!se)return;let Le=!0,be=()=>{Le&&ce()&&ze()},Ye=()=>{!Le||!ce()||(Mt(se),be())},xt=typeof ResizeObserver>"u"?null:new ResizeObserver(Ye);xt?.observe(se);let tt=se.querySelector("table");return tt&&xt?.observe(tt),se.addEventListener("focusin",be),se.addEventListener("focusout",be),se.ownerDocument.addEventListener("selectionchange",be),be(),()=>{Le=!1,pt.cancel(),xt?.disconnect(),se.removeEventListener("focusin",be),se.removeEventListener("focusout",be),se.ownerDocument.removeEventListener("selectionchange",be)}},[n,ce,g,x,pt,ze,Mt]),l(Op,{inputKey:S,visible:x,rows:F,expandedRows:N,capture:ue,children:l(yd,{value:je,children:v("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[v("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":I("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:R==="all"?"secondary":"ghost","aria-pressed":R==="all",onClick:()=>A("all"),children:I("trajectory.filterAll")}),U.map(se=>l(K,{size:"xs",variant:R===se?"secondary":"ghost","aria-pressed":R===se,onClick:()=>A(se),children:I(`trajectory.kinds.${se}`)},se))]}),a?l(Zr,{size:"xs",variant:"outline",pressed:Y.expandAll,disabled:p,onPressedChange:Y.setExpandAll,children:I("turnOverview.expandAll")}):null,l(Zr,{className:"ml-auto",size:"xs",variant:"outline",pressed:!T&&O,disabled:T,onPressedChange:_t,"aria-label":I("trajectory.followLatest"),children:I("trajectory.followLatest")})]}),s&&d?l(HS,{environmentId:t,filter:i,query:s,onChange:d}):null,v("div",{ref:te,className:"min-h-0 flex-1 overflow-auto",onScroll:Et,style:{paddingBottom:y},"data-trajectory-scroll":!0,children:[u!==null?v("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[l("span",{children:I("trajectory.loadEarlier")}),l(K,{size:"xs",variant:"outline",disabled:u.loading||p,onClick:ft,children:u.loading?I("trajectory.loadingEarlier"):I("trajectory.loadEarlierAction")})]}):null,F.length===0?l("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:s?.loading?I("trajectory.sourceFilter.loading"):s?.error?I("trajectory.sourceFilter.unavailable"):I(T||R!=="all"?"trajectory.sourceFilter.empty":"trajectory.empty")}):v(Eb,{children:[l(Ab,{className:"sticky top-0 z-10 bg-background",children:v(ta,{className:"hover:bg-transparent",children:[l(Ya,{className:"w-px whitespace-nowrap",children:I("trajectory.columnTime")}),l(Ya,{className:"w-px whitespace-nowrap",children:I("trajectory.columnType")}),l(Ya,{children:I("trajectory.columnSummary")}),l(Ya,{className:"w-px whitespace-nowrap",children:I("trajectory.columnStatus")}),l(Ya,{className:"w-px whitespace-nowrap",children:I("trajectory.columnDuration")}),l(Ya,{className:"w-px",children:l("span",{className:"sr-only",children:I("trajectory.openInChat")})})]})}),Z.map((se,Le)=>l(Mb,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":se[0]?.id??Le,children:se.map(be=>{let Ye=Y.headers.get(be.id);if(Ye)return l(PS,{...Ye,callCounts:s?.turnCounts.get(Ye.group.turnId),sourceFiltered:T,disabled:p,highlighted:Y.highlighted===be.id,onToggle:Y.toggleTurn,onLocate:Y.locate,onOpenFileDiff:c},be.id);let xt=Y.routines.get(be.id);return xt?l(ES,{id:be.id,...xt,disabled:p,onToggle:()=>Y.toggleRoutine(be.id)},be.id):l(_S,{environmentId:t,toolPresentation:o,row:be,inputKey:n,expanded:N.has(be.id),highlighted:Y.highlighted===be.id,toggleExpanded:J,resolveChatAnchorMessageId:w,onOpenInChat:k,timestampFormat:h,threadRef:L,useToolCallDetail:C,useCommunicationRecord:b},`${n}:${be.id}`)})},`${n}:${se[0]?.id??Le}`))]}),m!==null?v("div",{className:"flex justify-center gap-2 px-3 py-2",children:[l(K,{size:"xs",variant:"outline",disabled:m.loading||p,onClick:Ct,children:m.loading?I("timeline.loadingLater"):I("timeline.loadLater")}),f===null?null:l(K,{size:"xs",variant:"ghost",onClick:gt,children:I("timeline.returnToLatest")})]}):null]})]})})})});function zS({data:e,target:t,inputKey:o,paneVisible:n,timestampFormat:r,contentInsetEndAdjustment:a=0,onOpenInChat:s,onOpenFileDiff:i}){let[d,c]=Ge("trajectory-source-filter",o,{}),u=e.useTrajectory({target:t,threadKey:o,visible:n,toolFilter:d}),m=e.useToolPresentation?.(t),p=P(g=>e.useToolCallDetail(t,{toolCallId:g.toolCallId,turnId:g.turnId,revision:g.revision,...g.original===void 0?{}:{original:g.original}}),[e,t]),f=P(g=>e.useCommunicationRecord(t,g),[e,t]);return l($S,{inputKey:o,environmentId:t.environmentId,toolPresentation:m,rows:u.rows,groupRows:u.groupRows,toolFilter:d,onToolFilterChange:c,sourceQuery:u.sourceQuery,onOpenFileDiff:i,loadEarlier:u.loadEarlier,loadLater:u.loadLater,pagingBlockedByInteraction:u.pagingBlockedByInteraction,onReturnToLatest:u.onReturnToLatest,onVisibleTurnRangeChange:u.onVisibleTurnRangeChange,timestampFormat:r,contentInsetEndAdjustment:a,paneVisible:n,threadRef:t,useToolCallDetail:p,useCommunicationRecord:f,resolveChatAnchorMessageId:u.resolveChatAnchorMessageId,onOpenInChat:s})}$();$();var vh=qe(null),Bp=vh.Provider;function zo(){let e=Rt(vh);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function Co(){return Rt(vh)}$();var is=Ex(Ch());$();function VS(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>n=>{t.forEach(r=>r(n))},t)}var Kd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function os(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Up(e){return"nodeType"in e}function Lo(e){var t,o;return e?os(e)?e:Up(e)&&(t=(o=e.ownerDocument)==null?void 0:o.defaultView)!=null?t:window:window}function $p(e){let{Document:t}=Lo(e);return e instanceof t}function Ti(e){return os(e)?!1:e instanceof Lo(e).HTMLElement}function bh(e){return e instanceof Lo(e).SVGElement}function ns(e){return e?os(e)?e.document:Up(e)?$p(e)?e:Ti(e)||bh(e)?e.ownerDocument:document:document:document}var pn=Kd?fe:H;function zp(e){let t=M(e);return pn(()=>{t.current=e}),P(function(){for(var o=arguments.length,n=new Array(o),r=0;r<o;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function QS(){let e=M(null),t=P((n,r)=>{e.current=setInterval(n,r)},[]),o=P(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,o]}function Ii(e,t){t===void 0&&(t=[e]);let o=M(e);return pn(()=>{o.current!==e&&(o.current=e)},t),o}function Si(e,t){let o=M();return W(()=>{let n=e(o.current);return o.current=n,n},[...t])}function qd(e){let t=zp(e),o=M(null),n=P(r=>{r!==o.current&&t?.(r,o.current),o.current=r},[]);return[o,n]}function Kp(e){let t=M();return H(()=>{t.current=e},[e]),t.current}var xh={};function rs(e,t){return W(()=>{if(t)return t;let o=xh[e]==null?0:xh[e]+1;return xh[e]=o,e+"-"+o},[e,t])}function XS(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return n.reduce((a,s)=>{let i=Object.entries(s);for(let[d,c]of i){let u=a[d];u!=null&&(a[d]=u+e*c)}return a},{...t})}}var as=XS(1),ss=XS(-1);function l$(e){return"clientX"in e&&"clientY"in e}function Wd(e){if(!e)return!1;let{KeyboardEvent:t}=Lo(e.target);return t&&e instanceof t}function d$(e){if(!e)return!1;let{TouchEvent:t}=Lo(e.target);return t&&e instanceof t}function Gd(e){if(d$(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:o}=e.touches[0];return{x:t,y:o}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:o}=e.changedTouches[0];return{x:t,y:o}}}return l$(e)?{x:e.clientX,y:e.clientY}:null}var ia=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:o}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(o?Math.round(o):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:o}=e;return"scaleX("+t+") scaleY("+o+")"}},Transform:{toString(e){if(e)return[ia.Translate.toString(e),ia.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:o,easing:n}=e;return t+" "+o+"ms "+n}}}),jS="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function YS(e){return e.matches(jS)?e:e.querySelector(jS)}$();var c$={display:"none"};function JS(e){let{id:t,value:o}=e;return eo.createElement("div",{id:t,style:c$},o)}function ZS(e){let{id:t,announcement:o,ariaLiveType:n="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 eo.createElement("div",{id:t,style:r,role:"status","aria-live":n,"aria-atomic":!0},o)}function e0(){let[e,t]=q("");return{announce:P(n=>{n!=null&&t(n)},[]),announcement:e}}var m0=qe(null);function u$(e){let t=Rt(m0);H(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function p$(){let[e]=q(()=>new Set),t=P(n=>(e.add(n),()=>e.delete(n)),[e]);return[P(n=>{let{type:r,event:a}=n;e.forEach(s=>{var i;return(i=s[r])==null?void 0:i.call(s,a)})},[e]),t]}var m$={draggable:`
|
|
3545
|
+
`);return p.length===0&&!s?null:v("div",{className:"space-y-2",children:[s?v(Fu,{value:[d?"original":"received"],onValueChange:f=>{f[0]&&c(f[0]==="original")},"aria-label":i("toolCall.output"),children:[l(Xr,{value:"received",children:i("toolCall.agentReceived")}),l(Xr,{value:"original",children:i("toolCall.originalResult")})]}):null,l("pre",{className:ph,children:d?u?.original:p}),d&&u?.originalLoading?l("p",{role:"status",children:i("toolCall.originalLoading")}):null,d&&u?.originalTruncated?l("p",{children:i("toolCall.originalRetained")}):null,d&&u?.originalFailed?l("p",{role:"alert",children:i("toolCall.originalLoadFailed")}):null,d&&u?.loadMoreOriginal?l(K,{size:"sm",onClick:u.loadMoreOriginal,children:i("toolCall.originalMore")}):null]})}function OS({row:e,environmentId:t,presentation:o}){let{t:n}=z();if(e.childThread!==void 0)return l(hd,{threadRef:{environmentId:t,threadId:e.childThread.threadId},fallbackName:e.childThread.fallbackName,showStatus:!1});let r=e.communication?.to;if(e.communication===void 0)return e.kind==="communication"?l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:n("trajectory.communication.unknownRecipient")})}):o!=null?l(Fd,{presentation:o,fallback:e.summary,environmentId:t}):l("span",{className:"break-words",children:e.kind==="tool-call"&&(e.source==="ycodium"||e.builtinMcpTool!==void 0)?e.toolName??n("trajectory.kinds.tool-call"):e.summary});if(r?.kind==="thread"){let[s="",i=""]=n("trajectory.communication.sentTo",{name:""}).split("");return v("span",{className:"break-words",children:[s,l(hd,{threadRef:{environmentId:t,threadId:r.threadId},fallbackName:r.title??void 0,showStatus:!1}),i]})}let a=r==null?n("trajectory.communication.unknownRecipient"):r.kind==="work-item"?n("trajectory.communication.workItem"):r.displayName;return l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:a})})}var d$={replied:"trajectory.communication.phase.replied","picked-up":"trajectory.communication.phase.pickedUp",processed:"trajectory.communication.phase.processed",waiting:"trajectory.communication.phase.waiting",unknown:"trajectory.communication.phase.unknown",recorded:"trajectory.communication.phase.recorded",withdrawn:"trajectory.communication.phase.withdrawn",deleted:"trajectory.communication.phase.deleted"},DS={withdrawn:"trajectory.communication.body.withdrawn",deleted:"trajectory.communication.body.deleted",unavailable:"trajectory.communication.body.unavailable"};function FS({useCommunicationRecord:e,recordId:t,fallback:o,timestampFormat:n}){let{t:r}=z(),a=e===void 0?null:e(t);if(a===null)return o===void 0?null:l("pre",{className:ph,children:o});if(typeof a=="string")return l("span",{className:"px-1 text-xs text-muted-foreground","data-trajectory-communication":a,children:r(a==="unreadable"?DS.unavailable:a==="environment-outdated"?"trajectory.communication.environmentOutdated":a==="client-outdated"?"trajectory.communication.updateRequired":"trajectory.communication.notReceived")});let s=r(d$[a.phase]);return v("div",{className:"flex flex-col gap-1.5","data-trajectory-communication":a.recordId,children:[a.incomplete?l("span",{className:"px-1 text-xs text-muted-foreground",children:r("trajectory.communication.incomplete")}):null,a.bodyState==="present"?l("pre",{className:ph,children:a.text}):l("span",{className:"px-1 text-xs text-muted-foreground",children:r(DS[a.bodyState])}),l("span",{className:"px-1 text-xs text-muted-foreground",children:a.phaseAt===null?s:`${s} ${Yn(a.phaseAt,n,r)}`})]})}var BS=pe(function({environmentId:t,toolPresentation:o,row:n,inputKey:r,expanded:a,highlighted:s,toggleExpanded:i,resolveChatAnchorMessageId:d,onOpenInChat:c,timestampFormat:u,threadRef:m,useToolCallDetail:p,useCommunicationRecord:f}){let{t:g}=z(),{formatDuration:h}=_o(),y=W(()=>n.kind==="tool-call"?{toolMetadata:{source:n.source??"unknown",toolName:n.toolName,pluginId:n.pluginId,mcpServer:n.mcpServer,action:n.action,skillName:n.skillName},builtinMcpTool:n.builtinMcpTool,toolArgs:n.toolArgs}:void 0,[n]),x=y===void 0?null:o?.(y)??null,C=n.detail!==void 0||n.toolCallId!==void 0,b=d(n);return l(Gr,{value:n.id,children:[v(Jr,{"data-trajectory-row-id":n.id,"data-timeline-row-id":n.id,tabIndex:-1,className:V(C&&"cursor-pointer",s&&"outline-2 outline-primary"),onClick:C?()=>i(n.id):void 0,children:[l(bn,{className:"whitespace-nowrap text-muted-foreground",title:wn(n.createdAt,u,g),children:Yn(n.createdAt,u,g)}),l(bn,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${n.kind}`)}),v(bn,{className:"max-w-0 whitespace-normal",children:[v("span",{className:"inline-flex items-start gap-1",children:[C?l(K,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(a?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":a,onClick:L=>{L.stopPropagation(),i(n.id)},children:a?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0})}):null,l(OS,{row:n,environmentId:t,presentation:x})]}),n.kind==="tool-call"?v("span",{className:"ml-2 inline-flex flex-wrap gap-x-2 text-xs text-muted-foreground","data-trajectory-source":!0,children:[l("span",{children:g(`trajectory.sources.${n.source??"unknown"}`)}),n.source==="plugin"&&n.pluginId?l(Mo,{environmentId:t,pluginId:n.pluginId,iconClassName:"size-3"}):null,n.source==="mcp"&&n.mcpServer?l("span",{children:n.mcpServer}):null,n.action==="skill-read"?l("span",{children:n.skillName?g("trajectory.sourceFilter.skillReadNamed",{name:n.skillName}):g("trajectory.sourceFilter.skillRead")}):null]}):null]}),v(bn,{className:"whitespace-nowrap",children:[g(`trajectory.status.${n.status}`),n.rewrittenBy?.length?l(_d,{plugins:n.rewrittenBy,environmentId:t}):null]}),l(bn,{className:"whitespace-nowrap text-muted-foreground",children:n.durationMs!==void 0?h(n.durationMs):g("trajectory.valueUnknown")}),l(bn,{className:"whitespace-nowrap",children:b!==null?v(Pe,{children:[l(Ee,{render:l(K,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:L=>{L.stopPropagation(),c(b)}}),children:l($a,{"aria-hidden":!0})}),l(Re,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${r}:${n.id}`),a&&C?l(Jr,{className:"hover:bg-transparent","data-trajectory-detail-row":n.id,"data-timeline-row-id":n.id,children:v(bn,{colSpan:6,className:"whitespace-normal",children:[l("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),n.kind==="tool-call"&&n.toolCallId!==void 0?l(_S,{threadRef:m,rewritten:(n.rewrittenBy?.length??0)>0,useToolCallDetail:p,toolCallId:n.toolCallId,turnId:n.turnId,fallback:n.detail,revision:`${n.status}:${n.updatedActivityId??n.activityId??n.id}`}):n.communication!==void 0?l(FS,{useCommunicationRecord:f,recordId:n.communication.recordId,fallback:n.detail,timestampFormat:u}):n.detail!==void 0?l("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:n.detail}):null]})},`${r}:${n.id}:detail`):null]},`${r}:${n.id}:owner`)});var HS=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];$();var Mp=class extends ur{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 mh(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let o=e.querySelector("thead"),n=t.top+(o?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=Ga(r,n),s=[];if(a<0)return s;for(let i=a;i<r.length;i+=1){let d=r[i];if(d.getBoundingClientRect().top>=t.bottom)break;let c=d.querySelectorAll("[data-timeline-row-id]"),u=Ga(c,n);if(!(u<0))for(let m=u;m<c.length;m++){let p=c[m];if(p.getBoundingClientRect().top>=t.bottom)break;s.push(p)}}return s}function Ap(e){return e?.source!==void 0||e?.pluginId!==void 0||e?.mcpServer!==void 0}function US(e,t){if(t==="all")return e;let o=new Set(e.filter(n=>n.kind===t).map(n=>n.turnId??null));return e.filter(n=>n.kind===t||o.has(n.turnId??null)&&(n.kind==="user-message"||n.kind==="assistant-message"))}var c$=["native","ycodium","plugin","mcp","unknown"];function $S(e){let{t}=z(),o=Qn(e.environmentId,e.detail);return e.source!=="plugin"?l(oe,{children:e.detail}):o===null?l(oe,{children:t("trajectory.sources.plugin")}):l(Mo,{environmentId:e.environmentId,pluginId:e.detail})}function zS({environmentId:e,filter:t,query:o,onChange:n}){let{t:r}=z(),a=Ap(t),s=t?.source,i=s==="plugin"?"pluginId":s==="mcp"?"mcpServer":null,d=i===null?void 0:t?.[i],c=i===null?[]:[...new Set(o.sources.flatMap(u=>u.source===s&&u[i]!==void 0?[u[i]]:[]))];return d!==void 0&&!c.includes(d)&&c.push(d),v("div",{className:"flex flex-wrap items-center gap-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":r("trajectory.sourceFilter.label"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:a?"ghost":"secondary","aria-pressed":!a,onClick:()=>n({}),children:r("trajectory.sourceFilter.all")}),c$.filter(u=>u===s||o.sources.some(m=>m.source===u)).map(u=>l(K,{size:"xs",variant:s===u?"secondary":"ghost","aria-pressed":s===u,onClick:()=>n({source:u}),children:r(`trajectory.sources.${u}`)},u))]}),i!==null?v(Xs,{value:d===void 0?"all":`detail:${d}`,onValueChange:u=>{u===null||s===void 0||n(u==="all"?{source:s}:{source:s,[i]:u.slice(7)})},children:[l(Sb,{size:"xs",className:"max-w-full","aria-label":r(s==="plugin"?"trajectory.sourceFilter.plugin":"trajectory.sourceFilter.mcp"),children:d!==void 0&&s!==void 0?l($S,{environmentId:e,source:s,detail:d}):r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),v(Ys,{children:[l(qa,{value:"all",children:r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),c.map(u=>l(qa,{value:`detail:${u}`,children:s===void 0?u:l($S,{environmentId:e,source:s,detail:u})},u))]})]}):null,a?l(K,{size:"xs",variant:"ghost",onClick:()=>n({}),children:r("trajectory.sourceFilter.clear")}):null,o.loading?l("span",{role:"status",className:"text-xs text-muted-foreground",children:r("trajectory.sourceFilter.loading")}):null,o.error!==null?v("div",{role:"alert",className:"flex flex-wrap items-center gap-1 text-xs text-destructive-foreground",children:[l("span",{children:r("trajectory.sourceFilter.error",{error:o.error})}),l(K,{size:"xs",variant:"outline",disabled:o.loading,onClick:()=>o.retry(),children:r("trajectory.sourceFilter.retry")})]}):null]})}var KS=50,u$=32;function p$(e){let t=[];for(let o=0;o<e.length;o+=KS)t.push(e.slice(o,o+KS));return t}var qS=pe(function({environmentId:t="",toolPresentation:o,inputKey:n,rows:r,groupRows:a,sourceQuery:s,toolFilter:i,onToolFilterChange:d,onOpenFileDiff:c,loadEarlier:u,loadLater:m=null,pagingBlockedByInteraction:p=!1,onReturnToLatest:f=null,onVisibleTurnRangeChange:g=null,timestampFormat:h,contentInsetEndAdjustment:y=0,paneVisible:x,useToolCallDetail:C,useCommunicationRecord:b,threadRef:L,resolveChatAnchorMessageId:w,onOpenInChat:k}){let{t:I}=z(),T=Ap(i),S=T?JSON.stringify([n,i?.source,i?.pluginId,i?.mcpServer]):n,[P,A]=Ge(n,"all",{namespace:"trajectory-kind-filter"}),[N,B]=Ge(n,()=>new Set,{namespace:"trajectory-expanded-rows"}),[O,j]=Ge(n,!0,{namespace:"trajectory-follow-latest"}),U=W(()=>{let se=new Set(r.map(Le=>Le.kind));return HS.filter(Le=>se.has(Le))},[r]),D=W(()=>US(r,P),[r,P]),J=E(null),G=E(!1);fe(()=>{G.current=!1},[S]);let M=R(()=>{A("all"),T&&d?.({})},[A,T,d]),X=Xb({inputKey:n,rows:D,groupRows:a,paneVisible:x,resetFilter:M}),F=X.rows,ee=W(()=>p$(F),[F]),Y=se=>B(Le=>{let be=new Set(Le);return be.has(se)?be.delete(se):be.add(se),be}),ae=E(null),te=R(se=>{J.current=se,se&&(ae.current=se)},[]),de=$e(S,!0,{namespace:"trajectory-at-end"}),ge=$e(S,0,{namespace:"trajectory-scroll-top"}),ne=$e(S,null,{namespace:"trajectory-row-anchor"}),Z=E({viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p});Z.current={viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p};let ve=E(null);fe(()=>{if(ve.current=null,!!x)return()=>{ve.current=null,g?.(null)}},[S,x,g]);let he=W(()=>({inputKey:n,store:gd()}),[n]),Ae=E(he);Ae.current=he;let De=E(()=>{}),je=R(se=>{let Le=Ae.current;return Le.store.acquire(se,()=>{Ae.current===Le&&De.current()})},[]),ot=W(()=>{let se=F.map((Le,be)=>({key:Le.id,turnId:Le.turnId??null,firstRowIndex:be,endRowIndex:be+1}));return{sections:se,bySectionKey:new Map(se.map(Le=>[Le.key,Le])),byRowId:new Map(se.map(Le=>[Le.key,{turnId:Le.turnId,index:Le.firstRowIndex}]))}},[F]),me=R((se,Le)=>Array.from(se.querySelectorAll("[data-trajectory-row-id]")).find(be=>be.dataset.trajectoryRowId===Le),[]),Me=R((se,Le)=>{let be=Le[0]?.dataset.timelineRowId,Xe=be===void 0?void 0:me(se,be);Xe&&be!==void 0&&(ne.current={rowId:be,offset:se.getBoundingClientRect().top-Xe.getBoundingClientRect().top})},[me,ne]),ue=R(()=>{if(!x)return;let se=J.current??ae.current;se&&(ge.current=se.scrollTop,de.current=se.scrollHeight-se.scrollTop-se.clientHeight<=u$,F.length>0&&Me(se,mh(se)))},[de,F.length,x,Me,ge]),ce=R(()=>Z.current.viewportKey===S&&Z.current.paneVisible,[S]),Ze=R(()=>{if(!ce()||g===null)return;let se=J.current;if(!se||se.clientHeight<=0)return;let Le=mh(se);Me(se,Le);let be=he.store.rows(),Xe=se.ownerDocument.activeElement;if(ai(Xe)){let It=ri(Xe,se);It&&be.push(It)}let xt=Ju({index:ot,visibleSectionKeys:Le.flatMap(It=>{let po=It.dataset.timelineRowId;return po===void 0?[]:[po]}),protectedRowIds:be,selectionRows:Zu(se)}),tt=JSON.stringify(xt);ve.current!==tt&&(ve.current=tt,g(xt))},[he,ce,g,ot,Me]),pt=Zr(x),ze=R(()=>{ce()&&g!==null&&pt.request(Ze)},[ce,g,pt,Ze]);De.current=ze;let et=R(se=>{let Le=ne.current,be=Le===null?void 0:me(se,Le.rowId),Xe=be?.closest("[data-trajectory-chunk]"),xt=Xe?.style.contentVisibility;Xe&&(Xe.style.contentVisibility="visible");try{se.scrollTop=be===void 0?T?0:ge.current:se.scrollTop+be.getBoundingClientRect().top-se.getBoundingClientRect().top+Le.offset}finally{Xe&&(Xe.style.contentVisibility=xt??"")}},[me,ne,ge,T]),Et=R(()=>{ce()&&(ue(),ze())},[ue,ce,ze]),ft=R(()=>{!ce()||Z.current.pagingBlockedByInteraction||u?.loading||(ue(),T&&(G.current=!0),u?.onLoadEarlier())},[ue,ce,u,T]),Ct=R(()=>{!ce()||Z.current.pagingBlockedByInteraction||m?.loading||(ue(),T&&(G.current=!0),m?.onLoadLater())},[ue,ce,m,T]),gt=R(()=>{ce()&&f?.(()=>{if(!ce())return;de.current=!0,j(!0);let se=J.current;se&&(se.scrollTop=se.scrollHeight)})},[ce,f,de,j]),Dt=se=>{if(!(!ce()||T)){if(se&&m!==null){gt();return}se&&(de.current=!0),j(se)}},Mt=R(se=>{if(T&&G.current){se.scrollTop=0,ge.current=0,ne.current=null,s?.loading||(G.current=!1);return}let Le=X.request;if(Le!==null){de.current=!1,j(!1);let be=F.some(Xe=>Xe.id===Le.rowId)?me(se,Le.rowId):void 0;if(!be)return;be.scrollIntoView({block:"center"}),be.focus({preventScroll:!0}),ge.current=se.scrollTop,Me(se,[be]),X.completeReveal(Le);return}!T&&O&&de.current&&m===null?se.scrollTop=se.scrollHeight:et(se)},[X.request,X.completeReveal,de,j,F,me,ge,Me,O,T,s?.loading,ne,m,et]);return fe(()=>{if(!ce())return;let se=J.current;se&&(Mt(se),ze())},[Mt,y,de,N,F,O,n,ce,m,x,ze,et]),fe(()=>{let se=J.current;if(!ce()||g===null||!se)return;let Le=!0,be=()=>{Le&&ce()&&ze()},Xe=()=>{!Le||!ce()||(Mt(se),be())},xt=typeof ResizeObserver>"u"?null:new ResizeObserver(Xe);xt?.observe(se);let tt=se.querySelector("table");return tt&&xt?.observe(tt),se.addEventListener("focusin",be),se.addEventListener("focusout",be),se.ownerDocument.addEventListener("selectionchange",be),be(),()=>{Le=!1,pt.cancel(),xt?.disconnect(),se.removeEventListener("focusin",be),se.removeEventListener("focusout",be),se.ownerDocument.removeEventListener("selectionchange",be)}},[n,ce,g,x,pt,ze,Mt]),l(Mp,{inputKey:S,visible:x,rows:F,expandedRows:N,capture:ue,children:l(fd,{value:je,children:v("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[v("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":I("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:P==="all"?"secondary":"ghost","aria-pressed":P==="all",onClick:()=>A("all"),children:I("trajectory.filterAll")}),U.map(se=>l(K,{size:"xs",variant:P===se?"secondary":"ghost","aria-pressed":P===se,onClick:()=>A(se),children:I(`trajectory.kinds.${se}`)},se))]}),a?l(Xr,{size:"xs",variant:"outline",pressed:X.expandAll,disabled:p,onPressedChange:X.setExpandAll,children:I("turnOverview.expandAll")}):null,l(Xr,{className:"ml-auto",size:"xs",variant:"outline",pressed:!T&&O,disabled:T,onPressedChange:Dt,"aria-label":I("trajectory.followLatest"),children:I("trajectory.followLatest")})]}),s&&d?l(zS,{environmentId:t,filter:i,query:s,onChange:d}):null,v("div",{ref:te,className:"min-h-0 flex-1 overflow-auto",onScroll:Et,style:{paddingBottom:y},"data-trajectory-scroll":!0,children:[u!==null?v("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[l("span",{children:I("trajectory.loadEarlier")}),l(K,{size:"xs",variant:"outline",disabled:u.loading||p,onClick:ft,children:u.loading?I("trajectory.loadingEarlier"):I("trajectory.loadEarlierAction")})]}):null,F.length===0?l("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:s?.loading?I("trajectory.sourceFilter.loading"):s?.error?I("trajectory.sourceFilter.unavailable"):I(T||P!=="all"?"trajectory.sourceFilter.empty":"trajectory.empty")}):v(Pb,{children:[l(Eb,{className:"sticky top-0 z-10 bg-background",children:v(Jr,{className:"hover:bg-transparent",children:[l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnTime")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnType")}),l(Wa,{children:I("trajectory.columnSummary")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnStatus")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnDuration")}),l(Wa,{className:"w-px",children:l("span",{className:"sr-only",children:I("trajectory.openInChat")})})]})}),ee.map((se,Le)=>l(Rb,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":se[0]?.id??Le,children:se.map(be=>{let Xe=X.headers.get(be.id);if(Xe)return l(AS,{...Xe,callCounts:s?.turnCounts.get(Xe.group.turnId),sourceFiltered:T,disabled:p,highlighted:X.highlighted===be.id,onToggle:X.toggleTurn,onLocate:X.locate,onOpenFileDiff:c},be.id);let xt=X.routines.get(be.id);return xt?l(NS,{id:be.id,...xt,disabled:p,onToggle:()=>X.toggleRoutine(be.id)},be.id):l(BS,{environmentId:t,toolPresentation:o,row:be,inputKey:n,expanded:N.has(be.id),highlighted:X.highlighted===be.id,toggleExpanded:Y,resolveChatAnchorMessageId:w,onOpenInChat:k,timestampFormat:h,threadRef:L,useToolCallDetail:C,useCommunicationRecord:b},`${n}:${be.id}`)})},`${n}:${se[0]?.id??Le}`))]}),m!==null?v("div",{className:"flex justify-center gap-2 px-3 py-2",children:[l(K,{size:"xs",variant:"outline",disabled:m.loading||p,onClick:Ct,children:m.loading?I("timeline.loadingLater"):I("timeline.loadLater")}),f===null?null:l(K,{size:"xs",variant:"ghost",onClick:gt,children:I("timeline.returnToLatest")})]}):null]})]})})})});function WS({data:e,target:t,inputKey:o,paneVisible:n,timestampFormat:r,contentInsetEndAdjustment:a=0,onOpenInChat:s,onOpenFileDiff:i}){let[d,c]=Ge(o,{},{namespace:"trajectory-source-filter"}),u=e.useTrajectory({target:t,threadKey:o,visible:n,toolFilter:d}),m=e.useToolPresentation?.(t),p=R(g=>e.useToolCallDetail(t,{toolCallId:g.toolCallId,turnId:g.turnId,revision:g.revision,...g.original===void 0?{}:{original:g.original}}),[e,t]),f=R(g=>e.useCommunicationRecord(t,g),[e,t]);return l(qS,{inputKey:o,environmentId:t.environmentId,toolPresentation:m,rows:u.rows,groupRows:u.groupRows,toolFilter:d,onToolFilterChange:c,sourceQuery:u.sourceQuery,onOpenFileDiff:i,loadEarlier:u.loadEarlier,loadLater:u.loadLater,pagingBlockedByInteraction:u.pagingBlockedByInteraction,onReturnToLatest:u.onReturnToLatest,onVisibleTurnRangeChange:u.onVisibleTurnRangeChange,timestampFormat:r,contentInsetEndAdjustment:a,paneVisible:n,threadRef:t,useToolCallDetail:p,useCommunicationRecord:f,resolveChatAnchorMessageId:u.resolveChatAnchorMessageId,onOpenInChat:s})}$();$();var fh=qe(null),Np=fh.Provider;function Ho(){let e=Pt(fh);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function Co(){return Pt(fh)}$();var ns=Lx(gh());$();function YS(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>n=>{t.forEach(r=>r(n))},t)}var $d=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ja(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _p(e){return"nodeType"in e}function So(e){var t,o;return e?Ja(e)?e:_p(e)&&(t=(o=e.ownerDocument)==null?void 0:o.defaultView)!=null?t:window:window}function Op(e){let{Document:t}=So(e);return e instanceof t}function xi(e){return Ja(e)?!1:e instanceof So(e).HTMLElement}function yh(e){return e instanceof So(e).SVGElement}function Za(e){return e?Ja(e)?e.document:_p(e)?Op(e)?e:xi(e)||yh(e)?e.ownerDocument:document:document:document}var dn=$d?fe:H;function Fp(e){let t=E(e);return dn(()=>{t.current=e}),R(function(){for(var o=arguments.length,n=new Array(o),r=0;r<o;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function JS(){let e=E(null),t=R((n,r)=>{e.current=setInterval(n,r)},[]),o=R(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,o]}function bi(e,t){t===void 0&&(t=[e]);let o=E(e);return dn(()=>{o.current!==e&&(o.current=e)},t),o}function wi(e,t){let o=E();return W(()=>{let n=e(o.current);return o.current=n,n},[...t])}function zd(e){let t=Fp(e),o=E(null),n=R(r=>{r!==o.current&&t?.(r,o.current),o.current=r},[]);return[o,n]}function Bp(e){let t=E();return H(()=>{t.current=e},[e]),t.current}var hh={};function es(e,t){return W(()=>{if(t)return t;let o=hh[e]==null?0:hh[e]+1;return hh[e]=o,e+"-"+o},[e,t])}function ZS(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return n.reduce((a,s)=>{let i=Object.entries(s);for(let[d,c]of i){let u=a[d];u!=null&&(a[d]=u+e*c)}return a},{...t})}}var ts=ZS(1),os=ZS(-1);function h$(e){return"clientX"in e&&"clientY"in e}function Kd(e){if(!e)return!1;let{KeyboardEvent:t}=So(e.target);return t&&e instanceof t}function y$(e){if(!e)return!1;let{TouchEvent:t}=So(e.target);return t&&e instanceof t}function qd(e){if(y$(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:o}=e.touches[0];return{x:t,y:o}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:o}=e.changedTouches[0];return{x:t,y:o}}}return h$(e)?{x:e.clientX,y:e.clientY}:null}var na=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:o}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(o?Math.round(o):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:o}=e;return"scaleX("+t+") scaleY("+o+")"}},Transform:{toString(e){if(e)return[na.Translate.toString(e),na.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:o,easing:n}=e;return t+" "+o+"ms "+n}}}),XS="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ek(e){return e.matches(XS)?e:e.querySelector(XS)}$();var v$={display:"none"};function tk(e){let{id:t,value:o}=e;return Zt.createElement("div",{id:t,style:v$},o)}function ok(e){let{id:t,announcement:o,ariaLiveType:n="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 Zt.createElement("div",{id:t,style:r,role:"status","aria-live":n,"aria-atomic":!0},o)}function nk(){let[e,t]=q("");return{announce:R(n=>{n!=null&&t(n)},[]),announcement:e}}var hk=qe(null);function C$(e){let t=Pt(hk);H(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function x$(){let[e]=q(()=>new Set),t=R(n=>(e.add(n),()=>e.delete(n)),[e]);return[R(n=>{let{type:r,event:a}=n;e.forEach(s=>{var i;return(i=s[r])==null?void 0:i.call(s,a)})},[e]),t]}var b$={draggable:`
|
|
3563
3546
|
To pick up a draggable item, press the space bar.
|
|
3564
3547
|
While dragging, use the arrow keys to move the item.
|
|
3565
3548
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
3566
|
-
`},f$={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was moved over droppable area "+o.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was dropped over droppable area "+o.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function g$(e){let{announcements:t=f$,container:o,hiddenTextDescribedById:n,screenReaderInstructions:r=m$}=e,{announce:a,announcement:s}=e0(),i=rs("DndLiveRegion"),[d,c]=q(!1);if(H(()=>{c(!0)},[]),u$(W(()=>({onDragStart(m){let{active:p}=m;a(t.onDragStart({active:p}))},onDragMove(m){let{active:p,over:f}=m;t.onDragMove&&a(t.onDragMove({active:p,over:f}))},onDragOver(m){let{active:p,over:f}=m;a(t.onDragOver({active:p,over:f}))},onDragEnd(m){let{active:p,over:f}=m;a(t.onDragEnd({active:p,over:f}))},onDragCancel(m){let{active:p,over:f}=m;a(t.onDragCancel({active:p,over:f}))}}),[a,t])),!d)return null;let u=eo.createElement(eo.Fragment,null,eo.createElement(JS,{id:n,value:r.draggable}),eo.createElement(ZS,{id:i,announcement:s}));return o?(0,is.createPortal)(u,o):u}var jt;(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"})(jt||(jt={}));function Wp(){}function Eh(e,t){return W(()=>({sensor:e,options:t??{}}),[e,t])}function f0(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>[...t].filter(n=>n!=null),[...t])}var Rn=Object.freeze({x:0,y:0});function g0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function h0(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return o-n}function h$(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return n-o}function t0(e){let{left:t,top:o,height:n,width:r}=e;return[{x:t,y:o},{x:t+r,y:o},{x:t,y:o+n},{x:t+r,y:o+n}]}function Mh(e,t){if(!e||e.length===0)return null;let[o]=e;return t?o[t]:o}function o0(e,t,o){return t===void 0&&(t=e.left),o===void 0&&(o=e.top),{x:t+e.width*.5,y:o+e.height*.5}}var y0=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=o0(t,t.left,t.top),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=g0(o0(d),r);a.push({id:i,data:{droppableContainer:s,value:c}})}}return a.sort(h0)},v0=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=t0(t),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=t0(d),u=r.reduce((p,f,g)=>p+g0(c[g],f),0),m=Number((u/4).toFixed(4));a.push({id:i,data:{droppableContainer:s,value:m}})}}return a.sort(h0)};function y$(e,t){let o=Math.max(t.top,e.top),n=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-n,i=a-o;if(n<r&&o<a){let d=t.width*t.height,c=e.width*e.height,u=s*i,m=u/(d+c-u);return Number(m.toFixed(4))}return 0}var v$=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=[];for(let a of n){let{id:s}=a,i=o.get(s);if(i){let d=y$(i,t);d>0&&r.push({id:s,data:{droppableContainer:a,value:d}})}}return r.sort(h$)};function C$(e,t,o){return{...e,scaleX:t&&o?t.width/o.width:1,scaleY:t&&o?t.height/o.height:1}}function C0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Rn}function x$(e){return function(o){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;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}),{...o})}}var b$=x$(1);function w$(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 T$(e,t,o){let n=w$(t);if(!n)return e;let{scaleX:r,scaleY:a,x:s,y:i}=n,d=e.left-s-(1-r)*parseFloat(o),c=e.top-i-(1-a)*parseFloat(o.slice(o.indexOf(" ")+1)),u=r?e.width/r:e.width,m=a?e.height/a:e.height;return{width:u,height:m,top:c,right:d+u,bottom:c+m,left:d}}var I$={ignoreTransform:!1};function cs(e,t){t===void 0&&(t=I$);let o=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:c,transformOrigin:u}=Lo(e).getComputedStyle(e);c&&(o=T$(o,c,u))}let{top:n,left:r,width:a,height:s,bottom:i,right:d}=o;return{top:n,left:r,width:a,height:s,bottom:i,right:d}}function n0(e){return cs(e,{ignoreTransform:!0})}function S$(e){let t=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:t,bottom:o,width:t,height:o}}function k$(e,t){return t===void 0&&(t=Lo(e).getComputedStyle(e)),t.position==="fixed"}function L$(e,t){t===void 0&&(t=Lo(e).getComputedStyle(e));let o=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?o.test(a):!1})}function Yd(e,t){let o=[];function n(r){if(t!=null&&o.length>=t||!r)return o;if($p(r)&&r.scrollingElement!=null&&!o.includes(r.scrollingElement))return o.push(r.scrollingElement),o;if(!Ti(r)||bh(r)||o.includes(r))return o;let a=Lo(e).getComputedStyle(r);return r!==e&&L$(r,a)&&o.push(r),k$(r,a)?o:n(r.parentNode)}return e?n(e):o}function x0(e){let[t]=Yd(e,1);return t??null}function wh(e){return!Kd||!e?null:os(e)?e:Up(e)?$p(e)||e===ns(e).scrollingElement?window:Ti(e)?e:null:null}function b0(e){return os(e)?e.scrollX:e.scrollLeft}function w0(e){return os(e)?e.scrollY:e.scrollTop}function Sh(e){return{x:b0(e),y:w0(e)}}var to;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(to||(to={}));function T0(e){return!Kd||!e?!1:e===document.scrollingElement}function I0(e){let t={x:0,y:0},o=T0(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-o.width,y:e.scrollHeight-o.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:r,isLeft:a,isBottom:s,isRight:i,maxScroll:n,minScroll:t}}var R$={x:.2,y:.2};function P$(e,t,o,n,r){let{top:a,left:s,right:i,bottom:d}=o;n===void 0&&(n=10),r===void 0&&(r=R$);let{isTop:c,isBottom:u,isLeft:m,isRight:p}=I0(e),f={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!c&&a<=t.top+h.height?(f.y=to.Backward,g.y=n*Math.abs((t.top+h.height-a)/h.height)):!u&&d>=t.bottom-h.height&&(f.y=to.Forward,g.y=n*Math.abs((t.bottom-h.height-d)/h.height)),!p&&i>=t.right-h.width?(f.x=to.Forward,g.x=n*Math.abs((t.right-h.width-i)/h.width)):!m&&s<=t.left+h.width&&(f.x=to.Backward,g.x=n*Math.abs((t.left+h.width-s)/h.width)),{direction:f,speed:g}}function E$(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:o,right:n,bottom:r}=e.getBoundingClientRect();return{top:t,left:o,right:n,bottom:r,width:e.clientWidth,height:e.clientHeight}}function S0(e){return e.reduce((t,o)=>as(t,Sh(o)),Rn)}function M$(e){return e.reduce((t,o)=>t+b0(o),0)}function A$(e){return e.reduce((t,o)=>t+w0(o),0)}function N$(e,t){if(t===void 0&&(t=cs),!e)return;let{top:o,left:n,bottom:r,right:a}=t(e);x0(e)&&(r<=0||a<=0||o>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var D$=[["x",["left","right"],M$],["y",["top","bottom"],A$]],Vd=class{constructor(t,o){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 n=Yd(o),r=S0(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,s,i]of D$)for(let d of s)Object.defineProperty(this,d,{get:()=>{let c=i(n),u=r[a]-c;return this.rect[d]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},ls=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(o=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...o)})},this.target=t}add(t,o,n){var r;(r=this.target)==null||r.addEventListener(t,o,n),this.listeners.push([t,o,n])}};function _$(e){let{EventTarget:t}=Lo(e);return e instanceof t?e:ns(e)}function Th(e,t){let o=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(o**2+n**2)>t:"x"in t&&"y"in t?o>t.x&&n>t.y:"x"in t?o>t.x:"y"in t?n>t.y:!1}var mn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(mn||(mn={}));function r0(e){e.preventDefault()}function O$(e){e.stopPropagation()}var Qe;(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"})(Qe||(Qe={}));var k0={start:[Qe.Space,Qe.Enter],cancel:[Qe.Esc],end:[Qe.Space,Qe.Enter,Qe.Tab]},F$=(e,t)=>{let{currentCoordinates:o}=t;switch(e.code){case Qe.Right:return{...o,x:o.x+25};case Qe.Left:return{...o,x:o.x-25};case Qe.Down:return{...o,y:o.y+25};case Qe.Up:return{...o,y:o.y-25}}},ki=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:o}}=t;this.props=t,this.listeners=new ls(ns(o)),this.windowListeners=new ls(Lo(o)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(mn.Resize,this.handleCancel),this.windowListeners.add(mn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(mn.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:o}=this.props,n=t.node.current;n&&N$(n),o(Rn)}handleKeyDown(t){if(Wd(t)){let{active:o,context:n,options:r}=this.props,{keyboardCodes:a=k0,coordinateGetter:s=F$,scrollBehavior:i="smooth"}=r,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}let{collisionRect:c}=n.current,u=c?{x:c.left,y:c.top}:Rn;this.referenceCoordinates||(this.referenceCoordinates=u);let m=s(t,{active:o,context:n.current,currentCoordinates:u});if(m){let p=ss(m,u),f={x:0,y:0},{scrollableAncestors:g}=n.current;for(let h of g){let y=t.code,{isTop:x,isRight:C,isLeft:b,isBottom:L,maxScroll:w,minScroll:k}=I0(h),I=E$(h),T={x:Math.min(y===Qe.Right?I.right-I.width/2:I.right,Math.max(y===Qe.Right?I.left:I.left+I.width/2,m.x)),y:Math.min(y===Qe.Down?I.bottom-I.height/2:I.bottom,Math.max(y===Qe.Down?I.top:I.top+I.height/2,m.y))},S=y===Qe.Right&&!C||y===Qe.Left&&!b,R=y===Qe.Down&&!L||y===Qe.Up&&!x;if(S&&T.x!==m.x){let A=h.scrollLeft+p.x,N=y===Qe.Right&&A<=w.x||y===Qe.Left&&A>=k.x;if(N&&!p.y){h.scrollTo({left:A,behavior:i});return}N?f.x=h.scrollLeft-A:f.x=y===Qe.Right?h.scrollLeft-w.x:h.scrollLeft-k.x,f.x&&h.scrollBy({left:-f.x,behavior:i});break}else if(R&&T.y!==m.y){let A=h.scrollTop+p.y,N=y===Qe.Down&&A<=w.y||y===Qe.Up&&A>=k.y;if(N&&!p.x){h.scrollTo({top:A,behavior:i});return}N?f.y=h.scrollTop-A:f.y=y===Qe.Down?h.scrollTop-w.y:h.scrollTop-k.y,f.y&&h.scrollBy({top:-f.y,behavior:i});break}}this.handleMove(t,as(ss(m,this.referenceCoordinates),f))}}}handleMove(t,o){let{onMove:n}=this.props;t.preventDefault(),n(o)}handleEnd(t){let{onEnd:o}=this.props;t.preventDefault(),this.detach(),o()}handleCancel(t){let{onCancel:o}=this.props;t.preventDefault(),this.detach(),o()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};ki.activators=[{eventName:"onKeyDown",handler:(e,t,o)=>{let{keyboardCodes:n=k0,onActivation:r}=t,{active:a}=o,{code:s}=e.nativeEvent;if(n.start.includes(s)){let i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function a0(e){return!!(e&&"distance"in e)}function s0(e){return!!(e&&"delay"in e)}var Qd=class{constructor(t,o,n){var r;n===void 0&&(n=_$(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=o;let{event:a}=t,{target:s}=a;this.props=t,this.events=o,this.document=ns(s),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(Lo(s)),this.initialCoordinates=(r=Gd(a))!=null?r:Rn,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:o,bypassActivationConstraint:n}}}=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(mn.Resize,this.handleCancel),this.windowListeners.add(mn.DragStart,r0),this.windowListeners.add(mn.VisibilityChange,this.handleCancel),this.windowListeners.add(mn.ContextMenu,r0),this.documentListeners.add(mn.Keydown,this.handleKeydown),o){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(s0(o)){this.timeoutId=setTimeout(this.handleStart,o.delay),this.handlePending(o);return}if(a0(o)){this.handlePending(o);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,o){let{active:n,onPending:r}=this.props;r(n,t,this.initialCoordinates,o)}handleStart(){let{initialCoordinates:t}=this,{onStart:o}=this.props;t&&(this.activated=!0,this.documentListeners.add(mn.Click,O$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(mn.SelectionChange,this.removeTextSelection),o(t))}handleMove(t){var o;let{activated:n,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:i}}=a;if(!r)return;let d=(o=Gd(t))!=null?o:Rn,c=ss(r,d);if(!n&&i){if(a0(i)){if(i.tolerance!=null&&Th(c,i.tolerance))return this.handleCancel();if(Th(c,i.distance))return this.handleStart()}if(s0(i)&&Th(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),s(d)}handleEnd(){let{onAbort:t,onEnd:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleCancel(){let{onAbort:t,onCancel:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleKeydown(t){t.code===Qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},B$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Li=class extends Qd{constructor(t){let{event:o}=t,n=ns(o.target);super(t,B$,n)}};Li.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return!o.isPrimary||o.button!==0?!1:(n?.({event:o}),!0)}}];var H$={move:{name:"mousemove"},end:{name:"mouseup"}},kh;(function(e){e[e.RightClick=2]="RightClick"})(kh||(kh={}));var Lh=class extends Qd{constructor(t){super(t,H$,ns(t.event.target))}};Lh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return o.button===kh.RightClick?!1:(n?.({event:o}),!0)}}];var Ih={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Rh=class extends Qd{constructor(t){super(t,Ih)}static setup(){return window.addEventListener(Ih.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ih.move.name,t)};function t(){}}};Rh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t,{touches:r}=o;return r.length>1?!1:(n?.({event:o}),!0)}}];var jd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(jd||(jd={}));var Gp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Gp||(Gp={}));function U$(e){let{acceleration:t,activator:o=jd.Pointer,canScroll:n,draggingRect:r,enabled:a,interval:s=5,order:i=Gp.TreeOrder,pointerCoordinates:d,scrollableAncestors:c,scrollableAncestorRects:u,delta:m,threshold:p}=e,f=z$({delta:m,disabled:!a}),[g,h]=QS(),y=M({x:0,y:0}),x=M({x:0,y:0}),C=W(()=>{switch(o){case jd.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case jd.DraggableRect:return r}},[o,r,d]),b=M(null),L=P(()=>{let k=b.current;if(!k)return;let I=y.current.x*x.current.x,T=y.current.y*x.current.y;k.scrollBy(I,T)},[]),w=W(()=>i===Gp.TreeOrder?[...c].reverse():c,[i,c]);H(()=>{if(!a||!c.length||!C){h();return}for(let k of w){if(n?.(k)===!1)continue;let I=c.indexOf(k),T=u[I];if(!T)continue;let{direction:S,speed:R}=P$(k,T,C,t,p);for(let A of["x","y"])f[A][S[A]]||(R[A]=0,S[A]=0);if(R.x>0||R.y>0){h(),b.current=k,g(L,s),y.current=R,x.current=S;return}}y.current={x:0,y:0},x.current={x:0,y:0},h()},[t,L,n,h,a,s,JSON.stringify(C),JSON.stringify(f),g,c,w,u,JSON.stringify(p)])}var $$={x:{[to.Backward]:!1,[to.Forward]:!1},y:{[to.Backward]:!1,[to.Forward]:!1}};function z$(e){let{delta:t,disabled:o}=e,n=Kp(t);return Si(r=>{if(o||!n||!r)return $$;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[to.Backward]:r.x[to.Backward]||a.x===-1,[to.Forward]:r.x[to.Forward]||a.x===1},y:{[to.Backward]:r.y[to.Backward]||a.y===-1,[to.Forward]:r.y[to.Forward]||a.y===1}}},[o,t,n])}function K$(e,t){let o=t!=null?e.get(t):void 0,n=o?o.node.current:null;return Si(r=>{var a;return t==null?null:(a=n??r)!=null?a:null},[n,t])}function q$(e,t){return W(()=>e.reduce((o,n)=>{let{sensor:r}=n,a=r.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...o,...a]},[]),[e,t])}var Xd;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Xd||(Xd={}));var Ph;(function(e){e.Optimized="optimized"})(Ph||(Ph={}));var i0=new Map;function W$(e,t){let{dragging:o,dependencies:n,config:r}=t,[a,s]=q(null),{frequency:i,measure:d,strategy:c}=r,u=M(e),m=y(),p=Ii(m),f=P(function(x){x===void 0&&(x=[]),!p.current&&s(C=>C===null?x:C.concat(x.filter(b=>!C.includes(b))))},[p]),g=M(null),h=Si(x=>{if(m&&!o)return i0;if(!x||x===i0||u.current!==e||a!=null){let C=new Map;for(let b of e){if(!b)continue;if(a&&a.length>0&&!a.includes(b.id)&&b.rect.current){C.set(b.id,b.rect.current);continue}let L=b.node.current,w=L?new Vd(d(L),L):null;b.rect.current=w,w&&C.set(b.id,w)}return C}return x},[e,a,o,m,d]);return H(()=>{u.current=e},[e]),H(()=>{m||f()},[o,m]),H(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),H(()=>{m||typeof i!="number"||g.current!==null||(g.current=setTimeout(()=>{f(),g.current=null},i))},[i,m,f,...n]),{droppableRects:h,measureDroppableContainers:f,measuringScheduled:a!=null};function y(){switch(c){case Xd.Always:return!1;case Xd.BeforeDragging:return o;default:return!o}}}function L0(e,t){return Si(o=>e?o||(typeof t=="function"?t(e):e):null,[t,e])}function G$(e,t){return L0(e,t)}function j$(e){let{callback:t,disabled:o}=e,n=zp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(n)},[n,o]);return H(()=>()=>r?.disconnect(),[r]),r}function jp(e){let{callback:t,disabled:o}=e,n=zp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(n)},[o]);return H(()=>()=>r?.disconnect(),[r]),r}function V$(e){return new Vd(cs(e),e)}function l0(e,t,o){t===void 0&&(t=V$);let[n,r]=q(null);function a(){r(d=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=d??o)!=null?c:null}let u=t(e);return JSON.stringify(d)===JSON.stringify(u)?d:u})}let s=j$({callback(d){if(e)for(let c of d){let{type:u,target:m}=c;if(u==="childList"&&m instanceof HTMLElement&&m.contains(e)){a();break}}}}),i=jp({callback:a});return pn(()=>{a(),e?(i?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),s?.disconnect())},[e]),n}function Q$(e){let t=L0(e);return C0(e,t)}var d0=[];function X$(e){let t=M(e),o=Si(n=>e?n&&n!==d0&&e&&t.current&&e.parentNode===t.current.parentNode?n:Yd(e):d0,[e]);return H(()=>{t.current=e},[e]),o}function Y$(e){let[t,o]=q(null),n=M(e),r=P(a=>{let s=wh(a.target);s&&o(i=>i?(i.set(s,Sh(s)),new Map(i)):null)},[]);return H(()=>{let a=n.current;if(e!==a){s(a);let i=e.map(d=>{let c=wh(d);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,Sh(c)]):null}).filter(d=>d!=null);o(i.length?new Map(i):null),n.current=e}return()=>{s(e),s(a)};function s(i){i.forEach(d=>{let c=wh(d);c?.removeEventListener("scroll",r)})}},[r,e]),W(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>as(a,s),Rn):S0(e):Rn,[e,t])}function c0(e,t){t===void 0&&(t=[]);let o=M(null);return H(()=>{o.current=null},t),H(()=>{let n=e!==Rn;n&&!o.current&&(o.current=e),!n&&o.current&&(o.current=null)},[e]),o.current?ss(e,o.current):Rn}function J$(e){H(()=>{if(!Kd)return;let t=e.map(o=>{let{sensor:n}=o;return n.setup==null?void 0:n.setup()});return()=>{for(let o of t)o?.()}},e.map(t=>{let{sensor:o}=t;return o}))}function Z$(e,t){return W(()=>e.reduce((o,n)=>{let{eventName:r,handler:a}=n;return o[r]=s=>{a(s,t)},o},{}),[e,t])}function R0(e){return W(()=>e?S$(e):null,[e])}var u0=[];function ez(e,t){t===void 0&&(t=cs);let[o]=e,n=R0(o?Lo(o):null),[r,a]=q(u0);function s(){a(()=>e.length?e.map(d=>T0(d)?n:new Vd(t(d),d)):u0)}let i=jp({callback:s});return pn(()=>{i?.disconnect(),s(),e.forEach(d=>i?.observe(d))},[e]),r}function tz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Ti(t)?t:e}function oz(e){let{measure:t}=e,[o,n]=q(null),r=P(c=>{for(let{target:u}of c)if(Ti(u)){n(m=>{let p=t(u);return m?{...m,width:p.width,height:p.height}:p});break}},[t]),a=jp({callback:r}),s=P(c=>{let u=tz(c);a?.disconnect(),u&&a?.observe(u),n(u?t(u):null)},[t,a]),[i,d]=qd(s);return W(()=>({nodeRef:i,rect:o,setRef:d}),[o,i,d])}var nz=[{sensor:Li,options:{}},{sensor:ki,options:{}}],rz={current:{}},qp={draggable:{measure:n0},droppable:{measure:n0,strategy:Xd.WhileDragging,frequency:Ph.Optimized},dragOverlay:{measure:cs}},ds=class extends Map{get(t){var o;return t!=null&&(o=super.get(t))!=null?o:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:o}=t;return!o})}getNodeFor(t){var o,n;return(o=(n=this.get(t))==null?void 0:n.node.current)!=null?o:void 0}},az={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ds,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Wp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qp,measureDroppableContainers:Wp,windowRect:null,measuringScheduled:!1},sz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Wp,draggableNodes:new Map,over:null,measureDroppableContainers:Wp},Vp=qe(sz),P0=qe(az);function iz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ds}}}function lz(e,t){switch(t.type){case jt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case jt.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 jt.DragEnd:case jt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case jt.RegisterDroppable:{let{element:o}=t,{id:n}=o,r=new ds(e.droppable.containers);return r.set(n,o),{...e,droppable:{...e.droppable,containers:r}}}case jt.SetDroppableDisabled:{let{id:o,key:n,disabled:r}=t,a=e.droppable.containers.get(o);if(!a||n!==a.key)return e;let s=new ds(e.droppable.containers);return s.set(o,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case jt.UnregisterDroppable:{let{id:o,key:n}=t,r=e.droppable.containers.get(o);if(!r||n!==r.key)return e;let a=new ds(e.droppable.containers);return a.delete(o),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function dz(e){let{disabled:t}=e,{active:o,activatorEvent:n,draggableNodes:r}=Rt(Vp),a=Kp(n),s=Kp(o?.id);return H(()=>{if(!t&&!n&&a&&s!=null){if(!Wd(a)||document.activeElement===a.target)return;let i=r.get(s);if(!i)return;let{activatorNode:d,node:c}=i;if(!d.current&&!c.current)return;requestAnimationFrame(()=>{for(let u of[d.current,c.current]){if(!u)continue;let m=YS(u);if(m){m.focus();break}}})}},[n,t,r,s,a]),null}function cz(e,t){let{transform:o,...n}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...n}),o):o}function uz(e){return W(()=>({draggable:{...qp.draggable,...e?.draggable},droppable:{...qp.droppable,...e?.droppable},dragOverlay:{...qp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function pz(e){let{activeNode:t,measure:o,initialRect:n,config:r=!0}=e,a=M(!1),{x:s,y:i}=typeof r=="boolean"?{x:r,y:r}:r;pn(()=>{if(!s&&!i||!t){a.current=!1;return}if(a.current||!n)return;let c=t?.node.current;if(!c||c.isConnected===!1)return;let u=o(c),m=C0(u,n);if(s||(m.x=0),i||(m.y=0),a.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){let p=x0(c);p&&p.scrollBy({top:m.y,left:m.x})}},[t,s,i,n,o])}var E0=qe({...Rn,scaleX:1,scaleY:1}),la;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(la||(la={}));var M0=pe(function(t){var o,n,r,a;let{id:s,accessibility:i,autoScroll:d=!0,children:c,sensors:u=nz,collisionDetection:m=v$,measuring:p,modifiers:f,...g}=t,h=_a(lz,void 0,iz),[y,x]=h,[C,b]=p$(),[L,w]=q(la.Uninitialized),k=L===la.Initialized,{draggable:{active:I,nodes:T,translate:S},droppable:{containers:R}}=y,A=I!=null?T.get(I):null,N=M({initial:null,translated:null}),B=W(()=>{var At;return I!=null?{id:I,data:(At=A?.data)!=null?At:rz,rect:N}:null},[I,A]),O=M(null),[V,U]=q(null),[D,X]=q(null),j=Ii(g,Object.values(g)),E=rs("DndDescribedBy",s),Y=W(()=>R.getEnabled(),[R]),F=uz(p),{droppableRects:Z,measureDroppableContainers:J,measuringScheduled:ne}=W$(Y,{dragging:k,dependencies:[S.x,S.y],config:F.droppable}),te=K$(T,I),le=W(()=>D?Gd(D):null,[D]),ge=xn(),re=G$(te,F.draggable.measure);pz({activeNode:I!=null?T.get(I):null,config:ge.layoutShiftCompensation,initialRect:re,measure:F.draggable.measure});let ee=l0(te,F.draggable.measure,re),ve=l0(te?te.parentElement:null),he=M({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ne=R.getNodeFor((o=he.current.over)==null?void 0:o.id),De=oz({measure:F.dragOverlay.measure}),je=(n=De.nodeRef.current)!=null?n:te,nt=k?(r=De.rect)!=null?r:ee:null,me=!!(De.nodeRef.current&&De.rect),Ae=Q$(me?null:ee),ue=R0(je?Lo(je):null),ce=X$(k?Ne??te:null),Ze=ez(ce),pt=cz(f,{transform:{x:S.x-Ae.x,y:S.y-Ae.y,scaleX:1,scaleY:1},activatorEvent:D,active:B,activeNodeRect:ee,containerNodeRect:ve,draggingNodeRect:nt,over:he.current.over,overlayNodeRect:De.rect,scrollableAncestors:ce,scrollableAncestorRects:Ze,windowRect:ue}),ze=le?as(le,S):null,et=Y$(ce),Et=c0(et),ft=c0(et,[ee]),Ct=as(pt,Et),gt=nt?b$(nt,pt):null,_t=B&>?m({active:B,collisionRect:gt,droppableRects:Z,droppableContainers:Y,pointerCoordinates:ze}):null,Mt=Mh(_t,"id"),[se,Le]=q(null),be=me?pt:as(pt,ft),Ye=C$(be,(a=se?.rect)!=null?a:null,ee),xt=M(null),tt=P((At,St)=>{let{sensor:bt,options:mo}=St;if(O.current==null)return;let kt=T.get(O.current);if(!kt)return;let Ot=At.nativeEvent,Yt=new bt({active:O.current,activeNode:kt,event:Ot,options:mo,context:he,onAbort(dt){if(!T.get(dt))return;let{onDragAbort:Ut}=j.current,Jt={id:dt};Ut?.(Jt),C({type:"onDragAbort",event:Jt})},onPending(dt,Ht,Ut,Jt){if(!T.get(dt))return;let{onDragPending:fo}=j.current,go={id:dt,constraint:Ht,initialCoordinates:Ut,offset:Jt};fo?.(go),C({type:"onDragPending",event:go})},onStart(dt){let Ht=O.current;if(Ht==null)return;let Ut=T.get(Ht);if(!Ut)return;let{onDragStart:Jt}=j.current,Vo={activatorEvent:Ot,active:{id:Ht,data:Ut.data,rect:N}};(0,is.unstable_batchedUpdates)(()=>{Jt?.(Vo),w(la.Initializing),x({type:jt.DragStart,initialCoordinates:dt,active:Ht}),C({type:"onDragStart",event:Vo}),U(xt.current),X(Ot)})},onMove(dt){x({type:jt.DragMove,coordinates:dt})},onEnd:rt(jt.DragEnd),onCancel:rt(jt.DragCancel)});xt.current=Yt;function rt(dt){return async function(){let{active:Ut,collisions:Jt,over:Vo,scrollAdjustedTranslate:fo}=he.current,go=null;if(Ut&&fo){let{cancelDrop:Zt}=j.current;go={activatorEvent:Ot,active:Ut,collisions:Jt,delta:fo,over:Vo},dt===jt.DragEnd&&typeof Zt=="function"&&await Promise.resolve(Zt(go))&&(dt=jt.DragCancel)}O.current=null,(0,is.unstable_batchedUpdates)(()=>{x({type:dt}),w(la.Uninitialized),Le(null),U(null),X(null),xt.current=null;let Zt=dt===jt.DragEnd?"onDragEnd":"onDragCancel";if(go){let Kn=j.current[Zt];Kn?.(go),C({type:Zt,event:go})}})}}},[T]),It=P((At,St)=>(bt,mo)=>{let kt=bt.nativeEvent,Ot=T.get(mo);if(O.current!==null||!Ot||kt.dndKit||kt.defaultPrevented)return;let Yt={active:Ot};At(bt,St.options,Yt)===!0&&(kt.dndKit={capturedBy:St.sensor},O.current=mo,tt(bt,St))},[T,tt]),po=q$(u,It);J$(u),pn(()=>{ee&&L===la.Initializing&&w(la.Initialized)},[ee,L]),H(()=>{let{onDragMove:At}=j.current,{active:St,activatorEvent:bt,collisions:mo,over:kt}=he.current;if(!St||!bt)return;let Ot={active:St,activatorEvent:bt,collisions:mo,delta:{x:Ct.x,y:Ct.y},over:kt};(0,is.unstable_batchedUpdates)(()=>{At?.(Ot),C({type:"onDragMove",event:Ot})})},[Ct.x,Ct.y]),H(()=>{let{active:At,activatorEvent:St,collisions:bt,droppableContainers:mo,scrollAdjustedTranslate:kt}=he.current;if(!At||O.current==null||!St||!kt)return;let{onDragOver:Ot}=j.current,Yt=mo.get(Mt),rt=Yt&&Yt.rect.current?{id:Yt.id,rect:Yt.rect.current,data:Yt.data,disabled:Yt.disabled}:null,dt={active:At,activatorEvent:St,collisions:bt,delta:{x:kt.x,y:kt.y},over:rt};(0,is.unstable_batchedUpdates)(()=>{Le(rt),Ot?.(dt),C({type:"onDragOver",event:dt})})},[Mt]),pn(()=>{he.current={activatorEvent:D,active:B,activeNode:te,collisionRect:gt,collisions:_t,droppableRects:Z,draggableNodes:T,draggingNode:je,draggingNodeRect:nt,droppableContainers:R,over:se,scrollableAncestors:ce,scrollAdjustedTranslate:Ct},N.current={initial:nt,translated:gt}},[B,te,_t,gt,T,je,nt,Z,R,se,ce,Ct]),U$({...ge,delta:S,draggingRect:gt,pointerCoordinates:ze,scrollableAncestors:ce,scrollableAncestorRects:Ze});let jo=W(()=>({active:B,activeNode:te,activeNodeRect:ee,activatorEvent:D,collisions:_t,containerNodeRect:ve,dragOverlay:De,draggableNodes:T,droppableContainers:R,droppableRects:Z,over:se,measureDroppableContainers:J,scrollableAncestors:ce,scrollableAncestorRects:Ze,measuringConfiguration:F,measuringScheduled:ne,windowRect:ue}),[B,te,ee,D,_t,ve,De,T,R,Z,se,J,ce,Ze,F,ne,ue]),Xt=W(()=>({activatorEvent:D,activators:po,active:B,activeNodeRect:ee,ariaDescribedById:{draggable:E},dispatch:x,draggableNodes:T,over:se,measureDroppableContainers:J}),[D,po,B,ee,x,E,T,se,J]);return eo.createElement(m0.Provider,{value:b},eo.createElement(Vp.Provider,{value:Xt},eo.createElement(P0.Provider,{value:jo},eo.createElement(E0.Provider,{value:Ye},c)),eo.createElement(dz,{disabled:i?.restoreFocus===!1})),eo.createElement(g$,{...i,hiddenTextDescribedById:E}));function xn(){let At=V?.autoScrollEnabled===!1,St=typeof d=="object"?d.enabled===!1:d===!1,bt=k&&!At&&!St;return typeof d=="object"?{...d,enabled:bt}:{enabled:bt}}}),mz=qe(null),p0="button",fz="Draggable";function A0(e){let{id:t,data:o,disabled:n=!1,attributes:r}=e,a=rs(fz),{activators:s,activatorEvent:i,active:d,activeNodeRect:c,ariaDescribedById:u,draggableNodes:m,over:p}=Rt(Vp),{role:f=p0,roleDescription:g="draggable",tabIndex:h=0}=r??{},y=d?.id===t,x=Rt(y?E0:mz),[C,b]=qd(),[L,w]=qd(),k=Z$(s,t),I=Ii(o);pn(()=>(m.set(t,{id:t,key:a,node:C,activatorNode:L,data:I}),()=>{let S=m.get(t);S&&S.key===a&&m.delete(t)}),[m,t]);let T=W(()=>({role:f,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&f===p0?!0:void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[n,f,h,y,g,u.draggable]);return{active:d,activatorEvent:i,activeNodeRect:c,attributes:T,isDragging:y,listeners:n?void 0:k,node:C,over:p,setNodeRef:b,setActivatorNodeRef:w,transform:x}}function N0(){return Rt(P0)}var gz="Droppable",hz={timeout:25};function D0(e){let{data:t,disabled:o=!1,id:n,resizeObserverConfig:r}=e,a=rs(gz),{active:s,dispatch:i,over:d,measureDroppableContainers:c}=Rt(Vp),u=M({disabled:o}),m=M(!1),p=M(null),f=M(null),{disabled:g,updateMeasurementsFor:h,timeout:y}={...hz,...r},x=Ii(h??n),C=P(()=>{if(!m.current){m.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),f.current=null},y)},[y]),b=jp({callback:C,disabled:g||!s}),L=P((T,S)=>{b&&(S&&(b.unobserve(S),m.current=!1),T&&b.observe(T))},[b]),[w,k]=qd(L),I=Ii(t);return H(()=>{!b||!w.current||(b.disconnect(),m.current=!1,b.observe(w.current))},[w,b]),H(()=>(i({type:jt.RegisterDroppable,element:{id:n,key:a,disabled:o,node:w,rect:p,data:I}}),()=>i({type:jt.UnregisterDroppable,key:a,id:n})),[n]),H(()=>{o!==u.current.disabled&&(i({type:jt.SetDroppableDisabled,id:n,key:a,disabled:o}),u.current.disabled=o)},[n,a,o,i]),{active:s,rect:p,isOver:d?.id===n,node:w,over:d,setNodeRef:k}}$();function _0(e,t,o){let n=e.slice();return n.splice(o<0?n.length+o:o,0,n.splice(t,1)[0]),n}function yz(e,t){return e.reduce((o,n,r)=>{let a=t.get(n);return a&&(o[r]=a),o},Array(e.length))}function Qp(e){return e!==null&&e>=0}function vz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}function Cz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var O0=e=>{let{rects:t,activeIndex:o,overIndex:n,index:r}=e,a=_0(t,n,o),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 Xp={scaleX:1,scaleY:1},F0=e=>{var t;let{activeIndex:o,activeNodeRect:n,index:r,rects:a,overIndex:s}=e,i=(t=a[o])!=null?t:n;if(!i)return null;if(r===o){let c=a[s];return c?{x:0,y:o<s?c.top+c.height-(i.top+i.height):c.top-i.top,...Xp}:null}let d=xz(a,r,o);return r>o&&r<=s?{x:0,y:-i.height-d,...Xp}:r<o&&r>=s?{x:0,y:i.height+d,...Xp}:{x:0,y:0,...Xp}};function xz(e,t,o){let n=e[t],r=e[t-1],a=e[t+1];return n?o<t?r?n.top-(r.top+r.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):r?n.top-(r.top+r.height):0:0}var B0="Sortable",H0=eo.createContext({activeIndex:-1,containerId:B0,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:O0,disabled:{draggable:!1,droppable:!1}});function U0(e){let{children:t,id:o,items:n,strategy:r=O0,disabled:a=!1}=e,{active:s,dragOverlay:i,droppableRects:d,over:c,measureDroppableContainers:u}=N0(),m=rs(B0,o),p=i.rect!==null,f=W(()=>n.map(k=>typeof k=="object"&&"id"in k?k.id:k),[n]),g=s!=null,h=s?f.indexOf(s.id):-1,y=c?f.indexOf(c.id):-1,x=M(f),C=!vz(f,x.current),b=y!==-1&&h===-1||C,L=Cz(a);pn(()=>{C&&g&&u(f)},[C,f,g,u]),H(()=>{x.current=f},[f]);let w=W(()=>({activeIndex:h,containerId:m,disabled:L,disableTransforms:b,items:f,overIndex:y,useDragOverlay:p,sortedRects:yz(f,d),strategy:r}),[h,m,L.draggable,L.droppable,b,f,y,d,p,r]);return eo.createElement(H0.Provider,{value:w},t)}var bz=e=>{let{id:t,items:o,activeIndex:n,overIndex:r}=e;return _0(o,n,r).indexOf(t)},wz=e=>{let{containerId:t,isSorting:o,wasDragging:n,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:d,transition:c}=e;return!c||!n||i!==a&&r===s?!1:o?!0:s!==r&&t===d},Tz={duration:200,easing:"ease"},$0="transform",Iz=ia.Transition.toString({property:$0,duration:0,easing:"linear"}),Sz={roleDescription:"sortable"};function kz(e){let{disabled:t,index:o,node:n,rect:r}=e,[a,s]=q(null),i=M(o);return pn(()=>{if(!t&&o!==i.current&&n.current){let d=r.current;if(d){let c=cs(n.current,{ignoreTransform:!0}),u={x:d.left-c.left,y:d.top-c.top,scaleX:d.width/c.width,scaleY:d.height/c.height};(u.x||u.y)&&s(u)}}o!==i.current&&(i.current=o)},[t,o,n,r]),H(()=>{a&&s(null)},[a]),a}function z0(e){let{animateLayoutChanges:t=wz,attributes:o,disabled:n,data:r,getNewIndex:a=bz,id:s,strategy:i,resizeObserverConfig:d,transition:c=Tz}=e,{items:u,containerId:m,activeIndex:p,disabled:f,disableTransforms:g,sortedRects:h,overIndex:y,useDragOverlay:x,strategy:C}=Rt(H0),b=Lz(n,f),L=u.indexOf(s),w=W(()=>({sortable:{containerId:m,index:L,items:u},...r}),[m,r,L,u]),k=W(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:T,isOver:S,setNodeRef:R}=D0({id:s,data:w,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...d}}),{active:A,activatorEvent:N,activeNodeRect:B,attributes:O,setNodeRef:V,listeners:U,isDragging:D,over:X,setActivatorNodeRef:j,transform:E}=A0({id:s,data:w,attributes:{...Sz,...o},disabled:b.draggable}),Y=VS(R,V),F=!!A,Z=F&&!g&&Qp(p)&&Qp(y),J=!x&&D,ne=J&&Z?E:null,le=Z?ne??(i??C)({rects:h,activeNodeRect:B,activeIndex:p,overIndex:y,index:L}):null,ge=Qp(p)&&Qp(y)?a({id:s,items:u,activeIndex:p,overIndex:y}):L,re=A?.id,ee=M({activeId:re,items:u,newIndex:ge,containerId:m}),ve=u!==ee.current.items,he=t({active:A,containerId:m,isDragging:D,isSorting:F,id:s,index:L,items:u,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:c,wasDragging:ee.current.activeId!=null}),Ne=kz({disabled:!he,index:L,node:T,rect:I});return H(()=>{F&&ee.current.newIndex!==ge&&(ee.current.newIndex=ge),m!==ee.current.containerId&&(ee.current.containerId=m),u!==ee.current.items&&(ee.current.items=u)},[F,ge,m,u]),H(()=>{if(re===ee.current.activeId)return;if(re!=null&&ee.current.activeId==null){ee.current.activeId=re;return}let je=setTimeout(()=>{ee.current.activeId=re},50);return()=>clearTimeout(je)},[re]),{active:A,activeIndex:p,attributes:O,data:w,rect:I,index:L,newIndex:ge,items:u,isOver:S,isSorting:F,isDragging:D,listeners:U,node:T,overIndex:y,over:X,setNodeRef:Y,setActivatorNodeRef:j,setDroppableNodeRef:R,setDraggableNodeRef:V,transform:Ne??le,transition:De()};function De(){if(Ne||ve&&ee.current.newIndex===L)return Iz;if(!(J&&!Wd(N)||!c)&&(F||he))return ia.Transition.toString({...c,property:$0})}}function Lz(e,t){var o,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(o=e?.draggable)!=null?o:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function Yp(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 Rz=[Qe.Down,Qe.Right,Qe.Up,Qe.Left],K0=(e,t)=>{let{context:{active:o,collisionRect:n,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(Rz.includes(e.code)){if(e.preventDefault(),!o||!n)return;let d=[];a.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;let p=r.get(m.id);if(p)switch(e.code){case Qe.Down:n.top<p.top&&d.push(m);break;case Qe.Up:n.top>p.top&&d.push(m);break;case Qe.Left:n.left>p.left&&d.push(m);break;case Qe.Right:n.left<p.left&&d.push(m);break}});let c=v0({active:o,collisionRect:n,droppableRects:r,droppableContainers:d,pointerCoordinates:null}),u=Mh(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){let m=a.get(o.id),p=a.get(u),f=p?r.get(p.id):null,g=p?.node.current;if(g&&f&&m&&p){let y=Yd(g).some((k,I)=>i[I]!==k),x=q0(m,p),C=Pz(m,p),b=y||!x?{x:0,y:0}:{x:C?n.width-f.width:0,y:C?n.height-f.height:0},L={x:f.left,y:f.top};return b.x&&b.y?L:ss(L,b)}}}};function q0(e,t){return!Yp(e)||!Yp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Pz(e,t){return!Yp(e)||!Yp(t)||!q0(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Ez(e,t,o){let n={...e};return t.top+e.y<=o.top?n.y=o.top-t.top:t.bottom+e.y>=o.top+o.height&&(n.y=o.top+o.height-t.bottom),t.left+e.x<=o.left?n.x=o.left-t.left:t.right+e.x>=o.left+o.width&&(n.x=o.left+o.width-t.right),n}var W0=e=>{let{draggingNodeRect:t,transform:o,scrollableAncestorRects:n}=e,r=n[0];return!t||!r?o:Ez(o,t,r)},G0=e=>{let{transform:t}=e;return{...t,x:0}};$();$();var Jp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function j0(e){return`(min-width: ${typeof e=="number"?e:Jp[e]}px)`}function V0(e){return`(max-width: ${(typeof e=="number"?e:Jp[e])-1}px)`}function Mz(e){if(typeof e!="string"){let o=[];return e.min!=null&&o.push(j0(e.min)),e.max!=null&&o.push(V0(e.max)),e.pointer==="coarse"&&o.push("(pointer: coarse)"),e.pointer==="fine"&&o.push("(pointer: fine)"),o.length===0?"(min-width: 0px)":o.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let o of e.split(":"))if(o.startsWith("max-")){let n=o.slice(4);n in Jp&&t.push(V0(n))}else o in Jp&&t.push(j0(o));return t.length>0?t.join(" and "):e}function Az(){return!1}function Zp(e){let t=Mz(e),o=P(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),n=P(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return Xo(o,n,Az)}function Zd(e){return e.source?.kind==="user"?!1:e.source?.kind==="scheduled-wake"?e.management===void 0:!0}var Jd=e=>(e??"").split(`
|
|
3567
|
-
`).map(t=>t.trim()).find(t=>t!=="")??"";function Nz(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let o=t.toDateString()===new Date().toDateString();return new Intl.DateTimeFormat(void 0,{...o?{}:{dateStyle:"short"},timeStyle:"short"}).format(t)}var Ah={user:"turnQueue.sourceUser",schedule:"turnQueue.sourceSchedule","scheduled-wake":"turnQueue.sourceScheduledWake",record:"turnQueue.sourceSession",session:"turnQueue.sourceSession",reply:"turnQueue.sourceReply","child-report":"turnQueue.sourceChildReport","plugin-wake":"turnQueue.sourcePluginWake","board-dispatch":"turnQueue.sourceBoardDispatch","plugin-notice":"turnQueue.sourcePluginNotice","home-machine":"turnQueue.sourceHomeMachine","restart-resume":"turnQueue.sourceRestartResume"};function Q0({environmentId:e,pluginId:t,label:o}){let n=Zn(e,t??"");return t===void 0||n===null?l(oe,{children:o}):l(Do,{environmentId:e,pluginId:t})}function Nh({source:e,environmentId:t}){let{t:o}=z();return e===void 0?null:l(Xr,{variant:e.kind==="user"?"outline":e.kind==="scheduled-wake"?"info":"muted",size:"sm","data-queue-source":e.kind,children:e.kind==="person"?e.displayName:e.kind==="scheduled-wake"||e.kind==="schedule"?v(oe,{children:[o(Ah[e.kind]),e.pluginId===void 0?null:l(Q0,{environmentId:t,pluginId:e.pluginId,label:""})]}):e.kind==="plugin-wake"||e.kind==="plugin-notice"?l(Q0,{environmentId:t,pluginId:e.pluginId,label:o(Ah[e.kind])}):o(Ah[e.kind])})}function em(e,t,o){let n=Tb(t===null?null:{environmentId:e,threadId:t},o??void 0);return t===null?null:n??o}function Dh({title:e,text:t}){let{t:o}=z();return e===null||e===""?l(oe,{children:t}):l(oe,{children:t===""?o("turnQueue.titleOnly",{title:e}):o("turnQueue.sessionLine",{sender:e,text:t})})}function Dz({recordId:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=t(e),a=r===null||typeof r=="string"?null:r,s=a?.from,i=em(o,s?.kind==="thread"?s.threadId:null,s?.kind==="thread"?s.title:null);if(r===null)return l(oe,{children:"\u2026"});if(a===null||a.text===null)return l(oe,{children:n("turnQueue.messageUnavailable")});let d=s===void 0?null:s.kind==="thread"?i:s.displayName;return l(Dh,{title:d,text:Jd(_d(a.text))})}function _z({recordId:e,readRecord:t,environmentId:o}){let n=t(e),r=n===null||typeof n=="string"?null:n,a=t(r?.replyRecordId??null),s=a===null||typeof a=="string"?null:a,i=s?.from??r?.to,d=em(o,i?.kind==="thread"?i.threadId:null,i?.kind==="thread"?i.title:null),c=i===void 0?null:i.kind==="thread"?d:i.displayName,u=s?.text==null?"":Jd(_d(s.text));return c===null&&u===""?null:l(Dh,{title:c,text:u})}function Oz(e){let t=em(e.environmentId,e.threadId,e.threadTitle);return l(Dh,{title:t,text:e.text})}function Fz(e){let{t}=z(),{source:o}=e,n=em(e.environmentId,o.childThreadId,o.childTitle);return l(oe,{children:t(o.outcome==="settled"?"turnQueue.childReportSettled":o.outcome==="failed"?"turnQueue.childReportFailed":"turnQueue.childReportLine",{title:n??"",text:e.text})})}function X0({entry:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=e.source;switch(r?.kind){case"scheduled-wake":return l(oe,{children:n("turnQueue.wakeLine",{time:Nz(r.dueAt),note:e.text??""})});case"record":return t===void 0?null:l(Dz,{recordId:r.recordId,readRecord:t,environmentId:o});case"reply":return t===void 0?null:l(_z,{recordId:r.recordId,readRecord:t,environmentId:o});case"session":return l(Oz,{environmentId:o,threadId:r.threadId,threadTitle:r.threadTitle,text:Jd(e.text)});case"child-report":return l(Fz,{environmentId:o,source:r,text:Jd(e.text)});case"plugin-wake":case"person":case"board-dispatch":case"plugin-notice":case"home-machine":case"restart-resume":return l(oe,{children:Jd(e.text)});default:return l(oe,{children:e.text||n("turnQueue.attachmentsOnly")})}}$();var _h={};$t(_h,{LexicalComposerContext:()=>Y0,createLexicalComposerContext:()=>Bz,useLexicalComposerContext:()=>Hz});$();var Y0=qe(null);function Bz(e,t){let o=null;return e!=null&&(o=e[1]),{getTheme:function(){return t??(o!=null?o.getTheme():null)}}}function Hz(){let e=Rt(Y0);return e==null&&(function(t,...o){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of o)r.append("v",a);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var Oh=_h,J0=Oh.LexicalComposerContext,Z0=Oh.createLexicalComposerContext,ct=Oh.useLexicalComposerContext;var uv={};$t(uv,{$addUpdateTag:()=>Hm,$applyNodeReplacement:()=>Ic,$caretFromPoint:()=>va,$caretRangeFromSelection:()=>Ty,$cloneWithProperties:()=>rv,$cloneWithPropertiesEphemeral:()=>w5,$comparePointCaretNext:()=>lv,$copyNode:()=>ov,$create:()=>I5,$createLineBreakNode:()=>Oi,$createNodeSelection:()=>$y,$createParagraphNode:()=>Pr,$createPoint:()=>Dn,$createRangeSelection:()=>KL,$createRangeSelectionFromDom:()=>YK,$createTabNode:()=>Nm,$createTextNode:()=>oo,$extendCaretToRange:()=>sv,$findMatchingParent:()=>ac,$getAdjacentChildCaret:()=>qi,$getAdjacentNode:()=>dR,$getAdjacentSiblingOrParentSiblingCaret:()=>A5,$getCaretInDirection:()=>Ca,$getCaretRange:()=>ya,$getCaretRangeInDirection:()=>cv,$getCharacterOffsets:()=>gy,$getChildCaret:()=>Mr,$getChildCaretAtIndex:()=>IR,$getChildCaretOrSelf:()=>CR,$getCollapsedCaretRange:()=>xR,$getCommonAncestor:()=>sc,$getCommonAncestorResultBranchOrder:()=>dv,$getEditor:()=>nv,$getNearestNodeFromDOMNode:()=>Bm,$getNearestRootOrShadowRoot:()=>pR,$getNodeByKey:()=>Qt,$getNodeByKeyOrThrow:()=>mR,$getNodeFromDOMNode:()=>Qy,$getPreviousSelection:()=>bs,$getRoot:()=>Zo,$getSelection:()=>Je,$getSiblingCaret:()=>io,$getState:()=>pm,$getStateChange:()=>yK,$getTextContent:()=>e5,$getTextNodeOffset:()=>Nn,$getTextPointCaret:()=>ha,$getTextPointCaretSlice:()=>by,$getWritableNodeState:()=>Ly,$hasAncestor:()=>Lm,$hasUpdateTag:()=>y5,$insertNodes:()=>ZK,$isBlockElementNode:()=>XK,$isChildCaret:()=>An,$isDecoratorNode:()=>yt,$isEditorState:()=>r5,$isElementNode:()=>ae,$isExtendableTextPointCaret:()=>TR,$isInlineElementOrDecoratorNode:()=>v5,$isLeafNode:()=>f5,$isLineBreakNode:()=>fs,$isNodeCaret:()=>L5,$isNodeSelection:()=>xc,$isParagraphNode:()=>XL,$isRangeSelection:()=>Oe,$isRootNode:()=>lo,$isRootOrShadowRoot:()=>gn,$isSiblingCaret:()=>xs,$isTabNode:()=>Uy,$isTextNode:()=>ke,$isTextPointCaret:()=>Er,$isTextPointCaretSlice:()=>M5,$isTokenOrSegmented:()=>kr,$isTokenOrTab:()=>ua,$nodesOfType:()=>h5,$normalizeCaret:()=>En,$normalizeSelection__EXPERIMENTAL:()=>mm,$onUpdate:()=>uR,$parseSerializedNode:()=>n5,$removeTextFromCaretRange:()=>wR,$rewindSiblingCaret:()=>Vi,$selectAll:()=>g5,$setCompositionKey:()=>ro,$setPointFromCaret:()=>Wi,$setSelection:()=>qo,$setSelectionFromCaretRange:()=>bR,$setState:()=>vK,$splitAtPointCaretNext:()=>_5,$splitNode:()=>C5,$updateRangeSelectionFromCaretRange:()=>ic,ArtificialNode__DO_NOT_USE:()=>Sm,BEFORE_INPUT_COMMAND:()=>Py,BLUR_COMMAND:()=>wL,CAN_REDO_COMMAND:()=>EK,CAN_UNDO_COMMAND:()=>MK,CLEAR_EDITOR_COMMAND:()=>RK,CLEAR_HISTORY_COMMAND:()=>PK,CLICK_COMMAND:()=>aL,COLLABORATION_TAG:()=>NL,COMMAND_PRIORITY_CRITICAL:()=>d5,COMMAND_PRIORITY_EDITOR:()=>Ei,COMMAND_PRIORITY_HIGH:()=>l5,COMMAND_PRIORITY_LOW:()=>s5,COMMAND_PRIORITY_NORMAL:()=>i5,COMPOSITION_END_COMMAND:()=>Ay,COMPOSITION_END_TAG:()=>FL,COMPOSITION_START_COMMAND:()=>My,COMPOSITION_START_TAG:()=>OL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ai,COPY_COMMAND:()=>Fy,CUT_COMMAND:()=>By,DELETE_CHARACTER_COMMAND:()=>uc,DELETE_LINE_COMMAND:()=>mc,DELETE_WORD_COMMAND:()=>pc,DRAGEND_COMMAND:()=>xL,DRAGOVER_COMMAND:()=>CL,DRAGSTART_COMMAND:()=>vL,DROP_COMMAND:()=>yL,DecoratorNode:()=>gc,ElementNode:()=>fa,FOCUS_COMMAND:()=>bL,FORMAT_ELEMENT_COMMAND:()=>LK,FORMAT_TEXT_COMMAND:()=>da,HISTORIC_TAG:()=>HK,HISTORY_MERGE_TAG:()=>dm,HISTORY_PUSH_TAG:()=>UK,INDENT_CONTENT_COMMAND:()=>SK,INPUT_COMMAND:()=>Ey,INSERT_LINE_BREAK_COMMAND:()=>oc,INSERT_PARAGRAPH_COMMAND:()=>ay,INSERT_TAB_COMMAND:()=>IK,INTERNAL_$isBlock:()=>Rr,IS_ALL_FORMATTING:()=>Jz,IS_BOLD:()=>Wz,IS_CODE:()=>Qz,IS_HIGHLIGHT:()=>Iy,IS_ITALIC:()=>Gz,IS_STRIKETHROUGH:()=>jz,IS_SUBSCRIPT:()=>Xz,IS_SUPERSCRIPT:()=>Yz,IS_UNDERLINE:()=>Vz,KEY_ARROW_DOWN_COMMAND:()=>uL,KEY_ARROW_LEFT_COMMAND:()=>lL,KEY_ARROW_RIGHT_COMMAND:()=>sL,KEY_ARROW_UP_COMMAND:()=>cL,KEY_BACKSPACE_COMMAND:()=>mL,KEY_DELETE_COMMAND:()=>gL,KEY_DOWN_COMMAND:()=>Oy,KEY_ENTER_COMMAND:()=>vm,KEY_ESCAPE_COMMAND:()=>fL,KEY_MODIFIER_COMMAND:()=>TL,KEY_SPACE_COMMAND:()=>pL,KEY_TAB_COMMAND:()=>hL,LineBreakNode:()=>_i,MOVE_TO_END:()=>iL,MOVE_TO_START:()=>dL,NODE_STATE_KEY:()=>uK,OUTDENT_CONTENT_COMMAND:()=>kK,PASTE_COMMAND:()=>Ny,PASTE_TAG:()=>$K,ParagraphNode:()=>Hi,REDO_COMMAND:()=>_y,REMOVE_TEXT_COMMAND:()=>sy,RootNode:()=>Bi,SELECTION_CHANGE_COMMAND:()=>Ry,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>TK,SELECT_ALL_COMMAND:()=>iy,SKIP_COLLAB_TAG:()=>zK,SKIP_DOM_SELECTION_TAG:()=>_L,SKIP_SCROLL_INTO_VIEW_TAG:()=>DL,SKIP_SELECTION_FOCUS_TAG:()=>my,TEXT_TYPE_TO_FORMAT:()=>xo,TabNode:()=>Fi,TextNode:()=>ys,UNDO_COMMAND:()=>Dy,addClassNamesToElement:()=>$5,buildImportMap:()=>BK,configExtension:()=>F5,createCommand:()=>He,createEditor:()=>c5,createSharedNodeState:()=>Zk,createState:()=>hK,declarePeerDependency:()=>B5,defineExtension:()=>O5,flipDirection:()=>xa,getDOMOwnerDocument:()=>ev,getDOMSelection:()=>On,getDOMSelectionFromTarget:()=>fR,getDOMTextNode:()=>Cs,getEditorPropertyFromDOMNode:()=>wc,getNearestEditorFromDOMNode:()=>Vy,getRegisteredNode:()=>Gy,getRegisteredNodeOrThrow:()=>Wy,getStaticNodeConfig:()=>Sc,getTextDirection:()=>m5,getTransformSetFromKlass:()=>JL,isBlockDomNode:()=>Cy,isCurrentlyReadOnlyMode:()=>Gi,isDOMDocumentNode:()=>tR,isDOMNode:()=>ji,isDOMTextNode:()=>ir,isDOMUnmanaged:()=>vR,isDocumentFragment:()=>gR,isExactShortcutMatch:()=>st,isHTMLAnchorElement:()=>x5,isHTMLElement:()=>Ro,isInlineDomNode:()=>hR,isLexicalEditor:()=>Om,isModifierMatch:()=>lR,isSelectionCapturedInDecoratorInput:()=>jy,isSelectionWithinEditor:()=>bc,makeStepwiseIterator:()=>iv,mergeRegister:()=>K5,normalizeClassNames:()=>kc,removeClassNamesFromElement:()=>z5,removeFromParent:()=>pa,resetRandomKey:()=>u5,safeCast:()=>H5,setDOMUnmanaged:()=>T5,setNodeIndentFromDOM:()=>yR,shallowMergeConfig:()=>U5,toggleTextFormatType:()=>yc});function ie(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Wk(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var _n=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Uz=_n&&"documentMode"in document?document.documentMode:null,Pn=_n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ma=_n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),um=!(!_n||!("InputEvent"in window)||Uz)&&"getTargetRanges"in new window.InputEvent("input"),Pm=_n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Cc=_n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$z=_n&&/Android/.test(navigator.userAgent),Gk=_n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jh=_n&&$z&&Gk,Em=_n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Pn&&!Gk,zz=0,Kz=1,qz=2,Wz=1,Gz=2,jz=4,Vz=8,Qz=16,Xz=32,Yz=64,Iy=128,Jz=2047,Zz=1,eK=2,tK=3,oK=4,nK=5,rK=6,lc=Pm||Cc||Em?"\xA0":"\u200B",Mm=`
|
|
3549
|
+
`},w$={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was moved over droppable area "+o.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was dropped over droppable area "+o.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function T$(e){let{announcements:t=w$,container:o,hiddenTextDescribedById:n,screenReaderInstructions:r=b$}=e,{announce:a,announcement:s}=nk(),i=es("DndLiveRegion"),[d,c]=q(!1);if(H(()=>{c(!0)},[]),C$(W(()=>({onDragStart(m){let{active:p}=m;a(t.onDragStart({active:p}))},onDragMove(m){let{active:p,over:f}=m;t.onDragMove&&a(t.onDragMove({active:p,over:f}))},onDragOver(m){let{active:p,over:f}=m;a(t.onDragOver({active:p,over:f}))},onDragEnd(m){let{active:p,over:f}=m;a(t.onDragEnd({active:p,over:f}))},onDragCancel(m){let{active:p,over:f}=m;a(t.onDragCancel({active:p,over:f}))}}),[a,t])),!d)return null;let u=Zt.createElement(Zt.Fragment,null,Zt.createElement(tk,{id:n,value:r.draggable}),Zt.createElement(ok,{id:i,announcement:s}));return o?(0,ns.createPortal)(u,o):u}var Gt;(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"})(Gt||(Gt={}));function Up(){}function kh(e,t){return W(()=>({sensor:e,options:t??{}}),[e,t])}function yk(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>[...t].filter(n=>n!=null),[...t])}var Tn=Object.freeze({x:0,y:0});function vk(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ck(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return o-n}function I$(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return n-o}function rk(e){let{left:t,top:o,height:n,width:r}=e;return[{x:t,y:o},{x:t+r,y:o},{x:t,y:o+n},{x:t+r,y:o+n}]}function Lh(e,t){if(!e||e.length===0)return null;let[o]=e;return t?o[t]:o}function ak(e,t,o){return t===void 0&&(t=e.left),o===void 0&&(o=e.top),{x:t+e.width*.5,y:o+e.height*.5}}var xk=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=ak(t,t.left,t.top),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=vk(ak(d),r);a.push({id:i,data:{droppableContainer:s,value:c}})}}return a.sort(Ck)},bk=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=rk(t),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=rk(d),u=r.reduce((p,f,g)=>p+vk(c[g],f),0),m=Number((u/4).toFixed(4));a.push({id:i,data:{droppableContainer:s,value:m}})}}return a.sort(Ck)};function S$(e,t){let o=Math.max(t.top,e.top),n=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-n,i=a-o;if(n<r&&o<a){let d=t.width*t.height,c=e.width*e.height,u=s*i,m=u/(d+c-u);return Number(m.toFixed(4))}return 0}var k$=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=[];for(let a of n){let{id:s}=a,i=o.get(s);if(i){let d=S$(i,t);d>0&&r.push({id:s,data:{droppableContainer:a,value:d}})}}return r.sort(I$)};function L$(e,t,o){return{...e,scaleX:t&&o?t.width/o.width:1,scaleY:t&&o?t.height/o.height:1}}function wk(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Tn}function P$(e){return function(o){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;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}),{...o})}}var R$=P$(1);function E$(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 M$(e,t,o){let n=E$(t);if(!n)return e;let{scaleX:r,scaleY:a,x:s,y:i}=n,d=e.left-s-(1-r)*parseFloat(o),c=e.top-i-(1-a)*parseFloat(o.slice(o.indexOf(" ")+1)),u=r?e.width/r:e.width,m=a?e.height/a:e.height;return{width:u,height:m,top:c,right:d+u,bottom:c+m,left:d}}var A$={ignoreTransform:!1};function ss(e,t){t===void 0&&(t=A$);let o=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:c,transformOrigin:u}=So(e).getComputedStyle(e);c&&(o=M$(o,c,u))}let{top:n,left:r,width:a,height:s,bottom:i,right:d}=o;return{top:n,left:r,width:a,height:s,bottom:i,right:d}}function sk(e){return ss(e,{ignoreTransform:!0})}function N$(e){let t=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:t,bottom:o,width:t,height:o}}function D$(e,t){return t===void 0&&(t=So(e).getComputedStyle(e)),t.position==="fixed"}function _$(e,t){t===void 0&&(t=So(e).getComputedStyle(e));let o=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?o.test(a):!1})}function Qd(e,t){let o=[];function n(r){if(t!=null&&o.length>=t||!r)return o;if(Op(r)&&r.scrollingElement!=null&&!o.includes(r.scrollingElement))return o.push(r.scrollingElement),o;if(!xi(r)||yh(r)||o.includes(r))return o;let a=So(e).getComputedStyle(r);return r!==e&&_$(r,a)&&o.push(r),D$(r,a)?o:n(r.parentNode)}return e?n(e):o}function Tk(e){let[t]=Qd(e,1);return t??null}function vh(e){return!$d||!e?null:Ja(e)?e:_p(e)?Op(e)||e===Za(e).scrollingElement?window:xi(e)?e:null:null}function Ik(e){return Ja(e)?e.scrollX:e.scrollLeft}function Sk(e){return Ja(e)?e.scrollY:e.scrollTop}function bh(e){return{x:Ik(e),y:Sk(e)}}var to;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(to||(to={}));function kk(e){return!$d||!e?!1:e===document.scrollingElement}function Lk(e){let t={x:0,y:0},o=kk(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-o.width,y:e.scrollHeight-o.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:r,isLeft:a,isBottom:s,isRight:i,maxScroll:n,minScroll:t}}var O$={x:.2,y:.2};function F$(e,t,o,n,r){let{top:a,left:s,right:i,bottom:d}=o;n===void 0&&(n=10),r===void 0&&(r=O$);let{isTop:c,isBottom:u,isLeft:m,isRight:p}=Lk(e),f={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!c&&a<=t.top+h.height?(f.y=to.Backward,g.y=n*Math.abs((t.top+h.height-a)/h.height)):!u&&d>=t.bottom-h.height&&(f.y=to.Forward,g.y=n*Math.abs((t.bottom-h.height-d)/h.height)),!p&&i>=t.right-h.width?(f.x=to.Forward,g.x=n*Math.abs((t.right-h.width-i)/h.width)):!m&&s<=t.left+h.width&&(f.x=to.Backward,g.x=n*Math.abs((t.left+h.width-s)/h.width)),{direction:f,speed:g}}function B$(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:o,right:n,bottom:r}=e.getBoundingClientRect();return{top:t,left:o,right:n,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Pk(e){return e.reduce((t,o)=>ts(t,bh(o)),Tn)}function H$(e){return e.reduce((t,o)=>t+Ik(o),0)}function U$(e){return e.reduce((t,o)=>t+Sk(o),0)}function $$(e,t){if(t===void 0&&(t=ss),!e)return;let{top:o,left:n,bottom:r,right:a}=t(e);Tk(e)&&(r<=0||a<=0||o>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var z$=[["x",["left","right"],H$],["y",["top","bottom"],U$]],Gd=class{constructor(t,o){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 n=Qd(o),r=Pk(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,s,i]of z$)for(let d of s)Object.defineProperty(this,d,{get:()=>{let c=i(n),u=r[a]-c;return this.rect[d]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},rs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(o=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...o)})},this.target=t}add(t,o,n){var r;(r=this.target)==null||r.addEventListener(t,o,n),this.listeners.push([t,o,n])}};function K$(e){let{EventTarget:t}=So(e);return e instanceof t?e:Za(e)}function Ch(e,t){let o=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(o**2+n**2)>t:"x"in t&&"y"in t?o>t.x&&n>t.y:"x"in t?o>t.x:"y"in t?n>t.y:!1}var cn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(cn||(cn={}));function ik(e){e.preventDefault()}function q$(e){e.stopPropagation()}var Ve;(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"})(Ve||(Ve={}));var Rk={start:[Ve.Space,Ve.Enter],cancel:[Ve.Esc],end:[Ve.Space,Ve.Enter,Ve.Tab]},W$=(e,t)=>{let{currentCoordinates:o}=t;switch(e.code){case Ve.Right:return{...o,x:o.x+25};case Ve.Left:return{...o,x:o.x-25};case Ve.Down:return{...o,y:o.y+25};case Ve.Up:return{...o,y:o.y-25}}},Ti=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:o}}=t;this.props=t,this.listeners=new rs(Za(o)),this.windowListeners=new rs(So(o)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(cn.Resize,this.handleCancel),this.windowListeners.add(cn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(cn.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:o}=this.props,n=t.node.current;n&&$$(n),o(Tn)}handleKeyDown(t){if(Kd(t)){let{active:o,context:n,options:r}=this.props,{keyboardCodes:a=Rk,coordinateGetter:s=W$,scrollBehavior:i="smooth"}=r,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}let{collisionRect:c}=n.current,u=c?{x:c.left,y:c.top}:Tn;this.referenceCoordinates||(this.referenceCoordinates=u);let m=s(t,{active:o,context:n.current,currentCoordinates:u});if(m){let p=os(m,u),f={x:0,y:0},{scrollableAncestors:g}=n.current;for(let h of g){let y=t.code,{isTop:x,isRight:C,isLeft:b,isBottom:L,maxScroll:w,minScroll:k}=Lk(h),I=B$(h),T={x:Math.min(y===Ve.Right?I.right-I.width/2:I.right,Math.max(y===Ve.Right?I.left:I.left+I.width/2,m.x)),y:Math.min(y===Ve.Down?I.bottom-I.height/2:I.bottom,Math.max(y===Ve.Down?I.top:I.top+I.height/2,m.y))},S=y===Ve.Right&&!C||y===Ve.Left&&!b,P=y===Ve.Down&&!L||y===Ve.Up&&!x;if(S&&T.x!==m.x){let A=h.scrollLeft+p.x,N=y===Ve.Right&&A<=w.x||y===Ve.Left&&A>=k.x;if(N&&!p.y){h.scrollTo({left:A,behavior:i});return}N?f.x=h.scrollLeft-A:f.x=y===Ve.Right?h.scrollLeft-w.x:h.scrollLeft-k.x,f.x&&h.scrollBy({left:-f.x,behavior:i});break}else if(P&&T.y!==m.y){let A=h.scrollTop+p.y,N=y===Ve.Down&&A<=w.y||y===Ve.Up&&A>=k.y;if(N&&!p.x){h.scrollTo({top:A,behavior:i});return}N?f.y=h.scrollTop-A:f.y=y===Ve.Down?h.scrollTop-w.y:h.scrollTop-k.y,f.y&&h.scrollBy({top:-f.y,behavior:i});break}}this.handleMove(t,ts(os(m,this.referenceCoordinates),f))}}}handleMove(t,o){let{onMove:n}=this.props;t.preventDefault(),n(o)}handleEnd(t){let{onEnd:o}=this.props;t.preventDefault(),this.detach(),o()}handleCancel(t){let{onCancel:o}=this.props;t.preventDefault(),this.detach(),o()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ti.activators=[{eventName:"onKeyDown",handler:(e,t,o)=>{let{keyboardCodes:n=Rk,onActivation:r}=t,{active:a}=o,{code:s}=e.nativeEvent;if(n.start.includes(s)){let i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function lk(e){return!!(e&&"distance"in e)}function dk(e){return!!(e&&"delay"in e)}var jd=class{constructor(t,o,n){var r;n===void 0&&(n=K$(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=o;let{event:a}=t,{target:s}=a;this.props=t,this.events=o,this.document=Za(s),this.documentListeners=new rs(this.document),this.listeners=new rs(n),this.windowListeners=new rs(So(s)),this.initialCoordinates=(r=qd(a))!=null?r:Tn,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:o,bypassActivationConstraint:n}}}=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(cn.Resize,this.handleCancel),this.windowListeners.add(cn.DragStart,ik),this.windowListeners.add(cn.VisibilityChange,this.handleCancel),this.windowListeners.add(cn.ContextMenu,ik),this.documentListeners.add(cn.Keydown,this.handleKeydown),o){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dk(o)){this.timeoutId=setTimeout(this.handleStart,o.delay),this.handlePending(o);return}if(lk(o)){this.handlePending(o);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,o){let{active:n,onPending:r}=this.props;r(n,t,this.initialCoordinates,o)}handleStart(){let{initialCoordinates:t}=this,{onStart:o}=this.props;t&&(this.activated=!0,this.documentListeners.add(cn.Click,q$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(cn.SelectionChange,this.removeTextSelection),o(t))}handleMove(t){var o;let{activated:n,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:i}}=a;if(!r)return;let d=(o=qd(t))!=null?o:Tn,c=os(r,d);if(!n&&i){if(lk(i)){if(i.tolerance!=null&&Ch(c,i.tolerance))return this.handleCancel();if(Ch(c,i.distance))return this.handleStart()}if(dk(i)&&Ch(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),s(d)}handleEnd(){let{onAbort:t,onEnd:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleCancel(){let{onAbort:t,onCancel:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleKeydown(t){t.code===Ve.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},G$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Ii=class extends jd{constructor(t){let{event:o}=t,n=Za(o.target);super(t,G$,n)}};Ii.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return!o.isPrimary||o.button!==0?!1:(n?.({event:o}),!0)}}];var j$={move:{name:"mousemove"},end:{name:"mouseup"}},wh;(function(e){e[e.RightClick=2]="RightClick"})(wh||(wh={}));var Th=class extends jd{constructor(t){super(t,j$,Za(t.event.target))}};Th.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return o.button===wh.RightClick?!1:(n?.({event:o}),!0)}}];var xh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Ih=class extends jd{constructor(t){super(t,xh)}static setup(){return window.addEventListener(xh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(xh.move.name,t)};function t(){}}};Ih.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t,{touches:r}=o;return r.length>1?!1:(n?.({event:o}),!0)}}];var Wd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Wd||(Wd={}));var $p;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})($p||($p={}));function V$(e){let{acceleration:t,activator:o=Wd.Pointer,canScroll:n,draggingRect:r,enabled:a,interval:s=5,order:i=$p.TreeOrder,pointerCoordinates:d,scrollableAncestors:c,scrollableAncestorRects:u,delta:m,threshold:p}=e,f=X$({delta:m,disabled:!a}),[g,h]=JS(),y=E({x:0,y:0}),x=E({x:0,y:0}),C=W(()=>{switch(o){case Wd.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Wd.DraggableRect:return r}},[o,r,d]),b=E(null),L=R(()=>{let k=b.current;if(!k)return;let I=y.current.x*x.current.x,T=y.current.y*x.current.y;k.scrollBy(I,T)},[]),w=W(()=>i===$p.TreeOrder?[...c].reverse():c,[i,c]);H(()=>{if(!a||!c.length||!C){h();return}for(let k of w){if(n?.(k)===!1)continue;let I=c.indexOf(k),T=u[I];if(!T)continue;let{direction:S,speed:P}=F$(k,T,C,t,p);for(let A of["x","y"])f[A][S[A]]||(P[A]=0,S[A]=0);if(P.x>0||P.y>0){h(),b.current=k,g(L,s),y.current=P,x.current=S;return}}y.current={x:0,y:0},x.current={x:0,y:0},h()},[t,L,n,h,a,s,JSON.stringify(C),JSON.stringify(f),g,c,w,u,JSON.stringify(p)])}var Q$={x:{[to.Backward]:!1,[to.Forward]:!1},y:{[to.Backward]:!1,[to.Forward]:!1}};function X$(e){let{delta:t,disabled:o}=e,n=Bp(t);return wi(r=>{if(o||!n||!r)return Q$;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[to.Backward]:r.x[to.Backward]||a.x===-1,[to.Forward]:r.x[to.Forward]||a.x===1},y:{[to.Backward]:r.y[to.Backward]||a.y===-1,[to.Forward]:r.y[to.Forward]||a.y===1}}},[o,t,n])}function Y$(e,t){let o=t!=null?e.get(t):void 0,n=o?o.node.current:null;return wi(r=>{var a;return t==null?null:(a=n??r)!=null?a:null},[n,t])}function J$(e,t){return W(()=>e.reduce((o,n)=>{let{sensor:r}=n,a=r.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...o,...a]},[]),[e,t])}var Vd;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Vd||(Vd={}));var Sh;(function(e){e.Optimized="optimized"})(Sh||(Sh={}));var ck=new Map;function Z$(e,t){let{dragging:o,dependencies:n,config:r}=t,[a,s]=q(null),{frequency:i,measure:d,strategy:c}=r,u=E(e),m=y(),p=bi(m),f=R(function(x){x===void 0&&(x=[]),!p.current&&s(C=>C===null?x:C.concat(x.filter(b=>!C.includes(b))))},[p]),g=E(null),h=wi(x=>{if(m&&!o)return ck;if(!x||x===ck||u.current!==e||a!=null){let C=new Map;for(let b of e){if(!b)continue;if(a&&a.length>0&&!a.includes(b.id)&&b.rect.current){C.set(b.id,b.rect.current);continue}let L=b.node.current,w=L?new Gd(d(L),L):null;b.rect.current=w,w&&C.set(b.id,w)}return C}return x},[e,a,o,m,d]);return H(()=>{u.current=e},[e]),H(()=>{m||f()},[o,m]),H(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),H(()=>{m||typeof i!="number"||g.current!==null||(g.current=setTimeout(()=>{f(),g.current=null},i))},[i,m,f,...n]),{droppableRects:h,measureDroppableContainers:f,measuringScheduled:a!=null};function y(){switch(c){case Vd.Always:return!1;case Vd.BeforeDragging:return o;default:return!o}}}function Ek(e,t){return wi(o=>e?o||(typeof t=="function"?t(e):e):null,[t,e])}function ez(e,t){return Ek(e,t)}function tz(e){let{callback:t,disabled:o}=e,n=Fp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(n)},[n,o]);return H(()=>()=>r?.disconnect(),[r]),r}function zp(e){let{callback:t,disabled:o}=e,n=Fp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(n)},[o]);return H(()=>()=>r?.disconnect(),[r]),r}function oz(e){return new Gd(ss(e),e)}function uk(e,t,o){t===void 0&&(t=oz);let[n,r]=q(null);function a(){r(d=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=d??o)!=null?c:null}let u=t(e);return JSON.stringify(d)===JSON.stringify(u)?d:u})}let s=tz({callback(d){if(e)for(let c of d){let{type:u,target:m}=c;if(u==="childList"&&m instanceof HTMLElement&&m.contains(e)){a();break}}}}),i=zp({callback:a});return dn(()=>{a(),e?(i?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),s?.disconnect())},[e]),n}function nz(e){let t=Ek(e);return wk(e,t)}var pk=[];function rz(e){let t=E(e),o=wi(n=>e?n&&n!==pk&&e&&t.current&&e.parentNode===t.current.parentNode?n:Qd(e):pk,[e]);return H(()=>{t.current=e},[e]),o}function az(e){let[t,o]=q(null),n=E(e),r=R(a=>{let s=vh(a.target);s&&o(i=>i?(i.set(s,bh(s)),new Map(i)):null)},[]);return H(()=>{let a=n.current;if(e!==a){s(a);let i=e.map(d=>{let c=vh(d);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,bh(c)]):null}).filter(d=>d!=null);o(i.length?new Map(i):null),n.current=e}return()=>{s(e),s(a)};function s(i){i.forEach(d=>{let c=vh(d);c?.removeEventListener("scroll",r)})}},[r,e]),W(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ts(a,s),Tn):Pk(e):Tn,[e,t])}function mk(e,t){t===void 0&&(t=[]);let o=E(null);return H(()=>{o.current=null},t),H(()=>{let n=e!==Tn;n&&!o.current&&(o.current=e),!n&&o.current&&(o.current=null)},[e]),o.current?os(e,o.current):Tn}function sz(e){H(()=>{if(!$d)return;let t=e.map(o=>{let{sensor:n}=o;return n.setup==null?void 0:n.setup()});return()=>{for(let o of t)o?.()}},e.map(t=>{let{sensor:o}=t;return o}))}function iz(e,t){return W(()=>e.reduce((o,n)=>{let{eventName:r,handler:a}=n;return o[r]=s=>{a(s,t)},o},{}),[e,t])}function Mk(e){return W(()=>e?N$(e):null,[e])}var fk=[];function lz(e,t){t===void 0&&(t=ss);let[o]=e,n=Mk(o?So(o):null),[r,a]=q(fk);function s(){a(()=>e.length?e.map(d=>kk(d)?n:new Gd(t(d),d)):fk)}let i=zp({callback:s});return dn(()=>{i?.disconnect(),s(),e.forEach(d=>i?.observe(d))},[e]),r}function dz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return xi(t)?t:e}function cz(e){let{measure:t}=e,[o,n]=q(null),r=R(c=>{for(let{target:u}of c)if(xi(u)){n(m=>{let p=t(u);return m?{...m,width:p.width,height:p.height}:p});break}},[t]),a=zp({callback:r}),s=R(c=>{let u=dz(c);a?.disconnect(),u&&a?.observe(u),n(u?t(u):null)},[t,a]),[i,d]=zd(s);return W(()=>({nodeRef:i,rect:o,setRef:d}),[o,i,d])}var uz=[{sensor:Ii,options:{}},{sensor:Ti,options:{}}],pz={current:{}},Hp={draggable:{measure:sk},droppable:{measure:sk,strategy:Vd.WhileDragging,frequency:Sh.Optimized},dragOverlay:{measure:ss}},as=class extends Map{get(t){var o;return t!=null&&(o=super.get(t))!=null?o:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:o}=t;return!o})}getNodeFor(t){var o,n;return(o=(n=this.get(t))==null?void 0:n.node.current)!=null?o:void 0}},mz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new as,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Up},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hp,measureDroppableContainers:Up,windowRect:null,measuringScheduled:!1},fz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Up,draggableNodes:new Map,over:null,measureDroppableContainers:Up},Kp=qe(fz),Ak=qe(mz);function gz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new as}}}function hz(e,t){switch(t.type){case Gt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Gt.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 Gt.DragEnd:case Gt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Gt.RegisterDroppable:{let{element:o}=t,{id:n}=o,r=new as(e.droppable.containers);return r.set(n,o),{...e,droppable:{...e.droppable,containers:r}}}case Gt.SetDroppableDisabled:{let{id:o,key:n,disabled:r}=t,a=e.droppable.containers.get(o);if(!a||n!==a.key)return e;let s=new as(e.droppable.containers);return s.set(o,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Gt.UnregisterDroppable:{let{id:o,key:n}=t,r=e.droppable.containers.get(o);if(!r||n!==r.key)return e;let a=new as(e.droppable.containers);return a.delete(o),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function yz(e){let{disabled:t}=e,{active:o,activatorEvent:n,draggableNodes:r}=Pt(Kp),a=Bp(n),s=Bp(o?.id);return H(()=>{if(!t&&!n&&a&&s!=null){if(!Kd(a)||document.activeElement===a.target)return;let i=r.get(s);if(!i)return;let{activatorNode:d,node:c}=i;if(!d.current&&!c.current)return;requestAnimationFrame(()=>{for(let u of[d.current,c.current]){if(!u)continue;let m=ek(u);if(m){m.focus();break}}})}},[n,t,r,s,a]),null}function vz(e,t){let{transform:o,...n}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...n}),o):o}function Cz(e){return W(()=>({draggable:{...Hp.draggable,...e?.draggable},droppable:{...Hp.droppable,...e?.droppable},dragOverlay:{...Hp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function xz(e){let{activeNode:t,measure:o,initialRect:n,config:r=!0}=e,a=E(!1),{x:s,y:i}=typeof r=="boolean"?{x:r,y:r}:r;dn(()=>{if(!s&&!i||!t){a.current=!1;return}if(a.current||!n)return;let c=t?.node.current;if(!c||c.isConnected===!1)return;let u=o(c),m=wk(u,n);if(s||(m.x=0),i||(m.y=0),a.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){let p=Tk(c);p&&p.scrollBy({top:m.y,left:m.x})}},[t,s,i,n,o])}var Nk=qe({...Tn,scaleX:1,scaleY:1}),ra;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ra||(ra={}));var Dk=pe(function(t){var o,n,r,a;let{id:s,accessibility:i,autoScroll:d=!0,children:c,sensors:u=uz,collisionDetection:m=k$,measuring:p,modifiers:f,...g}=t,h=Na(hz,void 0,gz),[y,x]=h,[C,b]=x$(),[L,w]=q(ra.Uninitialized),k=L===ra.Initialized,{draggable:{active:I,nodes:T,translate:S},droppable:{containers:P}}=y,A=I!=null?T.get(I):null,N=E({initial:null,translated:null}),B=W(()=>{var At;return I!=null?{id:I,data:(At=A?.data)!=null?At:pz,rect:N}:null},[I,A]),O=E(null),[j,U]=q(null),[D,J]=q(null),G=bi(g,Object.values(g)),M=es("DndDescribedBy",s),X=W(()=>P.getEnabled(),[P]),F=Cz(p),{droppableRects:ee,measureDroppableContainers:Y,measuringScheduled:ae}=Z$(X,{dragging:k,dependencies:[S.x,S.y],config:F.droppable}),te=Y$(T,I),de=W(()=>D?qd(D):null,[D]),ge=hn(),ne=ez(te,F.draggable.measure);xz({activeNode:I!=null?T.get(I):null,config:ge.layoutShiftCompensation,initialRect:ne,measure:F.draggable.measure});let Z=uk(te,F.draggable.measure,ne),ve=uk(te?te.parentElement:null),he=E({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=P.getNodeFor((o=he.current.over)==null?void 0:o.id),De=cz({measure:F.dragOverlay.measure}),je=(n=De.nodeRef.current)!=null?n:te,ot=k?(r=De.rect)!=null?r:Z:null,me=!!(De.nodeRef.current&&De.rect),Me=nz(me?null:Z),ue=Mk(je?So(je):null),ce=rz(k?Ae??te:null),Ze=lz(ce),pt=vz(f,{transform:{x:S.x-Me.x,y:S.y-Me.y,scaleX:1,scaleY:1},activatorEvent:D,active:B,activeNodeRect:Z,containerNodeRect:ve,draggingNodeRect:ot,over:he.current.over,overlayNodeRect:De.rect,scrollableAncestors:ce,scrollableAncestorRects:Ze,windowRect:ue}),ze=de?ts(de,S):null,et=az(ce),Et=mk(et),ft=mk(et,[Z]),Ct=ts(pt,Et),gt=ot?R$(ot,pt):null,Dt=B&>?m({active:B,collisionRect:gt,droppableRects:ee,droppableContainers:X,pointerCoordinates:ze}):null,Mt=Lh(Dt,"id"),[se,Le]=q(null),be=me?pt:ts(pt,ft),Xe=L$(be,(a=se?.rect)!=null?a:null,Z),xt=E(null),tt=R((At,St)=>{let{sensor:bt,options:mo}=St;if(O.current==null)return;let kt=T.get(O.current);if(!kt)return;let _t=At.nativeEvent,Xt=new bt({active:O.current,activeNode:kt,event:_t,options:mo,context:he,onAbort(lt){if(!T.get(lt))return;let{onDragAbort:Ht}=G.current,Yt={id:lt};Ht?.(Yt),C({type:"onDragAbort",event:Yt})},onPending(lt,Bt,Ht,Yt){if(!T.get(lt))return;let{onDragPending:fo}=G.current,go={id:lt,constraint:Bt,initialCoordinates:Ht,offset:Yt};fo?.(go),C({type:"onDragPending",event:go})},onStart(lt){let Bt=O.current;if(Bt==null)return;let Ht=T.get(Bt);if(!Ht)return;let{onDragStart:Yt}=G.current,qo={activatorEvent:_t,active:{id:Bt,data:Ht.data,rect:N}};(0,ns.unstable_batchedUpdates)(()=>{Yt?.(qo),w(ra.Initializing),x({type:Gt.DragStart,initialCoordinates:lt,active:Bt}),C({type:"onDragStart",event:qo}),U(xt.current),J(_t)})},onMove(lt){x({type:Gt.DragMove,coordinates:lt})},onEnd:nt(Gt.DragEnd),onCancel:nt(Gt.DragCancel)});xt.current=Xt;function nt(lt){return async function(){let{active:Ht,collisions:Yt,over:qo,scrollAdjustedTranslate:fo}=he.current,go=null;if(Ht&&fo){let{cancelDrop:Jt}=G.current;go={activatorEvent:_t,active:Ht,collisions:Yt,delta:fo,over:qo},lt===Gt.DragEnd&&typeof Jt=="function"&&await Promise.resolve(Jt(go))&&(lt=Gt.DragCancel)}O.current=null,(0,ns.unstable_batchedUpdates)(()=>{x({type:lt}),w(ra.Uninitialized),Le(null),U(null),J(null),xt.current=null;let Jt=lt===Gt.DragEnd?"onDragEnd":"onDragCancel";if(go){let Hn=G.current[Jt];Hn?.(go),C({type:Jt,event:go})}})}}},[T]),It=R((At,St)=>(bt,mo)=>{let kt=bt.nativeEvent,_t=T.get(mo);if(O.current!==null||!_t||kt.dndKit||kt.defaultPrevented)return;let Xt={active:_t};At(bt,St.options,Xt)===!0&&(kt.dndKit={capturedBy:St.sensor},O.current=mo,tt(bt,St))},[T,tt]),po=J$(u,It);sz(u),dn(()=>{Z&&L===ra.Initializing&&w(ra.Initialized)},[Z,L]),H(()=>{let{onDragMove:At}=G.current,{active:St,activatorEvent:bt,collisions:mo,over:kt}=he.current;if(!St||!bt)return;let _t={active:St,activatorEvent:bt,collisions:mo,delta:{x:Ct.x,y:Ct.y},over:kt};(0,ns.unstable_batchedUpdates)(()=>{At?.(_t),C({type:"onDragMove",event:_t})})},[Ct.x,Ct.y]),H(()=>{let{active:At,activatorEvent:St,collisions:bt,droppableContainers:mo,scrollAdjustedTranslate:kt}=he.current;if(!At||O.current==null||!St||!kt)return;let{onDragOver:_t}=G.current,Xt=mo.get(Mt),nt=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,lt={active:At,activatorEvent:St,collisions:bt,delta:{x:kt.x,y:kt.y},over:nt};(0,ns.unstable_batchedUpdates)(()=>{Le(nt),_t?.(lt),C({type:"onDragOver",event:lt})})},[Mt]),dn(()=>{he.current={activatorEvent:D,active:B,activeNode:te,collisionRect:gt,collisions:Dt,droppableRects:ee,draggableNodes:T,draggingNode:je,draggingNodeRect:ot,droppableContainers:P,over:se,scrollableAncestors:ce,scrollAdjustedTranslate:Ct},N.current={initial:ot,translated:gt}},[B,te,Dt,gt,T,je,ot,ee,P,se,ce,Ct]),V$({...ge,delta:S,draggingRect:gt,pointerCoordinates:ze,scrollableAncestors:ce,scrollableAncestorRects:Ze});let Ko=W(()=>({active:B,activeNode:te,activeNodeRect:Z,activatorEvent:D,collisions:Dt,containerNodeRect:ve,dragOverlay:De,draggableNodes:T,droppableContainers:P,droppableRects:ee,over:se,measureDroppableContainers:Y,scrollableAncestors:ce,scrollableAncestorRects:Ze,measuringConfiguration:F,measuringScheduled:ae,windowRect:ue}),[B,te,Z,D,Dt,ve,De,T,P,ee,se,Y,ce,Ze,F,ae,ue]),Qt=W(()=>({activatorEvent:D,activators:po,active:B,activeNodeRect:Z,ariaDescribedById:{draggable:M},dispatch:x,draggableNodes:T,over:se,measureDroppableContainers:Y}),[D,po,B,Z,x,M,T,se,Y]);return Zt.createElement(hk.Provider,{value:b},Zt.createElement(Kp.Provider,{value:Qt},Zt.createElement(Ak.Provider,{value:Ko},Zt.createElement(Nk.Provider,{value:Xe},c)),Zt.createElement(yz,{disabled:i?.restoreFocus===!1})),Zt.createElement(T$,{...i,hiddenTextDescribedById:M}));function hn(){let At=j?.autoScrollEnabled===!1,St=typeof d=="object"?d.enabled===!1:d===!1,bt=k&&!At&&!St;return typeof d=="object"?{...d,enabled:bt}:{enabled:bt}}}),bz=qe(null),gk="button",wz="Draggable";function _k(e){let{id:t,data:o,disabled:n=!1,attributes:r}=e,a=es(wz),{activators:s,activatorEvent:i,active:d,activeNodeRect:c,ariaDescribedById:u,draggableNodes:m,over:p}=Pt(Kp),{role:f=gk,roleDescription:g="draggable",tabIndex:h=0}=r??{},y=d?.id===t,x=Pt(y?Nk:bz),[C,b]=zd(),[L,w]=zd(),k=iz(s,t),I=bi(o);dn(()=>(m.set(t,{id:t,key:a,node:C,activatorNode:L,data:I}),()=>{let S=m.get(t);S&&S.key===a&&m.delete(t)}),[m,t]);let T=W(()=>({role:f,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&f===gk?!0:void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[n,f,h,y,g,u.draggable]);return{active:d,activatorEvent:i,activeNodeRect:c,attributes:T,isDragging:y,listeners:n?void 0:k,node:C,over:p,setNodeRef:b,setActivatorNodeRef:w,transform:x}}function Ok(){return Pt(Ak)}var Tz="Droppable",Iz={timeout:25};function Fk(e){let{data:t,disabled:o=!1,id:n,resizeObserverConfig:r}=e,a=es(Tz),{active:s,dispatch:i,over:d,measureDroppableContainers:c}=Pt(Kp),u=E({disabled:o}),m=E(!1),p=E(null),f=E(null),{disabled:g,updateMeasurementsFor:h,timeout:y}={...Iz,...r},x=bi(h??n),C=R(()=>{if(!m.current){m.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),f.current=null},y)},[y]),b=zp({callback:C,disabled:g||!s}),L=R((T,S)=>{b&&(S&&(b.unobserve(S),m.current=!1),T&&b.observe(T))},[b]),[w,k]=zd(L),I=bi(t);return H(()=>{!b||!w.current||(b.disconnect(),m.current=!1,b.observe(w.current))},[w,b]),H(()=>(i({type:Gt.RegisterDroppable,element:{id:n,key:a,disabled:o,node:w,rect:p,data:I}}),()=>i({type:Gt.UnregisterDroppable,key:a,id:n})),[n]),H(()=>{o!==u.current.disabled&&(i({type:Gt.SetDroppableDisabled,id:n,key:a,disabled:o}),u.current.disabled=o)},[n,a,o,i]),{active:s,rect:p,isOver:d?.id===n,node:w,over:d,setNodeRef:k}}$();function Bk(e,t,o){let n=e.slice();return n.splice(o<0?n.length+o:o,0,n.splice(t,1)[0]),n}function Sz(e,t){return e.reduce((o,n,r)=>{let a=t.get(n);return a&&(o[r]=a),o},Array(e.length))}function qp(e){return e!==null&&e>=0}function kz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}function Lz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var Hk=e=>{let{rects:t,activeIndex:o,overIndex:n,index:r}=e,a=Bk(t,n,o),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 Wp={scaleX:1,scaleY:1},Uk=e=>{var t;let{activeIndex:o,activeNodeRect:n,index:r,rects:a,overIndex:s}=e,i=(t=a[o])!=null?t:n;if(!i)return null;if(r===o){let c=a[s];return c?{x:0,y:o<s?c.top+c.height-(i.top+i.height):c.top-i.top,...Wp}:null}let d=Pz(a,r,o);return r>o&&r<=s?{x:0,y:-i.height-d,...Wp}:r<o&&r>=s?{x:0,y:i.height+d,...Wp}:{x:0,y:0,...Wp}};function Pz(e,t,o){let n=e[t],r=e[t-1],a=e[t+1];return n?o<t?r?n.top-(r.top+r.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):r?n.top-(r.top+r.height):0:0}var $k="Sortable",zk=Zt.createContext({activeIndex:-1,containerId:$k,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Hk,disabled:{draggable:!1,droppable:!1}});function Kk(e){let{children:t,id:o,items:n,strategy:r=Hk,disabled:a=!1}=e,{active:s,dragOverlay:i,droppableRects:d,over:c,measureDroppableContainers:u}=Ok(),m=es($k,o),p=i.rect!==null,f=W(()=>n.map(k=>typeof k=="object"&&"id"in k?k.id:k),[n]),g=s!=null,h=s?f.indexOf(s.id):-1,y=c?f.indexOf(c.id):-1,x=E(f),C=!kz(f,x.current),b=y!==-1&&h===-1||C,L=Lz(a);dn(()=>{C&&g&&u(f)},[C,f,g,u]),H(()=>{x.current=f},[f]);let w=W(()=>({activeIndex:h,containerId:m,disabled:L,disableTransforms:b,items:f,overIndex:y,useDragOverlay:p,sortedRects:Sz(f,d),strategy:r}),[h,m,L.draggable,L.droppable,b,f,y,d,p,r]);return Zt.createElement(zk.Provider,{value:w},t)}var Rz=e=>{let{id:t,items:o,activeIndex:n,overIndex:r}=e;return Bk(o,n,r).indexOf(t)},Ez=e=>{let{containerId:t,isSorting:o,wasDragging:n,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:d,transition:c}=e;return!c||!n||i!==a&&r===s?!1:o?!0:s!==r&&t===d},Mz={duration:200,easing:"ease"},qk="transform",Az=na.Transition.toString({property:qk,duration:0,easing:"linear"}),Nz={roleDescription:"sortable"};function Dz(e){let{disabled:t,index:o,node:n,rect:r}=e,[a,s]=q(null),i=E(o);return dn(()=>{if(!t&&o!==i.current&&n.current){let d=r.current;if(d){let c=ss(n.current,{ignoreTransform:!0}),u={x:d.left-c.left,y:d.top-c.top,scaleX:d.width/c.width,scaleY:d.height/c.height};(u.x||u.y)&&s(u)}}o!==i.current&&(i.current=o)},[t,o,n,r]),H(()=>{a&&s(null)},[a]),a}function Wk(e){let{animateLayoutChanges:t=Ez,attributes:o,disabled:n,data:r,getNewIndex:a=Rz,id:s,strategy:i,resizeObserverConfig:d,transition:c=Mz}=e,{items:u,containerId:m,activeIndex:p,disabled:f,disableTransforms:g,sortedRects:h,overIndex:y,useDragOverlay:x,strategy:C}=Pt(zk),b=_z(n,f),L=u.indexOf(s),w=W(()=>({sortable:{containerId:m,index:L,items:u},...r}),[m,r,L,u]),k=W(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:T,isOver:S,setNodeRef:P}=Fk({id:s,data:w,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...d}}),{active:A,activatorEvent:N,activeNodeRect:B,attributes:O,setNodeRef:j,listeners:U,isDragging:D,over:J,setActivatorNodeRef:G,transform:M}=_k({id:s,data:w,attributes:{...Nz,...o},disabled:b.draggable}),X=YS(P,j),F=!!A,ee=F&&!g&&qp(p)&&qp(y),Y=!x&&D,ae=Y&&ee?M:null,de=ee?ae??(i??C)({rects:h,activeNodeRect:B,activeIndex:p,overIndex:y,index:L}):null,ge=qp(p)&&qp(y)?a({id:s,items:u,activeIndex:p,overIndex:y}):L,ne=A?.id,Z=E({activeId:ne,items:u,newIndex:ge,containerId:m}),ve=u!==Z.current.items,he=t({active:A,containerId:m,isDragging:D,isSorting:F,id:s,index:L,items:u,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:c,wasDragging:Z.current.activeId!=null}),Ae=Dz({disabled:!he,index:L,node:T,rect:I});return H(()=>{F&&Z.current.newIndex!==ge&&(Z.current.newIndex=ge),m!==Z.current.containerId&&(Z.current.containerId=m),u!==Z.current.items&&(Z.current.items=u)},[F,ge,m,u]),H(()=>{if(ne===Z.current.activeId)return;if(ne!=null&&Z.current.activeId==null){Z.current.activeId=ne;return}let je=setTimeout(()=>{Z.current.activeId=ne},50);return()=>clearTimeout(je)},[ne]),{active:A,activeIndex:p,attributes:O,data:w,rect:I,index:L,newIndex:ge,items:u,isOver:S,isSorting:F,isDragging:D,listeners:U,node:T,overIndex:y,over:J,setNodeRef:X,setActivatorNodeRef:G,setDroppableNodeRef:P,setDraggableNodeRef:j,transform:Ae??de,transition:De()};function De(){if(Ae||ve&&Z.current.newIndex===L)return Az;if(!(Y&&!Kd(N)||!c)&&(F||he))return na.Transition.toString({...c,property:qk})}}function _z(e,t){var o,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(o=e?.draggable)!=null?o:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function Gp(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 Oz=[Ve.Down,Ve.Right,Ve.Up,Ve.Left],Gk=(e,t)=>{let{context:{active:o,collisionRect:n,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(Oz.includes(e.code)){if(e.preventDefault(),!o||!n)return;let d=[];a.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;let p=r.get(m.id);if(p)switch(e.code){case Ve.Down:n.top<p.top&&d.push(m);break;case Ve.Up:n.top>p.top&&d.push(m);break;case Ve.Left:n.left>p.left&&d.push(m);break;case Ve.Right:n.left<p.left&&d.push(m);break}});let c=bk({active:o,collisionRect:n,droppableRects:r,droppableContainers:d,pointerCoordinates:null}),u=Lh(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){let m=a.get(o.id),p=a.get(u),f=p?r.get(p.id):null,g=p?.node.current;if(g&&f&&m&&p){let y=Qd(g).some((k,I)=>i[I]!==k),x=jk(m,p),C=Fz(m,p),b=y||!x?{x:0,y:0}:{x:C?n.width-f.width:0,y:C?n.height-f.height:0},L={x:f.left,y:f.top};return b.x&&b.y?L:os(L,b)}}}};function jk(e,t){return!Gp(e)||!Gp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Fz(e,t){return!Gp(e)||!Gp(t)||!jk(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Bz(e,t,o){let n={...e};return t.top+e.y<=o.top?n.y=o.top-t.top:t.bottom+e.y>=o.top+o.height&&(n.y=o.top+o.height-t.bottom),t.left+e.x<=o.left?n.x=o.left-t.left:t.right+e.x>=o.left+o.width&&(n.x=o.left+o.width-t.right),n}var Vk=e=>{let{draggingNodeRect:t,transform:o,scrollableAncestorRects:n}=e,r=n[0];return!t||!r?o:Bz(o,t,r)},Qk=e=>{let{transform:t}=e;return{...t,x:0}};$();$();var jp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function Xk(e){return`(min-width: ${typeof e=="number"?e:jp[e]}px)`}function Yk(e){return`(max-width: ${(typeof e=="number"?e:jp[e])-1}px)`}function Hz(e){if(typeof e!="string"){let o=[];return e.min!=null&&o.push(Xk(e.min)),e.max!=null&&o.push(Yk(e.max)),e.pointer==="coarse"&&o.push("(pointer: coarse)"),e.pointer==="fine"&&o.push("(pointer: fine)"),o.length===0?"(min-width: 0px)":o.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let o of e.split(":"))if(o.startsWith("max-")){let n=o.slice(4);n in jp&&t.push(Yk(n))}else o in jp&&t.push(Xk(o));return t.length>0?t.join(" and "):e}function Uz(){return!1}function Vp(e){let t=Hz(e),o=R(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),n=R(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return Go(o,n,Uz)}function Yd(e){return e.source?.kind==="user"?!1:e.source?.kind==="scheduled-wake"?e.management===void 0:!0}var Xd=e=>(e??"").split(`
|
|
3550
|
+
`).map(t=>t.trim()).find(t=>t!=="")??"";function $z(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let o=t.toDateString()===new Date().toDateString();return new Intl.DateTimeFormat(void 0,{...o?{}:{dateStyle:"short"},timeStyle:"short"}).format(t)}var Ph={user:"turnQueue.sourceUser",schedule:"turnQueue.sourceSchedule","scheduled-wake":"turnQueue.sourceScheduledWake",record:"turnQueue.sourceSession",session:"turnQueue.sourceSession",reply:"turnQueue.sourceReply","child-report":"turnQueue.sourceChildReport","plugin-wake":"turnQueue.sourcePluginWake","board-dispatch":"turnQueue.sourceBoardDispatch","plugin-notice":"turnQueue.sourcePluginNotice","home-machine":"turnQueue.sourceHomeMachine","restart-resume":"turnQueue.sourceRestartResume"};function Jk({environmentId:e,pluginId:t,label:o}){let n=Qn(e,t??"");return t===void 0||n===null?l(oe,{children:o}):l(Mo,{environmentId:e,pluginId:t})}function Rh({source:e,environmentId:t}){let{t:o}=z();return e===void 0?null:l(jr,{variant:e.kind==="user"?"outline":e.kind==="scheduled-wake"?"info":"muted",size:"sm","data-queue-source":e.kind,children:e.kind==="person"?e.displayName:e.kind==="scheduled-wake"||e.kind==="schedule"?v(oe,{children:[o(Ph[e.kind]),e.pluginId===void 0?null:l(Jk,{environmentId:t,pluginId:e.pluginId,label:""})]}):e.kind==="plugin-wake"||e.kind==="plugin-notice"?l(Jk,{environmentId:t,pluginId:e.pluginId,label:o(Ph[e.kind])}):o(Ph[e.kind])})}function Qp(e,t,o){let n=bb(t===null?null:{environmentId:e,threadId:t},o??void 0);return t===null?null:n??o}function Eh({title:e,text:t}){let{t:o}=z();return e===null||e===""?l(oe,{children:t}):l(oe,{children:t===""?o("turnQueue.titleOnly",{title:e}):o("turnQueue.sessionLine",{sender:e,text:t})})}function zz({recordId:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=t(e),a=r===null||typeof r=="string"?null:r,s=a?.from,i=Qp(o,s?.kind==="thread"?s.threadId:null,s?.kind==="thread"?s.title:null);if(r===null)return l(oe,{children:"\u2026"});if(a===null||a.text===null)return l(oe,{children:n("turnQueue.messageUnavailable")});let d=s===void 0?null:s.kind==="thread"?i:s.displayName;return l(Eh,{title:d,text:Xd(Nd(a.text))})}function Kz({recordId:e,readRecord:t,environmentId:o}){let n=t(e),r=n===null||typeof n=="string"?null:n,a=t(r?.replyRecordId??null),s=a===null||typeof a=="string"?null:a,i=s?.from??r?.to,d=Qp(o,i?.kind==="thread"?i.threadId:null,i?.kind==="thread"?i.title:null),c=i===void 0?null:i.kind==="thread"?d:i.displayName,u=s?.text==null?"":Xd(Nd(s.text));return c===null&&u===""?null:l(Eh,{title:c,text:u})}function qz(e){let t=Qp(e.environmentId,e.threadId,e.threadTitle);return l(Eh,{title:t,text:e.text})}function Wz(e){let{t}=z(),{source:o}=e,n=Qp(e.environmentId,o.childThreadId,o.childTitle);return l(oe,{children:t(o.outcome==="settled"?"turnQueue.childReportSettled":o.outcome==="failed"?"turnQueue.childReportFailed":"turnQueue.childReportLine",{title:n??"",text:e.text})})}function Zk({entry:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=e.source;switch(r?.kind){case"scheduled-wake":return l(oe,{children:n("turnQueue.wakeLine",{time:$z(r.dueAt),note:e.text??""})});case"record":return t===void 0?null:l(zz,{recordId:r.recordId,readRecord:t,environmentId:o});case"reply":return t===void 0?null:l(Kz,{recordId:r.recordId,readRecord:t,environmentId:o});case"session":return l(qz,{environmentId:o,threadId:r.threadId,threadTitle:r.threadTitle,text:Xd(e.text)});case"child-report":return l(Wz,{environmentId:o,source:r,text:Xd(e.text)});case"plugin-wake":case"person":case"board-dispatch":case"plugin-notice":case"home-machine":case"restart-resume":return l(oe,{children:Xd(e.text)});default:return l(oe,{children:e.text||n("turnQueue.attachmentsOnly")})}}$();var Mh={};Ut(Mh,{LexicalComposerContext:()=>e0,createLexicalComposerContext:()=>Gz,useLexicalComposerContext:()=>jz});$();var e0=qe(null);function Gz(e,t){let o=null;return e!=null&&(o=e[1]),{getTheme:function(){return t??(o!=null?o.getTheme():null)}}}function jz(){let e=Pt(e0);return e==null&&(function(t,...o){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of o)r.append("v",a);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var Ah=Mh,t0=Ah.LexicalComposerContext,o0=Ah.createLexicalComposerContext,ct=Ah.useLexicalComposerContext;var iv={};Ut(iv,{$addUpdateTag:()=>Dm,$applyNodeReplacement:()=>wc,$caretFromPoint:()=>fa,$caretRangeFromSelection:()=>Cy,$cloneWithProperties:()=>ev,$cloneWithPropertiesEphemeral:()=>E5,$comparePointCaretNext:()=>rv,$copyNode:()=>Jy,$create:()=>A5,$createLineBreakNode:()=>Ni,$createNodeSelection:()=>Fy,$createParagraphNode:()=>Lr,$createPoint:()=>Rn,$createRangeSelection:()=>GL,$createRangeSelectionFromDom:()=>a5,$createTabNode:()=>Pm,$createTextNode:()=>oo,$extendCaretToRange:()=>ov,$findMatchingParent:()=>nc,$getAdjacentChildCaret:()=>$i,$getAdjacentNode:()=>pP,$getAdjacentSiblingOrParentSiblingCaret:()=>U5,$getCaretInDirection:()=>ga,$getCaretRange:()=>ma,$getCaretRangeInDirection:()=>sv,$getCharacterOffsets:()=>uy,$getChildCaret:()=>Rr,$getChildCaretAtIndex:()=>LP,$getChildCaretOrSelf:()=>wP,$getCollapsedCaretRange:()=>TP,$getCommonAncestor:()=>rc,$getCommonAncestorResultBranchOrder:()=>av,$getEditor:()=>Zy,$getNearestNodeFromDOMNode:()=>Nm,$getNearestRootOrShadowRoot:()=>gP,$getNodeByKey:()=>Vt,$getNodeByKeyOrThrow:()=>hP,$getNodeFromDOMNode:()=>Wy,$getPreviousSelection:()=>ys,$getRoot:()=>Yo,$getSelection:()=>Je,$getSiblingCaret:()=>io,$getState:()=>im,$getStateChange:()=>SK,$getTextContent:()=>l5,$getTextNodeOffset:()=>Pn,$getTextPointCaret:()=>pa,$getTextPointCaretSlice:()=>yy,$getWritableNodeState:()=>Ty,$hasAncestor:()=>wm,$hasUpdateTag:()=>S5,$insertNodes:()=>i5,$isBlockElementNode:()=>r5,$isChildCaret:()=>Ln,$isDecoratorNode:()=>yt,$isEditorState:()=>p5,$isElementNode:()=>re,$isExtendableTextPointCaret:()=>kP,$isInlineElementOrDecoratorNode:()=>k5,$isLeafNode:()=>w5,$isLineBreakNode:()=>cs,$isNodeCaret:()=>_5,$isNodeSelection:()=>vc,$isParagraphNode:()=>ZL,$isRangeSelection:()=>Oe,$isRootNode:()=>lo,$isRootOrShadowRoot:()=>pn,$isSiblingCaret:()=>hs,$isTabNode:()=>Oy,$isTextNode:()=>ke,$isTextPointCaret:()=>Pr,$isTextPointCaretSlice:()=>H5,$isTokenOrSegmented:()=>Ir,$isTokenOrTab:()=>ia,$nodesOfType:()=>I5,$normalizeCaret:()=>Sn,$normalizeSelection__EXPERIMENTAL:()=>lm,$onUpdate:()=>fP,$parseSerializedNode:()=>u5,$removeTextFromCaretRange:()=>SP,$rewindSiblingCaret:()=>Wi,$selectAll:()=>T5,$setCompositionKey:()=>ro,$setPointFromCaret:()=>zi,$setSelection:()=>$o,$setSelectionFromCaretRange:()=>IP,$setState:()=>kK,$splitAtPointCaretNext:()=>K5,$splitNode:()=>L5,$updateRangeSelectionFromCaretRange:()=>ac,ArtificialNode__DO_NOT_USE:()=>xm,BEFORE_INPUT_COMMAND:()=>Sy,BLUR_COMMAND:()=>SL,CAN_REDO_COMMAND:()=>BK,CAN_UNDO_COMMAND:()=>HK,CLEAR_EDITOR_COMMAND:()=>OK,CLEAR_HISTORY_COMMAND:()=>FK,CLICK_COMMAND:()=>lL,COLLABORATION_TAG:()=>OL,COMMAND_PRIORITY_CRITICAL:()=>y5,COMMAND_PRIORITY_EDITOR:()=>Li,COMMAND_PRIORITY_HIGH:()=>h5,COMMAND_PRIORITY_LOW:()=>f5,COMMAND_PRIORITY_NORMAL:()=>g5,COMPOSITION_END_COMMAND:()=>Py,COMPOSITION_END_TAG:()=>UL,COMPOSITION_START_COMMAND:()=>Ly,COMPOSITION_START_TAG:()=>HL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ri,COPY_COMMAND:()=>Ny,CUT_COMMAND:()=>Dy,DELETE_CHARACTER_COMMAND:()=>dc,DELETE_LINE_COMMAND:()=>uc,DELETE_WORD_COMMAND:()=>cc,DRAGEND_COMMAND:()=>TL,DRAGOVER_COMMAND:()=>wL,DRAGSTART_COMMAND:()=>bL,DROP_COMMAND:()=>xL,DecoratorNode:()=>mc,ElementNode:()=>ca,FOCUS_COMMAND:()=>IL,FORMAT_ELEMENT_COMMAND:()=>_K,FORMAT_TEXT_COMMAND:()=>aa,HISTORIC_TAG:()=>jK,HISTORY_MERGE_TAG:()=>rm,HISTORY_PUSH_TAG:()=>VK,INDENT_CONTENT_COMMAND:()=>NK,INPUT_COMMAND:()=>ky,INSERT_LINE_BREAK_COMMAND:()=>ec,INSERT_PARAGRAPH_COMMAND:()=>ty,INSERT_TAB_COMMAND:()=>AK,INTERNAL_$isBlock:()=>kr,IS_ALL_FORMATTING:()=>sK,IS_BOLD:()=>Zz,IS_CODE:()=>nK,IS_HIGHLIGHT:()=>xy,IS_ITALIC:()=>eK,IS_STRIKETHROUGH:()=>tK,IS_SUBSCRIPT:()=>rK,IS_SUPERSCRIPT:()=>aK,IS_UNDERLINE:()=>oK,KEY_ARROW_DOWN_COMMAND:()=>fL,KEY_ARROW_LEFT_COMMAND:()=>uL,KEY_ARROW_RIGHT_COMMAND:()=>dL,KEY_ARROW_UP_COMMAND:()=>mL,KEY_BACKSPACE_COMMAND:()=>hL,KEY_DELETE_COMMAND:()=>vL,KEY_DOWN_COMMAND:()=>Ay,KEY_ENTER_COMMAND:()=>mm,KEY_ESCAPE_COMMAND:()=>yL,KEY_MODIFIER_COMMAND:()=>kL,KEY_SPACE_COMMAND:()=>gL,KEY_TAB_COMMAND:()=>CL,LineBreakNode:()=>Ai,MOVE_TO_END:()=>cL,MOVE_TO_START:()=>pL,NODE_STATE_KEY:()=>CK,OUTDENT_CONTENT_COMMAND:()=>DK,PASTE_COMMAND:()=>Ry,PASTE_TAG:()=>QK,ParagraphNode:()=>Oi,REDO_COMMAND:()=>My,REMOVE_TEXT_COMMAND:()=>oy,RootNode:()=>_i,SELECTION_CHANGE_COMMAND:()=>Iy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>MK,SELECT_ALL_COMMAND:()=>ny,SKIP_COLLAB_TAG:()=>XK,SKIP_DOM_SELECTION_TAG:()=>BL,SKIP_SCROLL_INTO_VIEW_TAG:()=>FL,SKIP_SELECTION_FOCUS_TAG:()=>dy,TEXT_TYPE_TO_FORMAT:()=>xo,TabNode:()=>Di,TextNode:()=>ms,UNDO_COMMAND:()=>Ey,addClassNamesToElement:()=>Q5,buildImportMap:()=>GK,configExtension:()=>W5,createCommand:()=>He,createEditor:()=>v5,createSharedNodeState:()=>oL,createState:()=>IK,declarePeerDependency:()=>G5,defineExtension:()=>q5,flipDirection:()=>ha,getDOMOwnerDocument:()=>Xy,getDOMSelection:()=>Mn,getDOMSelectionFromTarget:()=>yP,getDOMTextNode:()=>gs,getEditorPropertyFromDOMNode:()=>xc,getNearestEditorFromDOMNode:()=>qy,getRegisteredNode:()=>zy,getRegisteredNodeOrThrow:()=>$y,getStaticNodeConfig:()=>Tc,getTextDirection:()=>b5,getTransformSetFromKlass:()=>tP,isBlockDomNode:()=>gy,isCurrentlyReadOnlyMode:()=>Ki,isDOMDocumentNode:()=>rP,isDOMNode:()=>qi,isDOMTextNode:()=>nr,isDOMUnmanaged:()=>bP,isDocumentFragment:()=>vP,isExactShortcutMatch:()=>at,isHTMLAnchorElement:()=>P5,isHTMLElement:()=>ko,isInlineDomNode:()=>CP,isLexicalEditor:()=>Mm,isModifierMatch:()=>uP,isSelectionCapturedInDecoratorInput:()=>Ky,isSelectionWithinEditor:()=>Cc,makeStepwiseIterator:()=>nv,mergeRegister:()=>Y5,normalizeClassNames:()=>Ic,removeClassNamesFromElement:()=>X5,removeFromParent:()=>la,resetRandomKey:()=>C5,safeCast:()=>j5,setDOMUnmanaged:()=>M5,setNodeIndentFromDOM:()=>xP,shallowMergeConfig:()=>V5,toggleTextFormatType:()=>gc});function le(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function V0(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var En=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Vz=En&&"documentMode"in document?document.documentMode:null,In=En&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),da=En&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),sm=!(!En||!("InputEvent"in window)||Vz)&&"getTargetRanges"in new window.InputEvent("input"),Im=En&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),yc=En&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qz=En&&/Android/.test(navigator.userAgent),Q0=En&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Kh=En&&Qz&&Q0,Sm=En&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&In&&!Q0,Xz=0,Yz=1,Jz=2,Zz=1,eK=2,tK=4,oK=8,nK=16,rK=32,aK=64,xy=128,sK=2047,iK=1,lK=2,dK=3,cK=4,uK=5,pK=6,sc=Im||yc||Sm?"\xA0":"\u200B",km=`
|
|
3568
3551
|
|
|
3569
|
-
`,Sy=ma?"\xA0":lc,jk="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Vk="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",aK=new RegExp("^[^"+Vk+"]*["+jk+"]"),sK=new RegExp("^[^"+jk+"]*["+Vk+"]"),xo={bold:1,capitalize:1024,code:16,highlight:Iy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},iK={directionless:1,unmergeable:2},Vh={center:2,end:6,justify:4,left:1,right:3,start:5},lK={[eK]:"center",[rK]:"end",[oK]:"justify",[Zz]:"left",[tK]:"right",[nK]:"start"},dK={normal:0,segmented:2,token:1},cK={[zz]:"normal",[qz]:"segmented",[Kz]:"token"},uK="$",ek="$config";function Qk(e,t,o,n,r,a){let s=e.getFirstChild();for(;s!==null;){let i=s.__key;s.__parent===t&&(ae(s)&&Qk(s,i,o,n,r,a),o.has(i)||a.delete(i),r.push(i)),s=s.getNextSibling()}}var Qh=!1,ky=0;function pK(e){ky=e.timeStamp}function Fh(e,t,o){let n=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||n&&e.previousSibling===r)||n&&Fm(e,o)!==void 0}function mK(e,t,o){let n=On(en(o)),r=null,a=null;n!==null&&n.anchorNode===e&&(r=n.anchorOffset,a=n.focusOffset);let s=e.nodeValue;s!==null&&Jy(t,s,r,a,!1)}function fK(e,t,o){if(Oe(e)){let n=e.anchor.getNode();if(n.is(o)&&e.format!==n.getFormat())return!1}return ir(t)&&o.isAttached()}function gK(e,t,o,n){for(let r=e;r&&!vR(r);r=Tc(r)){let a=Fm(r,t);if(a!==void 0){let s=Qt(a,o);if(s)return yt(s)||!Ro(r)?void 0:[r,s]}else if(r===n)return[n,rR(o)]}}function Xk(e,t,o){Qh=!0;let n=performance.now()-ky>100;try{sr(e,()=>{let r=Je()||(function(p){return p.getEditorState().read(()=>{let f=Je();return f!==null?f.clone():null})})(e),a=new Map,s=e.getRootElement(),i=e._editorState,d=e._blockCursorElement,c=!1,u="";for(let p=0;p<t.length;p++){let f=t[p],g=f.type,h=f.target,y=gK(h,e,i,s);if(!y)continue;let[x,C]=y;if(g==="characterData")n&&ke(C)&&ir(h)&&fK(r,h,C)&&mK(h,C,e);else if(g==="childList"){c=!0;let b=f.addedNodes;for(let k=0;k<b.length;k++){let I=b[k],T=Qy(I),S=I.parentNode;if(S!=null&&I!==d&&T===null&&!Fh(I,S,e)){if(ma){let R=(Ro(I)?I.innerText:null)||I.nodeValue;R&&(u+=R)}S.removeChild(I)}}let L=f.removedNodes,w=L.length;if(w>0){let k=0;for(let I=0;I<w;I++){let T=L[I];(Fh(T,h,e)||d===T)&&(h.appendChild(T),k++)}w!==k&&a.set(x,C)}}}if(a.size>0)for(let[p,f]of a)f.reconcileObservedMutation(p,e);let m=o.takeRecords();if(m.length>0){for(let p=0;p<m.length;p++){let f=m[p],g=f.addedNodes,h=f.target;for(let y=0;y<g.length;y++){let x=g[y],C=x.parentNode;C==null||x.nodeName!=="BR"||Fh(x,h,e)||C.removeChild(x)}}o.takeRecords()}r!==null&&(c&&qo(r),ma&&cR(e)&&r.insertRawText(u))})}finally{Qh=!1}}function Yk(e){let t=e._observer;t!==null&&Xk(e,t.takeRecords(),t)}function Jk(e){(function(t){ky===0&&en(t).addEventListener("textInput",pK,!0)})(e),e._observer=new MutationObserver((t,o)=>{Xk(e,t,o)})}var Xh=class{key;parse;unparse;isEqual;defaultValue;constructor(t,o){this.key=t,this.parse=o.parse.bind(o),this.unparse=(o.unparse||CK).bind(o),this.isEqual=(o.isEqual||Object.is).bind(o),this.defaultValue=this.parse(void 0)}};function hK(e,t){return new Xh(e,t)}function pm(e,t,o="latest"){let n=(o==="latest"?e.getLatest():e).__state;return n?n.getValue(t):t.defaultValue}function yK(e,t,o){let n=pm(e,o,"direct"),r=pm(t,o,"direct");return o.isEqual(n,r)?null:[n,r]}function vK(e,t,o){let n;if(no(),typeof o=="function"){let a=e.getLatest(),s=pm(a,t);if(n=o(s),t.isEqual(s,n))return a}else n=o;let r=e.getWritable();return Ly(r).updateFromKnown(t,n),r}function Zk(e){let t=new Map,o=new Set;for(let n=typeof e=="function"?e:e.replace;n.prototype&&n.prototype.getType!==void 0;n=Object.getPrototypeOf(n)){let{ownNodeConfig:r}=Sc(n);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let s;"stateConfig"in a?(s=a.stateConfig,a.flat&&o.add(s.key)):s=a,t.set(s.key,s)}}return{flatKeys:o,sharedConfigMap:t}}var Yh=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,o,n=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=o,this.unknownState=n,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,i=a!==void 0?a:(function(d,c,u){let m=u.size;if(c)for(let p in c){let f=d.get(p);f&&u.has(f)||m++}return m})(s,n,r);this.size=i}getValue(t){let o=this.knownState.get(t);if(o!==void 0)return o;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(n=t.parse(r)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},o={};for(let[n,r]of this.knownState)n.isEqual(r,n.defaultValue)?delete t[n.key]:t[n.key]=n.unparse(r);for(let n of this.sharedNodeState.flatKeys)n in t&&(o[n]=t[n],delete t[n]);return tk(t)&&(o.$=t),o}getWritable(t){if(this.node===t)return this;let{sharedNodeState:o,unknownState:n}=this,r=new Map(this.knownState);return new e(t,o,(function(a,s,i){let d;if(i)for(let[c,u]of Object.entries(i)){let m=a.get(c);m?s.has(m)||s.set(m,m.parse(u)):(d=d||{},d[c]=u)}return d})(o.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,o){let n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&n in a||(a&&(delete a[n],this.unknownState=tk(a)),this.size++),r.set(t,o)}updateFromUnknown(t,o){let n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(o)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=o)}updateFromJSON(t){let{knownState:o}=this;for(let n of o.keys())o.set(n,n.defaultValue);if(this.size=o.size,this.unknownState=void 0,t)for(let[n,r]of Object.entries(t))this.updateFromUnknown(n,r)}};function Ly(e){let t=e.getWritable(),o=t.__state?t.__state.getWritable(t):new Yh(t,eL(t));return t.__state=o,o}function eL(e){return e.__state?e.__state.sharedNodeState:Wy(nv(),e.getType()).sharedNodeState}function tk(e){if(e)for(let t in e)return e}function CK(e){return e}function ok(e,t,o){for(let[n,r]of t.knownState){if(e.has(n.key))continue;e.add(n.key);let a=o?o.getValue(n):n.defaultValue;if(a!==r&&!n.isEqual(a,r))return!0}return!1}function nk(e,t,o){let{unknownState:n}=t,r=o?o.unknownState:void 0;if(n){for(let[a,s]of Object.entries(n))if(!e.has(a)&&(e.add(a),s!==(r?r[a]:void 0)))return!0}return!1}function rk(e,t){let o=e.__state;return o&&o.node===e?o.getWritable(t):o}function ak(e,t){let o=e.__mode,n=e.__format,r=e.__style,a=t.__mode,s=t.__format,i=t.__style,d=e.__state,c=t.__state;return(o===null||o===a)&&(n===null||n===s)&&(r===null||r===i)&&(e.__state===null||d===c||(function(u,m){if(u===m)return!0;if(u&&m&&u.size!==m.size)return!1;let p=new Set;return!(u&&ok(p,u,m)||m&&ok(p,m,u)||u&&nk(p,u,m)||m&&nk(p,m,u))})(d,c))}function sk(e,t){let o=e.mergeWithSibling(t),n=mt()._normalizedNodes;return n.add(e.__key),n.add(t.__key),o}function ik(e){let t,o,n=e;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(t=n.getPreviousSibling())!==null&&ke(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(ak(t,n)){n=sk(t,n);break}break}t.remove()}for(;(o=n.getNextSibling())!==null&&ke(o)&&o.isSimpleText()&&!o.isUnmergeable();){if(o.__text!==""){if(ak(n,o)){n=sk(n,o);break}break}o.remove()}}else n.remove()}function mm(e){return lk(e.anchor),lk(e.focus),e}function lk(e){for(;e.type==="element";){let t=e.getNode(),o=e.offset,n,r;if(o===t.getChildrenSize()?(n=t.getChildAtIndex(o-1),r=!0):(n=t.getChildAtIndex(o),r=!1),ke(n)){e.set(n.__key,r?n.getTextContentSize():0,"text",!0);break}if(!ae(n))break;e.set(n.__key,r?n.getChildrenSize():0,"element",!0)}}var gs,co,dc,Am,Jh,Zh,hs,Mn,ey,cc,Vt="",ar=null,ps=null,Ri=!1,fm=!1;function gm(e,t){let o=hs.get(e);if(t!==null){let n=ry(e);n.parentNode===t&&t.removeChild(n)}if(Mn.has(e)||co._keyToDOMMap.delete(e),ae(o)){let n=ym(o,hs);ty(n,0,n.length-1,null)}o!==void 0&&Zy(cc,dc,Am,o,"destroyed")}function ty(e,t,o,n){for(let r=t;r<=o;++r){let a=e[r];a!==void 0&&gm(a,n)}}function us(e,t){e.setProperty("text-align",t)}var xK="40px";function tL(e,t){let o=gs.theme.indent;if(typeof o=="string"){let r=e.classList.contains(o);t>0&&!r?e.classList.add(o):t<1&&r&&e.classList.remove(o)}if(t===0)return void e.style.setProperty("padding-inline-start","");let n=getComputedStyle(co._rootElement||e).getPropertyValue("--lexical-indent-base-value")||xK;e.style.setProperty("padding-inline-start",`calc(${t} * ${n})`)}function oL(e,t){let o=e.style;t===0?us(o,""):t===1?us(o,"left"):t===2?us(o,"center"):t===3?us(o,"right"):t===4?us(o,"justify"):t===5?us(o,"start"):t===6&&us(o,"end")}function oy(e,t){let o=(function(n){let r=n.__dir;if(r!==null)return r;if(lo(n))return null;let a=n.getParentOrThrow();return lo(a)&&a.__dir===null?"auto":null})(t);o!==null?e.dir=o:e.removeAttribute("dir")}function hm(e,t){let o=Mn.get(e);o===void 0&&ie(60);let n=o.createDOM(gs,co);if((function(r,a,s){let i=s._keyToDOMMap;(function(d,c,u){let m=`__lexicalKey_${c._key}`;d[m]=u})(a,s,r),i.set(r,a)})(e,n,co),ke(o)?n.setAttribute("data-lexical-text","true"):yt(o)&&n.setAttribute("data-lexical-decorator","true"),ae(o)){let r=o.__indent,a=o.__size;if(oy(n,o),r!==0&&tL(n,r),a!==0){let i=a-1;ny(ym(o,Mn),o,0,i,o.getDOMSlot(n))}let s=o.__format;s!==0&&oL(n,s),o.isInline()||nL(null,o,n)}else{let r=o.getTextContent();if(yt(o)){let a=o.decorate(co,gs);a!==null&&rL(e,a),n.contentEditable="false"}Vt+=r}return t!==null&&t.insertChild(n),Zy(cc,dc,Am,o,"created"),n}function ny(e,t,o,n,r){let a=Vt;Vt="";let s=o;for(;s<=n;++s){hm(e[s],r);let i=Mn.get(e[s]);i!==null&&ke(i)?ar===null&&(ar=i.getFormat(),ps=i.getStyle()):ae(i)&&s<n&&!i.isInline()&&(Vt+=Mm)}r.element.__lexicalTextContent=Vt,Vt=a+Vt}function dk(e,t){if(e){let o=e.__last;if(o){let n=t.get(o);if(n)return fs(n)?"line-break":yt(n)&&n.isInline()?"decorator":null}return"empty"}return null}function nL(e,t,o){let n=dk(e,hs),r=dk(t,Mn);n!==r&&t.getDOMSlot(o).setManagedLineBreak(r)}function bK(e,t,o){var n;ar=null,ps=null,(function(r,a,s){let i=Vt,d=r.__size,c=a.__size;Vt="";let u=s.element;if(d===1&&c===1){let m=r.__first,p=a.__first;if(m===p)am(m,u);else{let g=ry(m),h=hm(p,null);try{u.replaceChild(h,g)}catch(y){if(typeof y=="object"&&y!=null){let x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${m}}.`;throw new Error(x)}throw y}gm(m,null)}let f=Mn.get(p);ke(f)&&ar===null&&(ar=f.getFormat(),ps=f.getStyle())}else{let m=ym(r,hs),p=ym(a,Mn);if(m.length!==d&&ie(227),p.length!==c&&ie(228),d===0)c!==0&&ny(p,0,0,c-1,s);else if(c===0){if(d!==0){let f=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;ty(m,0,d-1,f?null:u),f&&(u.textContent="")}}else(function(f,g,h,y,x,C){let b=y-1,L=x-1,w,k,I=C.getFirstChild(),T=0,S=0;for(;T<=b&&S<=L;){let N=g[T],B=h[S];if(N===B)I=Bh(am(B,C.element)),T++,S++;else{if(k===void 0&&(k=ck(h,S)),w===void 0)w=ck(g,T);else if(!w.has(N)){T++;continue}if(!k.has(N)){I=Bh(ry(N)),gm(N,C.element),T++,w.delete(N);continue}if(w.has(B)){let V=Ui(co,B);V!==I&&C.withBefore(I).insertChild(V),I=Bh(am(B,C.element)),T++,S++}else hm(B,C.withBefore(I)),S++}let O=Mn.get(B);O!==null&&ke(O)?ar===null&&(ar=O.getFormat(),ps=O.getStyle()):ae(O)&&S<=L&&!O.isInline()&&(Vt+=Mm)}let R=T>b,A=S>L;if(R&&!A){let N=h[L+1],B=N===void 0?null:co.getElementByKey(N);ny(h,0,S,L,C.withBefore(B))}else A&&!R&&ty(g,T,b,C.element)})(0,m,p,d,c,s)}u.__lexicalTextContent=Vt,Vt=i+Vt})(e,t,t.getDOMSlot(o)),n=t,ar==null||ar===n.__textFormat||fm||n.setTextFormat(ar),(function(r){ps==null||ps===r.__textStyle||fm||r.setTextStyle(ps)})(t)}function ym(e,t){let o=[],n=e.__first;for(;n!==null;){let r=t.get(n);r===void 0&&ie(101),o.push(n),n=r.__next}return o}function am(e,t){let o=hs.get(e),n=Mn.get(e);o!==void 0&&n!==void 0||ie(61);let r=Ri||Zh.has(e)||Jh.has(e),a=Ui(co,e);if(o===n&&!r){let s;if(ae(o)){let i=a.__lexicalTextContent;typeof i=="string"?s=i:(s=o.getTextContent(),a.__lexicalTextContent=s)}else s=o.getTextContent();return Vt+=s,a}if(o!==n&&r&&Zy(cc,dc,Am,n,"updated"),n.updateDOM(o,a,gs)){let s=hm(e,null);return t===null&&ie(62),t.replaceChild(s,a),gm(e,null),s}if(ae(o)){ae(n)||ie(334,e);let s=n.__indent;(Ri||s!==o.__indent)&&tL(a,s);let i=n.__format;if((Ri||i!==o.__format)&&oL(a,i),r)bK(o,n,a),lo(n)||n.isInline()||nL(o,n,a);else{let d=a.__lexicalTextContent,c;typeof d=="string"?c=d:(c=o.getTextContent(),a.__lexicalTextContent=c),Vt+=c}if((Ri||n.__dir!==o.__dir)&&(oy(a,n),lo(n)&&!Ri))for(let d of n.getChildren())ae(d)&&oy(Ui(co,d.getKey()),d)}else{let s=n.getTextContent();if(yt(n)){let i=n.decorate(co,gs);i!==null&&rL(e,i)}Vt+=s}if(!fm&&lo(n)&&n.__cachedText!==Vt){let s=n.getWritable();s.__cachedText=Vt,n=s}return a}function rL(e,t){let o=co._pendingDecorators,n=co._decorators;if(o===null){if(n[e]===t)return;o=nR(co)}o[e]=t}function Bh(e){let t=e.nextSibling;return t!==null&&t===co._blockCursorElement&&(t=t.nextSibling),t}function ck(e,t){let o=new Set;for(let n=t;n<e.length;n++)o.add(e[n]);return o}function wK(e,t,o,n,r,a){Vt="",Ri=n===2,co=o,gs=o._config,dc=o._nodes,Am=co._listeners.mutation,Jh=r,Zh=a,hs=e._nodeMap,Mn=t._nodeMap,fm=t._readOnly,ey=new Map(o._keyToDOMMap);let s=new Map;return cc=s,am("root",null),co=void 0,dc=void 0,Jh=void 0,Zh=void 0,hs=void 0,Mn=void 0,gs=void 0,ey=void 0,cc=void 0,s}function ry(e){let t=ey.get(e);return t===void 0&&ie(75,e),t}function He(e){return{type:e}}var Ry=He("SELECTION_CHANGE_COMMAND"),TK=He("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),aL=He("CLICK_COMMAND"),Py=He("BEFORE_INPUT_COMMAND"),Ey=He("INPUT_COMMAND"),My=He("COMPOSITION_START_COMMAND"),Ay=He("COMPOSITION_END_COMMAND"),uc=He("DELETE_CHARACTER_COMMAND"),oc=He("INSERT_LINE_BREAK_COMMAND"),ay=He("INSERT_PARAGRAPH_COMMAND"),Ai=He("CONTROLLED_TEXT_INSERTION_COMMAND"),Ny=He("PASTE_COMMAND"),sy=He("REMOVE_TEXT_COMMAND"),pc=He("DELETE_WORD_COMMAND"),mc=He("DELETE_LINE_COMMAND"),da=He("FORMAT_TEXT_COMMAND"),Dy=He("UNDO_COMMAND"),_y=He("REDO_COMMAND"),Oy=He("KEYDOWN_COMMAND"),sL=He("KEY_ARROW_RIGHT_COMMAND"),iL=He("MOVE_TO_END"),lL=He("KEY_ARROW_LEFT_COMMAND"),dL=He("MOVE_TO_START"),cL=He("KEY_ARROW_UP_COMMAND"),uL=He("KEY_ARROW_DOWN_COMMAND"),vm=He("KEY_ENTER_COMMAND"),pL=He("KEY_SPACE_COMMAND"),mL=He("KEY_BACKSPACE_COMMAND"),fL=He("KEY_ESCAPE_COMMAND"),gL=He("KEY_DELETE_COMMAND"),hL=He("KEY_TAB_COMMAND"),IK=He("INSERT_TAB_COMMAND"),SK=He("INDENT_CONTENT_COMMAND"),kK=He("OUTDENT_CONTENT_COMMAND"),yL=He("DROP_COMMAND"),LK=He("FORMAT_ELEMENT_COMMAND"),vL=He("DRAGSTART_COMMAND"),CL=He("DRAGOVER_COMMAND"),xL=He("DRAGEND_COMMAND"),Fy=He("COPY_COMMAND"),By=He("CUT_COMMAND"),iy=He("SELECT_ALL_COMMAND"),RK=He("CLEAR_EDITOR_COMMAND"),PK=He("CLEAR_HISTORY_COMMAND"),EK=He("CAN_REDO_COMMAND"),MK=He("CAN_UNDO_COMMAND"),bL=He("FOCUS_COMMAND"),wL=He("BLUR_COMMAND"),TL=He("KEY_MODIFIER_COMMAND"),Tr=Object.freeze({}),ly=[["keydown",function(e,t){fc=e.timeStamp,IL=e.key,!t.isComposing()&&we(t,Oy,e)}],["pointerdown",function(e,t){let o=e.target,n=e.pointerType;ji(o)&&n!=="touch"&&n!=="pen"&&e.button===0&&sr(t,()=>{eR(o)||(uy=!0)})}],["compositionstart",function(e,t){we(t,My,e)}],["compositionend",function(e,t){ma?tc=!0:Cc||!Pm&&!Em?we(t,Ay,e):(sm=!0,im=e.data)}],["input",function(e,t){e.stopPropagation(),sr(t,()=>{t.dispatchCommand(Ey,e)},{event:e}),Pi=null}],["click",function(e,t){sr(t,()=>{let o=Je(),n=On(en(t)),r=bs();if(n){if(Oe(o)){let a=o.anchor,s=a.getNode();if(a.type==="element"&&a.offset===0&&o.isCollapsed()&&!lo(s)&&Zo().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&o.is(r))n.removeAllRanges(),o.dirty=!0;else if(e.detail===3&&!o.isCollapsed()&&s!==o.focus.getNode()){let i=ac(s,d=>ae(d)&&!d.isInline());ae(i)&&i.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=n.anchorNode;(Ro(a)||ir(a))&&qo(Dm(r,n,t,e))}}we(t,aL,e)})}],["cut",Tr],["copy",Tr],["dragstart",Tr],["dragover",Tr],["dragend",Tr],["paste",Tr],["focus",Tr],["blur",Tr],["drop",Tr]];um&&ly.push(["beforeinput",(e,t)=>(function(o,n){let r=o.inputType;r==="deleteCompositionText"||ma&&cR(n)||r!=="insertCompositionText"&&we(n,Py,o)})(e,t)]);var fc=0,IL=null,SL=0,Pi=null,dy=new WeakMap,Cm=new WeakMap,cy=!1,uy=!1,nc=!1,tc=!1,sm=!1,im="",ms=null,kL=[0,"",0,"root",0];function LL(e,t,o,n,r){let a=e.anchor,s=e.focus,i=a.getNode(),d=mt(),c=On(en(d)),u=c!==null?c.anchorNode:null,m=a.key,p=d.getElementByKey(m),f=o.length;return m!==s.key||!ke(i)||(!r&&(!um||SL<n+50)||i.isDirty()&&f<2||aR(o))&&a.offset!==s.offset&&!i.isComposing()||kr(i)||i.isDirty()&&f>1||(r||!um)&&p!==null&&!i.isComposing()&&u!==Cs(p)||c!==null&&t!==null&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.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 y=g.anchor.offset,x=h.getParentOrThrow(),C=ua(h);return y===0?!h.canInsertTextBefore()||!x.canInsertTextBefore()&&!h.isComposing()||C||(function(b){let L=b.getPreviousSibling();return(ke(L)||ae(L)&&L.isInline())&&!L.canInsertTextAfter()})(h):y===h.getTextContentSize()&&(!h.canInsertTextAfter()||!x.canInsertTextAfter()&&!h.isComposing()||C)})(e,i)}function uk(e,t){return ir(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function pk(e,t,o){let{anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:s}=e;cy&&(cy=!1,uk(n,r)&&uk(a,s)&&!ms)||sr(t,()=>{if(!o)return void qo(null);if(!bc(t,n,a))return;let i=Je();if(ms&&Oe(i)&&i.isCollapsed()){let d=i.anchor,c=ms.anchor;(d.key===c.key&&d.offset===c.offset+1||d.offset===1&&c.getNode().is(d.getNode().getPreviousSibling()))&&(i=ms.clone(),qo(i))}if(ms=null,Oe(i)){let d=i.anchor,c=d.getNode();if(i.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(i.dirty=!0);let u=en(t).event,m=u?u.timeStamp:performance.now(),[p,f,g,h,y]=kL,x=Zo(),C=t.isComposing()===!1&&x.getTextContent()==="";if(m<y+200&&d.offset===g&&d.key===h)lm(i,p,f);else if(d.type==="text")ke(c)||ie(141),RL(i,c);else if(d.type==="element"&&!C){ae(c)||ie(259);let b=d.getNode();b.isEmpty()?(function(L,w){let k=w.getTextFormat(),I=w.getTextStyle();lm(L,k,I)})(i,b):lm(i,0,"")}}else{let u=d.key,m=i.focus.key,p=i.getNodes(),f=p.length,g=i.isBackward(),h=g?s:r,y=g?r:s,x=g?m:u,C=g?u:m,b=2047,L=!1;for(let w=0;w<f;w++){let k=p[w],I=k.getTextContentSize();if(ke(k)&&I!==0&&!(w===0&&k.__key===x&&h===I||w===f-1&&k.__key===C&&y===0)&&(L=!0,b&=k.getFormat(),b===0))break}i.format=L?b:0}}we(t,Ry,void 0)})}function lm(e,t,o){e.format===t&&e.style===o||(e.format=t,e.style=o,e.dirty=!0)}function RL(e,t){lm(e,t.getFormat(),t.getStyle())}function PL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function AK(e){let t=e.inputType,o=PL(e),n=mt(),r=Je();if(t==="deleteContentBackward"){if(r===null){let m=bs();if(!Oe(m))return!0;qo(m.clone())}if(Oe(r)){let m=r.anchor.key===r.focus.key;if(a=e.timeStamp,IL==="MediaLast"&&a<fc+30&&n.isComposing()&&m){if(ro(null),fc=0,setTimeout(()=>{sr(n,()=>{ro(null)})},30),Oe(r)){let p=r.anchor.getNode();p.markDirty(),ke(p)||ie(142),RL(r,p)}}else{ro(null),e.preventDefault();let p=r.anchor.getNode(),f=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===f.length,y=jh&&m&&!h&&g;if(y&&r.isCollapsed()&&(y=!yt(dR(r.anchor,!0))),!y){we(n,uc,!0);let x=Je();jh&&Oe(x)&&x.isCollapsed()&&(ms=x,setTimeout(()=>ms=null))}}return!0}}var a;if(!Oe(r))return!0;let s=e.data;Pi!==null&&Yy(!1,n,Pi),r.dirty&&Pi===null||!r.isCollapsed()||lo(r.anchor.getNode())||o===null||r.applyDOMRange(o),Pi=null;let i=r.anchor,d=r.focus,c=i.getNode(),u=d.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
|
|
3570
|
-
`)e.preventDefault(),we(n,
|
|
3571
|
-
`){let n=Je();if(Oe(n)||xc(n)){if(Oe(n)){let r=n.focus;n.anchor.set(r.key,r.offset,r.type)}return void we(e,vm,null)}}}Yy(!0,e,t)}function OK(e){let t=mt();if(e.key==null)return!0;if(sm){if(Hk(e))return sr(t,()=>{xm(t,im)}),sm=!1,im="",!0;sm=!1,im=""}if((function(o){return st(o,"ArrowRight",{shiftKey:"any"})})(e))we(t,sL,e);else if((function(o){return st(o,"ArrowRight",Sr)})(e))we(t,iL,e);else if((function(o){return st(o,"ArrowLeft",{shiftKey:"any"})})(e))we(t,lL,e);else if((function(o){return st(o,"ArrowLeft",Sr)})(e))we(t,dL,e);else if((function(o){return st(o,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))we(t,cL,e);else if((function(o){return st(o,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))we(t,uL,e);else if((function(o){return st(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))nc=!0,we(t,vm,e);else if((function(o){return o.key===" "})(e))we(t,pL,e);else if((function(o){return Pn&&st(o,"o",{ctrlKey:!0})})(e))e.preventDefault(),nc=!0,we(t,oc,!0);else if((function(o){return st(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))nc=!1,we(t,vm,e);else if((function(o){return st(o,"Backspace",{shiftKey:"any"})||Pn&&st(o,"h",{ctrlKey:!0})})(e))Hk(e)?we(t,mL,e):(e.preventDefault(),we(t,uc,!0));else if((function(o){return o.key==="Escape"})(e))we(t,fL,e);else if((function(o){return st(o,"Delete",{})||Pn&&st(o,"d",{ctrlKey:!0})})(e))(function(o){return o.key==="Delete"})(e)?we(t,gL,e):(e.preventDefault(),we(t,uc,!1));else if((function(o){return st(o,"Backspace",Bk)})(e))e.preventDefault(),we(t,pc,!0);else if((function(o){return st(o,"Delete",Bk)})(e))e.preventDefault(),we(t,pc,!1);else if((function(o){return Pn&&st(o,"Backspace",{metaKey:!0})})(e))e.preventDefault(),we(t,mc,!0);else if((function(o){return Pn&&(st(o,"Delete",{metaKey:!0})||st(o,"k",{ctrlKey:!0}))})(e))e.preventDefault(),we(t,mc,!1);else if((function(o){return st(o,"b",Sr)})(e))e.preventDefault(),we(t,da,"bold");else if((function(o){return st(o,"u",Sr)})(e))e.preventDefault(),we(t,da,"underline");else if((function(o){return st(o,"i",Sr)})(e))e.preventDefault(),we(t,da,"italic");else if((function(o){return st(o,"Tab",{shiftKey:"any"})})(e))we(t,hL,e);else if((function(o){return st(o,"z",Sr)})(e))e.preventDefault(),we(t,Dy,void 0);else if((function(o){return Pn?st(o,"z",{metaKey:!0,shiftKey:!0}):st(o,"y",{ctrlKey:!0})||st(o,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),we(t,_y,void 0);else{let o=t._editorState._selection;o===null||Oe(o)?Uk(e)&&(e.preventDefault(),we(t,iy,e)):(function(n){return st(n,"c",Sr)})(e)?(e.preventDefault(),we(t,Fy,e)):(function(n){return st(n,"x",Sr)})(e)?(e.preventDefault(),we(t,By,e)):Uk(e)&&(e.preventDefault(),we(t,iy,e))}return(function(o){return o.ctrlKey||o.shiftKey||o.altKey||o.metaKey})(e)&&t.dispatchCommand(TL,e),!0}function EL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Ni=new Map;function ML(e){let t=fR(e.target);if(t===null)return;let o=Vy(t.anchorNode);if(o===null)return;uy&&(uy=!1,sr(o,()=>{let d=bs(),c=t.anchorNode;(Ro(c)||ir(c))&&qo(Dm(d,t,o,e))}));let n=Xy(o),r=n[n.length-1],a=r._key,s=Ni.get(a),i=s||r;i!==o&&pk(t,i,!1),pk(t,o,!0),o!==r?Ni.set(a,o):s&&Ni.delete(a)}function mk(e){e._lexicalHandled=!0}function fk(e){return e._lexicalHandled===!0}var gk=()=>{};function FK(e){let t=dy.get(e);if(t===void 0)return void gk();let o=Cm.get(t);if(o===void 0)return void gk();let n=o-1;n>=0||ie(164),dy.delete(e),Cm.set(t,n),n===0&&t.removeEventListener("selectionchange",ML);let r=wc(e);Om(r)?((function(s){if(s._parentEditor!==null){let i=Xy(s),d=i[i.length-1]._key;Ni.get(d)===s&&Ni.delete(d)}else Ni.delete(s._key)})(r),e.__lexicalEditor=null):r&&ie(198);let a=EL(e);for(let s=0;s<a.length;s++)a[s]();e.__lexicalEventHandles=[]}function py(e,t,o){no();let n=e.__key,r=e.getParent();if(r===null)return;let a=(function(i){let d=Je();if(!Oe(d)||!ae(i))return d;let{anchor:c,focus:u}=d,m=c.getNode(),p=u.getNode();return Lm(m,i)&&c.set(i.__key,0,"element"),Lm(p,i)&&u.set(i.__key,0,"element"),d})(e),s=!1;if(Oe(a)&&t){let i=a.anchor,d=a.focus;i.key===n&&(Im(i,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0),d.key===n&&(Im(d,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else xc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Oe(a)&&t&&!s){let i=e.getIndexWithinParent();pa(e),Tm(a,r,i,-1)}else pa(e);o||gn(r)||r.canBeEmpty()||!r.isEmpty()||py(r,t),t&&a&&lo(r)&&r.isEmpty()&&r.selectEnd()}function BK(e){return e}var AL=Symbol.for("ephemeral");function bm(e){return e[AL]||!1}var fn=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Sc(this);return t===void 0&&ie(64,this.name),t}static clone(t){ie(65,this.name)}$config(){return{}}config(t,o){let n=o.extends||Object.getPrototypeOf(this.constructor);return Object.assign(o,{extends:n,type:t}),{[t]:o}}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}),oR(this,t)}getType(){return this.__type}isInline(){ie(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let o=Qt(t);if(o===null)break;t=o.__parent}return!1}isSelected(t){let o=t||Je();if(o==null)return!1;let n=o.getNodes().some(r=>r.__key===this.__key);if(ke(this))return n;if(Oe(o)&&o.anchor.type==="element"&&o.focus.type==="element"){if(o.isCollapsed())return!1;let r=this.getParent();if(yt(this)&&this.isInline()&&r){let a=o.isBackward()?o.focus:o.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let o=t.getFirstChild(),n=0;for(;o!==null;){if(this.is(o))return n;n++,o=o.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Qt(t)}getParentOrThrow(){let t=this.getParent();return t===null&&ie(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let o=t.getParent();if(gn(o))return ae(t)||t===this&&yt(t)||ie(194),t;t=o}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&ie(67,this.__key),t}getParents(){let t=[],o=this.getParent();for(;o!==null;)t.push(o),o=o.getParent();return t}getParentKeys(){let t=[],o=this.getParent();for(;o!==null;)t.push(o.__key),o=o.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Qt(t)}getPreviousSiblings(){let t=[],o=this.getParent();if(o===null)return t;let n=o.getFirstChild();for(;n!==null&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Qt(t)}getNextSiblings(){let t=[],o=this.getNextSibling();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getCommonAncestor(t){let o=ae(this)?this:this.getParent(),n=ae(t)?t:t.getParent(),r=o&&n?sc(o,n):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let o=sc(this,t);return o!==null&&(o.type==="descendant"||(o.type==="branch"?dv(o)===-1:(o.type!=="same"&&o.type!=="ancestor"&&ie(279),!1)))}isParentOf(t){let o=sc(this,t);return o!==null&&o.type==="ancestor"}getNodesBetween(t){let o=this.isBefore(t),n=[],r=new Set,a=this;for(;a!==null;){let s=a.__key;if(r.has(s)||(r.add(s),n.push(a)),a===t)break;let i=ae(a)?o?a.getFirstChild():a.getLastChild():null;if(i!==null){a=i;continue}let d=o?a.getNextSibling():a.getPreviousSibling();if(d!==null){a=d;continue}let c=a.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===t)break;let u=null,m=c;do{if(m===null&&ie(68),u=o?m.getNextSibling():m.getPreviousSibling(),m=m.getParent(),m===null)break;u!==null||r.has(m.__key)||n.push(m)}while(u===null);a=u}return o||n.reverse(),n}isDirty(){let t=mt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(bm(this))return this;let t=Qt(this.__key);return t===null&&ie(113),t}getWritable(){if(bm(this))return this;no();let t=Ar(),o=mt(),n=t._nodeMap,r=this.__key,a=this.getLatest(),s=o._cloneNotNeeded,i=Je();if(i!==null&&i.setCachedNodes(null),s.has(r))return km(a),a;let d=rv(a);return s.add(r),km(d),n.set(r,d),d}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,o){ie(70)}updateDOM(t,o,n){ie(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){ie(18,this.name)}updateFromJSON(t){return(function(o,n){let r=o.getWritable(),a=n.$,s=a;for(let i of eL(r).flatKeys)i in n&&(s!==void 0&&s!==a||(s={...a}),s[i]=n[i]);return(r.__state||s)&&Ly(o).updateFromJSON(s),r})(this,t)}static transform(){return null}remove(t){py(this,!0,t)}replace(t,o){no();let n=Je();n!==null&&(n=n.clone()),qh(this,t);let r=this.getLatest(),a=this.__key,s=t.__key,i=t.getWritable(),d=this.getParentOrThrow().getWritable(),c=d.__size;pa(i);let u=r.getPreviousSibling(),m=r.getNextSibling(),p=r.__prev,f=r.__next,g=r.__parent;if(py(r,!1,!0),u===null?d.__first=s:u.getWritable().__next=s,i.__prev=p,m===null?d.__last=s:m.getWritable().__prev=s,i.__next=f,i.__parent=g,d.__size=c,o&&(ae(this)&&ae(i)||ie(139),this.getChildren().forEach(h=>{i.append(h)})),Oe(n)){qo(n);let h=n.anchor,y=n.focus;h.key===a&&Ck(h,i),y.key===a&&Ck(y,i)}return ca()===a&&ro(s),i}insertAfter(t,o=!0){no(),qh(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.getParent(),s=Je(),i=!1,d=!1;if(a!==null){let f=t.getIndexWithinParent();if(pa(r),Oe(s)){let g=a.__key,h=s.anchor,y=s.focus;i=h.type==="element"&&h.key===g&&h.offset===f+1,d=y.type==="element"&&y.key===g&&y.offset===f+1}}let c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),m=r.__key,p=n.__next;if(c===null?u.__last=m:c.getWritable().__prev=m,u.__size++,n.__next=m,r.__next=p,r.__prev=n.__key,r.__parent=n.__parent,o&&Oe(s)){let f=this.getIndexWithinParent();Tm(s,u,f+1);let g=u.__key;i&&s.anchor.set(g,f+2,"element"),d&&s.focus.set(g,f+2,"element")}return t}insertBefore(t,o=!0){no(),qh(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.__key;pa(r);let s=this.getPreviousSibling(),i=this.getParentOrThrow().getWritable(),d=n.__prev,c=this.getIndexWithinParent();s===null?i.__first=a:s.getWritable().__next=a,i.__size++,n.__prev=a,r.__prev=d,r.__next=n.__key,r.__parent=n.__parent;let u=Je();return o&&Oe(u)&&Tm(u,this.getParentOrThrow(),c),t}isParentRequired(){return!1}createParentElementNode(){return Pr()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,o){no();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(ae(n))return n.select();if(!ke(n)){let a=n.getIndexWithinParent()+1;return r.select(a,a)}return n.select(t,o)}selectNext(t,o){no();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(ae(n))return n.select(0,0);if(!ke(n)){let a=n.getIndexWithinParent();return r.select(a,a)}return n.select(t,o)}markDirty(){this.getWritable()}reconcileObservedMutation(t,o){this.markDirty()}},HK="historic",UK="history-push",dm="history-merge",$K="paste",NL="collaboration",zK="skip-collab",DL="skip-scroll-into-view",_L="skip-dom-selection",my="skip-selection-focus",OL="composition-start",FL="composition-end",_i=class e extends fn{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
|
|
3572
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(o){let n=o.parentElement;if(n!==null&&
|
|
3552
|
+
`,by=da?"\xA0":sc,X0="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Y0="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",mK=new RegExp("^[^"+Y0+"]*["+X0+"]"),fK=new RegExp("^[^"+X0+"]*["+Y0+"]"),xo={bold:1,capitalize:1024,code:16,highlight:xy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},gK={directionless:1,unmergeable:2},qh={center:2,end:6,justify:4,left:1,right:3,start:5},hK={[lK]:"center",[pK]:"end",[cK]:"justify",[iK]:"left",[dK]:"right",[uK]:"start"},yK={normal:0,segmented:2,token:1},vK={[Xz]:"normal",[Jz]:"segmented",[Yz]:"token"},CK="$",n0="$config";function J0(e,t,o,n,r,a){let s=e.getFirstChild();for(;s!==null;){let i=s.__key;s.__parent===t&&(re(s)&&J0(s,i,o,n,r,a),o.has(i)||a.delete(i),r.push(i)),s=s.getNextSibling()}}var Wh=!1,wy=0;function xK(e){wy=e.timeStamp}function Nh(e,t,o){let n=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||n&&e.previousSibling===r)||n&&Am(e,o)!==void 0}function bK(e,t,o){let n=Mn(Jo(o)),r=null,a=null;n!==null&&n.anchorNode===e&&(r=n.anchorOffset,a=n.focusOffset);let s=e.nodeValue;s!==null&&Vy(t,s,r,a,!1)}function wK(e,t,o){if(Oe(e)){let n=e.anchor.getNode();if(n.is(o)&&e.format!==n.getFormat())return!1}return nr(t)&&o.isAttached()}function TK(e,t,o,n){for(let r=e;r&&!bP(r);r=bc(r)){let a=Am(r,t);if(a!==void 0){let s=Vt(a,o);if(s)return yt(s)||!ko(r)?void 0:[r,s]}else if(r===n)return[n,iP(o)]}}function Z0(e,t,o){Wh=!0;let n=performance.now()-wy>100;try{or(e,()=>{let r=Je()||(function(p){return p.getEditorState().read(()=>{let f=Je();return f!==null?f.clone():null})})(e),a=new Map,s=e.getRootElement(),i=e._editorState,d=e._blockCursorElement,c=!1,u="";for(let p=0;p<t.length;p++){let f=t[p],g=f.type,h=f.target,y=TK(h,e,i,s);if(!y)continue;let[x,C]=y;if(g==="characterData")n&&ke(C)&&nr(h)&&wK(r,h,C)&&bK(h,C,e);else if(g==="childList"){c=!0;let b=f.addedNodes;for(let k=0;k<b.length;k++){let I=b[k],T=Wy(I),S=I.parentNode;if(S!=null&&I!==d&&T===null&&!Nh(I,S,e)){if(da){let P=(ko(I)?I.innerText:null)||I.nodeValue;P&&(u+=P)}S.removeChild(I)}}let L=f.removedNodes,w=L.length;if(w>0){let k=0;for(let I=0;I<w;I++){let T=L[I];(Nh(T,h,e)||d===T)&&(h.appendChild(T),k++)}w!==k&&a.set(x,C)}}}if(a.size>0)for(let[p,f]of a)f.reconcileObservedMutation(p,e);let m=o.takeRecords();if(m.length>0){for(let p=0;p<m.length;p++){let f=m[p],g=f.addedNodes,h=f.target;for(let y=0;y<g.length;y++){let x=g[y],C=x.parentNode;C==null||x.nodeName!=="BR"||Nh(x,h,e)||C.removeChild(x)}}o.takeRecords()}r!==null&&(c&&$o(r),da&&mP(e)&&r.insertRawText(u))})}finally{Wh=!1}}function eL(e){let t=e._observer;t!==null&&Z0(e,t.takeRecords(),t)}function tL(e){(function(t){wy===0&&Jo(t).addEventListener("textInput",xK,!0)})(e),e._observer=new MutationObserver((t,o)=>{Z0(e,t,o)})}var Gh=class{key;parse;unparse;isEqual;defaultValue;constructor(t,o){this.key=t,this.parse=o.parse.bind(o),this.unparse=(o.unparse||LK).bind(o),this.isEqual=(o.isEqual||Object.is).bind(o),this.defaultValue=this.parse(void 0)}};function IK(e,t){return new Gh(e,t)}function im(e,t,o="latest"){let n=(o==="latest"?e.getLatest():e).__state;return n?n.getValue(t):t.defaultValue}function SK(e,t,o){let n=im(e,o,"direct"),r=im(t,o,"direct");return o.isEqual(n,r)?null:[n,r]}function kK(e,t,o){let n;if(no(),typeof o=="function"){let a=e.getLatest(),s=im(a,t);if(n=o(s),t.isEqual(s,n))return a}else n=o;let r=e.getWritable();return Ty(r).updateFromKnown(t,n),r}function oL(e){let t=new Map,o=new Set;for(let n=typeof e=="function"?e:e.replace;n.prototype&&n.prototype.getType!==void 0;n=Object.getPrototypeOf(n)){let{ownNodeConfig:r}=Tc(n);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let s;"stateConfig"in a?(s=a.stateConfig,a.flat&&o.add(s.key)):s=a,t.set(s.key,s)}}return{flatKeys:o,sharedConfigMap:t}}var jh=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,o,n=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=o,this.unknownState=n,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,i=a!==void 0?a:(function(d,c,u){let m=u.size;if(c)for(let p in c){let f=d.get(p);f&&u.has(f)||m++}return m})(s,n,r);this.size=i}getValue(t){let o=this.knownState.get(t);if(o!==void 0)return o;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(n=t.parse(r)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},o={};for(let[n,r]of this.knownState)n.isEqual(r,n.defaultValue)?delete t[n.key]:t[n.key]=n.unparse(r);for(let n of this.sharedNodeState.flatKeys)n in t&&(o[n]=t[n],delete t[n]);return r0(t)&&(o.$=t),o}getWritable(t){if(this.node===t)return this;let{sharedNodeState:o,unknownState:n}=this,r=new Map(this.knownState);return new e(t,o,(function(a,s,i){let d;if(i)for(let[c,u]of Object.entries(i)){let m=a.get(c);m?s.has(m)||s.set(m,m.parse(u)):(d=d||{},d[c]=u)}return d})(o.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,o){let n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&n in a||(a&&(delete a[n],this.unknownState=r0(a)),this.size++),r.set(t,o)}updateFromUnknown(t,o){let n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(o)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=o)}updateFromJSON(t){let{knownState:o}=this;for(let n of o.keys())o.set(n,n.defaultValue);if(this.size=o.size,this.unknownState=void 0,t)for(let[n,r]of Object.entries(t))this.updateFromUnknown(n,r)}};function Ty(e){let t=e.getWritable(),o=t.__state?t.__state.getWritable(t):new jh(t,nL(t));return t.__state=o,o}function nL(e){return e.__state?e.__state.sharedNodeState:$y(Zy(),e.getType()).sharedNodeState}function r0(e){if(e)for(let t in e)return e}function LK(e){return e}function a0(e,t,o){for(let[n,r]of t.knownState){if(e.has(n.key))continue;e.add(n.key);let a=o?o.getValue(n):n.defaultValue;if(a!==r&&!n.isEqual(a,r))return!0}return!1}function s0(e,t,o){let{unknownState:n}=t,r=o?o.unknownState:void 0;if(n){for(let[a,s]of Object.entries(n))if(!e.has(a)&&(e.add(a),s!==(r?r[a]:void 0)))return!0}return!1}function i0(e,t){let o=e.__state;return o&&o.node===e?o.getWritable(t):o}function l0(e,t){let o=e.__mode,n=e.__format,r=e.__style,a=t.__mode,s=t.__format,i=t.__style,d=e.__state,c=t.__state;return(o===null||o===a)&&(n===null||n===s)&&(r===null||r===i)&&(e.__state===null||d===c||(function(u,m){if(u===m)return!0;if(u&&m&&u.size!==m.size)return!1;let p=new Set;return!(u&&a0(p,u,m)||m&&a0(p,m,u)||u&&s0(p,u,m)||m&&s0(p,m,u))})(d,c))}function d0(e,t){let o=e.mergeWithSibling(t),n=mt()._normalizedNodes;return n.add(e.__key),n.add(t.__key),o}function c0(e){let t,o,n=e;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(t=n.getPreviousSibling())!==null&&ke(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(l0(t,n)){n=d0(t,n);break}break}t.remove()}for(;(o=n.getNextSibling())!==null&&ke(o)&&o.isSimpleText()&&!o.isUnmergeable();){if(o.__text!==""){if(l0(n,o)){n=d0(n,o);break}break}o.remove()}}else n.remove()}function lm(e){return u0(e.anchor),u0(e.focus),e}function u0(e){for(;e.type==="element";){let t=e.getNode(),o=e.offset,n,r;if(o===t.getChildrenSize()?(n=t.getChildAtIndex(o-1),r=!0):(n=t.getChildAtIndex(o),r=!1),ke(n)){e.set(n.__key,r?n.getTextContentSize():0,"text",!0);break}if(!re(n))break;e.set(n.__key,r?n.getChildrenSize():0,"element",!0)}}var us,co,ic,Lm,Vh,Qh,ps,kn,Xh,lc,jt="",tr=null,ls=null,Si=!1,dm=!1;function cm(e,t){let o=ps.get(e);if(t!==null){let n=ey(e);n.parentNode===t&&t.removeChild(n)}if(kn.has(e)||co._keyToDOMMap.delete(e),re(o)){let n=pm(o,ps);Yh(n,0,n.length-1,null)}o!==void 0&&Qy(lc,ic,Lm,o,"destroyed")}function Yh(e,t,o,n){for(let r=t;r<=o;++r){let a=e[r];a!==void 0&&cm(a,n)}}function is(e,t){e.setProperty("text-align",t)}var PK="40px";function rL(e,t){let o=us.theme.indent;if(typeof o=="string"){let r=e.classList.contains(o);t>0&&!r?e.classList.add(o):t<1&&r&&e.classList.remove(o)}if(t===0)return void e.style.setProperty("padding-inline-start","");let n=getComputedStyle(co._rootElement||e).getPropertyValue("--lexical-indent-base-value")||PK;e.style.setProperty("padding-inline-start",`calc(${t} * ${n})`)}function aL(e,t){let o=e.style;t===0?is(o,""):t===1?is(o,"left"):t===2?is(o,"center"):t===3?is(o,"right"):t===4?is(o,"justify"):t===5?is(o,"start"):t===6&&is(o,"end")}function Jh(e,t){let o=(function(n){let r=n.__dir;if(r!==null)return r;if(lo(n))return null;let a=n.getParentOrThrow();return lo(a)&&a.__dir===null?"auto":null})(t);o!==null?e.dir=o:e.removeAttribute("dir")}function um(e,t){let o=kn.get(e);o===void 0&&le(60);let n=o.createDOM(us,co);if((function(r,a,s){let i=s._keyToDOMMap;(function(d,c,u){let m=`__lexicalKey_${c._key}`;d[m]=u})(a,s,r),i.set(r,a)})(e,n,co),ke(o)?n.setAttribute("data-lexical-text","true"):yt(o)&&n.setAttribute("data-lexical-decorator","true"),re(o)){let r=o.__indent,a=o.__size;if(Jh(n,o),r!==0&&rL(n,r),a!==0){let i=a-1;Zh(pm(o,kn),o,0,i,o.getDOMSlot(n))}let s=o.__format;s!==0&&aL(n,s),o.isInline()||sL(null,o,n)}else{let r=o.getTextContent();if(yt(o)){let a=o.decorate(co,us);a!==null&&iL(e,a),n.contentEditable="false"}jt+=r}return t!==null&&t.insertChild(n),Qy(lc,ic,Lm,o,"created"),n}function Zh(e,t,o,n,r){let a=jt;jt="";let s=o;for(;s<=n;++s){um(e[s],r);let i=kn.get(e[s]);i!==null&&ke(i)?tr===null&&(tr=i.getFormat(),ls=i.getStyle()):re(i)&&s<n&&!i.isInline()&&(jt+=km)}r.element.__lexicalTextContent=jt,jt=a+jt}function p0(e,t){if(e){let o=e.__last;if(o){let n=t.get(o);if(n)return cs(n)?"line-break":yt(n)&&n.isInline()?"decorator":null}return"empty"}return null}function sL(e,t,o){let n=p0(e,ps),r=p0(t,kn);n!==r&&t.getDOMSlot(o).setManagedLineBreak(r)}function RK(e,t,o){var n;tr=null,ls=null,(function(r,a,s){let i=jt,d=r.__size,c=a.__size;jt="";let u=s.element;if(d===1&&c===1){let m=r.__first,p=a.__first;if(m===p)em(m,u);else{let g=ey(m),h=um(p,null);try{u.replaceChild(h,g)}catch(y){if(typeof y=="object"&&y!=null){let x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${m}}.`;throw new Error(x)}throw y}cm(m,null)}let f=kn.get(p);ke(f)&&tr===null&&(tr=f.getFormat(),ls=f.getStyle())}else{let m=pm(r,ps),p=pm(a,kn);if(m.length!==d&&le(227),p.length!==c&&le(228),d===0)c!==0&&Zh(p,0,0,c-1,s);else if(c===0){if(d!==0){let f=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;Yh(m,0,d-1,f?null:u),f&&(u.textContent="")}}else(function(f,g,h,y,x,C){let b=y-1,L=x-1,w,k,I=C.getFirstChild(),T=0,S=0;for(;T<=b&&S<=L;){let N=g[T],B=h[S];if(N===B)I=Dh(em(B,C.element)),T++,S++;else{if(k===void 0&&(k=m0(h,S)),w===void 0)w=m0(g,T);else if(!w.has(N)){T++;continue}if(!k.has(N)){I=Dh(ey(N)),cm(N,C.element),T++,w.delete(N);continue}if(w.has(B)){let j=Fi(co,B);j!==I&&C.withBefore(I).insertChild(j),I=Dh(em(B,C.element)),T++,S++}else um(B,C.withBefore(I)),S++}let O=kn.get(B);O!==null&&ke(O)?tr===null&&(tr=O.getFormat(),ls=O.getStyle()):re(O)&&S<=L&&!O.isInline()&&(jt+=km)}let P=T>b,A=S>L;if(P&&!A){let N=h[L+1],B=N===void 0?null:co.getElementByKey(N);Zh(h,0,S,L,C.withBefore(B))}else A&&!P&&Yh(g,T,b,C.element)})(0,m,p,d,c,s)}u.__lexicalTextContent=jt,jt=i+jt})(e,t,t.getDOMSlot(o)),n=t,tr==null||tr===n.__textFormat||dm||n.setTextFormat(tr),(function(r){ls==null||ls===r.__textStyle||dm||r.setTextStyle(ls)})(t)}function pm(e,t){let o=[],n=e.__first;for(;n!==null;){let r=t.get(n);r===void 0&&le(101),o.push(n),n=r.__next}return o}function em(e,t){let o=ps.get(e),n=kn.get(e);o!==void 0&&n!==void 0||le(61);let r=Si||Qh.has(e)||Vh.has(e),a=Fi(co,e);if(o===n&&!r){let s;if(re(o)){let i=a.__lexicalTextContent;typeof i=="string"?s=i:(s=o.getTextContent(),a.__lexicalTextContent=s)}else s=o.getTextContent();return jt+=s,a}if(o!==n&&r&&Qy(lc,ic,Lm,n,"updated"),n.updateDOM(o,a,us)){let s=um(e,null);return t===null&&le(62),t.replaceChild(s,a),cm(e,null),s}if(re(o)){re(n)||le(334,e);let s=n.__indent;(Si||s!==o.__indent)&&rL(a,s);let i=n.__format;if((Si||i!==o.__format)&&aL(a,i),r)RK(o,n,a),lo(n)||n.isInline()||sL(o,n,a);else{let d=a.__lexicalTextContent,c;typeof d=="string"?c=d:(c=o.getTextContent(),a.__lexicalTextContent=c),jt+=c}if((Si||n.__dir!==o.__dir)&&(Jh(a,n),lo(n)&&!Si))for(let d of n.getChildren())re(d)&&Jh(Fi(co,d.getKey()),d)}else{let s=n.getTextContent();if(yt(n)){let i=n.decorate(co,us);i!==null&&iL(e,i)}jt+=s}if(!dm&&lo(n)&&n.__cachedText!==jt){let s=n.getWritable();s.__cachedText=jt,n=s}return a}function iL(e,t){let o=co._pendingDecorators,n=co._decorators;if(o===null){if(n[e]===t)return;o=sP(co)}o[e]=t}function Dh(e){let t=e.nextSibling;return t!==null&&t===co._blockCursorElement&&(t=t.nextSibling),t}function m0(e,t){let o=new Set;for(let n=t;n<e.length;n++)o.add(e[n]);return o}function EK(e,t,o,n,r,a){jt="",Si=n===2,co=o,us=o._config,ic=o._nodes,Lm=co._listeners.mutation,Vh=r,Qh=a,ps=e._nodeMap,kn=t._nodeMap,dm=t._readOnly,Xh=new Map(o._keyToDOMMap);let s=new Map;return lc=s,em("root",null),co=void 0,ic=void 0,Vh=void 0,Qh=void 0,ps=void 0,kn=void 0,us=void 0,Xh=void 0,lc=void 0,s}function ey(e){let t=Xh.get(e);return t===void 0&&le(75,e),t}function He(e){return{type:e}}var Iy=He("SELECTION_CHANGE_COMMAND"),MK=He("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),lL=He("CLICK_COMMAND"),Sy=He("BEFORE_INPUT_COMMAND"),ky=He("INPUT_COMMAND"),Ly=He("COMPOSITION_START_COMMAND"),Py=He("COMPOSITION_END_COMMAND"),dc=He("DELETE_CHARACTER_COMMAND"),ec=He("INSERT_LINE_BREAK_COMMAND"),ty=He("INSERT_PARAGRAPH_COMMAND"),Ri=He("CONTROLLED_TEXT_INSERTION_COMMAND"),Ry=He("PASTE_COMMAND"),oy=He("REMOVE_TEXT_COMMAND"),cc=He("DELETE_WORD_COMMAND"),uc=He("DELETE_LINE_COMMAND"),aa=He("FORMAT_TEXT_COMMAND"),Ey=He("UNDO_COMMAND"),My=He("REDO_COMMAND"),Ay=He("KEYDOWN_COMMAND"),dL=He("KEY_ARROW_RIGHT_COMMAND"),cL=He("MOVE_TO_END"),uL=He("KEY_ARROW_LEFT_COMMAND"),pL=He("MOVE_TO_START"),mL=He("KEY_ARROW_UP_COMMAND"),fL=He("KEY_ARROW_DOWN_COMMAND"),mm=He("KEY_ENTER_COMMAND"),gL=He("KEY_SPACE_COMMAND"),hL=He("KEY_BACKSPACE_COMMAND"),yL=He("KEY_ESCAPE_COMMAND"),vL=He("KEY_DELETE_COMMAND"),CL=He("KEY_TAB_COMMAND"),AK=He("INSERT_TAB_COMMAND"),NK=He("INDENT_CONTENT_COMMAND"),DK=He("OUTDENT_CONTENT_COMMAND"),xL=He("DROP_COMMAND"),_K=He("FORMAT_ELEMENT_COMMAND"),bL=He("DRAGSTART_COMMAND"),wL=He("DRAGOVER_COMMAND"),TL=He("DRAGEND_COMMAND"),Ny=He("COPY_COMMAND"),Dy=He("CUT_COMMAND"),ny=He("SELECT_ALL_COMMAND"),OK=He("CLEAR_EDITOR_COMMAND"),FK=He("CLEAR_HISTORY_COMMAND"),BK=He("CAN_REDO_COMMAND"),HK=He("CAN_UNDO_COMMAND"),IL=He("FOCUS_COMMAND"),SL=He("BLUR_COMMAND"),kL=He("KEY_MODIFIER_COMMAND"),br=Object.freeze({}),ry=[["keydown",function(e,t){pc=e.timeStamp,LL=e.key,!t.isComposing()&&we(t,Ay,e)}],["pointerdown",function(e,t){let o=e.target,n=e.pointerType;qi(o)&&n!=="touch"&&n!=="pen"&&e.button===0&&or(t,()=>{nP(o)||(iy=!0)})}],["compositionstart",function(e,t){we(t,Ly,e)}],["compositionend",function(e,t){da?Zd=!0:yc||!Im&&!Sm?we(t,Py,e):(tm=!0,om=e.data)}],["input",function(e,t){e.stopPropagation(),or(t,()=>{t.dispatchCommand(ky,e)},{event:e}),ki=null}],["click",function(e,t){or(t,()=>{let o=Je(),n=Mn(Jo(t)),r=ys();if(n){if(Oe(o)){let a=o.anchor,s=a.getNode();if(a.type==="element"&&a.offset===0&&o.isCollapsed()&&!lo(s)&&Yo().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&o.is(r))n.removeAllRanges(),o.dirty=!0;else if(e.detail===3&&!o.isCollapsed()&&s!==o.focus.getNode()){let i=nc(s,d=>re(d)&&!d.isInline());re(i)&&i.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=n.anchorNode;(ko(a)||nr(a))&&$o(Rm(r,n,t,e))}}we(t,lL,e)})}],["cut",br],["copy",br],["dragstart",br],["dragover",br],["dragend",br],["paste",br],["focus",br],["blur",br],["drop",br]];sm&&ry.push(["beforeinput",(e,t)=>(function(o,n){let r=o.inputType;r==="deleteCompositionText"||da&&mP(n)||r!=="insertCompositionText"&&we(n,Sy,o)})(e,t)]);var pc=0,LL=null,PL=0,ki=null,ay=new WeakMap,fm=new WeakMap,sy=!1,iy=!1,tc=!1,Zd=!1,tm=!1,om="",ds=null,RL=[0,"",0,"root",0];function EL(e,t,o,n,r){let a=e.anchor,s=e.focus,i=a.getNode(),d=mt(),c=Mn(Jo(d)),u=c!==null?c.anchorNode:null,m=a.key,p=d.getElementByKey(m),f=o.length;return m!==s.key||!ke(i)||(!r&&(!sm||PL<n+50)||i.isDirty()&&f<2||lP(o))&&a.offset!==s.offset&&!i.isComposing()||Ir(i)||i.isDirty()&&f>1||(r||!sm)&&p!==null&&!i.isComposing()&&u!==gs(p)||c!==null&&t!==null&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.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 y=g.anchor.offset,x=h.getParentOrThrow(),C=ia(h);return y===0?!h.canInsertTextBefore()||!x.canInsertTextBefore()&&!h.isComposing()||C||(function(b){let L=b.getPreviousSibling();return(ke(L)||re(L)&&L.isInline())&&!L.canInsertTextAfter()})(h):y===h.getTextContentSize()&&(!h.canInsertTextAfter()||!x.canInsertTextAfter()&&!h.isComposing()||C)})(e,i)}function f0(e,t){return nr(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function g0(e,t,o){let{anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:s}=e;sy&&(sy=!1,f0(n,r)&&f0(a,s)&&!ds)||or(t,()=>{if(!o)return void $o(null);if(!Cc(t,n,a))return;let i=Je();if(ds&&Oe(i)&&i.isCollapsed()){let d=i.anchor,c=ds.anchor;(d.key===c.key&&d.offset===c.offset+1||d.offset===1&&c.getNode().is(d.getNode().getPreviousSibling()))&&(i=ds.clone(),$o(i))}if(ds=null,Oe(i)){let d=i.anchor,c=d.getNode();if(i.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(i.dirty=!0);let u=Jo(t).event,m=u?u.timeStamp:performance.now(),[p,f,g,h,y]=RL,x=Yo(),C=t.isComposing()===!1&&x.getTextContent()==="";if(m<y+200&&d.offset===g&&d.key===h)nm(i,p,f);else if(d.type==="text")ke(c)||le(141),ML(i,c);else if(d.type==="element"&&!C){re(c)||le(259);let b=d.getNode();b.isEmpty()?(function(L,w){let k=w.getTextFormat(),I=w.getTextStyle();nm(L,k,I)})(i,b):nm(i,0,"")}}else{let u=d.key,m=i.focus.key,p=i.getNodes(),f=p.length,g=i.isBackward(),h=g?s:r,y=g?r:s,x=g?m:u,C=g?u:m,b=2047,L=!1;for(let w=0;w<f;w++){let k=p[w],I=k.getTextContentSize();if(ke(k)&&I!==0&&!(w===0&&k.__key===x&&h===I||w===f-1&&k.__key===C&&y===0)&&(L=!0,b&=k.getFormat(),b===0))break}i.format=L?b:0}}we(t,Iy,void 0)})}function nm(e,t,o){e.format===t&&e.style===o||(e.format=t,e.style=o,e.dirty=!0)}function ML(e,t){nm(e,t.getFormat(),t.getStyle())}function AL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function UK(e){let t=e.inputType,o=AL(e),n=mt(),r=Je();if(t==="deleteContentBackward"){if(r===null){let m=ys();if(!Oe(m))return!0;$o(m.clone())}if(Oe(r)){let m=r.anchor.key===r.focus.key;if(a=e.timeStamp,LL==="MediaLast"&&a<pc+30&&n.isComposing()&&m){if(ro(null),pc=0,setTimeout(()=>{or(n,()=>{ro(null)})},30),Oe(r)){let p=r.anchor.getNode();p.markDirty(),ke(p)||le(142),ML(r,p)}}else{ro(null),e.preventDefault();let p=r.anchor.getNode(),f=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===f.length,y=Kh&&m&&!h&&g;if(y&&r.isCollapsed()&&(y=!yt(pP(r.anchor,!0))),!y){we(n,dc,!0);let x=Je();Kh&&Oe(x)&&x.isCollapsed()&&(ds=x,setTimeout(()=>ds=null))}}return!0}}var a;if(!Oe(r))return!0;let s=e.data;ki!==null&&jy(!1,n,ki),r.dirty&&ki===null||!r.isCollapsed()||lo(r.anchor.getNode())||o===null||r.applyDOMRange(o),ki=null;let i=r.anchor,d=r.focus,c=i.getNode(),u=d.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
|
|
3553
|
+
`)e.preventDefault(),we(n,ec,!1);else if(s===km)e.preventDefault(),we(n,ty,void 0);else if(s==null&&e.dataTransfer){let m=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(m)}else s!=null&&EL(r,o,s,e.timeStamp,!0)?(e.preventDefault(),we(n,Ri,s)):ki=s;return PL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":we(n,Ri,e);break;case"insertFromComposition":ro(null),we(n,Ri,e);break;case"insertLineBreak":ro(null),we(n,ec,!1);break;case"insertParagraph":ro(null),tc&&!yc?(tc=!1,we(n,ec,!1)):we(n,ty,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":we(n,Ry,e);break;case"deleteByComposition":(function(m,p){return m!==p||re(m)||re(p)||!ia(m)||!ia(p)})(c,u)&&we(n,oy,e);break;case"deleteByDrag":case"deleteByCut":we(n,oy,e);break;case"deleteContent":we(n,dc,!1);break;case"deleteWordBackward":we(n,cc,!0);break;case"deleteWordForward":we(n,cc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":we(n,uc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":we(n,uc,!1);break;case"formatStrikeThrough":we(n,aa,"strikethrough");break;case"formatBold":we(n,aa,"bold");break;case"formatItalic":we(n,aa,"italic");break;case"formatUnderline":we(n,aa,"underline");break;case"historyUndo":we(n,Ey,void 0);break;case"historyRedo":we(n,My,void 0)}return!0}function $K(e){if(ko(e.target)&&nP(e.target))return!0;let t=mt(),o=Je(),n=e.data,r=AL(e);if(n!=null&&Oe(o)&&EL(o,r,n,e.timeStamp,!1)){Zd&&(gm(t,n),Zd=!1);let a=o.anchor.getNode(),s=Mn(Jo(t));if(s===null)return!0;let i=o.isBackward(),d=i?o.anchor.offset:o.focus.offset,c=i?o.focus.offset:o.anchor.offset;sm&&!o.isCollapsed()&&ke(a)&&s.anchorNode!==null&&a.getTextContent().slice(0,d)+n+a.getTextContent().slice(d+c)===cP(s.anchorNode)||we(t,Ri,n);let u=n.length;da&&u>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(o.anchor.offset-=u),Kh&&t.isComposing()&&(pc=0,ro(null))}else jy(!1,t,n!==null?n:void 0),Zd&&(gm(t,n||void 0),Zd=!1);return(function(){no();let a=mt();eL(a)})(),!0}function zK(e){let t=mt(),o=Je();if(Oe(o)&&!t.isComposing()){let n=o.anchor,r=o.anchor.getNode();ro(n.key),Dm(HL),(e.timeStamp<pc+30||n.type==="element"||!o.isCollapsed()||r.getFormat()!==o.format||ke(r)&&r.getStyle()!==o.style)&&we(t,Ri,by)}return!0}function KK(e){return gm(mt(),e.data),Dm(UL),!0}function gm(e,t){let o=e._compositionKey;if(ro(null),o!==null&&t!=null){if(t===""){let n=Vt(o),r=gs(e.getElementByKey(o));if(r!==null&&r.nodeValue!==null&&ke(n)){let a=Mn(Jo(e)),s=null,i=null;a!==null&&a.anchorNode===r&&(s=a.anchorOffset,i=a.focusOffset),Vy(n,r.nodeValue,s,i,!0)}return}if(t[t.length-1]===`
|
|
3554
|
+
`){let n=Je();if(Oe(n)||vc(n)){if(Oe(n)){let r=n.focus;n.anchor.set(r.key,r.offset,r.type)}return void we(e,mm,null)}}}jy(!0,e,t)}function qK(e){let t=mt();if(e.key==null)return!0;if(tm){if(z0(e))return or(t,()=>{gm(t,om)}),tm=!1,om="",!0;tm=!1,om=""}if((function(o){return at(o,"ArrowRight",{shiftKey:"any"})})(e))we(t,dL,e);else if((function(o){return at(o,"ArrowRight",Tr)})(e))we(t,cL,e);else if((function(o){return at(o,"ArrowLeft",{shiftKey:"any"})})(e))we(t,uL,e);else if((function(o){return at(o,"ArrowLeft",Tr)})(e))we(t,pL,e);else if((function(o){return at(o,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))we(t,mL,e);else if((function(o){return at(o,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))we(t,fL,e);else if((function(o){return at(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))tc=!0,we(t,mm,e);else if((function(o){return o.key===" "})(e))we(t,gL,e);else if((function(o){return In&&at(o,"o",{ctrlKey:!0})})(e))e.preventDefault(),tc=!0,we(t,ec,!0);else if((function(o){return at(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))tc=!1,we(t,mm,e);else if((function(o){return at(o,"Backspace",{shiftKey:"any"})||In&&at(o,"h",{ctrlKey:!0})})(e))z0(e)?we(t,hL,e):(e.preventDefault(),we(t,dc,!0));else if((function(o){return o.key==="Escape"})(e))we(t,yL,e);else if((function(o){return at(o,"Delete",{})||In&&at(o,"d",{ctrlKey:!0})})(e))(function(o){return o.key==="Delete"})(e)?we(t,vL,e):(e.preventDefault(),we(t,dc,!1));else if((function(o){return at(o,"Backspace",$0)})(e))e.preventDefault(),we(t,cc,!0);else if((function(o){return at(o,"Delete",$0)})(e))e.preventDefault(),we(t,cc,!1);else if((function(o){return In&&at(o,"Backspace",{metaKey:!0})})(e))e.preventDefault(),we(t,uc,!0);else if((function(o){return In&&(at(o,"Delete",{metaKey:!0})||at(o,"k",{ctrlKey:!0}))})(e))e.preventDefault(),we(t,uc,!1);else if((function(o){return at(o,"b",Tr)})(e))e.preventDefault(),we(t,aa,"bold");else if((function(o){return at(o,"u",Tr)})(e))e.preventDefault(),we(t,aa,"underline");else if((function(o){return at(o,"i",Tr)})(e))e.preventDefault(),we(t,aa,"italic");else if((function(o){return at(o,"Tab",{shiftKey:"any"})})(e))we(t,CL,e);else if((function(o){return at(o,"z",Tr)})(e))e.preventDefault(),we(t,Ey,void 0);else if((function(o){return In?at(o,"z",{metaKey:!0,shiftKey:!0}):at(o,"y",{ctrlKey:!0})||at(o,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),we(t,My,void 0);else{let o=t._editorState._selection;o===null||Oe(o)?K0(e)&&(e.preventDefault(),we(t,ny,e)):(function(n){return at(n,"c",Tr)})(e)?(e.preventDefault(),we(t,Ny,e)):(function(n){return at(n,"x",Tr)})(e)?(e.preventDefault(),we(t,Dy,e)):K0(e)&&(e.preventDefault(),we(t,ny,e))}return(function(o){return o.ctrlKey||o.shiftKey||o.altKey||o.metaKey})(e)&&t.dispatchCommand(kL,e),!0}function NL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Ei=new Map;function DL(e){let t=yP(e.target);if(t===null)return;let o=qy(t.anchorNode);if(o===null)return;iy&&(iy=!1,or(o,()=>{let d=ys(),c=t.anchorNode;(ko(c)||nr(c))&&$o(Rm(d,t,o,e))}));let n=Gy(o),r=n[n.length-1],a=r._key,s=Ei.get(a),i=s||r;i!==o&&g0(t,i,!1),g0(t,o,!0),o!==r?Ei.set(a,o):s&&Ei.delete(a)}function h0(e){e._lexicalHandled=!0}function y0(e){return e._lexicalHandled===!0}var v0=()=>{};function WK(e){let t=ay.get(e);if(t===void 0)return void v0();let o=fm.get(t);if(o===void 0)return void v0();let n=o-1;n>=0||le(164),ay.delete(e),fm.set(t,n),n===0&&t.removeEventListener("selectionchange",DL);let r=xc(e);Mm(r)?((function(s){if(s._parentEditor!==null){let i=Gy(s),d=i[i.length-1]._key;Ei.get(d)===s&&Ei.delete(d)}else Ei.delete(s._key)})(r),e.__lexicalEditor=null):r&&le(198);let a=NL(e);for(let s=0;s<a.length;s++)a[s]();e.__lexicalEventHandles=[]}function ly(e,t,o){no();let n=e.__key,r=e.getParent();if(r===null)return;let a=(function(i){let d=Je();if(!Oe(d)||!re(i))return d;let{anchor:c,focus:u}=d,m=c.getNode(),p=u.getNode();return wm(m,i)&&c.set(i.__key,0,"element"),wm(p,i)&&u.set(i.__key,0,"element"),d})(e),s=!1;if(Oe(a)&&t){let i=a.anchor,d=a.focus;i.key===n&&(Cm(i,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0),d.key===n&&(Cm(d,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else vc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Oe(a)&&t&&!s){let i=e.getIndexWithinParent();la(e),vm(a,r,i,-1)}else la(e);o||pn(r)||r.canBeEmpty()||!r.isEmpty()||ly(r,t),t&&a&&lo(r)&&r.isEmpty()&&r.selectEnd()}function GK(e){return e}var _L=Symbol.for("ephemeral");function hm(e){return e[_L]||!1}var un=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Tc(this);return t===void 0&&le(64,this.name),t}static clone(t){le(65,this.name)}$config(){return{}}config(t,o){let n=o.extends||Object.getPrototypeOf(this.constructor);return Object.assign(o,{extends:n,type:t}),{[t]:o}}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(){le(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let o=Vt(t);if(o===null)break;t=o.__parent}return!1}isSelected(t){let o=t||Je();if(o==null)return!1;let n=o.getNodes().some(r=>r.__key===this.__key);if(ke(this))return n;if(Oe(o)&&o.anchor.type==="element"&&o.focus.type==="element"){if(o.isCollapsed())return!1;let r=this.getParent();if(yt(this)&&this.isInline()&&r){let a=o.isBackward()?o.focus:o.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let o=t.getFirstChild(),n=0;for(;o!==null;){if(this.is(o))return n;n++,o=o.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Vt(t)}getParentOrThrow(){let t=this.getParent();return t===null&&le(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let o=t.getParent();if(pn(o))return re(t)||t===this&&yt(t)||le(194),t;t=o}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&le(67,this.__key),t}getParents(){let t=[],o=this.getParent();for(;o!==null;)t.push(o),o=o.getParent();return t}getParentKeys(){let t=[],o=this.getParent();for(;o!==null;)t.push(o.__key),o=o.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Vt(t)}getPreviousSiblings(){let t=[],o=this.getParent();if(o===null)return t;let n=o.getFirstChild();for(;n!==null&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Vt(t)}getNextSiblings(){let t=[],o=this.getNextSibling();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getCommonAncestor(t){let o=re(this)?this:this.getParent(),n=re(t)?t:t.getParent(),r=o&&n?rc(o,n):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let o=rc(this,t);return o!==null&&(o.type==="descendant"||(o.type==="branch"?av(o)===-1:(o.type!=="same"&&o.type!=="ancestor"&&le(279),!1)))}isParentOf(t){let o=rc(this,t);return o!==null&&o.type==="ancestor"}getNodesBetween(t){let o=this.isBefore(t),n=[],r=new Set,a=this;for(;a!==null;){let s=a.__key;if(r.has(s)||(r.add(s),n.push(a)),a===t)break;let i=re(a)?o?a.getFirstChild():a.getLastChild():null;if(i!==null){a=i;continue}let d=o?a.getNextSibling():a.getPreviousSibling();if(d!==null){a=d;continue}let c=a.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===t)break;let u=null,m=c;do{if(m===null&&le(68),u=o?m.getNextSibling():m.getPreviousSibling(),m=m.getParent(),m===null)break;u!==null||r.has(m.__key)||n.push(m)}while(u===null);a=u}return o||n.reverse(),n}isDirty(){let t=mt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(hm(this))return this;let t=Vt(this.__key);return t===null&&le(113),t}getWritable(){if(hm(this))return this;no();let t=Er(),o=mt(),n=t._nodeMap,r=this.__key,a=this.getLatest(),s=o._cloneNotNeeded,i=Je();if(i!==null&&i.setCachedNodes(null),s.has(r))return bm(a),a;let d=ev(a);return s.add(r),bm(d),n.set(r,d),d}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,o){le(70)}updateDOM(t,o,n){le(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){le(18,this.name)}updateFromJSON(t){return(function(o,n){let r=o.getWritable(),a=n.$,s=a;for(let i of nL(r).flatKeys)i in n&&(s!==void 0&&s!==a||(s={...a}),s[i]=n[i]);return(r.__state||s)&&Ty(o).updateFromJSON(s),r})(this,t)}static transform(){return null}remove(t){ly(this,!0,t)}replace(t,o){no();let n=Je();n!==null&&(n=n.clone()),Uh(this,t);let r=this.getLatest(),a=this.__key,s=t.__key,i=t.getWritable(),d=this.getParentOrThrow().getWritable(),c=d.__size;la(i);let u=r.getPreviousSibling(),m=r.getNextSibling(),p=r.__prev,f=r.__next,g=r.__parent;if(ly(r,!1,!0),u===null?d.__first=s:u.getWritable().__next=s,i.__prev=p,m===null?d.__last=s:m.getWritable().__prev=s,i.__next=f,i.__parent=g,d.__size=c,o&&(re(this)&&re(i)||le(139),this.getChildren().forEach(h=>{i.append(h)})),Oe(n)){$o(n);let h=n.anchor,y=n.focus;h.key===a&&w0(h,i),y.key===a&&w0(y,i)}return sa()===a&&ro(s),i}insertAfter(t,o=!0){no(),Uh(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.getParent(),s=Je(),i=!1,d=!1;if(a!==null){let f=t.getIndexWithinParent();if(la(r),Oe(s)){let g=a.__key,h=s.anchor,y=s.focus;i=h.type==="element"&&h.key===g&&h.offset===f+1,d=y.type==="element"&&y.key===g&&y.offset===f+1}}let c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),m=r.__key,p=n.__next;if(c===null?u.__last=m:c.getWritable().__prev=m,u.__size++,n.__next=m,r.__next=p,r.__prev=n.__key,r.__parent=n.__parent,o&&Oe(s)){let f=this.getIndexWithinParent();vm(s,u,f+1);let g=u.__key;i&&s.anchor.set(g,f+2,"element"),d&&s.focus.set(g,f+2,"element")}return t}insertBefore(t,o=!0){no(),Uh(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.__key;la(r);let s=this.getPreviousSibling(),i=this.getParentOrThrow().getWritable(),d=n.__prev,c=this.getIndexWithinParent();s===null?i.__first=a:s.getWritable().__next=a,i.__size++,n.__prev=a,r.__prev=d,r.__next=n.__key,r.__parent=n.__parent;let u=Je();return o&&Oe(u)&&vm(u,this.getParentOrThrow(),c),t}isParentRequired(){return!1}createParentElementNode(){return Lr()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,o){no();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(re(n))return n.select();if(!ke(n)){let a=n.getIndexWithinParent()+1;return r.select(a,a)}return n.select(t,o)}selectNext(t,o){no();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(re(n))return n.select(0,0);if(!ke(n)){let a=n.getIndexWithinParent();return r.select(a,a)}return n.select(t,o)}markDirty(){this.getWritable()}reconcileObservedMutation(t,o){this.markDirty()}},jK="historic",VK="history-push",rm="history-merge",QK="paste",OL="collaboration",XK="skip-collab",FL="skip-scroll-into-view",BL="skip-dom-selection",dy="skip-selection-focus",HL="composition-start",UL="composition-end",Ai=class e extends un{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
|
|
3555
|
+
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(o){let n=o.parentElement;if(n!==null&&gy(n)){let r=n.firstChild;if(r===o||r.nextSibling===o&&Xp(r)){let a=n.lastChild;if(a===o||a.previousSibling===o&&Xp(a))return!0}}return!1})(t)||(function(o){let n=o.parentElement;if(n!==null&&gy(n)){let r=n.firstChild;if(r===o||r.nextSibling===o&&Xp(r))return!1;let a=n.lastChild;if(a===o||a.previousSibling===o&&Xp(a))return!0}return!1})(t)?null:{conversion:YK,priority:0}}}static importJSON(t){return Ni().updateFromJSON(t)}};function YK(e){return{node:Ni()}}function Ni(){return wc(new Ai)}function cs(e){return e instanceof Ai}function Xp(e){return nr(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function _h(e,t){return 16&t?"code":t&xy?"mark":32&t?"sub":64&t?"sup":null}function Oh(e,t){return 1&t?"strong":2&t?"em":"span"}function $L(e,t,o,n,r){let a=n.classList,s=Mi(r,"base");s!==void 0&&a.add(...s),s=Mi(r,"underlineStrikethrough");let i=!1,d=8&t&&4&t;s!==void 0&&(8&o&&4&o?(i=!0,d||a.add(...s)):d&&a.remove(...s));for(let c in xo){let u=xo[c];if(s=Mi(r,c),s!==void 0)if(o&u){if(i&&(c==="underline"||c==="strikethrough")){t&u&&a.remove(...s);continue}((t&u)===0||d&&c==="underline"||c==="strikethrough")&&a.add(...s)}else t&u&&a.remove(...s)}}function zL(e,t,o){let n=t.firstChild,r=o.isComposing(),a=e+(r?sc:"");if(n==null)t.textContent=a;else{let s=n.nodeValue;if(s!==a)if(r||da){let[i,d,c]=(function(u,m){let p=u.length,f=m.length,g=0,h=0;for(;g<p&&g<f&&u[g]===m[g];)g++;for(;h+g<p&&h+g<f&&u[p-h-1]===m[f-h-1];)h++;return[g,p-g-h,m.slice(g,f-h)]})(s,a);d!==0&&n.deleteData(i,d),n.insertData(i,c)}else n.nodeValue=a}}function C0(e,t,o,n,r,a){zL(r,e,t);let s=a.theme.text;s!==void 0&&$L(0,0,n,e,s)}function Yp(e,t){let o=document.createElement(t);return o.appendChild(e),o}var ms=class e extends un{__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="",o){super(o),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 vK[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===sa()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let o=xo[t];return(this.getFormat()&o)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,o){return gc(this.getLatest().__format,t,o)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,o){let n=this.__format,r=_h(0,n),a=Oh(0,n),s=r===null?a:r,i=document.createElement(s),d=i;this.hasFormat("code")&&i.setAttribute("spellcheck","false"),r!==null&&(d=document.createElement(a),i.appendChild(d)),C0(d,this,0,n,this.__text,t);let c=this.__style;return c!==""&&(i.style.cssText=c),i}updateDOM(t,o,n){let r=this.__text,a=t.__format,s=this.__format,i=_h(0,a),d=_h(0,s),c=Oh(0,a),u=Oh(0,s);if((i===null?c:i)!==(d===null?u:d))return!0;if(i===d&&c!==u){let h=o.firstChild;h==null&&le(48);let y=document.createElement(u);return C0(y,this,0,s,r,n),o.replaceChild(y,h),!1}let m=o;d!==null&&i!==null&&(m=o.firstChild,m==null&&le(49)),zL(r,m,this);let p=n.theme.text;p!==void 0&&a!==s&&$L(0,a,s,m,p);let f=t.__style,g=this.__style;return f!==g&&(o.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:t5,priority:0}),b:()=>({conversion:ZK,priority:0}),code:()=>({conversion:wr,priority:0}),em:()=>({conversion:wr,priority:0}),i:()=>({conversion:wr,priority:0}),mark:()=>({conversion:wr,priority:0}),s:()=>({conversion:wr,priority:0}),span:()=>({conversion:JK,priority:0}),strong:()=>({conversion:wr,priority:0}),sub:()=>({conversion:wr,priority:0}),sup:()=>({conversion:wr,priority:0}),u:()=>({conversion:wr,priority:0})}}static importJSON(t){return oo().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:o}=super.exportDOM(t);return ko(o)||le(132),o.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?o.style.textTransform="lowercase":this.hasFormat("uppercase")?o.style.textTransform="uppercase":this.hasFormat("capitalize")&&(o.style.textTransform="capitalize"),this.hasFormat("bold")&&(o=Yp(o,"b")),this.hasFormat("italic")&&(o=Yp(o,"i")),this.hasFormat("strikethrough")&&(o=Yp(o,"s")),this.hasFormat("underline")&&(o=Yp(o,"u")),{element:o}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,o){}setFormat(t){let o=this.getWritable();return o.__format=typeof t=="string"?xo[t]:t,o}setDetail(t){let o=this.getWritable();return o.__detail=typeof t=="string"?gK[t]:t,o}setStyle(t){let o=this.getWritable();return o.__style=t,o}toggleFormat(t){let o=gc(this.getFormat(),t,null);return this.setFormat(o)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let o=yK[t];if(this.__mode===o)return this;let n=this.getWritable();return n.__mode=o,n}setTextContent(t){if(this.__text===t)return this;let o=this.getWritable();return o.__text=t,o}select(t,o){no();let n=t,r=o,a=Je(),s=this.getTextContent(),i=this.__key;if(typeof s=="string"){let d=s.length;n===void 0&&(n=d),r===void 0&&(r=d)}else n=0,r=0;if(!Oe(a))return WL(i,n,i,r,"text","text");{let d=sa();d!==a.anchor.key&&d!==a.focus.key||ro(i),a.setTextNodeRange(this,n,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,o,n,r){let a=this.getWritable(),s=a.__text,i=n.length,d=t;d<0&&(d=i+d,d<0&&(d=0));let c=Je();if(r&&Oe(c)){let m=t+i;c.setTextNodeRange(a,m,a,m)}let u=s.slice(0,d)+n+s.slice(d+o);return a.__text=u,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){no();let o=this.getLatest(),n=o.getTextContent();if(n==="")return[];let r=o.__key,a=sa(),s=n.length;t.sort((T,S)=>T-S),t.push(s);let i=[],d=t.length;for(let T=0,S=0;T<s&&S<=d;S++){let P=t[S];P>T&&(i.push(n.slice(T,P)),T=P)}let c=i.length;if(c===1)return[o];let u=i[0],m=o.getParent(),p,f=o.getFormat(),g=o.getStyle(),h=o.__detail,y=!1,x=null,C=null,b=Je();if(Oe(b)){let[T,S]=b.isBackward()?[b.focus,b.anchor]:[b.anchor,b.focus];T.type==="text"&&T.key===r&&(x=T),S.type==="text"&&S.key===r&&(C=S)}o.isSegmented()?(p=oo(u),p.__format=f,p.__style=g,p.__detail=h,p.__state=i0(o,p),y=!0):p=o.setTextContent(u);let L=[p];for(let T=1;T<c;T++){let S=oo(i[T]);S.__format=f,S.__style=g,S.__detail=h,S.__state=i0(o,S);let P=S.__key;a===r&&ro(P),L.push(S)}let w=x?x.offset:null,k=C?C.offset:null,I=0;for(let T of L){if(!x&&!C)break;let S=I+T.getTextContentSize();if(x!==null&&w!==null&&w<=S&&w>=I&&(x.set(T.getKey(),w-I,"text"),w<S&&(x=null)),C!==null&&k!==null&&k<=S&&k>=I){C.set(T.getKey(),k-I,"text");break}I=S}if(m!==null){(function(P){let A=P.getPreviousSibling(),N=P.getNextSibling();A!==null&&bm(A),N!==null&&bm(N)})(this);let T=m.getWritable(),S=this.getIndexWithinParent();y?(T.splice(S,0,L),this.remove()):T.splice(S,1,L),Oe(b)&&vm(b,m,S,c-1)}return L}mergeWithSibling(t){let o=t===this.getPreviousSibling();o||t===this.getNextSibling()||le(50);let n=this.__key,r=t.__key,a=this.__text,s=a.length;sa()===r&&ro(n);let i=Je();if(Oe(i)){let m=i.anchor,p=i.focus;m!==null&&m.key===r&&R0(m,o,n,t,s),p!==null&&p.key===r&&R0(p,o,n,t,s)}let d=t.__text,c=o?d+a:a+d;this.setTextContent(c);let u=this.getWritable();return t.remove(),u}isTextEntity(){return!1}};function JK(e){return{forChild:_y(e.style),node:null}}function ZK(e){let t=e,o=t.style.fontWeight==="normal";return{forChild:_y(t.style,o?void 0:"bold"),node:null}}var x0=new WeakMap;function e5(e){if(!ko(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function t5(e){let t=e;e.parentElement===null&&le(129);let o=t.textContent||"";if((function(n){let r,a=n.parentNode,s=[n];for(;a!==null&&(r=x0.get(a))===void 0&&!e5(a);)s.push(a),a=a.parentNode;let i=r===void 0?a:r;for(let d=0;d<s.length;d++)x0.set(s[d],i);return i})(t)!==null){let n=o.split(/(\r?\n|\t)/),r=[],a=n.length;for(let s=0;s<a;s++){let i=n[s];i===`
|
|
3573
3556
|
`||i===`\r
|
|
3574
|
-
`?r.push(
|
|
3575
|
-
`),u=!p.isEmpty();else if(u=!1,ke(p)){let f=p.getTextContent();p===o?p===n?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(f=i<d?f.slice(i,d):f.slice(d,i)):f=s?f.slice(i):f.slice(d):p===n&&(f=s?f.slice(0,d):f.slice(0,i)),c+=f}else!yt(p)&&!
|
|
3557
|
+
`?r.push(Ni()):i===" "?r.push(Pm()):i!==""&&r.push(oo(i))}return{node:r}}if(o=o.replace(/\r/g,"").replace(/[ \t\n]+/g," "),o==="")return{node:null};if(o[0]===" "){let n=t,r=!0;for(;n!==null&&(n=b0(n,!1))!==null;){let a=n.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(o=o.slice(1)),r=!1;break}}r&&(o=o.slice(1))}if(o[o.length-1]===" "){let n=t,r=!0;for(;n!==null&&(n=b0(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(o=o.slice(0,o.length-1))}return o===""?{node:null}:{node:oo(o)}}function b0(e,t){let o=e;for(;;){let n;for(;(n=t?o.nextSibling:o.previousSibling)===null;){let a=o.parentElement;if(a===null)return null;o=a}if(o=n,ko(o)){let a=o.style.display;if(a===""&&!CP(o)||a!==""&&!a.startsWith("inline"))return null}let r=o;for(;(r=t?o.firstChild:o.lastChild)!==null;)o=r;if(nr(o))return o;if(o.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 wr(e){let t=o5[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:_y(e.style,t),node:null}}function oo(e=""){return wc(new ms(e))}function ke(e){return e instanceof ms}function _y(e,t){let o=e.fontWeight,n=e.textDecoration.split(" "),r=o==="700"||o==="bold",a=n.includes("line-through"),s=e.fontStyle==="italic",i=n.includes("underline"),d=e.verticalAlign;return c=>(ke(c)&&(r&&!c.hasFormat("bold")&&c.toggleFormat("bold"),a&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),i&&!c.hasFormat("underline")&&c.toggleFormat("underline"),d!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),d!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),t&&!c.hasFormat(t)&&c.toggleFormat(t)),c)}var Di=class e extends ms{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 o=super.createDOM(t),n=Mi(t.theme,"tab");return n!==void 0&&o.classList.add(...n),o}static importJSON(t){return Pm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&V0(126),super.setTextContent(" ")}spliceText(t,o,n,r){return n===""&&o===0||n===" "&&o===1||le(286),this}setDetail(t){return t!==2&&le(127),this}setMode(t){return t!=="normal"&&le(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Pm(){return wc(new Di)}function Oy(e){return e instanceof Di}var cy=class{key;offset;type;_selection;constructor(t,o,n){this._selection=null,this.key=t,this.offset=o,this.type=n}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:rv(Sn(fa(this,"next")),Sn(fa(t,"next")))<0}getNode(){let t=Vt(this.key);return t===null&&le(20),t}set(t,o,n,r){let a=this._selection,s=this.key;r&&this.key===t&&this.offset===o&&this.type===n||(this.key=t,this.offset=o,this.type=n,Ki()||(sa()===s&&ro(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Rn(e,t,o){return new cy(e,t,o)}function Fh(e,t){let o=t.__key,n=e.offset,r="element";if(ke(t)){r="text";let a=t.getTextContentSize();n>a&&(n=a)}else if(!re(t)){let a=t.getNextSibling();if(ke(a))o=a.__key,n=0,r="text";else{let s=t.getParent();s&&(o=s.__key,n=t.getIndexWithinParent()+1)}}e.set(o,n,r)}function w0(e,t){if(re(t)){let o=t.getLastDescendant();re(o)||ke(o)?Fh(e,o):Fh(e,t)}else Fh(e,t)}var ym=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(!vc(t))return!1;let o=this._nodes,n=t._nodes;return o.size===n.size&&Array.from(o).every(r=>n.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 o=this.getNodes(),n=o.length,r=o[n-1],a;if(ke(r))a=r.select();else{let s=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(s,s)}a.insertNodes(t);for(let s=0;s<n;s++)o[s].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let o=this._nodes,n=[];for(let r of o){let a=Vt(r);a!==null&&n.push(a)}return Ki()||(this._cachedNodes=n),n}getTextContent(){let t=this.getNodes(),o="";for(let n=0;n<t.length;n++)o+=t[n].getTextContent();return o}deleteNodes(){let t=this.getNodes();if((Je()||ys())===this&&t[0]){let o=io(t[0],"next");IP(ma(o,o))}for(let o of t)o.remove()}};function Oe(e){return e instanceof fs}var fs=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,o,n,r){this.anchor=t,this.focus=o,t._selection=this,o._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Oe(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 o=(function(n){let r=[],[a,s]=n.getTextSlices();a&&r.push(a.caret.origin);let i=new Set,d=new Set;for(let c of n)if(Ln(c)){let{origin:u}=c;r.length===0?i.add(u):(d.add(u),r.push(u))}else{let{origin:u}=c;re(u)&&d.has(u)||r.push(u)}if(s&&r.push(s.caret.origin),hs(n.focus)&&re(n.focus.origin)&&n.focus.getNodeAtCaret()===null)for(let c=Rr(n.focus.origin,"previous");Ln(c)&&i.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(r[r.length-1]);c=$i(c))i.delete(c.origin),r.pop();for(;r.length>1;){let c=r[r.length-1];if(!re(c)||d.has(c)||c.isEmpty()||i.has(c))break;r.pop()}if(r.length===0&&n.isCollapsed()){let c=Sn(n.anchor),u=Sn(n.anchor.getFlipped()),m=f=>Pr(f)?f.origin:f.getNodeAtCaret(),p=m(c)||m(u)||(n.anchor.getNodeAtCaret()?c.origin:u.origin);r.push(p)}return r})(sv(Cy(this),"next"));return Ki()||(this._cachedNodes=o),o}setTextNodeRange(t,o,n,r){this.anchor.set(t.__key,o,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let o=t[0],n=t[t.length-1],r=this.anchor,a=this.focus,s=r.isBefore(a),[i,d]=uy(this),c="",u=!0;for(let m=0;m<t.length;m++){let p=t[m];if(re(p)&&!p.isInline())u||(c+=`
|
|
3558
|
+
`),u=!p.isEmpty();else if(u=!1,ke(p)){let f=p.getTextContent();p===o?p===n?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(f=i<d?f.slice(i,d):f.slice(d,i)):f=s?f.slice(i):f.slice(d):p===n&&(f=s?f.slice(0,d):f.slice(0,i)),c+=f}else!yt(p)&&!cs(p)||p===n&&this.isCollapsed()||(c+=p.getTextContent())}return c}applyDOMRange(t){let o=mt(),n=o.getEditorState()._selection,r=qL(t.startContainer,t.startOffset,t.endContainer,t.endOffset,o,n);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),lm(this)}clone(){let t=this.anchor,o=this.focus;return new e(Rn(t.key,t.offset,t.type),Rn(o.key,o.offset,o.type),this.format,this.style)}toggleFormat(t){this.format=gc(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let o=xo[t];return(this.format&o)!==0}insertRawText(t){let o=t.split(/(\r?\n|\t)/),n=[],r=o.length;for(let a=0;a<r;a++){let s=o[a];s===`
|
|
3576
3559
|
`||s===`\r
|
|
3577
|
-
`?n.push(Oi()):s===" "?n.push(Nm()):n.push(oo(s))}this.insertNodes(n)}insertText(t){let o=this.anchor,n=this.focus,r=this.format,a=this.style,s=o,i=n;!this.isCollapsed()&&n.isBefore(o)&&(s=n,i=o),s.type==="element"&&(function(y,x,C,b){let L=y.getNode(),w=L.getChildAtIndex(y.offset),k=oo();if(k.setFormat(C),k.setStyle(b),XL(w))w.splice(0,0,[k]);else{let I=lo(L)?Pr().append(k):k;w===null?L.append(I):w.insertBefore(I)}y.is(x)&&x.set(k.__key,0,"text"),y.set(k.__key,0,"text")})(s,i,r,a),i.type==="element"&&Wi(i,En(va(i,"next")));let d=s.offset,c=i.offset,u=this.getNodes(),m=u.length,p=u[0];ke(p)||ie(26);let f=p.getTextContent().length,g=p.getParentOrThrow(),h=u[m-1];if(m===1&&i.type==="element"&&(c=f,i.set(s.key,c,"text")),this.isCollapsed()&&d===f&&(kr(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let y=p.getNextSibling();if(ke(y)&&y.canInsertTextBefore()&&!kr(y)||(y=oo(),y.setFormat(r),y.setStyle(a),g.canInsertTextAfter()?p.insertAfter(y):g.insertAfter(y)),y.select(0,0),p=y,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&d===0&&(kr(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let y=p.getPreviousSibling();if(ke(y)&&!kr(y)||(y=oo(),y.setFormat(r),g.canInsertTextBefore()?p.insertBefore(y):g.insertBefore(y)),y.select(),p=y,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&d!==f){let y=oo(p.getTextContent());y.setFormat(r),p.replace(y),p=y}else if(!this.isCollapsed()&&t!==""){let y=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||ae(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),UL(this.anchor,this.focus),void this.insertText(t)}if(m===1){if(ua(p)){let b=oo(t);return b.select(),void p.replace(b)}let y=p.getFormat(),x=p.getStyle();if(d!==c||y===r&&x===a){if(Uy(p)){let b=oo(t);return b.setFormat(r),b.setStyle(a),b.select(),void p.replace(b)}}else{if(p.getTextContent()!==""){let b=oo(t);if(b.setFormat(r),b.setStyle(a),b.select(),d===0)p.insertBefore(b,!1);else{let[L]=p.splitText(d);L.insertAfter(b,!1)}return void(b.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let C=c-d;p=p.spliceText(d,C,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=y,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let y=new Set([...p.getParentKeys(),...h.getParentKeys()]),x=ae(p)?p:p.getParentOrThrow(),C=ae(h)?h:h.getParentOrThrow(),b=h;if(!x.is(C)&&C.isInline())do b=C,C=C.getParentOrThrow();while(C.isInline());if(i.type==="text"&&(c!==0||h.getTextContent()==="")||i.type==="element"&&h.getIndexWithinParent()<c)if(ke(h)&&!ua(h)&&c!==h.getTextContentSize()){if(h.isSegmented()){let T=oo(h.getTextContent());h.replace(T),h=T}lo(i.getNode())||i.type!=="text"||(h=h.spliceText(0,c,"")),y.add(h.__key)}else{let T=h.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?h.remove():T.remove()}else y.add(h.__key);let L=C.getChildren(),w=new Set(u),k=x.is(C),I=x.isInline()&&p.getNextSibling()===null?x:p;for(let T=L.length-1;T>=0;T--){let S=L[T];if(S.is(p)||ae(S)&&S.isParentOf(p))break;S.isAttached()&&(!w.has(S)||S.is(b)?k||I.insertAfter(S,!1):S.remove())}if(!k){let T=C,S=null;for(;T!==null;){let R=T.getChildren(),A=R.length;(A===0||R[A-1].is(S))&&(y.delete(T.__key),S=T),T=T.getParent()}}if(ua(p))if(d===f)p.select();else{let T=oo(t);T.select(),p.replace(T)}else p=p.spliceText(d,f-d,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 T=1;T<m;T++){let S=u[T],R=S.__key;y.has(R)||S.remove()}}}removeText(){let t=Je()===this;ic(this,wR(Ty(this))),t&&Je()!==this&&qo(this)}formatText(t,o=null){if(this.isCollapsed())return this.toggleFormat(t),void ro(null);let n=this.getNodes(),r=[];for(let L of n)ke(L)&&r.push(L);let a=L=>{n.forEach(w=>{if(ae(w)){let k=w.getFormatFlags(t,L);w.setTextFormat(k)}})},s=r.length;if(s===0)return this.toggleFormat(t),ro(null),void a(o);let i=this.anchor,d=this.focus,c=this.isBackward(),u=c?d:i,m=c?i:d,p=0,f=r[0],g=u.type==="element"?0:u.offset;if(u.type==="text"&&g===f.getTextContentSize()&&(p=1,f=r[1],g=0),f==null)return;let h=f.getFormatFlags(t,o);a(h);let y=s-1,x=r[y],C=m.type==="text"?m.offset:x.getTextContentSize();if(f.is(x)){if(g===C)return;if(kr(f)||g===0&&C===f.getTextContentSize())f.setFormat(h);else{let L=f.splitText(g,C),w=g===0?L[0]:L[1];w.setFormat(h),u.type==="text"&&u.set(w.__key,0,"text"),m.type==="text"&&m.set(w.__key,C-g,"text")}return void(this.format=h)}g===0||kr(f)||([,f]=f.splitText(g),g=0),f.setFormat(h);let b=x.getFormatFlags(t,h);C>0&&(C===x.getTextContentSize()||kr(x)||([x]=x.splitText(C)),x.setFormat(b));for(let L=p+1;L<y;L++){let w=r[L],k=w.getFormatFlags(t,b);w.setFormat(k)}u.type==="text"&&u.set(f.__key,g,"text"),m.type==="text"&&m.set(x.__key,C,"text"),this.format=h|b}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=Je();return Oe(g)||ie(134),g.insertNodes(t)}let o=(this.isBackward()?this.focus:this.anchor).getNode(),n=ac(o,Rr),r=t[t.length-1];if(ae(n)&&"__language"in n){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=zh(this);n.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(ae(g)||yt(g))&&!g.isInline())){ae(n)||ie(211,o.constructor.name,o.getType());let g=zh(this);return n.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=Pr(),y=null;for(let x=0;x<g.length;x++){let C=g[x],b=fs(C);if(b||yt(C)&&C.isInline()||ae(C)&&C.isInline()||ke(C)||C.isParentRequired()){if(y===null&&(y=C.createParentElementNode(),h.append(y),b))continue;y!==null&&y.append(C)}else h.append(C),y=null}return h})(t),s=a.getLastDescendant(),i=a.getChildren(),d=!ae(n)||!n.isEmpty()?this.insertParagraph():null,c=i[i.length-1],u=i[0];var m;ae(m=u)&&Rr(m)&&!m.isEmpty()&&ae(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(ae(n)||ie(211,o.constructor.name,o.getType()),n.append(...u.getChildren()),u=i[1]),u&&(n===null&&ie(212,o.constructor.name,o.getType()),(function(g,h){let y=h.getParentOrThrow().getLastChild(),x=h,C=[h];for(;x!==y;)x.getNextSibling()||ie(140),x=x.getNextSibling(),C.push(x);let b=g;for(let L of C)b=b.insertAfter(L)})(n,u));let p=ac(s,Rr);d&&ae(p)&&(d.canMergeWhenEmpty()||Rr(c))&&(p.append(...d.getChildren()),d.remove()),ae(n)&&n.isEmpty()&&n.remove(),s.selectEnd();let f=ae(n)?n.getLastChild():null;fs(f)&&p!==n&&f.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Pr();return Zo().splice(this.anchor.offset,0,[s]),s.select(),s}let t=zh(this),o=ac(this.anchor.getNode(),Rr);ae(o)||ie(213);let n=o.getChildAtIndex(t),r=n?[n,...n.getNextSiblings()]:[],a=o.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let o=Oi();if(this.insertNodes([o]),t){let n=o.getParentOrThrow(),r=o.getIndexWithinParent();n.select(r,r)}}extract(){let t=[...this.getNodes()],o=t.length,n=t[0],r=t[o-1],[a,s]=gy(this),i=this.isBackward(),[d,c]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[u,m]=i?[s,a]:[a,s];if(o===0)return[];if(o===1){if(ke(n)&&!this.isCollapsed()){let p=n.splitText(u,m),f=u===0?p[0]:p[1];return f?(d.set(f.getKey(),0,"text"),c.set(f.getKey(),f.getTextContentSize(),"text"),[f]):[]}return[n]}if(ke(n)&&(u===n.getTextContentSize()?t.shift():u!==0&&([,n]=n.splitText(u),t[0]=n,d.set(n.getKey(),0,"text"))),ke(r)){let p=r.getTextContent().length;m===0?t.pop():m!==p&&([r]=r.splitText(m),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,o,n){if(Rk(this,t,o,n))return;let r=t==="move",a=mt(),s=On(en(a));if(!s)return;let i=a._blockCursorElement,d=a._rootElement,c=this.focus.getNode();if(d===null||i===null||!ae(c)||c.isInline()||c.canBeEmpty()||vy(i,a,d),this.dirty){let u=Ui(a,this.anchor.key),m=Ui(a,this.focus.key);this.anchor.type==="text"&&(u=Cs(u)),this.focus.type==="text"&&(m=Cs(m)),u&&m&&qL(s,u,this.anchor.offset,m,this.focus.offset)}if((function(u,m,p,f){u.modify(m,p,f)})(s,t,o?"backward":"forward",n),s.rangeCount>0){let u=s.getRangeAt(0),m=this.anchor.getNode(),p=lo(m)?m:pR(m);if(this.applyDOMRange(u),this.dirty=!0,!r){let f=this.getNodes(),g=[],h=!1;for(let y=0;y<f.length;y++){let x=f[y];Lm(x,p)?g.push(x):h=!0}if(h&&g.length>0)if(o){let y=g[0];ae(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{let y=g[g.length-1];ae(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||(function(y){let x=y.focus,C=y.anchor,b=C.key,L=C.offset,w=C.type;C.set(x.key,x.offset,x.type,!0),x.set(b,L,w,!0)})(this)}}n==="lineboundary"&&Rk(this,t,o,n,"decorators")}forwardDeletion(t,o,n){if(!n&&(t.type==="element"&&ae(o)&&t.offset===o.getChildrenSize()||t.type==="text"&&t.offset===o.getTextContentSize())){let r=o.getParent(),a=o.getNextSibling()||(r===null?null:r.getNextSibling());if(ae(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let o=this.isCollapsed();if(this.isCollapsed()){let n=this.anchor,r=n.getNode();if(this.forwardDeletion(n,r,t))return;let a=sv(va(n,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let d of a.iterNodeCarets("shadowRoot"))if(An(d)){if(!d.origin.isInline()){if(d.origin.isShadowRoot()){if(i.type==="merge-block")break;if(ae(a.anchor.origin)&&a.anchor.origin.isEmpty()){let c=En(d);ic(this,ya(c,c)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:d,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(xs(d)){if(ae(d.origin)){if(d.origin.isInline()){if(!d.origin.isParentOf(a.anchor.origin))break}else i={block:d.origin,type:"merge-next-block"};continue}if(yt(d.origin)){if(!d.origin.isIsolated())if(i.type==="merge-next-block"&&(d.origin.isKeyboardSelectable()||!d.origin.isInline())&&ae(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let c=$y();c.add(d.origin.getKey()),qo(c)}else d.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:d,block:c}=i;return ic(this,ya(!d.origin.isEmpty()&&c.isEmpty()?Vi(io(c,d.direction)):a.anchor,d)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&n.offset===0&&bk(this,n.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=n.type==="text"?n.getNode():null,i!==null&&i.isSegmented()){let d=s.offset,c=i.getTextContentSize();if(i.is(r)||t&&d!==c||!t&&d!==0)return void wk(i,t,d)}else if(r!==null&&r.isSegmented()){let d=n.offset,c=r.getTextContentSize();if(r.is(i)||t&&d!==0||!t&&d!==c)return void wk(r,t,d)}(function(d,c){let u=d.anchor,m=d.focus,p=u.getNode(),f=m.getNode();if(p===f&&u.type==="text"&&m.type==="text"){let g=u.offset,h=m.offset,y=g<h,x=y?g:h,C=y?h:g,b=C-1;x!==b&&(function(L){return!(aR(L)||QK(L))})(p.getTextContent().slice(x,C))&&(c?m.set(m.key,b,m.type):u.set(u.key,b,u.type))}})(this,t)}}if(this.removeText(),t&&!o&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let n=this.anchor.getNode();n.isEmpty()&&lo(n.getParent())&&n.getPreviousSibling()===null&&bk(this,n)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let o=this.anchor,n=o.getNode();if(this.forwardDeletion(o,n,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function xc(e){return e instanceof wm}function xk(e){let t=e.offset;if(e.type==="text")return t;let o=e.getNode();return t===o.getChildrenSize()?o.getTextContent().length:0}function gy(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[o,n]=t;return o.type==="element"&&n.type==="element"&&o.key===n.key&&o.offset===n.offset?[0,0]:[xk(o),xk(n)]}function bk(e,t){for(let o=t;o;o=o.getParent()){if(ae(o)){if(o.collapseAtStart(e))return!0;if(gn(o))break}if(o.getPreviousSibling())break}return!1}var QK=(()=>{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 wk(e,t,o){let n=e,r=n.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let c=0;c<a;c++){let u=c===a-1;if(i=s,s+=r[c].length,t&&s===o||s>o||u){r.splice(c,1),u&&(i=void 0);break}}let d=r.join("").trim();d===""?n.remove():(n.setTextContent(d),n.select(i,i))}function Tk(e,t,o,n){let r,a=t;if(Ro(e)){let s=!1,i=e.childNodes,d=i.length,c=n._blockCursorElement;a===d&&(s=!0,a=d-1);let u=i[a],m=!1;if(u===c)u=i[a+1],m=!0;else if(c!==null){let p=c.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,c)&&a--}if(r=Mi(u),ke(r))a=Nn(r,s?"next":"previous");else{let p=Mi(e);if(p===null)return null;if(ae(p)){let f=n.getElementByKey(p.getKey());f===null&&ie(214),[p,a]=p.getDOMSlot(f).resolveChildIndex(p,f,e,t),ae(p)||ie(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(ae(h)&&(function(y,x,C){let b=y.getParent();return C===null||b===null||!b.canBeEmpty()||b!==C.getNode()})(h,0,o)){let y=s?h.getLastDescendant():h.getFirstDescendant();y===null?p=h:(h=y,p=ae(h)?h:h.getParentOrThrow()),a=0}ke(h)?(r=h,p=null,a=Nn(h,s?"next":"previous")):h!==p&&s&&!m&&(ae(p)||ie(216),a=Math.min(p.getChildrenSize(),a+1))}else{let f=p.getIndexWithinParent();a=t===0&&yt(p)&&Mi(e)===p?f:f+1,p=p.getParentOrThrow()}if(ae(p))return Dn(p.__key,a,"element")}}else r=Mi(e);return ke(r)?Dn(r.__key,Nn(r,a,"clamp"),"text"):null}function Ik(e,t,o){let n=e.offset,r=e.getNode();if(n===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((o||!t)&&a===null&&ae(s)&&s.isInline()){let i=s.getPreviousSibling();ke(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else ae(a)&&!o&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):ke(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(n===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&ae(a)&&a.isInline())e.set(a.__key,0,"element");else if((o||t)&&a===null&&ae(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();ke(i)&&e.set(i.__key,0,"text")}}}function UL(e,t,o){if(e.type==="text"&&t.type==="text"){let n=e.isBefore(t),r=e.is(t);Ik(e,n,r),Ik(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function $L(e,t,o,n,r,a){if(e===null||o===null||!bc(r,e,o))return null;let s=Tk(e,t,Oe(a)?a.anchor:null,r);if(s===null)return null;let i=Tk(o,n,Oe(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let d=Mi(e),c=Mi(o);if(yt(d)&&yt(c))return null}return UL(s,i),[s,i]}function XK(e){return ae(e)&&!e.isInline()}function zL(e,t,o,n,r,a){let s=Ar(),i=new vs(Dn(e,t,r),Dn(o,n,a),0,"");return i.dirty=!0,s._selection=i,i}function KL(){let e=Dn("root",0,"element"),t=Dn("root",0,"element");return new vs(e,t,0,"")}function $y(){return new wm(new Set)}function YK(e,t){return Dm(null,e,t,null)}function Dm(e,t,o,n){let r=o._window;if(r===null)return null;let a=n||r.event,s=a?a.type:void 0,i=s==="selectionchange",d=!Qh&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),c,u,m,p;if(Oe(e)&&!d)return e.clone();if(t===null)return null;if(c=t.anchorNode,u=t.focusNode,m=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&Oe(e)&&!bc(o,c,u))return e.clone();let f=$L(c,m,u,p,o,e);if(f===null)return null;let[g,h]=f,y=0,x="";if(Oe(e)){let C=e.anchor;if(g.key===C.key)y=e.format,x=e.style;else{let b=g.getNode();ke(b)?(y=b.getFormat(),x=b.getStyle()):ae(b)&&(y=b.getTextFormat(),x=b.getTextStyle())}}return new vs(g,h,y,x)}function Je(){return Ar()._selection}function bs(){return mt()._editorState._selection}function Tm(e,t,o,n=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))return;let d=t.__key;if(e.isCollapsed()){let c=r.offset;if(o<=c&&n>0||o<c&&n<0){let u=Math.max(0,c+n);r.set(d,u,"element"),a.set(d,u,"element"),Sk(e)}}else{let c=e.isBackward(),u=c?a:r,m=u.getNode(),p=c?r:a,f=p.getNode();if(t.is(m)){let g=u.offset;(o<=g&&n>0||o<g&&n<0)&&u.set(d,Math.max(0,g+n),"element")}if(t.is(f)){let g=p.offset;(o<=g&&n>0||o<g&&n<0)&&p.set(d,Math.max(0,g+n),"element")}}Sk(e)}function Sk(e){let t=e.anchor,o=t.offset,n=e.focus,r=n.offset,a=t.getNode(),s=n.getNode();if(e.isCollapsed()){if(!ae(a))return;let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text"),n.set(c.__key,u,"text")}return}if(ae(a)){let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text")}}if(ae(s)){let i=s.getChildrenSize(),d=r>=i,c=d?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),n.set(c.__key,u,"text")}}}function Im(e,t,o,n,r){let a=null,s=0,i=null;n!==null?(a=n.__key,ke(n)?(s=n.getTextContentSize(),i="text"):ae(n)&&(s=n.getChildrenSize(),i="element")):r!==null&&(a=r.__key,ke(r)?i="text":ae(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=o.getChildrenSize()),e.set(o.__key,s,"element"))}function kk(e,t,o,n,r){e.type==="text"?e.set(o,e.offset+(t?0:r),"text"):e.offset>n.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function qL(e,t,o,n,r){try{e.setBaseAndExtent(t,o,n,r)}catch{}}function Lk(e,t,o){let n=Ui(e,t.getKey());if(ae(t)){let r=t.getDOMSlot(n);return[r.element,o+r.getFirstChildOffset()]}return[n,o]}function JK(e,t,o,n,r,a,s){let i=n.anchorNode,d=n.focusNode,c=n.anchorOffset,u=n.focusOffset,m=document.activeElement;if(r.has(NL)&&m!==a||m!==null&&jy(m))return;if(!Oe(t))return void(e!==null&&bc(o,i,d)&&n.removeAllRanges());let p=t.anchor,f=t.focus,g=p.getNode(),h=f.getNode(),[y,x]=Lk(o,g,p.offset),[C,b]=Lk(o,h,f.offset),L=t.format,w=t.style,k=t.isCollapsed(),I=y,T=C,S=!1;var R,A,N,B,O;if(p.type==="text"?(I=Cs(y),S=g.getFormat()!==L||g.getStyle()!==w):Oe(e)&&e.anchor.type==="text"&&(S=!0),f.type==="text"&&(T=Cs(C)),I!==null&&T!==null&&(k&&(e===null||S||Oe(e)&&(e.format!==L||e.style!==w))&&(R=L,A=w,N=x,B=p.key,O=performance.now(),kL=[R,A,N,B,O]),c!==x||u!==b||i!==I||d!==T||n.type==="Range"&&k||(m!==null&&a.contains(m)||r.has(my)||a.focus({preventScroll:!0}),p.type==="element"))){if(qL(n,I,x,T,b),!ma||!t.isCollapsed()||a===null||r.has(my)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(DL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let V=Oe(t)&&t.anchor.type==="element"?I.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(V!==null){let U;if(V instanceof Text){let D=document.createRange();D.selectNode(V),U=D.getBoundingClientRect()}else U=V.getBoundingClientRect();(function(D,X,j){let E=ev(j),Y=tv(E);if(E===null||Y===null)return;let{top:F,bottom:Z}=X,J=0,ne=0,te=j;for(;te!==null;){let le=te===E.body;if(le)J=0,ne=en(D).innerHeight;else{let re=te.getBoundingClientRect();J=re.top,ne=re.bottom}let ge=0;if(F<J?ge=-(J-F):Z>ne&&(ge=Z-ne),ge!==0)if(le)Y.scrollBy(0,ge);else{let re=te.scrollTop;te.scrollTop+=ge;let ee=te.scrollTop-re;F-=ee,Z-=ee}if(le)break;te=Tc(te)}})(o,U,a)}}cy=!0}}function ZK(e){let t=Je()||bs();t===null&&(t=Zo().selectEnd()),t.insertNodes(e)}function e5(){let e=Je();return e===null?"":e.getTextContent()}function zh(e){let t=e;e.isCollapsed()||t.removeText();let o=Je();Oe(o)&&(t=o),Oe(t)||ie(161);let n=t.anchor,r=n.getNode(),a=n.offset;for(;!Rr(r);){let s=r;if([r,a]=t5(r,a),s.is(r))break}return a}function t5(e,t){let o=e.getParent();if(!o){let r=Pr();return Zo().append(r),r.select(),[Zo(),0]}if(ke(e)){let r=e.splitText(t);if(r.length===0)return[o,e.getIndexWithinParent()];let a=t===0?0:1;return[o,r[0].getIndexWithinParent()+a]}if(!ae(e)||t===0)return[o,e.getIndexWithinParent()];let n=e.getChildAtIndex(t);if(n){let r=new vs(Dn(e.__key,t,"element"),Dn(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(n,...n.getNextSiblings())}return[o,e.getIndexWithinParent()+1]}function Rk(e,t,o,n,r="decorators-and-blocks"){if(t==="move"&&n==="character"&&!e.isCollapsed()){let[u,m]=o===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return m.set(u.key,u.offset,u.type),!0}let a=va(e.focus,o?"previous":"next"),s=n==="lineboundary",i=t==="move",d=a,c=r==="decorators-and-blocks";if(!TR(d)){for(let u of d){c=!1;let{origin:m}=u;if(!yt(m)||m.isIsolated()||(d=u,!s||!m.isInline()))break}if(c)for(let u of sv(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(An(u))u.origin.isInline()||(d=u);else{if(ae(u.origin))continue;yt(u.origin)&&!u.origin.isInline()&&(d=u)}break}}if(d===a)return!1;if(i&&!s&&yt(d.origin)&&d.origin.isKeyboardSelectable()){let u=$y();return u.add(d.origin.getKey()),qo(u),!0}return d=En(d),i&&Wi(e.anchor,d),Wi(e.focus,d),c||!s}var ao=null,so=null,Ko=!1,Kh=!1,cm=0,Pk={characterData:!0,childList:!0,subtree:!0};function Gi(){return Ko||ao!==null&&ao._readOnly}function no(){Ko&&ie(13)}function WL(){cm>99&&ie(14)}function Ar(){return ao===null&&ie(195,GL()),ao}function mt(){return so===null&&ie(196,GL()),so}function GL(){let e=0,t=new Set,o=ga.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=wc(r);if(Om(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===o&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let n=` Detected on the page: ${e} compatible editor(s) with version ${o}`;return t.size&&(n+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),n}function o5(){return so}function Ek(e,t,o){let n=t.__type,r=Wy(e,n),a=o.get(n);a===void 0&&(a=Array.from(r.transforms),o.set(n,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function Mk(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function jL(e,t){if(!t)return;let o=e._updateTags,n=t;Array.isArray(t)||(n=[t]);for(let r of n)o.add(r)}function n5(e){return zy(e,mt()._nodes)}function zy(e,t){let o=e.type,n=t.get(o);n===void 0&&ie(17,o);let r=n.klass;e.type!==r.getType()&&ie(18,r.name);let a=r.importJSON(e),s=e.children;if(ae(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let d=zy(s[i],t);a.append(d)}return a}function Ak(e,t,o){let n=ao,r=Ko,a=so;ao=t,Ko=!0,so=e;try{return o()}finally{ao=n,Ko=r,so=a}}function Lr(e,t){let o=e._pendingEditorState,n=e._rootElement,r=e._headless||n===null;if(o===null)return;let a=e._editorState,s=a._selection,i=o._selection,d=e._dirtyType!==0,c=ao,u=Ko,m=so,p=e._updating,f=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=o,!r&&d&&f!==null){so=e,ao=o,Ko=!1,e._updating=!0;try{let k=e._dirtyType,I=e._dirtyElements,T=e._dirtyLeaves;f.disconnect(),g=wK(a,o,e,k,I,T)}catch(k){if(k instanceof Error&&e._onError(k),Kh)throw k;return YL(e,null,n,o),Jk(e),e._dirtyType=2,Kh=!0,Lr(e,a),void(Kh=!1)}finally{f.observe(n,Pk),e._updating=p,ao=c,Ko=u,so=m}}o._readOnly||(o._readOnly=!0);let h=e._dirtyLeaves,y=e._dirtyElements,x=e._normalizedNodes,C=e._updateTags,b=e._deferred;d&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(k,I){let T=k._decorators,S=k._pendingDecorators||T,R=I._nodeMap,A;for(A in S)R.has(A)||(S===T&&(S=nR(k)),delete S[A])})(e,o);let L=r?null:On(en(e));if(e._editable&&L!==null&&(d||i===null||i.dirty||!i.is(s))&&n!==null&&!C.has(_L)){so=e,ao=o;try{if(f!==null&&f.disconnect(),d||i===null||i.dirty){let k=e._blockCursorElement;k!==null&&vy(k,e,n),JK(s,i,e,L,C,n)}(function(k,I,T){let S=k._blockCursorElement;if(Oe(T)&&T.isCollapsed()&&T.anchor.type==="element"&&I.contains(document.activeElement)){let R=T.anchor,A=R.getNode(),N=R.offset,B=!1,O=null;if(N===A.getChildrenSize())Wh(A.getChildAtIndex(N-1))&&(B=!0);else{let V=A.getChildAtIndex(N);if(V!==null&&Wh(V)){let U=V.getPreviousSibling();(U===null||Wh(U))&&(B=!0,O=k.getElementByKey(V.__key))}}if(B){let V=k.getElementByKey(A.__key);return S===null&&(k._blockCursorElement=S=(function(U){let D=U.theme,X=document.createElement("div");X.contentEditable="false",X.setAttribute("data-lexical-cursor","true");let j=D.blockCursor;if(j!==void 0){if(typeof j=="string"){let E=kc(j);j=D.blockCursor=E}j!==void 0&&X.classList.add(...j)}return X})(k._config)),I.style.caretColor="transparent",void(O===null?V.appendChild(S):V.insertBefore(S,O))}}S!==null&&vy(S,k,I)})(e,n,i)}finally{f!==null&&f.observe(n,Pk),so=m,ao=c}}g!==null&&(function(k,I,T,S,R){let A=Array.from(k._listeners.mutation),N=A.length;for(let B=0;B<N;B++){let[O,V]=A[B];for(let U of V){let D=I.get(U);D!==void 0&&O(D,{dirtyLeaves:S,prevEditorState:R,updateTags:T})}}})(e,g,C,h,a),Oe(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(Ry,void 0);let w=e._pendingDecorators;w!==null&&(e._decorators=w,e._pendingDecorators=null,rc("decorator",e,!0,w)),(function(k,I,T){let S=Ok(I),R=Ok(T);S!==R&&rc("textcontent",k,!0,R)})(e,t||a,o),rc("update",e,!0,{dirtyElements:y,dirtyLeaves:h,editorState:o,mutatedNodes:g,normalizedNodes:x,prevEditorState:t||a,tags:C}),(function(k,I){if(k._deferred=[],I.length!==0){let T=k._updating;k._updating=!0;try{for(let S=0;S<I.length;S++)I[S]()}finally{k._updating=T}}})(e,b),(function(k){let I=k._updates;if(I.length!==0){let T=I.shift();if(T){let[S,R]=T;_m(k,S,R)}}})(e)}function rc(e,t,o,...n){let r=t._updating;t._updating=o;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,n)}finally{t._updating=r}}function Nk(e,t){let o=e._updates,n=t||!1;for(;o.length!==0;){let r=o.shift();if(r){let[a,s]=r,i=e._pendingEditorState,d;s!==void 0&&(d=s.onUpdate,s.skipTransforms&&(n=!0),s.discrete&&(i===null&&ie(191),i._flushSync=!0),d&&e._deferred.push(d),jL(e,s.tag)),i==null?_m(e,a,s):a()}}return n}function _m(e,t,o){let n=e._updateTags,r,a=!1,s=!1;o!==void 0&&(r=o.onUpdate,jL(e,o.tag),a=o.skipTransforms||!1,s=o.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,d=e._pendingEditorState,c=!1;(d===null||d._readOnly)&&(d=e._pendingEditorState=VL(d||i),c=!0),d._flushSync=s;let u=ao,m=Ko,p=so,f=e._updating;ao=d,Ko=!1,e._updating=!0,so=e;let g=e._headless||e.getRootElement()===null;qy(null);try{c&&(g?i._selection!==null&&(d._selection=i._selection.clone()):d._selection=(function(C,b){let L=C.getEditorState()._selection,w=On(en(C));return Oe(L)||L==null?Dm(L,w,C,b):L.clone()})(e,o&&o.event||null));let y=e._compositionKey;t(),a=Nk(e,a),(function(C,b){let L=b.getEditorState()._selection,w=C._selection;if(Oe(w)){let k=w.anchor,I=w.focus,T;if(k.type==="text"&&(T=k.getNode(),T.selectionTransform(L,w)),I.type==="text"){let S=I.getNode();T!==S&&S.selectionTransform(L,w)}}})(d,e),e._dirtyType!==0&&(a?(function(C,b){let L=b._dirtyLeaves,w=C._nodeMap;for(let k of L){let I=w.get(k);ke(I)&&I.isAttached()&&I.isSimpleText()&&!I.isUnmergeable()&&ik(I)}})(d,e):(function(C,b){let L=b._dirtyLeaves,w=b._dirtyElements,k=C._nodeMap,I=ca(),T=new Map,S=L,R=S.size,A=w,N=A.size;for(;R>0||N>0;){if(R>0){b._dirtyLeaves=new Set;for(let B of S){let O=k.get(B);ke(O)&&O.isAttached()&&O.isSimpleText()&&!O.isUnmergeable()&&ik(O),O!==void 0&&Mk(O,I)&&Ek(b,O,T),L.add(B)}if(S=b._dirtyLeaves,R=S.size,R>0){cm++;continue}}b._dirtyLeaves=new Set,b._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let B of A){let O=B[0],V=B[1];if(w.set(O,V),!V)continue;let U=k.get(O);U!==void 0&&Mk(U,I)&&Ek(b,U,T)}S=b._dirtyLeaves,R=S.size,A=b._dirtyElements,N=A.size,cm++}b._dirtyLeaves=L,b._dirtyElements=w})(d,e),Nk(e),(function(C,b,L,w){let k=C._nodeMap,I=b._nodeMap,T=[];for(let[S]of w){let R=I.get(S);R!==void 0&&(R.isAttached()||(ae(R)&&Qk(R,S,k,I,T,w),k.has(S)||w.delete(S),T.push(S)))}for(let S of T)I.delete(S);for(let S of L){let R=I.get(S);R===void 0||R.isAttached()||(k.has(S)||L.delete(S),I.delete(S))}})(i,d,e._dirtyLeaves,e._dirtyElements)),y!==e._compositionKey&&(d._flushSync=!0);let x=d._selection;if(Oe(x)){let C=d._nodeMap,b=x.anchor.key,L=x.focus.key;C.get(b)!==void 0&&C.get(L)!==void 0||ie(19)}else xc(x)&&x._nodes.size===0&&(d._selection=null)}catch(y){return y instanceof Error&&e._onError(y),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Lr(e)}finally{ao=u,Ko=m,so=p,e._updating=f,cm=0}e._dirtyType!==0||e._deferred.length>0||(function(y,x){let C=x.getEditorState()._selection,b=y._selection;if(b!==null){if(b.dirty||!b.is(C))return!0}else if(C!==null)return!0;return!1})(d,e)?d._flushSync?(d._flushSync=!1,Lr(e)):c&&p5(()=>{Lr(e)}):(d._flushSync=!1,c&&(n.clear(),e._deferred=[],e._pendingEditorState=null))}function sr(e,t,o){so===e&&o===void 0?t():_m(e,t,o)}var hy=class e{element;before;after;constructor(t,o,n){this.element=t,this.before=o||null,this.after=n||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 o=this.before||this.getManagedLineBreak();return o!==null&&o.parentElement!==this.element&&ie(222),this.element.insertBefore(t,o),this}removeChild(t){return t.parentElement!==this.element&&ie(223),this.element.removeChild(t),this}replaceChild(t,o){return o.parentElement!==this.element&&ie(224),this.element.replaceChild(t,o),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 o=t==="decorator"&&(Em||Cc||Pm);this.insertManagedLineBreak(o)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let o=this.element,n=t.nodeName==="IMG"?t.nextSibling:null;n&&o.removeChild(n),o.removeChild(t),o.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let o=this.getManagedLineBreak();if(o){if(t===(o.nodeName==="IMG"))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,a=document.createElement("br");if(n.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="",n.insertBefore(s,a),n.__lexicalLineBreak=s}else n.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let o=this.after;o!==null;o=o.previousSibling)t++;return t}resolveChildIndex(t,o,n,r){if(n===this.element){let d=this.getFirstChildOffset();return[t,Math.min(d+t.getChildrenSize(),Math.max(d,r))]}let a=Dk(o,n);a.push(r);let s=Dk(o,this.element),i=t.getIndexWithinParent();for(let d=0;d<s.length;d++){let c=a[d],u=s[d];if(c===void 0||c<u)break;if(c>u){i+=1;break}}return[t.getParentOrThrow(),i]}};function Dk(e,t){let o=[],n=t;for(;n!==e&&n!==null;n=n.parentNode){let r=0;for(let a=n.previousSibling;a!==null;a=a.previousSibling)r++;o.push(r)}return n!==e&&ie(225),o.reverse()}var fa=class extends fn{__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 lK[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getChildrenKeys(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o.__key),o=o.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=mt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),o=this.getParentOrThrow().getLastChild();return o!==null&&o.is(t)}getAllTextNodes(){let t=[],o=this.getFirstChild();for(;o!==null;){if(ke(o)&&t.push(o),ae(o)){let n=o.getAllTextNodes();t.push(...n)}o=o.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;ae(t);){let o=t.getFirstChild();if(o===null)break;t=o}return t}getLastDescendant(){let t=this.getLastChild();for(;ae(t);){let o=t.getLastChild();if(o===null)break;t=o}return t}getDescendantByIndex(t){let o=this.getChildren(),n=o.length;if(t>=n){let a=o[n-1];return ae(a)&&a.getLastDescendant()||a||null}let r=o[t];return ae(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Qt(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&ie(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Qt(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&ie(96,this.__key),t}getChildAtIndex(t){let o=this.getChildrenSize(),n,r;if(t<o/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=o-1;n!==null&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="",o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContent(),ae(a)&&r!==n-1&&!a.isInline()&&(t+=Mm)}return t}getTextContentSize(){let t=0,o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContentSize(),ae(a)&&r!==n-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let o=Vh[t];return(this.getFormat()&o)!==0}return!1}hasTextFormat(t){let o=xo[t];return(this.getTextFormat()&o)!==0}getFormatFlags(t,o){return yc(this.getLatest().__textFormat,t,o)}getTextStyle(){return this.getLatest().__textStyle}select(t,o){no();let n=Je(),r=t,a=o,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&o===0){let d=this.getFirstChild();if(ke(d)||ae(d))return d.select(0,0)}else if(!(t!==void 0&&t!==s||o!==void 0&&o!==s)){let d=this.getLastChild();if(ke(d)||ae(d))return d.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return Oe(n)?(n.anchor.set(i,r,"element"),n.focus.set(i,a,"element"),n.dirty=!0,n):zL(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(o=>o.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let o=this.getWritable();return o.__dir=t,o}setFormat(t){return this.getWritable().__format=t!==""?Vh[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let o=this.getWritable();return o.__textFormat=t,o}setTextStyle(t){let o=this.getWritable();return o.__textStyle=t,o}setIndent(t){return this.getWritable().__indent=t,this}splice(t,o,n){bm(this)&&ie(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+o<=r||ie(226,String(t),String(o),String(r));let s=a.__key,i=[],d=[],c=this.getChildAtIndex(t+o),u=null,m=r-o+n.length;if(t!==0)if(t===r)u=this.getLastChild();else{let f=this.getChildAtIndex(t);f!==null&&(u=f.getPreviousSibling())}if(o>0){let f=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<o;g++){f===null&&ie(100);let h=f.getNextSibling(),y=f.__key;pa(f.getWritable()),d.push(y),f=h}}let p=u;for(let f of n){p!==null&&f.is(p)&&(u=p=p.getPreviousSibling());let g=f.getWritable();g.__parent===s&&m--,pa(g);let h=f.__key;if(p===null)a.__first=h,g.__prev=null;else{let y=p.getWritable();y.__next=h,g.__prev=y.__key}f.__key===s&&ie(76),g.__parent=s,i.push(h),p=f}if(t+o===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(c!==null){let f=c.getWritable();if(p!==null){let g=p.getWritable();f.__prev=p.__key,g.__next=c.__key}else f.__prev=null}if(a.__size=m,d.length){let f=Je();if(Oe(f)){let g=new Set(d),h=new Set(i),{anchor:y,focus:x}=f;_k(y,g,h)&&Im(y,y.getNode(),this,u,c),_k(x,g,h)&&Im(x,x.getNode(),this,u,c),m!==0||this.canBeEmpty()||gn(this)||this.remove()}}return a}getDOMSlot(t){return new hy(t)}exportDOM(t){let{element:o}=super.exportDOM(t);if(Ro(o)){let n=this.getIndent();n>0&&(o.style.paddingInlineStart=40*n+"px");let r=this.getDirection();r&&(o.dir=r)}return{element:o}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},o=this.getTextFormat(),n=this.getTextStyle();return o===0&&n===""||gn(this)||this.getChildren().some(ke)||(o!==0&&(t.textFormat=o),n!==""&&(t.textStyle=n)),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,o){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,o,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,o){let n=this.getDOMSlot(t),r=n.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let s=o.getElementByKey(a.getKey());s!==null&&(r==null?(n.insertChild(s),r=s):r!==s&&n.replaceChild(s,r),r=r.nextSibling)}}};function ae(e){return e instanceof fa}function _k(e,t,o){let n=e.getNode();for(;n;){let r=n.__key;if(t.has(r)&&!o.has(r))return!0;n=n.getParent()}return!1}var gc=class extends fn{decorate(t,o){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function yt(e){return e instanceof gc}var Bi=class e extends fa{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ie(51)}getTextContent(){let t=this.__cachedText;return!Gi()&&mt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){ie(52)}replace(t){ie(53)}insertBefore(t){ie(54)}insertAfter(t){ie(55)}updateDOM(t,o){return!1}splice(t,o,n){for(let r of n)ae(r)||yt(r)||ie(282);return super.splice(t,o,n)}static importJSON(t){return Zo().updateFromJSON(t)}collapseAtStart(){return!0}};function lo(e){return e instanceof Bi}function VL(e){return new hc(new Map(e._nodeMap))}function Ky(){return new hc(new Map([["root",new Bi]]))}function QL(e){let t=e.exportJSON(),o=e.constructor;if(t.type!==o.getType()&&ie(130,o.name),ae(e)){let n=t.children;Array.isArray(n)||ie(59,o.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=QL(r[a]);n.push(s)}}return t}function r5(e){return e instanceof hc}var hc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,o){this._nodeMap=t,this._selection=o||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,o){return Ak(o&&o.editor||null,this,t)}clone(t){let o=new e(this._nodeMap,t===void 0?this._selection:t);return o._readOnly=!0,o}toJSON(){return Ak(null,this,()=>({root:QL(Zo())}))}},Sm=class extends fa{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Hi=class e extends fa{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let o=document.createElement("p"),n=Di(t.theme,"paragraph");return n!==void 0&&o.classList.add(...n),o}updateDOM(t,o,n){return!1}static importDOM(){return{p:t=>({conversion:a5,priority:0})}}exportDOM(t){let{element:o}=super.exportDOM(t);if(Ro(o)){this.isEmpty()&&o.append(document.createElement("br"));let n=this.getFormatType();n&&(o.style.textAlign=n)}return{element:o}}static importJSON(t){return Pr().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let o=this.getChildren().find(ke);o?(t.textFormat=o.getFormat(),t.textStyle=o.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,o){let n=Pr();n.setTextFormat(t.format),n.setTextStyle(t.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,o),n}collapseAtStart(){let t=this.getChildren();if(t.length===0||ke(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 a5(e){let t=Pr();if(e.style&&(t.setFormat(e.style.textAlign),yR(e,t)),t.getFormatType()===""){let o=e.getAttribute("align");o&&o&&o in Vh&&t.setFormat(o)}return{node:t}}function Pr(){return Ic(new Hi)}function XL(e){return e instanceof Hi}var Ei=0,s5=1,i5=2,l5=3,d5=4;function YL(e,t,o,n){let r=e._keyToDOMMap;r.clear(),e._editorState=Ky(),e._pendingEditorState=n,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=""),o!==null&&(o.textContent="",r.set("root",o))}function JL(e){let t=new Set,o=new Set,n=e;for(;n;){let{ownNodeConfig:r}=Sc(n),a=n.transform;if(!o.has(a)){o.add(a);let s=n.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),n=r.extends}else{let s=Object.getPrototypeOf(n);n=s.prototype instanceof fn&&s!==fn?s:void 0}}return t}function c5(e){let t=e||{},o=o5(),n=t.theme||{},r=e===void 0?o:t.parentEditor||null,a=t.disableEvents||!1,s=Ky(),i=t.namespace||(r!==null?r._config.namespace:sR()),d=t.editorState,c=[Bi,ys,_i,Fi,Hi,Sm,...t.nodes||[]],{onError:u,html:m}=t,p=t.editable===void 0||t.editable,f;if(e===void 0&&o!==null)f=o._nodes;else{f=new Map;for(let h=0;h<c.length;h++){let y=c[h],x=null,C=null;if(typeof y!="function"){let w=y;y=w.replace,x=w.with,C=w.withKlass||null}Sc(y);let b=y.getType(),L=JL(y);f.set(b,{exportDOM:m&&m.export?m.export.get(y):void 0,klass:y,replace:x,replaceWithKlass:C,sharedNodeState:Zk(c[h]),transforms:L})}}let g=new ga(s,r,f,{disableEvents:a,namespace:i,theme:n},u||console.error,(function(h,y){let x=new Map,C=new Set,b=L=>{Object.keys(L).forEach(w=>{let k=x.get(w);k===void 0&&(k=[],x.set(w,k)),k.push(L[w])})};return h.forEach(L=>{let w=L.klass.importDOM;if(w==null||C.has(w))return;C.add(w);let k=w.call(L.klass);k!==null&&b(k)}),y&&b(y),x})(f,m?m.import:void 0),p,e);return d!==void 0&&(g._pendingEditorState=d,g._dirtyType=2),(function(h){h.registerCommand(Py,AK,Ei),h.registerCommand(Ey,NK,Ei),h.registerCommand(My,DK,Ei),h.registerCommand(Ay,_K,Ei),h.registerCommand(Oy,OK,Ei)})(g),g}var ga=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,o,n,r,a,s,i,d){this._createEditorArgs=d,this._parentEditor=o,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=n,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=sR(),this._onError=a,this._htmlConversions=s,this._editable=i,this._headless=o!==null&&o._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let o=this._listeners.update;return o.add(t),()=>{o.delete(t)}}registerEditableListener(t){let o=this._listeners.editable;return o.add(t),()=>{o.delete(t)}}registerDecoratorListener(t){let o=this._listeners.decorator;return o.add(t),()=>{o.delete(t)}}registerTextContentListener(t){let o=this._listeners.textcontent;return o.add(t),()=>{o.delete(t)}}registerRootListener(t){let o=this._listeners.root;return t(this._rootElement,null),o.add(t),()=>{t(null,this._rootElement),o.delete(t)}}registerCommand(t,o,n){n===void 0&&ie(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&&ie(36,String(t));let s=a[n];return s.add(o),()=>{s.delete(o),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,o,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(o);s===void 0&&(s=new Set,a.set(o,s)),s.add(r);let i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(o,r),()=>{s.delete(r),s.size===0&&a.delete(o)}}getRegisteredNode(t){let o=this._nodes.get(t.getType());return o===void 0&&ie(37,t.name),o}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,o){let n=this._editorState,r=xy(n).get(o.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:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,o){let n=this.getRegisteredNode(t);return n.transforms.add(o),n}registerNodeTransform(t,o){let n=this.registerNodeTransformToKlass(t,o),r=[n],a=n.replaceWithKlass;if(a!=null){let s=this.registerNodeTransformToKlass(a,o);r.push(s)}return(function(s,i){let d=xy(s.getEditorState()),c=[];for(let u of i){let m=d.get(u);m&&c.push(m)}c.length!==0&&s.update(()=>{for(let u of c)for(let m of u.keys()){let p=Qt(m);p&&p.markDirty()}},s._pendingEditorState===null?{tag:dm}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(o))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,o){return we(this,t,o)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let o=this._rootElement;if(t!==o){let n=Di(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,YL(this,o,t,r),o!==null&&(this._config.disableEvents||FK(o),n!=null&&o.classList.remove(...n)),t!==null){let a=tv(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,Jk(this),this._updateTags.add(dm),Lr(this),this._config.disableEvents||(function(i,d){let c=i.ownerDocument;dy.set(i,c);let u=Cm.get(c)??0;u<1&&c.addEventListener("selectionchange",ML),Cm.set(c,u+1),i.__lexicalEditor=d;let m=EL(i);for(let p=0;p<ly.length;p++){let[f,g]=ly[p],h=typeof g=="function"?y=>{fk(y)||(mk(y),(d.isEditable()||f==="click")&&g(y,d))}:y=>{if(fk(y))return;mk(y);let x=d.isEditable();switch(f){case"cut":return x&&we(d,By,y);case"copy":return we(d,Fy,y);case"paste":return x&&we(d,Ny,y);case"dragstart":return x&&we(d,vL,y);case"dragover":return x&&we(d,CL,y);case"dragend":return x&&we(d,xL,y);case"focus":return x&&we(d,bL,y);case"blur":return x&&we(d,wL,y);case"drop":return x&&we(d,yL,y)}};i.addEventListener(f,h),m.push(()=>{i.removeEventListener(f,h)})}})(t,this),n!=null&&t.classList.add(...n)}else this._window=null,this._updateTags.add(dm),Lr(this);rc("root",this,!1,t,o)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,o){t.isEmpty()&&ie(38);let n=t;n._readOnly&&(n=VL(t),n._selection=t._selection?t._selection.clone():null),Yk(this);let r=this._pendingEditorState,a=this._updateTags,s=o!==void 0?o.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),Lr(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||Lr(this)}parseEditorState(t,o){return(function(n,r,a){let s=Ky(),i=ao,d=Ko,c=so,u=r._dirtyElements,m=r._dirtyLeaves,p=r._cloneNotNeeded,f=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,ao=s,Ko=!1,so=r,qy(null);try{let g=r._nodes;zy(n.root,g),a&&a(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=u,r._dirtyLeaves=m,r._cloneNotNeeded=p,r._dirtyType=f,ao=i,Ko=d,so=c}return s})(typeof t=="string"?JSON.parse(t):t,this,o)}read(t){return Lr(this),this.getEditorState().read(t,{editor:this})}update(t,o){(function(n,r,a){n._updating?n._updates.push([r,a]):_m(n,r,a)})(this,t,o)}focus(t,o={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),sr(this,()=>{let r=Je(),a=Zo();r!==null?r.dirty||qo(r.clone()):a.getChildrenSize()!==0&&(o.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Hm("focus"),uR(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let o=On(this._window);o!==null&&o.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,rc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};ga.version="0.41.0+prod.esm";var yy=null;function qy(e){yy=e}var ZL=1;function u5(){ZL=1}function Wy(e,t){let o=Gy(e,t);return o===void 0&&ie(30,t),o}function Gy(e,t){return e._nodes.get(t)}var p5=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function eR(e){return yt(Bm(e))}function jy(e){let t=document.activeElement;if(!Ro(t))return!1;let o=t.nodeName;return yt(Bm(e))&&(o==="INPUT"||o==="TEXTAREA"||t.contentEditable==="true"&&wc(t)==null)}function bc(e,t,o){let n=e.getRootElement();try{return n!==null&&n.contains(t)&&n.contains(o)&&t!==null&&!jy(t)&&Vy(t)===e}catch{return!1}}function Om(e){return e instanceof ga}function Vy(e){let t=e;for(;t!=null;){let o=wc(t);if(Om(o))return o;t=Tc(t)}return null}function wc(e){return e?e.__lexicalEditor:null}function m5(e){return aK.test(e)?"rtl":sK.test(e)?"ltr":null}function ua(e){return Uy(e)||e.isToken()}function kr(e){return ua(e)||e.isSegmented()}function ir(e){return ji(e)&&e.nodeType===3}function tR(e){return ji(e)&&e.nodeType===9}function Cs(e){let t=e;for(;t!=null;){if(ir(t))return t;t=t.firstChild}return null}function yc(e,t,o){let n=xo[t];if(o!==null&&(e&n)===(o&n))return e;let r=e^n;return t==="subscript"?r&=~xo.superscript:t==="superscript"?r&=~xo.subscript:t==="lowercase"?(r&=~xo.uppercase,r&=~xo.capitalize):t==="uppercase"?(r&=~xo.lowercase,r&=~xo.capitalize):t==="capitalize"&&(r&=~xo.lowercase,r&=~xo.uppercase),r}function f5(e){return ke(e)||fs(e)||yt(e)}function oR(e,t){let o=(function(){let s=yy;return yy=null,s})();if((t=t||o&&o.__key)!=null)return void(e.__key=t);no(),WL();let n=mt(),r=Ar(),a=""+ZL++;r._nodeMap.set(a,e),ae(e)?n._dirtyElements.set(a,!0):n._dirtyLeaves.add(a),n._cloneNotNeeded.add(a),n._dirtyType=1,e.__key=a}function pa(e){let t=e.getParent();if(t!==null){let o=e.getWritable(),n=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,d=r!==null?r.getWritable():null,c=a!==null?a.getWritable():null;r===null&&(n.__first=s),a===null&&(n.__last=i),d!==null&&(d.__next=s),c!==null&&(c.__prev=i),o.__prev=null,o.__next=null,o.__parent=null,n.__size--}}function km(e){WL(),bm(e)&&ie(323,e.__key,e.__type);let t=e.getLatest(),o=t.__parent,n=Ar(),r=mt(),a=n._nodeMap,s=r._dirtyElements;o!==null&&(function(d,c,u){let m=d;for(;m!==null;){if(u.has(m))return;let p=c.get(m);if(p===void 0)break;u.set(m,!1),m=p.__parent}})(o,a,s);let i=t.__key;r._dirtyType=1,ae(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function ro(e){no();let t=mt(),o=t._compositionKey;if(e!==o){if(t._compositionKey=e,o!==null){let n=Qt(o);n!==null&&n.getWritable()}if(e!==null){let n=Qt(e);n!==null&&n.getWritable()}}}function ca(){return Gi()?null:mt()._compositionKey}function Qt(e,t){let o=(t||Ar())._nodeMap.get(e);return o===void 0?null:o}function Qy(e,t){let o=Fm(e,mt());return o!==void 0?Qt(o,t):null}function Fm(e,t){return e[`__lexicalKey_${t._key}`]}function Bm(e,t){let o=e;for(;o!=null;){let n=Qy(o,t);if(n!==null)return n;o=Tc(o)}return null}function nR(e){let t=e._decorators,o=Object.assign({},t);return e._pendingDecorators=o,o}function Ok(e){return e.read(()=>Zo().getTextContent())}function Zo(){return rR(Ar())}function rR(e){return e._nodeMap.get("root")}function qo(e){no();let t=Ar();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Mi(e){let t=mt(),o=(function(n,r){let a=n;for(;a!=null;){let s=Fm(a,r);if(s!==void 0)return s;a=Tc(a)}return null})(e,t);return o===null?e===t.getRootElement()?Qt("root"):null:Qt(o)}function aR(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Xy(e){let t=[],o=e;for(;o!==null;)t.push(o),o=o._parentEditor;return t}function sR(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function iR(e){return ir(e)?e.nodeValue:null}function Yy(e,t,o){let n=On(en(t));if(n===null)return;let r=n.anchorNode,{anchorOffset:a,focusOffset:s}=n;if(r!==null){let i=iR(r),d=Bm(r);if(i!==null&&ke(d)){if((i===lc||i===Sy)&&o){let c=o.length;i=o,a=c,s=c}i!==null&&Jy(d,i,a,s,e)}}}function Jy(e,t,o,n,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(lc)&&(i=t.slice(0,-lc.length)),r)){let c=Sy,u;for(;(u=i.indexOf(c))!==-1;)i=i.slice(0,u)+i.slice(u+c.length),o!==null&&o>u&&(o=Math.max(u,o-c.length)),n!==null&&n>u&&(n=Math.max(u,n-c.length))}let d=a.getTextContent();if(r||i!==d){if(i===""){if(ro(null),Pm||Cc||Em)a.remove();else{let h=mt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let c=a.getParent(),u=bs(),m=a.getTextContentSize(),p=ca(),f=a.getKey();if(a.isToken()||p!==null&&f===p&&!s||Oe(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===e.__key&&u.anchor.offset===0&&!a.canInsertTextBefore()&&!s||u.focus.key===e.__key&&u.focus.offset===m&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let g=Je();if(!Oe(g)||o===null||n===null)return void Fk(a,i,g);if(g.setTextNodeRange(a,o,a,n),a.isSegmented()){let h=oo(a.getTextContent());a.replace(h),a=h}Fk(a,i,g)}}}function Fk(e,t,o){if(e.setTextContent(t),Oe(o)){let n=e.getKey();for(let r of["anchor","focus"]){let a=o[r];a.type==="text"&&a.key===n&&(a.offset=Nn(e,a.offset,"clamp"))}}}function nm(e,t,o){let n=t[o]||!1;return n==="any"||n===e[o]}function lR(e,t){return nm(e,t,"altKey")&&nm(e,t,"ctrlKey")&&nm(e,t,"shiftKey")&&nm(e,t,"metaKey")}function st(e,t,o){if(!lR(e,o))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 n="Key"+t.toUpperCase();return e.code===n}var Sr={ctrlKey:!Pn,metaKey:Pn},Bk={altKey:Pn,ctrlKey:!Pn};function Hk(e){return e.key==="Backspace"}function Uk(e){return st(e,"a",Sr)}function g5(e){let t=Zo();if(Oe(e)){let o=e.anchor,n=e.focus,r=o.getNode().getTopLevelElementOrThrow().getParentOrThrow();return o.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),mm(e),e}{let o=t.select(0,t.getChildrenSize());return qo(mm(o)),o}}function Di(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let o=e.__lexicalClassNameCache,n=o[t];if(n!==void 0)return n;let r=e[t];if(typeof r=="string"){let a=kc(r);return o[t]=a,a}return r}function Zy(e,t,o,n,r){if(o.size===0)return;let a=n.__type,s=n.__key,i=t.get(a);i===void 0&&ie(33,a);let d=i.klass,c=e.get(d);c===void 0&&(c=new Map,e.set(d,c));let u=c.get(s),m=u==="destroyed"&&r==="created";(u===void 0||m)&&c.set(s,m?"updated":r)}function h5(e){let t=e.getType(),o=Ar();if(o._readOnly){let a=xy(o).get(t);return a?Array.from(a.values()):[]}let n=o._nodeMap,r=[];for(let[,a]of n)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function $k(e,t,o){let n=e.getParent(),r=o,a=e;return n!==null&&(t&&o===0?(r=a.getIndexWithinParent(),a=n):t||o!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=n)),a.getChildAtIndex(t?r-1:r)}function dR(e,t){let o=e.offset;if(e.type==="element")return $k(e.getNode(),t,o);{let n=e.getNode();if(t&&o===0||!t&&o===n.getTextContentSize()){let r=t?n.getPreviousSibling():n.getNextSibling();return r===null?$k(n.getParentOrThrow(),t,n.getIndexWithinParent()+(t?0:1)):r}}return null}function cR(e){let t=en(e).event,o=t&&t.inputType;return o==="insertFromPaste"||o==="insertFromPasteAsQuotation"}function we(e,t,o){return(function(n,r,a){let s=Xy(n);for(let i=4;i>=0;i--)for(let d=0;d<s.length;d++){let c=s[d],u=c._commands.get(r);if(u!==void 0){let m=u[i];if(m!==void 0){let p=Array.from(m),f=p.length,g=!1;if(sr(c,()=>{for(let h=0;h<f;h++)if(p[h](a,n))return void(g=!0)}),g)return g}}}return!1})(e,t,o)}function Ui(e,t){let o=e._keyToDOMMap.get(t);return o===void 0&&ie(75,t),o}function Tc(e){let t=e.assignedSlot||e.parentElement;return gR(t)?t.host:t}function ev(e){return tR(e)?e:Ro(e)?e.ownerDocument:null}function y5(e){return mt()._updateTags.has(e)}function Hm(e){no(),mt()._updateTags.add(e)}function uR(e){no(),mt()._deferred.push(e)}function Lm(e,t){let o=e.getParent();for(;o!==null;){if(o.is(t))return!0;o=o.getParent()}return!1}function tv(e){let t=ev(e);return t?t.defaultView:null}function en(e){let t=e._window;return t===null&&ie(78),t}function v5(e){return ae(e)&&e.isInline()||yt(e)&&e.isInline()}function pR(e){let t=e.getParentOrThrow();for(;t!==null;){if(gn(t))return t;t=t.getParentOrThrow()}return t}function gn(e){return lo(e)||ae(e)&&e.isShadowRoot()}function ov(e){let t=e.constructor.clone(e);return oR(t,null),t.afterCloneFrom(e),t}function Ic(e){let t=mt(),o=e.getType(),n=Gy(t,o);n===void 0&&ie(200,e.constructor.name,o);let{replace:r,replaceWithKlass:a}=n;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||ie(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,o):s instanceof e.constructor&&i!==e.constructor||ie(202,i.name,i.getType(),e.constructor.name,o),s.__key===e.__key&&ie(203,e.constructor.name,o,i.name,i.getType()),s}return e}function qh(e,t){!lo(e.getParent())||ae(t)||yt(t)||ie(99)}function mR(e){let t=Qt(e);return t===null&&ie(63,e),t}function Wh(e){return(yt(e)||ae(e)&&!e.canBeEmpty())&&!e.isInline()}function vy(e,t,o){o.style.removeProperty("caret-color"),t._blockCursorElement=null;let n=e.parentElement;n!==null&&n.removeChild(e)}function On(e){return _n?(e||window).getSelection():null}function fR(e){let t=tv(e);return t?t.getSelection():null}function C5(e,t){let o=e.getChildAtIndex(t);o==null&&(o=e),gn(e)&&ie(102);let n=s=>{let i=s.getParentOrThrow(),d=gn(i),c=s!==o||d?ov(s):s;if(d)return ae(s)&&ae(c)||ie(133),s.insertAfter(c),[s,c,c];{let[u,m,p]=n(i),f=s.getNextSiblings();return p.append(c,...f),[u,m,c]}},[r,a]=n(o);return[r,a]}function x5(e){return Ro(e)&&e.tagName==="A"}function Ro(e){return ji(e)&&e.nodeType===1}function ji(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function gR(e){return ji(e)&&e.nodeType===11}function hR(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 Cy(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 Rr(e){if(yt(e)&&!e.isInline())return!0;if(!ae(e)||gn(e))return!1;let t=e.getFirstChild(),o=t===null||fs(t)||ke(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function nv(){return mt()}var zk=new WeakMap,b5=new Map;function xy(e){if(!e._readOnly&&e.isEmpty())return b5;e._readOnly||ie(192);let t=zk.get(e);return t||(t=(function(o){let n=new Map;for(let[r,a]of o._nodeMap){let s=a.__type,i=n.get(s);i||(i=new Map,n.set(s,i)),i.set(r,a)}return n})(e),zk.set(e,t)),t}function rv(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function w5(e){return(t=rv(e))[AL]=!0,t;var t}function yR(e,t){let o=parseInt(e.style.paddingInlineStart,10)||0,n=Math.round(o/40);t.setIndent(n)}function T5(e){e.__lexicalUnmanaged=!0}function vR(e){return e.__lexicalUnmanaged===!0}function ec(e,t){return(function(o,n){return Object.prototype.hasOwnProperty.call(o,n)})(e,t)&&e[t]!==fn[t]}function Sc(e){let t=ek in e.prototype?e.prototype[ek]():void 0,o=(function(s){if(!(s===fn||s.prototype instanceof fn)){let i="<unknown>",d="<unknown>";try{i=s.getType()}catch{}try{ga.version&&(d=JSON.parse(ga.version))}catch{}ie(290,s.name,i,d)}return s===gc||s===fa||s===fn})(e),n=!o&&ec(e,"getType")?e.getType():void 0,r,a=n;if(t)if(n)r=t[n];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!o&&a&&(ec(e,"getType")||(e.getType=()=>a),ec(e,"clone")||(e.clone=s=>(qy(s),new e)),ec(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!ec(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function I5(e){let t=nv();return no(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var ac=(e,t)=>{let o=e;for(;o!=null&&!lo(o);){if(t(o))return o;o=o.getParent()}return null},S5={next:"previous",previous:"next"},$i=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return iv({hasNext:xs,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return io(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return io(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,o){let n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(n===null?this.insert(t):n.replace(t,o)),this}splice(t,o,n="next"){let r=n===this.direction?o:Array.from(o).reverse(),a=this,s=this.getParentAtCaret(),i=new Map;for(let d=a.getAdjacentCaret();d!==null&&i.size<t;d=d.getAdjacentCaret()){let c=d.origin.getWritable();i.set(c.getKey(),c)}for(let d of r){if(i.size>0){let c=a.getNodeAtCaret();if(c){if(i.delete(c.getKey()),i.delete(d.getKey()),!(c.is(d)||a.origin.is(d))){let u=d.getParent();u&&u.is(s)&&d.remove(),c.replace(d)}}else c===null&&ie(263,Array.from(i).join(" "))}else a.insert(d);a=io(d,this.direction)}for(let d of i.values())d.remove();return this}},vc=class e extends $i{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Mr(t,this.direction)}getParentCaret(t="root"){return io(av(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=xa(this.direction);return io(this.getNodeAtCaret(),t)||Mr(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)}},k5={root:lo,shadowRoot:gn};function xa(e){return S5[e]}function av(e,t="root"){return k5[t](e)?null:e}var zi=class e extends $i{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:io(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return ae(this.origin)?Mr(this.origin,this.direction):null}getParentCaret(t="root"){return io(av(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=xa(this.direction);return io(this.getNodeAtCaret(),t)||Mr(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 Ki)&&this.direction===t.direction&&this.origin.is(t.origin)}},Ki=class e extends $i{type="text";offset;constructor(t,o){super(t),this.offset=o}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:ha(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return io(av(this.getParentAtCaret(),t),this.direction)}getFlipped(){return ha(this.origin,xa(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 zi||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return io(this.origin,this.direction)}};function Er(e){return e instanceof Ki}function L5(e){return e instanceof $i}function xs(e){return e instanceof zi}function An(e){return e instanceof vc}var R5={next:class extends Ki{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ki{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},P5={next:class extends zi{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends zi{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},E5={next:class extends vc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends vc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function io(e,t){return e?new P5[t](e):null}function ha(e,t,o){return e?new R5[t](e,Nn(e,o)):null}function Nn(e,t,o="error"){let n=e.getTextContentSize(),r=t==="next"?n:t==="previous"?0:t;return(r<0||r>n)&&(o!=="clamp"&&Wk(284,String(t),String(n),e.getKey()),r=r<0?0:n),r}function by(e,t){return new Rm(e,t)}function Mr(e,t){return ae(e)?new E5[t](e):null}function CR(e){return e&&e.getChildCaret()||e}function qi(e){return e&&CR(e.getAdjacentCaret())}var wy=class e{type="node-caret-range";direction;anchor;focus;constructor(t,o,n){this.anchor=t,this.focus=o,this.direction=n}getLatest(){let t=this.anchor.getLatest(),o=this.focus.getLatest();return t===this.anchor&&o===this.focus?this:new e(t,o,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Er(a)?(function(s,i){let{direction:d,origin:c}=s,u=Nn(c,i==="focus"?xa(d):d);return by(s,u-s.offset)})(a,r):null},o=t("anchor"),n=t("focus");if(o&&n){let{caret:r}=o,{caret:a}=n;if(r.isSameNodeCaret(a))return[by(r,a.offset-r.offset),null]}return[o,n]}iterNodeCarets(t="root"){let o=Er(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Er(n),a=s=>s.isSameNodeCaret(n)?null:qi(s)||s.getParentCaret(t);return iv({hasNext:s=>s!==null&&!(r&&n.isSameNodeCaret(s)),initial:o.isSameNodeCaret(n)?null:a(o),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Rm=class{type="slice";caret;distance;constructor(t,o){this.caret=t,this.distance=o}getSliceIndices(){let{distance:t,caret:{offset:o}}=this,n=o+t;return n<o?[n,o]:[o,n]}getTextContent(){let[t,o]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,o)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:o}}=this,[n,r]=this.getSliceIndices(),a=t.getTextContent();return ha(t.setTextContent(a.slice(0,n)+a.slice(r)),o,n)}};function M5(e){return e instanceof Rm}function sv(e){return ya(e,io(Zo(),e.direction))}function xR(e){return ya(e,e)}function ya(e,t){return e.direction!==t.direction&&ie(265),new wy(e,t,e.direction)}function iv(e){let{initial:t,hasNext:o,step:n,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!o(a))return{done:!0,value:void 0};let s={done:!1,value:r(a)};return a=n(a),s}}}function lv(e,t){let o=sc(e.origin,t.origin);switch(o===null&&ie(275,e.origin.getKey(),t.origin.getKey()),o.type){case"same":{let n=e.type==="text",r=t.type==="text";return n&&r?(function(a,s){return Math.sign(a-s)})(e.offset,t.offset):e.type===t.type?0:n?-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 dv(o)}}function dv(e){let{a:t,b:o}=e,n=t.__key,r=o.__key,a=t,s=o;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===n)return 1}return a===null?1:-1}function rm(e,t){return t.is(e)}function Kk(e){return ae(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function sc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let o=new Map;for(let[n,r]=Kk(e);n;r=n,n=n.getParent())o.set(n,r);for(let[n,r]=Kk(t);n;r=n,n=n.getParent()){let a=o.get(n);if(a!==void 0)return a===null?(rm(e,n)||ie(276),{commonAncestor:n,type:"ancestor"}):r===null?(rm(t,n)||ie(277),{commonAncestor:n,type:"descendant"}):((ae(a)||rm(e,a))&&(ae(r)||rm(t,r))&&n.is(a.getParent())&&n.is(r.getParent())||ie(278),{a,b:r,commonAncestor:n,type:"branch"})}return null}function va(e,t){let{type:o,key:n,offset:r}=e,a=mR(e.key);return o==="text"?(ke(a)||ie(266,a.getType(),n),ha(a,t,r)):(ae(a)||ie(267,a.getType(),n),IR(a,e.offset,t))}function Wi(e,t){let{origin:o,direction:n}=t,r=n==="next";Er(t)?e.set(o.getKey(),t.offset,"text"):xs(t)?ke(o)?e.set(o.getKey(),Nn(o,n),"text"):e.set(o.getParentOrThrow().getKey(),o.getIndexWithinParent()+(r?1:0),"element"):(An(t)&&ae(o)||ie(268),e.set(o.getKey(),r?0:o.getChildrenSize(),"element"))}function bR(e){let t=Je(),o=Oe(t)?t:KL();return ic(o,e),qo(o),o}function ic(e,t){Wi(e.anchor,t.anchor),Wi(e.focus,t.focus)}function Ty(e){let{anchor:t,focus:o}=e,n=va(t,"next"),r=va(o,"next"),a=lv(n,r)<=0?"next":"previous";return ya(Ca(n,a),Ca(r,a))}function Vi(e){let{direction:t,origin:o}=e,n=io(o,xa(t)).getNodeAtCaret();return n?io(n,t):Mr(o.getParentOrThrow(),t)}function qk(e,t="root"){let o=[e];for(let n=An(e)?e.getParentCaret(t):e.getSiblingCaret();n!==null;n=n.getParentCaret(t))o.push(Vi(n));return o}function Gh(e){return!!e&&e.origin.isAttached()}function wR(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let o="root",n="next",r=t,a=cv(e,n),s=qk(a.anchor,o),i=qk(a.focus.getFlipped(),o),d=new Set,c=[];for(let g of a.iterNodeCarets(o))if(An(g))d.add(g.origin.getKey());else if(xs(g)){let{origin:h}=g;ae(h)&&!d.has(h.getKey())||c.push(h)}for(let g of c)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,y=h.getTextContentSize(),x=Vi(io(h,n)),C=h.getMode();if(Math.abs(g.distance)===y&&r==="removeEmptySlices"||C==="token"&&g.distance!==0)x.remove();else if(g.distance!==0){r="removeEmptySlices";let b=g.removeTextSlice(),L=g.caret.origin;if(C==="segmented"){let w=b.origin,k=oo(w.getTextContent()).setStyle(w.getStyle()).setFormat(w.getFormat());x.replaceOrInsert(k),b=ha(k,n,b.offset)}L.is(s[0].origin)&&(s[0]=b),L.is(i[0].origin)&&(i[0]=b.getFlipped())}}let u,m;for(let g of s)if(Gh(g)){u=En(g);break}for(let g of i)if(Gh(g)){m=En(g);break}let p=(function(g,h,y){if(!g||!h)return null;let x=g.getParentAtCaret(),C=h.getParentAtCaret();if(!x||!C)return null;let b=x.getParents().reverse();b.push(x);let L=C.getParents().reverse();L.push(C);let w=Math.min(b.length,L.length),k;for(k=0;k<w&&b[k]===L[k];k++);let I=(R,A)=>{let N;for(let B=k;B<R.length;B++){let O=R[B];if(gn(O))return;!N&&A(O)&&(N=O)}return N},T=I(b,Rr),S=T&&I(L,R=>y.has(R.getKey())&&Rr(R));return T&&S?[T,S]:null})(u,m,d);if(p){let[g,h]=p;Mr(g,"previous").splice(0,h.getChildren());let y=h.getParent();for(h.remove(!0);y&&y.isEmpty();){let x=y;y=y.getParent(),x.remove(!0)}}let f=[u,m,...s,...i].find(Gh);if(f)return xR(Ca(En(f),e.direction));ie(269,JSON.stringify(s.map(g=>g.origin.__key)))}function En(e){let t=(function(r){let a=r;for(;An(a);){let s=qi(a);if(!An(s))break;a=s}return a})(e.getLatest()),{direction:o}=t;if(ke(t.origin))return Er(t)?t:ha(t.origin,o,o);let n=t.getAdjacentCaret();return xs(n)&&ke(n.origin)?ha(n.origin,o,xa(o)):t}function TR(e){return Er(e)&&e.offset!==Nn(e.origin,e.direction)}function Ca(e,t){return e.direction===t?e:e.getFlipped()}function cv(e,t){return e.direction===t?e:ya(Ca(e.focus,t),Ca(e.anchor,t))}function IR(e,t,o){let n=Mr(e,"next");for(let r=0;r<t;r++){let a=n.getAdjacentCaret();if(a===null)break;n=a}return Ca(n,o)}function A5(e,t="root"){let o=0,n=e,r=qi(n);for(;r===null;){if(o--,r=n.getParentCaret(t),!r)return null;n=r,r=qi(n)}return r&&[r,o]}function N5(e){let{origin:t,offset:o,direction:n}=e;if(o===Nn(t,n))return e.getSiblingCaret();if(o===Nn(t,xa(n)))return Vi(e.getSiblingCaret());let[r]=t.splitText(o);return ke(r)||ie(281),Ca(io(r,"next"),n)}function D5(e,t){return!0}function _5(e,{$copyElementNode:t=ov,$splitTextPointCaretNext:o=N5,rootMode:n="shadowRoot",$shouldSplit:r=D5}={}){if(Er(e))return o(e);let a=e.getParentCaret(n);if(a){let{origin:s}=a;if(An(e)&&(!s.canBeEmpty()||!r(s,"first")))return Vi(a);let i=(function(d){let c=[];for(let u=d.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function O5(e){return e}function F5(...e){return e}function B5(e,t){return[e,t]}function H5(e){return e}function U5(e,t){if(!t||e===t)return e;for(let o in t)if(e[o]!==t[o])return{...e,...t};return e}function kc(...e){let t=[];for(let o of e)if(o&&typeof o=="string")for(let[n]of o.matchAll(/\S+/g))t.push(n);return t}function $5(e,...t){let o=kc(...t);o.length>0&&e.classList.add(...o)}function z5(e,...t){let o=kc(...t);o.length>0&&e.classList.remove(...o)}function K5(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var _=uv,ede=_.$addUpdateTag,ba=_.$applyNodeReplacement,Qi=_.$caretFromPoint,SR=_.$caretRangeFromSelection,Um=_.$cloneWithProperties,kR=_.$cloneWithPropertiesEphemeral,tde=_.$comparePointCaretNext,ode=_.$copyNode,LR=_.$create,ws=_.$createLineBreakNode,RR=_.$createNodeSelection,hn=_.$createParagraphNode,nde=_.$createPoint,Ts=_.$createRangeSelection,PR=_.$createRangeSelectionFromDom,ER=_.$createTabNode,Fn=_.$createTextNode,MR=_.$extendCaretToRange,Nr=_.$findMatchingParent,pv=_.$getAdjacentChildCaret,rde=_.$getAdjacentNode,Is=_.$getAdjacentSiblingOrParentSiblingCaret,mv=_.$getCaretInDirection,AR=_.$getCaretRange,ade=_.$getCaretRangeInDirection,NR=_.$getCharacterOffsets,wa=_.$getChildCaret,sde=_.$getChildCaretAtIndex,fv=_.$getChildCaretOrSelf,DR=_.$getCollapsedCaretRange,ide=_.$getCommonAncestor,lde=_.$getCommonAncestorResultBranchOrder,$m=_.$getEditor,dde=_.$getNearestNodeFromDOMNode,cde=_.$getNearestRootOrShadowRoot,Ta=_.$getNodeByKey,ude=_.$getNodeByKeyOrThrow,_R=_.$getNodeFromDOMNode,Lc=_.$getPreviousSelection,Ve=_.$getRoot,Te=_.$getSelection,Dr=_.$getSiblingCaret,zm=_.$getState,pde=_.$getStateChange,mde=_.$getTextContent,fde=_.$getTextNodeOffset,gde=_.$getTextPointCaret,hde=_.$getTextPointCaretSlice,yde=_.$getWritableNodeState,OR=_.$hasAncestor,vde=_.$hasUpdateTag,Cde=_.$insertNodes,Xi=_.$isBlockElementNode,Rc=_.$isChildCaret,Km=_.$isDecoratorNode,FR=_.$isEditorState,_e=_.$isElementNode,BR=_.$isExtendableTextPointCaret,xde=_.$isInlineElementOrDecoratorNode,HR=_.$isLeafNode,Yi=_.$isLineBreakNode,bde=_.$isNodeCaret,gv=_.$isNodeSelection,UR=_.$isParagraphNode,ye=_.$isRangeSelection,Pc=_.$isRootNode,Ss=_.$isRootOrShadowRoot,$R=_.$isSiblingCaret,wde=_.$isTabNode,Ke=_.$isTextNode,qm=_.$isTextPointCaret,Tde=_.$isTextPointCaretSlice,hv=_.$isTokenOrSegmented,Ide=_.$isTokenOrTab,Sde=_.$nodesOfType,zR=_.$normalizeCaret,KR=_.$normalizeSelection__EXPERIMENTAL,kde=_.$onUpdate,qR=_.$parseSerializedNode,Lde=_.$removeTextFromCaretRange,WR=_.$rewindSiblingCaret,Wm=_.$selectAll,Rde=_.$setCompositionKey,Pde=_.$setPointFromCaret,yn=_.$setSelection,GR=_.$setSelectionFromCaretRange,Gm=_.$setState,jR=_.$splitAtPointCaretNext,VR=_.$splitNode,Ede=_.$updateRangeSelectionFromCaretRange,yv=_.ArtificialNode__DO_NOT_USE,Mde=_.BEFORE_INPUT_COMMAND,QR=_.BLUR_COMMAND,Ec=_.CAN_REDO_COMMAND,Mc=_.CAN_UNDO_COMMAND,jm=_.CLEAR_EDITOR_COMMAND,XR=_.CLEAR_HISTORY_COMMAND,YR=_.CLICK_COMMAND,Ade=_.COLLABORATION_TAG,Vm=_.COMMAND_PRIORITY_CRITICAL,vt=_.COMMAND_PRIORITY_EDITOR,tn=_.COMMAND_PRIORITY_HIGH,Ji=_.COMMAND_PRIORITY_LOW,Nde=_.COMMAND_PRIORITY_NORMAL,Dde=_.COMPOSITION_END_COMMAND,JR=_.COMPOSITION_END_TAG,_de=_.COMPOSITION_START_COMMAND,ZR=_.COMPOSITION_START_TAG,eP=_.CONTROLLED_TEXT_INSERTION_COMMAND,Qm=_.COPY_COMMAND,tP=_.CUT_COMMAND,Xm=_.DELETE_CHARACTER_COMMAND,oP=_.DELETE_LINE_COMMAND,nP=_.DELETE_WORD_COMMAND,Ode=_.DRAGEND_COMMAND,Fde=_.DRAGOVER_COMMAND,rP=_.DRAGSTART_COMMAND,aP=_.DROP_COMMAND,Wo=_.DecoratorNode,Bde=_.ElementNode,sP=_.FOCUS_COMMAND,Hde=_.FORMAT_ELEMENT_COMMAND,iP=_.FORMAT_TEXT_COMMAND,Ym=_.HISTORIC_TAG,Go=_.HISTORY_MERGE_TAG,lP=_.HISTORY_PUSH_TAG,vv=_.INDENT_CONTENT_COMMAND,Ude=_.INPUT_COMMAND,Cv=_.INSERT_LINE_BREAK_COMMAND,dP=_.INSERT_PARAGRAPH_COMMAND,cP=_.INSERT_TAB_COMMAND,Ac=_.INTERNAL_$isBlock,$de=_.IS_ALL_FORMATTING,zde=_.IS_BOLD,Kde=_.IS_CODE,qde=_.IS_HIGHLIGHT,Wde=_.IS_ITALIC,Gde=_.IS_STRIKETHROUGH,jde=_.IS_SUBSCRIPT,Vde=_.IS_SUPERSCRIPT,Qde=_.IS_UNDERLINE,uP=_.KEY_ARROW_DOWN_COMMAND,Jm=_.KEY_ARROW_LEFT_COMMAND,Zm=_.KEY_ARROW_RIGHT_COMMAND,pP=_.KEY_ARROW_UP_COMMAND,ef=_.KEY_BACKSPACE_COMMAND,tf=_.KEY_DELETE_COMMAND,mP=_.KEY_DOWN_COMMAND,of=_.KEY_ENTER_COMMAND,fP=_.KEY_ESCAPE_COMMAND,Xde=_.KEY_MODIFIER_COMMAND,Yde=_.KEY_SPACE_COMMAND,nf=_.KEY_TAB_COMMAND,gP=_.LineBreakNode,Jde=_.MOVE_TO_END,Zde=_.MOVE_TO_START,ece=_.NODE_STATE_KEY,hP=_.OUTDENT_CONTENT_COMMAND,rf=_.PASTE_COMMAND,yP=_.PASTE_TAG,vP=_.ParagraphNode,CP=_.REDO_COMMAND,xP=_.REMOVE_TEXT_COMMAND,bP=_.RootNode,tce=_.SELECTION_CHANGE_COMMAND,wP=_.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,TP=_.SELECT_ALL_COMMAND,oce=_.SKIP_COLLAB_TAG,IP=_.SKIP_DOM_SELECTION_TAG,xv=_.SKIP_SCROLL_INTO_VIEW_TAG,nce=_.SKIP_SELECTION_FOCUS_TAG,SP=_.TEXT_TYPE_TO_FORMAT,kP=_.TabNode,af=_.TextNode,LP=_.UNDO_COMMAND,Nc=_.addClassNamesToElement,rce=_.buildImportMap,sf=_.configExtension,RP=_.createCommand,lf=_.createEditor,ace=_.createSharedNodeState,PP=_.createState,EP=_.declarePeerDependency,Kt=_.defineExtension,sce=_.flipDirection,ice=_.getDOMOwnerDocument,bv=_.getDOMSelection,lce=_.getDOMSelectionFromTarget,MP=_.getDOMTextNode,dce=_.getEditorPropertyFromDOMNode,cce=_.getNearestEditorFromDOMNode,AP=_.getRegisteredNode,uce=_.getRegisteredNodeOrThrow,pce=_.getStaticNodeConfig,mce=_.getTextDirection,fce=_.getTransformSetFromKlass,NP=_.isBlockDomNode,gce=_.isCurrentlyReadOnlyMode,DP=_.isDOMDocumentNode,_P=_.isDOMNode,hce=_.isDOMTextNode,yce=_.isDOMUnmanaged,wv=_.isDocumentFragment,vce=_.isExactShortcutMatch,OP=_.isHTMLAnchorElement,df=_.isHTMLElement,Dc=_.isInlineDomNode,Cce=_.isLexicalEditor,xce=_.isModifierMatch,bce=_.isSelectionCapturedInDecoratorInput,FP=_.isSelectionWithinEditor,Tv=_.makeStepwiseIterator,lr=_.mergeRegister,wce=_.normalizeClassNames,cf=_.removeClassNamesFromElement,Tce=_.removeFromParent,Ice=_.resetRandomKey,Bn=_.safeCast,Sce=_.setDOMUnmanaged,kce=_.setNodeIndentFromDOM,uf=_.shallowMergeConfig,Iv=_.toggleTextFormatType;var Sv={};$t(Sv,{LexicalComposer:()=>W5});$();var BP=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,q5=BP?fe:H,pf={tag:Go};function W5({initialConfig:e,children:t}){let o=W(()=>{let{theme:n,namespace:r,nodes:a,onError:s,editorState:i,html:d}=e,c=Z0(null,n),u=lf({editable:e.editable,html:d,namespace:r,nodes:a,onError:m=>s(m,u),theme:n});return(function(m,p){if(p!==null){if(p===void 0)m.update(()=>{let f=Ve();if(f.isEmpty()){let g=hn();f.append(g);let h=BP?document.activeElement:null;(Te()!==null||h!==null&&h===m.getRootElement())&&g.select()}},pf);else if(p!==null)switch(typeof p){case"string":{let f=m.parseEditorState(p);m.setEditorState(f,pf);break}case"object":m.setEditorState(p,pf);break;case"function":m.update(()=>{Ve().isEmpty()&&p(m)},pf)}}})(u,i),[u,c]},[]);return q5(()=>{let n=e.editable,[r]=o;r.setEditable(n===void 0||n)},[]),l(J0.Provider,{value:o,children:t})}var G5=Sv,HP=G5.LexicalComposer;var Lv={};$t(Lv,{$canShowPlaceholder:()=>$P,$canShowPlaceholderCurry:()=>V5,$findTextIntersectionFromCharacters:()=>Q5,$isRootTextContentEmpty:()=>kv,$isRootTextContentEmptyCurry:()=>j5,$rootTextContent:()=>UP,registerLexicalTextEntity:()=>Y5});function UP(){return Ve().getTextContent()}function kv(e,t=!0){if(e)return!1;let o=UP();return t&&(o=o.trim()),o===""}function j5(e,t){return()=>kv(e,t)}function $P(e){if(!kv(e,!1))return!1;let t=Ve().getChildren(),o=t.length;if(o>1)return!1;for(let n=0;n<o;n++){let r=t[n];if(Km(r))return!1;if(_e(r)){if(!UR(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let d=a[n];if(!Ke(d))return!1}}}return!0}function V5(e){return()=>$P(e)}function Q5(e,t){let o=e.getFirstChild(),n=0;e:for(;o!==null;){if(_e(o)){let s=o.getFirstChild();if(s!==null){o=s;continue}}else if(Ke(o)){let s=o.getTextContentSize();if(n+s>t)return{node:o,offset:t-n};n+=s}let r=o.getNextSibling();if(r!==null){o=r;continue}let a=o.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){o=s;continue e}a=a.getParent()}break}return null}function X5(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Y5(e,t,o,n){let r=s=>s instanceof o,a=s=>{let i=Fn(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(af,s=>{if(!s.isSimpleText())return;let i,d=s.getPreviousSibling(),c=s.getTextContent(),u=s;if(Ke(d)){let p=d.getTextContent(),f=t(p+c);if(r(d)){if(f===null||(g=>g.getLatest().__mode)(d)!==0)return void a(d);{let g=f.end-p.length;if(g>0){let h=p+c.slice(0,g);if(d.select(),d.setTextContent(h),g===c.length)s.remove();else{let y=c.slice(g);s.setTextContent(y)}return}}}else if(f===null||f.start<p.length)return}let m=0;for(;;){i=t(c);let p,f=i===null?"":c.slice(i.end);if(c=f,f===""){let h=u.getNextSibling();if(Ke(h)){f=u.getTextContent()+h.getTextContent();let y=t(f);if(y===null)return void(r(h)?a(h):h.markDirty());if(y.start!==0)return}}if(i===null)return;if(i.start===0&&Ke(d)&&d.isTextEntity()){m+=i.end;continue}i.start===0?[p,u]=u.splitText(i.end):[,p,u]=u.splitText(i.start+m,i.end+m),p===void 0&&X5(165,"nodeToReplace");let g=n(p);if(g.setFormat(p.getFormat()),p.replace(g),u==null)return;m=0,d=g}}),e.registerNodeTransform(o,s=>{let i=s.getTextContent(),d=t(i);if(d===null||d.start!==0)return void a(s);if(i.length>d.end)return void s.splitText(d.end);let c=s.getPreviousSibling();Ke(c)&&c.isTextEntity()&&(a(c),a(s));let u=s.getNextSibling();Ke(u)&&u.isTextEntity()&&(a(u),r(s)&&a(s))})]}var ks=Lv,Dce=ks.$canShowPlaceholder,mf=ks.$canShowPlaceholderCurry,_ce=ks.$findTextIntersectionFromCharacters,Oce=ks.$isRootTextContentEmpty,Fce=ks.$isRootTextContentEmptyCurry,Bce=ks.$rootTextContent,Hce=ks.registerLexicalTextEntity;var Nv={};$t(Nv,{$addNodeStyle:()=>nq,$cloneWithProperties:()=>Um,$copyBlockFormatIndent:()=>XP,$ensureForwardRangeSelection:()=>QP,$forEachSelectedTextNode:()=>VP,$getComputedStyleForElement:()=>Ev,$getComputedStyleForParent:()=>Mv,$getSelectionStyleValueForProperty:()=>uq,$isAtNodeEnd:()=>oq,$isParentElementRTL:()=>Av,$isParentRTL:()=>eq,$moveCaretSelection:()=>ZP,$moveCharacter:()=>dq,$patchStyleText:()=>rq,$selectAll:()=>Wm,$setBlocksType:()=>aq,$shouldOverrideDefaultCharacterSelection:()=>lq,$sliceSelectedTextNodeContent:()=>tq,$trimTextContentFromAnchor:()=>jP,$wrapNodes:()=>iq,createDOMRange:()=>J5,createRectsFromDOMRange:()=>Z5,getCSSFromStyleObject:()=>GP,getStyleObjectFromCSS:()=>hf,trimTextContentFromAnchor:()=>pq});function Pv(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var gf=new Map;function zP(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function KP(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function J5(e,t,o,n,r){let a=t.getKey(),s=n.getKey(),i=document.createRange(),d=e.getElementByKey(a),c=e.getElementByKey(s),u=o,m=r;if(Ke(t)&&(d=zP(d)),Ke(n)&&(c=zP(c)),t===void 0||n===void 0||d===null||c===null)return null;d.nodeName==="BR"&&([d,u]=KP(d)),c.nodeName==="BR"&&([c,m]=KP(c));let p=d.firstChild;d===c&&p!=null&&p.nodeName==="BR"&&u===0&&m===0&&(m=1);try{i.setStart(d,u),i.setEnd(c,m)}catch{return null}return!i.collapsed||u===m&&a===s||(i.setStart(c,m),i.setEnd(d,u)),i}function Z5(e,t){let o=e.getRootElement();if(o===null)return[];let n=o.getBoundingClientRect(),r=getComputedStyle(o),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,d=s.length;s.sort((c,u)=>{let m=c.top-u.top;return Math.abs(m)<=3?c.left-u.left:m});for(let c=0;c<d;c++){let u=s[c],m=i&&i.top<=u.top&&i.top+i.height>u.top&&i.left+i.width>u.left,p=u.width+a===n.width;m||p?(s.splice(c--,1),d--):i=u}return s}function WP(e){let t={};if(!e)return t;let o=e.split(";");for(let n of o)if(n!==""){let[r,a]=n.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function hf(e){let t=gf.get(e);return t===void 0&&(t=WP(e),gf.set(e,t)),t}function GP(e){let t="";for(let o in e)o&&(t+=`${o}: ${e[o]};`);return t}function Ev(e){let t=$m().getElementByKey(e.getKey());if(t===null)return null;let o=t.ownerDocument.defaultView;return o===null?null:o.getComputedStyle(t)}function Mv(e){return Ev(Pc(e)?e:e.getParentOrThrow())}function eq(e){let t=Mv(e);return t!==null&&t.direction==="rtl"}function tq(e,t,o="self"){let n=e.getStartEndPoints();if(t.isSelected(e)&&!hv(t)&&n!==null){let[r,a]=n,s=e.isBackward(),i=r.getNode(),d=a.getNode(),c=t.is(i),u=t.is(d);if(c||u){let[m,p]=NR(e),f=i.is(d),g=t.is(s?d:i),h=t.is(s?i:d),y,x=0;f?(x=m>p?p:m,y=m>p?m:p):g?(x=s?p:m,y=void 0):h&&(x=0,y=s?m:p);let C=t.__text.slice(x,y);C!==t.__text&&(o==="clone"&&(t=kR(t)),t.__text=C)}}return t}function oq(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return _e(t)||Pv(177),e.offset===t.getChildrenSize()}function jP(e,t,o){let n=t.getNode(),r=o;if(_e(n)){let a=n.getDescendantByIndex(t.offset);a!==null&&(n=a)}for(;r>0&&n!==null;){if(_e(n)){let c=n.getLastDescendant();c!==null&&(n=c)}let a=n.getPreviousSibling(),s=0;if(a===null){let c=n.getParentOrThrow(),u=c.getPreviousSibling();for(;u===null;){if(c=c.getParent(),c===null){a=null;break}u=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,a=u)}let i=n.getTextContent();i===""&&_e(n)&&!n.isInline()&&(i=`
|
|
3560
|
+
`?n.push(Ni()):s===" "?n.push(Pm()):n.push(oo(s))}this.insertNodes(n)}insertText(t){let o=this.anchor,n=this.focus,r=this.format,a=this.style,s=o,i=n;!this.isCollapsed()&&n.isBefore(o)&&(s=n,i=o),s.type==="element"&&(function(y,x,C,b){let L=y.getNode(),w=L.getChildAtIndex(y.offset),k=oo();if(k.setFormat(C),k.setStyle(b),ZL(w))w.splice(0,0,[k]);else{let I=lo(L)?Lr().append(k):k;w===null?L.append(I):w.insertBefore(I)}y.is(x)&&x.set(k.__key,0,"text"),y.set(k.__key,0,"text")})(s,i,r,a),i.type==="element"&&zi(i,Sn(fa(i,"next")));let d=s.offset,c=i.offset,u=this.getNodes(),m=u.length,p=u[0];ke(p)||le(26);let f=p.getTextContent().length,g=p.getParentOrThrow(),h=u[m-1];if(m===1&&i.type==="element"&&(c=f,i.set(s.key,c,"text")),this.isCollapsed()&&d===f&&(Ir(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let y=p.getNextSibling();if(ke(y)&&y.canInsertTextBefore()&&!Ir(y)||(y=oo(),y.setFormat(r),y.setStyle(a),g.canInsertTextAfter()?p.insertAfter(y):g.insertAfter(y)),y.select(0,0),p=y,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&d===0&&(Ir(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let y=p.getPreviousSibling();if(ke(y)&&!Ir(y)||(y=oo(),y.setFormat(r),g.canInsertTextBefore()?p.insertBefore(y):g.insertBefore(y)),y.select(),p=y,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&d!==f){let y=oo(p.getTextContent());y.setFormat(r),p.replace(y),p=y}else if(!this.isCollapsed()&&t!==""){let y=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||re(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),KL(this.anchor,this.focus),void this.insertText(t)}if(m===1){if(ia(p)){let b=oo(t);return b.select(),void p.replace(b)}let y=p.getFormat(),x=p.getStyle();if(d!==c||y===r&&x===a){if(Oy(p)){let b=oo(t);return b.setFormat(r),b.setStyle(a),b.select(),void p.replace(b)}}else{if(p.getTextContent()!==""){let b=oo(t);if(b.setFormat(r),b.setStyle(a),b.select(),d===0)p.insertBefore(b,!1);else{let[L]=p.splitText(d);L.insertAfter(b,!1)}return void(b.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let C=c-d;p=p.spliceText(d,C,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=y,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let y=new Set([...p.getParentKeys(),...h.getParentKeys()]),x=re(p)?p:p.getParentOrThrow(),C=re(h)?h:h.getParentOrThrow(),b=h;if(!x.is(C)&&C.isInline())do b=C,C=C.getParentOrThrow();while(C.isInline());if(i.type==="text"&&(c!==0||h.getTextContent()==="")||i.type==="element"&&h.getIndexWithinParent()<c)if(ke(h)&&!ia(h)&&c!==h.getTextContentSize()){if(h.isSegmented()){let T=oo(h.getTextContent());h.replace(T),h=T}lo(i.getNode())||i.type!=="text"||(h=h.spliceText(0,c,"")),y.add(h.__key)}else{let T=h.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?h.remove():T.remove()}else y.add(h.__key);let L=C.getChildren(),w=new Set(u),k=x.is(C),I=x.isInline()&&p.getNextSibling()===null?x:p;for(let T=L.length-1;T>=0;T--){let S=L[T];if(S.is(p)||re(S)&&S.isParentOf(p))break;S.isAttached()&&(!w.has(S)||S.is(b)?k||I.insertAfter(S,!1):S.remove())}if(!k){let T=C,S=null;for(;T!==null;){let P=T.getChildren(),A=P.length;(A===0||P[A-1].is(S))&&(y.delete(T.__key),S=T),T=T.getParent()}}if(ia(p))if(d===f)p.select();else{let T=oo(t);T.select(),p.replace(T)}else p=p.spliceText(d,f-d,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 T=1;T<m;T++){let S=u[T],P=S.__key;y.has(P)||S.remove()}}}removeText(){let t=Je()===this;ac(this,SP(Cy(this))),t&&Je()!==this&&$o(this)}formatText(t,o=null){if(this.isCollapsed())return this.toggleFormat(t),void ro(null);let n=this.getNodes(),r=[];for(let L of n)ke(L)&&r.push(L);let a=L=>{n.forEach(w=>{if(re(w)){let k=w.getFormatFlags(t,L);w.setTextFormat(k)}})},s=r.length;if(s===0)return this.toggleFormat(t),ro(null),void a(o);let i=this.anchor,d=this.focus,c=this.isBackward(),u=c?d:i,m=c?i:d,p=0,f=r[0],g=u.type==="element"?0:u.offset;if(u.type==="text"&&g===f.getTextContentSize()&&(p=1,f=r[1],g=0),f==null)return;let h=f.getFormatFlags(t,o);a(h);let y=s-1,x=r[y],C=m.type==="text"?m.offset:x.getTextContentSize();if(f.is(x)){if(g===C)return;if(Ir(f)||g===0&&C===f.getTextContentSize())f.setFormat(h);else{let L=f.splitText(g,C),w=g===0?L[0]:L[1];w.setFormat(h),u.type==="text"&&u.set(w.__key,0,"text"),m.type==="text"&&m.set(w.__key,C-g,"text")}return void(this.format=h)}g===0||Ir(f)||([,f]=f.splitText(g),g=0),f.setFormat(h);let b=x.getFormatFlags(t,h);C>0&&(C===x.getTextContentSize()||Ir(x)||([x]=x.splitText(C)),x.setFormat(b));for(let L=p+1;L<y;L++){let w=r[L],k=w.getFormatFlags(t,b);w.setFormat(k)}u.type==="text"&&u.set(f.__key,g,"text"),m.type==="text"&&m.set(x.__key,C,"text"),this.format=h|b}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=Je();return Oe(g)||le(134),g.insertNodes(t)}let o=(this.isBackward()?this.focus:this.anchor).getNode(),n=nc(o,kr),r=t[t.length-1];if(re(n)&&"__language"in n){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Bh(this);n.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(re(g)||yt(g))&&!g.isInline())){re(n)||le(211,o.constructor.name,o.getType());let g=Bh(this);return n.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=Lr(),y=null;for(let x=0;x<g.length;x++){let C=g[x],b=cs(C);if(b||yt(C)&&C.isInline()||re(C)&&C.isInline()||ke(C)||C.isParentRequired()){if(y===null&&(y=C.createParentElementNode(),h.append(y),b))continue;y!==null&&y.append(C)}else h.append(C),y=null}return h})(t),s=a.getLastDescendant(),i=a.getChildren(),d=!re(n)||!n.isEmpty()?this.insertParagraph():null,c=i[i.length-1],u=i[0];var m;re(m=u)&&kr(m)&&!m.isEmpty()&&re(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(re(n)||le(211,o.constructor.name,o.getType()),n.append(...u.getChildren()),u=i[1]),u&&(n===null&&le(212,o.constructor.name,o.getType()),(function(g,h){let y=h.getParentOrThrow().getLastChild(),x=h,C=[h];for(;x!==y;)x.getNextSibling()||le(140),x=x.getNextSibling(),C.push(x);let b=g;for(let L of C)b=b.insertAfter(L)})(n,u));let p=nc(s,kr);d&&re(p)&&(d.canMergeWhenEmpty()||kr(c))&&(p.append(...d.getChildren()),d.remove()),re(n)&&n.isEmpty()&&n.remove(),s.selectEnd();let f=re(n)?n.getLastChild():null;cs(f)&&p!==n&&f.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Lr();return Yo().splice(this.anchor.offset,0,[s]),s.select(),s}let t=Bh(this),o=nc(this.anchor.getNode(),kr);re(o)||le(213);let n=o.getChildAtIndex(t),r=n?[n,...n.getNextSiblings()]:[],a=o.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let o=Ni();if(this.insertNodes([o]),t){let n=o.getParentOrThrow(),r=o.getIndexWithinParent();n.select(r,r)}}extract(){let t=[...this.getNodes()],o=t.length,n=t[0],r=t[o-1],[a,s]=uy(this),i=this.isBackward(),[d,c]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[u,m]=i?[s,a]:[a,s];if(o===0)return[];if(o===1){if(ke(n)&&!this.isCollapsed()){let p=n.splitText(u,m),f=u===0?p[0]:p[1];return f?(d.set(f.getKey(),0,"text"),c.set(f.getKey(),f.getTextContentSize(),"text"),[f]):[]}return[n]}if(ke(n)&&(u===n.getTextContentSize()?t.shift():u!==0&&([,n]=n.splitText(u),t[0]=n,d.set(n.getKey(),0,"text"))),ke(r)){let p=r.getTextContent().length;m===0?t.pop():m!==p&&([r]=r.splitText(m),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,o,n){if(M0(this,t,o,n))return;let r=t==="move",a=mt(),s=Mn(Jo(a));if(!s)return;let i=a._blockCursorElement,d=a._rootElement,c=this.focus.getNode();if(d===null||i===null||!re(c)||c.isInline()||c.canBeEmpty()||fy(i,a,d),this.dirty){let u=Fi(a,this.anchor.key),m=Fi(a,this.focus.key);this.anchor.type==="text"&&(u=gs(u)),this.focus.type==="text"&&(m=gs(m)),u&&m&&jL(s,u,this.anchor.offset,m,this.focus.offset)}if((function(u,m,p,f){u.modify(m,p,f)})(s,t,o?"backward":"forward",n),s.rangeCount>0){let u=s.getRangeAt(0),m=this.anchor.getNode(),p=lo(m)?m:gP(m);if(this.applyDOMRange(u),this.dirty=!0,!r){let f=this.getNodes(),g=[],h=!1;for(let y=0;y<f.length;y++){let x=f[y];wm(x,p)?g.push(x):h=!0}if(h&&g.length>0)if(o){let y=g[0];re(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{let y=g[g.length-1];re(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||(function(y){let x=y.focus,C=y.anchor,b=C.key,L=C.offset,w=C.type;C.set(x.key,x.offset,x.type,!0),x.set(b,L,w,!0)})(this)}}n==="lineboundary"&&M0(this,t,o,n,"decorators")}forwardDeletion(t,o,n){if(!n&&(t.type==="element"&&re(o)&&t.offset===o.getChildrenSize()||t.type==="text"&&t.offset===o.getTextContentSize())){let r=o.getParent(),a=o.getNextSibling()||(r===null?null:r.getNextSibling());if(re(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let o=this.isCollapsed();if(this.isCollapsed()){let n=this.anchor,r=n.getNode();if(this.forwardDeletion(n,r,t))return;let a=ov(fa(n,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let d of a.iterNodeCarets("shadowRoot"))if(Ln(d)){if(!d.origin.isInline()){if(d.origin.isShadowRoot()){if(i.type==="merge-block")break;if(re(a.anchor.origin)&&a.anchor.origin.isEmpty()){let c=Sn(d);ac(this,ma(c,c)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:d,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(hs(d)){if(re(d.origin)){if(d.origin.isInline()){if(!d.origin.isParentOf(a.anchor.origin))break}else i={block:d.origin,type:"merge-next-block"};continue}if(yt(d.origin)){if(!d.origin.isIsolated())if(i.type==="merge-next-block"&&(d.origin.isKeyboardSelectable()||!d.origin.isInline())&&re(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let c=Fy();c.add(d.origin.getKey()),$o(c)}else d.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:d,block:c}=i;return ac(this,ma(!d.origin.isEmpty()&&c.isEmpty()?Wi(io(c,d.direction)):a.anchor,d)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&n.offset===0&&I0(this,n.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=n.type==="text"?n.getNode():null,i!==null&&i.isSegmented()){let d=s.offset,c=i.getTextContentSize();if(i.is(r)||t&&d!==c||!t&&d!==0)return void S0(i,t,d)}else if(r!==null&&r.isSegmented()){let d=n.offset,c=r.getTextContentSize();if(r.is(i)||t&&d!==0||!t&&d!==c)return void S0(r,t,d)}(function(d,c){let u=d.anchor,m=d.focus,p=u.getNode(),f=m.getNode();if(p===f&&u.type==="text"&&m.type==="text"){let g=u.offset,h=m.offset,y=g<h,x=y?g:h,C=y?h:g,b=C-1;x!==b&&(function(L){return!(lP(L)||n5(L))})(p.getTextContent().slice(x,C))&&(c?m.set(m.key,b,m.type):u.set(u.key,b,u.type))}})(this,t)}}if(this.removeText(),t&&!o&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let n=this.anchor.getNode();n.isEmpty()&&lo(n.getParent())&&n.getPreviousSibling()===null&&I0(this,n)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let o=this.anchor,n=o.getNode();if(this.forwardDeletion(o,n,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function vc(e){return e instanceof ym}function T0(e){let t=e.offset;if(e.type==="text")return t;let o=e.getNode();return t===o.getChildrenSize()?o.getTextContent().length:0}function uy(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[o,n]=t;return o.type==="element"&&n.type==="element"&&o.key===n.key&&o.offset===n.offset?[0,0]:[T0(o),T0(n)]}function I0(e,t){for(let o=t;o;o=o.getParent()){if(re(o)){if(o.collapseAtStart(e))return!0;if(pn(o))break}if(o.getPreviousSibling())break}return!1}var n5=(()=>{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 S0(e,t,o){let n=e,r=n.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let c=0;c<a;c++){let u=c===a-1;if(i=s,s+=r[c].length,t&&s===o||s>o||u){r.splice(c,1),u&&(i=void 0);break}}let d=r.join("").trim();d===""?n.remove():(n.setTextContent(d),n.select(i,i))}function k0(e,t,o,n){let r,a=t;if(ko(e)){let s=!1,i=e.childNodes,d=i.length,c=n._blockCursorElement;a===d&&(s=!0,a=d-1);let u=i[a],m=!1;if(u===c)u=i[a+1],m=!0;else if(c!==null){let p=c.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,c)&&a--}if(r=Pi(u),ke(r))a=Pn(r,s?"next":"previous");else{let p=Pi(e);if(p===null)return null;if(re(p)){let f=n.getElementByKey(p.getKey());f===null&&le(214),[p,a]=p.getDOMSlot(f).resolveChildIndex(p,f,e,t),re(p)||le(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(re(h)&&(function(y,x,C){let b=y.getParent();return C===null||b===null||!b.canBeEmpty()||b!==C.getNode()})(h,0,o)){let y=s?h.getLastDescendant():h.getFirstDescendant();y===null?p=h:(h=y,p=re(h)?h:h.getParentOrThrow()),a=0}ke(h)?(r=h,p=null,a=Pn(h,s?"next":"previous")):h!==p&&s&&!m&&(re(p)||le(216),a=Math.min(p.getChildrenSize(),a+1))}else{let f=p.getIndexWithinParent();a=t===0&&yt(p)&&Pi(e)===p?f:f+1,p=p.getParentOrThrow()}if(re(p))return Rn(p.__key,a,"element")}}else r=Pi(e);return ke(r)?Rn(r.__key,Pn(r,a,"clamp"),"text"):null}function L0(e,t,o){let n=e.offset,r=e.getNode();if(n===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((o||!t)&&a===null&&re(s)&&s.isInline()){let i=s.getPreviousSibling();ke(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else re(a)&&!o&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):ke(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(n===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&re(a)&&a.isInline())e.set(a.__key,0,"element");else if((o||t)&&a===null&&re(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();ke(i)&&e.set(i.__key,0,"text")}}}function KL(e,t,o){if(e.type==="text"&&t.type==="text"){let n=e.isBefore(t),r=e.is(t);L0(e,n,r),L0(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function qL(e,t,o,n,r,a){if(e===null||o===null||!Cc(r,e,o))return null;let s=k0(e,t,Oe(a)?a.anchor:null,r);if(s===null)return null;let i=k0(o,n,Oe(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let d=Pi(e),c=Pi(o);if(yt(d)&&yt(c))return null}return KL(s,i),[s,i]}function r5(e){return re(e)&&!e.isInline()}function WL(e,t,o,n,r,a){let s=Er(),i=new fs(Rn(e,t,r),Rn(o,n,a),0,"");return i.dirty=!0,s._selection=i,i}function GL(){let e=Rn("root",0,"element"),t=Rn("root",0,"element");return new fs(e,t,0,"")}function Fy(){return new ym(new Set)}function a5(e,t){return Rm(null,e,t,null)}function Rm(e,t,o,n){let r=o._window;if(r===null)return null;let a=n||r.event,s=a?a.type:void 0,i=s==="selectionchange",d=!Wh&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),c,u,m,p;if(Oe(e)&&!d)return e.clone();if(t===null)return null;if(c=t.anchorNode,u=t.focusNode,m=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&Oe(e)&&!Cc(o,c,u))return e.clone();let f=qL(c,m,u,p,o,e);if(f===null)return null;let[g,h]=f,y=0,x="";if(Oe(e)){let C=e.anchor;if(g.key===C.key)y=e.format,x=e.style;else{let b=g.getNode();ke(b)?(y=b.getFormat(),x=b.getStyle()):re(b)&&(y=b.getTextFormat(),x=b.getTextStyle())}}return new fs(g,h,y,x)}function Je(){return Er()._selection}function ys(){return mt()._editorState._selection}function vm(e,t,o,n=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))return;let d=t.__key;if(e.isCollapsed()){let c=r.offset;if(o<=c&&n>0||o<c&&n<0){let u=Math.max(0,c+n);r.set(d,u,"element"),a.set(d,u,"element"),P0(e)}}else{let c=e.isBackward(),u=c?a:r,m=u.getNode(),p=c?r:a,f=p.getNode();if(t.is(m)){let g=u.offset;(o<=g&&n>0||o<g&&n<0)&&u.set(d,Math.max(0,g+n),"element")}if(t.is(f)){let g=p.offset;(o<=g&&n>0||o<g&&n<0)&&p.set(d,Math.max(0,g+n),"element")}}P0(e)}function P0(e){let t=e.anchor,o=t.offset,n=e.focus,r=n.offset,a=t.getNode(),s=n.getNode();if(e.isCollapsed()){if(!re(a))return;let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text"),n.set(c.__key,u,"text")}return}if(re(a)){let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text")}}if(re(s)){let i=s.getChildrenSize(),d=r>=i,c=d?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),n.set(c.__key,u,"text")}}}function Cm(e,t,o,n,r){let a=null,s=0,i=null;n!==null?(a=n.__key,ke(n)?(s=n.getTextContentSize(),i="text"):re(n)&&(s=n.getChildrenSize(),i="element")):r!==null&&(a=r.__key,ke(r)?i="text":re(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=o.getChildrenSize()),e.set(o.__key,s,"element"))}function R0(e,t,o,n,r){e.type==="text"?e.set(o,e.offset+(t?0:r),"text"):e.offset>n.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function jL(e,t,o,n,r){try{e.setBaseAndExtent(t,o,n,r)}catch{}}function E0(e,t,o){let n=Fi(e,t.getKey());if(re(t)){let r=t.getDOMSlot(n);return[r.element,o+r.getFirstChildOffset()]}return[n,o]}function s5(e,t,o,n,r,a,s){let i=n.anchorNode,d=n.focusNode,c=n.anchorOffset,u=n.focusOffset,m=document.activeElement;if(r.has(OL)&&m!==a||m!==null&&Ky(m))return;if(!Oe(t))return void(e!==null&&Cc(o,i,d)&&n.removeAllRanges());let p=t.anchor,f=t.focus,g=p.getNode(),h=f.getNode(),[y,x]=E0(o,g,p.offset),[C,b]=E0(o,h,f.offset),L=t.format,w=t.style,k=t.isCollapsed(),I=y,T=C,S=!1;var P,A,N,B,O;if(p.type==="text"?(I=gs(y),S=g.getFormat()!==L||g.getStyle()!==w):Oe(e)&&e.anchor.type==="text"&&(S=!0),f.type==="text"&&(T=gs(C)),I!==null&&T!==null&&(k&&(e===null||S||Oe(e)&&(e.format!==L||e.style!==w))&&(P=L,A=w,N=x,B=p.key,O=performance.now(),RL=[P,A,N,B,O]),c!==x||u!==b||i!==I||d!==T||n.type==="Range"&&k||(m!==null&&a.contains(m)||r.has(dy)||a.focus({preventScroll:!0}),p.type==="element"))){if(jL(n,I,x,T,b),!da||!t.isCollapsed()||a===null||r.has(dy)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(FL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let j=Oe(t)&&t.anchor.type==="element"?I.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(j!==null){let U;if(j instanceof Text){let D=document.createRange();D.selectNode(j),U=D.getBoundingClientRect()}else U=j.getBoundingClientRect();(function(D,J,G){let M=Xy(G),X=Yy(M);if(M===null||X===null)return;let{top:F,bottom:ee}=J,Y=0,ae=0,te=G;for(;te!==null;){let de=te===M.body;if(de)Y=0,ae=Jo(D).innerHeight;else{let ne=te.getBoundingClientRect();Y=ne.top,ae=ne.bottom}let ge=0;if(F<Y?ge=-(Y-F):ee>ae&&(ge=ee-ae),ge!==0)if(de)X.scrollBy(0,ge);else{let ne=te.scrollTop;te.scrollTop+=ge;let Z=te.scrollTop-ne;F-=Z,ee-=Z}if(de)break;te=bc(te)}})(o,U,a)}}sy=!0}}function i5(e){let t=Je()||ys();t===null&&(t=Yo().selectEnd()),t.insertNodes(e)}function l5(){let e=Je();return e===null?"":e.getTextContent()}function Bh(e){let t=e;e.isCollapsed()||t.removeText();let o=Je();Oe(o)&&(t=o),Oe(t)||le(161);let n=t.anchor,r=n.getNode(),a=n.offset;for(;!kr(r);){let s=r;if([r,a]=d5(r,a),s.is(r))break}return a}function d5(e,t){let o=e.getParent();if(!o){let r=Lr();return Yo().append(r),r.select(),[Yo(),0]}if(ke(e)){let r=e.splitText(t);if(r.length===0)return[o,e.getIndexWithinParent()];let a=t===0?0:1;return[o,r[0].getIndexWithinParent()+a]}if(!re(e)||t===0)return[o,e.getIndexWithinParent()];let n=e.getChildAtIndex(t);if(n){let r=new fs(Rn(e.__key,t,"element"),Rn(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(n,...n.getNextSiblings())}return[o,e.getIndexWithinParent()+1]}function M0(e,t,o,n,r="decorators-and-blocks"){if(t==="move"&&n==="character"&&!e.isCollapsed()){let[u,m]=o===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return m.set(u.key,u.offset,u.type),!0}let a=fa(e.focus,o?"previous":"next"),s=n==="lineboundary",i=t==="move",d=a,c=r==="decorators-and-blocks";if(!kP(d)){for(let u of d){c=!1;let{origin:m}=u;if(!yt(m)||m.isIsolated()||(d=u,!s||!m.isInline()))break}if(c)for(let u of ov(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Ln(u))u.origin.isInline()||(d=u);else{if(re(u.origin))continue;yt(u.origin)&&!u.origin.isInline()&&(d=u)}break}}if(d===a)return!1;if(i&&!s&&yt(d.origin)&&d.origin.isKeyboardSelectable()){let u=Fy();return u.add(d.origin.getKey()),$o(u),!0}return d=Sn(d),i&&zi(e.anchor,d),zi(e.focus,d),c||!s}var ao=null,so=null,Uo=!1,Hh=!1,am=0,A0={characterData:!0,childList:!0,subtree:!0};function Ki(){return Uo||ao!==null&&ao._readOnly}function no(){Uo&&le(13)}function VL(){am>99&&le(14)}function Er(){return ao===null&&le(195,QL()),ao}function mt(){return so===null&&le(196,QL()),so}function QL(){let e=0,t=new Set,o=ua.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=xc(r);if(Mm(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===o&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let n=` Detected on the page: ${e} compatible editor(s) with version ${o}`;return t.size&&(n+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),n}function c5(){return so}function N0(e,t,o){let n=t.__type,r=$y(e,n),a=o.get(n);a===void 0&&(a=Array.from(r.transforms),o.set(n,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function D0(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function XL(e,t){if(!t)return;let o=e._updateTags,n=t;Array.isArray(t)||(n=[t]);for(let r of n)o.add(r)}function u5(e){return By(e,mt()._nodes)}function By(e,t){let o=e.type,n=t.get(o);n===void 0&&le(17,o);let r=n.klass;e.type!==r.getType()&&le(18,r.name);let a=r.importJSON(e),s=e.children;if(re(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let d=By(s[i],t);a.append(d)}return a}function _0(e,t,o){let n=ao,r=Uo,a=so;ao=t,Uo=!0,so=e;try{return o()}finally{ao=n,Uo=r,so=a}}function Sr(e,t){let o=e._pendingEditorState,n=e._rootElement,r=e._headless||n===null;if(o===null)return;let a=e._editorState,s=a._selection,i=o._selection,d=e._dirtyType!==0,c=ao,u=Uo,m=so,p=e._updating,f=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=o,!r&&d&&f!==null){so=e,ao=o,Uo=!1,e._updating=!0;try{let k=e._dirtyType,I=e._dirtyElements,T=e._dirtyLeaves;f.disconnect(),g=EK(a,o,e,k,I,T)}catch(k){if(k instanceof Error&&e._onError(k),Hh)throw k;return eP(e,null,n,o),tL(e),e._dirtyType=2,Hh=!0,Sr(e,a),void(Hh=!1)}finally{f.observe(n,A0),e._updating=p,ao=c,Uo=u,so=m}}o._readOnly||(o._readOnly=!0);let h=e._dirtyLeaves,y=e._dirtyElements,x=e._normalizedNodes,C=e._updateTags,b=e._deferred;d&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(k,I){let T=k._decorators,S=k._pendingDecorators||T,P=I._nodeMap,A;for(A in S)P.has(A)||(S===T&&(S=sP(k)),delete S[A])})(e,o);let L=r?null:Mn(Jo(e));if(e._editable&&L!==null&&(d||i===null||i.dirty||!i.is(s))&&n!==null&&!C.has(BL)){so=e,ao=o;try{if(f!==null&&f.disconnect(),d||i===null||i.dirty){let k=e._blockCursorElement;k!==null&&fy(k,e,n),s5(s,i,e,L,C,n)}(function(k,I,T){let S=k._blockCursorElement;if(Oe(T)&&T.isCollapsed()&&T.anchor.type==="element"&&I.contains(document.activeElement)){let P=T.anchor,A=P.getNode(),N=P.offset,B=!1,O=null;if(N===A.getChildrenSize())$h(A.getChildAtIndex(N-1))&&(B=!0);else{let j=A.getChildAtIndex(N);if(j!==null&&$h(j)){let U=j.getPreviousSibling();(U===null||$h(U))&&(B=!0,O=k.getElementByKey(j.__key))}}if(B){let j=k.getElementByKey(A.__key);return S===null&&(k._blockCursorElement=S=(function(U){let D=U.theme,J=document.createElement("div");J.contentEditable="false",J.setAttribute("data-lexical-cursor","true");let G=D.blockCursor;if(G!==void 0){if(typeof G=="string"){let M=Ic(G);G=D.blockCursor=M}G!==void 0&&J.classList.add(...G)}return J})(k._config)),I.style.caretColor="transparent",void(O===null?j.appendChild(S):j.insertBefore(S,O))}}S!==null&&fy(S,k,I)})(e,n,i)}finally{f!==null&&f.observe(n,A0),so=m,ao=c}}g!==null&&(function(k,I,T,S,P){let A=Array.from(k._listeners.mutation),N=A.length;for(let B=0;B<N;B++){let[O,j]=A[B];for(let U of j){let D=I.get(U);D!==void 0&&O(D,{dirtyLeaves:S,prevEditorState:P,updateTags:T})}}})(e,g,C,h,a),Oe(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(Iy,void 0);let w=e._pendingDecorators;w!==null&&(e._decorators=w,e._pendingDecorators=null,oc("decorator",e,!0,w)),(function(k,I,T){let S=H0(I),P=H0(T);S!==P&&oc("textcontent",k,!0,P)})(e,t||a,o),oc("update",e,!0,{dirtyElements:y,dirtyLeaves:h,editorState:o,mutatedNodes:g,normalizedNodes:x,prevEditorState:t||a,tags:C}),(function(k,I){if(k._deferred=[],I.length!==0){let T=k._updating;k._updating=!0;try{for(let S=0;S<I.length;S++)I[S]()}finally{k._updating=T}}})(e,b),(function(k){let I=k._updates;if(I.length!==0){let T=I.shift();if(T){let[S,P]=T;Em(k,S,P)}}})(e)}function oc(e,t,o,...n){let r=t._updating;t._updating=o;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,n)}finally{t._updating=r}}function O0(e,t){let o=e._updates,n=t||!1;for(;o.length!==0;){let r=o.shift();if(r){let[a,s]=r,i=e._pendingEditorState,d;s!==void 0&&(d=s.onUpdate,s.skipTransforms&&(n=!0),s.discrete&&(i===null&&le(191),i._flushSync=!0),d&&e._deferred.push(d),XL(e,s.tag)),i==null?Em(e,a,s):a()}}return n}function Em(e,t,o){let n=e._updateTags,r,a=!1,s=!1;o!==void 0&&(r=o.onUpdate,XL(e,o.tag),a=o.skipTransforms||!1,s=o.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,d=e._pendingEditorState,c=!1;(d===null||d._readOnly)&&(d=e._pendingEditorState=YL(d||i),c=!0),d._flushSync=s;let u=ao,m=Uo,p=so,f=e._updating;ao=d,Uo=!1,e._updating=!0,so=e;let g=e._headless||e.getRootElement()===null;Uy(null);try{c&&(g?i._selection!==null&&(d._selection=i._selection.clone()):d._selection=(function(C,b){let L=C.getEditorState()._selection,w=Mn(Jo(C));return Oe(L)||L==null?Rm(L,w,C,b):L.clone()})(e,o&&o.event||null));let y=e._compositionKey;t(),a=O0(e,a),(function(C,b){let L=b.getEditorState()._selection,w=C._selection;if(Oe(w)){let k=w.anchor,I=w.focus,T;if(k.type==="text"&&(T=k.getNode(),T.selectionTransform(L,w)),I.type==="text"){let S=I.getNode();T!==S&&S.selectionTransform(L,w)}}})(d,e),e._dirtyType!==0&&(a?(function(C,b){let L=b._dirtyLeaves,w=C._nodeMap;for(let k of L){let I=w.get(k);ke(I)&&I.isAttached()&&I.isSimpleText()&&!I.isUnmergeable()&&c0(I)}})(d,e):(function(C,b){let L=b._dirtyLeaves,w=b._dirtyElements,k=C._nodeMap,I=sa(),T=new Map,S=L,P=S.size,A=w,N=A.size;for(;P>0||N>0;){if(P>0){b._dirtyLeaves=new Set;for(let B of S){let O=k.get(B);ke(O)&&O.isAttached()&&O.isSimpleText()&&!O.isUnmergeable()&&c0(O),O!==void 0&&D0(O,I)&&N0(b,O,T),L.add(B)}if(S=b._dirtyLeaves,P=S.size,P>0){am++;continue}}b._dirtyLeaves=new Set,b._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let B of A){let O=B[0],j=B[1];if(w.set(O,j),!j)continue;let U=k.get(O);U!==void 0&&D0(U,I)&&N0(b,U,T)}S=b._dirtyLeaves,P=S.size,A=b._dirtyElements,N=A.size,am++}b._dirtyLeaves=L,b._dirtyElements=w})(d,e),O0(e),(function(C,b,L,w){let k=C._nodeMap,I=b._nodeMap,T=[];for(let[S]of w){let P=I.get(S);P!==void 0&&(P.isAttached()||(re(P)&&J0(P,S,k,I,T,w),k.has(S)||w.delete(S),T.push(S)))}for(let S of T)I.delete(S);for(let S of L){let P=I.get(S);P===void 0||P.isAttached()||(k.has(S)||L.delete(S),I.delete(S))}})(i,d,e._dirtyLeaves,e._dirtyElements)),y!==e._compositionKey&&(d._flushSync=!0);let x=d._selection;if(Oe(x)){let C=d._nodeMap,b=x.anchor.key,L=x.focus.key;C.get(b)!==void 0&&C.get(L)!==void 0||le(19)}else vc(x)&&x._nodes.size===0&&(d._selection=null)}catch(y){return y instanceof Error&&e._onError(y),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Sr(e)}finally{ao=u,Uo=m,so=p,e._updating=f,am=0}e._dirtyType!==0||e._deferred.length>0||(function(y,x){let C=x.getEditorState()._selection,b=y._selection;if(b!==null){if(b.dirty||!b.is(C))return!0}else if(C!==null)return!0;return!1})(d,e)?d._flushSync?(d._flushSync=!1,Sr(e)):c&&x5(()=>{Sr(e)}):(d._flushSync=!1,c&&(n.clear(),e._deferred=[],e._pendingEditorState=null))}function or(e,t,o){so===e&&o===void 0?t():Em(e,t,o)}var py=class e{element;before;after;constructor(t,o,n){this.element=t,this.before=o||null,this.after=n||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 o=this.before||this.getManagedLineBreak();return o!==null&&o.parentElement!==this.element&&le(222),this.element.insertBefore(t,o),this}removeChild(t){return t.parentElement!==this.element&&le(223),this.element.removeChild(t),this}replaceChild(t,o){return o.parentElement!==this.element&&le(224),this.element.replaceChild(t,o),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 o=t==="decorator"&&(Sm||yc||Im);this.insertManagedLineBreak(o)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let o=this.element,n=t.nodeName==="IMG"?t.nextSibling:null;n&&o.removeChild(n),o.removeChild(t),o.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let o=this.getManagedLineBreak();if(o){if(t===(o.nodeName==="IMG"))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,a=document.createElement("br");if(n.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="",n.insertBefore(s,a),n.__lexicalLineBreak=s}else n.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let o=this.after;o!==null;o=o.previousSibling)t++;return t}resolveChildIndex(t,o,n,r){if(n===this.element){let d=this.getFirstChildOffset();return[t,Math.min(d+t.getChildrenSize(),Math.max(d,r))]}let a=F0(o,n);a.push(r);let s=F0(o,this.element),i=t.getIndexWithinParent();for(let d=0;d<s.length;d++){let c=a[d],u=s[d];if(c===void 0||c<u)break;if(c>u){i+=1;break}}return[t.getParentOrThrow(),i]}};function F0(e,t){let o=[],n=t;for(;n!==e&&n!==null;n=n.parentNode){let r=0;for(let a=n.previousSibling;a!==null;a=a.previousSibling)r++;o.push(r)}return n!==e&&le(225),o.reverse()}var ca=class extends un{__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 hK[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getChildrenKeys(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o.__key),o=o.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=mt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),o=this.getParentOrThrow().getLastChild();return o!==null&&o.is(t)}getAllTextNodes(){let t=[],o=this.getFirstChild();for(;o!==null;){if(ke(o)&&t.push(o),re(o)){let n=o.getAllTextNodes();t.push(...n)}o=o.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;re(t);){let o=t.getFirstChild();if(o===null)break;t=o}return t}getLastDescendant(){let t=this.getLastChild();for(;re(t);){let o=t.getLastChild();if(o===null)break;t=o}return t}getDescendantByIndex(t){let o=this.getChildren(),n=o.length;if(t>=n){let a=o[n-1];return re(a)&&a.getLastDescendant()||a||null}let r=o[t];return re(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Vt(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&le(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Vt(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&le(96,this.__key),t}getChildAtIndex(t){let o=this.getChildrenSize(),n,r;if(t<o/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=o-1;n!==null&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="",o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContent(),re(a)&&r!==n-1&&!a.isInline()&&(t+=km)}return t}getTextContentSize(){let t=0,o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContentSize(),re(a)&&r!==n-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let o=qh[t];return(this.getFormat()&o)!==0}return!1}hasTextFormat(t){let o=xo[t];return(this.getTextFormat()&o)!==0}getFormatFlags(t,o){return gc(this.getLatest().__textFormat,t,o)}getTextStyle(){return this.getLatest().__textStyle}select(t,o){no();let n=Je(),r=t,a=o,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&o===0){let d=this.getFirstChild();if(ke(d)||re(d))return d.select(0,0)}else if(!(t!==void 0&&t!==s||o!==void 0&&o!==s)){let d=this.getLastChild();if(ke(d)||re(d))return d.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return Oe(n)?(n.anchor.set(i,r,"element"),n.focus.set(i,a,"element"),n.dirty=!0,n):WL(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(o=>o.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let o=this.getWritable();return o.__dir=t,o}setFormat(t){return this.getWritable().__format=t!==""?qh[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let o=this.getWritable();return o.__textFormat=t,o}setTextStyle(t){let o=this.getWritable();return o.__textStyle=t,o}setIndent(t){return this.getWritable().__indent=t,this}splice(t,o,n){hm(this)&&le(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+o<=r||le(226,String(t),String(o),String(r));let s=a.__key,i=[],d=[],c=this.getChildAtIndex(t+o),u=null,m=r-o+n.length;if(t!==0)if(t===r)u=this.getLastChild();else{let f=this.getChildAtIndex(t);f!==null&&(u=f.getPreviousSibling())}if(o>0){let f=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<o;g++){f===null&&le(100);let h=f.getNextSibling(),y=f.__key;la(f.getWritable()),d.push(y),f=h}}let p=u;for(let f of n){p!==null&&f.is(p)&&(u=p=p.getPreviousSibling());let g=f.getWritable();g.__parent===s&&m--,la(g);let h=f.__key;if(p===null)a.__first=h,g.__prev=null;else{let y=p.getWritable();y.__next=h,g.__prev=y.__key}f.__key===s&&le(76),g.__parent=s,i.push(h),p=f}if(t+o===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(c!==null){let f=c.getWritable();if(p!==null){let g=p.getWritable();f.__prev=p.__key,g.__next=c.__key}else f.__prev=null}if(a.__size=m,d.length){let f=Je();if(Oe(f)){let g=new Set(d),h=new Set(i),{anchor:y,focus:x}=f;B0(y,g,h)&&Cm(y,y.getNode(),this,u,c),B0(x,g,h)&&Cm(x,x.getNode(),this,u,c),m!==0||this.canBeEmpty()||pn(this)||this.remove()}}return a}getDOMSlot(t){return new py(t)}exportDOM(t){let{element:o}=super.exportDOM(t);if(ko(o)){let n=this.getIndent();n>0&&(o.style.paddingInlineStart=40*n+"px");let r=this.getDirection();r&&(o.dir=r)}return{element:o}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},o=this.getTextFormat(),n=this.getTextStyle();return o===0&&n===""||pn(this)||this.getChildren().some(ke)||(o!==0&&(t.textFormat=o),n!==""&&(t.textStyle=n)),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,o){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,o,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,o){let n=this.getDOMSlot(t),r=n.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let s=o.getElementByKey(a.getKey());s!==null&&(r==null?(n.insertChild(s),r=s):r!==s&&n.replaceChild(s,r),r=r.nextSibling)}}};function re(e){return e instanceof ca}function B0(e,t,o){let n=e.getNode();for(;n;){let r=n.__key;if(t.has(r)&&!o.has(r))return!0;n=n.getParent()}return!1}var mc=class extends un{decorate(t,o){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function yt(e){return e instanceof mc}var _i=class e extends ca{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){le(51)}getTextContent(){let t=this.__cachedText;return!Ki()&&mt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){le(52)}replace(t){le(53)}insertBefore(t){le(54)}insertAfter(t){le(55)}updateDOM(t,o){return!1}splice(t,o,n){for(let r of n)re(r)||yt(r)||le(282);return super.splice(t,o,n)}static importJSON(t){return Yo().updateFromJSON(t)}collapseAtStart(){return!0}};function lo(e){return e instanceof _i}function YL(e){return new fc(new Map(e._nodeMap))}function Hy(){return new fc(new Map([["root",new _i]]))}function JL(e){let t=e.exportJSON(),o=e.constructor;if(t.type!==o.getType()&&le(130,o.name),re(e)){let n=t.children;Array.isArray(n)||le(59,o.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=JL(r[a]);n.push(s)}}return t}function p5(e){return e instanceof fc}var fc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,o){this._nodeMap=t,this._selection=o||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,o){return _0(o&&o.editor||null,this,t)}clone(t){let o=new e(this._nodeMap,t===void 0?this._selection:t);return o._readOnly=!0,o}toJSON(){return _0(null,this,()=>({root:JL(Yo())}))}},xm=class extends ca{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Oi=class e extends ca{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let o=document.createElement("p"),n=Mi(t.theme,"paragraph");return n!==void 0&&o.classList.add(...n),o}updateDOM(t,o,n){return!1}static importDOM(){return{p:t=>({conversion:m5,priority:0})}}exportDOM(t){let{element:o}=super.exportDOM(t);if(ko(o)){this.isEmpty()&&o.append(document.createElement("br"));let n=this.getFormatType();n&&(o.style.textAlign=n)}return{element:o}}static importJSON(t){return Lr().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let o=this.getChildren().find(ke);o?(t.textFormat=o.getFormat(),t.textStyle=o.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,o){let n=Lr();n.setTextFormat(t.format),n.setTextStyle(t.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,o),n}collapseAtStart(){let t=this.getChildren();if(t.length===0||ke(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 m5(e){let t=Lr();if(e.style&&(t.setFormat(e.style.textAlign),xP(e,t)),t.getFormatType()===""){let o=e.getAttribute("align");o&&o&&o in qh&&t.setFormat(o)}return{node:t}}function Lr(){return wc(new Oi)}function ZL(e){return e instanceof Oi}var Li=0,f5=1,g5=2,h5=3,y5=4;function eP(e,t,o,n){let r=e._keyToDOMMap;r.clear(),e._editorState=Hy(),e._pendingEditorState=n,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=""),o!==null&&(o.textContent="",r.set("root",o))}function tP(e){let t=new Set,o=new Set,n=e;for(;n;){let{ownNodeConfig:r}=Tc(n),a=n.transform;if(!o.has(a)){o.add(a);let s=n.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),n=r.extends}else{let s=Object.getPrototypeOf(n);n=s.prototype instanceof un&&s!==un?s:void 0}}return t}function v5(e){let t=e||{},o=c5(),n=t.theme||{},r=e===void 0?o:t.parentEditor||null,a=t.disableEvents||!1,s=Hy(),i=t.namespace||(r!==null?r._config.namespace:dP()),d=t.editorState,c=[_i,ms,Ai,Di,Oi,xm,...t.nodes||[]],{onError:u,html:m}=t,p=t.editable===void 0||t.editable,f;if(e===void 0&&o!==null)f=o._nodes;else{f=new Map;for(let h=0;h<c.length;h++){let y=c[h],x=null,C=null;if(typeof y!="function"){let w=y;y=w.replace,x=w.with,C=w.withKlass||null}Tc(y);let b=y.getType(),L=tP(y);f.set(b,{exportDOM:m&&m.export?m.export.get(y):void 0,klass:y,replace:x,replaceWithKlass:C,sharedNodeState:oL(c[h]),transforms:L})}}let g=new ua(s,r,f,{disableEvents:a,namespace:i,theme:n},u||console.error,(function(h,y){let x=new Map,C=new Set,b=L=>{Object.keys(L).forEach(w=>{let k=x.get(w);k===void 0&&(k=[],x.set(w,k)),k.push(L[w])})};return h.forEach(L=>{let w=L.klass.importDOM;if(w==null||C.has(w))return;C.add(w);let k=w.call(L.klass);k!==null&&b(k)}),y&&b(y),x})(f,m?m.import:void 0),p,e);return d!==void 0&&(g._pendingEditorState=d,g._dirtyType=2),(function(h){h.registerCommand(Sy,UK,Li),h.registerCommand(ky,$K,Li),h.registerCommand(Ly,zK,Li),h.registerCommand(Py,KK,Li),h.registerCommand(Ay,qK,Li)})(g),g}var ua=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,o,n,r,a,s,i,d){this._createEditorArgs=d,this._parentEditor=o,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=n,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=dP(),this._onError=a,this._htmlConversions=s,this._editable=i,this._headless=o!==null&&o._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let o=this._listeners.update;return o.add(t),()=>{o.delete(t)}}registerEditableListener(t){let o=this._listeners.editable;return o.add(t),()=>{o.delete(t)}}registerDecoratorListener(t){let o=this._listeners.decorator;return o.add(t),()=>{o.delete(t)}}registerTextContentListener(t){let o=this._listeners.textcontent;return o.add(t),()=>{o.delete(t)}}registerRootListener(t){let o=this._listeners.root;return t(this._rootElement,null),o.add(t),()=>{t(null,this._rootElement),o.delete(t)}}registerCommand(t,o,n){n===void 0&&le(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&&le(36,String(t));let s=a[n];return s.add(o),()=>{s.delete(o),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,o,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(o);s===void 0&&(s=new Set,a.set(o,s)),s.add(r);let i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(o,r),()=>{s.delete(r),s.size===0&&a.delete(o)}}getRegisteredNode(t){let o=this._nodes.get(t.getType());return o===void 0&&le(37,t.name),o}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,o){let n=this._editorState,r=hy(n).get(o.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:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,o){let n=this.getRegisteredNode(t);return n.transforms.add(o),n}registerNodeTransform(t,o){let n=this.registerNodeTransformToKlass(t,o),r=[n],a=n.replaceWithKlass;if(a!=null){let s=this.registerNodeTransformToKlass(a,o);r.push(s)}return(function(s,i){let d=hy(s.getEditorState()),c=[];for(let u of i){let m=d.get(u);m&&c.push(m)}c.length!==0&&s.update(()=>{for(let u of c)for(let m of u.keys()){let p=Vt(m);p&&p.markDirty()}},s._pendingEditorState===null?{tag:rm}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(o))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,o){return we(this,t,o)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let o=this._rootElement;if(t!==o){let n=Mi(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,eP(this,o,t,r),o!==null&&(this._config.disableEvents||WK(o),n!=null&&o.classList.remove(...n)),t!==null){let a=Yy(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,tL(this),this._updateTags.add(rm),Sr(this),this._config.disableEvents||(function(i,d){let c=i.ownerDocument;ay.set(i,c);let u=fm.get(c)??0;u<1&&c.addEventListener("selectionchange",DL),fm.set(c,u+1),i.__lexicalEditor=d;let m=NL(i);for(let p=0;p<ry.length;p++){let[f,g]=ry[p],h=typeof g=="function"?y=>{y0(y)||(h0(y),(d.isEditable()||f==="click")&&g(y,d))}:y=>{if(y0(y))return;h0(y);let x=d.isEditable();switch(f){case"cut":return x&&we(d,Dy,y);case"copy":return we(d,Ny,y);case"paste":return x&&we(d,Ry,y);case"dragstart":return x&&we(d,bL,y);case"dragover":return x&&we(d,wL,y);case"dragend":return x&&we(d,TL,y);case"focus":return x&&we(d,IL,y);case"blur":return x&&we(d,SL,y);case"drop":return x&&we(d,xL,y)}};i.addEventListener(f,h),m.push(()=>{i.removeEventListener(f,h)})}})(t,this),n!=null&&t.classList.add(...n)}else this._window=null,this._updateTags.add(rm),Sr(this);oc("root",this,!1,t,o)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,o){t.isEmpty()&&le(38);let n=t;n._readOnly&&(n=YL(t),n._selection=t._selection?t._selection.clone():null),eL(this);let r=this._pendingEditorState,a=this._updateTags,s=o!==void 0?o.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),Sr(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||Sr(this)}parseEditorState(t,o){return(function(n,r,a){let s=Hy(),i=ao,d=Uo,c=so,u=r._dirtyElements,m=r._dirtyLeaves,p=r._cloneNotNeeded,f=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,ao=s,Uo=!1,so=r,Uy(null);try{let g=r._nodes;By(n.root,g),a&&a(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=u,r._dirtyLeaves=m,r._cloneNotNeeded=p,r._dirtyType=f,ao=i,Uo=d,so=c}return s})(typeof t=="string"?JSON.parse(t):t,this,o)}read(t){return Sr(this),this.getEditorState().read(t,{editor:this})}update(t,o){(function(n,r,a){n._updating?n._updates.push([r,a]):Em(n,r,a)})(this,t,o)}focus(t,o={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),or(this,()=>{let r=Je(),a=Yo();r!==null?r.dirty||$o(r.clone()):a.getChildrenSize()!==0&&(o.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Dm("focus"),fP(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let o=Mn(this._window);o!==null&&o.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,oc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};ua.version="0.41.0+prod.esm";var my=null;function Uy(e){my=e}var oP=1;function C5(){oP=1}function $y(e,t){let o=zy(e,t);return o===void 0&&le(30,t),o}function zy(e,t){return e._nodes.get(t)}var x5=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function nP(e){return yt(Nm(e))}function Ky(e){let t=document.activeElement;if(!ko(t))return!1;let o=t.nodeName;return yt(Nm(e))&&(o==="INPUT"||o==="TEXTAREA"||t.contentEditable==="true"&&xc(t)==null)}function Cc(e,t,o){let n=e.getRootElement();try{return n!==null&&n.contains(t)&&n.contains(o)&&t!==null&&!Ky(t)&&qy(t)===e}catch{return!1}}function Mm(e){return e instanceof ua}function qy(e){let t=e;for(;t!=null;){let o=xc(t);if(Mm(o))return o;t=bc(t)}return null}function xc(e){return e?e.__lexicalEditor:null}function b5(e){return mK.test(e)?"rtl":fK.test(e)?"ltr":null}function ia(e){return Oy(e)||e.isToken()}function Ir(e){return ia(e)||e.isSegmented()}function nr(e){return qi(e)&&e.nodeType===3}function rP(e){return qi(e)&&e.nodeType===9}function gs(e){let t=e;for(;t!=null;){if(nr(t))return t;t=t.firstChild}return null}function gc(e,t,o){let n=xo[t];if(o!==null&&(e&n)===(o&n))return e;let r=e^n;return t==="subscript"?r&=~xo.superscript:t==="superscript"?r&=~xo.subscript:t==="lowercase"?(r&=~xo.uppercase,r&=~xo.capitalize):t==="uppercase"?(r&=~xo.lowercase,r&=~xo.capitalize):t==="capitalize"&&(r&=~xo.lowercase,r&=~xo.uppercase),r}function w5(e){return ke(e)||cs(e)||yt(e)}function aP(e,t){let o=(function(){let s=my;return my=null,s})();if((t=t||o&&o.__key)!=null)return void(e.__key=t);no(),VL();let n=mt(),r=Er(),a=""+oP++;r._nodeMap.set(a,e),re(e)?n._dirtyElements.set(a,!0):n._dirtyLeaves.add(a),n._cloneNotNeeded.add(a),n._dirtyType=1,e.__key=a}function la(e){let t=e.getParent();if(t!==null){let o=e.getWritable(),n=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,d=r!==null?r.getWritable():null,c=a!==null?a.getWritable():null;r===null&&(n.__first=s),a===null&&(n.__last=i),d!==null&&(d.__next=s),c!==null&&(c.__prev=i),o.__prev=null,o.__next=null,o.__parent=null,n.__size--}}function bm(e){VL(),hm(e)&&le(323,e.__key,e.__type);let t=e.getLatest(),o=t.__parent,n=Er(),r=mt(),a=n._nodeMap,s=r._dirtyElements;o!==null&&(function(d,c,u){let m=d;for(;m!==null;){if(u.has(m))return;let p=c.get(m);if(p===void 0)break;u.set(m,!1),m=p.__parent}})(o,a,s);let i=t.__key;r._dirtyType=1,re(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function ro(e){no();let t=mt(),o=t._compositionKey;if(e!==o){if(t._compositionKey=e,o!==null){let n=Vt(o);n!==null&&n.getWritable()}if(e!==null){let n=Vt(e);n!==null&&n.getWritable()}}}function sa(){return Ki()?null:mt()._compositionKey}function Vt(e,t){let o=(t||Er())._nodeMap.get(e);return o===void 0?null:o}function Wy(e,t){let o=Am(e,mt());return o!==void 0?Vt(o,t):null}function Am(e,t){return e[`__lexicalKey_${t._key}`]}function Nm(e,t){let o=e;for(;o!=null;){let n=Wy(o,t);if(n!==null)return n;o=bc(o)}return null}function sP(e){let t=e._decorators,o=Object.assign({},t);return e._pendingDecorators=o,o}function H0(e){return e.read(()=>Yo().getTextContent())}function Yo(){return iP(Er())}function iP(e){return e._nodeMap.get("root")}function $o(e){no();let t=Er();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Pi(e){let t=mt(),o=(function(n,r){let a=n;for(;a!=null;){let s=Am(a,r);if(s!==void 0)return s;a=bc(a)}return null})(e,t);return o===null?e===t.getRootElement()?Vt("root"):null:Vt(o)}function lP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Gy(e){let t=[],o=e;for(;o!==null;)t.push(o),o=o._parentEditor;return t}function dP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function cP(e){return nr(e)?e.nodeValue:null}function jy(e,t,o){let n=Mn(Jo(t));if(n===null)return;let r=n.anchorNode,{anchorOffset:a,focusOffset:s}=n;if(r!==null){let i=cP(r),d=Nm(r);if(i!==null&&ke(d)){if((i===sc||i===by)&&o){let c=o.length;i=o,a=c,s=c}i!==null&&Vy(d,i,a,s,e)}}}function Vy(e,t,o,n,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(sc)&&(i=t.slice(0,-sc.length)),r)){let c=by,u;for(;(u=i.indexOf(c))!==-1;)i=i.slice(0,u)+i.slice(u+c.length),o!==null&&o>u&&(o=Math.max(u,o-c.length)),n!==null&&n>u&&(n=Math.max(u,n-c.length))}let d=a.getTextContent();if(r||i!==d){if(i===""){if(ro(null),Im||yc||Sm)a.remove();else{let h=mt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let c=a.getParent(),u=ys(),m=a.getTextContentSize(),p=sa(),f=a.getKey();if(a.isToken()||p!==null&&f===p&&!s||Oe(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===e.__key&&u.anchor.offset===0&&!a.canInsertTextBefore()&&!s||u.focus.key===e.__key&&u.focus.offset===m&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let g=Je();if(!Oe(g)||o===null||n===null)return void U0(a,i,g);if(g.setTextNodeRange(a,o,a,n),a.isSegmented()){let h=oo(a.getTextContent());a.replace(h),a=h}U0(a,i,g)}}}function U0(e,t,o){if(e.setTextContent(t),Oe(o)){let n=e.getKey();for(let r of["anchor","focus"]){let a=o[r];a.type==="text"&&a.key===n&&(a.offset=Pn(e,a.offset,"clamp"))}}}function Jp(e,t,o){let n=t[o]||!1;return n==="any"||n===e[o]}function uP(e,t){return Jp(e,t,"altKey")&&Jp(e,t,"ctrlKey")&&Jp(e,t,"shiftKey")&&Jp(e,t,"metaKey")}function at(e,t,o){if(!uP(e,o))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 n="Key"+t.toUpperCase();return e.code===n}var Tr={ctrlKey:!In,metaKey:In},$0={altKey:In,ctrlKey:!In};function z0(e){return e.key==="Backspace"}function K0(e){return at(e,"a",Tr)}function T5(e){let t=Yo();if(Oe(e)){let o=e.anchor,n=e.focus,r=o.getNode().getTopLevelElementOrThrow().getParentOrThrow();return o.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),lm(e),e}{let o=t.select(0,t.getChildrenSize());return $o(lm(o)),o}}function Mi(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let o=e.__lexicalClassNameCache,n=o[t];if(n!==void 0)return n;let r=e[t];if(typeof r=="string"){let a=Ic(r);return o[t]=a,a}return r}function Qy(e,t,o,n,r){if(o.size===0)return;let a=n.__type,s=n.__key,i=t.get(a);i===void 0&&le(33,a);let d=i.klass,c=e.get(d);c===void 0&&(c=new Map,e.set(d,c));let u=c.get(s),m=u==="destroyed"&&r==="created";(u===void 0||m)&&c.set(s,m?"updated":r)}function I5(e){let t=e.getType(),o=Er();if(o._readOnly){let a=hy(o).get(t);return a?Array.from(a.values()):[]}let n=o._nodeMap,r=[];for(let[,a]of n)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function q0(e,t,o){let n=e.getParent(),r=o,a=e;return n!==null&&(t&&o===0?(r=a.getIndexWithinParent(),a=n):t||o!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=n)),a.getChildAtIndex(t?r-1:r)}function pP(e,t){let o=e.offset;if(e.type==="element")return q0(e.getNode(),t,o);{let n=e.getNode();if(t&&o===0||!t&&o===n.getTextContentSize()){let r=t?n.getPreviousSibling():n.getNextSibling();return r===null?q0(n.getParentOrThrow(),t,n.getIndexWithinParent()+(t?0:1)):r}}return null}function mP(e){let t=Jo(e).event,o=t&&t.inputType;return o==="insertFromPaste"||o==="insertFromPasteAsQuotation"}function we(e,t,o){return(function(n,r,a){let s=Gy(n);for(let i=4;i>=0;i--)for(let d=0;d<s.length;d++){let c=s[d],u=c._commands.get(r);if(u!==void 0){let m=u[i];if(m!==void 0){let p=Array.from(m),f=p.length,g=!1;if(or(c,()=>{for(let h=0;h<f;h++)if(p[h](a,n))return void(g=!0)}),g)return g}}}return!1})(e,t,o)}function Fi(e,t){let o=e._keyToDOMMap.get(t);return o===void 0&&le(75,t),o}function bc(e){let t=e.assignedSlot||e.parentElement;return vP(t)?t.host:t}function Xy(e){return rP(e)?e:ko(e)?e.ownerDocument:null}function S5(e){return mt()._updateTags.has(e)}function Dm(e){no(),mt()._updateTags.add(e)}function fP(e){no(),mt()._deferred.push(e)}function wm(e,t){let o=e.getParent();for(;o!==null;){if(o.is(t))return!0;o=o.getParent()}return!1}function Yy(e){let t=Xy(e);return t?t.defaultView:null}function Jo(e){let t=e._window;return t===null&&le(78),t}function k5(e){return re(e)&&e.isInline()||yt(e)&&e.isInline()}function gP(e){let t=e.getParentOrThrow();for(;t!==null;){if(pn(t))return t;t=t.getParentOrThrow()}return t}function pn(e){return lo(e)||re(e)&&e.isShadowRoot()}function Jy(e){let t=e.constructor.clone(e);return aP(t,null),t.afterCloneFrom(e),t}function wc(e){let t=mt(),o=e.getType(),n=zy(t,o);n===void 0&&le(200,e.constructor.name,o);let{replace:r,replaceWithKlass:a}=n;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||le(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,o):s instanceof e.constructor&&i!==e.constructor||le(202,i.name,i.getType(),e.constructor.name,o),s.__key===e.__key&&le(203,e.constructor.name,o,i.name,i.getType()),s}return e}function Uh(e,t){!lo(e.getParent())||re(t)||yt(t)||le(99)}function hP(e){let t=Vt(e);return t===null&&le(63,e),t}function $h(e){return(yt(e)||re(e)&&!e.canBeEmpty())&&!e.isInline()}function fy(e,t,o){o.style.removeProperty("caret-color"),t._blockCursorElement=null;let n=e.parentElement;n!==null&&n.removeChild(e)}function Mn(e){return En?(e||window).getSelection():null}function yP(e){let t=Yy(e);return t?t.getSelection():null}function L5(e,t){let o=e.getChildAtIndex(t);o==null&&(o=e),pn(e)&&le(102);let n=s=>{let i=s.getParentOrThrow(),d=pn(i),c=s!==o||d?Jy(s):s;if(d)return re(s)&&re(c)||le(133),s.insertAfter(c),[s,c,c];{let[u,m,p]=n(i),f=s.getNextSiblings();return p.append(c,...f),[u,m,c]}},[r,a]=n(o);return[r,a]}function P5(e){return ko(e)&&e.tagName==="A"}function ko(e){return qi(e)&&e.nodeType===1}function qi(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function vP(e){return qi(e)&&e.nodeType===11}function CP(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 gy(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 kr(e){if(yt(e)&&!e.isInline())return!0;if(!re(e)||pn(e))return!1;let t=e.getFirstChild(),o=t===null||cs(t)||ke(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Zy(){return mt()}var W0=new WeakMap,R5=new Map;function hy(e){if(!e._readOnly&&e.isEmpty())return R5;e._readOnly||le(192);let t=W0.get(e);return t||(t=(function(o){let n=new Map;for(let[r,a]of o._nodeMap){let s=a.__type,i=n.get(s);i||(i=new Map,n.set(s,i)),i.set(r,a)}return n})(e),W0.set(e,t)),t}function ev(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function E5(e){return(t=ev(e))[_L]=!0,t;var t}function xP(e,t){let o=parseInt(e.style.paddingInlineStart,10)||0,n=Math.round(o/40);t.setIndent(n)}function M5(e){e.__lexicalUnmanaged=!0}function bP(e){return e.__lexicalUnmanaged===!0}function Jd(e,t){return(function(o,n){return Object.prototype.hasOwnProperty.call(o,n)})(e,t)&&e[t]!==un[t]}function Tc(e){let t=n0 in e.prototype?e.prototype[n0]():void 0,o=(function(s){if(!(s===un||s.prototype instanceof un)){let i="<unknown>",d="<unknown>";try{i=s.getType()}catch{}try{ua.version&&(d=JSON.parse(ua.version))}catch{}le(290,s.name,i,d)}return s===mc||s===ca||s===un})(e),n=!o&&Jd(e,"getType")?e.getType():void 0,r,a=n;if(t)if(n)r=t[n];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!o&&a&&(Jd(e,"getType")||(e.getType=()=>a),Jd(e,"clone")||(e.clone=s=>(Uy(s),new e)),Jd(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!Jd(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function A5(e){let t=Zy();return no(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var nc=(e,t)=>{let o=e;for(;o!=null&&!lo(o);){if(t(o))return o;o=o.getParent()}return null},N5={next:"previous",previous:"next"},Bi=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return nv({hasNext:hs,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return io(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return io(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,o){let n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(n===null?this.insert(t):n.replace(t,o)),this}splice(t,o,n="next"){let r=n===this.direction?o:Array.from(o).reverse(),a=this,s=this.getParentAtCaret(),i=new Map;for(let d=a.getAdjacentCaret();d!==null&&i.size<t;d=d.getAdjacentCaret()){let c=d.origin.getWritable();i.set(c.getKey(),c)}for(let d of r){if(i.size>0){let c=a.getNodeAtCaret();if(c){if(i.delete(c.getKey()),i.delete(d.getKey()),!(c.is(d)||a.origin.is(d))){let u=d.getParent();u&&u.is(s)&&d.remove(),c.replace(d)}}else c===null&&le(263,Array.from(i).join(" "))}else a.insert(d);a=io(d,this.direction)}for(let d of i.values())d.remove();return this}},hc=class e extends Bi{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Rr(t,this.direction)}getParentCaret(t="root"){return io(tv(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ha(this.direction);return io(this.getNodeAtCaret(),t)||Rr(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)}},D5={root:lo,shadowRoot:pn};function ha(e){return N5[e]}function tv(e,t="root"){return D5[t](e)?null:e}var Hi=class e extends Bi{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:io(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return re(this.origin)?Rr(this.origin,this.direction):null}getParentCaret(t="root"){return io(tv(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ha(this.direction);return io(this.getNodeAtCaret(),t)||Rr(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 Ui)&&this.direction===t.direction&&this.origin.is(t.origin)}},Ui=class e extends Bi{type="text";offset;constructor(t,o){super(t),this.offset=o}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:pa(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return io(tv(this.getParentAtCaret(),t),this.direction)}getFlipped(){return pa(this.origin,ha(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 Hi||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return io(this.origin,this.direction)}};function Pr(e){return e instanceof Ui}function _5(e){return e instanceof Bi}function hs(e){return e instanceof Hi}function Ln(e){return e instanceof hc}var O5={next:class extends Ui{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ui{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},F5={next:class extends Hi{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Hi{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},B5={next:class extends hc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends hc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function io(e,t){return e?new F5[t](e):null}function pa(e,t,o){return e?new O5[t](e,Pn(e,o)):null}function Pn(e,t,o="error"){let n=e.getTextContentSize(),r=t==="next"?n:t==="previous"?0:t;return(r<0||r>n)&&(o!=="clamp"&&V0(284,String(t),String(n),e.getKey()),r=r<0?0:n),r}function yy(e,t){return new Tm(e,t)}function Rr(e,t){return re(e)?new B5[t](e):null}function wP(e){return e&&e.getChildCaret()||e}function $i(e){return e&&wP(e.getAdjacentCaret())}var vy=class e{type="node-caret-range";direction;anchor;focus;constructor(t,o,n){this.anchor=t,this.focus=o,this.direction=n}getLatest(){let t=this.anchor.getLatest(),o=this.focus.getLatest();return t===this.anchor&&o===this.focus?this:new e(t,o,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Pr(a)?(function(s,i){let{direction:d,origin:c}=s,u=Pn(c,i==="focus"?ha(d):d);return yy(s,u-s.offset)})(a,r):null},o=t("anchor"),n=t("focus");if(o&&n){let{caret:r}=o,{caret:a}=n;if(r.isSameNodeCaret(a))return[yy(r,a.offset-r.offset),null]}return[o,n]}iterNodeCarets(t="root"){let o=Pr(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Pr(n),a=s=>s.isSameNodeCaret(n)?null:$i(s)||s.getParentCaret(t);return nv({hasNext:s=>s!==null&&!(r&&n.isSameNodeCaret(s)),initial:o.isSameNodeCaret(n)?null:a(o),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Tm=class{type="slice";caret;distance;constructor(t,o){this.caret=t,this.distance=o}getSliceIndices(){let{distance:t,caret:{offset:o}}=this,n=o+t;return n<o?[n,o]:[o,n]}getTextContent(){let[t,o]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,o)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:o}}=this,[n,r]=this.getSliceIndices(),a=t.getTextContent();return pa(t.setTextContent(a.slice(0,n)+a.slice(r)),o,n)}};function H5(e){return e instanceof Tm}function ov(e){return ma(e,io(Yo(),e.direction))}function TP(e){return ma(e,e)}function ma(e,t){return e.direction!==t.direction&&le(265),new vy(e,t,e.direction)}function nv(e){let{initial:t,hasNext:o,step:n,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!o(a))return{done:!0,value:void 0};let s={done:!1,value:r(a)};return a=n(a),s}}}function rv(e,t){let o=rc(e.origin,t.origin);switch(o===null&&le(275,e.origin.getKey(),t.origin.getKey()),o.type){case"same":{let n=e.type==="text",r=t.type==="text";return n&&r?(function(a,s){return Math.sign(a-s)})(e.offset,t.offset):e.type===t.type?0:n?-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 av(o)}}function av(e){let{a:t,b:o}=e,n=t.__key,r=o.__key,a=t,s=o;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===n)return 1}return a===null?1:-1}function Zp(e,t){return t.is(e)}function G0(e){return re(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function rc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let o=new Map;for(let[n,r]=G0(e);n;r=n,n=n.getParent())o.set(n,r);for(let[n,r]=G0(t);n;r=n,n=n.getParent()){let a=o.get(n);if(a!==void 0)return a===null?(Zp(e,n)||le(276),{commonAncestor:n,type:"ancestor"}):r===null?(Zp(t,n)||le(277),{commonAncestor:n,type:"descendant"}):((re(a)||Zp(e,a))&&(re(r)||Zp(t,r))&&n.is(a.getParent())&&n.is(r.getParent())||le(278),{a,b:r,commonAncestor:n,type:"branch"})}return null}function fa(e,t){let{type:o,key:n,offset:r}=e,a=hP(e.key);return o==="text"?(ke(a)||le(266,a.getType(),n),pa(a,t,r)):(re(a)||le(267,a.getType(),n),LP(a,e.offset,t))}function zi(e,t){let{origin:o,direction:n}=t,r=n==="next";Pr(t)?e.set(o.getKey(),t.offset,"text"):hs(t)?ke(o)?e.set(o.getKey(),Pn(o,n),"text"):e.set(o.getParentOrThrow().getKey(),o.getIndexWithinParent()+(r?1:0),"element"):(Ln(t)&&re(o)||le(268),e.set(o.getKey(),r?0:o.getChildrenSize(),"element"))}function IP(e){let t=Je(),o=Oe(t)?t:GL();return ac(o,e),$o(o),o}function ac(e,t){zi(e.anchor,t.anchor),zi(e.focus,t.focus)}function Cy(e){let{anchor:t,focus:o}=e,n=fa(t,"next"),r=fa(o,"next"),a=rv(n,r)<=0?"next":"previous";return ma(ga(n,a),ga(r,a))}function Wi(e){let{direction:t,origin:o}=e,n=io(o,ha(t)).getNodeAtCaret();return n?io(n,t):Rr(o.getParentOrThrow(),t)}function j0(e,t="root"){let o=[e];for(let n=Ln(e)?e.getParentCaret(t):e.getSiblingCaret();n!==null;n=n.getParentCaret(t))o.push(Wi(n));return o}function zh(e){return!!e&&e.origin.isAttached()}function SP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let o="root",n="next",r=t,a=sv(e,n),s=j0(a.anchor,o),i=j0(a.focus.getFlipped(),o),d=new Set,c=[];for(let g of a.iterNodeCarets(o))if(Ln(g))d.add(g.origin.getKey());else if(hs(g)){let{origin:h}=g;re(h)&&!d.has(h.getKey())||c.push(h)}for(let g of c)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,y=h.getTextContentSize(),x=Wi(io(h,n)),C=h.getMode();if(Math.abs(g.distance)===y&&r==="removeEmptySlices"||C==="token"&&g.distance!==0)x.remove();else if(g.distance!==0){r="removeEmptySlices";let b=g.removeTextSlice(),L=g.caret.origin;if(C==="segmented"){let w=b.origin,k=oo(w.getTextContent()).setStyle(w.getStyle()).setFormat(w.getFormat());x.replaceOrInsert(k),b=pa(k,n,b.offset)}L.is(s[0].origin)&&(s[0]=b),L.is(i[0].origin)&&(i[0]=b.getFlipped())}}let u,m;for(let g of s)if(zh(g)){u=Sn(g);break}for(let g of i)if(zh(g)){m=Sn(g);break}let p=(function(g,h,y){if(!g||!h)return null;let x=g.getParentAtCaret(),C=h.getParentAtCaret();if(!x||!C)return null;let b=x.getParents().reverse();b.push(x);let L=C.getParents().reverse();L.push(C);let w=Math.min(b.length,L.length),k;for(k=0;k<w&&b[k]===L[k];k++);let I=(P,A)=>{let N;for(let B=k;B<P.length;B++){let O=P[B];if(pn(O))return;!N&&A(O)&&(N=O)}return N},T=I(b,kr),S=T&&I(L,P=>y.has(P.getKey())&&kr(P));return T&&S?[T,S]:null})(u,m,d);if(p){let[g,h]=p;Rr(g,"previous").splice(0,h.getChildren());let y=h.getParent();for(h.remove(!0);y&&y.isEmpty();){let x=y;y=y.getParent(),x.remove(!0)}}let f=[u,m,...s,...i].find(zh);if(f)return TP(ga(Sn(f),e.direction));le(269,JSON.stringify(s.map(g=>g.origin.__key)))}function Sn(e){let t=(function(r){let a=r;for(;Ln(a);){let s=$i(a);if(!Ln(s))break;a=s}return a})(e.getLatest()),{direction:o}=t;if(ke(t.origin))return Pr(t)?t:pa(t.origin,o,o);let n=t.getAdjacentCaret();return hs(n)&&ke(n.origin)?pa(n.origin,o,ha(o)):t}function kP(e){return Pr(e)&&e.offset!==Pn(e.origin,e.direction)}function ga(e,t){return e.direction===t?e:e.getFlipped()}function sv(e,t){return e.direction===t?e:ma(ga(e.focus,t),ga(e.anchor,t))}function LP(e,t,o){let n=Rr(e,"next");for(let r=0;r<t;r++){let a=n.getAdjacentCaret();if(a===null)break;n=a}return ga(n,o)}function U5(e,t="root"){let o=0,n=e,r=$i(n);for(;r===null;){if(o--,r=n.getParentCaret(t),!r)return null;n=r,r=$i(n)}return r&&[r,o]}function $5(e){let{origin:t,offset:o,direction:n}=e;if(o===Pn(t,n))return e.getSiblingCaret();if(o===Pn(t,ha(n)))return Wi(e.getSiblingCaret());let[r]=t.splitText(o);return ke(r)||le(281),ga(io(r,"next"),n)}function z5(e,t){return!0}function K5(e,{$copyElementNode:t=Jy,$splitTextPointCaretNext:o=$5,rootMode:n="shadowRoot",$shouldSplit:r=z5}={}){if(Pr(e))return o(e);let a=e.getParentCaret(n);if(a){let{origin:s}=a;if(Ln(e)&&(!s.canBeEmpty()||!r(s,"first")))return Wi(a);let i=(function(d){let c=[];for(let u=d.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function q5(e){return e}function W5(...e){return e}function G5(e,t){return[e,t]}function j5(e){return e}function V5(e,t){if(!t||e===t)return e;for(let o in t)if(e[o]!==t[o])return{...e,...t};return e}function Ic(...e){let t=[];for(let o of e)if(o&&typeof o=="string")for(let[n]of o.matchAll(/\S+/g))t.push(n);return t}function Q5(e,...t){let o=Ic(...t);o.length>0&&e.classList.add(...o)}function X5(e,...t){let o=Ic(...t);o.length>0&&e.classList.remove(...o)}function Y5(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var _=iv,Xle=_.$addUpdateTag,ya=_.$applyNodeReplacement,Gi=_.$caretFromPoint,PP=_.$caretRangeFromSelection,_m=_.$cloneWithProperties,RP=_.$cloneWithPropertiesEphemeral,Yle=_.$comparePointCaretNext,Jle=_.$copyNode,EP=_.$create,vs=_.$createLineBreakNode,MP=_.$createNodeSelection,mn=_.$createParagraphNode,Zle=_.$createPoint,Cs=_.$createRangeSelection,AP=_.$createRangeSelectionFromDom,NP=_.$createTabNode,An=_.$createTextNode,DP=_.$extendCaretToRange,Mr=_.$findMatchingParent,lv=_.$getAdjacentChildCaret,ede=_.$getAdjacentNode,xs=_.$getAdjacentSiblingOrParentSiblingCaret,dv=_.$getCaretInDirection,_P=_.$getCaretRange,tde=_.$getCaretRangeInDirection,OP=_.$getCharacterOffsets,va=_.$getChildCaret,ode=_.$getChildCaretAtIndex,cv=_.$getChildCaretOrSelf,FP=_.$getCollapsedCaretRange,nde=_.$getCommonAncestor,rde=_.$getCommonAncestorResultBranchOrder,Om=_.$getEditor,ade=_.$getNearestNodeFromDOMNode,sde=_.$getNearestRootOrShadowRoot,Ca=_.$getNodeByKey,ide=_.$getNodeByKeyOrThrow,BP=_.$getNodeFromDOMNode,Sc=_.$getPreviousSelection,Ye=_.$getRoot,Te=_.$getSelection,Ar=_.$getSiblingCaret,Fm=_.$getState,lde=_.$getStateChange,dde=_.$getTextContent,cde=_.$getTextNodeOffset,ude=_.$getTextPointCaret,pde=_.$getTextPointCaretSlice,mde=_.$getWritableNodeState,HP=_.$hasAncestor,fde=_.$hasUpdateTag,gde=_.$insertNodes,ji=_.$isBlockElementNode,kc=_.$isChildCaret,Bm=_.$isDecoratorNode,UP=_.$isEditorState,_e=_.$isElementNode,$P=_.$isExtendableTextPointCaret,hde=_.$isInlineElementOrDecoratorNode,zP=_.$isLeafNode,Lc=_.$isLineBreakNode,yde=_.$isNodeCaret,uv=_.$isNodeSelection,KP=_.$isParagraphNode,ye=_.$isRangeSelection,Pc=_.$isRootNode,bs=_.$isRootOrShadowRoot,qP=_.$isSiblingCaret,vde=_.$isTabNode,Ke=_.$isTextNode,Hm=_.$isTextPointCaret,Cde=_.$isTextPointCaretSlice,pv=_.$isTokenOrSegmented,xde=_.$isTokenOrTab,bde=_.$nodesOfType,WP=_.$normalizeCaret,GP=_.$normalizeSelection__EXPERIMENTAL,wde=_.$onUpdate,jP=_.$parseSerializedNode,Tde=_.$removeTextFromCaretRange,VP=_.$rewindSiblingCaret,Um=_.$selectAll,Ide=_.$setCompositionKey,Sde=_.$setPointFromCaret,fn=_.$setSelection,QP=_.$setSelectionFromCaretRange,$m=_.$setState,XP=_.$splitAtPointCaretNext,YP=_.$splitNode,kde=_.$updateRangeSelectionFromCaretRange,mv=_.ArtificialNode__DO_NOT_USE,Lde=_.BEFORE_INPUT_COMMAND,JP=_.BLUR_COMMAND,Rc=_.CAN_REDO_COMMAND,Ec=_.CAN_UNDO_COMMAND,zm=_.CLEAR_EDITOR_COMMAND,ZP=_.CLEAR_HISTORY_COMMAND,eR=_.CLICK_COMMAND,Pde=_.COLLABORATION_TAG,Km=_.COMMAND_PRIORITY_CRITICAL,vt=_.COMMAND_PRIORITY_EDITOR,Zo=_.COMMAND_PRIORITY_HIGH,Vi=_.COMMAND_PRIORITY_LOW,Rde=_.COMMAND_PRIORITY_NORMAL,Ede=_.COMPOSITION_END_COMMAND,tR=_.COMPOSITION_END_TAG,Mde=_.COMPOSITION_START_COMMAND,oR=_.COMPOSITION_START_TAG,nR=_.CONTROLLED_TEXT_INSERTION_COMMAND,qm=_.COPY_COMMAND,rR=_.CUT_COMMAND,Wm=_.DELETE_CHARACTER_COMMAND,aR=_.DELETE_LINE_COMMAND,sR=_.DELETE_WORD_COMMAND,Ade=_.DRAGEND_COMMAND,Nde=_.DRAGOVER_COMMAND,iR=_.DRAGSTART_COMMAND,lR=_.DROP_COMMAND,xa=_.DecoratorNode,Dde=_.ElementNode,dR=_.FOCUS_COMMAND,_de=_.FORMAT_ELEMENT_COMMAND,cR=_.FORMAT_TEXT_COMMAND,Gm=_.HISTORIC_TAG,zo=_.HISTORY_MERGE_TAG,uR=_.HISTORY_PUSH_TAG,fv=_.INDENT_CONTENT_COMMAND,Ode=_.INPUT_COMMAND,gv=_.INSERT_LINE_BREAK_COMMAND,pR=_.INSERT_PARAGRAPH_COMMAND,mR=_.INSERT_TAB_COMMAND,Mc=_.INTERNAL_$isBlock,Fde=_.IS_ALL_FORMATTING,Bde=_.IS_BOLD,Hde=_.IS_CODE,Ude=_.IS_HIGHLIGHT,$de=_.IS_ITALIC,zde=_.IS_STRIKETHROUGH,Kde=_.IS_SUBSCRIPT,qde=_.IS_SUPERSCRIPT,Wde=_.IS_UNDERLINE,fR=_.KEY_ARROW_DOWN_COMMAND,jm=_.KEY_ARROW_LEFT_COMMAND,Vm=_.KEY_ARROW_RIGHT_COMMAND,gR=_.KEY_ARROW_UP_COMMAND,Qm=_.KEY_BACKSPACE_COMMAND,Xm=_.KEY_DELETE_COMMAND,hR=_.KEY_DOWN_COMMAND,Ym=_.KEY_ENTER_COMMAND,yR=_.KEY_ESCAPE_COMMAND,Gde=_.KEY_MODIFIER_COMMAND,jde=_.KEY_SPACE_COMMAND,Jm=_.KEY_TAB_COMMAND,vR=_.LineBreakNode,Vde=_.MOVE_TO_END,Qde=_.MOVE_TO_START,Xde=_.NODE_STATE_KEY,CR=_.OUTDENT_CONTENT_COMMAND,Zm=_.PASTE_COMMAND,xR=_.PASTE_TAG,bR=_.ParagraphNode,wR=_.REDO_COMMAND,TR=_.REMOVE_TEXT_COMMAND,IR=_.RootNode,Yde=_.SELECTION_CHANGE_COMMAND,SR=_.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,kR=_.SELECT_ALL_COMMAND,Jde=_.SKIP_COLLAB_TAG,LR=_.SKIP_DOM_SELECTION_TAG,hv=_.SKIP_SCROLL_INTO_VIEW_TAG,Zde=_.SKIP_SELECTION_FOCUS_TAG,PR=_.TEXT_TYPE_TO_FORMAT,RR=_.TabNode,ef=_.TextNode,ER=_.UNDO_COMMAND,Ac=_.addClassNamesToElement,ece=_.buildImportMap,tf=_.configExtension,MR=_.createCommand,of=_.createEditor,tce=_.createSharedNodeState,AR=_.createState,NR=_.declarePeerDependency,zt=_.defineExtension,oce=_.flipDirection,nce=_.getDOMOwnerDocument,yv=_.getDOMSelection,rce=_.getDOMSelectionFromTarget,DR=_.getDOMTextNode,ace=_.getEditorPropertyFromDOMNode,sce=_.getNearestEditorFromDOMNode,_R=_.getRegisteredNode,ice=_.getRegisteredNodeOrThrow,lce=_.getStaticNodeConfig,dce=_.getTextDirection,cce=_.getTransformSetFromKlass,OR=_.isBlockDomNode,uce=_.isCurrentlyReadOnlyMode,FR=_.isDOMDocumentNode,BR=_.isDOMNode,pce=_.isDOMTextNode,mce=_.isDOMUnmanaged,vv=_.isDocumentFragment,fce=_.isExactShortcutMatch,HR=_.isHTMLAnchorElement,nf=_.isHTMLElement,Nc=_.isInlineDomNode,gce=_.isLexicalEditor,hce=_.isModifierMatch,yce=_.isSelectionCapturedInDecoratorInput,UR=_.isSelectionWithinEditor,Cv=_.makeStepwiseIterator,rr=_.mergeRegister,vce=_.normalizeClassNames,rf=_.removeClassNamesFromElement,Cce=_.removeFromParent,xce=_.resetRandomKey,Nn=_.safeCast,bce=_.setDOMUnmanaged,wce=_.setNodeIndentFromDOM,af=_.shallowMergeConfig,xv=_.toggleTextFormatType;var bv={};Ut(bv,{LexicalComposer:()=>Z5});$();var $R=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,J5=$R?fe:H,sf={tag:zo};function Z5({initialConfig:e,children:t}){let o=W(()=>{let{theme:n,namespace:r,nodes:a,onError:s,editorState:i,html:d}=e,c=o0(null,n),u=of({editable:e.editable,html:d,namespace:r,nodes:a,onError:m=>s(m,u),theme:n});return(function(m,p){if(p!==null){if(p===void 0)m.update(()=>{let f=Ye();if(f.isEmpty()){let g=mn();f.append(g);let h=$R?document.activeElement:null;(Te()!==null||h!==null&&h===m.getRootElement())&&g.select()}},sf);else if(p!==null)switch(typeof p){case"string":{let f=m.parseEditorState(p);m.setEditorState(f,sf);break}case"object":m.setEditorState(p,sf);break;case"function":m.update(()=>{Ye().isEmpty()&&p(m)},sf)}}})(u,i),[u,c]},[]);return J5(()=>{let n=e.editable,[r]=o;r.setEditable(n===void 0||n)},[]),l(t0.Provider,{value:o,children:t})}var eq=bv,zR=eq.LexicalComposer;var Tv={};Ut(Tv,{$canShowPlaceholder:()=>qR,$canShowPlaceholderCurry:()=>oq,$findTextIntersectionFromCharacters:()=>nq,$isRootTextContentEmpty:()=>wv,$isRootTextContentEmptyCurry:()=>tq,$rootTextContent:()=>KR,registerLexicalTextEntity:()=>aq});function KR(){return Ye().getTextContent()}function wv(e,t=!0){if(e)return!1;let o=KR();return t&&(o=o.trim()),o===""}function tq(e,t){return()=>wv(e,t)}function qR(e){if(!wv(e,!1))return!1;let t=Ye().getChildren(),o=t.length;if(o>1)return!1;for(let n=0;n<o;n++){let r=t[n];if(Bm(r))return!1;if(_e(r)){if(!KP(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let d=a[n];if(!Ke(d))return!1}}}return!0}function oq(e){return()=>qR(e)}function nq(e,t){let o=e.getFirstChild(),n=0;e:for(;o!==null;){if(_e(o)){let s=o.getFirstChild();if(s!==null){o=s;continue}}else if(Ke(o)){let s=o.getTextContentSize();if(n+s>t)return{node:o,offset:t-n};n+=s}let r=o.getNextSibling();if(r!==null){o=r;continue}let a=o.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){o=s;continue e}a=a.getParent()}break}return null}function rq(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function aq(e,t,o,n){let r=s=>s instanceof o,a=s=>{let i=An(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(ef,s=>{if(!s.isSimpleText())return;let i,d=s.getPreviousSibling(),c=s.getTextContent(),u=s;if(Ke(d)){let p=d.getTextContent(),f=t(p+c);if(r(d)){if(f===null||(g=>g.getLatest().__mode)(d)!==0)return void a(d);{let g=f.end-p.length;if(g>0){let h=p+c.slice(0,g);if(d.select(),d.setTextContent(h),g===c.length)s.remove();else{let y=c.slice(g);s.setTextContent(y)}return}}}else if(f===null||f.start<p.length)return}let m=0;for(;;){i=t(c);let p,f=i===null?"":c.slice(i.end);if(c=f,f===""){let h=u.getNextSibling();if(Ke(h)){f=u.getTextContent()+h.getTextContent();let y=t(f);if(y===null)return void(r(h)?a(h):h.markDirty());if(y.start!==0)return}}if(i===null)return;if(i.start===0&&Ke(d)&&d.isTextEntity()){m+=i.end;continue}i.start===0?[p,u]=u.splitText(i.end):[,p,u]=u.splitText(i.start+m,i.end+m),p===void 0&&rq(165,"nodeToReplace");let g=n(p);if(g.setFormat(p.getFormat()),p.replace(g),u==null)return;m=0,d=g}}),e.registerNodeTransform(o,s=>{let i=s.getTextContent(),d=t(i);if(d===null||d.start!==0)return void a(s);if(i.length>d.end)return void s.splitText(d.end);let c=s.getPreviousSibling();Ke(c)&&c.isTextEntity()&&(a(c),a(s));let u=s.getNextSibling();Ke(u)&&u.isTextEntity()&&(a(u),r(s)&&a(s))})]}var ws=Tv,Ece=ws.$canShowPlaceholder,lf=ws.$canShowPlaceholderCurry,Mce=ws.$findTextIntersectionFromCharacters,Ace=ws.$isRootTextContentEmpty,Nce=ws.$isRootTextContentEmptyCurry,Dce=ws.$rootTextContent,_ce=ws.registerLexicalTextEntity;var Rv={};Ut(Rv,{$addNodeStyle:()=>uq,$cloneWithProperties:()=>_m,$copyBlockFormatIndent:()=>ZR,$ensureForwardRangeSelection:()=>JR,$forEachSelectedTextNode:()=>YR,$getComputedStyleForElement:()=>kv,$getComputedStyleForParent:()=>Lv,$getSelectionStyleValueForProperty:()=>Cq,$isAtNodeEnd:()=>cq,$isParentElementRTL:()=>Pv,$isParentRTL:()=>lq,$moveCaretSelection:()=>oE,$moveCharacter:()=>yq,$patchStyleText:()=>pq,$selectAll:()=>Um,$setBlocksType:()=>mq,$shouldOverrideDefaultCharacterSelection:()=>hq,$sliceSelectedTextNodeContent:()=>dq,$trimTextContentFromAnchor:()=>XR,$wrapNodes:()=>gq,createDOMRange:()=>sq,createRectsFromDOMRange:()=>iq,getCSSFromStyleObject:()=>QR,getStyleObjectFromCSS:()=>uf,trimTextContentFromAnchor:()=>xq});function Sv(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var cf=new Map;function WR(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function GR(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function sq(e,t,o,n,r){let a=t.getKey(),s=n.getKey(),i=document.createRange(),d=e.getElementByKey(a),c=e.getElementByKey(s),u=o,m=r;if(Ke(t)&&(d=WR(d)),Ke(n)&&(c=WR(c)),t===void 0||n===void 0||d===null||c===null)return null;d.nodeName==="BR"&&([d,u]=GR(d)),c.nodeName==="BR"&&([c,m]=GR(c));let p=d.firstChild;d===c&&p!=null&&p.nodeName==="BR"&&u===0&&m===0&&(m=1);try{i.setStart(d,u),i.setEnd(c,m)}catch{return null}return!i.collapsed||u===m&&a===s||(i.setStart(c,m),i.setEnd(d,u)),i}function iq(e,t){let o=e.getRootElement();if(o===null)return[];let n=o.getBoundingClientRect(),r=getComputedStyle(o),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,d=s.length;s.sort((c,u)=>{let m=c.top-u.top;return Math.abs(m)<=3?c.left-u.left:m});for(let c=0;c<d;c++){let u=s[c],m=i&&i.top<=u.top&&i.top+i.height>u.top&&i.left+i.width>u.left,p=u.width+a===n.width;m||p?(s.splice(c--,1),d--):i=u}return s}function VR(e){let t={};if(!e)return t;let o=e.split(";");for(let n of o)if(n!==""){let[r,a]=n.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function uf(e){let t=cf.get(e);return t===void 0&&(t=VR(e),cf.set(e,t)),t}function QR(e){let t="";for(let o in e)o&&(t+=`${o}: ${e[o]};`);return t}function kv(e){let t=Om().getElementByKey(e.getKey());if(t===null)return null;let o=t.ownerDocument.defaultView;return o===null?null:o.getComputedStyle(t)}function Lv(e){return kv(Pc(e)?e:e.getParentOrThrow())}function lq(e){let t=Lv(e);return t!==null&&t.direction==="rtl"}function dq(e,t,o="self"){let n=e.getStartEndPoints();if(t.isSelected(e)&&!pv(t)&&n!==null){let[r,a]=n,s=e.isBackward(),i=r.getNode(),d=a.getNode(),c=t.is(i),u=t.is(d);if(c||u){let[m,p]=OP(e),f=i.is(d),g=t.is(s?d:i),h=t.is(s?i:d),y,x=0;f?(x=m>p?p:m,y=m>p?m:p):g?(x=s?p:m,y=void 0):h&&(x=0,y=s?m:p);let C=t.__text.slice(x,y);C!==t.__text&&(o==="clone"&&(t=RP(t)),t.__text=C)}}return t}function cq(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return _e(t)||Sv(177),e.offset===t.getChildrenSize()}function XR(e,t,o){let n=t.getNode(),r=o;if(_e(n)){let a=n.getDescendantByIndex(t.offset);a!==null&&(n=a)}for(;r>0&&n!==null;){if(_e(n)){let c=n.getLastDescendant();c!==null&&(n=c)}let a=n.getPreviousSibling(),s=0;if(a===null){let c=n.getParentOrThrow(),u=c.getPreviousSibling();for(;u===null;){if(c=c.getParent(),c===null){a=null;break}u=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,a=u)}let i=n.getTextContent();i===""&&_e(n)&&!n.isInline()&&(i=`
|
|
3578
3561
|
|
|
3579
|
-
`);let d=i.length;if(!Ke(n)||r>=d){let c=n.getParent();n.remove(),c==null||c.getChildrenSize()!==0||Pc(c)||c.remove(),r-=d+s,n=a}else{let c=n.getKey(),u=e.getEditorState().read(()=>{let f=Ta(c);return Ke(f)&&f.isSimpleText()?f.getTextContent():null}),m=d-r,p=i.slice(0,m);if(u!==null&&u!==i){let f=Lc(),g=n;if(n.isSimpleText())n.setTextContent(u);else{let h=Fn(u);n.replace(h),g=h}if(ye(f)&&f.isCollapsed()){let h=f.anchor.offset;g.select(h,h)}}else if(n.isSimpleText()){let f=t.key===c,g=t.offset;g<r&&(g=d);let h=f?g-r:0,y=f?g:m;if(f&&h===0){let[x]=n.splitText(h,y);x.remove()}else{let[,x]=n.splitText(h,y);x.remove()}}else{let f=Fn(p);n.replace(f)}r=0}}}function nq(e){let t=e.getStyle(),o=WP(t);gf.set(t,o)}function ff(e,t){(ye(e)?e.isCollapsed():Ke(e)||_e(e))||Pv(280);let o=hf(ye(e)?e.style:Ke(e)?e.getStyle():e.getTextStyle()),n=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(o[s],e):i===null?delete a[s]:a[s]=i,a),{...o}),r=GP(n);ye(e)||Ke(e)?e.setStyle(r):e.setTextStyle(r),gf.set(r,n)}function rq(e,t){if(ye(e)&&e.isCollapsed()){ff(e,t);let n=e.anchor.getNode();_e(n)&&n.isEmpty()&&ff(n,t)}VP(n=>{ff(n,t)});let o=e.getNodes();if(o.length>0){let n=new Set;for(let r of o){if(!_e(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();n.has(a)||(n.add(a),ff(r,t))}}}function VP(e){let t=Te();if(!t)return;let o=new Map,n=a=>o.get(a.getKey())||[0,a.getTextContentSize()];if(ye(t))for(let a of SR(t).getTextSlices())a&&o.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!Ke(a)||!a.canHaveFormat())continue;let[s,i]=n(a);i!==s&&(hv(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}ye(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&QP(t)}function QP(e){if(e.isBackward()){let{anchor:t,focus:o}=e,{key:n,offset:r,type:a}=t;t.set(o.key,o.offset,o.type),o.set(n,r,a)}}function XP(e,t){let o=e.getFormatType(),n=e.getIndent();o!==t.getFormatType()&&t.setFormat(o),n!==t.getIndent()&&t.setIndent(n)}function aq(e,t,o=XP){if(e===null)return;let n=e.getStartEndPoints(),r=new Map,a=null;if(n){let[s,i]=n;a=Ts(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let d=Nr(s.getNode(),Ac),c=Nr(i.getNode(),Ac);_e(d)&&r.set(d.getKey(),d),_e(c)&&r.set(c.getKey(),c)}for(let s of e.getNodes())if(_e(s)&&Ac(s))r.set(s.getKey(),s);else if(n===null){let i=Nr(s,Ac);_e(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let d=t();o(i,d),i.replace(d,!0),a&&(s===a.anchor.key&&a.anchor.set(d.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(d.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Te())&&yn(a)}function qP(e){return e.getNode().isAttached()}function sq(e){let t=e;for(;t!==null&&!Ss(t);){let o=t.getLatest(),n=t.getParent();o.getChildrenSize()===0&&t.remove(!0),t=n}}function iq(e,t,o=null){let n=e.getStartEndPoints(),r=n?n[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),u=c.getChildren(),m=t();return m.setFormat(c.getFormatType()),m.setIndent(c.getIndent()),u.forEach(p=>m.append(p)),o&&(m=o.append(m)),void c.replace(m)}let i=null,d=[];for(let c=0;c<s;c++){let u=a[c];Ss(u)?(Rv(e,d,d.length,t,o),d=[],i=u):i===null||i!==null&&OR(u,i)?d.push(u):(Rv(e,d,d.length,t,o),d=[u])}Rv(e,d,d.length,t,o)}function Rv(e,t,o,n,r=null){if(t.length===0)return;let a=t[0],s=new Map,i=[],d=_e(a)?a:a.getParentOrThrow();d.isInline()&&(d=d.getParentOrThrow());let c=!1;for(;d!==null;){let g=d.getPreviousSibling();if(g!==null){d=g,c=!0;break}if(d=d.getParentOrThrow(),Ss(d))break}let u=new Set;for(let g=0;g<o;g++){let h=t[g];_e(h)&&h.getChildrenSize()===0&&u.add(h.getKey())}let m=new Set;for(let g=0;g<o;g++){let h=t[g],y=h.getParent();if(y!==null&&y.isInline()&&(y=y.getParent()),y!==null&&HR(h)&&!m.has(h.getKey())){let x=y.getKey();if(s.get(x)===void 0){let C=n();C.setFormat(y.getFormatType()),C.setIndent(y.getIndent()),i.push(C),s.set(x,C),y.getChildren().forEach(b=>{C.append(b),m.add(b.getKey()),_e(b)&&b.getChildrenKeys().forEach(L=>m.add(L))}),sq(y)}}else if(u.has(h.getKey())){_e(h)||Pv(179);let x=n();x.setFormat(h.getFormatType()),x.setIndent(h.getIndent()),i.push(x),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(Ss(d))if(c)if(r!==null)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h)}else{let g=d.getFirstChild();if(_e(g)&&(d=g),g===null)if(r)d.append(r);else for(let h=0;h<i.length;h++){let y=i[h];d.append(y),p=y}else if(r!==null)g.insertBefore(r);else for(let h=0;h<i.length;h++){let y=i[h];g.insertBefore(y),p=y}}else if(r)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h),p=h}let f=Lc();ye(f)&&qP(f.anchor)&&qP(f.focus)?yn(f.clone()):p!==null?p.selectEnd():e.dirty=!0}function YP(e){let t=JP(e);return t!==null&&t.writingMode==="vertical-rl"}function JP(e){let t=e.anchor.getNode();return _e(t)?Ev(t):Mv(t)}function lq(e,t){let o=YP(e)?!t:t;Av(e)&&(o=!o);let n=Qi(e.focus,o?"previous":"next");if(BR(n))return!1;for(let r of MR(n)){if(Rc(r))return!r.origin.isInline();if(!_e(r.origin)){if(Km(r.origin))return!0;break}}return!1}function ZP(e,t,o,n){e.modify(t?"extend":"move",o,n)}function Av(e){let t=JP(e);return t!==null&&t.direction==="rtl"}function dq(e,t,o){let n=Av(e),r;r=YP(e)||n?!o:o,ZP(e,t,r,"character")}function cq(e,t,o){let n=hf(e.getStyle());return n!==null&&n[t]||o}function uq(e,t,o=""){let n=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),d=i?s.offset:a.offset,c=i?s.getNode():a.getNode();if(ye(e)&&e.isCollapsed()&&e.style!==""){let u=hf(e.style);if(u!==null&&t in u)return u[t]}for(let u=0;u<r.length;u++){let m=r[u];if((u===0||d!==0||!m.is(c))&&Ke(m)){let p=cq(m,t,o);if(n===null)n=p;else if(n!==p){n="";break}}}return n===null?o:n}var pq=jP;var Pt=Nv,eE=Pt.$addNodeStyle,Kce=Pt.$cloneWithProperties,qce=Pt.$copyBlockFormatIndent,Wce=Pt.$ensureForwardRangeSelection,Gce=Pt.$forEachSelectedTextNode,jce=Pt.$getComputedStyleForElement,Vce=Pt.$getComputedStyleForParent,Qce=Pt.$getSelectionStyleValueForProperty,Xce=Pt.$isAtNodeEnd,Yce=Pt.$isParentElementRTL,Jce=Pt.$isParentRTL,Zce=Pt.$moveCaretSelection,Dv=Pt.$moveCharacter,eue=Pt.$patchStyleText,tue=Pt.$selectAll,oue=Pt.$setBlocksType,_v=Pt.$shouldOverrideDefaultCharacterSelection,yf=Pt.$sliceSelectedTextNodeContent,nue=Pt.$trimTextContentFromAnchor,rue=Pt.$wrapNodes,aue=Pt.createDOMRange,tE=Pt.createRectsFromDOMRange,sue=Pt.getCSSFromStyleObject,iue=Pt.getStyleObjectFromCSS,lue=Pt.trimTextContentFromAnchor;var Hv={};$t(Hv,{$descendantsMatching:()=>Qq,$dfs:()=>Mq,$dfsIterator:()=>uE,$filter:()=>Kq,$findMatchingParent:()=>Nr,$firstToLastIterator:()=>Xq,$getAdjacentCaret:()=>Aq,$getAdjacentSiblingOrParentSiblingCaret:()=>Is,$getDepth:()=>mE,$getNearestBlockElementAncestorOrThrow:()=>Fq,$getNearestNodeOfType:()=>Oq,$getNextRightPreorderNode:()=>_q,$getNextSiblingOrParentSibling:()=>Dq,$handleIndentAndOutdent:()=>qq,$insertFirst:()=>Wq,$insertNodeToNearestRoot:()=>Uq,$insertNodeToNearestRootAtCaret:()=>gE,$isEditorIsNestedEditor:()=>jq,$lastToFirstIterator:()=>Bv,$restoreEditorState:()=>Hq,$reverseDfs:()=>Nq,$reverseDfsIterator:()=>fE,$splitNode:()=>VR,$unwrapAndFilterDescendants:()=>Vq,$unwrapNode:()=>Yq,$wrapNodeInElement:()=>$q,CAN_USE_BEFORE_INPUT:()=>wq,CAN_USE_DOM:()=>lE,IS_ANDROID:()=>Tq,IS_ANDROID_CHROME:()=>Iq,IS_APPLE:()=>Sq,IS_APPLE_WEBKIT:()=>kq,IS_CHROME:()=>Lq,IS_FIREFOX:()=>dE,IS_IOS:()=>Rq,IS_SAFARI:()=>Pq,addClassNamesToElement:()=>Nc,calculateZoomLevel:()=>Gq,isBlockDomNode:()=>NP,isHTMLAnchorElement:()=>OP,isHTMLElement:()=>df,isInlineDomNode:()=>Dc,isMimeType:()=>cE,makeStateWrapper:()=>Jq,markSelection:()=>iE,mediaFileReader:()=>Eq,mergeRegister:()=>lr,objectKlassEquals:()=>zq,positionNodeOnRange:()=>sE,registerNestedElementResolver:()=>Bq,removeClassNamesFromElement:()=>cf,selectionAlwaysOnDisplay:()=>bq});function vf(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Hn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,mq=Hn&&"documentMode"in document?document.documentMode:null,rE=Hn&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),fq=Hn&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),gq=!(!Hn||!("InputEvent"in window)||mq)&&"getTargetRanges"in new window.InputEvent("input"),hq=Hn&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),yq=Hn&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,aE=Hn&&/Android/.test(navigator.userAgent),Fv=Hn&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vq=Hn&&aE&&Fv,Cq=Hn&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&rE&&!Fv;function dr(e){return`${e}px`}var xq={attributes:!0,characterData:!0,childList:!0,subtree:!0};function sE(e,t,o){let n=null,r=null,a=null,s=[],i=document.createElement("div");function d(){n===null&&vf(182),r===null&&vf(183);let{left:m,top:p}=r.getBoundingClientRect(),f=tE(e,t);var g,h;i.isConnected||(h=i,(g=r).insertBefore(h,g.firstChild));let y=!1;for(let x=0;x<f.length;x++){let C=f[x],b=s[x]||document.createElement("div"),L=b.style;L.position!=="absolute"&&(L.position="absolute",y=!0);let w=dr(C.left-m);L.left!==w&&(L.left=w,y=!0);let k=dr(C.top-p);L.top!==k&&(b.style.top=k,y=!0);let I=dr(C.width);L.width!==I&&(b.style.width=I,y=!0);let T=dr(C.height);L.height!==T&&(b.style.height=T,y=!0),b.parentNode!==i&&(i.append(b),y=!0),s[x]=b}for(;s.length>f.length;)s.pop();y&&o(s)}function c(){r=null,n=null,a!==null&&a.disconnect(),a=null,i.remove();for(let m of s)m.remove();s=[]}i.style.position="relative";let u=e.registerRootListener(function m(){let p=e.getRootElement();if(p===null)return c();let f=p.parentElement;if(!df(f))return c();c(),n=p,r=f,a=new MutationObserver(g=>{let h=e.getRootElement(),y=h&&h.parentElement;if(h!==n||y!==r)return m();for(let x of g)if(!i.contains(x.target))return d()}),a.observe(f,xq),d()});return()=>{u(),c()}}function oE(e,t,o){if(e.type!=="text"&&_e(t)){let n=t.getDOMSlot(o);return[n.element,n.getFirstChildOffset()+e.offset]}return[MP(o)||o,e.offset]}function iE(e,t){let o=null,n=null,r=null,a=null,s=null,i=null,d=()=>{};function c(u){u.read(()=>{let m=Te();if(!ye(m))return o=null,r=null,a=null,i=null,d(),void(d=()=>{});let[p,f]=(function(T){let S=T.getStartEndPoints();return T.isBackward()?[S[1],S[0]]:S})(m),g=p.getNode(),h=g.getKey(),y=p.offset,x=f.getNode(),C=x.getKey(),b=f.offset,L=e.getElementByKey(h),w=e.getElementByKey(C),k=o===null||L!==n||y!==r||h!==o.getKey(),I=a===null||w!==s||b!==i||C!==a.getKey();if((k||I)&&L!==null&&w!==null){let T=(function(S,R,A,N,B,O,V){let U=(S._window?S._window.document:document).createRange();return U.setStart(...oE(R,A,N)),U.setEnd(...oE(B,O,V)),U})(e,p,g,L,f,x,w);d(),d=sE(e,T,S=>{if(t===void 0)for(let R of S){let A=R.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==dr(-1.5)&&(A.marginTop=dr(-1.5)),A.paddingTop!==dr(4)&&(A.paddingTop=dr(4)),A.paddingBottom!==dr(0)&&(A.paddingBottom=dr(0))}else t(S)})}o=g,n=L,r=y,a=x,s=w,i=b})}return c(e.getEditorState()),lr(e.registerUpdateListener(({editorState:u})=>c(u)),()=>{d()})}function bq(e,t){let o=null,n=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?o!==null&&(o(),o=null):o===null&&(o=iE(e,t))};return document.addEventListener("selectionchange",n),()=>{o!==null&&o(),document.removeEventListener("selectionchange",n)}}var wq=gq,lE=Hn,Tq=aE,Iq=vq,Sq=rE,kq=Cq,Lq=Fv,dE=fq,Rq=yq,Pq=hq;function cE(e,t){for(let o of t)if(e.type.startsWith(o))return!0;return!1}function Eq(e,t){let o=e[Symbol.iterator]();return new Promise((n,r)=>{let a=[],s=()=>{let{done:i,value:d}=o.next();if(i)return n(a);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",()=>{let u=c.result;typeof u=="string"&&a.push({file:d,result:u}),s()}),cE(d,t)?c.readAsDataURL(d):s()};s()})}function Mq(e,t){return Array.from(uE(e,t))}function Aq(e){return e?e.getAdjacentCaret():null}function Nq(e,t){return Array.from(fE(e,t))}function uE(e,t){return pE("next",e,t)}function nE(e,t){let o=Is(Dr(e,t));return o&&o[0]}function pE(e,t,o){let n=Ve(),r=t||n,a=_e(r)?wa(r,e):Dr(r,e),s=mE(r),i=o?pv(fv(Dr(o,e)))||nE(o,e):nE(r,e),d=s;return Tv({hasNext:c=>c!==null,initial:a,map:c=>({depth:d,node:c.origin}),step:c=>{if(c.isSameNodeCaret(i))return null;Rc(c)&&d++;let u=Is(c);return!u||u[0].isSameNodeCaret(i)?null:(d+=u[1],u[0])}})}function Dq(e){let t=Is(Dr(e,"next"));return t&&[t[0].origin,t[1]]}function mE(e){let t=-1;for(let o=e;o!==null;o=o.getParent())t++;return t}function _q(e){let t=fv(Dr(e,"previous")),o=Is(t,"root");return o&&o[0].origin}function fE(e,t){return pE("previous",e,t)}function Oq(e,t){let o=e;for(;o!=null;){if(o instanceof t)return o;o=o.getParent()}return null}function Fq(e){let t=Nr(e,o=>_e(o)&&!o.isInline());return _e(t)||vf(4,e.__key),t}function Bq(e,t,o,n){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let d=i.getChildren();for(let m=0;m<d.length;m++){let p=d[m];if(r(p))return null}let c=i,u=i;for(;c!==null;)if(u=c,c=c.getParent(),r(c))return{child:u,parent:c};return null})(a);if(s!==null){let{child:i,parent:d}=s;if(i.is(a)){n(d,a);let c=i.getNextSiblings(),u=c.length;if(d.insertAfter(i),u!==0){let m=o(d);i.insertAfter(m);for(let p=0;p<u;p++)m.append(c[p])}d.canBeEmpty()||d.getChildrenSize()!==0||d.remove()}}})}function Hq(e,t){let o=new Map,n=e._pendingEditorState;for(let[a,s]of t._nodeMap)o.set(a,Um(s));n&&(n._nodeMap=o),e._dirtyType=2;let r=t._selection;yn(r===null?null:r.clone())}function Uq(e){let t=Te()||Lc(),o;if(ye(t))o=Qi(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(o=Dr(i,"next"))}o=o||wa(Ve(),"previous").getFlipped().insert(hn())}let n=gE(e,o),r=pv(n),a=Rc(r)?zR(r):n;return GR(DR(a)),e.getLatest()}function gE(e,t,o){let n=mv(t,"next");for(let r=n;r;r=jR(r,o))n=r;return qm(n)&&vf(283),n.insert(e.isInline()?hn().append(e):e),mv(Dr(e.getLatest(),"next"),t.direction)}function $q(e,t){let o=t();return e.replace(o),o.append(e),o}function zq(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function Kq(e,t){let o=[];for(let n=0;n<e.length;n++){let r=t(e[n]);r!==null&&o.push(r)}return o}function qq(e){let t=Te();if(!ye(t))return!1;let o=new Set,n=t.getNodes();for(let r=0;r<n.length;r++){let a=n[r],s=a.getKey();if(o.has(s))continue;let i=Nr(a,c=>_e(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),e(i))}return o.size>0}function Wq(e,t){wa(e,"next").insert(t)}var Ov=!(dE||!lE)&&void 0;function Gq(e,t=!1){let o=1;if((function(){if(Ov===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let r=n.getBoundingClientRect();n.style.setProperty("zoom","2"),Ov=n.getBoundingClientRect().width===r.width,document.body.removeChild(n)}return Ov})()||t)for(;e;)o*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return o}function jq(e){return e._parentEditor!==null}function Vq(e,t){return hE(e,t,null)}function hE(e,t,o){let n=!1;for(let r of Bv(e))t(r)?o!==null&&o(r):(n=!0,_e(r)&&hE(r,t,o||(a=>r.insertAfter(a))),r.remove());return n}function Qq(e,t){let o=[],n=Array.from(e).reverse();for(let r=n.pop();r!==void 0;r=n.pop())if(t(r))o.push(r);else if(_e(r))for(let a of Bv(r))n.push(a);return o}function Xq(e){return yE(wa(e,"next"))}function Bv(e){return yE(wa(e,"previous"))}function yE(e){return Tv({hasNext:$R,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function Yq(e){WR(Dr(e,"next")).splice(1,e.getChildren())}function Jq(e){let t=n=>zm(n,e),o=(n,r)=>Gm(n,e,r);return{$get:t,$set:o,accessors:[t,o],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(n){return o(this,n)},stateConfig:e}}var Be=Hv,mue=Be.$descendantsMatching,fue=Be.$dfs,gue=Be.$dfsIterator,hue=Be.$filter,yue=Be.$findMatchingParent,vue=Be.$firstToLastIterator,Cue=Be.$getAdjacentCaret,xue=Be.$getAdjacentSiblingOrParentSiblingCaret,bue=Be.$getDepth,vE=Be.$getNearestBlockElementAncestorOrThrow,wue=Be.$getNearestNodeOfType,Tue=Be.$getNextRightPreorderNode,Iue=Be.$getNextSiblingOrParentSibling,CE=Be.$handleIndentAndOutdent,Sue=Be.$insertFirst,kue=Be.$insertNodeToNearestRoot,Lue=Be.$insertNodeToNearestRootAtCaret,Rue=Be.$isEditorIsNestedEditor,Pue=Be.$lastToFirstIterator,Eue=Be.$restoreEditorState,Mue=Be.$reverseDfs,Aue=Be.$reverseDfsIterator,Nue=Be.$splitNode,Due=Be.$unwrapAndFilterDescendants,_ue=Be.$unwrapNode,Oue=Be.$wrapNodeInElement,Fue=Be.CAN_USE_BEFORE_INPUT,Bue=Be.CAN_USE_DOM,Hue=Be.IS_ANDROID,Uue=Be.IS_ANDROID_CHROME,$ue=Be.IS_APPLE,zue=Be.IS_APPLE_WEBKIT,Kue=Be.IS_CHROME,que=Be.IS_FIREFOX,Wue=Be.IS_IOS,Gue=Be.IS_SAFARI,jue=Be.addClassNamesToElement,Vue=Be.calculateZoomLevel,Uv=Be.isBlockDomNode,Que=Be.isHTMLAnchorElement,xE=Be.isHTMLElement,Xue=Be.isInlineDomNode,Yue=Be.isMimeType,Jue=Be.makeStateWrapper,Zue=Be.markSelection,epe=Be.mediaFileReader,_r=Be.mergeRegister,_c=Be.objectKlassEquals,tpe=Be.positionNodeOnRange,ope=Be.registerNestedElementResolver,npe=Be.removeClassNamesFromElement,rpe=Be.selectionAlwaysOnDisplay;var $v={};$t($v,{ContentEditable:()=>e4,ContentEditableElement:()=>TE});$();var wE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function Zq({editor:e,ariaActiveDescendant:t,ariaAutoComplete:o,ariaControls:n,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:d,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:m,ariaRequired:p,autoCapitalize:f,className:g,id:h,role:y="textbox",spellCheck:x=!0,style:C,tabIndex:b,"data-testid":L,...w},k){let[I,T]=q(e.isEditable()),S=P(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),R=W(()=>(function(...A){return N=>{for(let B of A)typeof B=="function"?B(N):B!=null&&(B.current=N)}})(k,S),[S,k]);return wE(()=>(T(e.isEditable()),e.registerEditableListener(A=>{T(A)})),[e]),l("div",{"aria-activedescendant":I?t:void 0,"aria-autocomplete":I?o:"none","aria-controls":I?n:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":I&&y==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":d,"aria-labelledby":c,"aria-multiline":u,"aria-owns":I?m:void 0,"aria-readonly":!I||void 0,"aria-required":p,autoCapitalize:f,className:g,contentEditable:I,"data-testid":L,id:h,ref:R,role:y,spellCheck:x,style:C,tabIndex:b,...w})}var TE=Wn(Zq);function bE(e){return e.getEditorState().read(mf(e.isComposing()))}var e4=Wn(t4);function t4(e,t){let{placeholder:o,...n}=e,[r]=ct();return v(oe,{children:[l(TE,{editor:r,...n,ref:t}),o!=null&&l(o4,{editor:r,content:o})]})}function o4({content:e,editor:t}){let o=(function(s){let[i,d]=q(()=>bE(s));return wE(()=>{function c(){let u=bE(s);d(u)}return c(),_r(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),i})(t),[n,r]=q(t.isEditable());if(fe(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[t]),!o)return null;let a=null;return typeof e=="function"?a=e(n):e!==null&&(a=e),a===null?null:l("div",{"aria-hidden":!0,children:a})}var IE=$v,SE=IE.ContentEditable,upe=IE.ContentEditableElement;$();var n4=qe(null),zv={didCatch:!1,error:null},Cf=class extends mr{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=zv}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:o}=this.state;o!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(zv))}componentDidCatch(t,o){this.props.onError?.(t,o)}componentDidUpdate(t,o){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&o.error!==null&&r4(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(zv))}render(){let{children:t,fallbackRender:o,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:s}=this.state,i=t;if(a){let d={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof o=="function")i=o(d);else if(n)i=wn(n,d);else if(r!==void 0)i=r;else throw s}return wn(n4.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function r4(e=[],t=[]){return e.length!==t.length||e.some((o,n)=>!Object.is(o,t[n]))}var Kv={};$t(Kv,{LexicalErrorBoundary:()=>a4});function a4({children:e,onError:t}){return l(Cf,{fallback:l("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var s4=Kv,kE=s4.LexicalErrorBoundary;var rC={};$t(rC,{$createHorizontalRuleNode:()=>nC,$isDecoratorTextNode:()=>UE,$isHorizontalRuleNode:()=>GE,AutoFocusExtension:()=>d4,ClearEditorExtension:()=>c4,DecoratorTextExtension:()=>h4,DecoratorTextNode:()=>Bc,EditorStateExtension:()=>Tf,HorizontalRuleExtension:()=>L4,HorizontalRuleNode:()=>Rs,INSERT_HORIZONTAL_RULE_COMMAND:()=>S4,InitialStateExtension:()=>qE,LexicalBuilder:()=>ol,NodeSelectionExtension:()=>Zv,TabIndentationExtension:()=>R4,applyFormatFromStyle:()=>p4,applyFormatToDom:()=>m4,batch:()=>AE,buildEditorFromExtensions:()=>x4,computed:()=>_E,configExtension:()=>sf,declarePeerDependency:()=>EP,defineExtension:()=>Kt,effect:()=>Sa,getExtensionDependencyFromEditor:()=>w4,getKnownTypesAndNodes:()=>u4,getPeerDependencyFromEditor:()=>WE,getPeerDependencyFromEditorOrThrow:()=>T4,namedSignals:()=>Sf,registerClearEditor:()=>BE,registerTabIndentation:()=>VE,safeCast:()=>Bn,shallowMergeConfig:()=>uf,signal:()=>tl,untracked:()=>Qv,watchedSignal:()=>tC});var i4=Symbol.for("preact-signals");function If(){if(Ia>1)return void Ia--;let e,t=!1;for(;Fc!==void 0;){let o=Fc;for(Fc=void 0,Xv++;o!==void 0;){let n=o.o;if(o.o=void 0,o.f&=-3,!(8&o.f)&&NE(o))try{o.c()}catch(r){t||(e=r,t=!0)}o=n}}if(Xv=0,Ia--,t)throw e}function AE(e){if(Ia>0)return e();Ia++;try{return e()}finally{If()}}var it,Fc;function Qv(e){let t=it;it=void 0;try{return e()}finally{it=t}}var Ia=0,Xv=0,wf=0;function LE(e){if(it===void 0)return;let t=e.n;return t===void 0||t.t!==it?(t={i:0,S:e,p:it.s,n:void 0,t:it,e:void 0,x:void 0,r:t},it.s!==void 0&&(it.s.n=t),it.s=t,e.n=t,32&it.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=it.s,t.n=void 0,it.s.n=t,it.s=t),t):void 0}function Po(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function tl(e,t){return new Po(e,t)}function NE(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 RE(e){for(let t=e.s;t!==void 0;t=t.n){let o=t.S.n;if(o!==void 0&&(t.r=o),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function DE(e){let t,o=e.s;for(;o!==void 0;){let n=o.p;o.i===-1?(o.S.U(o),n!==void 0&&(n.n=o.n),o.n!==void 0&&(o.n.p=n)):t=o,o.S.n=o.r,o.r!==void 0&&(o.r=void 0),o=n}e.s=t}function Ls(e,t){Po.call(this,void 0),this.x=e,this.s=void 0,this.g=wf-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function _E(e,t){return new Ls(e,t)}function OE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Ia++;let o=it;it=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,eC(e),n}finally{it=o,If()}}}function eC(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,OE(e)}function l4(e){if(it!==this)throw new Error("Out-of-order effect");DE(this),it=e,this.f&=-2,8&this.f&&eC(this),If()}function el(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 Sa(e,t){let o=new el(e,t);try{o.c()}catch(r){throw o.d(),r}let n=o.d.bind(o);return n[Symbol.dispose]=n,n}function Sf(e,t={}){let o={};for(let n in e){let r=t[n],a=tl(r===void 0?e[n]:r);o[n]=a}return o}Po.prototype.brand=i4,Po.prototype.h=function(){return!0},Po.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:Qv(()=>{var o;(o=this.W)==null||o.call(this)}))},Po.prototype.U=function(e){if(this.t!==void 0){let t=e.e,o=e.x;t!==void 0&&(t.x=o,e.e=void 0),o!==void 0&&(o.e=t,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Qv(()=>{var n;(n=this.Z)==null||n.call(this)}))}},Po.prototype.subscribe=function(e){return Sa(()=>{let t=this.value,o=it;it=void 0;try{e(t)}finally{it=o}},{name:"sub"})},Po.prototype.valueOf=function(){return this.value},Po.prototype.toString=function(){return this.value+""},Po.prototype.toJSON=function(){return this.value},Po.prototype.peek=function(){let e=it;it=void 0;try{return this.value}finally{it=e}},Object.defineProperty(Po.prototype,"value",{get(){let e=LE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Xv>100)throw new Error("Cycle detected");this.v=e,this.i++,wf++,Ia++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{If()}}}}),Ls.prototype=new Po,Ls.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===wf))return!0;if(this.g=wf,this.f|=1,this.i>0&&!NE(this))return this.f&=-2,!0;let e=it;try{RE(this),it=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 it=e,DE(this),this.f&=-2,!0},Ls.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Po.prototype.S.call(this,e)},Ls.prototype.U=function(e){if(this.t!==void 0&&(Po.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Ls.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(Ls.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=LE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),el.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()}},el.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,OE(this),RE(this),Ia++;let e=it;return it=this,l4.bind(this,e)},el.prototype.N=function(){2&this.f||(this.f|=2,this.o=Fc,Fc=this)},el.prototype.d=function(){this.f|=8,1&this.f||eC(this)},el.prototype.dispose=function(){this.d()};var d4=Kt({build:(e,t,o)=>Sf(t),config:Bn({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,o){let n=o.getOutput();return Sa(()=>n.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:n.defaultSelection.peek()})}))}});function FE(){let e=Ve(),t=Te(),o=hn();e.clear(),e.append(o),t!==null&&o.select(),ye(t)&&(t.format=0)}function BE(e,t=FE){return e.registerCommand(jm,o=>(e.update(t),!0),vt)}var c4=Kt({build:(e,t,o)=>Sf(t),config:Bn({$onClear:FE}),name:"@lexical/extension/ClearEditor",register(e,t,o){let{$onClear:n}=o.getOutput();return Sa(()=>BE(e,n.value))}});function u4(e){let t=new Set,o=new Set;for(let n of HE(e)){let r=typeof n=="function"?n:n.replace;t.add(r.getType()),o.add(r)}return{nodes:o,types:t}}function HE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var qv=PP("format",{parse:e=>typeof e=="number"?e:0}),Bc=class extends Wo{$config(){return this.config("decorator-text",{extends:Wo,stateConfigs:[{flat:!0,stateConfig:qv}]})}getFormat(){return zm(this,qv)}getFormatFlags(t,o){return Iv(this.getFormat(),t,o)}hasFormat(t){let o=SP[t];return(this.getFormat()&o)!==0}setFormat(t){return Gm(this,qv,t)}toggleFormat(t){let o=this.getFormat(),n=Iv(o,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function UE(e){return e instanceof Bc}function p4(e,t,o){let n=t.fontWeight,r=t.textDecoration.split(" "),a=n==="700"||n==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",d=r.includes("underline"),c=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!e.hasFormat("italic")&&e.toggleFormat("italic"),d&&!e.hasFormat("underline")&&e.toggleFormat("underline"),c!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),c!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),o&&!e.hasFormat(o)&&e.toggleFormat(o),e}function m4(e,t,o=g4){for(let[n,r]of Object.entries(o))e.hasFormat(r)&&(t=f4(t,n));return t}function f4(e,t){let o=document.createElement(t);return o.appendChild(e),o}var g4={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},h4=Kt({name:"@lexical/extension/DecoratorText",nodes:()=>[Bc],register:(e,t,o)=>e.registerCommand(iP,n=>{let r=Te();if(gv(r)||ye(r))for(let a of r.getNodes())UE(a)&&a.toggleFormat(n);return!1},Ji)});function tC(e,t){let o;return tl(e(),{unwatched(){o&&(o(),o=void 0)},watched(){this.value=e(),o=t(this)}})}var Tf=Kt({build:e=>tC(()=>e.getEditorState(),t=>e.registerUpdateListener(o=>{t.value=o.editorState})),name:"@lexical/extension/EditorState"});function ut(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function $E(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let o=e,n=t;for(let r in n)o[r]=$E(o[r],n[r]);return e}return t}var oC=0,Yv=1,zE=2,Wv=3,xf=4,Zi=5,Gv=6,Oc=7;function jv(e){return e.id===oC}function KE(e){return e.id===zE}function y4(e){return(function(t){return t.id===Yv})(e)||ut(305,String(e.id),String(Yv)),Object.assign(e,{id:zE})}var v4=new Set,Jv=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,o){this.builder=t,this.extension=o,this.configs=new Set,this.state={id:oC}}mergeConfigs(){let t=this.extension.config||{},o=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):uf;for(let n of this.configs)t=o(t,n);return t}init(t){let o=this.state;KE(o)||ut(306,String(o.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(i,d,c){return Object.assign(i,{config:d,id:Wv,registerState:c})})(o,this.mergeConfigs(),n),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,n)),this.state=(function(i,d,c){return Object.assign(i,{id:xf,initResult:d,registerState:c})})(a,s,r)}build(t){let o=this.state,n;o.id!==xf&&ut(307,String(o.id),String(Zi)),this.extension.build&&(n=this.extension.build(t,o.config,o.registerState));let r={...o.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=(function(a,s,i){return Object.assign(a,{id:Zi,output:s,registerState:i})})(o,n,r)}register(t,o){this._signal=o;let n=this.state;n.id!==Zi&&ut(308,String(n.id),String(Zi));let r=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=(function(a){return Object.assign(a,{id:Gv})})(n),()=>{let a=this.state;a.id!==Oc&&ut(309,String(n.id),String(Oc)),this.state=(function(s){return Object.assign(s,{id:Zi})})(a),r&&r()}}afterRegistration(t){let o=this.state,n;return o.id!==Gv&&ut(310,String(o.id),String(Gv)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,o.config,o.registerState)),this.state=(function(r){return Object.assign(r,{id:Oc})})(o),n}getSignal(){return this._signal===void 0&&ut(311),this._signal}getInitResult(){this.extension.init===void 0&&ut(312,this.extension.name);let t=this.state;return(function(o){return o.id>=xf})(t)||ut(313,String(t.id),String(xf)),t.initResult}getInitPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(o){return o.id>=Wv})(t)||ut(314,String(t.id),String(Wv)),{config:t.config}}getPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}getInitDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionInitDependency()}getDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionDependency()}getState(){let t=this.state;return(function(o){return o.id>=Oc})(t)||ut(316,String(t.id),String(Oc)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||v4}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([o])=>o)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(o){return o.id>=Zi})(t)||ut(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},PE={tag:Go};function C4(){let e=Ve();e.isEmpty()&&e.append(hn())}var qE=Kt({config:Bn({setOptions:PE,updateOptions:PE}),init:({$initialEditorState:e=C4})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:o},n){let r=n.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(FR(a))e.setEditorState(a,o);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,o)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[bP,af,gP,kP,vP]}),EE=Symbol.for("@lexical/extension/LexicalBuilder");function x4(...e){return ol.fromExtensions(e).buildEditor()}function ME(){}function b4(e){throw e}function bf(e){return Array.isArray(e)?e:[e]}var Vv="0.41.0+prod.esm",ol=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=Vv,this.roots=t;for(let o of t)this.addExtension(o)}static fromExtensions(t){let o=[bf(qE)];for(let n of t)o.push(bf(n));return new e(o)}static maybeFromEditor(t){let o=t[EE];return o&&(o.PACKAGE_VERSION!==Vv&&ut(292,o.PACKAGE_VERSION,Vv),o instanceof e||ut(293)),o}static fromEditor(t){let o=e.maybeFromEditor(t);return o===void 0&&ut(294),o}constructEditor(){let{$initialEditorState:t,onError:o,...n}=this.buildCreateEditorArgs(),r=Object.assign(lf({...n,...o?{onError:a=>{o(a,r)}}:{}}),{[EE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=ME;function o(){try{t()}finally{t=ME}}let n=Object.assign(this.constructEditor(),{dispose:o,[Symbol.dispose]:o});return t=lr(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let o=this.extensionNameMap.get(t.name);if(o)return o.extension!==t&&ut(295,t.name),o}addEdge(t,o,n){let r=this.outgoingConfigEdges.get(t);r?r.set(o,n):this.outgoingConfigEdges.set(t,new Map([[o,n]]));let a=this.incomingEdges.get(o);a?a.add(t):this.incomingEdges.set(o,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&ut(296);let o=bf(t),[n]=o;typeof n.name!="string"&&ut(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(r!==void 0&&r.extension!==n&&ut(298,n.name),!r){r=new Jv(this,n),this.extensionNameMap.set(n.name,r);let a=this.conflicts.get(n.name);typeof a=="string"&&ut(299,n.name,a);for(let s of n.conflictsWith||[])this.extensionNameMap.has(s)&&ut(299,n.name,s),this.conflicts.set(s,n.name);for(let s of n.dependencies||[]){let i=bf(s);this.addEdge(n.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of n.peerDependencies||[])this.addEdge(n.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],o=(n,r)=>{let a=n.state;if(KE(a))return;let s=n.extension.name;var i;jv(a)||ut(300,s,r||"[unknown]"),jv(i=a)||ut(304,String(i.id),String(oC)),a=Object.assign(i,{id:Yv}),n.state=a;let d=this.outgoingConfigEdges.get(s);if(d)for(let c of d.keys()){let u=this.extensionNameMap.get(c);u&&o(u,s)}a=y4(a),n.state=a,t.push(n)};for(let n of this.extensionNameMap.values())jv(n.state)&&o(n);for(let n of t)for(let[r,a]of this.outgoingConfigEdges.get(n.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[n,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(n.name);a===void 0&&ut(301,n.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let o=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],a=n.signal;for(let s of o){let i=s.register(t,a);i&&r.push(i)}for(let s of o){let i=s.afterRegistration(t);i&&r.push(i)}return lr(...r)}buildCreateEditorArgs(){let t={},o=new Set,n=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let u of i){let{extension:m}=u;if(m.onError!==void 0&&(t.onError=m.onError),m.disableEvents!==void 0&&(t.disableEvents=m.disableEvents),m.parentEditor!==void 0&&(t.parentEditor=m.parentEditor),m.editable!==void 0&&(t.editable=m.editable),m.namespace!==void 0&&(t.namespace=m.namespace),m.$initialEditorState!==void 0&&(t.$initialEditorState=m.$initialEditorState),m.nodes)for(let p of HE(m)){if(typeof p!="function"){let f=n.get(p.replace);f&&ut(302,m.name,p.replace.name,f.extension.name),n.set(p.replace,u)}o.add(p)}if(m.html){if(m.html.export)for(let[p,f]of m.html.export.entries())r.set(p,f);m.html.import&&Object.assign(a,m.html.import)}m.theme&&$E(s,m.theme)}Object.keys(s).length>0&&(t.theme=s),o.size&&(t.nodes=[...o]);let d=Object.keys(a).length>0,c=r.size>0;(d||c)&&(t.html={},d&&(t.html.import=a),c&&(t.html.export=r));for(let u of i)u.init(t);return t.onError||(t.onError=b4),t}};function w4(e,t){let o=ol.fromEditor(e).getExtensionRep(t);return o===void 0&&ut(303,t.name),o.getExtensionDependency()}function WE(e,t){let o=ol.fromEditor(e).extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}function T4(e,t){let o=WE(e,t);return o===void 0&&ut(291,t),o}var I4=new Set,Zv=Kt({build(e,t,o){let n=o.getDependency(Tf).output,r=tl({watchedNodeKeys:new Map}),a=tC(()=>{},()=>Sa(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,d,c=!1;n.value.read(()=>{if(Te())for(let[u,m]of i.entries()){if(m.size===0){i.delete(u);continue}let p=Ta(u),f=p&&p.isSelected()||!1;c=c||f!==(!!s&&s.has(u)),f&&(d=d||new Set,d.add(u))}}),!c&&d&&s&&d.size===s.size||(a.value=d)}));return{watchNodeKey:function(s){let i=_E(()=>(a.value||I4).has(s)),{watchedNodeKeys:d}=r.peek(),c=d.get(s),u=c!==void 0;return c=c||new Set,c.add(i),u||(d.set(s,c),r.value={watchedNodeKeys:d}),i}}},dependencies:[Tf],name:"@lexical/extension/NodeSelection"}),S4=RP("INSERT_HORIZONTAL_RULE_COMMAND"),Rs=class e extends Wo{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return nC().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:k4,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let o=document.createElement("hr");return Nc(o,t.theme.hr),o}getTextContent(){return`
|
|
3580
|
-
`}isInline(){return!1}updateDOM(){return!1}};function k4(){return{node:nC()}}function nC(){return LR(Rs)}function GE(e){return e instanceof Rs}var L4=Kt({dependencies:[Tf,Zv],name:"@lexical/extension/HorizontalRule",nodes:()=>[Rs],register(e,t,o){let{watchNodeKey:n}=o.getDependency(Zv).output,r=tl({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return lr(e.registerCommand(YR,s=>{if(_P(s.target)){let i=_R(s.target);if(GE(i))return(function(d,c=!1){let u=Te(),m=d.isSelected(),p=d.getKey(),f;c&&gv(u)?f=u:(f=RR(),yn(f)),m?f.delete(p):f.add(p)})(i,s.shiftKey),!0}return!1},Ji),e.registerMutationListener(Rs,(s,i)=>{AE(()=>{let d=!1,{nodeSelections:c}=r.peek();for(let[u,m]of s.entries())if(m==="destroyed")c.delete(u),d=!0;else{let p=c.get(u),f=e.getElementByKey(u);p?p.domNode.value=f:(d=!0,c.set(u,{domNode:tl(f),selectedSignal:n(u)}))}d&&(r.value={nodeSelections:c})})}),Sa(()=>{let s=[];for(let{domNode:i,selectedSignal:d}of r.value.nodeSelections.values())s.push(Sa(()=>{let c=i.value;c&&(d.value?Nc(c,a):cf(c,a))}));return lr(...s)}))}});function jE(e){return e.canBeEmpty()}function VE(e,t,o=jE){return lr(e.registerCommand(nf,n=>{let r=Te();if(!ye(r))return!1;n.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>Xi(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,d=s.focus,c=d.isBefore(i)?d:i,u=c.getNode(),m=vE(u);if(m.canIndent()){let p=m.getKey(),f=Ts();if(f.anchor.set(p,0,"element"),f.focus.set(p,0,"element"),f=KR(f),f.anchor.is(c))return!0}return!1})(r)?n.shiftKey?hP:vv:cP;return e.dispatchCommand(a,void 0)},vt),e.registerCommand(vv,()=>{let n=typeof t=="number"?t:t?t.peek():null,r=Te();if(!ye(r))return!1;let a=typeof o=="function"?o:o.peek();return CE(s=>{if(a(s)){let i=s.getIndent()+1;(!n||i<n)&&s.setIndent(i)}})},Vm))}var R4=Kt({build:(e,t,o)=>Sf(t),config:Bn({$canIndent:jE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,o){let{disabled:n,maxIndent:r,$canIndent:a}=o.getOutput();return Sa(()=>{if(!n.value)return VE(e,r,a)})}});var Xe=rC,bpe=Xe.$createHorizontalRuleNode,wpe=Xe.$isDecoratorTextNode,Tpe=Xe.$isHorizontalRuleNode,Ipe=Xe.AutoFocusExtension,Spe=Xe.ClearEditorExtension,kpe=Xe.DecoratorTextExtension,Lpe=Xe.DecoratorTextNode,Rpe=Xe.EditorStateExtension,Ppe=Xe.HorizontalRuleExtension,Epe=Xe.HorizontalRuleNode,Mpe=Xe.INSERT_HORIZONTAL_RULE_COMMAND,Ape=Xe.InitialStateExtension,QE=Xe.LexicalBuilder,Npe=Xe.NodeSelectionExtension,Dpe=Xe.TabIndentationExtension,_pe=Xe.applyFormatFromStyle,Ope=Xe.applyFormatToDom,XE=Xe.batch,Fpe=Xe.buildEditorFromExtensions,Bpe=Xe.computed,Hpe=Xe.configExtension,Upe=Xe.declarePeerDependency,$pe=Xe.defineExtension,Hc=Xe.effect,zpe=Xe.getExtensionDependencyFromEditor,Kpe=Xe.getKnownTypesAndNodes,YE=Xe.getPeerDependencyFromEditor,qpe=Xe.getPeerDependencyFromEditorOrThrow,kf=Xe.namedSignals,Wpe=Xe.registerClearEditor,Gpe=Xe.registerTabIndentation,jpe=Xe.safeCast,Vpe=Xe.shallowMergeConfig,Qpe=Xe.signal,Xpe=Xe.untracked,Ype=Xe.watchedSignal;var aC={};$t(aC,{HistoryExtension:()=>Lf,SharedHistoryExtension:()=>M4,createEmptyHistoryState:()=>eM,registerHistory:()=>ZE});function P4(e,t,o,n,r){if(e===null||o.size===0&&n.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(ye(a)&&ye(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(x,C,b){let L=x._nodeMap,w=[];for(let k of C){let I=L.get(k);I!==void 0&&w.push(I)}for(let[k,I]of b){if(!I)continue;let T=L.get(k);T===void 0||Pc(T)||w.push(T)}return w})(t,o,n);if(i.length===0)return 0;if(i.length>1){let x=t._nodeMap,C=x.get(a.anchor.key),b=x.get(s.anchor.key);return C&&b&&!e._nodeMap.has(C.__key)&&Ke(C)&&C.__text.length===1&&a.anchor.offset===1?2:0}let d=i[0],c=e._nodeMap.get(d.__key);if(!Ke(c)||!Ke(d)||c.__mode!==d.__mode)return 0;let u=c.__text,m=d.__text;if(u===m)return 0;let p=a.anchor,f=s.anchor;if(p.key!==f.key||p.type!=="text")return 0;let g=p.offset,h=f.offset,y=m.length-u.length;return y===1&&h===g-1?2:y===-1&&h===g+1?3:y===-1&&h===g?4:0}function E4(e,t){let o=Date.now(),n=0,r=Date.now(),a=0,s=null;return(i,d,c,u,m,p)=>{let f=Date.now();if(p.has(ZR)&&(r=o,a=n,s=i),p.has(Ym))return n=0,o=f,2;p.has(JR)&&s&&(o=r,n=a,i=s);let g=P4(i,d,u,m,e.isComposing()),h=(()=>{let y=c===null||c.editor===e,x=p.has(lP);if(!x&&y&&p.has(Go))return 0;if(g===1)return 2;if(i===null)return 1;let C=d._selection;if(!(u.size>0||m.size>0))return C!==null?0:2;let b=typeof t=="number"?t:t.peek();return x===!1&&g!==0&&g===n&&f<o+b&&y||u.size===1&&(function(L,w,k){let I=w._nodeMap.get(L),T=k._nodeMap.get(L),S=w._selection,R=k._selection;return!(ye(S)&&ye(R)&&S.anchor.type==="element"&&S.focus.type==="element"&&R.anchor.type==="text"&&R.focus.type==="text"||!Ke(I)||!Ke(T)||I.__parent!==T.__parent)&&JSON.stringify(w.read(()=>I.exportJSON()))===JSON.stringify(k.read(()=>T.exportJSON()))})(Array.from(u)[0],i,d)?0:1})();return o=f,n=g,h}}function JE(e){e.undoStack=[],e.redoStack=[],e.current=null}function ZE(e,t,o){let n=E4(e,o);return _r(e.registerCommand(LP,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(d.length!==0){let c=s.current,u=d.pop();c!==null&&(i.push(c),a.dispatchCommand(Ec,!0)),d.length===0&&a.dispatchCommand(Mc,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Ym})}})(e,t),!0),vt),e.registerCommand(CP,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(i.length!==0){let c=s.current;c!==null&&(d.push(c),a.dispatchCommand(Mc,!0));let u=i.pop();i.length===0&&a.dispatchCommand(Ec,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Ym})}})(e,t),!0),vt),e.registerCommand(jm,()=>(JE(t),!1),vt),e.registerCommand(XR,()=>(JE(t),e.dispatchCommand(Ec,!1),e.dispatchCommand(Mc,!1),!0),vt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,dirtyElements:d,tags:c})=>{let u=t.current,m=t.redoStack,p=t.undoStack,f=u===null?null:u.editorState;if(u!==null&&a===f)return;let g=n(s,a,u,i,d,c);if(g===1)m.length!==0&&(t.redoStack=[],e.dispatchCommand(Ec,!1)),u!==null&&(p.push({...u}),e.dispatchCommand(Mc,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function eM(){return{current:null,redoStack:[],undoStack:[]}}var Lf=Kt({build:(e,{delay:t,createInitialHistoryState:o,disabled:n})=>kf({delay:t,disabled:n,historyState:o(e)}),config:Bn({createInitialHistoryState:eM,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,o)=>{let n=o.getOutput();return Hc(()=>n.disabled.value?void 0:ZE(e,n.historyState.value,n.delay))}}),M4=Kt({dependencies:[sf(Lf,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,o){let{output:n}=o.getDependency(Lf),r=(function(s){return s?YE(s,Lf.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Hc(()=>XE(()=>{n.delay.value=a.delay.value,n.historyState.value=a.historyState.value,n.disabled.value=a.disabled.value}))}});var Rf=aC,ome=Rf.HistoryExtension,nme=Rf.SharedHistoryExtension,Pf=Rf.createEmptyHistoryState,tM=Rf.registerHistory;var sC={};$t(sC,{HistoryPlugin:()=>A4,createEmptyHistoryState:()=>Pf});$();function A4({delay:e,externalHistoryState:t}){let[o]=ct();return(function(n,r,a=1e3){let s=W(()=>r||Pf(),[r]);H(()=>tM(n,s,a),[a,n,s])})(o,t,e),null}var oM=sC,nM=oM.HistoryPlugin,rM=oM.createEmptyHistoryState;var iC={};$t(iC,{OnChangePlugin:()=>D4});$();var N4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function D4({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:o}){let[n]=ct();return N4(()=>{if(o)return n.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:d})=>{t&&a.size===0&&s.size===0||e&&d.has(Go)||i.isEmpty()||o(r,n,d)})},[n,e,t,o]),null}var _4=iC,aM=_4.OnChangePlugin;var lC={};$t(lC,{useLexicalEditable:()=>B4});$();var O4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function F4(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function B4(){return(function(e){let[t]=ct(),o=W(()=>e(t),[t,e]),[n,r]=q(()=>o.initialValueFn()),a=M(n);return O4(()=>{let{initialValueFn:s,subscribe:i}=o,d=s();return a.current!==d&&(a.current=d,r(d)),i(c=>{a.current=c,r(c)})},[o,e]),n})(F4)}var H4=lC,Ef=H4.useLexicalEditable;var dC={};$t(dC,{ReactProviderExtension:()=>U4});var U4=Kt({name:"@lexical/react/ReactProvider"});var $4=dC,sM=$4.ReactProviderExtension;var cC={};$t(cC,{DragonExtension:()=>z4,registerDragonSupport:()=>iM});function iM(e){let t=window.location.origin,o=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=n.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 d=i.args;if(d){let[c,u,m,p,f]=d;e.update(()=>{let g=Te();if(ye(g)){let h=g.anchor,y=h.getNode(),x=0,C=0;if(Ke(y)&&c>=0&&u>=0&&(x=c,C=c+u,g.setTextNodeRange(y,x,y,C)),x===C&&m===""||(g.insertRawText(m),y=h.getNode()),Ke(y)){x=p,C=p+f;let b=y.getTextContentSize();x=x>b?b:x,C=C>b?b:C,g.setTextNodeRange(y,x,y,C)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",o,!0),()=>{window.removeEventListener("message",o,!0)}}var z4=Kt({build:(e,t,o)=>kf(t),config:Bn({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,o)=>Hc(()=>o.getOutput().disabled.value?void 0:iM(e))});var lM=cC,dM=lM.DragonExtension,cM=lM.registerDragonSupport;var uC={};$t(uC,{$generateHtmlFromNodes:()=>q4,$generateNodesFromDOM:()=>K4});function K4(e,t){let o=DP(t)?t.body.childNodes:t.childNodes,n=[],r=[];for(let a of o)if(!pM.has(a.nodeName)){let s=mM(a,e,r,!1);s!==null&&(n=n.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof yv&&s.insertAfter(ws());for(let s of a){let i=s.getChildren();for(let d of i)s.insertBefore(d);s.remove()}})(r),n}function q4(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 o=document.createElement("div"),n=Ve().getChildren();for(let r=0;r<n.length;r++)uM(e,n[r],o,t);return o.innerHTML}function uM(e,t,o,n=null){let r=n===null||t.isSelected(n),a=_e(t)&&t.excludeFromCopy("html"),s=t;n!==null&&Ke(t)&&(s=yf(n,t,"clone"));let i=_e(s)?s.getChildren():[],d=AP(e,s.getType()),c;c=d&&d.exportDOM!==void 0?d.exportDOM(e,s):s.exportDOM(e);let{element:u,after:m}=c;if(!u)return!1;let p=document.createDocumentFragment();for(let f=0;f<i.length;f++){let g=i[f],h=uM(e,g,p,n);!r&&_e(t)&&h&&t.extractWithChild(g,n,"html")&&(r=!0)}if(r&&!a){if((xE(u)||wv(u))&&u.append(p),o.append(u),m){let f=m.call(s,u);f&&(wv(u)?u.replaceChildren(f):u.replaceWith(f))}}else o.append(p);return r}var pM=new Set(["STYLE","SCRIPT"]);function mM(e,t,o,n,r=new Map,a){let s=[];if(pM.has(e.nodeName))return s;let i=null,d=(function(g,h){let{nodeName:y}=g,x=h._htmlConversions.get(y.toLowerCase()),C=null;if(x!==void 0)for(let b of x){let L=b(g);L!==null&&(C===null||(C.priority||0)<=(L.priority||0))&&(C=L)}return C!==null?C.conversion:null})(e,t),c=d?d(e):null,u=null;if(c!==null){u=c.after;let g=c.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])}c.forChild!=null&&r.set(e.nodeName,c.forChild)}let m=e.childNodes,p=[],f=(i==null||!Ss(i))&&(i!=null&&Xi(i)||n);for(let g=0;g<m.length;g++)p.push(...mM(m[g],t,o,f,new Map(r),i));return u!=null&&(p=u(p)),Uv(e)&&(p=W4(e,p,f?()=>{let g=new yv;return o.push(g),g}:hn)),i==null?p.length>0?s=s.concat(p):Uv(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Dc(g.nextSibling)&&Dc(g.previousSibling)})(e)&&(s=s.concat(ws())):_e(i)&&i.append(...p),s}function W4(e,t,o){let n=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(Xi(i))n&&!i.getFormat()&&i.setFormat(n),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&Xi(t[s+1])){let d=o();d.setFormat(n),d.append(...a),r.push(d),a=[]}}return r}var fM=uC,gM=fM.$generateHtmlFromNodes,hM=fM.$generateNodesFromDOM;var mC={};$t(mC,{$generateJSONFromSelectedNodes:()=>bM,$generateNodesFromSerializedNodes:()=>wM,$getClipboardDataFromSelection:()=>IM,$getHtmlContent:()=>vM,$getLexicalContent:()=>CM,$insertDataTransferForPlainText:()=>G4,$insertDataTransferForRichText:()=>j4,$insertGeneratedNodes:()=>pC,copyToClipboard:()=>V4,setLexicalClipboardDataTransfer:()=>SM});function Mf(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function vM(e,t=Te()){return t==null&&Mf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?"":gM(e,t)}function CM(e,t=Te()){return t==null&&Mf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(bM(e,t))}function G4(e,t){let o=e.getData("text/plain")||e.getData("text/uri-list");o!=null&&t.insertRawText(o)}function j4(e,t,o){let n=e.getData("application/x-lexical-editor");if(n)try{let i=JSON.parse(n);if(i.namespace===o._config.namespace&&Array.isArray(i.nodes))return pC(o,wM(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(d){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(d):d})(r),"text/html");return pC(o,hM(o,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(ye(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let d=0;d<i.length;d++){let c=Te();if(ye(c)){let u=i[d];u===`
|
|
3562
|
+
`);let d=i.length;if(!Ke(n)||r>=d){let c=n.getParent();n.remove(),c==null||c.getChildrenSize()!==0||Pc(c)||c.remove(),r-=d+s,n=a}else{let c=n.getKey(),u=e.getEditorState().read(()=>{let f=Ca(c);return Ke(f)&&f.isSimpleText()?f.getTextContent():null}),m=d-r,p=i.slice(0,m);if(u!==null&&u!==i){let f=Sc(),g=n;if(n.isSimpleText())n.setTextContent(u);else{let h=An(u);n.replace(h),g=h}if(ye(f)&&f.isCollapsed()){let h=f.anchor.offset;g.select(h,h)}}else if(n.isSimpleText()){let f=t.key===c,g=t.offset;g<r&&(g=d);let h=f?g-r:0,y=f?g:m;if(f&&h===0){let[x]=n.splitText(h,y);x.remove()}else{let[,x]=n.splitText(h,y);x.remove()}}else{let f=An(p);n.replace(f)}r=0}}}function uq(e){let t=e.getStyle(),o=VR(t);cf.set(t,o)}function df(e,t){(ye(e)?e.isCollapsed():Ke(e)||_e(e))||Sv(280);let o=uf(ye(e)?e.style:Ke(e)?e.getStyle():e.getTextStyle()),n=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(o[s],e):i===null?delete a[s]:a[s]=i,a),{...o}),r=QR(n);ye(e)||Ke(e)?e.setStyle(r):e.setTextStyle(r),cf.set(r,n)}function pq(e,t){if(ye(e)&&e.isCollapsed()){df(e,t);let n=e.anchor.getNode();_e(n)&&n.isEmpty()&&df(n,t)}YR(n=>{df(n,t)});let o=e.getNodes();if(o.length>0){let n=new Set;for(let r of o){if(!_e(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();n.has(a)||(n.add(a),df(r,t))}}}function YR(e){let t=Te();if(!t)return;let o=new Map,n=a=>o.get(a.getKey())||[0,a.getTextContentSize()];if(ye(t))for(let a of PP(t).getTextSlices())a&&o.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!Ke(a)||!a.canHaveFormat())continue;let[s,i]=n(a);i!==s&&(pv(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}ye(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&JR(t)}function JR(e){if(e.isBackward()){let{anchor:t,focus:o}=e,{key:n,offset:r,type:a}=t;t.set(o.key,o.offset,o.type),o.set(n,r,a)}}function ZR(e,t){let o=e.getFormatType(),n=e.getIndent();o!==t.getFormatType()&&t.setFormat(o),n!==t.getIndent()&&t.setIndent(n)}function mq(e,t,o=ZR){if(e===null)return;let n=e.getStartEndPoints(),r=new Map,a=null;if(n){let[s,i]=n;a=Cs(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let d=Mr(s.getNode(),Mc),c=Mr(i.getNode(),Mc);_e(d)&&r.set(d.getKey(),d),_e(c)&&r.set(c.getKey(),c)}for(let s of e.getNodes())if(_e(s)&&Mc(s))r.set(s.getKey(),s);else if(n===null){let i=Mr(s,Mc);_e(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let d=t();o(i,d),i.replace(d,!0),a&&(s===a.anchor.key&&a.anchor.set(d.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(d.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Te())&&fn(a)}function jR(e){return e.getNode().isAttached()}function fq(e){let t=e;for(;t!==null&&!bs(t);){let o=t.getLatest(),n=t.getParent();o.getChildrenSize()===0&&t.remove(!0),t=n}}function gq(e,t,o=null){let n=e.getStartEndPoints(),r=n?n[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),u=c.getChildren(),m=t();return m.setFormat(c.getFormatType()),m.setIndent(c.getIndent()),u.forEach(p=>m.append(p)),o&&(m=o.append(m)),void c.replace(m)}let i=null,d=[];for(let c=0;c<s;c++){let u=a[c];bs(u)?(Iv(e,d,d.length,t,o),d=[],i=u):i===null||i!==null&&HP(u,i)?d.push(u):(Iv(e,d,d.length,t,o),d=[u])}Iv(e,d,d.length,t,o)}function Iv(e,t,o,n,r=null){if(t.length===0)return;let a=t[0],s=new Map,i=[],d=_e(a)?a:a.getParentOrThrow();d.isInline()&&(d=d.getParentOrThrow());let c=!1;for(;d!==null;){let g=d.getPreviousSibling();if(g!==null){d=g,c=!0;break}if(d=d.getParentOrThrow(),bs(d))break}let u=new Set;for(let g=0;g<o;g++){let h=t[g];_e(h)&&h.getChildrenSize()===0&&u.add(h.getKey())}let m=new Set;for(let g=0;g<o;g++){let h=t[g],y=h.getParent();if(y!==null&&y.isInline()&&(y=y.getParent()),y!==null&&zP(h)&&!m.has(h.getKey())){let x=y.getKey();if(s.get(x)===void 0){let C=n();C.setFormat(y.getFormatType()),C.setIndent(y.getIndent()),i.push(C),s.set(x,C),y.getChildren().forEach(b=>{C.append(b),m.add(b.getKey()),_e(b)&&b.getChildrenKeys().forEach(L=>m.add(L))}),fq(y)}}else if(u.has(h.getKey())){_e(h)||Sv(179);let x=n();x.setFormat(h.getFormatType()),x.setIndent(h.getIndent()),i.push(x),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(bs(d))if(c)if(r!==null)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h)}else{let g=d.getFirstChild();if(_e(g)&&(d=g),g===null)if(r)d.append(r);else for(let h=0;h<i.length;h++){let y=i[h];d.append(y),p=y}else if(r!==null)g.insertBefore(r);else for(let h=0;h<i.length;h++){let y=i[h];g.insertBefore(y),p=y}}else if(r)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h),p=h}let f=Sc();ye(f)&&jR(f.anchor)&&jR(f.focus)?fn(f.clone()):p!==null?p.selectEnd():e.dirty=!0}function eE(e){let t=tE(e);return t!==null&&t.writingMode==="vertical-rl"}function tE(e){let t=e.anchor.getNode();return _e(t)?kv(t):Lv(t)}function hq(e,t){let o=eE(e)?!t:t;Pv(e)&&(o=!o);let n=Gi(e.focus,o?"previous":"next");if($P(n))return!1;for(let r of DP(n)){if(kc(r))return!r.origin.isInline();if(!_e(r.origin)){if(Bm(r.origin))return!0;break}}return!1}function oE(e,t,o,n){e.modify(t?"extend":"move",o,n)}function Pv(e){let t=tE(e);return t!==null&&t.direction==="rtl"}function yq(e,t,o){let n=Pv(e),r;r=eE(e)||n?!o:o,oE(e,t,r,"character")}function vq(e,t,o){let n=uf(e.getStyle());return n!==null&&n[t]||o}function Cq(e,t,o=""){let n=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),d=i?s.offset:a.offset,c=i?s.getNode():a.getNode();if(ye(e)&&e.isCollapsed()&&e.style!==""){let u=uf(e.style);if(u!==null&&t in u)return u[t]}for(let u=0;u<r.length;u++){let m=r[u];if((u===0||d!==0||!m.is(c))&&Ke(m)){let p=vq(m,t,o);if(n===null)n=p;else if(n!==p){n="";break}}}return n===null?o:n}var xq=XR;var Rt=Rv,nE=Rt.$addNodeStyle,Hce=Rt.$cloneWithProperties,Uce=Rt.$copyBlockFormatIndent,$ce=Rt.$ensureForwardRangeSelection,zce=Rt.$forEachSelectedTextNode,Kce=Rt.$getComputedStyleForElement,qce=Rt.$getComputedStyleForParent,Wce=Rt.$getSelectionStyleValueForProperty,Gce=Rt.$isAtNodeEnd,jce=Rt.$isParentElementRTL,Vce=Rt.$isParentRTL,Qce=Rt.$moveCaretSelection,Ev=Rt.$moveCharacter,Xce=Rt.$patchStyleText,Yce=Rt.$selectAll,Jce=Rt.$setBlocksType,Mv=Rt.$shouldOverrideDefaultCharacterSelection,pf=Rt.$sliceSelectedTextNodeContent,Zce=Rt.$trimTextContentFromAnchor,eue=Rt.$wrapNodes,tue=Rt.createDOMRange,rE=Rt.createRectsFromDOMRange,oue=Rt.getCSSFromStyleObject,nue=Rt.getStyleObjectFromCSS,rue=Rt.trimTextContentFromAnchor;var _v={};Ut(_v,{$descendantsMatching:()=>n4,$dfs:()=>Hq,$dfsIterator:()=>fE,$filter:()=>Yq,$findMatchingParent:()=>Mr,$firstToLastIterator:()=>r4,$getAdjacentCaret:()=>Uq,$getAdjacentSiblingOrParentSiblingCaret:()=>xs,$getDepth:()=>hE,$getNearestBlockElementAncestorOrThrow:()=>Wq,$getNearestNodeOfType:()=>qq,$getNextRightPreorderNode:()=>Kq,$getNextSiblingOrParentSibling:()=>zq,$handleIndentAndOutdent:()=>Jq,$insertFirst:()=>Zq,$insertNodeToNearestRoot:()=>Vq,$insertNodeToNearestRootAtCaret:()=>vE,$isEditorIsNestedEditor:()=>t4,$lastToFirstIterator:()=>Dv,$restoreEditorState:()=>jq,$reverseDfs:()=>$q,$reverseDfsIterator:()=>yE,$splitNode:()=>YP,$unwrapAndFilterDescendants:()=>o4,$unwrapNode:()=>a4,$wrapNodeInElement:()=>Qq,CAN_USE_BEFORE_INPUT:()=>Eq,CAN_USE_DOM:()=>uE,IS_ANDROID:()=>Mq,IS_ANDROID_CHROME:()=>Aq,IS_APPLE:()=>Nq,IS_APPLE_WEBKIT:()=>Dq,IS_CHROME:()=>_q,IS_FIREFOX:()=>pE,IS_IOS:()=>Oq,IS_SAFARI:()=>Fq,addClassNamesToElement:()=>Ac,calculateZoomLevel:()=>e4,isBlockDomNode:()=>OR,isHTMLAnchorElement:()=>HR,isHTMLElement:()=>nf,isInlineDomNode:()=>Nc,isMimeType:()=>mE,makeStateWrapper:()=>s4,markSelection:()=>cE,mediaFileReader:()=>Bq,mergeRegister:()=>rr,objectKlassEquals:()=>Xq,positionNodeOnRange:()=>dE,registerNestedElementResolver:()=>Gq,removeClassNamesFromElement:()=>rf,selectionAlwaysOnDisplay:()=>Rq});function mf(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Dn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,bq=Dn&&"documentMode"in document?document.documentMode:null,iE=Dn&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),wq=Dn&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Tq=!(!Dn||!("InputEvent"in window)||bq)&&"getTargetRanges"in new window.InputEvent("input"),Iq=Dn&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Sq=Dn&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,lE=Dn&&/Android/.test(navigator.userAgent),Nv=Dn&&/^(?=.*Chrome).*/i.test(navigator.userAgent),kq=Dn&&lE&&Nv,Lq=Dn&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&iE&&!Nv;function ar(e){return`${e}px`}var Pq={attributes:!0,characterData:!0,childList:!0,subtree:!0};function dE(e,t,o){let n=null,r=null,a=null,s=[],i=document.createElement("div");function d(){n===null&&mf(182),r===null&&mf(183);let{left:m,top:p}=r.getBoundingClientRect(),f=rE(e,t);var g,h;i.isConnected||(h=i,(g=r).insertBefore(h,g.firstChild));let y=!1;for(let x=0;x<f.length;x++){let C=f[x],b=s[x]||document.createElement("div"),L=b.style;L.position!=="absolute"&&(L.position="absolute",y=!0);let w=ar(C.left-m);L.left!==w&&(L.left=w,y=!0);let k=ar(C.top-p);L.top!==k&&(b.style.top=k,y=!0);let I=ar(C.width);L.width!==I&&(b.style.width=I,y=!0);let T=ar(C.height);L.height!==T&&(b.style.height=T,y=!0),b.parentNode!==i&&(i.append(b),y=!0),s[x]=b}for(;s.length>f.length;)s.pop();y&&o(s)}function c(){r=null,n=null,a!==null&&a.disconnect(),a=null,i.remove();for(let m of s)m.remove();s=[]}i.style.position="relative";let u=e.registerRootListener(function m(){let p=e.getRootElement();if(p===null)return c();let f=p.parentElement;if(!nf(f))return c();c(),n=p,r=f,a=new MutationObserver(g=>{let h=e.getRootElement(),y=h&&h.parentElement;if(h!==n||y!==r)return m();for(let x of g)if(!i.contains(x.target))return d()}),a.observe(f,Pq),d()});return()=>{u(),c()}}function aE(e,t,o){if(e.type!=="text"&&_e(t)){let n=t.getDOMSlot(o);return[n.element,n.getFirstChildOffset()+e.offset]}return[DR(o)||o,e.offset]}function cE(e,t){let o=null,n=null,r=null,a=null,s=null,i=null,d=()=>{};function c(u){u.read(()=>{let m=Te();if(!ye(m))return o=null,r=null,a=null,i=null,d(),void(d=()=>{});let[p,f]=(function(T){let S=T.getStartEndPoints();return T.isBackward()?[S[1],S[0]]:S})(m),g=p.getNode(),h=g.getKey(),y=p.offset,x=f.getNode(),C=x.getKey(),b=f.offset,L=e.getElementByKey(h),w=e.getElementByKey(C),k=o===null||L!==n||y!==r||h!==o.getKey(),I=a===null||w!==s||b!==i||C!==a.getKey();if((k||I)&&L!==null&&w!==null){let T=(function(S,P,A,N,B,O,j){let U=(S._window?S._window.document:document).createRange();return U.setStart(...aE(P,A,N)),U.setEnd(...aE(B,O,j)),U})(e,p,g,L,f,x,w);d(),d=dE(e,T,S=>{if(t===void 0)for(let P of S){let A=P.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==ar(-1.5)&&(A.marginTop=ar(-1.5)),A.paddingTop!==ar(4)&&(A.paddingTop=ar(4)),A.paddingBottom!==ar(0)&&(A.paddingBottom=ar(0))}else t(S)})}o=g,n=L,r=y,a=x,s=w,i=b})}return c(e.getEditorState()),rr(e.registerUpdateListener(({editorState:u})=>c(u)),()=>{d()})}function Rq(e,t){let o=null,n=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?o!==null&&(o(),o=null):o===null&&(o=cE(e,t))};return document.addEventListener("selectionchange",n),()=>{o!==null&&o(),document.removeEventListener("selectionchange",n)}}var Eq=Tq,uE=Dn,Mq=lE,Aq=kq,Nq=iE,Dq=Lq,_q=Nv,pE=wq,Oq=Sq,Fq=Iq;function mE(e,t){for(let o of t)if(e.type.startsWith(o))return!0;return!1}function Bq(e,t){let o=e[Symbol.iterator]();return new Promise((n,r)=>{let a=[],s=()=>{let{done:i,value:d}=o.next();if(i)return n(a);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",()=>{let u=c.result;typeof u=="string"&&a.push({file:d,result:u}),s()}),mE(d,t)?c.readAsDataURL(d):s()};s()})}function Hq(e,t){return Array.from(fE(e,t))}function Uq(e){return e?e.getAdjacentCaret():null}function $q(e,t){return Array.from(yE(e,t))}function fE(e,t){return gE("next",e,t)}function sE(e,t){let o=xs(Ar(e,t));return o&&o[0]}function gE(e,t,o){let n=Ye(),r=t||n,a=_e(r)?va(r,e):Ar(r,e),s=hE(r),i=o?lv(cv(Ar(o,e)))||sE(o,e):sE(r,e),d=s;return Cv({hasNext:c=>c!==null,initial:a,map:c=>({depth:d,node:c.origin}),step:c=>{if(c.isSameNodeCaret(i))return null;kc(c)&&d++;let u=xs(c);return!u||u[0].isSameNodeCaret(i)?null:(d+=u[1],u[0])}})}function zq(e){let t=xs(Ar(e,"next"));return t&&[t[0].origin,t[1]]}function hE(e){let t=-1;for(let o=e;o!==null;o=o.getParent())t++;return t}function Kq(e){let t=cv(Ar(e,"previous")),o=xs(t,"root");return o&&o[0].origin}function yE(e,t){return gE("previous",e,t)}function qq(e,t){let o=e;for(;o!=null;){if(o instanceof t)return o;o=o.getParent()}return null}function Wq(e){let t=Mr(e,o=>_e(o)&&!o.isInline());return _e(t)||mf(4,e.__key),t}function Gq(e,t,o,n){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let d=i.getChildren();for(let m=0;m<d.length;m++){let p=d[m];if(r(p))return null}let c=i,u=i;for(;c!==null;)if(u=c,c=c.getParent(),r(c))return{child:u,parent:c};return null})(a);if(s!==null){let{child:i,parent:d}=s;if(i.is(a)){n(d,a);let c=i.getNextSiblings(),u=c.length;if(d.insertAfter(i),u!==0){let m=o(d);i.insertAfter(m);for(let p=0;p<u;p++)m.append(c[p])}d.canBeEmpty()||d.getChildrenSize()!==0||d.remove()}}})}function jq(e,t){let o=new Map,n=e._pendingEditorState;for(let[a,s]of t._nodeMap)o.set(a,_m(s));n&&(n._nodeMap=o),e._dirtyType=2;let r=t._selection;fn(r===null?null:r.clone())}function Vq(e){let t=Te()||Sc(),o;if(ye(t))o=Gi(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(o=Ar(i,"next"))}o=o||va(Ye(),"previous").getFlipped().insert(mn())}let n=vE(e,o),r=lv(n),a=kc(r)?WP(r):n;return QP(FP(a)),e.getLatest()}function vE(e,t,o){let n=dv(t,"next");for(let r=n;r;r=XP(r,o))n=r;return Hm(n)&&mf(283),n.insert(e.isInline()?mn().append(e):e),dv(Ar(e.getLatest(),"next"),t.direction)}function Qq(e,t){let o=t();return e.replace(o),o.append(e),o}function Xq(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function Yq(e,t){let o=[];for(let n=0;n<e.length;n++){let r=t(e[n]);r!==null&&o.push(r)}return o}function Jq(e){let t=Te();if(!ye(t))return!1;let o=new Set,n=t.getNodes();for(let r=0;r<n.length;r++){let a=n[r],s=a.getKey();if(o.has(s))continue;let i=Mr(a,c=>_e(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),e(i))}return o.size>0}function Zq(e,t){va(e,"next").insert(t)}var Av=!(pE||!uE)&&void 0;function e4(e,t=!1){let o=1;if((function(){if(Av===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let r=n.getBoundingClientRect();n.style.setProperty("zoom","2"),Av=n.getBoundingClientRect().width===r.width,document.body.removeChild(n)}return Av})()||t)for(;e;)o*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return o}function t4(e){return e._parentEditor!==null}function o4(e,t){return CE(e,t,null)}function CE(e,t,o){let n=!1;for(let r of Dv(e))t(r)?o!==null&&o(r):(n=!0,_e(r)&&CE(r,t,o||(a=>r.insertAfter(a))),r.remove());return n}function n4(e,t){let o=[],n=Array.from(e).reverse();for(let r=n.pop();r!==void 0;r=n.pop())if(t(r))o.push(r);else if(_e(r))for(let a of Dv(r))n.push(a);return o}function r4(e){return xE(va(e,"next"))}function Dv(e){return xE(va(e,"previous"))}function xE(e){return Cv({hasNext:qP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function a4(e){VP(Ar(e,"next")).splice(1,e.getChildren())}function s4(e){let t=n=>Fm(n,e),o=(n,r)=>$m(n,e,r);return{$get:t,$set:o,accessors:[t,o],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(n){return o(this,n)},stateConfig:e}}var Be=_v,due=Be.$descendantsMatching,cue=Be.$dfs,uue=Be.$dfsIterator,pue=Be.$filter,mue=Be.$findMatchingParent,fue=Be.$firstToLastIterator,gue=Be.$getAdjacentCaret,hue=Be.$getAdjacentSiblingOrParentSiblingCaret,yue=Be.$getDepth,bE=Be.$getNearestBlockElementAncestorOrThrow,vue=Be.$getNearestNodeOfType,Cue=Be.$getNextRightPreorderNode,xue=Be.$getNextSiblingOrParentSibling,wE=Be.$handleIndentAndOutdent,bue=Be.$insertFirst,wue=Be.$insertNodeToNearestRoot,Tue=Be.$insertNodeToNearestRootAtCaret,Iue=Be.$isEditorIsNestedEditor,Sue=Be.$lastToFirstIterator,kue=Be.$restoreEditorState,Lue=Be.$reverseDfs,Pue=Be.$reverseDfsIterator,Rue=Be.$splitNode,Eue=Be.$unwrapAndFilterDescendants,Mue=Be.$unwrapNode,Aue=Be.$wrapNodeInElement,Nue=Be.CAN_USE_BEFORE_INPUT,Due=Be.CAN_USE_DOM,_ue=Be.IS_ANDROID,Oue=Be.IS_ANDROID_CHROME,Fue=Be.IS_APPLE,Bue=Be.IS_APPLE_WEBKIT,Hue=Be.IS_CHROME,Uue=Be.IS_FIREFOX,$ue=Be.IS_IOS,zue=Be.IS_SAFARI,Kue=Be.addClassNamesToElement,que=Be.calculateZoomLevel,Ov=Be.isBlockDomNode,Wue=Be.isHTMLAnchorElement,TE=Be.isHTMLElement,Gue=Be.isInlineDomNode,jue=Be.isMimeType,Vue=Be.makeStateWrapper,Que=Be.markSelection,Xue=Be.mediaFileReader,Nr=Be.mergeRegister,Dc=Be.objectKlassEquals,Yue=Be.positionNodeOnRange,Jue=Be.registerNestedElementResolver,Zue=Be.removeClassNamesFromElement,epe=Be.selectionAlwaysOnDisplay;var Fv={};Ut(Fv,{ContentEditable:()=>l4,ContentEditableElement:()=>kE});$();var SE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function i4({editor:e,ariaActiveDescendant:t,ariaAutoComplete:o,ariaControls:n,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:d,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:m,ariaRequired:p,autoCapitalize:f,className:g,id:h,role:y="textbox",spellCheck:x=!0,style:C,tabIndex:b,"data-testid":L,...w},k){let[I,T]=q(e.isEditable()),S=R(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),P=W(()=>(function(...A){return N=>{for(let B of A)typeof B=="function"?B(N):B!=null&&(B.current=N)}})(k,S),[S,k]);return SE(()=>(T(e.isEditable()),e.registerEditableListener(A=>{T(A)})),[e]),l("div",{"aria-activedescendant":I?t:void 0,"aria-autocomplete":I?o:"none","aria-controls":I?n:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":I&&y==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":d,"aria-labelledby":c,"aria-multiline":u,"aria-owns":I?m:void 0,"aria-readonly":!I||void 0,"aria-required":p,autoCapitalize:f,className:g,contentEditable:I,"data-testid":L,id:h,ref:P,role:y,spellCheck:x,style:C,tabIndex:b,...w})}var kE=$n(i4);function IE(e){return e.getEditorState().read(lf(e.isComposing()))}var l4=$n(d4);function d4(e,t){let{placeholder:o,...n}=e,[r]=ct();return v(oe,{children:[l(kE,{editor:r,...n,ref:t}),o!=null&&l(c4,{editor:r,content:o})]})}function c4({content:e,editor:t}){let o=(function(s){let[i,d]=q(()=>IE(s));return SE(()=>{function c(){let u=IE(s);d(u)}return c(),Nr(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),i})(t),[n,r]=q(t.isEditable());if(fe(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[t]),!o)return null;let a=null;return typeof e=="function"?a=e(n):e!==null&&(a=e),a===null?null:l("div",{"aria-hidden":!0,children:a})}var LE=Fv,PE=LE.ContentEditable,ipe=LE.ContentEditableElement;$();var u4=qe(null),Bv={didCatch:!1,error:null},ff=class extends ur{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Bv}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:o}=this.state;o!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Bv))}componentDidCatch(t,o){this.props.onError?.(t,o)}componentDidUpdate(t,o){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&o.error!==null&&p4(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Bv))}render(){let{children:t,fallbackRender:o,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:s}=this.state,i=t;if(a){let d={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof o=="function")i=o(d);else if(n)i=vn(n,d);else if(r!==void 0)i=r;else throw s}return vn(u4.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function p4(e=[],t=[]){return e.length!==t.length||e.some((o,n)=>!Object.is(o,t[n]))}var Hv={};Ut(Hv,{LexicalErrorBoundary:()=>m4});function m4({children:e,onError:t}){return l(ff,{fallback:l("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var f4=Hv,RE=f4.LexicalErrorBoundary;var eC={};Ut(eC,{$createHorizontalRuleNode:()=>Zv,$isDecoratorTextNode:()=>KE,$isHorizontalRuleNode:()=>QE,AutoFocusExtension:()=>y4,ClearEditorExtension:()=>v4,DecoratorTextExtension:()=>I4,DecoratorTextNode:()=>Fc,EditorStateExtension:()=>vf,HorizontalRuleExtension:()=>_4,HorizontalRuleNode:()=>Is,INSERT_HORIZONTAL_RULE_COMMAND:()=>N4,InitialStateExtension:()=>jE,LexicalBuilder:()=>Ji,NodeSelectionExtension:()=>Qv,TabIndentationExtension:()=>O4,applyFormatFromStyle:()=>x4,applyFormatToDom:()=>b4,batch:()=>_E,buildEditorFromExtensions:()=>P4,computed:()=>BE,configExtension:()=>tf,declarePeerDependency:()=>NR,defineExtension:()=>zt,effect:()=>wa,getExtensionDependencyFromEditor:()=>E4,getKnownTypesAndNodes:()=>C4,getPeerDependencyFromEditor:()=>VE,getPeerDependencyFromEditorOrThrow:()=>M4,namedSignals:()=>xf,registerClearEditor:()=>$E,registerTabIndentation:()=>YE,safeCast:()=>Nn,shallowMergeConfig:()=>af,signal:()=>Yi,untracked:()=>Wv,watchedSignal:()=>Yv});var g4=Symbol.for("preact-signals");function Cf(){if(ba>1)return void ba--;let e,t=!1;for(;Oc!==void 0;){let o=Oc;for(Oc=void 0,Gv++;o!==void 0;){let n=o.o;if(o.o=void 0,o.f&=-3,!(8&o.f)&&OE(o))try{o.c()}catch(r){t||(e=r,t=!0)}o=n}}if(Gv=0,ba--,t)throw e}function _E(e){if(ba>0)return e();ba++;try{return e()}finally{Cf()}}var st,Oc;function Wv(e){let t=st;st=void 0;try{return e()}finally{st=t}}var ba=0,Gv=0,yf=0;function EE(e){if(st===void 0)return;let t=e.n;return t===void 0||t.t!==st?(t={i:0,S:e,p:st.s,n:void 0,t:st,e:void 0,x:void 0,r:t},st.s!==void 0&&(st.s.n=t),st.s=t,e.n=t,32&st.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=st.s,t.n=void 0,st.s.n=t,st.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 Yi(e,t){return new Lo(e,t)}function OE(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 ME(e){for(let t=e.s;t!==void 0;t=t.n){let o=t.S.n;if(o!==void 0&&(t.r=o),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function FE(e){let t,o=e.s;for(;o!==void 0;){let n=o.p;o.i===-1?(o.S.U(o),n!==void 0&&(n.n=o.n),o.n!==void 0&&(o.n.p=n)):t=o,o.S.n=o.r,o.r!==void 0&&(o.r=void 0),o=n}e.s=t}function Ts(e,t){Lo.call(this,void 0),this.x=e,this.s=void 0,this.g=yf-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function BE(e,t){return new Ts(e,t)}function HE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){ba++;let o=st;st=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Xv(e),n}finally{st=o,Cf()}}}function Xv(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,HE(e)}function h4(e){if(st!==this)throw new Error("Out-of-order effect");FE(this),st=e,this.f&=-2,8&this.f&&Xv(this),Cf()}function Xi(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 wa(e,t){let o=new Xi(e,t);try{o.c()}catch(r){throw o.d(),r}let n=o.d.bind(o);return n[Symbol.dispose]=n,n}function xf(e,t={}){let o={};for(let n in e){let r=t[n],a=Yi(r===void 0?e[n]:r);o[n]=a}return o}Lo.prototype.brand=g4,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:Wv(()=>{var o;(o=this.W)==null||o.call(this)}))},Lo.prototype.U=function(e){if(this.t!==void 0){let t=e.e,o=e.x;t!==void 0&&(t.x=o,e.e=void 0),o!==void 0&&(o.e=t,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Wv(()=>{var n;(n=this.Z)==null||n.call(this)}))}},Lo.prototype.subscribe=function(e){return wa(()=>{let t=this.value,o=st;st=void 0;try{e(t)}finally{st=o}},{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=st;st=void 0;try{return this.value}finally{st=e}},Object.defineProperty(Lo.prototype,"value",{get(){let e=EE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Gv>100)throw new Error("Cycle detected");this.v=e,this.i++,yf++,ba++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Cf()}}}}),Ts.prototype=new Lo,Ts.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===yf))return!0;if(this.g=yf,this.f|=1,this.i>0&&!OE(this))return this.f&=-2,!0;let e=st;try{ME(this),st=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 st=e,FE(this),this.f&=-2,!0},Ts.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)},Ts.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)}},Ts.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(Ts.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=EE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Xi.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()}},Xi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,HE(this),ME(this),ba++;let e=st;return st=this,h4.bind(this,e)},Xi.prototype.N=function(){2&this.f||(this.f|=2,this.o=Oc,Oc=this)},Xi.prototype.d=function(){this.f|=8,1&this.f||Xv(this)},Xi.prototype.dispose=function(){this.d()};var y4=zt({build:(e,t,o)=>xf(t),config:Nn({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,o){let n=o.getOutput();return wa(()=>n.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:n.defaultSelection.peek()})}))}});function UE(){let e=Ye(),t=Te(),o=mn();e.clear(),e.append(o),t!==null&&o.select(),ye(t)&&(t.format=0)}function $E(e,t=UE){return e.registerCommand(zm,o=>(e.update(t),!0),vt)}var v4=zt({build:(e,t,o)=>xf(t),config:Nn({$onClear:UE}),name:"@lexical/extension/ClearEditor",register(e,t,o){let{$onClear:n}=o.getOutput();return wa(()=>$E(e,n.value))}});function C4(e){let t=new Set,o=new Set;for(let n of zE(e)){let r=typeof n=="function"?n:n.replace;t.add(r.getType()),o.add(r)}return{nodes:o,types:t}}function zE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Uv=AR("format",{parse:e=>typeof e=="number"?e:0}),Fc=class extends xa{$config(){return this.config("decorator-text",{extends:xa,stateConfigs:[{flat:!0,stateConfig:Uv}]})}getFormat(){return Fm(this,Uv)}getFormatFlags(t,o){return xv(this.getFormat(),t,o)}hasFormat(t){let o=PR[t];return(this.getFormat()&o)!==0}setFormat(t){return $m(this,Uv,t)}toggleFormat(t){let o=this.getFormat(),n=xv(o,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function KE(e){return e instanceof Fc}function x4(e,t,o){let n=t.fontWeight,r=t.textDecoration.split(" "),a=n==="700"||n==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",d=r.includes("underline"),c=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!e.hasFormat("italic")&&e.toggleFormat("italic"),d&&!e.hasFormat("underline")&&e.toggleFormat("underline"),c!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),c!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),o&&!e.hasFormat(o)&&e.toggleFormat(o),e}function b4(e,t,o=T4){for(let[n,r]of Object.entries(o))e.hasFormat(r)&&(t=w4(t,n));return t}function w4(e,t){let o=document.createElement(t);return o.appendChild(e),o}var T4={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},I4=zt({name:"@lexical/extension/DecoratorText",nodes:()=>[Fc],register:(e,t,o)=>e.registerCommand(cR,n=>{let r=Te();if(uv(r)||ye(r))for(let a of r.getNodes())KE(a)&&a.toggleFormat(n);return!1},Vi)});function Yv(e,t){let o;return Yi(e(),{unwatched(){o&&(o(),o=void 0)},watched(){this.value=e(),o=t(this)}})}var vf=zt({build:e=>Yv(()=>e.getEditorState(),t=>e.registerUpdateListener(o=>{t.value=o.editorState})),name:"@lexical/extension/EditorState"});function ut(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function qE(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let o=e,n=t;for(let r in n)o[r]=qE(o[r],n[r]);return e}return t}var Jv=0,jv=1,WE=2,$v=3,gf=4,Qi=5,zv=6,_c=7;function Kv(e){return e.id===Jv}function GE(e){return e.id===WE}function S4(e){return(function(t){return t.id===jv})(e)||ut(305,String(e.id),String(jv)),Object.assign(e,{id:WE})}var k4=new Set,Vv=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,o){this.builder=t,this.extension=o,this.configs=new Set,this.state={id:Jv}}mergeConfigs(){let t=this.extension.config||{},o=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):af;for(let n of this.configs)t=o(t,n);return t}init(t){let o=this.state;GE(o)||ut(306,String(o.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(i,d,c){return Object.assign(i,{config:d,id:$v,registerState:c})})(o,this.mergeConfigs(),n),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,n)),this.state=(function(i,d,c){return Object.assign(i,{id:gf,initResult:d,registerState:c})})(a,s,r)}build(t){let o=this.state,n;o.id!==gf&&ut(307,String(o.id),String(Qi)),this.extension.build&&(n=this.extension.build(t,o.config,o.registerState));let r={...o.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=(function(a,s,i){return Object.assign(a,{id:Qi,output:s,registerState:i})})(o,n,r)}register(t,o){this._signal=o;let n=this.state;n.id!==Qi&&ut(308,String(n.id),String(Qi));let r=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=(function(a){return Object.assign(a,{id:zv})})(n),()=>{let a=this.state;a.id!==_c&&ut(309,String(n.id),String(_c)),this.state=(function(s){return Object.assign(s,{id:Qi})})(a),r&&r()}}afterRegistration(t){let o=this.state,n;return o.id!==zv&&ut(310,String(o.id),String(zv)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,o.config,o.registerState)),this.state=(function(r){return Object.assign(r,{id:_c})})(o),n}getSignal(){return this._signal===void 0&&ut(311),this._signal}getInitResult(){this.extension.init===void 0&&ut(312,this.extension.name);let t=this.state;return(function(o){return o.id>=gf})(t)||ut(313,String(t.id),String(gf)),t.initResult}getInitPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(o){return o.id>=$v})(t)||ut(314,String(t.id),String($v)),{config:t.config}}getPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}getInitDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionInitDependency()}getDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionDependency()}getState(){let t=this.state;return(function(o){return o.id>=_c})(t)||ut(316,String(t.id),String(_c)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||k4}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([o])=>o)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(o){return o.id>=Qi})(t)||ut(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},AE={tag:zo};function L4(){let e=Ye();e.isEmpty()&&e.append(mn())}var jE=zt({config:Nn({setOptions:AE,updateOptions:AE}),init:({$initialEditorState:e=L4})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:o},n){let r=n.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(UP(a))e.setEditorState(a,o);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,o)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[IR,ef,vR,RR,bR]}),NE=Symbol.for("@lexical/extension/LexicalBuilder");function P4(...e){return Ji.fromExtensions(e).buildEditor()}function DE(){}function R4(e){throw e}function hf(e){return Array.isArray(e)?e:[e]}var qv="0.41.0+prod.esm",Ji=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=qv,this.roots=t;for(let o of t)this.addExtension(o)}static fromExtensions(t){let o=[hf(jE)];for(let n of t)o.push(hf(n));return new e(o)}static maybeFromEditor(t){let o=t[NE];return o&&(o.PACKAGE_VERSION!==qv&&ut(292,o.PACKAGE_VERSION,qv),o instanceof e||ut(293)),o}static fromEditor(t){let o=e.maybeFromEditor(t);return o===void 0&&ut(294),o}constructEditor(){let{$initialEditorState:t,onError:o,...n}=this.buildCreateEditorArgs(),r=Object.assign(of({...n,...o?{onError:a=>{o(a,r)}}:{}}),{[NE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=DE;function o(){try{t()}finally{t=DE}}let n=Object.assign(this.constructEditor(),{dispose:o,[Symbol.dispose]:o});return t=rr(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let o=this.extensionNameMap.get(t.name);if(o)return o.extension!==t&&ut(295,t.name),o}addEdge(t,o,n){let r=this.outgoingConfigEdges.get(t);r?r.set(o,n):this.outgoingConfigEdges.set(t,new Map([[o,n]]));let a=this.incomingEdges.get(o);a?a.add(t):this.incomingEdges.set(o,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&ut(296);let o=hf(t),[n]=o;typeof n.name!="string"&&ut(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(r!==void 0&&r.extension!==n&&ut(298,n.name),!r){r=new Vv(this,n),this.extensionNameMap.set(n.name,r);let a=this.conflicts.get(n.name);typeof a=="string"&&ut(299,n.name,a);for(let s of n.conflictsWith||[])this.extensionNameMap.has(s)&&ut(299,n.name,s),this.conflicts.set(s,n.name);for(let s of n.dependencies||[]){let i=hf(s);this.addEdge(n.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of n.peerDependencies||[])this.addEdge(n.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],o=(n,r)=>{let a=n.state;if(GE(a))return;let s=n.extension.name;var i;Kv(a)||ut(300,s,r||"[unknown]"),Kv(i=a)||ut(304,String(i.id),String(Jv)),a=Object.assign(i,{id:jv}),n.state=a;let d=this.outgoingConfigEdges.get(s);if(d)for(let c of d.keys()){let u=this.extensionNameMap.get(c);u&&o(u,s)}a=S4(a),n.state=a,t.push(n)};for(let n of this.extensionNameMap.values())Kv(n.state)&&o(n);for(let n of t)for(let[r,a]of this.outgoingConfigEdges.get(n.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[n,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(n.name);a===void 0&&ut(301,n.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let o=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],a=n.signal;for(let s of o){let i=s.register(t,a);i&&r.push(i)}for(let s of o){let i=s.afterRegistration(t);i&&r.push(i)}return rr(...r)}buildCreateEditorArgs(){let t={},o=new Set,n=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let u of i){let{extension:m}=u;if(m.onError!==void 0&&(t.onError=m.onError),m.disableEvents!==void 0&&(t.disableEvents=m.disableEvents),m.parentEditor!==void 0&&(t.parentEditor=m.parentEditor),m.editable!==void 0&&(t.editable=m.editable),m.namespace!==void 0&&(t.namespace=m.namespace),m.$initialEditorState!==void 0&&(t.$initialEditorState=m.$initialEditorState),m.nodes)for(let p of zE(m)){if(typeof p!="function"){let f=n.get(p.replace);f&&ut(302,m.name,p.replace.name,f.extension.name),n.set(p.replace,u)}o.add(p)}if(m.html){if(m.html.export)for(let[p,f]of m.html.export.entries())r.set(p,f);m.html.import&&Object.assign(a,m.html.import)}m.theme&&qE(s,m.theme)}Object.keys(s).length>0&&(t.theme=s),o.size&&(t.nodes=[...o]);let d=Object.keys(a).length>0,c=r.size>0;(d||c)&&(t.html={},d&&(t.html.import=a),c&&(t.html.export=r));for(let u of i)u.init(t);return t.onError||(t.onError=R4),t}};function E4(e,t){let o=Ji.fromEditor(e).getExtensionRep(t);return o===void 0&&ut(303,t.name),o.getExtensionDependency()}function VE(e,t){let o=Ji.fromEditor(e).extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}function M4(e,t){let o=VE(e,t);return o===void 0&&ut(291,t),o}var A4=new Set,Qv=zt({build(e,t,o){let n=o.getDependency(vf).output,r=Yi({watchedNodeKeys:new Map}),a=Yv(()=>{},()=>wa(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,d,c=!1;n.value.read(()=>{if(Te())for(let[u,m]of i.entries()){if(m.size===0){i.delete(u);continue}let p=Ca(u),f=p&&p.isSelected()||!1;c=c||f!==(!!s&&s.has(u)),f&&(d=d||new Set,d.add(u))}}),!c&&d&&s&&d.size===s.size||(a.value=d)}));return{watchNodeKey:function(s){let i=BE(()=>(a.value||A4).has(s)),{watchedNodeKeys:d}=r.peek(),c=d.get(s),u=c!==void 0;return c=c||new Set,c.add(i),u||(d.set(s,c),r.value={watchedNodeKeys:d}),i}}},dependencies:[vf],name:"@lexical/extension/NodeSelection"}),N4=MR("INSERT_HORIZONTAL_RULE_COMMAND"),Is=class e extends xa{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return Zv().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:D4,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let o=document.createElement("hr");return Ac(o,t.theme.hr),o}getTextContent(){return`
|
|
3563
|
+
`}isInline(){return!1}updateDOM(){return!1}};function D4(){return{node:Zv()}}function Zv(){return EP(Is)}function QE(e){return e instanceof Is}var _4=zt({dependencies:[vf,Qv],name:"@lexical/extension/HorizontalRule",nodes:()=>[Is],register(e,t,o){let{watchNodeKey:n}=o.getDependency(Qv).output,r=Yi({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return rr(e.registerCommand(eR,s=>{if(BR(s.target)){let i=BP(s.target);if(QE(i))return(function(d,c=!1){let u=Te(),m=d.isSelected(),p=d.getKey(),f;c&&uv(u)?f=u:(f=MP(),fn(f)),m?f.delete(p):f.add(p)})(i,s.shiftKey),!0}return!1},Vi),e.registerMutationListener(Is,(s,i)=>{_E(()=>{let d=!1,{nodeSelections:c}=r.peek();for(let[u,m]of s.entries())if(m==="destroyed")c.delete(u),d=!0;else{let p=c.get(u),f=e.getElementByKey(u);p?p.domNode.value=f:(d=!0,c.set(u,{domNode:Yi(f),selectedSignal:n(u)}))}d&&(r.value={nodeSelections:c})})}),wa(()=>{let s=[];for(let{domNode:i,selectedSignal:d}of r.value.nodeSelections.values())s.push(wa(()=>{let c=i.value;c&&(d.value?Ac(c,a):rf(c,a))}));return rr(...s)}))}});function XE(e){return e.canBeEmpty()}function YE(e,t,o=XE){return rr(e.registerCommand(Jm,n=>{let r=Te();if(!ye(r))return!1;n.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>ji(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,d=s.focus,c=d.isBefore(i)?d:i,u=c.getNode(),m=bE(u);if(m.canIndent()){let p=m.getKey(),f=Cs();if(f.anchor.set(p,0,"element"),f.focus.set(p,0,"element"),f=GP(f),f.anchor.is(c))return!0}return!1})(r)?n.shiftKey?CR:fv:mR;return e.dispatchCommand(a,void 0)},vt),e.registerCommand(fv,()=>{let n=typeof t=="number"?t:t?t.peek():null,r=Te();if(!ye(r))return!1;let a=typeof o=="function"?o:o.peek();return wE(s=>{if(a(s)){let i=s.getIndent()+1;(!n||i<n)&&s.setIndent(i)}})},Km))}var O4=zt({build:(e,t,o)=>xf(t),config:Nn({$canIndent:XE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,o){let{disabled:n,maxIndent:r,$canIndent:a}=o.getOutput();return wa(()=>{if(!n.value)return YE(e,r,a)})}});var Qe=eC,ype=Qe.$createHorizontalRuleNode,vpe=Qe.$isDecoratorTextNode,Cpe=Qe.$isHorizontalRuleNode,xpe=Qe.AutoFocusExtension,bpe=Qe.ClearEditorExtension,wpe=Qe.DecoratorTextExtension,Tpe=Qe.DecoratorTextNode,Ipe=Qe.EditorStateExtension,Spe=Qe.HorizontalRuleExtension,kpe=Qe.HorizontalRuleNode,Lpe=Qe.INSERT_HORIZONTAL_RULE_COMMAND,Ppe=Qe.InitialStateExtension,JE=Qe.LexicalBuilder,Rpe=Qe.NodeSelectionExtension,Epe=Qe.TabIndentationExtension,Mpe=Qe.applyFormatFromStyle,Ape=Qe.applyFormatToDom,ZE=Qe.batch,Npe=Qe.buildEditorFromExtensions,Dpe=Qe.computed,_pe=Qe.configExtension,Ope=Qe.declarePeerDependency,Fpe=Qe.defineExtension,Bc=Qe.effect,Bpe=Qe.getExtensionDependencyFromEditor,Hpe=Qe.getKnownTypesAndNodes,eM=Qe.getPeerDependencyFromEditor,Upe=Qe.getPeerDependencyFromEditorOrThrow,bf=Qe.namedSignals,$pe=Qe.registerClearEditor,zpe=Qe.registerTabIndentation,Kpe=Qe.safeCast,qpe=Qe.shallowMergeConfig,Wpe=Qe.signal,Gpe=Qe.untracked,jpe=Qe.watchedSignal;var tC={};Ut(tC,{HistoryExtension:()=>wf,SharedHistoryExtension:()=>H4,createEmptyHistoryState:()=>nM,registerHistory:()=>oM});function F4(e,t,o,n,r){if(e===null||o.size===0&&n.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(ye(a)&&ye(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(x,C,b){let L=x._nodeMap,w=[];for(let k of C){let I=L.get(k);I!==void 0&&w.push(I)}for(let[k,I]of b){if(!I)continue;let T=L.get(k);T===void 0||Pc(T)||w.push(T)}return w})(t,o,n);if(i.length===0)return 0;if(i.length>1){let x=t._nodeMap,C=x.get(a.anchor.key),b=x.get(s.anchor.key);return C&&b&&!e._nodeMap.has(C.__key)&&Ke(C)&&C.__text.length===1&&a.anchor.offset===1?2:0}let d=i[0],c=e._nodeMap.get(d.__key);if(!Ke(c)||!Ke(d)||c.__mode!==d.__mode)return 0;let u=c.__text,m=d.__text;if(u===m)return 0;let p=a.anchor,f=s.anchor;if(p.key!==f.key||p.type!=="text")return 0;let g=p.offset,h=f.offset,y=m.length-u.length;return y===1&&h===g-1?2:y===-1&&h===g+1?3:y===-1&&h===g?4:0}function B4(e,t){let o=Date.now(),n=0,r=Date.now(),a=0,s=null;return(i,d,c,u,m,p)=>{let f=Date.now();if(p.has(oR)&&(r=o,a=n,s=i),p.has(Gm))return n=0,o=f,2;p.has(tR)&&s&&(o=r,n=a,i=s);let g=F4(i,d,u,m,e.isComposing()),h=(()=>{let y=c===null||c.editor===e,x=p.has(uR);if(!x&&y&&p.has(zo))return 0;if(g===1)return 2;if(i===null)return 1;let C=d._selection;if(!(u.size>0||m.size>0))return C!==null?0:2;let b=typeof t=="number"?t:t.peek();return x===!1&&g!==0&&g===n&&f<o+b&&y||u.size===1&&(function(L,w,k){let I=w._nodeMap.get(L),T=k._nodeMap.get(L),S=w._selection,P=k._selection;return!(ye(S)&&ye(P)&&S.anchor.type==="element"&&S.focus.type==="element"&&P.anchor.type==="text"&&P.focus.type==="text"||!Ke(I)||!Ke(T)||I.__parent!==T.__parent)&&JSON.stringify(w.read(()=>I.exportJSON()))===JSON.stringify(k.read(()=>T.exportJSON()))})(Array.from(u)[0],i,d)?0:1})();return o=f,n=g,h}}function tM(e){e.undoStack=[],e.redoStack=[],e.current=null}function oM(e,t,o){let n=B4(e,o);return Nr(e.registerCommand(ER,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(d.length!==0){let c=s.current,u=d.pop();c!==null&&(i.push(c),a.dispatchCommand(Rc,!0)),d.length===0&&a.dispatchCommand(Ec,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Gm})}})(e,t),!0),vt),e.registerCommand(wR,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(i.length!==0){let c=s.current;c!==null&&(d.push(c),a.dispatchCommand(Ec,!0));let u=i.pop();i.length===0&&a.dispatchCommand(Rc,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:Gm})}})(e,t),!0),vt),e.registerCommand(zm,()=>(tM(t),!1),vt),e.registerCommand(ZP,()=>(tM(t),e.dispatchCommand(Rc,!1),e.dispatchCommand(Ec,!1),!0),vt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,dirtyElements:d,tags:c})=>{let u=t.current,m=t.redoStack,p=t.undoStack,f=u===null?null:u.editorState;if(u!==null&&a===f)return;let g=n(s,a,u,i,d,c);if(g===1)m.length!==0&&(t.redoStack=[],e.dispatchCommand(Rc,!1)),u!==null&&(p.push({...u}),e.dispatchCommand(Ec,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function nM(){return{current:null,redoStack:[],undoStack:[]}}var wf=zt({build:(e,{delay:t,createInitialHistoryState:o,disabled:n})=>bf({delay:t,disabled:n,historyState:o(e)}),config:Nn({createInitialHistoryState:nM,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,o)=>{let n=o.getOutput();return Bc(()=>n.disabled.value?void 0:oM(e,n.historyState.value,n.delay))}}),H4=zt({dependencies:[tf(wf,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,o){let{output:n}=o.getDependency(wf),r=(function(s){return s?eM(s,wf.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Bc(()=>ZE(()=>{n.delay.value=a.delay.value,n.historyState.value=a.historyState.value,n.disabled.value=a.disabled.value}))}});var Tf=tC,Jpe=Tf.HistoryExtension,Zpe=Tf.SharedHistoryExtension,If=Tf.createEmptyHistoryState,rM=Tf.registerHistory;var oC={};Ut(oC,{HistoryPlugin:()=>U4,createEmptyHistoryState:()=>If});$();function U4({delay:e,externalHistoryState:t}){let[o]=ct();return(function(n,r,a=1e3){let s=W(()=>r||If(),[r]);H(()=>rM(n,s,a),[a,n,s])})(o,t,e),null}var aM=oC,sM=aM.HistoryPlugin,iM=aM.createEmptyHistoryState;var nC={};Ut(nC,{OnChangePlugin:()=>z4});$();var $4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function z4({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:o}){let[n]=ct();return $4(()=>{if(o)return n.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:d})=>{t&&a.size===0&&s.size===0||e&&d.has(zo)||i.isEmpty()||o(r,n,d)})},[n,e,t,o]),null}var K4=nC,lM=K4.OnChangePlugin;var rC={};Ut(rC,{useLexicalEditable:()=>G4});$();var q4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function W4(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function G4(){return(function(e){let[t]=ct(),o=W(()=>e(t),[t,e]),[n,r]=q(()=>o.initialValueFn()),a=E(n);return q4(()=>{let{initialValueFn:s,subscribe:i}=o,d=s();return a.current!==d&&(a.current=d,r(d)),i(c=>{a.current=c,r(c)})},[o,e]),n})(W4)}var j4=rC,Sf=j4.useLexicalEditable;var aC={};Ut(aC,{ReactProviderExtension:()=>V4});var V4=zt({name:"@lexical/react/ReactProvider"});var Q4=aC,dM=Q4.ReactProviderExtension;var sC={};Ut(sC,{DragonExtension:()=>X4,registerDragonSupport:()=>cM});function cM(e){let t=window.location.origin,o=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=n.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 d=i.args;if(d){let[c,u,m,p,f]=d;e.update(()=>{let g=Te();if(ye(g)){let h=g.anchor,y=h.getNode(),x=0,C=0;if(Ke(y)&&c>=0&&u>=0&&(x=c,C=c+u,g.setTextNodeRange(y,x,y,C)),x===C&&m===""||(g.insertRawText(m),y=h.getNode()),Ke(y)){x=p,C=p+f;let b=y.getTextContentSize();x=x>b?b:x,C=C>b?b:C,g.setTextNodeRange(y,x,y,C)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",o,!0),()=>{window.removeEventListener("message",o,!0)}}var X4=zt({build:(e,t,o)=>bf(t),config:Nn({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,o)=>Bc(()=>o.getOutput().disabled.value?void 0:cM(e))});var uM=sC,pM=uM.DragonExtension,mM=uM.registerDragonSupport;var iC={};Ut(iC,{$generateHtmlFromNodes:()=>J4,$generateNodesFromDOM:()=>Y4});function Y4(e,t){let o=FR(t)?t.body.childNodes:t.childNodes,n=[],r=[];for(let a of o)if(!gM.has(a.nodeName)){let s=hM(a,e,r,!1);s!==null&&(n=n.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof mv&&s.insertAfter(vs());for(let s of a){let i=s.getChildren();for(let d of i)s.insertBefore(d);s.remove()}})(r),n}function J4(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 o=document.createElement("div"),n=Ye().getChildren();for(let r=0;r<n.length;r++)fM(e,n[r],o,t);return o.innerHTML}function fM(e,t,o,n=null){let r=n===null||t.isSelected(n),a=_e(t)&&t.excludeFromCopy("html"),s=t;n!==null&&Ke(t)&&(s=pf(n,t,"clone"));let i=_e(s)?s.getChildren():[],d=_R(e,s.getType()),c;c=d&&d.exportDOM!==void 0?d.exportDOM(e,s):s.exportDOM(e);let{element:u,after:m}=c;if(!u)return!1;let p=document.createDocumentFragment();for(let f=0;f<i.length;f++){let g=i[f],h=fM(e,g,p,n);!r&&_e(t)&&h&&t.extractWithChild(g,n,"html")&&(r=!0)}if(r&&!a){if((TE(u)||vv(u))&&u.append(p),o.append(u),m){let f=m.call(s,u);f&&(vv(u)?u.replaceChildren(f):u.replaceWith(f))}}else o.append(p);return r}var gM=new Set(["STYLE","SCRIPT"]);function hM(e,t,o,n,r=new Map,a){let s=[];if(gM.has(e.nodeName))return s;let i=null,d=(function(g,h){let{nodeName:y}=g,x=h._htmlConversions.get(y.toLowerCase()),C=null;if(x!==void 0)for(let b of x){let L=b(g);L!==null&&(C===null||(C.priority||0)<=(L.priority||0))&&(C=L)}return C!==null?C.conversion:null})(e,t),c=d?d(e):null,u=null;if(c!==null){u=c.after;let g=c.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])}c.forChild!=null&&r.set(e.nodeName,c.forChild)}let m=e.childNodes,p=[],f=(i==null||!bs(i))&&(i!=null&&ji(i)||n);for(let g=0;g<m.length;g++)p.push(...hM(m[g],t,o,f,new Map(r),i));return u!=null&&(p=u(p)),Ov(e)&&(p=Z4(e,p,f?()=>{let g=new mv;return o.push(g),g}:mn)),i==null?p.length>0?s=s.concat(p):Ov(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Nc(g.nextSibling)&&Nc(g.previousSibling)})(e)&&(s=s.concat(vs())):_e(i)&&i.append(...p),s}function Z4(e,t,o){let n=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(ji(i))n&&!i.getFormat()&&i.setFormat(n),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&ji(t[s+1])){let d=o();d.setFormat(n),d.append(...a),r.push(d),a=[]}}return r}var yM=iC,vM=yM.$generateHtmlFromNodes,CM=yM.$generateNodesFromDOM;var dC={};Ut(dC,{$generateJSONFromSelectedNodes:()=>IM,$generateNodesFromSerializedNodes:()=>SM,$getClipboardDataFromSelection:()=>LM,$getHtmlContent:()=>bM,$getLexicalContent:()=>wM,$insertDataTransferForPlainText:()=>e3,$insertDataTransferForRichText:()=>t3,$insertGeneratedNodes:()=>lC,copyToClipboard:()=>o3,setLexicalClipboardDataTransfer:()=>PM});function kf(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function bM(e,t=Te()){return t==null&&kf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?"":vM(e,t)}function wM(e,t=Te()){return t==null&&kf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(IM(e,t))}function e3(e,t){let o=e.getData("text/plain")||e.getData("text/uri-list");o!=null&&t.insertRawText(o)}function t3(e,t,o){let n=e.getData("application/x-lexical-editor");if(n)try{let i=JSON.parse(n);if(i.namespace===o._config.namespace&&Array.isArray(i.nodes))return lC(o,SM(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(d){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(d):d})(r),"text/html");return lC(o,CM(o,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(ye(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let d=0;d<i.length;d++){let c=Te();if(ye(c)){let u=i[d];u===`
|
|
3581
3564
|
`||u===`\r
|
|
3582
|
-
`?c.insertParagraph():u===" "?c.insertNodes([ER()]):c.insertText(u)}}}else t.insertRawText(s)}function pC(e,t,o){e.dispatchCommand(wP,{nodes:t,selection:o})||(o.insertNodes(t),(function(n){if(ye(n)&&n.isCollapsed()){let r=n.anchor,a=null,s=Qi(r,"previous");if(s)if(qm(s))a=s.origin;else{let i=AR(s,wa(Ve(),"next").getFlipped());for(let d of i){if(Ke(d.origin)){a=d.origin;break}if(_e(d.origin)&&!d.origin.isInline())break}}if(a&&Ke(a)){let i=a.getFormat(),d=a.getStyle();n.format===i&&n.style===d||(n.format=i,n.style=d,n.dirty=!0)}}})(o))}function xM(e,t,o,n=[]){let r=t===null||o.isSelected(t),a=_e(o)&&o.excludeFromCopy("html"),s=o;t!==null&&Ke(s)&&(s=yf(t,s,"clone"));let i=_e(s)?s.getChildren():[],d=(function(c){let u=c.exportJSON(),m=c.constructor;if(u.type!==m.getType()&&Mf(58,m.name),_e(c)){let p=u.children;Array.isArray(p)||Mf(59,m.name)}return u})(s);Ke(s)&&s.getTextContentSize()===0&&(r=!1);for(let c=0;c<i.length;c++){let u=i[c],m=xM(e,t,u,d.children);!r&&_e(o)&&m&&o.extractWithChild(u,t,"clone")&&(r=!0)}if(r&&!a)n.push(d);else if(Array.isArray(d.children))for(let c=0;c<d.children.length;c++){let u=d.children[c];n.push(u)}return r}function bM(e,t){let o=[],n=Ve().getChildren();for(let r=0;r<n.length;r++)xM(e,t,n[r],o);return{namespace:e._config.namespace,nodes:o}}function wM(e){let t=[];for(let o=0;o<e.length;o++){let n=e[o],r=qR(n);Ke(r)&&eE(r),t.push(r)}return t}var nl=null;async function V4(e,t,o){if(nl!==null)return!1;if(t!==null)return new Promise((c,u)=>{e.update(()=>{c(yM(e,t,o))})});let n=e.getRootElement(),r=e._window||window,a=r.document,s=bv(r);if(n===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),n.append(i);let d=new Range;return d.setStart(i,0),d.setEnd(i,1),s.removeAllRanges(),s.addRange(d),new Promise((c,u)=>{let m=e.registerCommand(Qm,p=>(_c(p,ClipboardEvent)&&(m(),nl!==null&&(r.clearTimeout(nl),nl=null),c(yM(e,p,o))),!0),Vm);nl=r.setTimeout(()=>{m(),nl=null,c(!1)},50),a.execCommand("copy"),i.remove()})}function yM(e,t,o){if(o===void 0){let r=bv(e._window),a=Te();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!FP(e,s,i))return!1;o=IM(a)}t.preventDefault();let n=t.clipboardData;return n!==null&&(SM(n,o),!0)}var TM=[["text/html",vM],["application/x-lexical-editor",CM]];function IM(e=Te()){let t={"text/plain":e?e.getTextContent():""};if(e){let o=$m();for(let[n,r]of TM){let a=r(o,e);a!==null&&(t[n]=a)}}return t}function SM(e,t){for(let[o]of TM)t[o]===void 0&&e.setData(o,"");for(let o in t){let n=t[o];n!==void 0&&e.setData(o,n)}}var cr=mC,Eme=cr.$generateJSONFromSelectedNodes,Mme=cr.$generateNodesFromSerializedNodes,Ame=cr.$getClipboardDataFromSelection,kM=cr.$getHtmlContent,Nme=cr.$getLexicalContent,fC=cr.$insertDataTransferForPlainText,Dme=cr.$insertDataTransferForRichText,_me=cr.$insertGeneratedNodes,Ome=cr.copyToClipboard,Fme=cr.setLexicalClipboardDataTransfer;var gC={};$t(gC,{PlainTextExtension:()=>t3,registerPlainText:()=>PM});var Ps=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Q4=Ps&&"documentMode"in document?document.documentMode:null,X4=Ps&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Y4=!(!Ps||!("InputEvent"in window)||Q4)&&"getTargetRanges"in new window.InputEvent("input"),J4=Ps&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),LM=Ps&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Z4=Ps&&/^(?=.*Chrome).*/i.test(navigator.userAgent),e3=Ps&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&X4&&!Z4;function RM(e,t){t.update(()=>{if(e!==null){let o=_c(e,KeyboardEvent)?null:e.clipboardData,n=Te();if(n!==null&&!n.isCollapsed()&&o!=null){e.preventDefault();let r=kM(t);r!==null&&o.setData("text/html",r),o.setData("text/plain",n.getTextContent())}}})}function PM(e){return _r(e.registerCommand(Xm,t=>{let o=Te();return!!ye(o)&&(o.deleteCharacter(t),!0)},vt),e.registerCommand(nP,t=>{let o=Te();return!!ye(o)&&(o.deleteWord(t),!0)},vt),e.registerCommand(oP,t=>{let o=Te();return!!ye(o)&&(o.deleteLine(t),!0)},vt),e.registerCommand(eP,t=>{let o=Te();if(!ye(o))return!1;if(typeof t=="string")o.insertText(t);else{let n=t.dataTransfer;if(n!=null)fC(n,o);else{let r=t.data;r&&o.insertText(r)}}return!0},vt),e.registerCommand(xP,()=>{let t=Te();return!!ye(t)&&(t.removeText(),!0)},vt),e.registerCommand(Cv,t=>{let o=Te();return!!ye(o)&&(o.insertLineBreak(t),!0)},vt),e.registerCommand(dP,()=>{let t=Te();return!!ye(t)&&(t.insertLineBreak(),!0)},vt),e.registerCommand(Jm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!_v(o,!0)&&(n.preventDefault(),Dv(o,r,!0),!0)},vt),e.registerCommand(Zm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!_v(o,!1)&&(n.preventDefault(),Dv(o,r,!1),!0)},vt),e.registerCommand(ef,t=>{let o=Te();return!!ye(o)&&(!LM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Xm,!0))},vt),e.registerCommand(tf,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),e.dispatchCommand(Xm,!1))},vt),e.registerCommand(of,t=>{let o=Te();if(!ye(o))return!1;if(t!==null){if((LM||J4||e3)&&Y4)return!1;t.preventDefault()}return e.dispatchCommand(Cv,!1)},vt),e.registerCommand(TP,()=>(Wm(),!0),vt),e.registerCommand(Qm,t=>{let o=Te();return!!ye(o)&&(RM(t,e),!0)},vt),e.registerCommand(tP,t=>{let o=Te();return!!ye(o)&&((function(n,r){RM(n,r),r.update(()=>{let a=Te();ye(a)&&a.removeText()})})(t,e),!0)},vt),e.registerCommand(rf,t=>{let o=Te();return!!ye(o)&&((function(n,r){n.preventDefault(),r.update(()=>{let a=Te(),s=_c(n,ClipboardEvent)?n.clipboardData:null;s!=null&&ye(a)&&fC(s,a)},{tag:yP})})(t,e),!0)},vt),e.registerCommand(aP,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt),e.registerCommand(rP,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt))}var t3=Kt({conflictsWith:["@lexical/rich-text"],dependencies:[dM],name:"@lexical/plain-text",register:PM});var EM=gC,qme=EM.PlainTextExtension,MM=EM.registerPlainText;var yC={};$t(yC,{PlainTextPlugin:()=>a3});$();var Af=Ex(Ch(),1);function o3(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var hC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function n3({editor:e,ErrorBoundary:t}){return(function(o,n){let[r,a]=q(()=>o.getDecorators());return hC(()=>o.registerDecoratorListener(s=>{(0,Af.flushSync)(()=>{a(s)})}),[o]),H(()=>{a(o.getDecorators())},[o]),W(()=>{let s=[],i=Object.keys(r);for(let d=0;d<i.length;d++){let c=i[d],u=l(n,{onError:p=>o._onError(p),children:l(Ig,{fallback:null,children:r[c]})}),m=o.getElementByKey(c);m!==null&&s.push((0,Af.createPortal)(u,m,c))}return s},[n,r,o])})(e,t)}function r3({editor:e,ErrorBoundary:t}){return(function(o){let n=QE.maybeFromEditor(o);if(n&&n.hasExtensionByName(sM.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])n.hasExtensionByName(r)&&o3(320,r);return!0}return!1})(e)?null:l(n3,{editor:e,ErrorBoundary:t})}function AM(e){return e.getEditorState().read(mf(e.isComposing()))}function a3({contentEditable:e,placeholder:t=null,ErrorBoundary:o}){let[n]=ct();return(function(r){hC(()=>_r(MM(r),cM(r)),[r])})(n),v(oe,{children:[e,l(s3,{content:t}),l(r3,{editor:n,ErrorBoundary:o})]})}function s3({content:e}){let[t]=ct(),o=(function(r){let[a,s]=q(()=>AM(r));return hC(()=>{function i(){let d=AM(r);s(d)}return i(),_r(r.registerUpdateListener(()=>{i()}),r.registerEditableListener(()=>{i()}))},[r]),a})(t),n=Ef();return o?typeof e=="function"?e(n):e:null}var i3=yC,NM=i3.PlainTextPlugin;$();var l3=new RegExp(`^(?:${Nd})?$`);function d3(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function DM(e,t,o=gi){let n=d3(e,t),r=e.lastIndexOf(`
|
|
3583
|
-
`,Math.max(0,n-1))+1,a=/^\/(\S*)$/.exec(e.slice(r,n));if(a)return{kind:"slash-command",query:a[1]??"",rangeStart:r,rangeEnd:n};let s=n;for(;s>0&&!o(e[s-1]??"");)s-=1;let i=e.slice(s,n),d={query:i.slice(1),rangeStart:s,rangeEnd:n};if(i.startsWith("$"))return{kind:"skill",...d};if(i.startsWith("@"))return{kind:"path",...d};if(!i.startsWith("/"))return null;let c=n;for(;c<e.length&&!o(e[c]??"");)c+=1;return l3.test(e.slice(s+1,c))?{kind:"slash-skill",...d}:null}var c3=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g,u3=512,p3=new RegExp(`(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,${u3}})\\]\\(([^)\\s]+)\\)(?=\\s)`,"g"),m3=/^[A-Za-z][A-Za-z0-9+.-]*:/,f3=/^[A-Za-z]:[\\/]/,g3=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function h3(e){let t=[];for(let o of e.matchAll(p3)){let n=o[0],r=o[1]??"",a=(o[2]??"").replace(/\\(.)/g,"$1"),s=o[3]??"",i=s;try{i=decodeURIComponent(s)}catch{}let d=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\")),c=d>=0?i.slice(d+1):i,u=m3.test(i)&&!f3.test(i);if(!i||u||a!==c)continue;let m=(o.index??0)+r.length,p=m+n.length-r.length;t.push({type:"mention",value:i,source:e.slice(m,p),start:m,end:p})}for(let o of e.matchAll(c3)){let n=o[0],r=o[1]??"",a=o[2],s=a!==void 0?a.replace(/\\(.)/g,"$1"):o[3]??"";if(!s||a===void 0&&g3.test(s))continue;let i=(o.index??0)+r.length,d=i+n.length-r.length;t.push({type:"mention",value:s,source:e.slice(i,d),start:i,end:d})}return t}function Uc(e,t={}){let o=h3(e);for(let n of Xg(e))n.sigil!=="$"||n.end>=e.length||o.push({type:"skill",value:n.name,source:e.slice(n.start,n.end),start:n.start,end:n.end});for(let n of t.preserveTrailingFrom??[])n.end===e.length&&e.slice(n.start,n.end)===n.source&&!o.some(r=>r.type===n.type&&r.start===n.start&&r.end===n.end)&&o.push(n);return[...o].sort((n,r)=>n.start-r.start)}function y3(e){return e.replace(/\r\n/g,`
|
|
3584
|
-
`).replace(/^\n+|\n+$/g,"")}function v3(e){return y3(e.text).length>0}function _M(e){return!v3(e)}function C3(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function Nf(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:C3(e,t)})}function OM(e,t,o){return e<=o&&o<t}function FM(e,t){if(!t)return;let o=e[e.length-1];if(o&&o.type==="text"){o.text+=t;return}e.push({type:"text",text:t})}function BM(e,t){let o=0;for(let n=0;n<e.length;n+=1)if(e[n]===gr){if(n>o&&t({type:"text",text:e.slice(o,n),promptOffset:o})===!0||t({type:"terminal-context",promptOffset:n})===!0)return!0;o=n+1}return o<e.length&&t({type:"text",text:e.slice(o),promptOffset:o})===!0}function x3(e,t){return BM(e,o=>o.type!=="text"?!1:t(o.text,o.promptOffset))}function b3(e,t){return x3(e,(o,n)=>{for(let r of Uc(o))if(r.type==="mention"&&t(r,n)===!0)return!0;return!1})}function w3(e){let t=[];if(!e)return t;let o=Uc(e),n=0;for(let r of o)r.start<n||(r.start>n&&FM(t,e.slice(n,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),n=r.end);return n<e.length&&FM(t,e.slice(n)),t}function vC(e,t,o){return!e||t>=o?!1:b3(e,(n,r)=>{let a=r+n.start,s=r+n.end,i=a-1,d=s;return!!(i>=0&&/\s/.test(e[i]??"")&&OM(t,o,i)||d<e.length&&/\s/.test(e[d]??"")&&OM(t,o,d))})}function Or(e,t=[]){if(!e)return[];let o=[],n=0;return BM(e,r=>r.type==="text"?(o.push(...w3(r.text)),!1):(o.push({type:"terminal-context",context:t[n]??null}),n+=1,!1)),o}function UM(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var HM=e=>e.type!=="text";function $M(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function CC(e){return gi(e)||e===gr}function on(e,t){let o=$M(e,t),n=Or(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;continue}if(s.type==="skill"){let d=s.name.length+1;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;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 zM(e){return e.type==="text"?e.text.length:1}function KM(e,t){let o=e.reduce((n,r)=>n+zM(r),0);return Number.isFinite(t)?Math.max(0,Math.min(o,Math.floor(t))):o}function vn(e,t){return KM(Or(e),t)}function uo(e,t){let o=$M(e,t),n=Or(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r===0)return a;if(r<=d)return a+1;r-=d,a+=1;continue}if(s.type==="skill"){let d=s.name.length+1;if(r===0)return a;if(r<=d)return a+1;r-=d,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 rl(e,t,o){let n=Or(e);if(!n.some(HM))return!1;let r=KM(n,t),a=0;for(let s of n){if(HM(s)&&(o==="left"&&r===a+1||o==="right"&&r===a))return!0;a+=zM(s)}return!1}function Eo(e,t){return DM(e,t,CC)}function qM(e,t,o,n){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,o));return{text:`${e.slice(0,r)}${n}${e.slice(a)}`,cursor:r+n.length}}function WM(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function GM(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function jM(e){let t=0;return e.getEditorState().read(()=>{let o=Te();ye(o)&&!o.isCollapsed()&&(t=o.getTextContent().length)}),t}function VM(e,t){let o=e.getRootElement(),n=o?.ownerDocument.getSelection();if(!o||!n?.isCollapsed||!n.anchorNode||!o.contains(n.anchorNode))return!1;let r=o.ownerDocument.createRange();if(r.selectNodeContents(o),t==="start"?r.setEnd(n.anchorNode,n.anchorOffset):r.setStart(n.anchorNode,n.anchorOffset),r.toString()==="")return!0;let a=r.getClientRects(),s=a[0],i=a[a.length-1];return s===void 0||i===void 0||i.top<s.bottom}function QM(e){e.update(()=>{let t=Te();ye(t)&&!t.isCollapsed()&&t.removeText()})}$();$();var T3="group/composer-chip relative inline-flex [&:hover>*:first-child>*:first-child]:opacity-0 pointer-coarse:[&>*:first-child>*:first-child]:opacity-0",I3="absolute top-1/2 left-[calc(0.5em*0.86+1px)] inline-flex size-[calc(1.17em*0.86)] -translate-y-1/2 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-foreground/10 hover:text-foreground group-hover/composer-chip:opacity-100 pointer-coarse:opacity-100 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:m-auto pointer-coarse:after:min-h-8 pointer-coarse:after:min-w-8";function ka(e){let{t}=z(),[o]=ct();if(!Ef())return e.children;let r=()=>{let a=o.getRootElement()?.contains(document.activeElement)??!1;o.update(()=>{let s=Ta(e.nodeKey);s!==null&&(a&&s.selectPrevious(),s.remove())}),e.onRemoved?.()};return v("span",{className:T3,children:[e.children,l("button",{type:"button",contentEditable:!1,tabIndex:-1,"aria-label":t("composer.removeChip",{label:e.label}),className:I3,onMouseDown:a=>a.preventDefault(),onClick:a=>{a.preventDefault(),a.stopPropagation(),r()},children:l(ot,{"aria-hidden":"true",className:"size-[calc(0.86em*0.86)]"})})]})}function S3(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var al=class e extends Wo{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return Df(t.quote,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__quote=t,this.__source=o}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}createDOM(){let t=document.createElement("span");return t.className=Ln,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return l(k3,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function Df(e,t){return ba(new al(e,t))}function k3(e){let{t}=z(),[o]=ct(),n=Co(),r=n?.data.assistantQuotes??null,[a,s]=q(!1),[i,d]=q(e.quote.comment??""),[c,u]=Ge(ep,n?.threadKey??"",null);H(()=>{c===null||c!==e.source||(u(null),d(e.quote.comment??""),s(!0))},[c,e.quote.comment,e.source,u]);let m=S3(e.quote),p=()=>{if(s(!1),r===null)return;let f=r.withComment(e.quote,i),g=r.serialize(f);g!==null&&o.update(()=>{let h=Ta(e.nodeKey);h instanceof al&&h.replace(Df(f,g))})};return l(ka,{nodeKey:e.nodeKey,label:m,children:v(ln,{open:a,onOpenChange:f=>{f&&d(e.quote.comment??""),s(f)},children:[l(cn,{render:v("span",{className:un,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:m}),children:[l(vr,{"aria-hidden":"true",className:Uo}),l("span",{className:$o,children:m})]})}),l(dn,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:v("div",{className:"flex flex-col gap-2",children:[l("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),l(kb,{value:i,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),p())}}),v("div",{className:"flex justify-end gap-2",children:[l(K,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:t("composer.cancel")}),l(K,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})})}var $c=class e extends Wo{__reference;__source;static getType(){return"composer-thread-reference"}static clone(t){return new e(t.__reference,t.__source,t.__key)}static importJSON(t){return xC(t.reference,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__reference=t,this.__source=o}exportJSON(){return{...super.exportJSON(),reference:this.__reference,source:this.__source,type:"composer-thread-reference",version:1}}createDOM(){let t=document.createElement("span");return t.className=Ln,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return l(L3,{nodeKey:this.getKey(),reference:this.__reference})}};function xC(e,t){return ba(new $c(e,t))}function L3(e){let{t}=z(),o=Co(),r=nr()(e.reference.title),a=v("span",{className:un,contentEditable:!1,spellCheck:!1,"data-composer-thread-reference-chip":"true","aria-label":t("composer.threadReference.chipLabel",{title:r}),children:[l(yr,{"aria-hidden":"true",className:Uo}),l("span",{className:$o,children:r})]});return l(ka,{nodeKey:e.nodeKey,label:r,children:v(Re,{children:[l(Ee,{render:a}),l(Pe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(mp,{reference:e.reference,useMachineLabel:o?.data.threadReferences?.useMachineLabel})})]})})}var bC=[al,$c];function _f(e){return bC.some(t=>e instanceof t)}function R3(e){return{collect:t=>[...e.assistantQuotes.collect(t).map(o=>({start:o.start,end:o.end,createNode:()=>Df(o.quote,o.source)})),...(e.threadReferences?.collect(t)??[]).map(o=>({start:o.start,end:o.end,createNode:()=>xC(o.reference,o.source)}))].toSorted((o,n)=>o.start-n.start)}}function Es(){let e=Co()?.data??null,t=W(()=>e===null?null:R3(e),[e]),o=M(t);return o.current=t,o}var sl=new Map,P3=32;function XM(e,t){for(sl.delete(e),sl.set(e,t);sl.size>P3;){let o=sl.keys().next().value;if(o===void 0)break;sl.delete(o)}}function E3(e){return{anchor:e.length,focus:e.length}}function Fr(e,t,o){let n=sl.get(e);if(n)return XM(e,n),n;let r={cursor:o?.cursor??t.length,expandedCursor:o?.expandedCursor??t.length,selection:o?{anchor:o.cursor,focus:o.cursor}:E3(t),history:rM()};return XM(e,r),r}function il(e,t,o){let n=Fr(e,t);n.cursor=o.cursor,n.expandedCursor=o.expandedCursor,n.selection=o.selection}function YM(e,t,o,n){let r=Fr(e,t);r.cursor=o,r.expandedCursor=n}function JM(e,t){let o=e.current,n=[...e.undoStack],r=[...e.redoStack];t(),e.current=o,e.undoStack.splice(0,e.undoStack.length,...n),e.redoStack.splice(0,e.redoStack.length,...r)}function M3(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function A3(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function N3(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Ms(e){return`[${A3(M3(e))}](${N3(e)})`}$();function zc(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function ZM(e){let t=zc(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}$();$();var eA=qe(null),ll=eA.Provider;function lt(){let e=Rt(eA);if(e===null)throw new Error("Composer API has not been provided.");return e}var Of=pe(function(t){let o=lt().pierreIcons,n=o.useSpriteReady();Nl(o.ensureSprite,[o]);let r=W(()=>o.resolveForEntry(t.pathValue,t.kind),[o,t.kind,t.pathValue]);return n?l("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:G("size-4 shrink-0",t.className),children:l("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?l(qr,{className:G("size-4 shrink-0 text-icon-muted",t.className)}):l(Vl,{className:G("size-4 shrink-0 text-icon-muted",t.className)})});var tA=un;function oA(e){return v(oe,{children:[l(Of,{pathValue:e.path,kind:ZM(e.path),theme:e.theme,className:Uo}),l("span",{className:e.selectable?Jw:$o,children:e.label})]})}function Ff(e){return l("span",{className:tA,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:l(oA,{path:e.path,label:zc(e.path),theme:e.theme})})}function Bf(e){return v("span",{className:Zw,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[l("span",{"aria-hidden":"true",className:Uo,dangerouslySetInnerHTML:{__html:eT}}),l("span",{className:$o,children:e.label})]})}function nA(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Re,{children:[l(Ee,{render:v("span",{className:G(un,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0,children:[l(To,{className:G(Uo,"size-icon-1",n&&"opacity-100")}),l("span",{className:$o,children:t})]})}),l(Pe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}function rA({context:e}){let{t}=z(),o=Nf(e,t),n=_M(e),r=n?t("pendingContext.terminalExpired",{label:o}):e.text;return l(nA,{label:o,tooltipText:r,expired:n})}function D3(e){let t=[];for(let o of e.split(/[\s:_-]+/))o.length!==0&&t.push(o.charAt(0).toUpperCase()+o.slice(1));return t.join(" ")}function _3(e){return e.replaceAll("\\","/")}function nn(e){let t=e.displayName?.trim();return t||D3(e.name)}function aA(e,t){return t?e.filter(wr):[]}function sA(e){let t=_3(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"}}var Kc=qe({onRemoveTerminalContext:()=>{}});function O3(e){let t=l(Ff,{path:e.path,theme:U3()});return l(ka,{nodeKey:e.nodeKey,label:zc(e.path),children:v(Re,{children:[l(Ee,{render:t}),l(Pe,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})})}var As=class e extends Wo{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return qc(t.path,t.source).updateFromJSON(t)}constructor(t,o=Ms(t),n){super(n),this.__path=t,this.__source=o}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=Ln,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return l(O3,{nodeKey:this.getKey(),path:this.__path})}};function qc(e,t){return ba(new As(e,t))}function F3(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Ns(e){return new Map(e.map(t=>[t.name,{label:nn(t),description:F3(t)}]))}function B3(e){let t=l(Bf,{label:e.skillLabel});return l(ka,{nodeKey:e.nodeKey,label:e.skillLabel,children:e.skillDescription?v(Re,{children:[l(Ee,{render:t}),l(Pe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t})}var dl=class e extends Wo{__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 wC(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,o,n,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=o,this.__skillDescription=n}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=Ln,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return l(B3,{nodeKey:this.getKey(),skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function wC(e,t,o){return ba(new dl(e,t,o))}function H3(e){let{t}=z(),{onRemoveTerminalContext:o}=xe(Kc);return l(ka,{nodeKey:e.nodeKey,label:Nf(e.context,t),onRemoved:()=>o(e.context.id),children:l(rA,{context:e.context})})}var ur=class e extends Wo{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return TC(t.context)}constructor(t,o){super(o),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=Ln,t}updateDOM(){return!1}getTextContent(){return gr}isInline(){return!0}decorate(){return l(H3,{nodeKey:this.getKey(),context:this.__context})}};function TC(e){return ba(new ur(e))}function rn(e){return e instanceof As||e instanceof dl||e instanceof ur||_f(e)}function U3(){return document.documentElement.classList.contains("dark")?"dark":"light"}function Gc(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Hf(e){return _f(e)?e.getTextContentSize():1}function lA(e){return e.getTextContentSize()}function $3(e,t,o){return t+(o>0?Hf(e):0)}function z3(e,t,o){return t+(o>0?lA(e):0)}function K3(e,t){let o=e.getParent();if(!o||!_e(o))return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===Hf(e)?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=Hf(e),null)}function Uf(e){return rn(e)?Hf(e):Ke(e)?e.getTextContentSize():Yi(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+Uf(o),0):0}function IC(e){return rn(e)?lA(e):Ke(e)?e.getTextContentSize():Yi(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+IC(o),0):0}function cl(e,t){let o=0,n=e;for(;n;){let r=n.getParent();if(!r||!_e(r))break;let a=r.getChildren(),s=n.getIndexWithinParent();for(let i=0;i<s;i+=1){let d=a[i];d&&(o+=Uf(d))}n=r}if(Ke(e))return o+Math.min(t,e.getTextContentSize());if(rn(e))return $3(e,o,t);if(Yi(e))return o+Math.min(t,1);if(_e(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&&(o+=Uf(i))}return o}return o}function Wc(e,t){let o=0,n=e;for(;n;){let r=n.getParent();if(!r||!_e(r))break;let a=r.getChildren(),s=n.getIndexWithinParent();for(let i=0;i<s;i+=1){let d=a[i];d&&(o+=IC(d))}n=r}if(Ke(e))return o+Math.min(t,e.getTextContentSize());if(rn(e))return z3(e,o,t);if(Yi(e))return o+Math.min(t,1);if(_e(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&&(o+=IC(i))}return o}return o}function $f(e,t){if(rn(e))return K3(e,t);if(Ke(e)){let o=e.getTextContentSize();return t.value<=o?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=o,null)}if(Yi(e)){let o=e.getParent();if(!o)return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===1?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=1,null)}if(_e(e)){let o=e.getChildren();for(let n of o){let r=$f(n,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:o.length,type:"element"}}return null}function jc(){return Ve().getChildren().reduce((o,n)=>o+Uf(n),0)}function La(e){let t=Ve(),o=jc(),r={value:Math.max(0,Math.min(e,o))},a=$f(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},s=Ts();s.anchor.set(a.key,a.offset,a.type),s.focus.set(a.key,a.offset,a.type),yn(s)}function ul(e,t){let o=Ve(),n=jc(),r=Math.max(0,Math.min(e,n)),a=Math.max(0,Math.min(t,n)),s={value:r},i={value:a},d=$f(o,s)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},c=$f(o,i)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},u=Ts();u.anchor.set(d.key,d.offset,d.type),u.focus.set(c.key,c.offset,c.type),yn(u)}function SC(e){if(!ye(e))return null;let t=e.anchor.getNode(),o=e.focus.getNode(),n=Wc(t,e.anchor.offset),r=Wc(o,e.focus.offset);return{start:Math.min(n,r),end:Math.max(n,r)}}function kC(e){return ye(e)?e.getNodes().some(t=>rn(t)):!1}function Ds(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=cl(o,t.anchor.offset),r=jc();return Math.max(0,Math.min(n,r))}function LC(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=Wc(o,t.anchor.offset),r=Ve().getTextContent().length;return Math.max(0,Math.min(n,r))}function zf(e){let t=Te();return ye(t)?{anchor:cl(t.anchor.getNode(),t.anchor.offset),focus:cl(t.focus.getNode(),t.focus.offset)}:e}function iA(e,t){let o=t.split(`
|
|
3585
|
-
`);for(let n=0;n<o.length;n+=1){let r=o[n]??"";r.length>0&&e.append(Fn(r)),n<o.length-1&&e.append(ws())}}function q3(e,t,o){let n=0;for(let r of o?.collect(t)??[])iA(e,t.slice(n,r.start)),e.append(r.createNode()),n=r.end;iA(e,t.slice(n))}function Vc(e,t,o,n){let r=Ve();r.clear();let a=hn();r.append(a);let s=Or(e,t);for(let i of s){if(i.type==="mention"){a.append(qc(i.path,i.source));continue}if(i.type==="skill"){let d=o.get(i.name);a.append(wC(i.name,d?.label??nn({name:i.name}),d?.description??null));continue}if(i.type==="terminal-context"){i.context&&a.append(TC(i.context));continue}q3(a,i.text,n)}}function Kf(e){return e instanceof ur?[e.__context.id]:_e(e)?e.getChildren().flatMap(t=>Kf(t)):[]}$();function pl(e){return/mac|iphone|ipad|ipod/i.test(e)}function _s(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let o of e)t+=o.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function dA(e,t){return e.registerCommand(rf,o=>{if(!(o instanceof ClipboardEvent)||o.clipboardData===null||o.clipboardData.files.length>0)return!1;let n=o.clipboardData.getData("text/plain");if(n.length===0)return!1;let r=t.readLinkChips?.()?.collect(n)??[],a=Uc(`${n}
|
|
3565
|
+
`?c.insertParagraph():u===" "?c.insertNodes([NP()]):c.insertText(u)}}}else t.insertRawText(s)}function lC(e,t,o){e.dispatchCommand(SR,{nodes:t,selection:o})||(o.insertNodes(t),(function(n){if(ye(n)&&n.isCollapsed()){let r=n.anchor,a=null,s=Gi(r,"previous");if(s)if(Hm(s))a=s.origin;else{let i=_P(s,va(Ye(),"next").getFlipped());for(let d of i){if(Ke(d.origin)){a=d.origin;break}if(_e(d.origin)&&!d.origin.isInline())break}}if(a&&Ke(a)){let i=a.getFormat(),d=a.getStyle();n.format===i&&n.style===d||(n.format=i,n.style=d,n.dirty=!0)}}})(o))}function TM(e,t,o,n=[]){let r=t===null||o.isSelected(t),a=_e(o)&&o.excludeFromCopy("html"),s=o;t!==null&&Ke(s)&&(s=pf(t,s,"clone"));let i=_e(s)?s.getChildren():[],d=(function(c){let u=c.exportJSON(),m=c.constructor;if(u.type!==m.getType()&&kf(58,m.name),_e(c)){let p=u.children;Array.isArray(p)||kf(59,m.name)}return u})(s);Ke(s)&&s.getTextContentSize()===0&&(r=!1);for(let c=0;c<i.length;c++){let u=i[c],m=TM(e,t,u,d.children);!r&&_e(o)&&m&&o.extractWithChild(u,t,"clone")&&(r=!0)}if(r&&!a)n.push(d);else if(Array.isArray(d.children))for(let c=0;c<d.children.length;c++){let u=d.children[c];n.push(u)}return r}function IM(e,t){let o=[],n=Ye().getChildren();for(let r=0;r<n.length;r++)TM(e,t,n[r],o);return{namespace:e._config.namespace,nodes:o}}function SM(e){let t=[];for(let o=0;o<e.length;o++){let n=e[o],r=jP(n);Ke(r)&&nE(r),t.push(r)}return t}var Zi=null;async function o3(e,t,o){if(Zi!==null)return!1;if(t!==null)return new Promise((c,u)=>{e.update(()=>{c(xM(e,t,o))})});let n=e.getRootElement(),r=e._window||window,a=r.document,s=yv(r);if(n===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),n.append(i);let d=new Range;return d.setStart(i,0),d.setEnd(i,1),s.removeAllRanges(),s.addRange(d),new Promise((c,u)=>{let m=e.registerCommand(qm,p=>(Dc(p,ClipboardEvent)&&(m(),Zi!==null&&(r.clearTimeout(Zi),Zi=null),c(xM(e,p,o))),!0),Km);Zi=r.setTimeout(()=>{m(),Zi=null,c(!1)},50),a.execCommand("copy"),i.remove()})}function xM(e,t,o){if(o===void 0){let r=yv(e._window),a=Te();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!UR(e,s,i))return!1;o=LM(a)}t.preventDefault();let n=t.clipboardData;return n!==null&&(PM(n,o),!0)}var kM=[["text/html",bM],["application/x-lexical-editor",wM]];function LM(e=Te()){let t={"text/plain":e?e.getTextContent():""};if(e){let o=Om();for(let[n,r]of kM){let a=r(o,e);a!==null&&(t[n]=a)}}return t}function PM(e,t){for(let[o]of kM)t[o]===void 0&&e.setData(o,"");for(let o in t){let n=t[o];n!==void 0&&e.setData(o,n)}}var sr=dC,kme=sr.$generateJSONFromSelectedNodes,Lme=sr.$generateNodesFromSerializedNodes,Pme=sr.$getClipboardDataFromSelection,RM=sr.$getHtmlContent,Rme=sr.$getLexicalContent,cC=sr.$insertDataTransferForPlainText,Eme=sr.$insertDataTransferForRichText,Mme=sr.$insertGeneratedNodes,Ame=sr.copyToClipboard,Nme=sr.setLexicalClipboardDataTransfer;var uC={};Ut(uC,{PlainTextExtension:()=>d3,registerPlainText:()=>AM});var Ss=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,n3=Ss&&"documentMode"in document?document.documentMode:null,r3=Ss&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),a3=!(!Ss||!("InputEvent"in window)||n3)&&"getTargetRanges"in new window.InputEvent("input"),s3=Ss&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),EM=Ss&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,i3=Ss&&/^(?=.*Chrome).*/i.test(navigator.userAgent),l3=Ss&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&r3&&!i3;function MM(e,t){t.update(()=>{if(e!==null){let o=Dc(e,KeyboardEvent)?null:e.clipboardData,n=Te();if(n!==null&&!n.isCollapsed()&&o!=null){e.preventDefault();let r=RM(t);r!==null&&o.setData("text/html",r),o.setData("text/plain",n.getTextContent())}}})}function AM(e){return Nr(e.registerCommand(Wm,t=>{let o=Te();return!!ye(o)&&(o.deleteCharacter(t),!0)},vt),e.registerCommand(sR,t=>{let o=Te();return!!ye(o)&&(o.deleteWord(t),!0)},vt),e.registerCommand(aR,t=>{let o=Te();return!!ye(o)&&(o.deleteLine(t),!0)},vt),e.registerCommand(nR,t=>{let o=Te();if(!ye(o))return!1;if(typeof t=="string")o.insertText(t);else{let n=t.dataTransfer;if(n!=null)cC(n,o);else{let r=t.data;r&&o.insertText(r)}}return!0},vt),e.registerCommand(TR,()=>{let t=Te();return!!ye(t)&&(t.removeText(),!0)},vt),e.registerCommand(gv,t=>{let o=Te();return!!ye(o)&&(o.insertLineBreak(t),!0)},vt),e.registerCommand(pR,()=>{let t=Te();return!!ye(t)&&(t.insertLineBreak(),!0)},vt),e.registerCommand(jm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!Mv(o,!0)&&(n.preventDefault(),Ev(o,r,!0),!0)},vt),e.registerCommand(Vm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!Mv(o,!1)&&(n.preventDefault(),Ev(o,r,!1),!0)},vt),e.registerCommand(Qm,t=>{let o=Te();return!!ye(o)&&(!EM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Wm,!0))},vt),e.registerCommand(Xm,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),e.dispatchCommand(Wm,!1))},vt),e.registerCommand(Ym,t=>{let o=Te();if(!ye(o))return!1;if(t!==null){if((EM||s3||l3)&&a3)return!1;t.preventDefault()}return e.dispatchCommand(gv,!1)},vt),e.registerCommand(kR,()=>(Um(),!0),vt),e.registerCommand(qm,t=>{let o=Te();return!!ye(o)&&(MM(t,e),!0)},vt),e.registerCommand(rR,t=>{let o=Te();return!!ye(o)&&((function(n,r){MM(n,r),r.update(()=>{let a=Te();ye(a)&&a.removeText()})})(t,e),!0)},vt),e.registerCommand(Zm,t=>{let o=Te();return!!ye(o)&&((function(n,r){n.preventDefault(),r.update(()=>{let a=Te(),s=Dc(n,ClipboardEvent)?n.clipboardData:null;s!=null&&ye(a)&&cC(s,a)},{tag:xR})})(t,e),!0)},vt),e.registerCommand(lR,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt),e.registerCommand(iR,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt))}var d3=zt({conflictsWith:["@lexical/rich-text"],dependencies:[pM],name:"@lexical/plain-text",register:AM});var NM=uC,Ume=NM.PlainTextExtension,DM=NM.registerPlainText;var mC={};Ut(mC,{PlainTextPlugin:()=>m3});$();var Lf=Lx(gh(),1);function c3(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var pC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function u3({editor:e,ErrorBoundary:t}){return(function(o,n){let[r,a]=q(()=>o.getDecorators());return pC(()=>o.registerDecoratorListener(s=>{(0,Lf.flushSync)(()=>{a(s)})}),[o]),H(()=>{a(o.getDecorators())},[o]),W(()=>{let s=[],i=Object.keys(r);for(let d=0;d<i.length;d++){let c=i[d],u=l(n,{onError:p=>o._onError(p),children:l(vg,{fallback:null,children:r[c]})}),m=o.getElementByKey(c);m!==null&&s.push((0,Lf.createPortal)(u,m,c))}return s},[n,r,o])})(e,t)}function p3({editor:e,ErrorBoundary:t}){return(function(o){let n=JE.maybeFromEditor(o);if(n&&n.hasExtensionByName(dM.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])n.hasExtensionByName(r)&&c3(320,r);return!0}return!1})(e)?null:l(u3,{editor:e,ErrorBoundary:t})}function _M(e){return e.getEditorState().read(lf(e.isComposing()))}function m3({contentEditable:e,placeholder:t=null,ErrorBoundary:o}){let[n]=ct();return(function(r){pC(()=>Nr(DM(r),mM(r)),[r])})(n),v(oe,{children:[e,l(f3,{content:t}),l(p3,{editor:n,ErrorBoundary:o})]})}function f3({content:e}){let[t]=ct(),o=(function(r){let[a,s]=q(()=>_M(r));return pC(()=>{function i(){let d=_M(r);s(d)}return i(),Nr(r.registerUpdateListener(()=>{i()}),r.registerEditableListener(()=>{i()}))},[r]),a})(t),n=Sf();return o?typeof e=="function"?e(n):e:null}var g3=mC,OM=g3.PlainTextPlugin;$();var h3=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g,y3=512,v3=new RegExp(`(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,${y3}})\\]\\(([^)\\s]+)\\)(?=\\s)`,"g"),C3=/^[A-Za-z][A-Za-z0-9+.-]*:/,x3=/^[A-Za-z]:[\\/]/,b3=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function w3(e){let t=[];for(let o of e.matchAll(v3)){let n=o[0],r=o[1]??"",a=(o[2]??"").replace(/\\(.)/g,"$1"),s=o[3]??"",i=s;try{i=decodeURIComponent(s)}catch{}let d=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\")),c=d>=0?i.slice(d+1):i,u=C3.test(i)&&!x3.test(i);if(!i||u||a!==c)continue;let m=(o.index??0)+r.length,p=m+n.length-r.length;t.push({type:"mention",value:i,source:e.slice(m,p),start:m,end:p})}for(let o of e.matchAll(h3)){let n=o[0],r=o[1]??"",a=o[2],s=a!==void 0?a.replace(/\\(.)/g,"$1"):o[3]??"";if(!s||a===void 0&&b3.test(s))continue;let i=(o.index??0)+r.length,d=i+n.length-r.length;t.push({type:"mention",value:s,source:e.slice(i,d),start:i,end:d})}return t}function Hc(e,t={}){let o=w3(e);for(let n of Wg(e))n.sigil!=="$"||n.end>=e.length||o.push({type:"skill",value:n.name,source:e.slice(n.start,n.end),start:n.start,end:n.end});for(let n of t.preserveTrailingFrom??[])n.end===e.length&&e.slice(n.start,n.end)===n.source&&!o.some(r=>r.type===n.type&&r.start===n.start&&r.end===n.end)&&o.push(n);return[...o].sort((n,r)=>n.start-r.start)}function FM(e,t,o){return e<=o&&o<t}function BM(e,t){if(!t)return;let o=e[e.length-1];if(o&&o.type==="text"){o.text+=t;return}e.push({type:"text",text:t})}function HM(e,t){let o=0;for(let n=0;n<e.length;n+=1)if(e[n]===mr){if(n>o&&t({type:"text",text:e.slice(o,n),promptOffset:o})===!0||t({type:"terminal-context",promptOffset:n})===!0)return!0;o=n+1}return o<e.length&&t({type:"text",text:e.slice(o),promptOffset:o})===!0}function T3(e,t){return HM(e,o=>o.type!=="text"?!1:t(o.text,o.promptOffset))}function I3(e,t){return T3(e,(o,n)=>{for(let r of Hc(o))if(r.type==="mention"&&t(r,n)===!0)return!0;return!1})}function S3(e){let t=[];if(!e)return t;let o=Hc(e),n=0;for(let r of o)r.start<n||(r.start>n&&BM(t,e.slice(n,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),n=r.end);return n<e.length&&BM(t,e.slice(n)),t}function fC(e,t,o){return!e||t>=o?!1:I3(e,(n,r)=>{let a=r+n.start,s=r+n.end,i=a-1,d=s;return!!(i>=0&&/\s/.test(e[i]??"")&&FM(t,o,i)||d<e.length&&/\s/.test(e[d]??"")&&FM(t,o,d))})}function Dr(e,t=[]){if(!e)return[];let o=[],n=0;return HM(e,r=>r.type==="text"?(o.push(...S3(r.text)),!1):(o.push({type:"terminal-context",context:t[n]??null}),n+=1,!1)),o}var k3=new RegExp(`^(?:${Ed})?$`);function L3(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function UM(e,t,o=fi){let n=L3(e,t),r=e.lastIndexOf(`
|
|
3566
|
+
`,Math.max(0,n-1))+1,a=/^\/(\S*)$/.exec(e.slice(r,n));if(a)return{kind:"slash-command",query:a[1]??"",rangeStart:r,rangeEnd:n};let s=n;for(;s>0&&!o(e[s-1]??"");)s-=1;let i=e.slice(s,n),d={query:i.slice(1),rangeStart:s,rangeEnd:n};if(i.startsWith("$"))return{kind:"skill",...d};if(i.startsWith("@"))return{kind:"path",...d};if(!i.startsWith("/"))return null;let c=n;for(;c<e.length&&!o(e[c]??"");)c+=1;return k3.test(e.slice(s+1,c))?{kind:"slash-skill",...d}:null}function zM(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var $M=e=>e.type!=="text";function KM(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function gC(e){return fi(e)||e===mr}function en(e,t){let o=KM(e,t),n=Dr(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;continue}if(s.type==="skill"){let d=s.name.length+1;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;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 qM(e){return e.type==="text"?e.text.length:1}function WM(e,t){let o=e.reduce((n,r)=>n+qM(r),0);return Number.isFinite(t)?Math.max(0,Math.min(o,Math.floor(t))):o}function ir(e,t){return WM(Dr(e),t)}function uo(e,t){let o=KM(e,t),n=Dr(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r===0)return a;if(r<=d)return a+1;r-=d,a+=1;continue}if(s.type==="skill"){let d=s.name.length+1;if(r===0)return a;if(r<=d)return a+1;r-=d,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 el(e,t,o){let n=Dr(e);if(!n.some($M))return!1;let r=WM(n,t),a=0;for(let s of n){if($M(s)&&(o==="left"&&r===a+1||o==="right"&&r===a))return!0;a+=qM(s)}return!1}function Po(e,t){return UM(e,t,gC)}function GM(e,t,o,n){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,o));return{text:`${e.slice(0,r)}${n}${e.slice(a)}`,cursor:r+n.length}}function P3(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function Pf(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:P3(e,t)})}function jM(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function VM(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function QM(e){let t=0;return e.getEditorState().read(()=>{let o=Te();ye(o)&&!o.isCollapsed()&&(t=o.getTextContent().length)}),t}function XM(e,t){let o=e.getRootElement(),n=o?.ownerDocument.getSelection();if(!o||!n?.isCollapsed||!n.anchorNode||!o.contains(n.anchorNode))return!1;let r=o.ownerDocument.createRange();if(r.selectNodeContents(o),t==="start"?r.setEnd(n.anchorNode,n.anchorOffset):r.setStart(n.anchorNode,n.anchorOffset),r.toString()==="")return!0;let a=r.getClientRects(),s=a[0],i=a[a.length-1];return s===void 0||i===void 0||i.top<s.bottom}function YM(e){e.update(()=>{let t=Te();ye(t)&&!t.isCollapsed()&&t.removeText()})}$();$();var lr=class extends xa{createDOM(){let t=document.createElement("span");return t.className=Md,t}updateDOM(){return!1}isInline(){return!0}};var R3="group/composer-chip relative inline-flex [&:hover>*:first-child>*:first-child]:opacity-0 pointer-coarse:[&>*:first-child>*:first-child]:opacity-0",E3="absolute top-1/2 left-[calc(0.5em*0.86+1px)] inline-flex size-[calc(1.17em*0.86)] -translate-y-1/2 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-foreground/10 hover:text-foreground group-hover/composer-chip:opacity-100 pointer-coarse:opacity-100 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:m-auto pointer-coarse:after:min-h-8 pointer-coarse:after:min-w-8";function Ta(e){let{t}=z(),[o]=ct();if(!Sf())return e.children;let r=()=>{let a=o.getRootElement()?.contains(document.activeElement)??!1;o.update(()=>{let s=Ca(e.nodeKey);s!==null&&(a&&s.selectPrevious(),s.remove())}),e.onRemoved?.()};return v("span",{className:R3,children:[e.children,l("button",{type:"button",contentEditable:!1,tabIndex:-1,"aria-label":t("composer.removeChip",{label:e.label}),className:E3,onMouseDown:a=>a.preventDefault(),onClick:a=>{a.preventDefault(),a.stopPropagation(),r()},children:l(dt,{"aria-hidden":"true",className:"size-[calc(0.86em*0.86)]"})})]})}function M3(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var tl=class e extends lr{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return Rf(t.quote,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__quote=t,this.__source=o}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}getTextContent(){return this.__source}decorate(){return l(A3,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function Rf(e,t){return ya(new tl(e,t))}function A3(e){let{t}=z(),[o]=ct(),n=Co(),r=n?.data.assistantQuotes??null,[a,s]=q(!1),[i,d]=q(e.quote.comment??""),[c,u]=Ge(n?.threadKey??"",null,{namespace:Yu});H(()=>{c===null||c!==e.source||(u(null),d(e.quote.comment??""),s(!0))},[c,e.quote.comment,e.source,u]);let m=M3(e.quote),p=()=>{if(s(!1),r===null)return;let f=r.withComment(e.quote,i),g=r.serialize(f);g!==null&&o.update(()=>{let h=Ca(e.nodeKey);h instanceof tl&&h.replace(Rf(f,g))})};return l(Ta,{nodeKey:e.nodeKey,label:m,children:v(rn,{open:a,onOpenChange:f=>{f&&d(e.quote.comment??""),s(f)},children:[l(sn,{render:v("span",{className:ln,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:m}),children:[l(hr,{"aria-hidden":"true",className:Fo}),l("span",{className:Bo,children:m})]})}),l(an,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:v("div",{className:"flex flex-col gap-2",children:[l("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),l(Ib,{value:i,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),p())}}),v("div",{className:"flex justify-end gap-2",children:[l(K,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:t("composer.cancel")}),l(K,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})})}var Uc=class e extends lr{__reference;__source;static getType(){return"composer-thread-reference"}static clone(t){return new e(t.__reference,t.__source,t.__key)}static importJSON(t){return hC(t.reference,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__reference=t,this.__source=o}exportJSON(){return{...super.exportJSON(),reference:this.__reference,source:this.__source,type:"composer-thread-reference",version:1}}getTextContent(){return this.__source}decorate(){return l(N3,{nodeKey:this.getKey(),reference:this.__reference})}};function hC(e,t){return ya(new Uc(e,t))}function N3(e){let{t}=z(),o=Co(),r=Zn()(e.reference.title),a=v("span",{className:ln,contentEditable:!1,spellCheck:!1,"data-composer-thread-reference-chip":"true","aria-label":t("composer.threadReference.chipLabel",{title:r}),children:[l(gr,{"aria-hidden":"true",className:Fo}),l("span",{className:Bo,children:r})]});return l(Ta,{nodeKey:e.nodeKey,label:r,children:v(Pe,{children:[l(Ee,{render:a}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(lp,{reference:e.reference,useMachineLabel:o?.data.threadReferences?.useMachineLabel})})]})})}var yC=[tl,Uc];function Ef(e){return yC.some(t=>e instanceof t)}function D3(e){return{collect:t=>[...e.assistantQuotes.collect(t).map(o=>({start:o.start,end:o.end,createNode:()=>Rf(o.quote,o.source)})),...(e.threadReferences?.collect(t)??[]).map(o=>({start:o.start,end:o.end,createNode:()=>hC(o.reference,o.source)}))].toSorted((o,n)=>o.start-n.start)}}function ks(){let e=Co()?.data??null,t=W(()=>e===null?null:D3(e),[e]),o=E(t);return o.current=t,o}var ol=new Map,_3=32;function JM(e,t){for(ol.delete(e),ol.set(e,t);ol.size>_3;){let o=ol.keys().next().value;if(o===void 0)break;ol.delete(o)}}function O3(e){return{anchor:e.length,focus:e.length}}function _r(e,t,o){let n=ol.get(e);if(n)return JM(e,n),n;let r={cursor:o?.cursor??t.length,expandedCursor:o?.expandedCursor??t.length,selection:o?{anchor:o.cursor,focus:o.cursor}:O3(t),history:iM()};return JM(e,r),r}function nl(e,t,o){let n=_r(e,t);n.cursor=o.cursor,n.expandedCursor=o.expandedCursor,n.selection=o.selection}function ZM(e,t,o,n){let r=_r(e,t);r.cursor=o,r.expandedCursor=n}function eA(e,t){let o=e.current,n=[...e.undoStack],r=[...e.redoStack];t(),e.current=o,e.undoStack.splice(0,e.undoStack.length,...n),e.redoStack.splice(0,e.redoStack.length,...r)}function F3(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function B3(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function H3(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Ls(e){return`[${B3(F3(e))}](${H3(e)})`}$();function $c(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function tA(e){let t=$c(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}$();$();var oA=qe(null),rl=oA.Provider;function it(){let e=Pt(oA);if(e===null)throw new Error("Composer API has not been provided.");return e}var Mf=pe(function(t){let o=it().pierreIcons,n=o.useSpriteReady();Rl(o.ensureSprite,[o]);let r=W(()=>o.resolveForEntry(t.pathValue,t.kind),[o,t.kind,t.pathValue]);return n?l("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:V("size-4 shrink-0",t.className),children:l("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?l(zr,{className:V("size-4 shrink-0 text-icon-muted",t.className)}):l(ql,{className:V("size-4 shrink-0 text-icon-muted",t.className)})});var nA=ln;function rA(e){return v(oe,{children:[l(Mf,{pathValue:e.path,kind:tA(e.path),theme:e.theme,className:Fo}),l("span",{className:e.selectable?Jw:Bo,children:e.label})]})}function Af(e){return l("span",{className:nA,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:l(rA,{path:e.path,label:$c(e.path),theme:e.theme})})}function Nf(e){return v("span",{className:Zw,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[l("span",{"aria-hidden":"true",className:Fo,dangerouslySetInnerHTML:{__html:eT}}),l("span",{className:Bo,children:e.label})]})}function aA(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Pe,{children:[l(Ee,{render:v("span",{className:V(ln,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0,children:[l(Qo,{className:V(Fo,"size-icon-1",n&&"opacity-100")}),l("span",{className:Bo,children:t})]})}),l(Re,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}function sA({context:e}){let{t}=z(),o=Pf(e,t),n=Bw(e),r=n?t("pendingContext.terminalExpired",{label:o}):e.text;return l(aA,{label:o,tooltipText:r,expired:n})}function U3(e){let t=[];for(let o of e.split(/[\s:_-]+/))o.length!==0&&t.push(o.charAt(0).toUpperCase()+o.slice(1));return t.join(" ")}function $3(e){return e.replaceAll("\\","/")}function tn(e){let t=e.displayName?.trim();return t||U3(e.name)}function iA(e,t){return t?e.filter(xr):[]}function lA(e){let t=$3(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"}}var zc=qe({onRemoveTerminalContext:()=>{}});function z3(e){let t=l(Af,{path:e.path,theme:G3()});return l(Ta,{nodeKey:e.nodeKey,label:$c(e.path),children:v(Pe,{children:[l(Ee,{render:t}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})})}var Ps=class e extends lr{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return Kc(t.path,t.source).updateFromJSON(t)}constructor(t,o=Ls(t),n){super(n),this.__path=t,this.__source=o}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}getTextContent(){return this.__source}decorate(){return l(z3,{nodeKey:this.getKey(),path:this.__path})}};function Kc(e,t){return ya(new Ps(e,t))}function K3(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Rs(e){return new Map(e.map(t=>[t.name,{label:tn(t),description:K3(t)}]))}function q3(e){let t=l(Nf,{label:e.skillLabel});return l(Ta,{nodeKey:e.nodeKey,label:e.skillLabel,children:e.skillDescription?v(Pe,{children:[l(Ee,{render:t}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t})}var al=class e extends lr{__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 vC(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,o,n,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=o,this.__skillDescription=n}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}getTextContent(){return`$${this.__skillName}`}decorate(){return l(q3,{nodeKey:this.getKey(),skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function vC(e,t,o){return ya(new al(e,t,o))}function W3(e){let{t}=z(),{onRemoveTerminalContext:o}=xe(zc);return l(Ta,{nodeKey:e.nodeKey,label:Pf(e.context,t),onRemoved:()=>o(e.context.id),children:l(sA,{context:e.context})})}var dr=class e extends lr{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return CC(t.context)}constructor(t,o){super(o),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}getTextContent(){return mr}decorate(){return l(W3,{nodeKey:this.getKey(),context:this.__context})}};function CC(e){return ya(new dr(e))}function gn(e){return e instanceof Ps||e instanceof al||e instanceof dr||Ef(e)}function G3(){return document.documentElement.classList.contains("dark")?"dark":"light"}function xC(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Df(e){return Ef(e)?e.getTextContentSize():1}function cA(e){return e.getTextContentSize()}function j3(e,t,o){return t+(o>0?Df(e):0)}function V3(e,t,o){return t+(o>0?cA(e):0)}function Q3(e,t){let o=e.getParent();if(!o||!_e(o))return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===Df(e)?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=Df(e),null)}function bC(e){return gn(e)?Df(e):Ke(e)?e.getTextContentSize():Lc(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+bC(o),0):0}function uA(e){return gn(e)?cA(e):Ke(e)?e.getTextContentSize():Lc(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+uA(o),0):0}function pA(e,t,o,n){let r=0,a=e;for(;a;){let s=a.getParent();if(!s||!_e(s))break;let i=s.getChildren(),d=a.getIndexWithinParent();for(let c=0;c<d;c+=1){let u=i[c];u&&(r+=o(u))}a=s}if(Ke(e))return r+Math.min(t,e.getTextContentSize());if(gn(e))return n(e,r,t);if(Lc(e))return r+Math.min(t,1);if(_e(e)){let s=e.getChildren(),i=Math.max(0,Math.min(t,s.length));for(let d=0;d<i;d+=1){let c=s[d];c&&(r+=o(c))}return r}return r}function sl(e,t){return pA(e,t,bC,j3)}function qc(e,t){return pA(e,t,uA,V3)}function _f(e,t){if(gn(e))return Q3(e,t);if(Ke(e)){let o=e.getTextContentSize();return t.value<=o?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=o,null)}if(Lc(e)){let o=e.getParent();if(!o)return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===1?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=1,null)}if(_e(e)){let o=e.getChildren();for(let n of o){let r=_f(n,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:o.length,type:"element"}}return null}function Wc(){return Ye().getChildren().reduce((o,n)=>o+bC(n),0)}function Ia(e){let t=Ye(),o=Wc(),r={value:Math.max(0,Math.min(e,o))},a=_f(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},s=Cs();s.anchor.set(a.key,a.offset,a.type),s.focus.set(a.key,a.offset,a.type),fn(s)}function il(e,t){let o=Ye(),n=Wc(),r=Math.max(0,Math.min(e,n)),a=Math.max(0,Math.min(t,n)),s={value:r},i={value:a},d=_f(o,s)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},c=_f(o,i)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},u=Cs();u.anchor.set(d.key,d.offset,d.type),u.focus.set(c.key,c.offset,c.type),fn(u)}function wC(e){if(!ye(e))return null;let t=e.anchor.getNode(),o=e.focus.getNode(),n=qc(t,e.anchor.offset),r=qc(o,e.focus.offset);return{start:Math.min(n,r),end:Math.max(n,r)}}function TC(e){return ye(e)?e.getNodes().some(t=>gn(t)):!1}function ll(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=sl(o,t.anchor.offset),r=Wc();return Math.max(0,Math.min(n,r))}function mA(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=qc(o,t.anchor.offset),r=Ye().getTextContent().length;return Math.max(0,Math.min(n,r))}function IC(e){let t=Te();return ye(t)?{anchor:sl(t.anchor.getNode(),t.anchor.offset),focus:sl(t.focus.getNode(),t.focus.offset)}:e}function dA(e,t){let o=t.split(`
|
|
3567
|
+
`);for(let n=0;n<o.length;n+=1){let r=o[n]??"";r.length>0&&e.append(An(r)),n<o.length-1&&e.append(vs())}}function X3(e,t,o){let n=0;for(let r of o?.collect(t)??[])dA(e,t.slice(n,r.start)),e.append(r.createNode()),n=r.end;dA(e,t.slice(n))}function Gc(e,t,o,n){let r=Ye();r.clear();let a=mn();r.append(a);let s=Dr(e,t);for(let i of s){if(i.type==="mention"){a.append(Kc(i.path,i.source));continue}if(i.type==="skill"){let d=o.get(i.name);a.append(vC(i.name,d?.label??tn({name:i.name}),d?.description??null));continue}if(i.type==="terminal-context"){i.context&&a.append(CC(i.context));continue}X3(a,i.text,n)}}function SC(e){return e instanceof dr?[e.__context.id]:_e(e)?e.getChildren().flatMap(t=>SC(t)):[]}$();function dl(e){return/mac|iphone|ipad|ipod/i.test(e)}function Es(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let o of e)t+=o.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function fA(e,t){return e.registerCommand(Zm,o=>{if(!(o instanceof ClipboardEvent)||o.clipboardData===null||o.clipboardData.files.length>0)return!1;let n=o.clipboardData.getData("text/plain");if(n.length===0)return!1;let r=t.readLinkChips?.()?.collect(n)??[],a=Hc(`${n}
|
|
3586
3568
|
`).filter(p=>p.type==="mention"&&p.end<=n.length&&!r.some(f=>p.start<f.end&&f.start<p.end));if(a.length===0&&r.length===0)return!1;let s=[...a.map(p=>({start:p.start,end:p.end,isMention:!0,create:()=>t.createMentionNode(p.value,p.source)})),...r.map(p=>({start:p.start,end:p.end,isMention:!1,create:()=>p.createNode()}))].sort((p,f)=>p.start-f.start),i=Te();if(!ye(i))return!1;let d=[],c=p=>{let f=p.split(`
|
|
3587
|
-
`);for(let g=0;g<f.length;g+=1){let h=f[g]??"";h.length>0&&d.push(Fn(h)),g<f.length-1&&d.push(ws())}},u=s[0];if(u?.isMention&&u.start===0){let p=i.isBackward()?i.focus:i.anchor,f=t.getExpandedAbsoluteOffsetForPoint(p.getNode(),p.offset),g=Ve().getTextContent().slice(f-1,f);g.length>0&&!/\s/.test(g)&&d.push(Fn(" "))}let m=0;for(let p of s)p.start<m||(p.start>m&&c(n.slice(m,p.start)),d.push(p.create()),m=p.end);return m<n.length?c(n.slice(m)):s.at(-1)?.isMention&&d.push(Fn(" ")),i.insertNodes(d),o.preventDefault(),!0},tn)}function cA(){let[e]=ct();return H(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let i=Te();if(!ye(i)||!i.isCollapsed()||i.anchor.type!=="element")return!1;let d=i.anchor.getNode();return _e(d)&&rn(d.getChildAtIndex(i.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let i=Te();ye(i)&&i.insertText(a)},{discrete:!0}))},o=null,n=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),o=r});return()=>{o?.removeEventListener("beforeinput",t,!0),n()}},[e]),null}function uA(e){let[t]=ct();return H(()=>{let o=(d,c)=>{if(!e.onCommandKeyDown||!c)return!1;if(d==="Enter"&&(c.isComposing||c.keyCode===229))return c.stopPropagation(),!0;let u=e.onCommandKeyDown(d,c);return u&&(c.preventDefault(),c.stopPropagation()),u},n=t.registerCommand(uP,d=>o("ArrowDown",d),tn),r=t.registerCommand(pP,d=>o("ArrowUp",d),tn),a=t.registerCommand(of,d=>o("Enter",d),tn),s=t.registerCommand(nf,d=>o("Tab",d),tn),i=t.registerCommand(fP,d=>o("Escape",d),tn);return()=>{n(),r(),a(),s(),i()}},[t,e]),null}function pA(){let[e]=ct();return H(()=>{let t=e.registerCommand(Jm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=Ds(0);if(i<=0)return;let d=Ve().getTextContent();rl(d,i,"left")&&(r=i-1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{La(a)}),!0},tn),o=e.registerCommand(Zm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=Ds(0),d=jc();if(i>=d)return;let c=Ve().getTextContent();rl(c,i,"right")&&(r=i+1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{La(a)}),!0},tn);return()=>{t(),o()}},[e]),null}function mA(){let[e]=ct();return H(()=>e.registerCommand(mP,t=>{if(!pl(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let o=e.getRootElement(),n=window.getSelection(),r=n?.anchorNode;return!o||!n||!r||!o.contains(r)||n.rangeCount===0||typeof n.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),n.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{yn(PR(n,e))}),!0)},tn),[e]),null}function fA(){let[e]=ct();return H(()=>e.registerUpdateListener(({editorState:t})=>{let o=null;t.read(()=>{let n=Te();if(!ye(n)||!n.isCollapsed())return;let r=n.anchor.getNode();if(!rn(r)||n.anchor.offset===0)return;o=cl(r,0)+1}),o!==null&&queueMicrotask(()=>{e.update(()=>{La(o)})})}),[e]),null}function gA(e,t,o){if(!rn(e))return!1;let n=cl(e,0),r=e instanceof ur;return e.remove(),r&&o(e.__context.id),La(t(n,r)),!0}function W3(){let e=Te();if(!ye(e)||!e.isCollapsed())return null;let t=e.anchor.getNode(),o=e.anchor.offset,n=rn(t)?o===0?t:t.getNextSibling():Ke(t)?o===t.getTextContentSize()?t.getNextSibling():null:_e(t)?t.getChildAtIndex(o):null;return rn(n)?n:null}function G3(e){return gA(W3(),t=>t,e)}function hA(){let[e]=ct(),{onRemoveTerminalContext:t}=xe(Kc);return H(()=>{let o=e.registerCommand(ef,r=>{let a=Te();if(!ye(a)||!a.isCollapsed())return!1;let s=a.anchor.getNode(),i=Ds(0),d=c=>{let u=gA(c,(m,p)=>p?i:m,t);return u&&r?.preventDefault(),u};if(d(s))return!0;if(Ke(s)){if(a.anchor.offset>0)return!1;if(d(s.getPreviousSibling()))return!0;let c=s.getParent();if(_e(c)){let u=s.getIndexWithinParent();if(u>0&&d(c.getChildAtIndex(u-1)))return!0}return!1}if(_e(s)){let c=a.anchor.offset-1;if(c>=0&&d(s.getChildAtIndex(c)))return!0}return!1},tn),n=e.registerCommand(tf,r=>{let a=G3(t);return a&&r?.preventDefault(),a},tn);return()=>{o(),n()}},[e,t]),null}function yA(){let[e]=ct();return H(()=>{let t=new Set,o=e.getRootElement()===document.activeElement,n=d=>{for(let c of t)d.has(c)||e.getElementByKey(c)?.removeAttribute("data-composer-chip-selected");for(let c of d)e.getElementByKey(c)?.setAttribute("data-composer-chip-selected","true");t=d},r=()=>{let d=new Set;return e.getEditorState().read(()=>{let c=Te();if(ye(c)&&!c.isCollapsed())for(let u of c.getNodes())u instanceof Wo&&d.add(u.getKey())}),d},a=e.registerUpdateListener(()=>{n(o?r():new Set)}),s=e.registerCommand(sP,()=>(o=!0,n(r()),!1),Ji),i=e.registerCommand(QR,()=>(o=!1,n(new Set),!1),Ji);return()=>{a(),s(),i()}},[e]),null}function vA(){let[e]=ct(),t=Es();return H(()=>dA(e,{createMentionNode:qc,getExpandedAbsoluteOffsetForPoint:Wc,readLinkChips:()=>t.current}),[e]),null}$();var j3=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],xA=new Map(j3),CA=xA.get("`")??null;function bA(e){let[t]=ct(),o=M(e.terminalContexts),n=M(Ns(e.skills)),r=Es(),a=M(null),s=M(null);H(()=>{o.current=e.terminalContexts},[e.terminalContexts]),H(()=>{n.current=Ns(e.skills)},[e.skills]);let i=Sg(d=>{let c=xA.get(d),u=a.current;if(!c)return a.current=null,!1;let m=!1;return t.update(()=>{let p=u??(()=>{let y=Te();if(!ye(y)||y.isCollapsed()||kC(y))return null;let x=SC(y);if(!x||x.start===x.end)return null;let C=Ve().getTextContent();return vC(C,x.start,x.end)?null:{value:C,expandedStart:x.start,expandedEnd:x.end}})();if(!p||!c)return;let f=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${d}${f}${c}${p.value.slice(p.expandedEnd)}`;Vc(g,o.current,n.current,r.current);let h=uo(g,p.expandedStart);ul(h+d.length,h+d.length+f.length),m=!0,a.current=null}),m});return H(()=>{let d=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 y=Te();if(!ye(y)||y.isCollapsed()){a.current=null,s.current=null;return}if(kC(y)){a.current=null,s.current=null;return}let x=SC(y);if(!x||x.start===x.end){a.current=null,s.current=null;return}let C=Ve().getTextContent();if(vC(C,x.start,x.end)){a.current=null,s.current=null;return}let b={value:C,expandedStart:x.start,expandedEnd:x.end};a.current=b,s.current=null})},c=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&CA!==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 y=h.inputType==="insertText"?h.data:null;if(!y||y.length!==1){a.current=null;return}i(y)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},u=h=>{queueMicrotask(()=>{t.update(()=>{let y=s.current;if(!y)return;let x=Ve().getTextContent(),C=CA;if(C===null){s.current=null;return}let b=`${y.value.slice(0,y.expandedStart)}\`${y.value.slice(y.expandedEnd)}`;if(x!==b){h?.finalAttempt&&(a.current=null,s.current=null);return}let L=y.value.slice(y.expandedStart,y.expandedEnd),w=uo(x,y.expandedStart);ul(w,w+1);let k=Te();if(!ye(k)){a.current=null,s.current=null;return}k.insertText(`\`${L}${C}`),ul(w+1,w+1+L.length),a.current=null,s.current=null},{tag:Go})})},m=h=>{let y=h;(y.inputType==="insertText"||y.inputType==="insertCompositionText")&&u()},p=()=>{u({finalAttempt:!0})},f=null,g=t.registerRootListener((h,y)=>{y?.removeEventListener("keydown",d),y?.removeEventListener("beforeinput",c,!0),y?.removeEventListener("input",m),y?.removeEventListener("compositionend",p),h?.addEventListener("keydown",d),h?.addEventListener("beforeinput",c,!0),h?.addEventListener("input",m),h?.addEventListener("compositionend",p),f=h});return()=>{f&&(f.removeEventListener("keydown",d),f.removeEventListener("beforeinput",c,!0),f.removeEventListener("input",m),f.removeEventListener("compositionend",p)),g()}},[t]),null}var V3=`composer-editor-${Math.random().toString(36).slice(2)}`,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)]",PC="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 Q3({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let[g]=ct(),h=M(u);h.current=u;let y=vn(t,o),x=Fr(e,t,{cursor:y,expandedCursor:on(t,y)}),C=vn(t,x.cursor),b=WM(n),L=M(b),w=GM(r),k=M(w),I=M(Ns(r)),T=Es(),S=M({value:t,cursor:C,expandedCursor:x.expandedCursor,selection:x.selection,terminalContextIds:n.map(D=>D.id)}),R=M(e),A=x.history,N=M(!1),B=W(()=>({onRemoveTerminalContext:c}),[c]);fe(()=>{I.current=Ns(r)},[r]),H(()=>{g.setEditable(!a)},[a,g]),fe(()=>{let D=vn(t,o),X=S.current,j=R.current,E=j!==e,Y=L.current!==b,F=k.current!==w;if(!E&&X.value===t&&X.cursor===D&&!Y&&!F)return;if(E){let ee=X.selection;g.getEditorState().read(()=>{ee=zf(ee)}),il(j,X.value,{cursor:X.cursor,expandedCursor:X.expandedCursor,selection:ee})}let Z=Fr(e,t),J=E?Z.selection:{anchor:D,focus:D};S.current={value:t,cursor:E?Z.cursor:D,expandedCursor:E?Z.expandedCursor:on(t,D),selection:J,terminalContextIds:n.map(ee=>ee.id)},R.current=e,L.current=b,k.current=w;let ne=g.getRootElement(),te=!!(ne&&document.activeElement===ne);if(!E&&X.value===t&&!Y&&!F&&!te)return;let le=E?Fr(j,X.value).history:null;N.current=!0;let ge=t==="",re=()=>g.update(()=>{let ee=E||X.value!==t||Y||F;ee&&Vc(t,n,I.current,T.current),E?ul(J.anchor,J.focus):(ee||te)&&La(D)},{discrete:!0,tag:ge?[Go,xv,IP]:Go});le?JM(le,re):re(),ge&&te&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let ee=Te();ye(ee)&&(ee.dirty=!0)},{tag:[Go,xv]})},0)),il(e,t,S.current),queueMicrotask(()=>{N.current=!1})},[o,e,g,w,n,b,t]);let O=P(D=>{let X=g.getRootElement();if(!X)return;let j=vn(S.current.value,D);X.focus({preventScroll:!0}),g.update(()=>{La(j)}),S.current={value:S.current.value,cursor:j,expandedCursor:on(S.current.value,j),selection:{anchor:j,focus:j},terminalContextIds:S.current.terminalContextIds},il(R.current,S.current.value,{cursor:S.current.cursor,expandedCursor:S.current.expandedCursor,selection:S.current.selection}),h.current(S.current.value,j,S.current.expandedCursor,!1,S.current.terminalContextIds)},[g]),V=P(()=>{let D=S.current;return g.getEditorState().read(()=>{let X=Ve().getTextContent(),j=vn(X,S.current.cursor),E=vn(X,Ds(j)),Y=Gc(X,S.current.expandedCursor),F=Gc(X,LC(Y)),Z=Kf(Ve()),J=zf(S.current.selection);D={value:X,cursor:E,expandedCursor:F,selection:J,terminalContextIds:Z}}),S.current=D,il(R.current,D.value,D),D},[g]);fr(f,()=>({focus:()=>{O(S.current.cursor)},focusAt:O,focusAtEnd:()=>{O(uo(S.current.value,S.current.value.length))},readSnapshot:V,readSelectedTextLength:()=>jM(g),removeSelectedText:()=>QM(g),isCaretOnVisualEdge:D=>VM(g,D)}),[g,O,V]);let U=P(D=>{D.read(()=>{let X=Ve().getTextContent(),j=vn(X,S.current.cursor),E=vn(X,Ds(j)),Y=Gc(X,S.current.expandedCursor),F=Gc(X,LC(Y)),Z=Kf(Ve()),J=zf(S.current.selection),ne=S.current;if(ne.value===X&&ne.cursor===E&&ne.expandedCursor===F&&ne.selection.anchor===J.anchor&&ne.selection.focus===J.focus&&ne.terminalContextIds.length===Z.length&&ne.terminalContextIds.every((le,ge)=>le===Z[ge])||N.current)return;S.current={value:X,cursor:E,expandedCursor:F,selection:J,terminalContextIds:Z},il(R.current,X,{cursor:E,expandedCursor:F,selection:J});let te=rl(X,E,"left")||rl(X,E,"right");h.current(X,E,F,te,Z)})},[]);return l(Kc,{value:B,children:v("div",{className:G(RC,"grid"),children:[l(NM,{contentEditable:l(SE,{className:G(PC,"col-start-1 row-start-1 min-w-0",i),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":s,...d?{"aria-label":d}:{},placeholder:l("span",{}),onPasteCapture:p}),placeholder:n.length>0?null:l("div",{className:"pointer-events-none col-start-1 row-start-1 min-w-0 select-none whitespace-pre-wrap wrap-break-word leading-relaxed text-placeholder",children:s}),ErrorBoundary:kE}),l(aM,{onChange:U}),l(uA,{...m?{onCommandKeyDown:m}:{}}),l(cA,{}),l(bA,{terminalContexts:n,skills:r}),l(mA,{}),l(pA,{}),l(fA,{}),l(hA,{}),l(vA,{}),l(yA,{}),l(nM,{externalHistoryState:A},e)]})})}function X3(e){let[t]=ct(),o=M(e),n=M(e),[r,a]=q(e.documentKey);r===e.documentKey&&(o.current=e),n.current=e,fe(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),H(()=>{let i=null,d=()=>{let u=n.current.documentKey;a(m=>m===u?m:u)},c=t.registerRootListener((u,m)=>{m?.removeEventListener("compositionend",d),u?.addEventListener("compositionend",d),i=u});return()=>{i?.removeEventListener("compositionend",d),c()}},[t]);let s=r===e.documentKey?e:o.current;return l(Q3,{...s})}function ml({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let g=M(t),h=M(n),y=M(Ns(r)),x=M(Es().current),C=W(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[As,dl,ur,...bC],editorState:()=>{Vc(g.current,h.current,y.current,x.current)},onError:b=>{throw b}}),[]);return l(HP,{initialConfig:C,children:l(X3,{documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,onRemoveTerminalContext:c,onChange:u,onPaste:p,editorRef:f,...m?{onCommandKeyDown:m}:{},...i?{className:i}:{},...d?{ariaLabel:d}:{}})},V3)}function wA(e){return typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"}function TA(e){return wA(e)?Promise.resolve(e).then(TA):e===!1?!1:e==null?!0:e.accepted}function Qc(e,t,o){let n=e.trim().length-t;return n<=0?null:o("composer.promptTooLong",{count:n,excess:n.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function EC(e){return e.submissionTarget==="provider-turn"?Qc(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function IA(e){return wA(e)}function SA(e){let t=EC(e);if(t)return e.event?.preventDefault(),{validationMessage:t,didDispatch:!1};let o=TA(e.onSend(e.event));return typeof o!="boolean"?o.then(n=>(n||e.event?.preventDefault(),{validationMessage:null,didDispatch:n})):(o||e.event?.preventDefault(),{validationMessage:null,didDispatch:o})}var bo=new Map;function Y3(e,t,o){return`${e}\0${t}\0${o??"none"}`}function MC(e,t){bo.delete(e),bo.set(e,t)}function fl(e,t){if(bo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,bo.delete(e);for(let o of t.state.added)t.releaseUpload(o.id),URL.revokeObjectURL(o.previewUrl);for(let o of t.listeners)o()}}function J3(e){if(bo.size<=100)return;let t=Array.from(bo);for(let[o,n]of t){if(bo.size<=100)return;o===e||n.committed||n.listeners.size>0||n.operationLeases>0||fl(o,n)}for(let[o,n]of t){if(bo.size<=100)return;o===e||n.listeners.size>0||n.operationLeases>0||fl(o,n)}}function qf(){queueMicrotask(()=>J3())}function kA(e,t,o,n,r=void 0){let a=o.management?.revision??null,s=Y3(e,o.intentId,a),i=bo.get(s);if(i)return i.releaseUpload=n.releaseUpload,i.watchAuthority=r,i.state;let d={key:s,inputKey:e,environmentId:t,intentId:o.intentId,revision:a,text:o.management?.text??o.text??"",retained:o.management?.attachments??[],added:[],saving:!1,error:null},c={state:d,listeners:new Set,releaseUpload:n.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return bo.set(s,c),d}function LA(e,t){let o=bo.get(e);return o?(o.releaseAuthorityWatch===void 0&&o.watchAuthority!==void 0&&(o.releaseAuthorityWatch=o.watchAuthority({threadKey:o.state.inputKey,intentId:o.state.intentId,revision:o.state.revision,onInvalid:()=>fl(e,o)})),o.committed=!0,MC(e,o),o.listeners.add(t),qf(),()=>{o.listeners.delete(t),qf()}):()=>{}}function Os(e,t){let o=bo.get(e);if(!o)return;o.committed=!0;let n=t(o.state);if(n!==o.state){o.state=n,MC(e,o);for(let r of o.listeners)r()}}function Wf(e){return bo.get(e)?.state}function RA(e){let t=bo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,MC(e,t);let o=!1;return()=>{if(!o){if(o=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){fl(e,t);return}qf()}}}function Gf(e){let t=bo.get(e);t&&fl(e,t)}function PA(e,t){let o=new Map(t.flatMap(n=>n.waiting&&n.management!==void 0?[[n.intentId,n.management.revision]]:[]));for(let[n,r]of bo)r.state.inputKey===e&&o.get(r.state.intentId)!==r.state.revision&&fl(n,r);qf()}var Z3=[],eW=[],tW=()=>{};function EA({entry:e,current:t,inputKey:o,environmentId:n,unavailable:r,attachments:a,watchEditorAuthority:s,onEdit:i,onClose:d}){let{t:c}=z(),u=kA(o,n,e,a,s),m=Xo(D=>LA(u.key,D),()=>Wf(u.key)??u,()=>Wf(u.key)??u),{key:p,text:f,retained:g,added:h,saving:y,error:x}=m,C=M(null),[b,L]=q(()=>f.length),w=Co()?.data.assistantQuotes??null,k=D=>Qc(w?w.expandForProvider(D):D,a.limits.maxInputChars,c),I=k(f),T=M(null),S=a.useUploadStatuses(),R=W(()=>g.map(D=>D.id),[g]),A=a.useAssetUrls(n,R),N=!t?.management||t.management.revision!==e.management?.revision;H(()=>{t===void 0&&(Gf(p),d())},[t,p,d]);let B=()=>{y||(Gf(p),d())},O=D=>{if(y||r||N)return;let X=null,j=[...h];for(let E of D){let Y=E.type||"application/octet-stream";if(E.size===0){X=c("attachments.empty",{name:E.name});continue}let F=a.makeImageAttachment({id:a.randomUUID(),name:E.name,mimeType:Y,sizeBytes:E.size,file:E});j.push(F),a.startUpload({environmentId:n,image:F})}Os(p,E=>({...E,added:j,error:X}))},V=async()=>{let D=Wf(p);if(!D||D.saving||r||N||!D.text.trim()&&D.retained.length+D.added.length===0||k(D.text)!==null)return;let X=RA(p);if(X!==null){Os(p,j=>({...j,saving:!0,error:null}));try{await a.awaitUploads(D.added.map(E=>E.id));let j=a.getUploadedAttachments({environmentId:n,images:D.added});if(!j)throw new Error(c("turnQueue.uploadFailed"));await i(e,{text:D.text,attachments:[...D.retained,...j]}),Gf(p),d()}catch(j){Os(p,E=>({...E,saving:!1,error:j instanceof Error?j.message:c("turnQueue.actionFailed")}))}finally{X()}}},U=[...g.map((D,X)=>({...D,previewUrl:A[X],added:!1})).filter(D=>D.source?._tag!=="thread-reference"),...h.map(D=>({...D,added:!0}))];return l(ti,{open:!0,onOpenChange:D=>{D||B()},children:v(ni,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(C.current?.focusAtEnd(),!1),children:[v(zu,{children:[l(ri,{children:c("turnQueue.editTitle")}),l(oi,{children:c("turnQueue.editDescription")})]}),v("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:D=>{D.dataTransfer.types.includes("Files")&&D.preventDefault()},onDrop:D=>{D.dataTransfer.files.length&&(D.preventDefault(),D.stopPropagation(),O(Array.from(D.dataTransfer.files)))},children:[l("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:l(ml,{editorRef:C,documentKey:`queue-editor\0${p}`,value:f,cursor:b,terminalContexts:Z3,skills:eW,disabled:y,placeholder:c("turnQueue.editText"),ariaLabel:c("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:tW,onChange:(D,X)=>{L(X),Os(p,j=>({...j,text:D}))},onCommandKeyDown:(D,X)=>D!=="Enter"||!(X.metaKey||X.ctrlKey)?!1:(V(),!0),onPaste:D=>{D.clipboardData.files.length&&(D.preventDefault(),O(Array.from(D.clipboardData.files)))}})}),I?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:I}):null,l("ul",{className:"flex flex-wrap gap-2",children:U.map(D=>v("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[D.type==="image"&&D.previewUrl?l("img",{src:D.previewUrl,alt:D.name,className:"size-12 rounded object-cover"}):l(Yo,{className:"size-4 shrink-0"}),v("div",{className:"min-w-0 text-xs",children:[l("p",{className:"max-w-48 break-words",children:D.name}),l("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(D.sizeBytes)}),D.added&&S.get(D.id)!=="ready"?l("p",{children:c(S.get(D.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,D.added&&S.get(D.id)==="failed"?l(K,{size:"xs",variant:"ghost",disabled:y||r||N,onClick:()=>{let X=h.find(j=>j.id===D.id);X&&a.retryUpload({environmentId:n,image:X})},children:c("turnQueue.retryUpload")}):null]}),l(K,{size:"icon-xs",variant:"ghost","aria-label":c("turnQueue.removeAttachment",{name:D.name}),disabled:y||N,onClick:()=>{D.added?(a.releaseUpload(D.id),D.previewUrl&&URL.revokeObjectURL(D.previewUrl),Os(p,X=>({...X,added:X.added.filter(j=>j.id!==D.id)}))):Os(p,X=>({...X,retained:X.retained.filter(j=>j.id!==D.id)}))},children:l(ot,{className:"size-3.5"})})]},D.id))}),l("input",{ref:T,type:"file",multiple:!0,className:"hidden","aria-label":c("turnQueue.addAttachments"),onChange:D=>{O(Array.from(D.target.files??[])),D.target.value=""}}),v(K,{size:"sm",variant:"outline",disabled:y||r||N,onClick:()=>T.current?.click(),children:[l(Yo,{className:"size-4"}),c("turnQueue.addAttachments")]}),N?l("p",{role:"alert",className:"text-sm text-muted-foreground",children:c("turnQueue.editStale")}):null,x?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),v($u,{children:[l(K,{variant:"ghost",disabled:y,onClick:B,children:c("turnQueue.discardEdit")}),l(K,{disabled:y||r||N||I!==null||!f.trim()&&U.length===0,onClick:()=>{V()},children:c(y?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}$();var Un=["approval-required","auto-accept-edits","auto","full-access"];var oW={"approval-required":ad,"auto-accept-edits":Qn,auto:Xn,"full-access":jr},nW={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function gl(){let{t:e}=z();return P(t=>{let o=nW[t];return{mode:t,label:e(`runtimeMode.${o}`),description:e(`runtimeMode.${o}Description`),icon:oW[t]}},[e])}function MA(e){let{t}=z(),o=gl(),{interactionMode:n,runtimeMode:r,nativeModeName:a}=e.sentWith,s=[n===void 0?null:t(n==="plan"?"turnQueue.sentWithPlan":"turnQueue.sentWithNoPlan"),a??(r===void 0?null:o(r).label)].filter(i=>i!=null);return l("p",{className:"text-muted-foreground","data-queued-sent-with":!0,children:t("turnQueue.sentWith",{modes:s.join(", ")})})}function AA(e,t){let o=e.find(a=>a.intentId===t.intentId);if(!o)return e;let n=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?n.length:n.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(n.splice(r,0,o),n)}function NA(e,t,o){if(t===o)return null;let n={intentId:t,beforeIntentId:o,previousOrder:e.map(a=>a.intentId)};return AA(e,n).every((a,s)=>a.intentId===e[s]?.intentId)?null:n}function DA(e,t){if(!e.find(d=>d.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(d=>d.intentId===t.beforeIntentId))return{entries:e,settled:!0};let n=new Set(e.map(d=>d.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(d=>n.has(d));return e.filter(d=>r.has(d.intentId)).some((d,c)=>d.intentId!==a[c])?{entries:e,settled:!0}:{entries:AA(e,t),settled:!1}}$();$();function rW({entry:e,unavailable:t,onCancel:o}){let{t:n}=z(),r=M(!1),[a,s]=q(!1),[i,d]=q(!1),[c,u]=q(!1);H(()=>{u(!1),d(!1)},[e.status,e.deliveryCertainty]);let m=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,s(!0),d(!1);try{await o(e),u(!1)}catch{d(!0)}finally{r.current=!1,s(!1)}}};return v("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[l("p",{className:"text-muted-foreground",children:n(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.waitingForCapacity===!0?"turnQueue.itemCapacity":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),l("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??n("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?l("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?c&&e.action==="abandon"?v("div",{className:"space-y-2",children:[l("p",{children:n("turnQueue.abandonDescription")}),v("div",{className:"flex flex-wrap gap-2",children:[l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{m()},children:n("turnQueue.confirmAbandon")}),l(K,{size:"xs",variant:"ghost",disabled:a,onClick:()=>u(!1),children:n("turnQueue.keepWaiting")})]})]}):l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?u(!0):void m(),children:n(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,i?l("p",{role:"alert",className:"text-destructive-foreground",children:n("turnQueue.actionFailed")}):null]})}function _A({entries:e,unavailable:t,onCancel:o,autoExpand:n=!1}){let{t:r}=z(),[a,s]=q(null),i=a??n,d=ho();return e.length===0?null:v("div",{className:"min-w-0 basis-full space-y-2",children:[l(K,{size:"xs",variant:"ghost","aria-expanded":i,"aria-controls":d,onClick:()=>s(!i),children:r(i?"turnQueue.hideMessages":"turnQueue.showMessages")}),i?l("ol",{id:d,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(c=>l(rW,{entry:c,unavailable:t,onCancel:o},c.intentId))}):null]})}function AC({queue:e,environmentId:t=null,unavailable:o=!1,onResume:n,entries:r,onCancel:a}){let{t:s}=z(),i=M(!1),[d,c]=q(!1),[u,m]=q(!1);H(()=>{e.paused||m(!1)},[e.paused]);let p=e.waitingForCapacity??null,g=Nt().useProviderName?.(t,p?.instanceId??"",p?.instanceId?p.agentName:void 0)??s("turnQueue.unknownProvider"),h=e.deliveryUncertain||e.blocked||e.reconciling||p!==null;if(!e.paused&&!h)return null;let y=r?.[0]?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),x=e.paused?s("turnQueue.pausedTitle"):e.deliveryUncertain?s("turnQueue.uncertainTitle"):e.blocked?s("turnQueue.blockedTitle"):e.reconciling?s("turnQueue.reconcilingTitle"):s(p!==null?"turnQueue.capacityTitle":"turnQueue.queuedTitle"),C=e.deliveryUncertain?s("turnQueue.uncertainDescription"):e.blocked?s("turnQueue.blockedDescription"):e.reconciling?s("turnQueue.reconcilingDescription"):e.paused?s("turnQueue.pausedDescription"):p!==null?p.maxProcesses===null?s("turnQueue.capacityDescriptionNoLimit",{agent:g}):s("turnQueue.capacityDescription",{agent:g,count:p.maxProcesses}):null,b=async()=>{if(!(i.current||o||!e.paused)){i.current=!0,c(!0),m(!1);try{await n()}catch{m(!0)}finally{i.current=!1,c(!1)}}};return v("div",{className:G("mx-auto mb-2 flex w-full max-w-3xl select-none flex-wrap items-start gap-2 rounded-md border bg-background px-3 py-2 text-xs text-foreground",p!==null&&!e.paused?"border-border":"border-warning/40"),"data-turn-queue-banner":!0,role:"status",children:[v("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[l("p",{className:"font-medium",children:x}),C===null?null:l("p",{className:"text-muted-foreground",children:C}),e.paused&&h?l("p",{className:"text-muted-foreground",children:s("turnQueue.pausedUncertainDescription")}):null,o?l("p",{className:"text-muted-foreground",children:s("turnQueue.disconnected")}):null,u&&e.paused?l("p",{className:"text-destructive-foreground",role:"alert",children:s("turnQueue.resumeFailed")}):null]}),e.paused?l(K,{size:"xs",variant:"outline",disabled:d,softDisabled:o,onClick:()=>{b()},children:s(d?"turnQueue.resuming":"turnQueue.resume")}):null,a&&r?l(_A,{entries:r.filter(L=>L.status!=="queued"),unavailable:o,onCancel:a,autoExpand:y}):null]})}var aW=[G0,W0],sW=[],iW={kind:"user"};function lW({submission:e,environmentId:t}){let{t:o}=z();return v("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:[l("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:l("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),l(Nh,{source:iW,environmentId:t}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:_d(e.text)||o("turnQueue.attachmentsOnly")}),e.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(Yo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),l("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:o("primaryActions.sendingButtonLabel")})]})}function dW({entry:e,disabled:t,dropPosition:o,dragPosition:n,feedback:r,reducedMotion:a,locked:s,children:i}){let{t:d}=z(),{attributes:c,listeners:u,setNodeRef:m,setActivatorNodeRef:p,transform:f,transition:g,isDragging:h}=z0({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return v("li",{ref:m,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:ia.Transform.toString(f),transition:g},className:G("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",s?"bg-muted/60":"bg-background hover:bg-accent",h&&"z-10 shadow-md ring-1 ring-primary/50 ring-inset [background:linear-gradient(var(--accent),var(--accent)),var(--background)]",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[o?l("span",{"aria-hidden":"true","data-queue-drop-position":o,className:G("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",o==="before"?"top-0":"bottom-0")}):null,s?l("span",{"aria-hidden":"true",className:"size-6 shrink-0"}):l(K,{ref:p,size:"icon-xs",variant:"ghost",className:G("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...c,...u,"aria-label":d("turnQueue.reorderMessage"),title:d("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?l(wo,{className:"size-3.5"}):l(Jl,{className:"size-3.5"})}),i,h&&n?l("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:n}):null]})}function OA({inputKey:e,entries:t,pendingSubmissions:o=sW,environmentId:n,unavailable:r,attachments:a,actions:s,onCancel:i,readRecord:d}){let{t:c}=z(),u=Zp("(prefers-reduced-motion: reduce)"),[m,p]=Ge("turn-queue:editing",e,null),[f,g]=Ge("turn-queue:pending",e,!1),h=$e("turn-queue:pending-ref",e,!1),[y,x]=Ge("turn-queue:error",e,null),[C,b]=Ge("turn-queue:drag",e,null),[L,w]=Ge("turn-queue:move",e,null),k=$e("turn-queue:reorder-ref",e,!1),[I,T]=Ge("turn-queue:feedback",e,null),S=f0(Eh(Li,{activationConstraint:{distance:5}}),Eh(ki,{coordinateGetter:K0,scrollBehavior:u?"auto":"smooth"})),R=W(()=>t.filter(E=>E.waiting),[t]),A=L?DA(R,L.preview):null,N=A?.entries??R,B=N.length+o.length,O=r||f||L!==null,V=N.findIndex(E=>E.intentId===C?.activeId),U=N.findIndex(E=>E.intentId===C?.overId);H(()=>{PA(e,t)},[t,e]),H(()=>{L!==null&&(r||L.acknowledged&&A?.settled)&&(k.current=!1,w(null),!r&&R.some(E=>E.intentId===L.preview.intentId)&&T({intentId:L.preview.intentId,kind:"saved"}))},[R,L,A?.settled,r]),H(()=>{if(I===null||I.kind==="failed")return;let E=window.setTimeout(()=>T(Y=>Y===I?null:Y),1600);return()=>window.clearTimeout(E)},[I]);let D=async E=>{if(!(h.current||k.current||r)){h.current=!0,g(!0),x(null),T(null);try{await E()}catch(Y){x(Y instanceof Error?Y.message:c("turnQueue.actionFailed"))}finally{h.current=!1,g(!1)}}},X=(E,Y)=>D(async()=>{let F=NA(R,E.intentId,Y);if(!(F===null||!E.management?.canReorder)){k.current=!0,w({preview:F,acknowledged:!1});try{await s.onReorder(E,Y),w(Z=>Z?.preview===F?{...Z,acknowledged:!0}:Z)}catch(Z){throw k.current=!1,w(null),T({intentId:E.intentId,kind:"failed"}),Z}}}),j=r?c("turnQueue.disconnected"):L!==null?c("turnQueue.saving"):C!==null?`${c("turnQueue.dragStarted")} ${U+1}/${N.length}`:I?.kind==="saved"?c("common.action.done"):I?.kind==="cancelled"?c("turnQueue.dragCancelled"):"";return v(oe,{children:[B>0?v("section",{"aria-label":c("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:[v("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[l("span",{className:"shrink-0",children:c("turnQueue.queued",{count:B})}),l("span",{role:"status","aria-live":C===null?"polite":"off","data-queue-reorder-status":L?"saving":I?.kind,className:G("min-w-0 truncate",I?.kind==="saved"&&"text-primary"),children:j})]}),l(M0,{sensors:S,collisionDetection:y0,modifiers:aW,accessibility:{screenReaderInstructions:{draggable:c("turnQueue.dragInstructions")},announcements:{onDragStart:()=>c("turnQueue.dragStarted"),onDragOver:({over:E})=>{let Y=N.findIndex(F=>F.intentId===E?.id);return Y<0?void 0:`${c("turnQueue.dragStarted")} ${Y+1}/${N.length}`},onDragEnd:()=>c("turnQueue.dragFinished"),onDragCancel:()=>c("turnQueue.dragCancelled")}},onDragStart:({active:E})=>{let Y=N.find(F=>F.intentId===E.id);!Y?.management?.canReorder||O||(x(null),T(null),b({activeId:Y.intentId,overId:Y.intentId}))},onDragOver:({over:E})=>{let Y=N.find(F=>F.intentId===E?.id);Y&&b(F=>F&&{...F,overId:Y.intentId})},onDragCancel:()=>{C&&T({intentId:C.activeId,kind:"cancelled"}),b(null)},onDragEnd:({active:E,over:Y})=>{if(b(null),!Y||E.id===Y.id)return;let F=N.findIndex(te=>te.intentId===E.id),Z=N.findIndex(te=>te.intentId===Y.id),J=N[F];if(!J?.management?.canReorder||Z<0)return;let ne=N[Z+(F<Z?1:0)]?.intentId??null;X(J,ne)},children:l(U0,{items:N.map(E=>E.intentId),strategy:F0,children:v("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[N.map((E,Y)=>v(dW,{entry:E,disabled:!E.management?.canReorder||O,locked:Zd(E),reducedMotion:u,feedback:I?.intentId===E.intentId?I.kind:void 0,dropPosition:E.intentId===C?.overId&&V!==U?V<U?"after":"before":void 0,dragPosition:E.intentId===C?.activeId?`${U+1}/${N.length}`:void 0,children:[l(Nh,{source:E.source,environmentId:n}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:l(X0,{entry:E,readRecord:d,environmentId:n})}),l(pp,{environmentId:n,rewrite:E.rewrite,text:E.rewrittenText??""}),E.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(Yo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:E.attachmentNames.join(", ")})]}):null,E.pendingAction?l("p",{className:"text-muted-foreground",children:c(E.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,E.sentWith?l(MA,{sentWith:E.sentWith}):null,E.failure?l("p",{role:"alert",className:"text-destructive-foreground",children:E.failure}):null]}),v("div",{className:G("flex shrink-0 items-center gap-0.5",E.intentId===C?.activeId&&"invisible"),children:[Zd(E)?null:l(K,{size:"icon-xs",variant:"ghost",disabled:!E.management||O||C!==null,"aria-label":c("turnQueue.editMessage"),title:c("turnQueue.editMessage"),onClick:()=>p(E),children:l(cd,{className:"size-3.5"})}),E.management?.canSteer?l(K,{size:"icon-xs",variant:"ghost",disabled:O||C!==null,"data-turn-queue-steer":"","aria-label":c("turnQueue.steer"),title:c("turnQueue.steerDescription"),onClick:()=>{D(()=>s.onRun(E,"steer"))},children:l(md,{className:"size-3.5"})}):null,v(_o,{children:[l(Fo,{render:l(K,{size:"icon-xs",variant:"ghost",disabled:O||!E.management&&!Zd(E)&&E.action!=="cancel"||C!==null,"aria-label":c("turnQueue.messageActions")}),children:l(Ao,{className:"size-4"})}),v(Oo,{align:"end",children:[Zd(E)?null:v(oe,{children:[v(vo,{disabled:!E.management?.canReorder||Y===0,onClick:()=>{X(E,N[Y-1].intentId)},children:[l(Hl,{className:"size-4"}),c("turnQueue.moveUp")]}),v(vo,{disabled:!E.management?.canReorder||Y===N.length-1,onClick:()=>{X(E,N[Y+2]?.intentId??null)},children:[l(Fl,{className:"size-4"}),c("turnQueue.moveDown")]}),E.management?.canSteer?l(vo,{onClick:()=>{D(()=>s.onRun(E,"steer"))},children:c("turnQueue.steer")}):null,l(vo,{disabled:!E.management?.canRun,onClick:()=>{D(()=>s.onRun(E,"interrupt"))},children:c(E.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),l(xd,{})]}),l(vo,{disabled:E.action!=="cancel",onClick:()=>{D(()=>i(E))},children:c("turnQueue.cancelMessage")})]})]})]})]},E.intentId)),o.map(E=>l(lW,{submission:E,environmentId:n},E.messageId))]})})},e),y?l("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:y}):null]}):null,m?l(EA,{entry:m,current:t.find(E=>E.intentId===m.intentId),inputKey:e,environmentId:n,unavailable:O,attachments:a,watchEditorAuthority:s.watchEditorAuthority,onEdit:s.onEdit,onClose:()=>p(null)},`${e}\0${m.intentId}\0${m.management?.revision??"none"}`):null]})}function FA({data:e,target:t,inputKey:o,attachments:n}){let r=e.useQueue({target:t,threadKey:o}),a=e.useCommandFailureText?.(),{environmentId:s,threadId:i}=t,d=e.queue,c=p=>e.useCommunicationRecord(t,p),u=W(()=>{let p={environmentId:s,threadId:i};return{actions:{onEdit:async(g,h)=>{try{await d.edit(p,g,h)}catch(y){let x=a?.(y);throw x?new Error(x):y}},onReorder:(g,h)=>d.reorder(p,g,h),onRun:(g,h)=>d.run(p,g,h),watchEditorAuthority:d.watchEditorAuthority},onCancel:g=>d.cancel(p,g),onResume:()=>d.resume(p)}},[d,s,a,i]),m=W(()=>({data:e,target:t,threadKey:`${o}\0queue-editor`}),[e,t,o]);return v(oe,{children:[l(Bp,{value:m,children:l(OA,{inputKey:o,actions:u.actions,attachments:n,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:s,onCancel:u.onCancel,readRecord:c,unavailable:r.unavailable})}),l(AC,{environmentId:s,entries:r.entries,onCancel:u.onCancel,onResume:u.onResume,queue:r.state,unavailable:r.unavailable})]})}$();function Ra(e){return e.id??e.label}function Xc(e,t){return Array.from(new Set((t??[]).flatMap(o=>{let n=e.options.find(r=>r.id!==void 0?r.id===o:r.label===o.trim());return n?[Ra(n)]:[]})))}$();$();function hl({unavailableReason:e=null,disabled:t,className:o,children:n,...r}){let a=ho(),s=t===!0&&e!==null;return v(oe,{children:[v(Re,{disabled:!s,children:[l(Ee,{"aria-describedby":s?a:void 0,render:l(K,{...r,disabled:t&&!s,softDisabled:s,className:G("rounded-full shadow-none! inset-shadow-none! ease-out before:rounded-full sm:rounded-full",o)}),children:n}),l(Pe,{side:"top",className:"max-w-72",children:e})]}),s?l("span",{id:a,hidden:!0,children:e}):null]})}var Yc="not-disabled:not-aria-disabled:border-message-action not-disabled:not-aria-disabled:bg-message-action not-disabled:not-aria-disabled:text-message-action-foreground not-disabled:not-aria-disabled:hover:bg-message-action-hover",Jc=(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"),cW=e=>{e.preventDefault()},yl=pe(function({compact:t,pendingAction:o,isRunning:n,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:s,sendDisabledReason:i,isEnvironmentUnavailable:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:u=!1,showSendWhileRunning:m=!1,onInterrupt:p,interruptArmed:f=!1,stopping:g=!1,cancelsCheck:h=!1,onImplementPlanInNewThread:y,shellCommandMode:x=!1,shellCommandUnavailableReason:C=null}){let{t:b}=z(),L=lt(),w=u?{onPointerDown:cW}:void 0,k=L.settings.useEnvironmentIdentificationMode(),I=i!==null,T=s?null:i??(d?b("primaryActions.environmentDisconnected"):null),S=L.devBackdrop.useVisible(k==="artwork"),R=O=>l(hl,{type:"button",variant:"destructive",size:g||f?"sm":"icon",className:G(g?"h-8 px-3 text-xs sm:h-8 sm:text-xs":f?"h-8 px-3 text-xs ring-2 ring-destructive-solid/60 sm:h-8 sm:text-xs":O?"size-8 sm:size-7":m&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...w,onClick:p,disabled:g,"data-interrupt-armed":f&&!g?"":void 0,"aria-label":b(g?"primaryActions.stopping":f?"primaryActions.confirmStopEsc":h?"primaryActions.cancelCheck":"primaryActions.stopGeneration"),children:g?b("primaryActions.stopping"):f?b("primaryActions.confirmStopEsc"):l("svg",{className:"size-3",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:l("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(o)return v("div",{className:G("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[n?R(!0):null,l(K,{type:"submit",size:"sm",className:G("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...w,disabled:d||o.isResponding||(o.isLastQuestion?!o.isComplete:!o.canAdvance),children:Jc(b,{compact:t,isLastQuestion:o.isLastQuestion,isResponding:o.isResponding,questionIndex:o.questionIndex})})]});if(x){let O=l(hl,{type:"submit",variant:"secondary",size:"icon","data-shell-command-run":"true",className:G("size-9 sm:size-8",Yc),...w,disabled:C!==null||!c,unavailableReason:C,"aria-label":b("primaryActions.runInTerminal"),children:l(To,{"aria-hidden":"true",className:"size-4"})});return n?v(oe,{children:[R(!1),O]}):O}if(r)return a?l(hl,{type:"submit",size:"sm",className:G(Yc,t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):v("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[l(hl,{type:"submit",size:"sm",className:G("h-9 rounded-r-none px-4 before:rounded-r-none sm:h-8 sm:rounded-r-none",Yc),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),v(_o,{children:[l(Fo,{render:l(K,{size:"sm",variant:"default",className:G("h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 px-2 sm:h-8",Yc),"aria-label":b("primaryActions.implementationActions"),disabled:s||I||d}),children:l(Tt,{})}),l(Oo,{align:"end",side:"top",children:l(vo,{disabled:s||I||d,onClick:()=>{y()},children:b("primaryActions.implementInNewThread")})})]})]});let A=s||I||d||!c,N=S&&!A,B=v(hl,{type:"submit",variant:"secondary",size:"icon",className:G("isolate size-9 sm:size-8",N?"bg-transparent text-white":Yc),...w,disabled:A,unavailableReason:T,"aria-label":b(s?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[N?l("span",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden rounded-full","aria-hidden":"true",children:l(Db,{compact:!0})}):null,s?l(Js,{className:"size-3.5","aria-hidden":"true"}):l("svg",{className:"size-4",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?v(oe,{children:[R(!1),m&&c?B:null]}):B});function uW(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function vl(e,t){if(t?.attachmentsBlocked)return null;let o=uW(t?.customAnswer);if(e.allowFreeform!==!1&&o)return o;let n=Xc(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?n.length>0?n:r?"":null:n[0]??(r?"":null)}function BA(e,t){let o=t.trim().length>0?void 0:e?.selectedOptionLabels;return{customAnswer:t,...o&&o.length>0?{selectedOptionLabels:o}:{}}}function HA(e,t,o){let n=Xc(e,[o])[0];if(n===void 0)return t??{};if(e.multiSelect){let r=Xc(e,t?.selectedOptionLabels),a=r.includes(n)?r.filter(s=>s!==n):[...r,n];return{customAnswer:"",...a.length>0?{selectedOptionLabels:a}:{}}}return{customAnswer:"",selectedOptionLabels:[n]}}function NC(e,t){let o={};for(let n of e){let r=vl(n,t[n.id]);if(r===null)return null;o[n.id]=r}return o}function pW(e,t){return e.reduce((o,n)=>vl(n,t[n.id])!==null?o+1:o,0)}function jf(e,t,o){let n=e.length===0?0:Math.max(0,Math.min(o,e.length-1)),r=e[n]??null,a=r?t[r.id]:void 0,s=r?vl(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",d=pW(e,t),c=e.length===0?!0:n>=e.length-1;return{questionIndex:n,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?Xc(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:d,isLastQuestion:c,isComplete:NC(e,t)!==null,canAdvance:s!==null}}var mW={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function Cl(e,t,o){if(o.displayKind==="acknowledge")return{label:e("pendingUserInput.acknowledge"),description:e("pendingUserInput.continueHint")};let n=t.kind==="plan"&&o.planAction!==void 0?mW[o.planAction]:void 0;return n===void 0?{label:o.label,description:o.description??""}:{label:e(n.label),description:e(n.description)}}function Vf(e){let{t}=z();return e.questions.length<2?null:l("div",{className:"flex flex-wrap items-center gap-1","data-pending-user-input-steps":!0,children:e.questions.map((o,n)=>{let r=n===e.currentIndex,a=vl(o,e.answers[o.id])!==null;return v(K,{size:"xs",variant:r?"outline":"ghost","aria-current":r?"step":void 0,"aria-label":t("pendingUserInput.goToQuestion",{index:n+1,question:o.header}),disabled:e.disabled,"data-pending-user-input-step":n,onClick:()=>e.onGoTo(n),children:[a?l(wo,{"aria-hidden":!0}):null,n+1]},o.id)})})}function Qf(e){let{t}=z();return e.questions.length<2||e.currentIndex<e.questions.length-1?null:l("ul",{className:"flex flex-col border-t border-border/60 pt-1","data-pending-user-input-summary":!0,children:e.questions.slice(0,-1).map((o,n)=>{let r=vl(o,e.answers[o.id]),a=i=>{let d=o.options.find(c=>Ra(c)===i);return d?Cl(t,o,d).label:i},s=r===null?t("pendingUserInput.unanswered"):r===""?t("pendingUserInput.attachmentsOnly"):(Array.isArray(r)?r:[r]).map(a).join(", ");return l("li",{children:v("button",{type:"button",disabled:e.disabled,"data-pending-user-input-summary-row":n,className:"flex w-full min-w-0 cursor-[var(--control-cursor)] items-baseline gap-2 rounded-md px-2 py-1 text-left text-chat-row transition-colors duration-(--control-duration) hover:bg-accent disabled:pointer-events-none pointer-coarse:min-h-11",onClick:()=>e.onGoTo(n),children:[l("span",{className:"max-w-[45%] shrink-0 truncate text-muted-foreground",children:o.header}),l("span",{className:r===null?"min-w-0 truncate text-warning-foreground":"min-w-0 truncate text-foreground",children:s})]})},o.id)})})}var UA=pe(function(t){let o=t.data.useQuestions(t.target);return o.pending.length===0?null:l("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:o.pending.toReversed().map(n=>l(fW,{pending:n,actions:o},n.requestId))})}),fW=pe(function(t){let{pending:o,actions:n}=t,{t:r}=z(),[a,s]=q({}),[i,d]=q(0),[c,u]=q(!1),[m,p]=q(null),f=M(null);H(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let g=o.questions,h=jf(g,a,i),y=h.activeQuestion;if(!y)return null;let x=NC(g,a),C=I=>{u(!0),p(null),I().then(T=>{u(!1),p(T)})},b=I=>{f.current!==null&&window.clearTimeout(f.current),f.current=null,d(Math.min(Math.max(I,0),g.length-1))},L=()=>{if(!c){if(!h.isLastQuestion){h.canAdvance&&b(h.questionIndex+1);return}x!==null&&C(()=>n.answer(o.requestId,x))}},w=I=>{if(s(S=>({...S,[y.id]:HA(y,S[y.id],I)})),y.multiSelect||h.isLastQuestion)return;f.current!==null&&window.clearTimeout(f.current);let T=h.questionIndex+1;f.current=window.setTimeout(()=>{f.current=null,b(T)},200)},k=y.header===y.question?r("asyncQuestion.title"):y.header;return l("section",{"data-async-question":o.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 shadow-xs sm:px-4",children:v(xr,{state:"pending",icon:l(jn,{}),title:k,actions:v(oe,{children:[l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground",disabled:c,onClick:()=>C(()=>n.dismiss(o.requestId)),children:r("asyncQuestion.dismiss")}),l(K,{size:"sm","data-async-question-submit":"",disabled:c||(h.isLastQuestion?x===null:!h.canAdvance),onClick:L,children:Jc(r,{compact:!1,isLastQuestion:h.isLastQuestion,isResponding:c,questionIndex:h.questionIndex})})]}),children:[l(Vf,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),l("p",{className:"whitespace-pre-wrap break-words text-chat font-medium text-foreground","data-async-question-item":y.id,children:y.question}),y.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?l(qu,{mode:y.multiSelect?"multiple":"single","aria-label":k,disabled:c,selected:h.usingCustomAnswer?[]:h.selectedOptionLabels,onToggle:w,onReselect:w,options:y.options.map(I=>{let T=Cl(r,y,I);return{value:Ra(I),label:T.label,...T.description&&T.description!==T.label?{description:T.description}:{}}})},y.id):null,y.allowFreeform===!1?null:l(Yr,{type:"text",size:"sm",value:h.customAnswer,disabled:c,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),onChange:I=>{let T=I.target.value;s(S=>({...S,[y.id]:BA(S[y.id],T)}))},onKeyDown:I=>{I.key!=="Enter"||I.nativeEvent.isComposing||(I.preventDefault(),L())}}),l(Qf,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),m?l("p",{role:"alert",className:"text-chat-row text-destructive-foreground",children:m}):null]})})});$();var DC=220,gW={opacity:0,transform:"translate3d(0, 4rem, 0)"},hW={opacity:0,transform:"translate3d(0, 7rem, 0)"},$A={opacity:1,transform:"none"},zA={transition:`transform ${DC}ms ease-in, opacity ${DC}ms ease-in`},yW={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function qA({className:e,items:t}){let{t:o}=z(),[n,r]=q(null),a=M(null),s=n!==null&&t.some(f=>f.id===n)?n:null;if(H(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let d=t.slice(1),c=d.length>0,u=c&&s!==i.id,m=d[0],p=f=>{!f.onDismiss||s||(r(f.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,f.onDismiss?.()},DC))};return l("div",{className:G("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:v("div",{className:G("relative flex flex-col-reverse",c?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[u&&m?l("div",{className:G("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)]",yW[m.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,l("div",{className:G("relative z-10",s===i.id?"pointer-events-none":null),style:{...zA,...s===i.id?gW:$A},children:l(KA,{item:i,attached:!0,exiting:s===i.id,onDismissRequest:()=>p(i)})}),c?l("div",{"data-composer-banner-stack-expanded-items":"true",className:G("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:l("div",{className:"min-h-0 overflow-hidden",children:l("div",{className:G("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:d.map(f=>l("div",{className:G(s===f.id?"pointer-events-none":null),style:{...zA,...s===f.id?hW:$A},children:l(KA,{item:f,attached:!1,exiting:s===f.id,onDismissRequest:()=>p(f)})},f.id))})})}):null]})})}function KA({item:e,attached:t,exiting:o,onDismissRequest:n}){let{t:r}=z(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?v(bd,{variant:e.variant,role:"status",className:G("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-composer py-1.5",e.className),"data-composer-banner-presentation":"compact","data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,v(Fg,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[l("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?v(wd,{className:G("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:o,onClick:n,children:l(ot,{})}):null]}):null]}):v(bd,{variant:e.variant,className:G(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-composer",e.className),"data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,l(Fg,{children:e.title}),e.description?l(Ku,{children:e.description}):null,e.actions||e.onDismiss?v(wd,{className:G(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?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:o,onClick:n,children:l(ot,{})}):null]}):null]})}$();var WA=qe(!1),GA=WA.Provider;function jA(){return Rt(WA)}$();var VA=qe(null),QA=VA;function XA(){let[e,t]=q(0),o=P(n=>{t(r=>Math.max(0,r+(n?1:-1)))},[]);return[e>0,o]}function YA(){let e=xe(VA);fe(()=>(e?.(!0),()=>e?.(!1)),[e])}function vW({api:e,draftId:t,environmentId:o,slots:n,threadId:r}){let a=e.presets.useDraftPresetId(t),s=t!==null;return n?.renderSlot("conversation.hero.agentPreset",{environmentId:o,threadId:r,draftId:t,presetId:a,selectable:s,onSelectPreset:s&&t!==null?i=>e.presets.setDraftPresetId(t,i):void 0})}function JA({api:e,belowSlot:t,teamDock:o,composer:n,data:r,draftHero:a,draftId:s,environmentId:i,onOverlayElementChange:d,queue:c,questions:u,slots:m,target:p,threadId:f,threadKey:g}){let h=r.useComposerBanners({target:p,threadKey:g}),y=l(qA,{className:"relative z-0",items:h.items}),[x,C]=XA();return v("div",{ref:d,"data-chat-composer-overlay":"true",className:a.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:[v("div",{ref:a.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:[v("div",{className:"pointer-events-auto relative z-10",children:[c,u,a.active?v("div",{className:"absolute inset-x-0 bottom-full z-0",children:[e===void 0?m?.renderSlot("conversation.hero.agentPreset",{environmentId:i,threadId:f}):l(vW,{api:e,draftId:s??null,environmentId:i,slots:m,threadId:f}),l("div",{"aria-hidden":x||void 0,className:G("pb-8 transition-opacity duration-150 motion-reduce:transition-none",x&&"pointer-events-none select-none opacity-0"),style:{viewTransitionName:a.headlineTransitionName},children:a.headline}),y]},`${g}:${s??""}`):y,o==null?null:l("div",{"data-chat-composer-team-dock":"true",className:"mx-auto mb-2 w-full max-w-3xl",children:o}),v("div",{"data-chat-composer-stack":"true",className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:a.composerTransitionName},children:[l("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-composer",children:l("div",{ref:a.composerAnchorRef,className:"relative z-10",children:l(GA,{value:h.items.length>0,children:l(QA,{value:C,children:n})})})}),l("div",{className:"min-h-0",children:t})]}),l("div",{"data-chat-composer-dock":"true",className:"mx-auto mt-2 w-full max-w-3xl empty:hidden",children:m?.renderSlot("conversation.input.dock",{environmentId:i,threadId:f})})]}),l("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),h.overlay]})}function Zc(e,t){let o=e.trim();return o?t?.trimLeadingPattern?o.replace(t.trimLeadingPattern,"").toLowerCase():o.toLowerCase():""}function CW(e,t){if(!t)return 0;let o=0,n=-1,r=-1,a=0;for(let s=0;s<e.length;s+=1)if(e[s]===t[o]&&(n===-1&&(n=s),r!==-1&&(a+=s-r-1),r=s,o+=1,o===t.length)){let i=s-n+1-t.length,d=Math.min(64,e.length-t.length);return n*2+a*3+i+d}return null}function _C(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function xW(e,t,o){let n=null;for(let r of o){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let s=a+r.length;(n===null||s<n)&&(n=s)}return n}function Cn(e){let{value:t,query:o}=e;if(!t||!o)return null;if(t===o)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(o))return e.prefixBase+_C(t,o);if(e.boundaryBase!==void 0){let n=xW(t,o,e.boundaryMarkers??[" ","-","_","/"]);if(n!==null)return e.boundaryBase+n*2+_C(t,o)}if(e.includesBase!==void 0){let n=t.indexOf(o);if(n!==-1)return e.includesBase+n*2+_C(t,o)}if(e.fuzzyBase!==void 0){let n=CW(t,o);if(n!==null)return e.fuzzyBase+n}return null}function bW(e,t){let o=e.score-t.score;return o!==0?o:e.tieBreaker.localeCompare(t.tieBreaker)}function wW(e,t){let o=0,n=e.length;for(;o<n;){let r=o+Math.floor((n-o)/2),a=e[r];if(!a)break;bW(t,a)<0?n=r:o=r+1}return o}function OC(e,t,o){if(o<=0)return;let n=wW(e,t);if(e.length<o){e.splice(n,0,t);return}n>=o||(e.splice(n,0,t),e.pop())}var eu=(e,t,o=0)=>Cn({value:e.toLowerCase(),query:t,exactBase:o,prefixBase:o+2,boundaryBase:o+4,includesBase:o+6,...o<20?{fuzzyBase:o+100}:{},boundaryMarkers:[" ","-","_","/"]});function TW(e,t,o=[]){let n=t.trim().replace(/^\/+/,"").toLowerCase();return n?e.flatMap(r=>{let a=r.type==="slash-command"?r.command:r.type==="skill"?r.skill.name:r.command.name,s=r.type==="skill"&&n.startsWith("skill:")?n.slice(6):n,i=[eu(a,s),eu(r.description,s,20)];r.type==="skill"&&(i.push(eu(r.skill.displayName??r.skill.name.replace(/[-_]/g," "),s,1)),i.push(eu(r.skill.description??"",s,30)),i.push(eu(r.skill.scope??"",s,40)),"skill".startsWith(n)&&i.push(n==="skill"?0:Number.MAX_SAFE_INTEGER));let d=i.filter(u=>u!==null);if(!d.length)return[];let c=r.type==="slash-command"?0:r.type==="provider-slash-command"?1:r.type==="skill"?2:3;return[{item:r,score:Math.min(...d)-(o.includes(r.id)?1:0),key:`${c}\0${a}\0${r.id}`}]}).sort((r,a)=>r.score-a.score||r.key.localeCompare(a.key)).map(({item:r})=>r):[...e]}function IW(e,t){let o=new Map(e.map(a=>[a.id,a])),n=[...new Set(t)].flatMap(a=>{let s=o.get(a);return s?[{...s,section:"recent"}]:[]}).slice(0,3),r=new Set(n.map(a=>a.id));return[...n,...e.filter(a=>!r.has(a.id)).map(a=>({...a,section:a.type==="slash-command"?"builtIn":a.type==="skill"?"skills":a.type==="plugin-slash-command"?"plugins":"provider"}))]}function ZA(e){let t=new Set(e.skills.map(a=>a.name.trim().toLowerCase())),o=new Set(e.builtIns.map(a=>a.command)),n=[...e.builtIns.map(a=>({...a,id:`slash:${a.command}`,type:"slash-command",label:`/${a.command}`})),...e.commands.filter(a=>!t.has(a.name.toLowerCase())&&!o.has(a.name)).map(a=>({id:`provider-slash-command:${e.provider}:${a.name}`,type:"provider-slash-command",provider:e.provider,command:a,label:`/${a.name}`,description:a.description??a.input?.hint??e.providerDescription})),...(e.showSkills?e.skills.filter(wr):[]).map(a=>({id:`skill:${e.provider}:${a.name}`,type:"skill",provider:e.provider,skill:a,label:`/skill:${a.name}`,description:a.shortDescription??a.description??""})),...(e.plugins??[]).map(a=>({id:`plugin-slash:${a.pluginId}:${a.name}`,type:"plugin-slash-command",pluginId:a.pluginId,command:a,label:`/${a.name}`,description:a.description??a.argumentHint??""}))];return FC(`/${e.query.trim()}`,{builtIns:e.builtIns.map(a=>a.command),skills:e.skills,commands:e.commands,plugins:e.plugins})?.kind==="ambiguous"?n.filter(a=>a.type==="plugin-slash-command"&&a.command.name===e.query.trim()):e.query.trim()?TW(n,e.query,e.recentIds):IW(n,e.recentIds??[])}function FC(e,t){let o=/^\/([^\s]+)(?:\s|$)/.exec(e)?.[1];if(!o)return null;if(t.binding?.name===o){let r=t.plugins?.find(a=>a.pluginId===t.binding.pluginId&&a.name===o);return r?{kind:"plugin",command:r}:{kind:"unavailable",binding:t.binding}}if(t.builtIns.includes(o))return{kind:"builtIn",name:o};if(t.skills.some(r=>r.name===o&&wr(r)))return{kind:"skill",name:o};if(t.commands.some(r=>r.name===o))return{kind:"provider",name:o};let n=t.plugins?.filter(r=>r.name===o)??[];return n.length===1?{kind:"plugin",command:n[0]}:n.length>1?{kind:"ambiguous",commands:n}:null}var SW=()=>[];function eN(e){let{api:t,target:o}=e,n=(t.slashCommands?.useCommands??SW)(e.environmentId,o);return t.draft.useThreadDraftSelector(o,r=>{if(n.length===0)return!1;let a=FC(r.prompt,{builtIns:["model",...e.planModeEnabled?["plan","default"]:[]],skills:e.provider?.skills??[],commands:e.provider?.slashCommands??[],plugins:n,binding:t.slashCommands?.readBinding(o)});return a?.kind==="plugin"&&a.command.kind==="action"})}function tN(e,t){let o=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(o||!t),showCollapsedPromptRow:t&&!o,hasBlocking:o}}function BC(e){return typeof e=="string"?e:`${e.environmentId}\0${e.threadId}`}var oN=(e,t)=>`${e}\0${BC(t)}`;$();var kW={"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 Xf(e,t){let o=e.code===void 0?void 0:kW[e.code];return o===void 0?e.reason:t(o,{status:e.httpStatus??""})}function nN(e,t){let o=0,n=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?n+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(o+=1)}return n>0?t("attachments.retryOrRemoveFailed",{count:n}):o>0?t("attachments.stillUploading",{count:o}):null}function Yf(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}$();function rN(e,t){let o=t?.hasWideActions?780:620;return e!==null&&e<o}function aN(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function sN(e,t){let o=lt().pane.useVisible(),[n,r]=q(null);fe(()=>{if(!o)return;let s=e.current;if(!s)return;let i=!0;if(typeof ResizeObserver<"u"){let u=new ResizeObserver(m=>{if(!i)return;let p=m.find(y=>y.target===s);if(!p)return;let f=window.getComputedStyle(s),g=Number.parseFloat(f.paddingLeft)||0,h=Number.parseFloat(f.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return u.observe(s),()=>{i=!1,u.disconnect()}}let d=null,c=()=>{d===null&&(d=window.requestAnimationFrame(()=>{d=null,i&&r(s.clientWidth)}))};return c(),window.addEventListener("resize",c),()=>{i=!1,window.removeEventListener("resize",c),d!==null&&window.cancelAnimationFrame(d)}},[e,o]);let a=rN(n,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&aN(n,{hasWideActions:t})}}$();function iN(e,t){let o=[],n=[];for(let r of e){let a=t(r);if(a.kind==="remote")return{paths:[],remote:!0,unavailableNames:[]};a.kind==="path"?o.push(a.path):n.push(r.name)}return{paths:o,remote:!1,unavailableNames:n}}function lN(e){let t=iN(e.folders,e.resolve);t.remote&&e.notifyError(e.t("attachments.folderRemote"));for(let o of t.unavailableNames)e.notifyError(e.t("attachments.folderPathUnavailable",{name:o}),e.t("attachments.folderPathUnavailableDetail"));for(let o of t.paths)e.insertText(`${Ms(o)} `)}var HC="ycodium:paste-as-text",dN=new TextEncoder;function cN(e,t){return e.key.toLowerCase()==="v"&&e.shiftKey&&!e.altKey&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)}function LW(e){return e.bypassAutoAttachment||!e.canAttach||e.text.length===0?"inline":e.wouldExceedInputLimit||e.text.length>=32768||dN.encode(e.text).byteLength>=32768?"attachment":"inline"}function RW(e){let t=new Set(e.map(o=>o.toLowerCase()));if(!t.has("pasted-text.txt"))return"pasted-text.txt";for(let o=2;;o+=1){let n=`pasted-text-${o}.txt`;if(!t.has(n))return n}}function PW(e){let t=Math.max(0,Math.min(e.valueLength,e.selectedLength));return e.valueLength-t+e.textLength>e.maxLength}function uN(e){let t=PW({valueLength:e.valueLength,selectedLength:e.selectedLength,textLength:e.text.length,maxLength:e.maxInputChars});if(LW({text:e.text,bypassAutoAttachment:e.bypassAutoAttachment,wouldExceedInputLimit:t,canAttach:!0})!=="attachment")return{kind:"inline"};let o=dN.encode(e.text).byteLength;return e.maxFileBytes!==null&&o>e.maxFileBytes?t?{kind:"reject",reason:"file-too-large"}:{kind:"inline"}:{kind:"fold",fileName:RW(e.existingNames),sizeBytes:o}}function pN(e,t,o){if(e.blocked)return!1;let{editor:n,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=uN({text:t,bypassAutoAttachment:o,valueLength:e.promptLength,selectedLength:n?.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),n?.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:pi(s.sizeBytes),shortcut:pl(navigator.platform)?"\u2318\u21E7V":"Ctrl+Shift+V"})),!0)}$();var mN="application/x-ycodium-composer-mention";function UC(e){return e.includes(mN)}function fN(e){let t=o=>UC(o.dataTransfer.types)?(o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(o){t(o)&&e.setDragActive(!0)},onDragOver(o){t(o)&&(o.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(o){if(!t(o))return;e.setDragActive(!1);let n=o.dataTransfer.getData(mN);n.length!==0&&(e.insertMentionAtEnd(`${n} `)||e.onInsertRejected())}}}function gN({documentKey:e,insertMentionAtEnd:t,onInsertRejected:o}){let[n,r]=q(!1),a=fN({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:o}),s=i=>{if(!UC(i.dataTransfer.types))return;i.stopPropagation();let d=i.relatedTarget;d instanceof Node&&i.currentTarget.contains(d)||r(!1)};return fe(()=>{r(!1)},[e]),H(()=>{if(!n)return;let i=()=>{r(!1)};return window.addEventListener("dragend",i),()=>window.removeEventListener("dragend",i)},[n]),{isDragOverComposer:n,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:s}}$();function hN(e){let t=M(0);return H(()=>{let o=()=>{t.current=Date.now()+1e3},n=s=>{s.target instanceof Node&&e.current?.contains(s.target)&&cN(s,pl(navigator.platform))&&o()},r=()=>{t.current=0},a=()=>{let s=document.activeElement;s instanceof Node&&e.current?.contains(s)&&o()};return window.addEventListener(HC,a),window.addEventListener("keydown",n,!0),window.addEventListener("blur",r),()=>{window.removeEventListener(HC,a),window.removeEventListener("keydown",n,!0),window.removeEventListener("blur",r)}},[e]),P(()=>{let o=Date.now()<=t.current;return t.current=0,o},[])}function yN(e){let{api:t,attachments:o,t:n,addComposerImages:r,promptRef:a,promptInputRef:s,composerEditorRef:i,composerFormRef:d,composerThreadKey:c,attachmentDocumentKey:u,attachmentImagesRef:m,limits:p,supportsAttachmentUploads:f,attachmentUploadsCapabilityKnown:g,composerDocumentKey:h,isComposerApprovalState:y,pasteBlocked:x,hasPendingUserInputs:C,projectSelectionRequired:b,environmentId:L}=e,w=hN(d),k=M({documentKey:"",names:new Set}),I=(V,U)=>pN({blocked:x,editor:i.current,documentKey:u,registry:k.current,existingImageNames:m.current.map(D=>D.name),promptLength:a.current.length,maxInputChars:p.maxInputChars,maxFileBytes:!g||f?null:p.inlineAttachmentMaxBytes,t:n,notify:t.notify,addFoldedFile:D=>{r([D],{source:{_tag:"pasted-text"}})}},V,U),T=V=>{let U=Array.from(V.clipboardData.files);if(U.length>0){V.preventDefault(),r(U);return}let D=V.clipboardData.getData("text/plain");I(D,w())&&(V.preventDefault(),V.stopPropagation())},S=(V,U)=>{if(V.length===0||y||C||b)return!1;let D=a.current,X=(U?.ensureLeadingBoundary??!1)&&D.length>0&&!/\s$/.test(D);return s.current?.applyPromptReplacement(D.length,D.length,X?` ${V}`:V)??!1},R=$e(Zu,c,null);R.current=V=>{if(y||C||b)return!1;let U=a.current,D=Math.max(0,Math.min(U.length,s.current?.readSnapshot().expandedCursor??U.length)),X=U.slice(0,D),j=U.slice(D),E=`${X.length>0&&!/\s$/.test(X)?" ":""}${V}${/^\s/.test(j)?"":" "}`;return s.current?.applyPromptReplacement(D,D,E)??!1};let{isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}=gN({documentKey:h,insertMentionAtEnd:V=>S(V,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{t.notify.error(n("composer.unableToAddToChat"),n("composer.composerBusy"))}});return{onComposerPaste:T,insertComposerTextAtEnd:S,addDroppedFolders:V=>{lN({folders:V,resolve:U=>o.resolveDroppedFolder({environmentId:L,folder:U}),t:n,notifyError:(U,D)=>t.notify.error(U,D),insertText:U=>S(U,{ensureLeadingBoundary:!0})})},isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}}$();function vN(e){let{api:t,t:o,limits:n,promptRef:r,promptInputRef:a,composerEditorRef:s,composerImagesRef:i,composerDraftTarget:d,setComposerDraftPrompt:c,addComposerDraftImages:u,clearComposerDraftPromptAndImages:m,setIsStashMenuOpen:p,setStashPulse:f,isComposerCollapsedMobile:g,expandMobileComposer:h,keybindings:y,terminalOpen:x,isComposerModelPickerOpen:C,hasPendingUserInputs:b,isComposerApprovalState:L,projectSelectionRequired:w,answeringQuestion:k}=e,I=M(0),T=M(null),S=M(new Set),R=t.stash.useStore,A=R(F=>F.entries),N=R(F=>F.stashEntry),B=R(F=>F.takeEntry),O=R(F=>F.finalizeEntryImages);H(()=>()=>{T.current!==null&&window.clearTimeout(T.current)},[]);let V=P(()=>{I.current+=1,f({key:I.current,active:!0}),T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{T.current=null,f(F=>({...F,active:!1}))},1200)},[]),U=P(F=>{let{entry:Z,durable:J}=B(F.id);if(!Z)return;J||t.notify.warning(o("composer.stashReappear"),o("composer.storageRejectedKeep")),p(!1);let ne=r.current,te=F.prompt.length===0?ne:ne.trim().length?`${ne.replace(/\s+$/,"")}
|
|
3569
|
+
`);for(let g=0;g<f.length;g+=1){let h=f[g]??"";h.length>0&&d.push(An(h)),g<f.length-1&&d.push(vs())}},u=s[0];if(u?.isMention&&u.start===0){let p=i.isBackward()?i.focus:i.anchor,f=t.getExpandedAbsoluteOffsetForPoint(p.getNode(),p.offset),g=Ye().getTextContent().slice(f-1,f);g.length>0&&!/\s/.test(g)&&d.push(An(" "))}let m=0;for(let p of s)p.start<m||(p.start>m&&c(n.slice(m,p.start)),d.push(p.create()),m=p.end);return m<n.length?c(n.slice(m)):s.at(-1)?.isMention&&d.push(An(" ")),i.insertNodes(d),o.preventDefault(),!0},Zo)}function gA(){let[e]=ct();return H(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let i=Te();if(!ye(i)||!i.isCollapsed()||i.anchor.type!=="element")return!1;let d=i.anchor.getNode();return _e(d)&&gn(d.getChildAtIndex(i.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let i=Te();ye(i)&&i.insertText(a)},{discrete:!0}))},o=null,n=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),o=r});return()=>{o?.removeEventListener("beforeinput",t,!0),n()}},[e]),null}function hA(e){let[t]=ct();return H(()=>{let o=(d,c)=>{if(!e.onCommandKeyDown||!c)return!1;if(d==="Enter"&&(c.isComposing||c.keyCode===229))return c.stopPropagation(),!0;let u=e.onCommandKeyDown(d,c);return u&&(c.preventDefault(),c.stopPropagation()),u},n=t.registerCommand(fR,d=>o("ArrowDown",d),Zo),r=t.registerCommand(gR,d=>o("ArrowUp",d),Zo),a=t.registerCommand(Ym,d=>o("Enter",d),Zo),s=t.registerCommand(Jm,d=>o("Tab",d),Zo),i=t.registerCommand(yR,d=>o("Escape",d),Zo);return()=>{n(),r(),a(),s(),i()}},[t,e]),null}function yA(){let[e]=ct();return H(()=>{let t=e.registerCommand(jm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=ll(0);if(i<=0)return;let d=Ye().getTextContent();el(d,i,"left")&&(r=i-1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{Ia(a)}),!0},Zo),o=e.registerCommand(Vm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=ll(0),d=Wc();if(i>=d)return;let c=Ye().getTextContent();el(c,i,"right")&&(r=i+1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{Ia(a)}),!0},Zo);return()=>{t(),o()}},[e]),null}function vA(){let[e]=ct();return H(()=>e.registerCommand(hR,t=>{if(!dl(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let o=e.getRootElement(),n=window.getSelection(),r=n?.anchorNode;return!o||!n||!r||!o.contains(r)||n.rangeCount===0||typeof n.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),n.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{fn(AP(n,e))}),!0)},Zo),[e]),null}function CA(){let[e]=ct();return H(()=>e.registerUpdateListener(({editorState:t})=>{let o=null;t.read(()=>{let n=Te();if(!ye(n)||!n.isCollapsed())return;let r=n.anchor.getNode();if(!gn(r)||n.anchor.offset===0)return;o=sl(r,0)+1}),o!==null&&queueMicrotask(()=>{e.update(()=>{Ia(o)})})}),[e]),null}function xA(e,t,o){if(!gn(e))return!1;let n=sl(e,0),r=e instanceof dr;return e.remove(),r&&o(e.__context.id),Ia(t(n,r)),!0}function Y3(){let e=Te();if(!ye(e)||!e.isCollapsed())return null;let t=e.anchor.getNode(),o=e.anchor.offset,n=gn(t)?o===0?t:t.getNextSibling():Ke(t)?o===t.getTextContentSize()?t.getNextSibling():null:_e(t)?t.getChildAtIndex(o):null;return gn(n)?n:null}function J3(e){return xA(Y3(),t=>t,e)}function bA(){let[e]=ct(),{onRemoveTerminalContext:t}=xe(zc);return H(()=>{let o=e.registerCommand(Qm,r=>{let a=Te();if(!ye(a)||!a.isCollapsed())return!1;let s=a.anchor.getNode(),i=ll(0),d=c=>{let u=xA(c,(m,p)=>p?i:m,t);return u&&r?.preventDefault(),u};if(d(s))return!0;if(Ke(s)){if(a.anchor.offset>0)return!1;if(d(s.getPreviousSibling()))return!0;let c=s.getParent();if(_e(c)){let u=s.getIndexWithinParent();if(u>0&&d(c.getChildAtIndex(u-1)))return!0}return!1}if(_e(s)){let c=a.anchor.offset-1;if(c>=0&&d(s.getChildAtIndex(c)))return!0}return!1},Zo),n=e.registerCommand(Xm,r=>{let a=J3(t);return a&&r?.preventDefault(),a},Zo);return()=>{o(),n()}},[e,t]),null}function wA(){let[e]=ct();return H(()=>{let t=new Set,o=e.getRootElement()===document.activeElement,n=d=>{for(let c of t)d.has(c)||e.getElementByKey(c)?.removeAttribute("data-composer-chip-selected");for(let c of d)e.getElementByKey(c)?.setAttribute("data-composer-chip-selected","true");t=d},r=()=>{let d=new Set;return e.getEditorState().read(()=>{let c=Te();if(ye(c)&&!c.isCollapsed())for(let u of c.getNodes())u instanceof xa&&d.add(u.getKey())}),d},a=e.registerUpdateListener(()=>{n(o?r():new Set)}),s=e.registerCommand(dR,()=>(o=!0,n(r()),!1),Vi),i=e.registerCommand(JP,()=>(o=!1,n(new Set),!1),Vi);return()=>{a(),s(),i()}},[e]),null}function TA(){let[e]=ct(),t=ks();return H(()=>fA(e,{createMentionNode:Kc,getExpandedAbsoluteOffsetForPoint:qc,readLinkChips:()=>t.current}),[e]),null}$();var Z3=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],SA=new Map(Z3),IA=SA.get("`")??null;function kA(e){let[t]=ct(),o=E(e.terminalContexts),n=E(Rs(e.skills)),r=ks(),a=E(null),s=E(null);H(()=>{o.current=e.terminalContexts},[e.terminalContexts]),H(()=>{n.current=Rs(e.skills)},[e.skills]);let i=Cg(d=>{let c=SA.get(d),u=a.current;if(!c)return a.current=null,!1;let m=!1;return t.update(()=>{let p=u??(()=>{let y=Te();if(!ye(y)||y.isCollapsed()||TC(y))return null;let x=wC(y);if(!x||x.start===x.end)return null;let C=Ye().getTextContent();return fC(C,x.start,x.end)?null:{value:C,expandedStart:x.start,expandedEnd:x.end}})();if(!p||!c)return;let f=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${d}${f}${c}${p.value.slice(p.expandedEnd)}`;Gc(g,o.current,n.current,r.current);let h=uo(g,p.expandedStart);il(h+d.length,h+d.length+f.length),m=!0,a.current=null}),m});return H(()=>{let d=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 y=Te();if(!ye(y)||y.isCollapsed()){a.current=null,s.current=null;return}if(TC(y)){a.current=null,s.current=null;return}let x=wC(y);if(!x||x.start===x.end){a.current=null,s.current=null;return}let C=Ye().getTextContent();if(fC(C,x.start,x.end)){a.current=null,s.current=null;return}let b={value:C,expandedStart:x.start,expandedEnd:x.end};a.current=b,s.current=null})},c=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&IA!==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 y=h.inputType==="insertText"?h.data:null;if(!y||y.length!==1){a.current=null;return}i(y)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},u=h=>{queueMicrotask(()=>{t.update(()=>{let y=s.current;if(!y)return;let x=Ye().getTextContent(),C=IA;if(C===null){s.current=null;return}let b=`${y.value.slice(0,y.expandedStart)}\`${y.value.slice(y.expandedEnd)}`;if(x!==b){h?.finalAttempt&&(a.current=null,s.current=null);return}let L=y.value.slice(y.expandedStart,y.expandedEnd),w=uo(x,y.expandedStart);il(w,w+1);let k=Te();if(!ye(k)){a.current=null,s.current=null;return}k.insertText(`\`${L}${C}`),il(w+1,w+1+L.length),a.current=null,s.current=null},{tag:zo})})},m=h=>{let y=h;(y.inputType==="insertText"||y.inputType==="insertCompositionText")&&u()},p=()=>{u({finalAttempt:!0})},f=null,g=t.registerRootListener((h,y)=>{y?.removeEventListener("keydown",d),y?.removeEventListener("beforeinput",c,!0),y?.removeEventListener("input",m),y?.removeEventListener("compositionend",p),h?.addEventListener("keydown",d),h?.addEventListener("beforeinput",c,!0),h?.addEventListener("input",m),h?.addEventListener("compositionend",p),f=h});return()=>{f&&(f.removeEventListener("keydown",d),f.removeEventListener("beforeinput",c,!0),f.removeEventListener("input",m),f.removeEventListener("compositionend",p)),g()}},[t]),null}var eW=`composer-editor-${Math.random().toString(36).slice(2)}`,kC="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)]",LC="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 LA(e){let t=Ye().getTextContent(),o=ir(t,e.cursor),n=xC(t,e.expandedCursor);return{value:t,cursor:ir(t,ll(o)),expandedCursor:xC(t,mA(n)),selection:IC(e.selection),terminalContextIds:SC(Ye())}}function tW({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let[g]=ct(),h=E(u);h.current=u;let y=ir(t,o),x=_r(e,t,{cursor:y,expandedCursor:en(t,y)}),C=ir(t,x.cursor),b=jM(n),L=E(b),w=VM(r),k=E(w),I=E(Rs(r)),T=ks(),S=E({value:t,cursor:C,expandedCursor:x.expandedCursor,selection:x.selection,terminalContextIds:n.map(D=>D.id)}),P=E(e),A=x.history,N=E(!1),B=W(()=>({onRemoveTerminalContext:c}),[c]);fe(()=>{I.current=Rs(r)},[r]),H(()=>{g.setEditable(!a)},[a,g]),fe(()=>{let D=ir(t,o),J=S.current,G=P.current,M=G!==e,X=L.current!==b,F=k.current!==w;if(!M&&J.value===t&&J.cursor===D&&!X&&!F)return;if(M){let Z=J.selection;g.getEditorState().read(()=>{Z=IC(Z)}),nl(G,J.value,{cursor:J.cursor,expandedCursor:J.expandedCursor,selection:Z})}let ee=_r(e,t),Y=M?ee.selection:{anchor:D,focus:D};S.current={value:t,cursor:M?ee.cursor:D,expandedCursor:M?ee.expandedCursor:en(t,D),selection:Y,terminalContextIds:n.map(Z=>Z.id)},P.current=e,L.current=b,k.current=w;let ae=g.getRootElement(),te=!!(ae&&document.activeElement===ae);if(!M&&J.value===t&&!X&&!F&&!te)return;let de=M?_r(G,J.value).history:null;N.current=!0;let ge=t==="",ne=()=>g.update(()=>{let Z=M||J.value!==t||X||F;Z&&Gc(t,n,I.current,T.current),M?il(Y.anchor,Y.focus):(Z||te)&&Ia(D)},{discrete:!0,tag:ge?[zo,hv,LR]:zo});de?eA(de,ne):ne(),ge&&te&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let Z=Te();ye(Z)&&(Z.dirty=!0)},{tag:[zo,hv]})},0)),nl(e,t,S.current),queueMicrotask(()=>{N.current=!1})},[o,e,g,w,n,b,t]);let O=R(D=>{let J=g.getRootElement();if(!J)return;let G=ir(S.current.value,D);J.focus({preventScroll:!0}),g.update(()=>{Ia(G)}),S.current={value:S.current.value,cursor:G,expandedCursor:en(S.current.value,G),selection:{anchor:G,focus:G},terminalContextIds:S.current.terminalContextIds},nl(P.current,S.current.value,{cursor:S.current.cursor,expandedCursor:S.current.expandedCursor,selection:S.current.selection}),h.current(S.current.value,G,S.current.expandedCursor,!1,S.current.terminalContextIds)},[g]),j=R(()=>{let D=S.current;return g.getEditorState().read(()=>{D=LA(S.current)}),S.current=D,nl(P.current,D.value,D),D},[g]);pr(f,()=>({focus:()=>{O(S.current.cursor)},focusAt:O,focusAtEnd:()=>{O(uo(S.current.value,S.current.value.length))},readSnapshot:j,readSelectedTextLength:()=>QM(g),removeSelectedText:()=>YM(g),isCaretOnVisualEdge:D=>XM(g,D)}),[g,O,j]);let U=R(D=>{D.read(()=>{let J=LA(S.current),{value:G,cursor:M,expandedCursor:X,selection:F,terminalContextIds:ee}=J,Y=S.current;if(Y.value===G&&Y.cursor===M&&Y.expandedCursor===X&&Y.selection.anchor===F.anchor&&Y.selection.focus===F.focus&&Y.terminalContextIds.length===ee.length&&Y.terminalContextIds.every((te,de)=>te===ee[de])||N.current)return;S.current=J,nl(P.current,G,{cursor:M,expandedCursor:X,selection:F});let ae=el(G,M,"left")||el(G,M,"right");h.current(G,M,X,ae,ee)})},[]);return l(zc,{value:B,children:v("div",{className:V(kC,"grid"),children:[l(OM,{contentEditable:l(PE,{className:V(LC,"col-start-1 row-start-1 min-w-0",i),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":s,...d?{"aria-label":d}:{},placeholder:l("span",{}),onPasteCapture:p}),placeholder:n.length>0?null:l("div",{className:"pointer-events-none col-start-1 row-start-1 min-w-0 select-none whitespace-pre-wrap wrap-break-word leading-relaxed text-placeholder",children:s}),ErrorBoundary:RE}),l(lM,{onChange:U}),l(hA,{...m?{onCommandKeyDown:m}:{}}),l(gA,{}),l(kA,{terminalContexts:n,skills:r}),l(vA,{}),l(yA,{}),l(CA,{}),l(bA,{}),l(TA,{}),l(wA,{}),l(sM,{externalHistoryState:A},e)]})})}function oW(e){let[t]=ct(),o=E(e),n=E(e),[r,a]=q(e.documentKey);r===e.documentKey&&(o.current=e),n.current=e,fe(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),H(()=>{let i=null,d=()=>{let u=n.current.documentKey;a(m=>m===u?m:u)},c=t.registerRootListener((u,m)=>{m?.removeEventListener("compositionend",d),u?.addEventListener("compositionend",d),i=u});return()=>{i?.removeEventListener("compositionend",d),c()}},[t]);let s=r===e.documentKey?e:o.current;return l(tW,{...s})}function cl({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let g=E(t),h=E(n),y=E(Rs(r)),x=E(ks().current),C=W(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Ps,al,dr,...yC],editorState:()=>{Gc(g.current,h.current,y.current,x.current)},onError:b=>{throw b}}),[]);return l(zR,{initialConfig:C,children:l(oW,{documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,onRemoveTerminalContext:c,onChange:u,onPaste:p,editorRef:f,...m?{onCommandKeyDown:m}:{},...i?{className:i}:{},...d?{ariaLabel:d}:{}})},eW)}function PA(e){return typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"}function RA(e){return PA(e)?Promise.resolve(e).then(RA):e===!1?!1:e==null?!0:e.accepted}function jc(e,t,o){let n=e.trim().length-t;return n<=0?null:o("composer.promptTooLong",{count:n,excess:n.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function PC(e){return e.submissionTarget==="provider-turn"?jc(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function EA(e){return PA(e)}function MA(e){let t=PC(e);if(t)return e.event?.preventDefault(),{validationMessage:t,didDispatch:!1};let o=RA(e.onSend(e.event));return typeof o!="boolean"?o.then(n=>(n||e.event?.preventDefault(),{validationMessage:null,didDispatch:n})):(o||e.event?.preventDefault(),{validationMessage:null,didDispatch:o})}var bo=new Map;function nW(e,t,o){return`${e}\0${t}\0${o??"none"}`}function RC(e,t){bo.delete(e),bo.set(e,t)}function ul(e,t){if(bo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,bo.delete(e);for(let o of t.state.added)t.releaseUpload(o.id),URL.revokeObjectURL(o.previewUrl);for(let o of t.listeners)o()}}function rW(e){if(bo.size<=100)return;let t=Array.from(bo);for(let[o,n]of t){if(bo.size<=100)return;o===e||n.committed||n.listeners.size>0||n.operationLeases>0||ul(o,n)}for(let[o,n]of t){if(bo.size<=100)return;o===e||n.listeners.size>0||n.operationLeases>0||ul(o,n)}}function Of(){queueMicrotask(()=>rW())}function AA(e,t,o,n,r=void 0){let a=o.management?.revision??null,s=nW(e,o.intentId,a),i=bo.get(s);if(i)return i.releaseUpload=n.releaseUpload,i.watchAuthority=r,i.state;let d={key:s,inputKey:e,environmentId:t,intentId:o.intentId,revision:a,text:o.management?.text??o.text??"",retained:o.management?.attachments??[],added:[],saving:!1,error:null},c={state:d,listeners:new Set,releaseUpload:n.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return bo.set(s,c),d}function NA(e,t){let o=bo.get(e);return o?(o.releaseAuthorityWatch===void 0&&o.watchAuthority!==void 0&&(o.releaseAuthorityWatch=o.watchAuthority({threadKey:o.state.inputKey,intentId:o.state.intentId,revision:o.state.revision,onInvalid:()=>ul(e,o)})),o.committed=!0,RC(e,o),o.listeners.add(t),Of(),()=>{o.listeners.delete(t),Of()}):()=>{}}function Ms(e,t){let o=bo.get(e);if(!o)return;o.committed=!0;let n=t(o.state);if(n!==o.state){o.state=n,RC(e,o);for(let r of o.listeners)r()}}function Ff(e){return bo.get(e)?.state}function DA(e){let t=bo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,RC(e,t);let o=!1;return()=>{if(!o){if(o=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){ul(e,t);return}Of()}}}function Bf(e){let t=bo.get(e);t&&ul(e,t)}function _A(e,t){let o=new Map(t.flatMap(n=>n.waiting&&n.management!==void 0?[[n.intentId,n.management.revision]]:[]));for(let[n,r]of bo)r.state.inputKey===e&&o.get(r.state.intentId)!==r.state.revision&&ul(n,r);Of()}var aW=[],sW=[],iW=()=>{};function OA({entry:e,current:t,inputKey:o,environmentId:n,unavailable:r,attachments:a,watchEditorAuthority:s,onEdit:i,onClose:d}){let{t:c}=z(),u=AA(o,n,e,a,s),m=Go(D=>NA(u.key,D),()=>Ff(u.key)??u,()=>Ff(u.key)??u),{key:p,text:f,retained:g,added:h,saving:y,error:x}=m,C=E(null),[b,L]=q(()=>f.length),w=Co()?.data.assistantQuotes??null,k=D=>jc(w?w.expandForProvider(D):D,a.limits.maxInputChars,c),I=k(f),T=E(null),S=a.useUploadStatuses(),P=W(()=>g.map(D=>D.id),[g]),A=a.useAssetUrls(n,P),N=!t?.management||t.management.revision!==e.management?.revision;H(()=>{t===void 0&&(Bf(p),d())},[t,p,d]);let B=()=>{y||(Bf(p),d())},O=D=>{if(y||r||N)return;let J=null,G=[...h];for(let M of D){let X=M.type||"application/octet-stream";if(M.size===0){J=c("attachments.empty",{name:M.name});continue}let F=a.makeImageAttachment({id:a.randomUUID(),name:M.name,mimeType:X,sizeBytes:M.size,file:M});G.push(F),a.startUpload({environmentId:n,image:F})}Ms(p,M=>({...M,added:G,error:J}))},j=async()=>{let D=Ff(p);if(!D||D.saving||r||N||!D.text.trim()&&D.retained.length+D.added.length===0||k(D.text)!==null)return;let J=DA(p);if(J!==null){Ms(p,G=>({...G,saving:!0,error:null}));try{await a.awaitUploads(D.added.map(M=>M.id));let G=a.getUploadedAttachments({environmentId:n,images:D.added});if(!G)throw new Error(c("turnQueue.uploadFailed"));await i(e,{text:D.text,attachments:[...D.retained,...G]}),Bf(p),d()}catch(G){Ms(p,M=>({...M,saving:!1,error:G instanceof Error?G.message:c("turnQueue.actionFailed")}))}finally{J()}}},U=[...g.map((D,J)=>({...D,previewUrl:A[J],added:!1})).filter(D=>D.source?._tag!=="thread-reference"),...h.map(D=>({...D,added:!0}))];return l(Js,{open:!0,onOpenChange:D=>{D||B()},children:v(ei,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(C.current?.focusAtEnd(),!1),children:[v(Hu,{children:[l(ti,{children:c("turnQueue.editTitle")}),l(Zs,{children:c("turnQueue.editDescription")})]}),v("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:D=>{D.dataTransfer.types.includes("Files")&&D.preventDefault()},onDrop:D=>{D.dataTransfer.files.length&&(D.preventDefault(),D.stopPropagation(),O(Array.from(D.dataTransfer.files)))},children:[l("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:l(cl,{editorRef:C,documentKey:`queue-editor\0${p}`,value:f,cursor:b,terminalContexts:aW,skills:sW,disabled:y,placeholder:c("turnQueue.editText"),ariaLabel:c("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:iW,onChange:(D,J)=>{L(J),Ms(p,G=>({...G,text:D}))},onCommandKeyDown:(D,J)=>D!=="Enter"||!(J.metaKey||J.ctrlKey)?!1:(j(),!0),onPaste:D=>{D.clipboardData.files.length&&(D.preventDefault(),O(Array.from(D.clipboardData.files)))}})}),I?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:I}):null,l("ul",{className:"flex flex-wrap gap-2",children:U.map(D=>v("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[D.type==="image"&&D.previewUrl?l("img",{src:D.previewUrl,alt:D.name,className:"size-12 rounded object-cover"}):l(Vo,{className:"size-4 shrink-0"}),v("div",{className:"min-w-0 text-xs",children:[l("p",{className:"max-w-48 break-words",children:D.name}),l("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(D.sizeBytes)}),D.added&&S.get(D.id)!=="ready"?l("p",{children:c(S.get(D.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,D.added&&S.get(D.id)==="failed"?l(K,{size:"xs",variant:"ghost",disabled:y||r||N,onClick:()=>{let J=h.find(G=>G.id===D.id);J&&a.retryUpload({environmentId:n,image:J})},children:c("turnQueue.retryUpload")}):null]}),l(K,{size:"icon-xs",variant:"ghost","aria-label":c("turnQueue.removeAttachment",{name:D.name}),disabled:y||N,onClick:()=>{D.added?(a.releaseUpload(D.id),D.previewUrl&&URL.revokeObjectURL(D.previewUrl),Ms(p,J=>({...J,added:J.added.filter(G=>G.id!==D.id)}))):Ms(p,J=>({...J,retained:J.retained.filter(G=>G.id!==D.id)}))},children:l(dt,{className:"size-3.5"})})]},D.id))}),l("input",{ref:T,type:"file",multiple:!0,className:"hidden","aria-label":c("turnQueue.addAttachments"),onChange:D=>{O(Array.from(D.target.files??[])),D.target.value=""}}),v(K,{size:"sm",variant:"outline",disabled:y||r||N,onClick:()=>T.current?.click(),children:[l(Vo,{className:"size-4"}),c("turnQueue.addAttachments")]}),N?l("p",{role:"alert",className:"text-sm text-muted-foreground",children:c("turnQueue.editStale")}):null,x?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),v(Bu,{children:[l(K,{variant:"ghost",disabled:y,onClick:B,children:c("turnQueue.discardEdit")}),l(K,{disabled:y||r||N||I!==null||!f.trim()&&U.length===0,onClick:()=>{j()},children:c(y?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}$();var _n=["approval-required","auto-accept-edits","auto","full-access"];var lW={"approval-required":td,"auto-accept-edits":Wn,auto:Gn,"full-access":Wr},dW={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function pl(){let{t:e}=z();return R(t=>{let o=dW[t];return{mode:t,label:e(`runtimeMode.${o}`),description:e(`runtimeMode.${o}Description`),icon:lW[t]}},[e])}function FA(e){let{t}=z(),o=pl(),{interactionMode:n,runtimeMode:r,nativeModeName:a}=e.sentWith,s=[n===void 0?null:t(n==="plan"?"turnQueue.sentWithPlan":"turnQueue.sentWithNoPlan"),a??(r===void 0?null:o(r).label)].filter(i=>i!=null);return l("p",{className:"text-muted-foreground","data-queued-sent-with":!0,children:t("turnQueue.sentWith",{modes:s.join(", ")})})}function BA(e,t){let o=e.find(a=>a.intentId===t.intentId);if(!o)return e;let n=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?n.length:n.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(n.splice(r,0,o),n)}function HA(e,t,o){if(t===o)return null;let n={intentId:t,beforeIntentId:o,previousOrder:e.map(a=>a.intentId)};return BA(e,n).every((a,s)=>a.intentId===e[s]?.intentId)?null:n}function UA(e,t){if(!e.find(d=>d.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(d=>d.intentId===t.beforeIntentId))return{entries:e,settled:!0};let n=new Set(e.map(d=>d.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(d=>n.has(d));return e.filter(d=>r.has(d.intentId)).some((d,c)=>d.intentId!==a[c])?{entries:e,settled:!0}:{entries:BA(e,t),settled:!1}}$();$();function cW({entry:e,unavailable:t,onCancel:o}){let{t:n}=z(),r=E(!1),[a,s]=q(!1),[i,d]=q(!1),[c,u]=q(!1);H(()=>{u(!1),d(!1)},[e.status,e.deliveryCertainty]);let m=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,s(!0),d(!1);try{await o(e),u(!1)}catch{d(!0)}finally{r.current=!1,s(!1)}}};return v("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[l("p",{className:"text-muted-foreground",children:n(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.waitingForCapacity===!0?"turnQueue.itemCapacity":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),l("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??n("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?l("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?c&&e.action==="abandon"?v("div",{className:"space-y-2",children:[l("p",{children:n("turnQueue.abandonDescription")}),v("div",{className:"flex flex-wrap gap-2",children:[l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{m()},children:n("turnQueue.confirmAbandon")}),l(K,{size:"xs",variant:"ghost",disabled:a,onClick:()=>u(!1),children:n("turnQueue.keepWaiting")})]})]}):l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?u(!0):void m(),children:n(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,i?l("p",{role:"alert",className:"text-destructive-foreground",children:n("turnQueue.actionFailed")}):null]})}function $A({entries:e,unavailable:t,onCancel:o,autoExpand:n=!1}){let{t:r}=z(),[a,s]=q(null),i=a??n,d=ho();return e.length===0?null:v("div",{className:"min-w-0 basis-full space-y-2",children:[l(K,{size:"xs",variant:"ghost","aria-expanded":i,"aria-controls":d,onClick:()=>s(!i),children:r(i?"turnQueue.hideMessages":"turnQueue.showMessages")}),i?l("ol",{id:d,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(c=>l(cW,{entry:c,unavailable:t,onCancel:o},c.intentId))}):null]})}function EC({queue:e,environmentId:t=null,unavailable:o=!1,onResume:n,entries:r,onCancel:a}){let{t:s}=z(),i=E(!1),[d,c]=q(!1),[u,m]=q(!1);H(()=>{e.paused||m(!1)},[e.paused]);let p=e.waitingForCapacity??null,g=Nt().useProviderName?.(t,p?.instanceId??"",p?.instanceId?p.agentName:void 0)??s("turnQueue.unknownProvider"),h=e.deliveryUncertain||e.blocked||e.reconciling||p!==null;if(!e.paused&&!h)return null;let y=r?.[0]?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),x=e.paused?s("turnQueue.pausedTitle"):e.deliveryUncertain?s("turnQueue.uncertainTitle"):e.blocked?s("turnQueue.blockedTitle"):e.reconciling?s("turnQueue.reconcilingTitle"):s(p!==null?"turnQueue.capacityTitle":"turnQueue.queuedTitle"),C=e.deliveryUncertain?s("turnQueue.uncertainDescription"):e.blocked?s("turnQueue.blockedDescription"):e.reconciling?s("turnQueue.reconcilingDescription"):e.paused?s("turnQueue.pausedDescription"):p!==null?p.maxProcesses===null?s("turnQueue.capacityDescriptionNoLimit",{agent:g}):s("turnQueue.capacityDescription",{agent:g,count:p.maxProcesses}):null,b=async()=>{if(!(i.current||o||!e.paused)){i.current=!0,c(!0),m(!1);try{await n()}catch{m(!0)}finally{i.current=!1,c(!1)}}};return v("div",{className:V("mx-auto mb-2 flex w-full max-w-3xl select-none flex-wrap items-start gap-2 rounded-md border bg-background px-3 py-2 text-xs text-foreground",p!==null&&!e.paused?"border-border":"border-warning/40"),"data-turn-queue-banner":!0,role:"status",children:[v("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[l("p",{className:"font-medium",children:x}),C===null?null:l("p",{className:"text-muted-foreground",children:C}),e.paused&&h?l("p",{className:"text-muted-foreground",children:s("turnQueue.pausedUncertainDescription")}):null,o?l("p",{className:"text-muted-foreground",children:s("turnQueue.disconnected")}):null,u&&e.paused?l("p",{className:"text-destructive-foreground",role:"alert",children:s("turnQueue.resumeFailed")}):null]}),e.paused?l(K,{size:"xs",variant:"outline",disabled:d,softDisabled:o,onClick:()=>{b()},children:s(d?"turnQueue.resuming":"turnQueue.resume")}):null,a&&r?l($A,{entries:r.filter(L=>L.status!=="queued"),unavailable:o,onCancel:a,autoExpand:y}):null]})}var uW=[Qk,Vk],pW=[],mW={kind:"user"};function fW({submission:e,environmentId:t}){let{t:o}=z();return v("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:[l("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:l("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),l(Rh,{source:mW,environmentId:t}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Nd(e.text)||o("turnQueue.attachmentsOnly")}),e.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(Vo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),l("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:o("primaryActions.sendingButtonLabel")})]})}function gW({entry:e,disabled:t,dropPosition:o,dragPosition:n,feedback:r,reducedMotion:a,locked:s,children:i}){let{t:d}=z(),{attributes:c,listeners:u,setNodeRef:m,setActivatorNodeRef:p,transform:f,transition:g,isDragging:h}=Wk({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return v("li",{ref:m,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:na.Transform.toString(f),transition:g},className:V("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",s?"bg-muted/60":"bg-background hover:bg-accent",h&&"z-10 shadow-md ring-1 ring-primary/50 ring-inset [background:linear-gradient(var(--accent),var(--accent)),var(--background)]",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[o?l("span",{"aria-hidden":"true","data-queue-drop-position":o,className:V("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",o==="before"?"top-0":"bottom-0")}):null,s?l("span",{"aria-hidden":"true",className:"size-6 shrink-0"}):l(K,{ref:p,size:"icon-xs",variant:"ghost",className:V("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...c,...u,"aria-label":d("turnQueue.reorderMessage"),title:d("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?l(jo,{className:"size-3.5"}):l(Ql,{className:"size-3.5"})}),i,h&&n?l("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:n}):null]})}function zA({inputKey:e,entries:t,pendingSubmissions:o=pW,environmentId:n,unavailable:r,attachments:a,actions:s,onCancel:i,readRecord:d}){let{t:c}=z(),u=Vp("(prefers-reduced-motion: reduce)"),[m,p]=Ge(e,null,{namespace:"turn-queue:editing"}),[f,g]=Ge(e,!1,{namespace:"turn-queue:pending"}),h=$e(e,!1,{namespace:"turn-queue:pending-ref"}),[y,x]=Ge(e,null,{namespace:"turn-queue:error"}),[C,b]=Ge(e,null,{namespace:"turn-queue:drag"}),[L,w]=Ge(e,null,{namespace:"turn-queue:move"}),k=$e(e,!1,{namespace:"turn-queue:reorder-ref"}),[I,T]=Ge(e,null,{namespace:"turn-queue:feedback"}),S=yk(kh(Ii,{activationConstraint:{distance:5}}),kh(Ti,{coordinateGetter:Gk,scrollBehavior:u?"auto":"smooth"})),P=W(()=>t.filter(M=>M.waiting),[t]),A=L?UA(P,L.preview):null,N=A?.entries??P,B=N.length+o.length,O=r||f||L!==null,j=N.findIndex(M=>M.intentId===C?.activeId),U=N.findIndex(M=>M.intentId===C?.overId);H(()=>{_A(e,t)},[t,e]),H(()=>{L!==null&&(r||L.acknowledged&&A?.settled)&&(k.current=!1,w(null),!r&&P.some(M=>M.intentId===L.preview.intentId)&&T({intentId:L.preview.intentId,kind:"saved"}))},[P,L,A?.settled,r]),H(()=>{if(I===null||I.kind==="failed")return;let M=window.setTimeout(()=>T(X=>X===I?null:X),1600);return()=>window.clearTimeout(M)},[I]);let D=async M=>{if(!(h.current||k.current||r)){h.current=!0,g(!0),x(null),T(null);try{await M()}catch(X){x(X instanceof Error?X.message:c("turnQueue.actionFailed"))}finally{h.current=!1,g(!1)}}},J=(M,X)=>D(async()=>{let F=HA(P,M.intentId,X);if(!(F===null||!M.management?.canReorder)){k.current=!0,w({preview:F,acknowledged:!1});try{await s.onReorder(M,X),w(ee=>ee?.preview===F?{...ee,acknowledged:!0}:ee)}catch(ee){throw k.current=!1,w(null),T({intentId:M.intentId,kind:"failed"}),ee}}}),G=r?c("turnQueue.disconnected"):L!==null?c("turnQueue.saving"):C!==null?`${c("turnQueue.dragStarted")} ${U+1}/${N.length}`:I?.kind==="saved"?c("common.action.done"):I?.kind==="cancelled"?c("turnQueue.dragCancelled"):"";return v(oe,{children:[B>0?v("section",{"aria-label":c("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:[v("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[l("span",{className:"shrink-0",children:c("turnQueue.queued",{count:B})}),l("span",{role:"status","aria-live":C===null?"polite":"off","data-queue-reorder-status":L?"saving":I?.kind,className:V("min-w-0 truncate",I?.kind==="saved"&&"text-primary"),children:G})]}),l(Dk,{sensors:S,collisionDetection:xk,modifiers:uW,accessibility:{screenReaderInstructions:{draggable:c("turnQueue.dragInstructions")},announcements:{onDragStart:()=>c("turnQueue.dragStarted"),onDragOver:({over:M})=>{let X=N.findIndex(F=>F.intentId===M?.id);return X<0?void 0:`${c("turnQueue.dragStarted")} ${X+1}/${N.length}`},onDragEnd:()=>c("turnQueue.dragFinished"),onDragCancel:()=>c("turnQueue.dragCancelled")}},onDragStart:({active:M})=>{let X=N.find(F=>F.intentId===M.id);!X?.management?.canReorder||O||(x(null),T(null),b({activeId:X.intentId,overId:X.intentId}))},onDragOver:({over:M})=>{let X=N.find(F=>F.intentId===M?.id);X&&b(F=>F&&{...F,overId:X.intentId})},onDragCancel:()=>{C&&T({intentId:C.activeId,kind:"cancelled"}),b(null)},onDragEnd:({active:M,over:X})=>{if(b(null),!X||M.id===X.id)return;let F=N.findIndex(te=>te.intentId===M.id),ee=N.findIndex(te=>te.intentId===X.id),Y=N[F];if(!Y?.management?.canReorder||ee<0)return;let ae=N[ee+(F<ee?1:0)]?.intentId??null;J(Y,ae)},children:l(Kk,{items:N.map(M=>M.intentId),strategy:Uk,children:v("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[N.map((M,X)=>v(gW,{entry:M,disabled:!M.management?.canReorder||O,locked:Yd(M),reducedMotion:u,feedback:I?.intentId===M.intentId?I.kind:void 0,dropPosition:M.intentId===C?.overId&&j!==U?j<U?"after":"before":void 0,dragPosition:M.intentId===C?.activeId?`${U+1}/${N.length}`:void 0,children:[l(Rh,{source:M.source,environmentId:n}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:l(Zk,{entry:M,readRecord:d,environmentId:n})}),l(ip,{environmentId:n,rewrite:M.rewrite,text:M.rewrittenText??""}),M.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(Vo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:M.attachmentNames.join(", ")})]}):null,M.pendingAction?l("p",{className:"text-muted-foreground",children:c(M.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,M.sentWith?l(FA,{sentWith:M.sentWith}):null,M.failure?l("p",{role:"alert",className:"text-destructive-foreground",children:M.failure}):null]}),v("div",{className:V("flex shrink-0 items-center gap-0.5",M.intentId===C?.activeId&&"invisible"),children:[Yd(M)?null:l(K,{size:"icon-xs",variant:"ghost",disabled:!M.management||O||C!==null,"aria-label":c("turnQueue.editMessage"),title:c("turnQueue.editMessage"),onClick:()=>p(M),children:l(id,{className:"size-3.5"})}),M.management?.canSteer?l(K,{size:"icon-xs",variant:"ghost",disabled:O||C!==null,"data-turn-queue-steer":"","aria-label":c("turnQueue.steer"),title:c("turnQueue.steerDescription"),onClick:()=>{D(()=>s.onRun(M,"steer"))},children:l(ud,{className:"size-3.5"})}):null,v(Ao,{children:[l(Do,{render:l(K,{size:"icon-xs",variant:"ghost",disabled:O||!M.management&&!Yd(M)&&M.action!=="cancel"||C!==null,"aria-label":c("turnQueue.messageActions")}),children:l(Eo,{className:"size-4"})}),v(No,{align:"end",children:[Yd(M)?null:v(oe,{children:[v(vo,{disabled:!M.management?.canReorder||X===0,onClick:()=>{J(M,N[X-1].intentId)},children:[l(_l,{className:"size-4"}),c("turnQueue.moveUp")]}),v(vo,{disabled:!M.management?.canReorder||X===N.length-1,onClick:()=>{J(M,N[X+2]?.intentId??null)},children:[l(Nl,{className:"size-4"}),c("turnQueue.moveDown")]}),M.management?.canSteer?l(vo,{onClick:()=>{D(()=>s.onRun(M,"steer"))},children:c("turnQueue.steer")}):null,l(vo,{disabled:!M.management?.canRun,onClick:()=>{D(()=>s.onRun(M,"interrupt"))},children:c(M.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),l(Cd,{})]}),l(vo,{disabled:M.action!=="cancel",onClick:()=>{D(()=>i(M))},children:c("turnQueue.cancelMessage")})]})]})]})]},M.intentId)),o.map(M=>l(fW,{submission:M,environmentId:n},M.messageId))]})})},e),y?l("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:y}):null]}):null,m?l(OA,{entry:m,current:t.find(M=>M.intentId===m.intentId),inputKey:e,environmentId:n,unavailable:O,attachments:a,watchEditorAuthority:s.watchEditorAuthority,onEdit:s.onEdit,onClose:()=>p(null)},`${e}\0${m.intentId}\0${m.management?.revision??"none"}`):null]})}function KA({data:e,target:t,inputKey:o,attachments:n}){let r=e.useQueue({target:t,threadKey:o}),a=e.useCommandFailureText?.(),{environmentId:s,threadId:i}=t,d=e.queue,c=p=>e.useCommunicationRecord(t,p),u=W(()=>{let p={environmentId:s,threadId:i};return{actions:{onEdit:async(g,h)=>{try{await d.edit(p,g,h)}catch(y){let x=a?.(y);throw x?new Error(x):y}},onReorder:(g,h)=>d.reorder(p,g,h),onRun:(g,h)=>d.run(p,g,h),watchEditorAuthority:d.watchEditorAuthority},onCancel:g=>d.cancel(p,g),onResume:()=>d.resume(p)}},[d,s,a,i]),m=W(()=>({data:e,target:t,threadKey:`${o}\0queue-editor`}),[e,t,o]);return v(oe,{children:[l(Np,{value:m,children:l(zA,{inputKey:o,actions:u.actions,attachments:n,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:s,onCancel:u.onCancel,readRecord:c,unavailable:r.unavailable})}),l(EC,{environmentId:s,entries:r.entries,onCancel:u.onCancel,onResume:u.onResume,queue:r.state,unavailable:r.unavailable})]})}$();$();$();function ml({unavailableReason:e=null,disabled:t,className:o,children:n,...r}){let a=ho(),s=t===!0&&e!==null;return v(oe,{children:[v(Pe,{disabled:!s,children:[l(Ee,{"aria-describedby":s?a:void 0,render:l(K,{...r,disabled:t&&!s,softDisabled:s,className:V("rounded-full shadow-none! inset-shadow-none! ease-out before:rounded-full sm:rounded-full",o)}),children:n}),l(Re,{side:"top",className:"max-w-72",children:e})]}),s?l("span",{id:a,hidden:!0,children:e}):null]})}var Vc="not-disabled:not-aria-disabled:border-message-action not-disabled:not-aria-disabled:bg-message-action not-disabled:not-aria-disabled:text-message-action-foreground not-disabled:not-aria-disabled:hover:bg-message-action-hover",Qc=(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"),hW=e=>{e.preventDefault()},fl=pe(function({compact:t,pendingAction:o,isRunning:n,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:s,sendDisabledReason:i,isEnvironmentUnavailable:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:u=!1,showSendWhileRunning:m=!1,onInterrupt:p,interruptArmed:f=!1,stopping:g=!1,cancelsCheck:h=!1,onImplementPlanInNewThread:y,shellCommandMode:x=!1,shellCommandUnavailableReason:C=null}){let{t:b}=z(),L=it(),w=u?{onPointerDown:hW}:void 0,k=L.settings.useEnvironmentIdentificationMode(),I=i!==null,T=s?null:i??(d?b("primaryActions.environmentDisconnected"):null),S=L.devBackdrop.useVisible(k==="artwork"),P=O=>l(ml,{type:"button",variant:"destructive",size:g||f?"sm":"icon",className:V(g?"h-8 px-3 text-xs sm:h-8 sm:text-xs":f?"h-8 px-3 text-xs ring-2 ring-destructive-solid/60 sm:h-8 sm:text-xs":O?"size-8 sm:size-7":m&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...w,onClick:p,disabled:g,"data-interrupt-armed":f&&!g?"":void 0,"aria-label":b(g?"primaryActions.stopping":f?"primaryActions.confirmStopEsc":h?"primaryActions.cancelCheck":"primaryActions.stopGeneration"),children:g?b("primaryActions.stopping"):f?b("primaryActions.confirmStopEsc"):l("svg",{className:"size-3",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:l("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(o)return v("div",{className:V("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[n?P(!0):null,l(K,{type:"submit",size:"sm",className:V("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...w,disabled:d||o.isResponding||(o.isLastQuestion?!o.isComplete:!o.canAdvance),children:Qc(b,{compact:t,isLastQuestion:o.isLastQuestion,isResponding:o.isResponding,questionIndex:o.questionIndex})})]});if(x){let O=l(ml,{type:"submit",variant:"secondary",size:"icon","data-shell-command-run":"true",className:V("size-9 sm:size-8",Vc),...w,disabled:C!==null||!c,unavailableReason:C,"aria-label":b("primaryActions.runInTerminal"),children:l(Qo,{"aria-hidden":"true",className:"size-4"})});return n?v(oe,{children:[P(!1),O]}):O}if(r)return a?l(ml,{type:"submit",size:"sm",className:V(Vc,t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):v("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[l(ml,{type:"submit",size:"sm",className:V("h-9 rounded-r-none px-4 before:rounded-r-none sm:h-8 sm:rounded-r-none",Vc),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),v(Ao,{children:[l(Do,{render:l(K,{size:"sm",variant:"default",className:V("h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 px-2 sm:h-8",Vc),"aria-label":b("primaryActions.implementationActions"),disabled:s||I||d}),children:l(Tt,{})}),l(No,{align:"end",side:"top",children:l(vo,{disabled:s||I||d,onClick:()=>{y()},children:b("primaryActions.implementInNewThread")})})]})]});let A=s||I||d||!c,N=S&&!A,B=v(ml,{type:"submit",variant:"secondary",size:"icon",className:V("isolate size-9 sm:size-8",N?"bg-transparent text-white":Vc),...w,disabled:A,unavailableReason:T,"aria-label":b(s?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[N?l("span",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden rounded-full","aria-hidden":"true",children:l(Ab,{compact:!0})}):null,s?l(Qs,{className:"size-3.5","aria-hidden":"true"}):l("svg",{className:"size-4",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?v(oe,{children:[P(!1),m&&c?B:null]}):B});function Sa(e){return e.id??e.label}function Hf(e,t){return Array.from(new Set((t??[]).flatMap(o=>{let n=e.options.find(r=>r.id!==void 0?r.id===o:r.label===o.trim());return n?[Sa(n)]:[]})))}function yW(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function gl(e,t){if(t?.attachmentsBlocked)return null;let o=yW(t?.customAnswer);if(e.allowFreeform!==!1&&o)return o;let n=Hf(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?n.length>0?n:r?"":null:n[0]??(r?"":null)}function qA(e,t){let o=t.trim().length>0?void 0:e?.selectedOptionLabels;return{customAnswer:t,...o&&o.length>0?{selectedOptionLabels:o}:{}}}function WA(e,t,o){let n=Hf(e,[o])[0];if(n===void 0)return t??{};if(e.multiSelect){let r=Hf(e,t?.selectedOptionLabels),a=r.includes(n)?r.filter(s=>s!==n):[...r,n];return{customAnswer:"",...a.length>0?{selectedOptionLabels:a}:{}}}return{customAnswer:"",selectedOptionLabels:[n]}}function MC(e,t){let o={};for(let n of e){let r=gl(n,t[n.id]);if(r===null)return null;o[n.id]=r}return o}function vW(e,t){return e.reduce((o,n)=>gl(n,t[n.id])!==null?o+1:o,0)}function Uf(e,t,o){let n=e.length===0?0:Math.max(0,Math.min(o,e.length-1)),r=e[n]??null,a=r?t[r.id]:void 0,s=r?gl(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",d=vW(e,t),c=e.length===0?!0:n>=e.length-1;return{questionIndex:n,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?Hf(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:d,isLastQuestion:c,isComplete:MC(e,t)!==null,canAdvance:s!==null}}var CW={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function hl(e,t,o){if(o.displayKind==="acknowledge")return{label:e("pendingUserInput.acknowledge"),description:e("pendingUserInput.continueHint")};let n=t.kind==="plan"&&o.planAction!==void 0?CW[o.planAction]:void 0;return n===void 0?{label:o.label,description:o.description??""}:{label:e(n.label),description:e(n.description)}}function $f(e){let{t}=z();return e.questions.length<2?null:l("div",{className:"flex flex-wrap items-center gap-1","data-pending-user-input-steps":!0,children:e.questions.map((o,n)=>{let r=n===e.currentIndex,a=gl(o,e.answers[o.id])!==null;return v(K,{size:"xs",variant:r?"outline":"ghost","aria-current":r?"step":void 0,"aria-label":t("pendingUserInput.goToQuestion",{index:n+1,question:o.header}),disabled:e.disabled,"data-pending-user-input-step":n,onClick:()=>e.onGoTo(n),children:[a?l(jo,{"aria-hidden":!0}):null,n+1]},o.id)})})}function zf(e){let{t}=z();return e.questions.length<2||e.currentIndex<e.questions.length-1?null:l("ul",{className:"flex flex-col border-t border-border/60 pt-1","data-pending-user-input-summary":!0,children:e.questions.slice(0,-1).map((o,n)=>{let r=gl(o,e.answers[o.id]),a=i=>{let d=o.options.find(c=>Sa(c)===i);return d?hl(t,o,d).label:i},s=r===null?t("pendingUserInput.unanswered"):r===""?t("pendingUserInput.attachmentsOnly"):(Array.isArray(r)?r:[r]).map(a).join(", ");return l("li",{children:v("button",{type:"button",disabled:e.disabled,"data-pending-user-input-summary-row":n,className:"flex w-full min-w-0 cursor-[var(--control-cursor)] items-baseline gap-2 rounded-md px-2 py-1 text-left text-chat-row transition-colors duration-(--control-duration) hover:bg-accent disabled:pointer-events-none pointer-coarse:min-h-11",onClick:()=>e.onGoTo(n),children:[l("span",{className:"max-w-[45%] shrink-0 truncate text-muted-foreground",children:o.header}),l("span",{className:r===null?"min-w-0 truncate text-warning-foreground":"min-w-0 truncate text-foreground",children:s})]})},o.id)})})}var GA=pe(function(t){let o=t.data.useQuestions(t.target);return o.pending.length===0?null:l("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:o.pending.toReversed().map(n=>l(xW,{pending:n,actions:o},n.requestId))})}),xW=pe(function(t){let{pending:o,actions:n}=t,{t:r}=z(),[a,s]=q({}),[i,d]=q(0),[c,u]=q(!1),[m,p]=q(null),f=E(null);H(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let g=o.questions,h=Uf(g,a,i),y=h.activeQuestion;if(!y)return null;let x=MC(g,a),C=I=>{u(!0),p(null),I().then(T=>{u(!1),p(T)})},b=I=>{f.current!==null&&window.clearTimeout(f.current),f.current=null,d(Math.min(Math.max(I,0),g.length-1))},L=()=>{if(!c){if(!h.isLastQuestion){h.canAdvance&&b(h.questionIndex+1);return}x!==null&&C(()=>n.answer(o.requestId,x))}},w=I=>{if(s(S=>({...S,[y.id]:WA(y,S[y.id],I)})),y.multiSelect||h.isLastQuestion)return;f.current!==null&&window.clearTimeout(f.current);let T=h.questionIndex+1;f.current=window.setTimeout(()=>{f.current=null,b(T)},200)},k=y.header===y.question?r("asyncQuestion.title"):y.header;return l("section",{"data-async-question":o.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 shadow-xs sm:px-4",children:v(vr,{state:"pending",icon:l(Kn,{}),title:k,actions:v(oe,{children:[l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground",disabled:c,onClick:()=>C(()=>n.dismiss(o.requestId)),children:r("asyncQuestion.dismiss")}),l(K,{size:"sm","data-async-question-submit":"",disabled:c||(h.isLastQuestion?x===null:!h.canAdvance),onClick:L,children:Qc(r,{compact:!1,isLastQuestion:h.isLastQuestion,isResponding:c,questionIndex:h.questionIndex})})]}),children:[l($f,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),l("p",{className:"whitespace-pre-wrap break-words text-chat font-medium text-foreground","data-async-question-item":y.id,children:y.question}),y.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?l($u,{mode:y.multiSelect?"multiple":"single","aria-label":k,disabled:c,selected:h.usingCustomAnswer?[]:h.selectedOptionLabels,onToggle:w,onReselect:w,options:y.options.map(I=>{let T=hl(r,y,I);return{value:Sa(I),label:T.label,...T.description&&T.description!==T.label?{description:T.description}:{}}})},y.id):null,y.allowFreeform===!1?null:l(Vr,{type:"text",size:"sm",value:h.customAnswer,disabled:c,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),onChange:I=>{let T=I.target.value;s(S=>({...S,[y.id]:qA(S[y.id],T)}))},onKeyDown:I=>{I.key!=="Enter"||I.nativeEvent.isComposing||(I.preventDefault(),L())}}),l(zf,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),m?l("p",{role:"alert",className:"text-chat-row text-destructive-foreground",children:m}):null]})})});$();var AC=220,bW={opacity:0,transform:"translate3d(0, 4rem, 0)"},wW={opacity:0,transform:"translate3d(0, 7rem, 0)"},jA={opacity:1,transform:"none"},VA={transition:`transform ${AC}ms ease-in, opacity ${AC}ms ease-in`},TW={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function XA({className:e,items:t}){let{t:o}=z(),[n,r]=q(null),a=E(null),s=n!==null&&t.some(f=>f.id===n)?n:null;if(H(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let d=t.slice(1),c=d.length>0,u=c&&s!==i.id,m=d[0],p=f=>{!f.onDismiss||s||(r(f.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,f.onDismiss?.()},AC))};return l("div",{className:V("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:v("div",{className:V("relative flex flex-col-reverse",c?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[u&&m?l("div",{className:V("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)]",TW[m.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,l("div",{className:V("relative z-10",s===i.id?"pointer-events-none":null),style:{...VA,...s===i.id?bW:jA},children:l(QA,{item:i,attached:!0,exiting:s===i.id,onDismissRequest:()=>p(i)})}),c?l("div",{"data-composer-banner-stack-expanded-items":"true",className:V("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:l("div",{className:"min-h-0 overflow-hidden",children:l("div",{className:V("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:d.map(f=>l("div",{className:V(s===f.id?"pointer-events-none":null),style:{...VA,...s===f.id?wW:jA},children:l(QA,{item:f,attached:!1,exiting:s===f.id,onDismissRequest:()=>p(f)})},f.id))})})}):null]})})}function QA({item:e,attached:t,exiting:o,onDismissRequest:n}){let{t:r}=z(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?v(xd,{variant:e.variant,role:"status",className:V("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-composer py-1.5",e.className),"data-composer-banner-presentation":"compact","data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,v(Mg,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[l("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?v(bd,{className:V("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:o,onClick:n,children:l(dt,{})}):null]}):null]}):v(xd,{variant:e.variant,className:V(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-composer",e.className),"data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,l(Mg,{children:e.title}),e.description?l(Uu,{children:e.description}):null,e.actions||e.onDismiss?v(bd,{className:V(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?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:o,onClick:n,children:l(dt,{})}):null]}):null]})}$();var YA=qe(!1),JA=YA.Provider;function ZA(){return Pt(YA)}$();var eN=qe(null),tN=eN;function oN(){let[e,t]=q(0),o=R(n=>{t(r=>Math.max(0,r+(n?1:-1)))},[]);return[e>0,o]}function nN(){let e=xe(eN);fe(()=>(e?.(!0),()=>e?.(!1)),[e])}function IW({api:e,draftId:t,environmentId:o,slots:n,threadId:r}){let a=e.presets.useDraftPresetId(t),s=t!==null;return n?.renderSlot("conversation.hero.agentPreset",{environmentId:o,threadId:r,draftId:t,presetId:a,selectable:s,onSelectPreset:s&&t!==null?i=>e.presets.setDraftPresetId(t,i):void 0})}function rN({api:e,belowSlot:t,teamDock:o,composer:n,data:r,draftHero:a,draftId:s,environmentId:i,onOverlayElementChange:d,queue:c,questions:u,slots:m,target:p,threadId:f,threadKey:g}){let h=r.useComposerBanners({target:p,threadKey:g}),y=l(XA,{className:"relative z-0",items:h.items}),[x,C]=oN();return v("div",{ref:d,"data-chat-composer-overlay":"true",className:a.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:[v("div",{ref:a.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:[v("div",{className:"pointer-events-auto relative z-10",children:[c,u,a.active?v("div",{className:"absolute inset-x-0 bottom-full z-0",children:[e===void 0?m?.renderSlot("conversation.hero.agentPreset",{environmentId:i,threadId:f}):l(IW,{api:e,draftId:s??null,environmentId:i,slots:m,threadId:f}),l("div",{"aria-hidden":x||void 0,className:V("pb-8 transition-opacity duration-150 motion-reduce:transition-none",x&&"pointer-events-none select-none opacity-0"),style:{viewTransitionName:a.headlineTransitionName},children:a.headline}),y]},`${g}:${s??""}`):y,o==null?null:l("div",{"data-chat-composer-team-dock":"true",className:"mx-auto mb-2 w-full max-w-3xl",children:o}),v("div",{"data-chat-composer-stack":"true",className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:a.composerTransitionName},children:[l("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-composer",children:l("div",{ref:a.composerAnchorRef,className:"relative z-10",children:l(JA,{value:h.items.length>0,children:l(tN,{value:C,children:n})})})}),l("div",{className:"min-h-0",children:t})]}),l("div",{"data-chat-composer-dock":"true",className:"mx-auto mt-2 w-full max-w-3xl empty:hidden",children:m?.renderSlot("conversation.input.dock",{environmentId:i,threadId:f})})]}),l("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),h.overlay]})}function Kf(e,t){let o=e.trim();return o?t?.trimLeadingPattern?o.replace(t.trimLeadingPattern,"").toLowerCase():o.toLowerCase():""}function SW(e,t){if(!t)return 0;let o=0,n=-1,r=-1,a=0;for(let s=0;s<e.length;s+=1)if(e[s]===t[o]&&(n===-1&&(n=s),r!==-1&&(a+=s-r-1),r=s,o+=1,o===t.length)){let i=s-n+1-t.length,d=Math.min(64,e.length-t.length);return n*2+a*3+i+d}return null}function NC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function kW(e,t,o){let n=null;for(let r of o){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let s=a+r.length;(n===null||s<n)&&(n=s)}return n}function On(e){let{value:t,query:o}=e;if(!t||!o)return null;if(t===o)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(o))return e.prefixBase+NC(t,o);if(e.boundaryBase!==void 0){let n=kW(t,o,e.boundaryMarkers??[" ","-","_","/"]);if(n!==null)return e.boundaryBase+n*2+NC(t,o)}if(e.includesBase!==void 0){let n=t.indexOf(o);if(n!==-1)return e.includesBase+n*2+NC(t,o)}if(e.fuzzyBase!==void 0){let n=SW(t,o);if(n!==null)return e.fuzzyBase+n}return null}function LW(e,t){let o=e.score-t.score;return o!==0?o:e.tieBreaker.localeCompare(t.tieBreaker)}function PW(e,t){let o=0,n=e.length;for(;o<n;){let r=o+Math.floor((n-o)/2),a=e[r];if(!a)break;LW(t,a)<0?n=r:o=r+1}return o}function aN(e,t,o){if(o<=0)return;let n=PW(e,t);if(e.length<o){e.splice(n,0,t);return}n>=o||(e.splice(n,0,t),e.pop())}var Xc=(e,t,o=0)=>On({value:e.toLowerCase(),query:t,exactBase:o,prefixBase:o+2,boundaryBase:o+4,includesBase:o+6,...o<20?{fuzzyBase:o+100}:{},boundaryMarkers:[" ","-","_","/"]});function RW(e,t,o=[]){let n=t.trim().replace(/^\/+/,"").toLowerCase();return n?e.flatMap(r=>{let a=r.type==="slash-command"?r.command:r.type==="skill"?r.skill.name:r.command.name,s=r.type==="skill"&&n.startsWith("skill:")?n.slice(6):n,i=[Xc(a,s),Xc(r.description,s,20)];r.type==="skill"&&(i.push(Xc(r.skill.displayName??r.skill.name.replace(/[-_]/g," "),s,1)),i.push(Xc(r.skill.description??"",s,30)),i.push(Xc(r.skill.scope??"",s,40)),"skill".startsWith(n)&&i.push(n==="skill"?0:Number.MAX_SAFE_INTEGER));let d=i.filter(u=>u!==null);if(!d.length)return[];let c=r.type==="slash-command"?0:r.type==="provider-slash-command"?1:r.type==="skill"?2:3;return[{item:r,score:Math.min(...d)-(o.includes(r.id)?1:0),key:`${c}\0${a}\0${r.id}`}]}).sort((r,a)=>r.score-a.score||r.key.localeCompare(a.key)).map(({item:r})=>r):[...e]}function EW(e,t){let o=new Map(e.map(a=>[a.id,a])),n=[...new Set(t)].flatMap(a=>{let s=o.get(a);return s?[{...s,section:"recent"}]:[]}).slice(0,3),r=new Set(n.map(a=>a.id));return[...n,...e.filter(a=>!r.has(a.id)).map(a=>({...a,section:a.type==="slash-command"?"builtIn":a.type==="skill"?"skills":a.type==="plugin-slash-command"?"plugins":"provider"}))]}function sN(e){let t=new Set(e.skills.map(a=>a.name.trim().toLowerCase())),o=new Set(e.builtIns.map(a=>a.command)),n=[...e.builtIns.map(a=>({...a,id:`slash:${a.command}`,type:"slash-command",label:`/${a.command}`})),...e.commands.filter(a=>!t.has(a.name.toLowerCase())&&!o.has(a.name)).map(a=>({id:`provider-slash-command:${e.provider}:${a.name}`,type:"provider-slash-command",provider:e.provider,command:a,label:`/${a.name}`,description:a.description??a.input?.hint??e.providerDescription})),...(e.showSkills?e.skills.filter(xr):[]).map(a=>({id:`skill:${e.provider}:${a.name}`,type:"skill",provider:e.provider,skill:a,label:`/skill:${a.name}`,description:a.shortDescription??a.description??""})),...(e.plugins??[]).map(a=>({id:`plugin-slash:${a.pluginId}:${a.name}`,type:"plugin-slash-command",pluginId:a.pluginId,command:a,label:`/${a.name}`,description:a.description??a.argumentHint??""}))];return DC(`/${e.query.trim()}`,{builtIns:e.builtIns.map(a=>a.command),skills:e.skills,commands:e.commands,plugins:e.plugins})?.kind==="ambiguous"?n.filter(a=>a.type==="plugin-slash-command"&&a.command.name===e.query.trim()):e.query.trim()?RW(n,e.query,e.recentIds):EW(n,e.recentIds??[])}function DC(e,t){let o=/^\/([^\s]+)(?:\s|$)/.exec(e)?.[1];if(!o)return null;if(t.binding?.name===o){let r=t.plugins?.find(a=>a.pluginId===t.binding.pluginId&&a.name===o);return r?{kind:"plugin",command:r}:{kind:"unavailable",binding:t.binding}}if(t.builtIns.includes(o))return{kind:"builtIn",name:o};if(t.skills.some(r=>r.name===o&&xr(r)))return{kind:"skill",name:o};if(t.commands.some(r=>r.name===o))return{kind:"provider",name:o};let n=t.plugins?.filter(r=>r.name===o)??[];return n.length===1?{kind:"plugin",command:n[0]}:n.length>1?{kind:"ambiguous",commands:n}:null}var MW=()=>[];function iN(e){let{api:t,target:o}=e,n=(t.slashCommands?.useCommands??MW)(e.environmentId,o);return t.draft.useThreadDraftSelector(o,r=>{if(n.length===0)return!1;let a=DC(r.prompt,{builtIns:["model",...e.planModeEnabled?["plan","default"]:[]],skills:e.provider?.skills??[],commands:e.provider?.slashCommands??[],plugins:n,binding:t.slashCommands?.readBinding(o)});return a?.kind==="plugin"&&a.command.kind==="action"})}function lN(e,t){let o=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(o||!t),showCollapsedPromptRow:t&&!o,hasBlocking:o}}function _C(e){return typeof e=="string"?e:`${e.environmentId}\0${e.threadId}`}var dN=(e,t)=>`${e}\0${_C(t)}`;$();var AW={"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 qf(e,t){let o=e.code===void 0?void 0:AW[e.code];return o===void 0?e.reason:t(o,{status:e.httpStatus??""})}function cN(e,t){let o=0,n=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?n+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(o+=1)}return n>0?t("attachments.retryOrRemoveFailed",{count:n}):o>0?t("attachments.stillUploading",{count:o}):null}function Wf(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}$();function uN(e,t){let o=t?.hasWideActions?780:620;return e!==null&&e<o}function pN(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function mN(e,t){let o=it().pane.useVisible(),[n,r]=q(null);fe(()=>{if(!o)return;let s=e.current;if(!s)return;let i=!0;if(typeof ResizeObserver<"u"){let u=new ResizeObserver(m=>{if(!i)return;let p=m.find(y=>y.target===s);if(!p)return;let f=window.getComputedStyle(s),g=Number.parseFloat(f.paddingLeft)||0,h=Number.parseFloat(f.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return u.observe(s),()=>{i=!1,u.disconnect()}}let d=null,c=()=>{d===null&&(d=window.requestAnimationFrame(()=>{d=null,i&&r(s.clientWidth)}))};return c(),window.addEventListener("resize",c),()=>{i=!1,window.removeEventListener("resize",c),d!==null&&window.cancelAnimationFrame(d)}},[e,o]);let a=uN(n,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&pN(n,{hasWideActions:t})}}$();function fN(e,t){let o=[],n=[];for(let r of e){let a=t(r);if(a.kind==="remote")return{paths:[],remote:!0,unavailableNames:[]};a.kind==="path"?o.push(a.path):n.push(r.name)}return{paths:o,remote:!1,unavailableNames:n}}function gN(e){let t=fN(e.folders,e.resolve);t.remote&&e.notifyError(e.t("attachments.folderRemote"));for(let o of t.unavailableNames)e.notifyError(e.t("attachments.folderPathUnavailable",{name:o}),e.t("attachments.folderPathUnavailableDetail"));for(let o of t.paths)e.insertText(`${Ls(o)} `)}var OC="ycodium:paste-as-text",hN=new TextEncoder;function yN(e,t){return e.key.toLowerCase()==="v"&&e.shiftKey&&!e.altKey&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)}function NW(e){return e.bypassAutoAttachment||!e.canAttach||e.text.length===0?"inline":e.wouldExceedInputLimit||e.text.length>=32768||hN.encode(e.text).byteLength>=32768?"attachment":"inline"}function DW(e){let t=new Set(e.map(o=>o.toLowerCase()));if(!t.has("pasted-text.txt"))return"pasted-text.txt";for(let o=2;;o+=1){let n=`pasted-text-${o}.txt`;if(!t.has(n))return n}}function _W(e){let t=Math.max(0,Math.min(e.valueLength,e.selectedLength));return e.valueLength-t+e.textLength>e.maxLength}function vN(e){let t=_W({valueLength:e.valueLength,selectedLength:e.selectedLength,textLength:e.text.length,maxLength:e.maxInputChars});if(NW({text:e.text,bypassAutoAttachment:e.bypassAutoAttachment,wouldExceedInputLimit:t,canAttach:!0})!=="attachment")return{kind:"inline"};let o=hN.encode(e.text).byteLength;return e.maxFileBytes!==null&&o>e.maxFileBytes?t?{kind:"reject",reason:"file-too-large"}:{kind:"inline"}:{kind:"fold",fileName:DW(e.existingNames),sizeBytes:o}}function CN(e,t,o){if(e.blocked)return!1;let{editor:n,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=vN({text:t,bypassAutoAttachment:o,valueLength:e.promptLength,selectedLength:n?.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),n?.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:di(s.sizeBytes),shortcut:dl(navigator.platform)?"\u2318\u21E7V":"Ctrl+Shift+V"})),!0)}$();var xN="application/x-ycodium-composer-mention";function FC(e){return e.includes(xN)}function bN(e){let t=o=>FC(o.dataTransfer.types)?(o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(o){t(o)&&e.setDragActive(!0)},onDragOver(o){t(o)&&(o.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(o){if(!t(o))return;e.setDragActive(!1);let n=o.dataTransfer.getData(xN);n.length!==0&&(e.insertMentionAtEnd(`${n} `)||e.onInsertRejected())}}}function wN({documentKey:e,insertMentionAtEnd:t,onInsertRejected:o}){let[n,r]=q(!1),a=bN({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:o}),s=i=>{if(!FC(i.dataTransfer.types))return;i.stopPropagation();let d=i.relatedTarget;d instanceof Node&&i.currentTarget.contains(d)||r(!1)};return fe(()=>{r(!1)},[e]),H(()=>{if(!n)return;let i=()=>{r(!1)};return window.addEventListener("dragend",i),()=>window.removeEventListener("dragend",i)},[n]),{isDragOverComposer:n,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:s}}$();function TN(e){let t=E(0);return H(()=>{let o=()=>{t.current=Date.now()+1e3},n=s=>{s.target instanceof Node&&e.current?.contains(s.target)&&yN(s,dl(navigator.platform))&&o()},r=()=>{t.current=0},a=()=>{let s=document.activeElement;s instanceof Node&&e.current?.contains(s)&&o()};return window.addEventListener(OC,a),window.addEventListener("keydown",n,!0),window.addEventListener("blur",r),()=>{window.removeEventListener(OC,a),window.removeEventListener("keydown",n,!0),window.removeEventListener("blur",r)}},[e]),R(()=>{let o=Date.now()<=t.current;return t.current=0,o},[])}function IN(e){let{api:t,attachments:o,t:n,addComposerImages:r,promptRef:a,promptInputRef:s,composerEditorRef:i,composerFormRef:d,composerThreadKey:c,attachmentDocumentKey:u,attachmentImagesRef:m,limits:p,supportsAttachmentUploads:f,attachmentUploadsCapabilityKnown:g,composerDocumentKey:h,isComposerApprovalState:y,pasteBlocked:x,hasPendingUserInputs:C,projectSelectionRequired:b,environmentId:L}=e,w=TN(d),k=E({documentKey:"",names:new Set}),I=(j,U)=>CN({blocked:x,editor:i.current,documentKey:u,registry:k.current,existingImageNames:m.current.map(D=>D.name),promptLength:a.current.length,maxInputChars:p.maxInputChars,maxFileBytes:!g||f?null:p.inlineAttachmentMaxBytes,t:n,notify:t.notify,addFoldedFile:D=>{r([D],{source:{_tag:"pasted-text"}})}},j,U),T=j=>{let U=Array.from(j.clipboardData.files);if(U.length>0){j.preventDefault(),r(U);return}let D=j.clipboardData.getData("text/plain");I(D,w())&&(j.preventDefault(),j.stopPropagation())},S=(j,U)=>{if(j.length===0||y||C||b)return!1;let D=a.current,J=(U?.ensureLeadingBoundary??!1)&&D.length>0&&!/\s$/.test(D);return s.current?.applyPromptReplacement(D.length,D.length,J?` ${j}`:j)??!1},P=$e(c,null,{namespace:Xu});P.current=j=>{if(y||C||b)return!1;let U=a.current,D=Math.max(0,Math.min(U.length,s.current?.readSnapshot().expandedCursor??U.length)),J=U.slice(0,D),G=U.slice(D),M=`${J.length>0&&!/\s$/.test(J)?" ":""}${j}${/^\s/.test(G)?"":" "}`;return s.current?.applyPromptReplacement(D,D,M)??!1};let{isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}=wN({documentKey:h,insertMentionAtEnd:j=>S(j,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{t.notify.error(n("composer.unableToAddToChat"),n("composer.composerBusy"))}});return{onComposerPaste:T,insertComposerTextAtEnd:S,addDroppedFolders:j=>{gN({folders:j,resolve:U=>o.resolveDroppedFolder({environmentId:L,folder:U}),t:n,notifyError:(U,D)=>t.notify.error(U,D),insertText:U=>S(U,{ensureLeadingBoundary:!0})})},isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}}$();function SN(e){let{api:t,t:o,limits:n,promptRef:r,promptInputRef:a,composerEditorRef:s,composerImagesRef:i,composerDraftTarget:d,setComposerDraftPrompt:c,addComposerDraftImages:u,clearComposerDraftPromptAndImages:m,setIsStashMenuOpen:p,setStashPulse:f,isComposerCollapsedMobile:g,expandMobileComposer:h,keybindings:y,terminalOpen:x,isComposerModelPickerOpen:C,hasPendingUserInputs:b,isComposerApprovalState:L,projectSelectionRequired:w,answeringQuestion:k}=e,I=E(0),T=E(null),S=E(new Set),P=t.stash.useStore,A=P(F=>F.entries),N=P(F=>F.stashEntry),B=P(F=>F.takeEntry),O=P(F=>F.finalizeEntryImages);H(()=>()=>{T.current!==null&&window.clearTimeout(T.current)},[]);let j=R(()=>{I.current+=1,f({key:I.current,active:!0}),T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{T.current=null,f(F=>({...F,active:!1}))},1200)},[]),U=R(F=>{let{entry:ee,durable:Y}=B(F.id);if(!ee)return;Y||t.notify.warning(o("composer.stashReappear"),o("composer.storageRejectedKeep")),p(!1);let ae=r.current,te=F.prompt.length===0?ae:ae.trim().length?`${ae.replace(/\s+$/,"")}
|
|
3588
3570
|
|
|
3589
|
-
${F.prompt}`:F.prompt,le=te!==ne;if(le&&(r.current=te,c(d,te),a.current?.syncCursor(uo(te,te.length),null)),F.attachments.length>0){let re=new Set(i.current.map(Ne=>Ne.id)),ee=new Set(i.current.map(Ne=>`${Ne.mimeType}\0${Ne.sizeBytes}\0${Ne.name}`)),ve=F.attachments.filter(Ne=>!re.has(Ne.id)&&!ee.has(`${Ne.mimeType}\0${Ne.sizeBytes}\0${Ne.name}`)),he=t.draft.hydrateImagesFromPersisted(ve);he.length>0&&u(d,he)}let ge=[];F.droppedImageNames.length>0&&ge.push(o("composer.stashImagesTooLarge",{names:F.droppedImageNames.join(", ")})),F.unreadableImageNames&&F.unreadableImageNames.length>0&&ge.push(o("composer.stashImagesUnreadable",{names:F.unreadableImageNames.join(", ")})),ge.length>0&&t.notify.warning(o("composer.someImagesNotRestored"),ge.join(" ")),le&&window.requestAnimationFrame(()=>{s.current?.focusAtEnd()})},[u,d,i,r,c,o,B]),D=P(F=>{let{durable:Z}=B(F.id);Z||t.notify.warning(o("composer.stashEntryMayReturn"),o("composer.storageRejectedDelete"))},[o,B]),X=P(async()=>{let F=r.current.split(gr).join("").trim(),Z=[...i.current];if(F.length===0&&Z.length===0){p(le=>!le);return}let J=`${BC(d)}\0${F}\0${Z.map(le=>le.id).join(",")}`;if(S.current.has(J))return;S.current.add(J);let ne=d,te=_s();try{let{evicted:le,written:ge,durable:re}=N({id:te,createdAt:new Date().toISOString(),prompt:F,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:Z.length});if(!ge){t.notify.error(o("composer.couldNotStash"),o("composer.storageRejectedWrite"));return}re||t.notify.warning(o("composer.stashNotSurvive"),o("composer.storageUnavailableMemory")),r.current="",m(ne);for(let me of Z)t.uploads.release(me.id);a.current?.syncCursor(0,null),V(),le&&t.notify.warning(o("composer.oldestStashDiscarded"),o("composer.oldestStashDiscardedDetail",{count:t.stash.maxEntries}));let ee=[],ve=[],he=[];for(let me of Z){let Ae=await t.imageCompression.compressForStash(me.file);if(!Ae.ok){(Ae.reason==="too-large"?ve:he).push(me.name);continue}ee.push({id:me.id,name:me.name,mimeType:Ae.image.mimeType,sizeBytes:Ae.image.sizeBytes,dataUrl:Ae.image.dataUrl})}let{kept:Ne,droppedNames:De}=t.stash.partitionAttachments(ee),{attached:je,durable:nt}=O(te,{attachments:Ne,droppedImageNames:[...ve,...De],unreadableImageNames:he});je?!nt&&re&&Z.length>0&&t.notify.warning(o("composer.stashImagesNotSaved"),o("composer.stashImagesMissingOnReload")):Ne.length>0&&t.notify.warning(o("composer.stashImagesDidNotAttach"),o("composer.stashImagesDidNotAttachDetail",{count:Ne.length}))}finally{S.current.delete(J)}},[m,d,i,O,r,V,N,o]),j=P(()=>{p(F=>!F)},[]),E=P(()=>{if(g){h(),p(!0);return}j()},[h,g,j]),Y=P(()=>{p(!1)},[]);return t.pane.useKeydown(F=>{if(t.keybindings.resolveShortcutCommand(F,y,{context:{terminalFocus:t.terminalFocus.getOwner()!==null,terminalOpen:x,modelPickerOpen:C}})==="composer.stash"&&(F.preventDefault(),F.stopPropagation(),!t.commandPalette.isOpen())){if(b&&!L){p(J=>!J);return}L||w||k||X()}},{capture:!0}),{stashQueue:A,restoreStashEntry:U,deleteStashEntry:D,toggleStashMenu:j,toggleInlineStashMenu:E,closeStashMenu:Y}}$();function EW(e,t,o){return{...Gg({id:_s(),name:t.name||e.t("attachments.defaultFileName"),mimeType:t.type||"application/octet-stream",sizeBytes:t.size,...o?{source:o}:{}}),previewUrl:URL.createObjectURL(t),file:t}}async function CN(e,t,o){let{t:n,supportsAttachmentUploads:r,inlineAttachmentMaxBytes:a}=e;if(!e.activeThreadId||t.length===0)return;if(e.answerQuestionsFirst){e.notifyError(n("attachments.answerQuestionsFirst"));return}let s=e.activeThreadId,i=e.attachmentDocumentKey,d=e.pendingCompressions,c=d.get(i)??0,u=[],m=null;for(let p of t){if(p.size<=0){m=n("attachments.empty",{name:p.name});continue}u.push(p)}if(e.setThreadError(s,m),u.length!==0){d.set(i,c+u.length);try{let p=[],f=null;for(let g of u){let h=await e.imageCompression.prepareFileForAttachment(g,e.attachmentUploadsCapabilityKnown&&!r?a:Number.POSITIVE_INFINITY);if(!h.ok){let x=e.imageCompression.attachmentPreparationError(h,g.name);f=n(x.key,x.values);continue}if(h.kind!=="image"){p.push(EW(e,h.file,h.kind==="file"?o?.source:void 0));continue}let y=h.file;p.push({...Gg({id:_s(),name:y.name||n("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),f!==null&&e.setThreadError(s,f)}finally{let p=(d.get(i)??0)-u.length;p>0?d.set(i,p):d.delete(i)}}}function xN(e){let{api:t,t:o,limits:n,setThreadError:r,activeThreadId:a,answerQuestionsFirst:s,attachmentTarget:i,attachmentDocumentKey:d,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,pendingImageCompressionsRef:m,addComposerDraftImage:p,addComposerDraftImages:f,removeComposerDraftImage:g}=e,h=P(w=>{p(i,w)},[i,p]),y=P(w=>{f(i,w)},[i,f]),x=P(w=>{t.uploads.release(w),g(i,w)},[t.uploads,i,g]),C=(w,k)=>CN({activeThreadId:a,answerQuestionsFirst:s,notifyError:I=>t.notify.error(I),t:o,setThreadError:r,attachmentDocumentKey:d,pendingCompressions:m.current,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,inlineAttachmentMaxBytes:n.inlineAttachmentMaxBytes,imageCompression:t.imageCompression,addImage:h,addImages:y},w,k);return{addComposerImages:C,removeComposerImage:w=>{x(w)},onComposerAttachmentInputChange:w=>{let k=Array.from(w.target.files??[]);w.target.value="",k.length!==0&&C(k)}}}$();var bN=e=>({images:e.images,nonPersistedImageIds:e.nonPersistedImageIds});function MW(e){let{supported:t,attachments:o,environmentId:n,threadId:r,requestId:a,question:s,responding:i}=e,d=s?.id,c=s?.allowFreeform;return W(()=>t&&a!==null&&d!==void 0&&c!==!1&&!i&&r?o.questionDraftTarget({environmentId:n,threadId:r,requestId:a,questionId:d}):null,[c,o,n,d,a,i,t,r])}function wN(e){let t=MW(e),o=t??e.composerDraftTarget,n=t?[e.environmentId,e.composerDraftTarget,"question",t].join("\0"):[e.environmentId,e.composerDraftTarget].join("\0");return{questionAttachmentTarget:t,attachmentTarget:o,attachmentDocumentKey:n}}$();function TN(e,t){let o=Un.indexOf(e);if(o===-1)return Un[0];let n=(o+t+Un.length)%Un.length;return Un[n]??Un[0]}function IN(e){let{composerRef:t,sendContextRef:o,api:n,t:r,limits:a,composerData:s,refs:i,composerDraftTarget:d,activeThread:c,addComposerImages:u,addDroppedFolders:m,focusComposer:p,insertComposerTextAtEnd:f,insertComposerDraftTerminalContext:g,composerBrowserAnnotations:h,composerReviewComments:y,isComposerApprovalState:x,pendingUserInputCount:C,projectSelectionRequired:b,noProviderAvailable:L,modelState:w,handleRuntimeModeChange:k,runtimeMode:I,setIsComposerModelPickerOpen:T,setProviderInputSubmissionError:S}=e,{composerEditorRef:R,promptInputRef:A,promptRef:N,composerImagesRef:B,composerTerminalContextsRef:O,composerElementContextsRef:V}=i,{selectedModel:U,selectedModelOptionsForDispatch:D,selectedModelSelection:X,selectedModelStatus:j,selectedNativeModeId:E,selectedProvider:Y,selectedProviderEntry:F,selectedProviderModels:Z,composerNativeMode:J,canSwitchNativeMode:ne,handleComposerNativeModeChange:te}=w,le=P(()=>A.current?.readSnapshot()??{value:N.current,cursor:uo(N.current,N.current.length),expandedCursor:N.current.length,terminalContextIds:O.current.map(re=>re.id)},[O,N]),ge=()=>({prompt:N.current,slashSources:{builtIns:["model",...w.planModeUiEnabled?["plan","default"]:[]],skills:w.selectedProviderStatus?.skills??[],commands:w.selectedProviderStatus?.slashCommands??[]},images:B.current,terminalContexts:O.current,elementContexts:V.current,browserAnnotations:h,reviewComments:y,selectedModelOptionsForDispatch:D,selectedModelSelection:X,...E?{selectedNativeModeId:E}:{},providerAvailable:F!==void 0,selectedProvider:Y,selectedModel:U,selectedModelStatus:j,selectedProviderModels:Z});o.current=ge,fr(t,()=>({focusAtEnd:()=>{R.current?.focusAtEnd()},focusAt:ee=>{R.current?.focusAt(ee)},addDroppedFiles:ee=>{u(ee),p()},addDroppedFolders:ee=>{m(ee),p()},insertTextAtEnd:f,toggleModelPicker:()=>{T(ee=>!ee)},cyclePermissionMode:ee=>{if(J===null){k(TN(I,ee));return}let{modes:ve,current:he}=J;if(!ne||ve.length<2)return;let Ne=ve.findIndex(je=>je.id===he.id),De=ve[(Ne+ee+ve.length)%ve.length];De!==void 0&&te(De.id)},readSnapshot:le,resetCursorState:ee=>{A.current?.resetCursorState(ee)},addTerminalContext:ee=>{if(!c)return;let ve=le(),he=n.terminalContext.insertInlinePlaceholder(ve.value,ve.expandedCursor),Ne=uo(he.prompt,he.cursor);g(d,he.prompt,{id:_s(),threadId:c.id,createdAt:new Date().toISOString(),...ee},he.contextIndex)&&(N.current=he.prompt,A.current?.syncCursor(Ne,Eo(he.prompt,he.cursor)),window.requestAnimationFrame(()=>{R.current?.focusAt(Ne)}))},readSendIdentity:()=>({prompt:N.current}),getSendContext:ge,validateProviderInput:ee=>{let ve=EC({prompt:N.current,providerInput:s.assistantQuotes.expandForProvider(ee),submissionTarget:"provider-turn",maxInputChars:a.maxInputChars,t:r});return S(ve),ve===null}}),[c,u,d,g,N,B,O,V,h,y,p,x,C,b,le,U,D,X,E,L,Y,Z,s,ge,o,a.maxInputChars,J,ne,te,k,I,r])}$();function SN(e){let{composerImages:t,composerImagesRef:o,composerTerminalContexts:n,composerTerminalContextsRef:r,composerElementContexts:a,composerElementContextsRef:s}=e;fe(()=>{o.current=t},[t,o]),fe(()=>{r.current=n},[n,r]),fe(()=>{s.current=a},[a,s])}$();var AW=['[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 NW(e){return e.closest(AW)!==null}function kN(e){let{isMobileViewport:t,forceExpandedOnMobile:o,composerEditorRef:n,composerSurfaceRef:r,composerFormRef:a}=e,[s,i]=q(!1),d=t&&!o&&!s,c=M(null),u=M(null),m=M(null),p=M(!1),f=P(()=>{if(!t)return;c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null);let x=document.activeElement;x instanceof HTMLElement&&x.blur(),i(!1)},[t]),g=P(()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current),p.current=!0,i(!0),u.current=window.requestAnimationFrame(()=>{u.current=null,n.current?.focusAtEnd(),m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1})})},[]),h=P(()=>{t&&(p.current||(c.current!==null&&window.cancelAnimationFrame(c.current),c.current=window.requestAnimationFrame(()=>{if(c.current=null,p.current)return;let x=r.current,C=a.current,b=document.activeElement;b instanceof Element&&NW(b)||b instanceof Node&&(x&&x.contains(b)||C&&C.contains(b))||i(!1)})))},[t]);return H(()=>()=>{c.current!==null&&window.cancelAnimationFrame(c.current),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current)},[]),{isComposerCollapsedMobile:d,blurMobileComposerAfterSend:f,expandMobileComposer:g,scheduleComposerCollapseCheck:h,handleFormFocusCapture:x=>{let C=x.target;d&&C instanceof HTMLElement&&C.closest('[data-chat-composer-collapsed-controls="true"]')||(c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),i(!0))}}}$();function LN(e){let{t,threadId:o,setThreadError:n,promptRef:r,promptInputRef:a,respondToApproval:s,respondToDecision:i,selectUserInputOption:d,activePendingProgress:c,activePendingIsResponding:u,activePendingResolvedAnswers:m}=e,p=W(()=>c?{questionIndex:c.questionIndex,isLastQuestion:c.isLastQuestion,canAdvance:c.canAdvance,isResponding:u,isComplete:!!m}:null,[u,c,m]),f=P((y,x)=>{d(y,x),r.current="",a.current?.resetCursorState({cursor:0})},[r,d]),g=P(async(y,x,C)=>{try{await s(y,x,C)}catch(b){n(o,b instanceof Error?b.message:t("approval.respondFailed"))}},[o,s,n,t]),h=P((y,x)=>i(y,x).then(C=>{C!==null&&n(o,C)}),[o,i,n]);return{pendingPrimaryAction:p,onSelectActivePendingUserInputOption:f,onRespondToApproval:g,onRespondToComposerDecision:h}}$();function RN(e){return e.startsWith("!")}function PN(e){return e.slice(1).trim()}function EN(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function DW(){return null}function MN(){let{data:e,target:t,threadKey:o}=zo();return(e.useShellCommand??DW)({target:t,threadKey:o})}$();function Jf(e){return e.activeThreadId!==null&&!e.isLocalDraftThread&&!e.isComposerApprovalState&&!e.hasPendingProgress&&!e.hasPendingAction&&!e.shellCommandMode}function Zf(e,t,o){return e&&t!==void 0?t:o}function eg(e){let t=e.environmentUnavailable?e.labels.environmentDisconnected:e.projectSelectionRequired?e.labels.chooseProjectToStart:e.pluginAction?null:e.noProviderAvailable&&!e.groupSend?e.labels.enableProviderToSend:Zf(e.groupSend,e.groupSendDisabledReason,e.sendDisabledReason);return{disabled:t!==null,reason:t}}function AN({promptRef:e,maxInputChars:t,noProviderAvailable:o,sendDisabledReason:n,groupSendDisabledReason:r,isGroupSend:a,isModelSendBlocked:s,onModelSendBlocked:i,onDispatched:d,activeThreadId:c,activePendingProgress:u,composerDocumentKey:m,pendingImageCompressionsRef:p,onSend:f,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:y}){let{t:x}=z(),[C,b]=q(null),[L,w]=q(!1),k=M(0);H(()=>{k.current+=1,b(null),w(!1)},[m]),H(()=>{n===null&&w(!1)},[n]);let I=P(S=>{b(R=>R===null?R:Qc(S,t,x))},[t,x]),T=P((S,R="foreground")=>{let A=a();if(o&&!A){S?.preventDefault();return}if(Zf(A,r,n)!==null){S?.preventDefault(),w(!0);return}if(s&&!A){S?.preventDefault(),i();return}if(c&&(p.current.get(m)??0)>0){S?.preventDefault(),g();return}let B=k.current,O=SA({prompt:e.current,submissionTarget:u?"pending-user-input":"provider-turn",maxInputChars:t,t:x,event:S,onSend:U=>f(U,R)}),V=U=>{B===k.current&&(b(U.validationMessage),U.didDispatch&&(d(),h()&&y()))};if(IA(O))return O.then(V);V(O)},[u,c,y,m,s,a,r,t,o,i,d,f,g,p,e,n,h,x]);return{composerSubmissionError:C??(L?Zf(a(),r,n):null),setComposerSubmissionError:b,revalidatePromptLength:I,submitComposer:T}}function NN(e){let{api:t,t:o,limits:n,composerDraftTarget:r,composerDraft:a,composerDocumentKey:s,promptRef:i,promptInputRef:d,pendingImageCompressionsRef:c,setComposerDraftPrompt:u,setModelSendBlockShown:m,onSend:p,onCompactContext:f,blurMobileComposerAfterSend:g,isMobileViewport:h,isComposerApprovalState:y,activePendingApproval:x,activePendingProgress:C,activePendingResolvedAnswers:b,pendingUserInputCount:L,activeThreadId:w,phase:k,isSendBusy:I,environmentUnavailable:T,compactDisabled:S,noProviderAvailable:R,isSendDisabled:A,sendDisabledReason:N,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:V,showPlanFollowUpPrompt:U}=e,D=!e.pluginAction&&R,X=!e.pluginAction&&A,j=e.pluginAction?null:N,E=!e.pluginAction&&V,Y=MN(),F=t.draft.useThreadDraftSelector(r,De=>RN(De.prompt)),Z=Y!==null&&F&&!y&&C===null,J=P(()=>!h||I||X||D||T!==null||k==="running"?!1:C?C.isLastQuestion&&!!b:U||a.hasSendableContent,[C,b,a.hasSendableContent,T,h,I,X,D,k,U]),{composerSubmissionError:ne,setComposerSubmissionError:te,revalidatePromptLength:le,submitComposer:ge}=AN({promptRef:i,maxInputChars:n.maxInputChars,noProviderAvailable:D,sendDisabledReason:j,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:E,onModelSendBlocked:()=>{m(!0)},onDispatched:()=>{m(!1)},activeThreadId:w,activePendingProgress:C,composerDocumentKey:s,pendingImageCompressionsRef:c,onSend:p,onStillCompressing:()=>{t.notify.info(o("composer.stillCompressing"),o("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:J,blurMobileComposerAfterSend:g}),re=M(!1),ee=P(De=>{if(De?.preventDefault(),Y===null||re.current)return;if(Y.unavailableReason!==null){te(Y.unavailableReason);return}let je=i.current,nt=PN(je),me=EN(nt);if(me==="empty")return;if(me==="multiline"){te(o("composer.shellCommand.singleLine"));return}te(null),re.current=!0;let Ae=r;Y.run(nt).then(ue=>{!ue||i.current!==je||(i.current="",u(Ae,""),d.current?.syncCursor(0,null))}).finally(()=>{re.current=!1})},[r,Y,i,u,te,o]),ve=P((De,je)=>{if(Z){ee(De);return}ge(De,je)},[ee,Z,ge]),he=P(()=>{if(!Z)return!1;let De=i.current.slice(1);return i.current=De,u(r,De),d.current?.resetCursorState({prompt:De,cursor:De.length}),!0},[r,i,u,Z]),Ne=P(()=>{S||D||x!==null||L>0||k==="running"||I||!w||f()},[x,w,S,I,D,f,L,k]);return{composerSubmissionError:ne,revalidatePromptLength:le,submitComposerOrShellCommand:ve,exitShellCommandMode:he,compactThreadContext:Ne,hostShellCommand:Y,shellCommandMode:Z}}$();function $C(){let e=lt(),{data:t,target:o}=zo(),n=e.draft.useThreadDraftSelector(o,a=>a.prompt),r=t.memberMentions?.useMatches({target:o,text:n.trim()});return r===void 0||r.status==="ready"&&r.matches.length===0?"unsupported":r.status}function _W(){return $C()==="ready"}function tg(e){let t=_W();return e&&t}function DN(e){return P(()=>Jf({activeThreadId:e.activeThreadId,isLocalDraftThread:e.isLocalDraftThread,isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.hasPendingProgress,hasPendingAction:e.hasPendingAction,shellCommandMode:!1})&&(e.memberMentions?.collect(e.target,e.promptRef.current.trim()).length??0)>0,[e.activeThreadId,e.isLocalDraftThread,e.isComposerApprovalState,e.hasPendingProgress,e.hasPendingAction,e.memberMentions,e.target,e.promptRef])}$();$();var og=pe(function(t){let{t:o}=z();if(t.count===0)return null;let n=t.placement==="inline",r=l("span",{className:G("text-ui-2xs font-medium 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 n?v(K,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:G("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:[l(Gs,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):v("button",{type:"button","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:G("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-[var(--control-cursor)] 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:[l(Gs,{className:"size-3 shrink-0","aria-hidden":"true"}),o("stash.label"),r]})});$();function ON(e){let t=new Map;return e.map(o=>{let n=t.get(o.step)??0;return t.set(o.step,n+1),{key:`${o.step}:${n}`,step:o}})}function _N({className:e,steps:t}){return t.length<=1?null:l("span",{"aria-hidden":!0,className:G("flex w-10 shrink-0 items-center gap-0.5",e),children:ON(t).map(({key:o,step:n})=>l("span",{className:G("h-[3px] min-w-0 flex-1 rounded-full",n.status==="completed"?"bg-success":n.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},o))})}var ng=pe(function({expanded:t,hasTrailingShoulder:o=!1,onDismiss:n,onToggle:r,placement:a="tab",progress:s,steps:i}){let{t:d}=z();if(s.totalSteps<=0)return null;let c=s.completedSteps>=s.totalSteps,u=d("tasksBadge.ariaLabel",{completed:s.completedSteps,total:s.totalSteps,step:s.step});return a==="inline"?v("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[v(K,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":u,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(qa,{"aria-hidden":!0,className:"size-3 shrink-0"}),l("span",{children:d("tasksBadge.label")}),l(_N,{steps:i}),v("span",{className:G("font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(ot,{"aria-hidden":!0,className:"size-2.5"})})]}):v("div",{className:G("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",o?"right-28":"right-4",c&&"text-foreground"),"data-composer-tasks-badge":"true",children:[v("button",{type:"button","aria-expanded":t,"aria-label":u,className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(qa,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"shrink-0",children:d("tasksBadge.label")}),l("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:s.step}),v("span",{className:G("shrink-0 font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]}),l(_N,{className:"w-20",steps:i})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(ot,{"aria-hidden":!0,className:"size-3"})})]})}),FN=pe(function({onDismiss:t,onCollapse:o,progress:n,steps:r}){let{t:a}=z(),{formatDuration:s}=Bo();return v("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[v("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[v("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:o,onPointerDown:i=>i.preventDefault(),children:[l(qa,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),v("span",{className:"tabular-nums",children:[n.completedSteps,"/",n.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:l(ot,{"aria-hidden":!0,className:"size-3"})})]}),l("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:ON(r).map(({key:i,step:d})=>v("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[l("span",{"aria-hidden":!0,className:G("w-3 shrink-0 text-center font-mono text-ui-2xs",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:G("min-w-0 flex-1",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step}),l("span",{className:"ml-auto w-10 shrink-0 text-right text-ui-2xs text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:d.durationMs!==void 0?s(d.durationMs):d.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function BN(e){let{activeThreadId:t,activeThread:o,activeTasksProgress:n,activeTaskSteps:r,isTasksDrawerOpen:a,setIsTasksDrawerOpen:s,dismissedTasksTurnId:i,setDismissedTasksTurnId:d,stashQueue:c,isStashMenuOpen:u,stashPulse:m,toggleInlineStashMenu:p,isComposerApprovalState:f,externalDrawerAttached:g,showComposerTopDrawer:h,isComposerCollapsedMobile:y,hasBlockingComposerTopDrawer:x}=e,C=P(()=>{s(O=>!O)},[]),b=o?.latestTurn?.turnId??null,L=b!==null&&i===b,w=L?null:n,k=L?null:r,I=P(()=>{b!==null&&d(b),s(!1)},[b]),S=c.length>0&&!f&&(g||h||a||y)?l(og,{count:c.length,menuOpen:u,placement:"inline",pulseKey:m.key,pulsing:m.active,onToggleMenu:p}):null,A=w!==null&&k!==null&&!a&&!x&&(g||h||y)?l(ng,{expanded:!1,onDismiss:I,onToggle:C,placement:"inline",progress:w,steps:k}):null,N=!g&&!h&&!a&&!y,B=N&&(c.length>0||w!==null&&k!==null&&w.totalSteps>0);return H(()=>{(w===null||k===null)&&s(!1)},[k,w]),H(()=>{x&&s(!1)},[x]),H(()=>{s(!1)},[t]),{toggleTasksDrawer:C,dismissTasks:I,visibleTasksProgress:w,visibleTaskSteps:k,inlineStashBadge:S,inlineTasksBadge:A,showShoulderTabs:N,hasShoulderTab:B}}$();function HN(e,t){if(!e)return null;let o=t.get(e.instanceId)?.find(n=>n.slug===e.model);return o?ST(o):e.model}function UN(e,t,o){return typeof o=="number"&&o>0?e("contextWindow.compactsAtThreshold",{threshold:o.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}$();function zC(e,t){if(!e)return t("composer.agentPickerLabel");let o=e.agentName?.trim(),n=e.displayName.trim();return o?!n||n===o?o:`${o} (${n})`:n}function KC(e,t){return e.filter(o=>Od(o)&&wp(o,t))}var qC=pe(function(t){let{t:o}=z(),n=t.instanceEntries.filter(Od),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(h=>h.instanceId===r)??null,s=t.notChosen===!0&&r===null,i=r!==null||s?null:n.find(h=>h.instanceId===t.activeInstanceId)??null,d=t.lockedProvider!=null&&t.lockedProvider.length>0,c=KC(t.instanceEntries,t),u=c.some(h=>h.instanceId!==t.activeInstanceId),m=t.disabled||!d?null:r!==null?c.length===0?o("composer.agentUnavailableNoChoice"):null:u?null:o("composer.agentSwitchUnavailable"),p=ho(),f=G("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink"),g=v(oe,{children:[r!==null?l(Dt,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):s?null:i?l(Ys,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?v("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?o("composer.agentUnknown"):zC(a,o)," ",o("composer.agentUnavailableBadge")]}):s?l("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:o("composer.agentChoosePlaceholder")}):l("span",{className:"min-w-0 truncate",children:zC(i,o)})]});return m!==null?v(Re,{children:[v(Ee,{render:l(Yn,{"aria-label":o("composer.agentPickerLabel"),"aria-describedby":p,"data-composer-agent-picker":"true",softDisabled:!0,className:f}),children:[g,l("span",{id:p,className:"sr-only",children:m})]}),l(Pe,{side:"top",align:"start",className:"max-w-80 leading-snug",children:m})]}):v(_o,{children:[v(Fo,{render:l(Yn,{"aria-label":o("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||c.length===0,className:f}),children:[g,l(_u,{})]}),l(Oo,{align:"start",children:l(ea,{value:r!==null||s?"":t.activeInstanceId,onValueChange:h=>{!h||r===null&&!s&&h===t.activeInstanceId||t.onInstanceChange(h)},children:c.map(h=>l(er,{value:h.instanceId,children:v("span",{className:"flex min-w-0 items-center gap-2",children:[l(Ys,{driver:h.driverKind,displayName:h.displayName,accentColor:h.accentColor,className:"size-4",iconClassName:"size-4"}),l("span",{className:"min-w-0 truncate",children:zC(h,o)})]})},h.instanceId))})})]})});function $N(e){return l(qC,{...e})}function zN(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function KN(e){if(!e.blockedOnSend||e.submissionTarget!=="provider-turn")return null;switch(e.status){case"probing":return{blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{blockKey:"composer.modelMissing",canChooseModel:!0};case"unavailable":return{blockKey:"composer.modelUnavailable",canChooseModel:!0};default:return{blockKey:"composer.modelReady",canChooseModel:!1}}}function qN(e){return(e?.hints??[]).filter(t=>t.kind==="model-replaced"||t.kind==="option-unsupported"||t.kind==="effort-moved")}function WC(e,t){if(typeof t=="boolean")return e(t?"traits.on":"traits.off");if(t===void 0)return"";let o=ET(t);return o===void 0?t:e(`traits.optionValue.${o}`)}function WN(e,t){switch(t.kind){case"model-replaced":return t.to===null?e("modelNote.replacedNoDefault",{from:t.from}):e("modelNote.replaced",{from:t.from,to:t.to});case"option-unsupported":return e("modelNote.optionUnsupported",{option:NT(e,t.optionId),value:WC(e,t.stored)});case"effort-moved":return e("modelNote.effortMoved",{from:WC(e,t.from),to:WC(e,t.to)})}}function GN(e){if(e===null||"blocked"in e.dispatch)return;let t=e.dispatch.options;return t.length>0?t:void 0}$();function jN(e){let{threadId:t,isLocalDraftThread:o,selection:n,selectionsEqual:r,onChosen:a}=e,s=M(null);H(()=>{let i=s.current,d=n.model.trim()===""?null:n;if(i===null||i.threadId!==t){s.current={threadId:t,selection:d};return}d!==null&&(s.current={threadId:t,selection:d},!(o||i.selection===null)&&(r(i.selection,d)||a?.(d)))},[t,o,n,r,a])}$();function VN(e){let{api:t,providerStatus:o,instanceId:n,environmentId:r,cwd:a,threadId:s}=e,i=t.providerInventory.useWorkspaceInventory({environmentId:r,instanceId:n,cwd:a,threadId:s});return W(()=>o===null||i===null?o:{...o,slashCommands:i.slashCommands,skills:i.skills},[o,i])}function QN(e){let{api:t,t:o,settings:n,composerDraft:r,composerDraftTarget:a,environmentId:s,gitCwd:i,routeKind:d,threadId:c,activeThread:u,isLocalDraftThread:m,unavailableAgentInstanceId:p,agentNotChosen:f,runtimeMode:g,lockedProvider:h,providerStatuses:y,projectId:x,activeProjectDefaultModelSelection:C,activeThreadModelSelection:b,actualModel:L,compactDisabledReason:w,externalSendDisabledReason:k,attachmentBlockReason:I,answeringQuestion:T,setComposerDraftNativeMode:S,handleNativeModeChange:R,onProviderInstanceSelect:A,onModelSelectionChosen:N}=e,B=W(()=>AT(t.model.applyInstanceSettings(t.model.deriveInstanceEntries(y),n)),[t.model,y,n]),O=r.activeProvider??null,V=u?.session?.providerInstanceId??b?.instanceId??C?.instanceId??null,D=MT(B,O??V)??t.model.makeDriverKind("unconfigured"),X=h??D,j=W(()=>{if(!h||!u)return null;let tt=u.session?.providerInstanceId??b?.instanceId;return tt?B.find(It=>It.instanceId===tt)?.continuationGroupKey??null:null},[u,b?.instanceId,h,B]),E=W(()=>{if(p!==null)return p;let tt=[r.activeProvider,u?.session?.providerInstanceId,b?.instanceId,C?.instanceId];for(let It of tt){if(!It)continue;let po=B.find(jo=>jo.instanceId===It&&Od(jo));if(po&&wp(po,{lockedProvider:h,lockedContinuationGroupKey:j}))return po.instanceId}return t.model.noProviderSelection.instanceId},[C?.instanceId,u?.session?.providerInstanceId,b?.instanceId,r.activeProvider,j,h,B,p]),Y=p!==null,F=W(()=>Y||f?void 0:B.find(tt=>tt.instanceId===E),[f,Y,B,E]),Z=F===void 0&&!Y&&!f,J=Y&&KC(B,{lockedProvider:h,lockedContinuationGroupKey:j}).length===0,ne=w??(Z?o("composer.compactingUnavailable"):null),te=F?.driverKind??X,{modelOptions:le,selectedModel:ge,selectedModelStatus:re,choice:ee}=t.draft.useEffectiveModelState({threadRef:a,providers:y,selectedProvider:te,selectedInstanceId:E,threadModelSelection:b,projectModelSelection:C,settings:n,purpose:m?"create":"display",actualModel:L}),ve=W(()=>F?.snapshot??null,[F]),he=VN({api:t,providerStatus:ve,instanceId:F?.instanceId??null,environmentId:s,cwd:i,threadId:d==="server"?c:null}),Ne=W(()=>F?.models??[],[F]),De=W(()=>GN(ee),[ee]),je=W(()=>qN(ee),[ee]),nt=ee?.selected.kind==="model"&&ee.selected.unconfirmed,me=n.planModeEnabled,Ae=W(()=>({showInteractionModeToggle:me&&t.model.getInteractionModeToggle(y,te),runtimeModeSwitch:he?.runtimeModeSwitch??"next-turn"}),[me,y,te,he]),ue=he?.supportsNativeModeSwitch===!0,ce=m&&ue?r.nativeModeByProvider?.[E]??null:null,Ze=W(()=>t.model.resolveNativeMode(he,{runtimeMode:g,nativeModeId:m?ce:u?.nativeModeId??null}),[t.model,u?.nativeModeId,he,g,m,ce]),pt=ce&&Ze?.current.id===ce?ce:void 0,ze=P(tt=>{m&&S(a,E,tt),R(tt)},[m,S,a,E,R]),et=W(()=>t.model.createSelection(E,ge,De),[t.model,E,ge,De]);jN({threadId:u?.id??null,isLocalDraftThread:m,selection:et,selectionsEqual:t.model.selectionsEqual,onChosen:Y||f?void 0:N});let Et=P(tt=>A(tt,et),[A,et]),ft=ee?.selected.kind==="model"?ee.selected.slug:ge,Ct=W(()=>{let tt=new Map;for(let It of B)tt.set(It.instanceId,t.model.getAppModelOptionsForInstance(n,It,It.instanceId===E?ft:null));return tt},[t.model,B,E,ft,n]),gt=W(()=>(Ct.get(E)??[]).some(It=>It.slug===ft)?ft:t.model.normalizeSlug(ft)??ft,[t.model,Ct,E,ft,te]),_t=k??(T?null:I),Mt=_t!==null,[se,Le]=q(!1);H(()=>{Le(!1)},[E]);let be=zN({status:re,submissionTarget:T?"pending-user-input":"provider-turn"}),Ye=KN({blockedOnSend:se,status:re,submissionTarget:T?"pending-user-input":"provider-turn"}),xt=W(()=>HN(b,Ct),[b,Ct]);return{providerInstanceEntries:B,lockedContinuationGroupKey:j,selectedInstanceId:E,agentUnavailable:Y,selectedProviderEntry:F,noProviderAvailable:Z,agentUnavailableNoChoice:J,resolvedCompactDisabledReason:ne,selectedProvider:te,composerModelOptions:le,selectedModel:ge,selectedModelStatus:re,selectedProviderStatus:he,selectedProviderModels:Ne,selectedModelChoice:ee,modelNotes:je,selectedModelUnconfirmed:nt,selectedModelOptionsForDispatch:De,planModeUiEnabled:me,composerProviderControls:Ae,canSwitchNativeMode:ue,composerNativeMode:Ze,selectedNativeModeId:pt,handleComposerNativeModeChange:ze,selectedModelSelection:et,onAgentInstanceChange:Et,modelOptionsByInstance:Ct,selectedModelForPickerWithCustomFallback:gt,sendDisabledReason:_t,isSendDisabled:Mt,setModelSendBlockShown:Le,isModelSendBlocked:be,modelSendBlock:Ye,activeThreadModelDisplayName:xt}}function XN(e,t){let{provider:o,instanceId:n,threadRef:r,draftId:a,model:s,choice:i}=t,d=r!==void 0||a!==void 0,c=RT(i,u=>u);return!d||!kT(c,LT(i))?null:l(e,{provider:o,...n?{instanceId:n}:{},...r?{threadRef:r}:{},...a?{draftId:a}:{},model:s,choice:i})}function YN(e){return XN(wb,e)}function JN(e){return XN(bb,e)}function ZN(e){let{routeKind:t,routeThreadRef:o,draftId:n,selectedProvider:r,selectedInstanceId:a,selectedModel:s,selectedModelChoice:i}=e,d={provider:r,instanceId:a,...t==="server"?{threadRef:o}:{},...t==="draft"&&n?{draftId:n}:{},model:s,choice:i};return{providerTraitsMenuContent:YN(d),providerTraitsPicker:JN(d)}}$();$();var GC="ycodium:status-bar-usage-surface";var eD=pe(function(t){let{data:o,target:n}=zo(),r=cb(),a=o.useAccountUsageInstance(n),s=`${n.environmentId}:${n.threadId}`;return H(()=>{if(r)return window.dispatchEvent(new CustomEvent(GC,{detail:{owner:s,environmentId:n.environmentId,instanceId:a?.instanceId??null,instanceLabel:a?.instanceLabel??null,decisionOccupiesComposer:t.decisionOccupiesComposer,clear:!1}})),()=>{window.dispatchEvent(new CustomEvent(GC,{detail:{owner:s,clear:!0}}))}},[r,a?.instanceId,a?.instanceLabel,s,t.decisionOccupiesComposer,n.environmentId]),null});function OW(e,t,o){let n=[];n.push(t(e));let r=o(e);return r&&n.push(r),e.pageUrl&&n.push(e.pageUrl),e.selector&&n.push(e.selector),e.htmlPreview.trim().length>0&&(n.push(""),n.push(e.htmlPreview.trim().slice(0,600))),n.join(`
|
|
3590
|
-
`)}function FW({context:e,onRemove:t}){let{t:o}=z(),n=lt().elementContext,r=n.formatLabel(e),a=n.formatSourceLabel(e);return v(Re,{children:[l(Ee,{render:v("span",{className:G(un,"pr-1"),children:[l(Vn,{className:G(Uo,"size-icon-1")}),l("span",{className:$o,children:r}),a?l("span",{className:"select-none text-ui-2xs font-normal text-muted-foreground/85",children:a}):null,l("button",{type:"button","aria-label":o("pendingContext.removeElement",{label:r}),className:Cp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(e.id)},children:l(ot,{className:"size-3","aria-hidden":!0})})]})}),l(Pe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:OW(e,n.formatLabel,n.formatSourceLabel)})]})}function tD({contexts:e,onRemove:t,className:o}){return e.length===0?null:l("div",{className:G("flex flex-wrap gap-1.5",o),children:e.map(n=>l(FW,{context:n,onRemove:t},n.id))})}function oD({comments:e,onRemove:t,className:o}){let{t:n}=z();return e.length===0?null:l("div",{className:G("flex flex-wrap gap-1.5",o),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,s=v("span",{className:G(un,"pr-1"),children:[l(Wa,{className:G(Uo,"size-icon-1")}),l("span",{className:$o,children:a}),l("button",{type:"button","aria-label":n("pendingContext.removeReviewComment",{label:a}),className:Cp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(r.id)},children:l(ot,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?s:v(Re,{children:[l(Ee,{render:s}),l(Pe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function rg(e){let{t}=z(),o=t(e.tooltipKey,{count:e.count});return v(Re,{children:[l(Ee,{render:v("span",{className:"inline-flex items-center gap-1 text-ui-2xs font-medium text-muted-foreground",children:[e.icon,e.count]})}),l(Pe,{side:"top",children:o})]})}function nD({annotations:e,images:t,onRemove:o,onExpandImage:n,uploadsByImageId:r,onRetryUpload:a,className:s}){let{t:i}=z(),d=lt().elementContext;if(e.length===0)return null;let c=new Map(t.map(u=>[u.id,u]));return l("div",{className:G("flex flex-wrap gap-1.5",s),children:e.map(u=>{let m=c.get(u.id),p=m?r?.[m.id]:void 0,f=u.elements.flatMap(g=>{let h=d.normalizeSelection(g.element);return h?[{id:g.id,label:d.formatLabel(h)}]:[]});return v("section",{className:"group/browser-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[m?.previewUrl?l("button",{type:"button","aria-label":i("browserAnnotation.previewImage",{name:m.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>n(m.id),children:l("img",{src:m.previewUrl,alt:i("browserAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/browser-annotation:scale-[1.03]"})}):l("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:l(Vn,{className:"size-icon-2"})}),v("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[u.comment.trim()?l("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:u.comment.trim()}):null,v("div",{className:G("flex min-w-0 items-center gap-2",u.comment.trim()&&"mt-1"),children:[f.length>0?v("div",{className:"flex min-w-0 items-center gap-1",children:[f.slice(0,2).map(({id:g,label:h})=>l("span",{className:"max-w-40 truncate font-mono text-secondary-label text-ui-2xs",children:h},g)),f.length>2?v("span",{className:"text-secondary-label text-ui-2xs",children:["+",f.length-2]}):null]}):null,v("div",{className:"flex shrink-0 items-center gap-2",children:[u.elements.length>0?l(rg,{icon:l(Vn,{className:"size-3"}),count:u.elements.length,tooltipKey:"browserAnnotation.elementCount"}):null,u.regions.length>0?l(rg,{icon:l(Ql,{className:"size-3"}),count:u.regions.length,tooltipKey:"browserAnnotation.regionCount"}):null,u.strokes.length>0?l(rg,{icon:l(Qn,{className:"size-3"}),count:u.strokes.length,tooltipKey:"browserAnnotation.drawingCount"}):null,u.styleChanges.length>0?l(rg,{icon:l(ja,{className:"size-3"}),count:u.styleChanges.length,tooltipKey:"browserAnnotation.styleChangeCount"}):null,p?.status==="uploading"?l("span",{className:"text-ui-2xs text-secondary-label",children:Yf(p.progress)}):null,p?.status==="failed"&&m&&a?v(Re,{children:[l(Ee,{render:l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("attachments.retryUpload",{name:m.name}),onClick:()=>a(m)}),children:l(Va,{className:"size-3"})}),l(Pe,{side:"top",children:Xf(p,i)})]}):null]})]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("browserAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>o(u.id),children:l(ot,{className:"size-3"})})]},u.id)})})}function jC(e,t){let o=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name,source:r.source}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,...r.source===void 0?{}:{source:r.source}})),index:n}}function rD(e){let{t}=z(),{api:o,environmentId:n,composerDraftTarget:r,isComposerCollapsedMobile:a,isComposerApprovalState:s,hasPendingUserInputs:i,supportsAttachmentUploads:d,uploadsByImageId:c,composerImages:u,composerPreviewableImages:m,composerBrowserAnnotations:p,composerReviewComments:f,composerElementContexts:g,nonPersistedComposerImageIdSet:h,removeComposerDraftBrowserAnnotation:y,removeComposerDraftReviewComment:x,removeComposerDraftElementContext:C,removeComposerImage:b,onExpandImage:L}=e;return v(oe,{children:[!a&&!s&&!i&&p.length>0&&l(nD,{annotations:p,images:u,...d?{uploadsByImageId:c,onRetryUpload:w=>o.uploads.retry({environmentId:n,image:w})}:{},onRemove:w=>{o.uploads.release(w),y(r,w)},onExpandImage:w=>{let k=jC(m,w);k&&L(k)},className:"mb-3"}),!a&&!s&&!i&&f.length>0&&l(oD,{comments:f,onRemove:w=>x(r,w),className:"mb-3"}),!a&&!s&&!i&&g.length>0&&l(tD,{contexts:g,onRemove:w=>C(r,w),className:"mb-3"}),!a&&!s&&!i&&u.some(w=>!p.some(k=>k.id===w.id))&&l("div",{className:"mb-3 flex flex-wrap gap-2",children:u.filter(w=>!p.some(k=>k.id===w.id)).map(w=>{let k=d?c[w.id]:void 0,I=or(w),T=up(I),S=I==="image"&&!!w.previewUrl;return v("div",{"data-composer-attachment-id":w.id,className:G("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",S?"w-16":"w-44 max-w-full"),children:[S?l("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":t("attachments.preview",{name:w.name}),onClick:()=>{let R=jC(m,w.id);R&&L(R)},children:l("img",{src:w.previewUrl,alt:w.name,className:"h-full w-full object-cover"})}):v("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:[l(T,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0",children:[l("span",{className:"block truncate text-ui-xs text-foreground",children:w.name}),l("span",{className:"block text-ui-2xs text-secondary-label",children:pi(w.sizeBytes)})]})]}),h.has(w.id)&&v(Re,{children:[l(Ee,{render:l("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-warning-foreground",children:l(Dt,{className:"size-3"})})}),l(Pe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:t("attachments.draftMayNotPersistDetail")})]}),k?.status==="uploading"&&l("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-ui-2xs text-foreground",children:Yf(k.progress)}),k?.status==="failed"&&v(Re,{children:[l(Ee,{render:l(K,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>o.uploads.retry({environmentId:n,image:w}),"aria-label":t("attachments.retryUpload",{name:w.name})}),children:l(Va,{})}),l(Pe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Xf(k,t)})]}),l(K,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>b(w.id),"aria-label":t("attachments.remove",{name:w.name}),children:l(ot,{})})]},w.id)})})]})}function aD(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function sD(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}function iD(e){return e.isComposerApprovalState?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.askAnything")}$();$();var lD=pe(function(t){let{t:o}=z(),n=gl();return v(_o,{children:[l(Fo,{render:l(K,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":o("composer.moreComposerControls")}),children:l(Ao,{"aria-hidden":"true",className:"size-4"})}),v(Oo,{align:"start",children:[t.traitsMenuContent?v(oe,{children:[t.traitsMenuContent,l(xd,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.modeMenuTitle")}),v(ea,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[l(er,{value:"default",children:o("composer.interactionModeChat")}),l(er,{value:"plan",children:o("composer.interactionModePlan")})]}),l(xd,{})]}):null,t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),l(ea,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Un.map(r=>l(er,{value:r,children:n(r).label},r))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?v(oe,{children:[l(ea,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>l(er,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):l("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});function dD(e){let{t}=z(),o=lt().environment.useScopedEnvironmentId();return l(xb,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1,emptyLabel:t("composer.chooseModel"),...o===null?{}:{environmentId:o}})}function cD(e){let{slots:t,...o}=e,n=l(dD,{...o}),r=t?.renderSlot("conversation.input.model",o,n);return l("span",{"data-conversation-slot":"conversation.input.model",children:r??n})}function uD(e){return l(dD,{...e})}$();function pD(e){return e.description??e.name}var mD=pe(function(t){let{t:o}=z(),{current:n,modes:r}=t.nativeMode,a=pD(n);return!t.canSwitch||r.length<2?v(Re,{children:[v(Ee,{render:l(Yn,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Jn,{icon:Qs}),l("span",{children:n.name})]}),v(Pe,{side:"top",children:[l("span",{className:"block font-medium",children:a}),r.length>1?l("span",{className:"mt-1 block text-muted-foreground text-xs",children:o("composer.agentModesList",{modes:r.map(s=>s.name).join(", ")})}):null]})]}):l(oe,{children:v(Re,{children:[v(Zs,{value:n.id,onValueChange:s=>t.onNativeModeChange(s),children:[v(Ee,{render:l(Ou,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Jn,{icon:Qs}),l(Hu,{children:n.name})]}),l(ei,{alignItemWithTrigger:!1,children:r.map(s=>l(Xa,{value:s.id,hideIndicator:!0,className:"min-w-56 py-2",children:v("div",{className:"grid min-w-0 gap-0.5",children:[l("span",{className:"font-medium text-foreground",children:s.name}),s.description?l("span",{className:"text-muted-foreground text-xs leading-4",children:s.description}):null]})},s.id))})]}),l(Pe,{side:"top",children:t.appliesNextTurn?`${a} ${o("runtimeMode.appliesNextTurnHint")}`:a})]})})});function VC(e){let{t}=z(),o=gl();if(e.nativeMode)return l(mD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let n=o(e.runtimeMode),r=n.icon,a=e.runtimeModeSwitch==="next-turn";return l(oe,{children:v(Re,{children:[v(Zs,{value:e.runtimeMode,onValueChange:s=>e.onRuntimeModeChange(s),children:[v(Ee,{render:l(Ou,{"data-composer-permission":"true",className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[l(Jn,{icon:r}),l(Hu,{children:n.label})]}),l(ei,{alignItemWithTrigger:!1,children:Un.map(s=>{let i=o(s),d=i.icon;return l(Xa,{value:s,hideIndicator:!0,className:"min-w-64 py-2","data-runtime-mode":s,children:v("span",{className:"flex items-center gap-2",children:[l(d,{className:"size-4"}),i.label]})},s)})})]}),l(Pe,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):n.label})]})})}function fD(e){return l(VC,{...e})}function QC(e){let{t}=z();if(!e.showInteractionModeToggle)return null;let o=e.interactionMode==="plan",n=t(o?"composer.planModeTooltip":"composer.defaultModeTooltip");return v(Re,{children:[v(Ee,{render:l(Yn,{"data-composer-plan-toggle":"true",className:G("shrink-0 whitespace-nowrap",o?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":n}),children:[o?l(Jn,{icon:dd,className:"text-current opacity-100"}):l(Jn,{icon:Ua,opticalSize:"large"}),l("span",{className:"sr-only sm:not-sr-only",children:t(o?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),l(Pe,{side:"top",className:"sm:hidden",children:n})]})}function gD(e){return l(QC,{...e})}function tu(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return l("span",{"data-conversation-slot":e.name,children:t??e.fallback})}function Br(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 BW(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function hD(e){let{t}=z(),o=ho(),{usage:n,breakdown:r,modelDisplayName:a,onCompact:s,compactDisabled:i,compactDisabledReason:d}=e,c=BW(n.usedPercentage),u=n.usedPercentage??0,m=n.usedPercentage===null?null:100,p=n.totalProcessedTokens??null,f=p!==null&&p>0;return v(ln,{children:[l(cn,{openOnHover:!0,delay:150,closeDelay:s?150:0,render:l(K,{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&&c?t("contextWindow.usedPercentAria",{percentage:c}):t("contextWindow.usedTokensAria",{tokens:Br(n.usedTokens)}),children:l(_g,{"aria-hidden":!0,"aria-label":t("contextWindow.usage"),limit:m,shape:"ring",used:u})})}),l(dn,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"overflow-y-auto p-0",className:"w-72 text-left whitespace-normal",children:v("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[l("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&c?v("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:[l("span",{children:c})," ",v("span",{children:[Br(n.usedTokens),"/",Br(n.maxTokens??null)]})]}):l("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:Br(n.usedTokens)})]}),n.maxTokens!==null?l(_g,{"aria-label":t("contextWindow.usage"),limit:m,shape:"bar",used:u}):null,r?v("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"system",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.system")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Br(r.systemTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"tools",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Br(r.toolsTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"messages",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Br(r.messageTokens)})]})]}):null,f?v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Br(p)})]}):null,n.compactsAutomatically?l("div",{className:"mt-1 text-pretty text-secondary-label text-ui-sm font-medium",children:UN(t,a,n.autoCompactThreshold)}):null,s?v(oe,{children:[v(K,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,"aria-describedby":i&&d?o:void 0,onClick:s,children:[l(sd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&d?l("div",{id:o,className:"text-pretty text-secondary-label text-ui-sm",children:d}):null]}):null]})})]})}$();function yD(e){if(e.useDraftPresetId===void 0||e.setDraftPresetId===void 0)throw new Error("missing draft preset api: useDraftPresetId and setDraftPresetId");return{useDraftPresetId:e.useDraftPresetId,setDraftPresetId:e.setDraftPresetId}}function XC(e,t){return t==null?void 0:e.find(o=>o.presetId===t)}var YC="__none__",vD=pe(function({environmentId:t,draftId:o,threadPresetId:n,compact:r}){let{t:a}=z(),s=lt().presets,i=yD(s),d=s.useThreadPresets(t),c=i.useDraftPresetId(o);if(o===null){let f=XC(d,n)?.displayName??n;return f===null?null:l(HW,{compact:r,label:f,applied:a("preset.appliedLabel",{name:f}),disabled:!0})}if(d.length===0)return null;let m=XC(d,c)?.displayName??a("preset.none");return v(_o,{children:[v(Fo,{render:l(Yn,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"max-w-40 min-w-0 shrink"}),children:[l(CD,{compact:r,label:m,applied:a("preset.appliedLabel",{name:m})}),l(_u,{})]}),l(Oo,{align:"start",children:v(Pb,{children:[l("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),v(ea,{value:c??YC,onValueChange:p=>{i.setDraftPresetId(o,p===YC?null:p)},children:[l(er,{value:YC,hideIndicator:!0,closeOnClick:!0,children:l("span",{className:"min-w-0 truncate",children:a("preset.none")})}),d.map(p=>l(er,{value:p.presetId,hideIndicator:!0,closeOnClick:!0,children:v("span",{className:"flex w-full min-w-0 flex-col",children:[l("span",{className:"min-w-0 truncate",children:p.displayName}),p.description?l("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:p.description}):null]})},p.presetId))]})]})})]})});function HW(e){return l(Yn,{variant:"ghost",disabled:e.disabled,"aria-label":e.applied,className:"max-w-40 min-w-0 shrink",children:l(CD,{compact:e.compact,label:e.label,applied:e.applied})})}function CD(e){return v(Re,{children:[v(Ee,{render:l("span",{className:"flex min-w-0 items-center gap-1.5"}),children:[l(Jn,{icon:Wr}),e.compact?null:l("span",{className:"min-w-0 truncate",children:e.label})]}),l(Pe,{side:"top",children:e.applied})]})}var UW=pe(function(t){let{data:o,target:n}=zo(),r=o.useContextUsage(n);return r?.window==null?null:l(hD,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),$W=pe(function(t){let{t:o}=z(),n=tg(t.groupSendEligible),r=eg({pluginAction:t.pluginAction,groupSend:n,groupSendDisabledReason:t.groupSendDisabledReason,sendDisabledReason:t.sendDisabledReason,noProviderAvailable:t.noProviderAvailable,environmentUnavailable:t.environmentUnavailable,projectSelectionRequired:t.projectSelectionRequired,labels:{environmentDisconnected:o("primaryActions.environmentDisconnected"),chooseProjectToStart:o("composer.chooseProjectToStart"),enableProviderToSend:o("composer.enableProviderToSend")}}).reason;return v(oe,{children:[l(UW,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),l(yl,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt&&!t.pluginAction,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:r,isEnvironmentUnavailable:t.environmentUnavailable||t.noProviderAvailable&&!n&&!t.pluginAction||t.projectSelectionRequired,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:!!(t.showSendWhileRunning||t.pluginAction),onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,stopping:t.stopping,cancelsCheck:t.cancelsCheck,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})});function xD(e){let{t}=z(),{isComposerFooterCompact:o,isComposerPrimaryActionsCompact:n,isMobileViewport:r,showMobilePendingAnswerActions:a,hasPendingUserInputs:s,projectSelectionRequired:i,noProviderAvailable:d,composerAttachmentInputRef:c,onComposerAttachmentInputChange:u,slots:m,selectedInstanceId:p,unavailableAgentInstanceId:f,agentNotChosen:g,agentUnavailable:h,providerInstanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,onAgentInstanceChange:b,selectedModelForPickerWithCustomFallback:L,selectedModelStatus:w,selectedModelUnconfirmed:k,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,isComposerModelPickerOpen:R,setIsComposerModelPickerOpen:A,getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onProviderModelSelect:V,environmentId:U,routeKind:D,draftId:X,activeThread:j,interactionMode:E,runtimeMode:Y,composerProviderControls:F,composerNativeMode:Z,canSwitchNativeMode:J,providerTraitsMenuContent:ne,providerTraitsPicker:te,toggleInteractionMode:le,handleRuntimeModeChange:ge,handleComposerNativeModeChange:re,inlineTasksBadge:ee,inlineStashBadge:ve,activeThreadModelDisplayName:he,pendingPrimaryAction:Ne,phase:De,continuationChecking:je,showPlanFollowUpPrompt:nt,composerDraft:me,isSendBusy:Ae,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,environmentUnavailable:pt,handleInterruptPrimaryAction:ze,interruptArmed:et,stopping:Et,handleImplementPlanInNewThreadPrimaryAction:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:_t,resolvedCompactDisabledReason:Mt,compactThreadContext:se}=e;return v("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":o?"true":"false",className:G("flex min-w-0 select-none flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s&&"pt-2",o?"gap-1.5":"gap-2 sm:gap-0",a&&"hidden sm:flex"),children:[v("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:[l("input",{ref:c,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:u}),v(Re,{children:[l(Ee,{render:l(K,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:i||s,"aria-label":t("attachments.add"),onClick:()=>c.current?.click()}),children:l(Yo,{})}),l(Pe,{side:"top",children:t("attachments.add")})]}),d?v(K,{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:[l(Dt,{className:"size-4"}),t("composer.noProviderAvailable")]}):v(oe,{children:[l(tu,{name:"conversation.input.agent",...m===void 0?{}:{slots:m},owner:{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b},fallback:l(qC,{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b})}),h||g?null:l(cD,{...m===void 0?{}:{slots:m},compact:o,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:p,model:L,modelStatus:w,modelUnconfirmed:k,lockedProvider:x,lockedContinuationGroupKey:C,instanceEntries:y,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,open:R,onOpenChange:Le=>{A(Le)},getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onInstanceModelChange:V})]}),v(oe,{children:[l(vD,{environmentId:U,draftId:D==="draft"?X:null,threadPresetId:j?.presetId??null,compact:o},D==="draft"?X:j?.id??"thread"),o?l(lD,{interactionMode:E,runtimeMode:Y,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:Z,canSwitchNativeMode:J,showInteractionModeToggle:F.showInteractionModeToggle,traitsMenuContent:ne,onToggleInteractionMode:le,onRuntimeModeChange:ge,onNativeModeChange:re}):v(oe,{children:[te?l(tu,{name:"conversation.input.effort",...m===void 0?{}:{slots:m},fallback:te}):null,Z===null&&F.showInteractionModeToggle?l(tu,{name:"conversation.input.plan",...m===void 0?{}:{slots:m},owner:{interactionMode:E,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:le},fallback:l(QC,{interactionMode:E,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:le})}):null,l(tu,{name:"conversation.input.permission",...m===void 0?{}:{slots:m},owner:{runtimeMode:Y,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:Z,canSwitchNativeMode:J,onRuntimeModeChange:ge,onNativeModeChange:re},fallback:l(VC,{runtimeMode:Y,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:Z,canSwitchNativeMode:J,onRuntimeModeChange:ge,onNativeModeChange:re})})]})]})]}),v("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":n?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[a?null:ee,a?null:ve,l($W,{pluginAction:e.pluginAction,compact:n,activeThreadModelDisplayName:he,pendingAction:Ne,isRunning:De==="running"||je,cancelsCheck:je&&De!=="running",showPlanFollowUpPrompt:!s&&nt,promptHasText:me.promptHasText,isSendBusy:Ae,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,noProviderAvailable:d,environmentUnavailable:pt!==null,projectSelectionRequired:i,hasSendableContent:me.hasSendableContent,preserveComposerFocusOnPointerDown:r,showSendWhileRunning:r,onInterrupt:ze,interruptArmed:et,stopping:Et,onImplementPlanInNewThread:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:_t||d||Ae,compactDisabledReason:Mt,onCompactContext:se})]})]})}var zW=e=>e.prompt.trim();function KW(e){let{t}=z(),o=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,zW),n=e.pendingCustomAnswer!==null;return l("button",{type:"button",className:G("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-control-3",(n?e.pendingCustomAnswer:o)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:n?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):o||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}function bD(e){let{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:r,onExpand:a,inlineTasksBadge:s,inlineStashBadge:i,submitDisabled:d,submitLabel:c,onSubmit:u}=e,{t:m}=z(),p=tg(e.groupSendEligible),f=eg({pluginAction:e.pluginAction,groupSend:p,groupSendDisabledReason:e.groupSendDisabledReason,sendDisabledReason:e.modelSendDisabledReason,noProviderAvailable:e.noProviderAvailable,environmentUnavailable:e.environmentUnavailable,projectSelectionRequired:e.projectSelectionRequired,labels:{environmentDisconnected:m("primaryActions.environmentDisconnected"),chooseProjectToStart:m("composer.chooseProjectToStart"),enableProviderToSend:m("composer.enableProviderToSend")}});return v("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[l(KW,{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:!p&&!e.pluginAction&&r,onExpand:a}),s,i,l("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:d||f.disabled,"aria-label":c,onPointerDown:g=>g.preventDefault(),onClick:g=>{g.stopPropagation(),u()},children:l("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}$();$();var wD={plugins:"slashMenu.sections.plugins",recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills",files:"slashMenu.sections.files","members-team":"slashMenu.sections.membersTeam","members-project":"slashMenu.sections.membersProject",threads:"slashMenu.sections.threads"},ID=pe(function(t){let{t:o}=z(),n=M(null),r=Co()?.data.threadReferences!==void 0,a=Co()?.data.memberMentions!==void 0;return fe(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),l(Wu,{autoHighlight:!1,mode:"none",onItemHighlighted:s=>{t.onHighlightedItemChange(typeof s=="string"?s:null)},children:v("div",{ref:n,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:[t.items.length>1&&t.items.every(s=>s.type==="plugin-slash-command"&&s.command.name===t.items[0].command.name)?l("p",{className:"px-5 pt-2 text-xs text-muted-foreground",children:o("slash.ambiguous",{command:t.items[0].command.name})}):null,t.items.length>0?l(Vu,{className:"max-h-72 scroll-pb-6",children:l(Gu,{children:t.items.map((s,i)=>l(qW,{sectionTitle:s.section!==void 0&&t.items[i-1]?.section!==s.section?s.section:null,sectionLabel:s.type==="path"?s.sectionLabel:void 0,item:s,environmentId:t.environmentId,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===s.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},s.id))})}):l("div",{className:"px-5 pt-3.5 pb-7",children:l("p",{className:"text-secondary-label text-xs",children:t.isLoading?TD(t.triggerKind)?o("composer.searchingSkills"):o("composer.searchingFiles"):TD(t.triggerKind)?o("composer.noSkillsFound"):t.triggerKind==="path"?o(a?"composer.noMatchingFilesThreadsOrMembers":r?"composer.noMatchingFilesOrThreads":"composer.noMatchingFiles"):o("composer.noMatchingCommand")})})]})})});function TD(e){return e==="skill"||e==="slash-skill"}var qW=pe(function(t){let{t:o}=z(),n=Co()?.target,r=t.item.type==="skill"?sA(t.item.skill):null,a=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return v(oe,{children:[t.sectionTitle!==null?l("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:t.sectionLabel??o(wD[t.sectionTitle]??wD.recent)}):null,v(ju,{value:t.item.id,"data-composer-item-id":t.item.id,className:G("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:s=>{s.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?l(Of,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,t.item.type==="thread"?l(yr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,t.item.type==="member"?l(Cr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,v("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[l("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:a?v(oe,{children:[l("span",{className:"text-secondary-label",children:"/skill:"}),nn(a)]}):t.item.label}),l("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),t.item.type==="plugin-slash-command"?l(Do,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.pluginId}):null,t.item.type==="skill"&&t.item.skill.pluginId?l(Do,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.skill.pluginId}):r?l(jW,{kind:r}):null]})]})]})}),WW={app:Ha,repo:qr,project:qr,personal:Cr,system:fd,other:ld},GW={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 jW(e){let{t}=z(),o=WW[e.kind];return v(Xr,{className:"ms-auto",variant:"secondary",children:[l(o,{"aria-hidden":"true",className:"text-current"}),t(GW[e.kind])]})}$();function VW(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function SD(e,t){let o=VW(e);if(!o)return"";let n=Date.now()-o.getTime();if(n<0)return t("relativeTime.justNow");let r=Math.floor(n/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 kD=90;function LD(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function QW(e,t){let o=e.prompt.trim().replace(/\s+/g," ");if(o.length>0)return o.length>kD?`${o.slice(0,kD)}\u2026`:o;let n=e.attachments.length+e.droppedImageNames.length;return n>0?t("stash.imageCountLabel",{count:n}):t("stash.emptyEntry")}var RD=pe(function(t){let{entries:o,onRestore:n,onDelete:r,onClose:a}=t,{t:s}=z(),i=lt(),d=M(null),[c,u]=q(o[0]?.id??null),m=o.find(p=>p.id===c)??o[0];return H(()=>{let p=f=>{let g=d.current;g&&f.composedPath().includes(g)||f.target instanceof Element&&f.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),H(()=>{o.length!==0&&(o.some(p=>p.id===c)||u(o[0]?.id??null))},[o,c]),i.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(o.length===0)return;p.preventDefault(),p.stopPropagation();let f=o.findIndex(x=>x.id===c),g=p.key==="ArrowDown"?1:-1,y=((f>=0?f:g===1?-1:0)+g+o.length)%o.length;u(o[y]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!m)return;p.preventDefault(),p.stopPropagation(),n(m);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!m)return;p.preventDefault(),p.stopPropagation(),r(m)}},{capture:!0}),l(Wu,{autoHighlight:!1,mode:"none",children:v("div",{ref:d,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[l("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:l(K,{variant:"ghost-muted",size:"icon-micro","aria-label":s("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:l(ot,{className:"size-3"})})}),l(Vu,{className:"max-h-64 scroll-pb-6",children:l(Gu,{children:o.length===0?l("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:s("stash.empty")}):o.map(p=>v(ju,{value:p.id,className:G("group/stash relative cursor-[var(--control-cursor)] 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",c===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{c!==p.id&&u(p.id)},onMouseDown:f=>{f.preventDefault()},onClick:()=>{n(p)},children:[l("span",{className:"min-w-0 flex-1 truncate text-xs",children:QW(p,s)}),p.pendingImageCount?l("span",{className:"shrink-0 text-ui-sm text-secondary-label",children:s("stash.savingImage",{count:p.pendingImageCount})}):LD(p)>0?l("span",{className:"shrink-0 text-ui-sm text-warning-foreground",children:s("stash.imagesDropped",{count:LD(p)})}):null,p.attachments.length>0?l("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(f=>l("img",{src:f.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},f.id))}):null,l("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:SD(p.createdAt,s)}),l(K,{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:f=>{f.stopPropagation(),r(p)},children:l(ot,{className:"stroke-2"})})]},p.id))})})]})})});$();function XW(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function JC(e){let t=lt(),o=Su(),n=t.pane.useActive(),[r,a]=q(null);return fe(()=>{if(!n)return;let s=e.anchor;if(!s){a(null);return}let i=!0,d=()=>{if(!i)return;let u=s.closest('[data-chat-composer-form="true"]'),p=(u?.querySelector('[data-chat-composer-main-surface="true"]')??u??s).getBoundingClientRect(),f=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(u??s).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*f,y=f+1,x={bottom:window.innerHeight-p.top-y,left:p.left+h,maxHeight:Math.max(96,p.top-24+y),width:Math.max(0,p.width-h*2),overlap:y};a(C=>C&&XW(C,x)?C:x)};d(),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0);let c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);if(c){c.observe(s);for(let u=s.parentElement;u;u=u.parentElement)c.observe(u)}return()=>{i=!1,c?.disconnect(),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[e.anchor,n]),!n||!r?null:t.createPortal(v("div",{className:o,"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:[l(YW,{}),e.children]}),document.body)}function YW(){return YA(),null}$();function JW(e){let t=yT(e);if(t===null)return"";let o=hi(t).visibleText;for(;;){let n=yi(o);if(!n.annotation)break;o=n.promptText}return o=ra(o).promptText,fi(o).flatMap(n=>n.kind==="text"?[n.text]:[]).join("").trim()}function PD(e){let t=[];for(let o of e){let n=JW(o.text);n!==""&&(t.at(-1)?.prompt===n&&t.pop(),t.push({id:o.id,prompt:n}))}return t}function ED(e){let{direction:t,entries:o,position:n,draft:r}=e,a=-1;if(n!==null&&n.recalled===r&&(a=o.findIndex(i=>i.id===n.id),a<0&&(a=o.findLastIndex(i=>i.prompt===n.recalled))),a<0&&(t==="forward"||r!==""))return null;let s=t==="forward"?o[a+1]:o[(a<0?o.length:a)-1];return s!==void 0?{position:{id:s.id,recalled:s.prompt},prompt:s.prompt}:t==="forward"?{position:null,prompt:""}:null}function MD(e){let{documentKey:t,promptRef:o,editorRef:n,blocked:r,readSentMessages:a,show:s}=e,i=M(null);return(d,c)=>{if(r||c.shiftKey||c.altKey||c.metaKey||c.ctrlKey||c.isComposing||c.keyCode===229)return!1;let u=o.current,m=i.current,p=m?.documentKey===t?m.position:null,f=d==="ArrowUp"?"back":"forward";if(p?.recalled!==u&&(f==="forward"||u!=="")||n.current?.isCaretOnVisualEdge(f==="back"?"start":"end")!==!0)return!1;let g=ED({direction:f,entries:PD(a()),position:p,draft:u});return g===null?!1:(i.current=g.position===null?null:{documentKey:t,position:g.position},s(g.prompt),!0)}}$();function ZW(e,t){let o=e.name.toLowerCase(),n=nn(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",s=e.scope?.toLowerCase()??"",i=[Cn({value:o,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Cn({value:n,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Cn({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Cn({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Cn({value:s,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(d=>d!==null);return i.length===0?null:Math.min(...i)}function AD(e,t,o=Number.POSITIVE_INFINITY){let n=e.filter(wr),r=Zc(t,{trimLeadingPattern:/^\$+/});if(!r)return n;let a=[];for(let s of n){let i=ZW(s,r);i!==null&&OC(a,{item:s,score:i,tieBreaker:`${nn(s).toLowerCase()}\0${s.name}`},o)}return a.map(s=>s.item)}var ND=[],DD=[],xl=Object.freeze({environmentId:"",threadId:""}),_D=e=>e.prompt,OD=e=>e.images.length>0||e.persistedAttachments.length>0||e.terminalContexts.length>0||e.elementContexts.length>0||e.browserAnnotations.length>0||e.reviewComments.length>0,eG=()=>[],FD=e=>eG,BD=(e,t)=>{let o=new Map(e.map(n=>[n.id,n]));return t.flatMap(n=>{let r=o.get(n);return r?[r]:[]})},HD=(e,t)=>e.length===t.length&&e.every((o,n)=>o.id===t[n]);function ZC(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 tG=1e4;function oG(e,t){if(t==="")return 0;let o=e.toLowerCase(),n=o.slice(o.lastIndexOf("/")+1),r=Cn({value:n,query:t,exactBase:0,prefixBase:100,boundaryBase:200,includesBase:300,fuzzyBase:400});return r!==null?r:Cn({value:o,query:t,exactBase:1e3,prefixBase:1100,boundaryBase:1200,includesBase:1300,fuzzyBase:1400})??tG}function UD(e){let t=Zc(e.query),o=[];e.folders.forEach((a,s)=>{e.groups.find(d=>d.cwd===a.cwd)?.entries.forEach((d,c)=>{o.push({hit:{folder:a,entry:d},quality:oG(d.path,t),position:c,folderIndex:s})})});let n=o.toSorted((a,s)=>a.quality-s.quality||a.position-s.position||a.folderIndex-s.folderIndex).slice(0,Bx),r=[];for(let{hit:a}of n)r.includes(a.folder.id)||r.push(a.folder.id);return r.flatMap(a=>n.filter(({hit:s})=>s.folder.id===a).map(({hit:s})=>s))}function $D(e){return e.map(t=>({id:`member:${t.memberId}`,type:"member",candidate:t,label:t.name,description:[t.title,t.machineLabel].filter(o=>o!==null).join(" / "),section:t.inTeam?"members-team":"members-project"}))}var zD=(e,t,o)=>o.endsWith(" ")&&e[t]===" "?t+1:t,nG=Object.freeze([]),rG=Object.freeze([]),aG=()=>rG,sG=()=>nG,iG=Object.freeze([]),lG=Object.freeze([]),dG=()=>iG,cG=Object.freeze({groups:Object.freeze([]),isPending:!1}),uG=()=>cG,pG=(e,t)=>`${e.replace(/[\\/]+$/,"")}/${t}`;function ou(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function qD({prompt:e,pluginCommands:t=[],onSelectPluginCommand:o,selectedProvider:n,selectedProviderStatus:r,planModeUiEnabled:a,showSkillsInSlashMenu:s,recentSlashCommandIds:i,environmentId:d,gitCwd:c,useComposerPathSearch:u,useComposerPathSearchAcross:m,readComposerSnapshot:p,applyPromptReplacement:f,onInteractionModeChange:g,onOpenModelPicker:h,onSlashCommandUsed:y}){let{t:x}=z(),C=nr(),[b,L]=q(()=>Eo(e,e.length)),[w,k]=q(null),[I,T]=q(null),[S,R]=q(null),A=w!==null&&ou(b)===w?null:b,N=A?.kind==="path"?A.query:"",B=A?.kind==="path",O=Co(),V=(O?.data.useThreadFolders??dG)(O?.target??xl),U=V.length>1&&m!==void 0,D=W(()=>U&&B?V.map(me=>me.cwd):lG,[V,B,U]),X=u({environmentId:d,cwd:B&&!U?c:null,query:B&&!U?N:null}),j=(m??uG)({environmentId:d,cwds:D,query:D.length>0?N:null}),E=W(()=>D.length>0?UD({query:N,folders:V,groups:j.groups}):[],[j.groups,D,V,N]),Y=U?j.isPending:X.isPending,F=O?.data.threadReferences,Z=(F?.useCandidates??sG)({target:O?.target??xl,query:B?N:null}),J=O?.data.memberMentions,ne=(J?.useCandidates??aG)({target:O?.target??xl,query:B?N:null}),te=W(()=>{if(!A)return[];if(A.kind==="path"){let me=ue=>Z.length>0||ne.length>0?{section:ue}:{},Ae=U?E.map(({folder:ue,entry:ce})=>({id:`path:${ce.kind}:${ue.id}:${ce.path}`,type:"path",path:ce.path,linkPath:pG(ue.cwd,ce.path),pathKind:ce.kind,label:KD(ce.path),description:ce.path.slice(0,Math.max(0,ce.path.lastIndexOf("/"))),section:`folder:${ue.id}`,sectionLabel:ue.name})):X.entries.map(ue=>({id:`path:${ue.kind}:${ue.path}`,type:"path",path:ue.path,pathKind:ue.kind,label:KD(ue.path),description:ue.path.slice(0,Math.max(0,ue.path.lastIndexOf("/"))),...me("files")}));return[...$D(ne),...Ae,...Z.map(ue=>({id:`thread:${ue.reference.environmentId}:${ue.reference.threadId}`,type:"thread",reference:ue.reference,label:C(ue.reference.title),description:[ue.projectLabel,ue.machineLabel].filter(ce=>ce!==null).join(" / "),...me("threads")}))]}if(A.kind==="slash-command"){let me=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:x("composer.switchModelDesc")},...a?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:x("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:x("composer.defaultDesc")}]:[]];return ZA({builtIns:me,plugins:t,provider:n,commands:r?.slashCommands??[],skills:r?.skills??[],showSkills:s,query:A.query,recentIds:i,providerDescription:x("composer.runProviderCommand")})}if(A.kind==="skill"||A.kind==="slash-skill"){let me=A.kind==="skill"?r?.skills??[]:aA(r?.skills??[],s);return AD(me,A.query).map(Ae=>({id:`skill:${n}:${Ae.name}`,type:"skill",provider:n,skill:Ae,label:nn(Ae),description:Ae.shortDescription??Ae.description??""}))}return[]},[C,t,A,a,i,n,r,s,x,Z,ne,E,U,X.entries]),le=A!==null&&!(A.kind==="slash-skill"&&te.length===0),ge=A?`${A.kind}:${A.query.trim().toLowerCase()}`:null,re=W(()=>{let me=ZC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});return te.find(Ae=>Ae.id===me)??null},[te,I,ge,S]),ee=P(()=>{let me=p(),Ae=Eo(me.value,me.expandedCursor),ue=w!==null&&ou(Ae)===w?null:Ae;return{snapshot:me,trigger:ue}},[p,w]),ve=P(me=>{let{snapshot:Ae,trigger:ue}=ee();if(!ue)return;if((me.type==="slash-command"||me.type==="provider-slash-command"||me.type==="plugin-slash-command"||me.type==="skill")&&y?.(me.id),me.type==="path"||me.type==="thread"||me.type==="member"){let ze=me.type==="path"?Ms(me.linkPath??me.path):me.type==="thread"?F?.serialize(me.reference)??null:J?.serialize(me.candidate)??null;if(ze===null)return;let et=`${ze} `,Et=zD(Ae.value,ue.rangeEnd,et);f(ue.rangeStart,Et,et,{expectedText:Ae.value.slice(ue.rangeStart,Et)})&&T(null);return}if(me.type==="slash-command"){if(me.command==="model"){f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Ae.value.slice(ue.rangeStart,ue.rangeEnd),focusEditorAfterReplace:!1})&&(T(null),h());return}g(me.command==="plan"?"plan":"default"),f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Ae.value.slice(ue.rangeStart,ue.rangeEnd)})&&T(null);return}let ce=me.type==="provider-slash-command"||me.type==="plugin-slash-command"?`/${me.command.name} `:`$${me.skill.name} `,Ze=zD(Ae.value,ue.rangeEnd,ce);f(ue.rangeStart,Ze,ce,{expectedText:Ae.value.slice(ue.rangeStart,Ze)})&&(T(null),me.type==="plugin-slash-command"&&o?.({pluginId:me.pluginId,name:me.command.name}))},[f,g,h,y,o,ee,F,J]);H(()=>{if(!le){T(null),R(null);return}let me=ZC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});T(Ae=>Ae===me?Ae:me),R(Ae=>Ae===ge?Ae:ge)},[I,S,te,le,ge]);let he=P(me=>{T(me),R(ge)},[ge]),Ne=P(()=>{let{trigger:me}=ee();return me===null||me.kind==="slash-skill"&&!le?!1:(k(ou(me)),T(null),!0)},[le,ee]),De=P(me=>{k(ou(Eo(me,me.length))),L(null),T(null)},[]),je=P((me,Ae)=>{let ue=on(me,Ae),ce=Eo(me,ue);L(ce);let Ze=ou(ce);k(pt=>pt!==null&&pt!==Ze?null:pt),T(null),R(null)},[]),nt=P(()=>{T(null)},[]);return{composerTrigger:b,menuTrigger:A,composerMenuItems:te,composerMenuOpen:le,composerMenuSearchKey:ge,activeComposerMenuItem:re,resolveActiveComposerTrigger:ee,onSelectComposerItem:ve,onComposerMenuItemHighlighted:he,onMenuEscape:Ne,resetForDocumentChange:je,dismissTrigger:nt,dismissTriggerIn:De,pathSearchPending:Y,highlightedItemId:I,setTrigger:L,setHighlightedItemId:T,setHighlightedSearchKey:R}}function KD(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}$();function WD(e,t){let o=W(()=>gp((e??[]).filter(wr)),[e]);return P((n,r)=>{let a=jw(n,r,o,CC);a!==null&&t(a.start,a.end,a.replacement,{expectedText:r.slice(a.start,a.end)})},[t,o])}var GD=pe(function(t){let{handleRef:o,api:n,composerDraftTarget:r,composerDocumentKey:a,promptRef:s,editorRef:i,menuAnchor:d,resolvedTheme:c,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,onSlashCommandUsed:x,onOpenModelPicker:C,onInteractionModeChange:b,onToggleInteractionMode:L,activePendingProgress:w,activePendingRequestId:k,hasPendingUserInputs:I,changeUserInputCustomAnswer:T,terminalContexts:S,showTerminalContexts:R,showEditor:A,isApprovalState:N,editorClassName:B,placeholder:O,disabled:V,onPaste:U,onSubmit:D,isMobileViewport:X,isDraftRoute:j,stashMenuOpen:E,stashEntries:Y,onRestoreStashEntry:F,onDeleteStashEntry:Z,onCloseStashMenu:J,onPromptEdited:ne,onUnclaimedEscape:te}=t,le=n.draft.useThreadDraftSelector(r,_D),ge=n.draft.useThreadDraftSelector(r,OD),re=Co(),ee=(re?.data.useSentMessagesReader??FD)(re?.target??xl),ve=n.draft.useStore,he=ve(Ce=>Ce.setPrompt),Ne=ve(Ce=>Ce.setTerminalContexts),De=ve(Ce=>Ce.removeTerminalContext),je=uo(le,le.length),nt=Fr(a,le,{cursor:je,expandedCursor:le.length}),[me,Ae]=q(()=>({documentKey:a,cursor:nt.cursor})),ue=me.documentKey===a?me.cursor:nt.cursor,ce=P(Ce=>{Ae(Ue=>{let at=Ue.documentKey===a?Ue.cursor:Fr(a,s.current).cursor,Lt=typeof Ce=="function"?Ce(at):Ce,wt=s.current,Ft=on(wt,Lt);return YM(a,wt,Lt,Ft),Ue.documentKey===a&&Ue.cursor===Lt?Ue:{documentKey:a,cursor:Lt}})},[a,s]),Ze=M(!1),pt=M(!1),ze=M([]),et=M(null),Et=P(Ce=>{he(r,Ce)},[r,he]),ft=P((Ce,Ue,at,Lt,wt)=>{T(Ce,Ue,at,Lt,wt),s.current=Ue},[T,s]),Ct=P((Ce,Ue,at,Lt)=>{let wt=s.current,Ft=Math.max(0,Math.min(wt.length,Ce)),Mo=Math.max(Ft,Math.min(wt.length,Ue));if(Lt?.expectedText!==void 0&&wt.slice(Ft,Mo)!==Lt.expectedText)return!1;let sn=qM(s.current,Ce,Ue,at),Hr=uo(sn.text,sn.cursor),Pa=on(sn.text,Hr);s.current=sn.text;let Fs=w?.activeQuestion;return Fs&&I?ft(Fs.id,sn.text,Hr,Pa,!1):Et(sn.text),ce(Hr),Xt(Eo(sn.text,Pa)),Lt?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{i.current?.focusAt(Hr)}),!0},[w?.activeQuestion,i,I,ft,s,ce,Et]),gt=P(()=>{let Ce=i.current?.readSnapshot();return Ce||{value:s.current,cursor:ue,expandedCursor:on(s.current,ue),terminalContextIds:S.map(Ue=>Ue.id)}},[ue,i,s,S]),_t=(n.slashCommands?.useCommands??(()=>[]))(h,r),Mt=qD({pluginCommands:_t,onSelectPluginCommand:Ce=>n.slashCommands?.select(r,Ce),prompt:le,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,useComposerPathSearch:n.pathSearch.useComposerPathSearch,useComposerPathSearchAcross:n.pathSearch.useComposerPathSearchAcross,readComposerSnapshot:gt,applyPromptReplacement:Ct,onInteractionModeChange:b,onOpenModelPicker:C,onSlashCommandUsed:x}),{composerTrigger:se,composerMenuItems:Le,composerMenuOpen:be,activeComposerMenuItem:Ye,resolveActiveComposerTrigger:xt,onComposerMenuItemHighlighted:tt,onMenuEscape:It,pathSearchPending:po,highlightedItemId:jo,setTrigger:Xt,setHighlightedItemId:xn}=Mt,At=se?.kind??null,St=se?.kind==="path"?se.query:"",bt=w?w.customAnswer:le,mo=N?"":bt,kt=Mt.resetForDocumentChange;H(()=>{kt(bt,ue)},[a,kt,bt,ue]),pt.current=be,ze.current=Le,et.current=Ye;let Ot=At==="path"&&St.length>0&&po===!0,Yt=P(Ce=>{let Ue=S.findIndex(wt=>wt.id===Ce);if(Ue<0)return;let at=n.terminalContext.removeInlinePlaceholder(s.current,Ue);s.current=at.prompt,Et(at.prompt),De(r,Ce);let Lt=uo(at.prompt,at.cursor);ce(Lt),Xt(Eo(at.prompt,at.cursor))},[n.terminalContext,r,s,De,ce,Et,S,Xt]);fe(()=>{s.current=le,ce(Ce=>vn(le,Ce))},[a,le,s,ce]),H(()=>{ne(le)},[ne,le]),H(()=>{be&&J()},[be,J]);let rt=M(null);H(()=>{let Ce=w?.customAnswer;if(typeof Ce!="string"){if(rt.current!==null){s.current=le;let Mo=uo(le,le.length);ce(Mo),Xt(Eo(le,on(le,Mo)))}rt.current=null;return}let Ue=k,at=w?.activeQuestion?.id??null,Lt=rt.current?.requestId!==Ue||rt.current?.questionId!==at,wt=s.current!==Ce;if(rt.current={requestId:Ue,questionId:at},!Lt&&!wt)return;s.current=Ce;let Ft=uo(Ce,Ce.length);ce(Ft),Xt(Eo(Ce,on(Ce,Ft))),xn(null)},[w?.customAnswer,w?.activeQuestion?.id,k,le,s]);let dt=WD(m?.skills,Ct),Ht=P((Ce,Ue,at,Lt,wt)=>{if(w?.activeQuestion&&I){if(w.activeQuestion.allowFreeform===!1)return;ce(Ue),Xt(Lt?null:Eo(Ce,at)),ft(w.activeQuestion.id,Ce,Ue,at,Lt);return}let Ft=s.current;s.current=Ce,Et(Ce),HD(S,wt)||Ne(r,BD(S,wt)),ce(Ue),Xt(Lt?null:Eo(Ce,at)),n.slashCommands?.readBinding(r)||dt(Ft,Ce)},[w?.activeQuestion,dt,I,ft,s,ce,Et,r,S,Ne,Xt]),Ut=Mt.onSelectComposerItem,Jt=P(Ce=>{Ze.current||(Ze.current=!0,window.requestAnimationFrame(()=>{Ze.current=!1}),Ut(Ce))},[Ut]),Vo=P(Ce=>{if(Le.length===0)return;let Ue=Le.findIndex(Mo=>Mo.id===jo),wt=((Ue>=0?Ue:Ce==="ArrowDown"?-1:0)+(Ce==="ArrowDown"?1:-1)+Le.length)%Le.length,Ft=Le[wt];xn(Ft?.id??null)},[jo,Le,xn]),fo=Mt.dismissTriggerIn,go=P(Ce=>{s.current=Ce,Et(Ce),ce(uo(Ce,Ce.length)),fo(Ce)},[fo,s,ce,Et]),Zt=MD({documentKey:a,promptRef:s,editorRef:i,blocked:ge||I||N||V||E,readSentMessages:ee,show:go}),Kn=(Ce,Ue)=>{if(Ce==="Escape")return Ue.isComposing||Ue.keyCode===229?!1:It()||(te?.()??!1);if(Ce==="Tab"&&Ue.shiftKey)return p?(L(),!0):!1;if((Ce==="ArrowUp"||Ce==="ArrowDown")&&Zt(Ce,Ue))return!0;let{trigger:at}=xt();if(pt.current||at!==null){let Ft=ze.current,Mo=et.current??Ft[0];if(Ce==="ArrowDown"&&Ft.length>0)return Vo("ArrowDown"),!0;if(Ce==="ArrowUp"&&Ft.length>0)return Vo("ArrowUp"),!0;if((Ce==="Enter"||Ce==="Tab")&&Mo)return Jt(Mo),!0}let wt=Ce==="Enter"?UM({isMobileViewport:X,shiftKey:Ue.shiftKey,modifierKey:Ue.metaKey||Ue.ctrlKey,isDraftThread:j}):null;return wt?(D(void 0,wt),!0):!1};return fr(o,()=>({readSnapshot:gt,readDraftPrompt:()=>le,applyPromptReplacement:Ct,syncCursor:(Ce,Ue)=>{ce(Ce),Xt(Ue)},resetCursorState:Ce=>{let Ue=Ce?.prompt??s.current,at=vn(Ue,Ce?.cursor??0);xn(null),ce(at),Xt(Ce?.detectTrigger?Eo(Ue,on(Ue,at)):null)}}),[Ct,le,s,gt,ce,xn,Xt]),v(oe,{children:[E&&!be&&!N&&l(JC,{anchor:d,children:l(RD,{entries:Y,onRestore:F,onDelete:Z,onClose:J})}),be&&!N&&l(JC,{anchor:d,children:l(ID,{environmentId:h,items:Le,resolvedTheme:c,isLoading:Ot,triggerKind:At,activeItemId:Ye?.id??null,onHighlightedItemChange:tt,onSelect:Jt})}),A?l(ml,{editorRef:i,documentKey:a,value:mo,cursor:ue,terminalContexts:R?S:ND,skills:m?.skills??DD,...B?{className:B}:{},onRemoveTerminalContext:Yt,onChange:Ht,onCommandKeyDown:Kn,onPaste:U,placeholder:O,disabled:V}):null]})});function jD({message:e}){return e?l("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive-foreground sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function VD(e){let{t}=z(),{message:o,agentNotChosen:n,agentUnavailable:r,agentUnavailableNoChoice:a,modelSendBlock:s,selectedModelStatus:i,modelNotes:d,onChooseModel:c}=e;return v(oe,{children:[l(jD,{message:o}),n?l("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,r?l("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:t(a?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,d.map(u=>l("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-note":u.kind,children:WN(t,u)},`${u.kind}:${u.kind==="option-unsupported"?u.optionId:""}`)),s===null?null:v("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":i,children:[t(s.blockKey),s.canChooseModel?l(K,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{c()},children:t("composer.chooseModel")}):null]})]})}function QD(e){let{t}=z(),o=$C();return!e.eligible||o==="unsupported"?null:l("p",{className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-group-send":"true","data-chat-composer-group-send-state":o,children:t(o==="ready"?"composer.groupSendHint":o==="error"?"composer.groupSendRosterFailed":"composer.groupSendRosterWaiting")})}function XD(e){let{t}=z();if(!e.mode)return null;let o=e.unavailableReason??t(e.isMobileViewport?"composer.shellCommand.touchHint":"composer.shellCommand.hint");return v("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-start gap-1.5 px-1 pb-1 text-xs",children:[l(To,{"aria-hidden":"true",className:"mt-0.5 size-3.5 shrink-0 text-primary"}),l("span",{className:"shrink-0 font-medium text-primary",children:t("composer.shellCommand.mode")}),l("span",{className:"min-w-0 flex-1 wrap-break-word text-muted-foreground",children:o})]})}var mG=[];function YD(e){let{t}=z(),{props:o,model:n,status:r,submit:a,badges:s,traits:i,composerDraft:d}=e,c=e.pendingUserInputs.length>0,u=W(()=>e.composerImages.filter(b=>or(b)==="image"),[e.composerImages]),m=W(()=>new Set(e.nonPersistedComposerImageIds),[e.nonPersistedComposerImageIds]),p=e.isMobileViewport&&!e.isComposerCollapsedMobile&&e.pendingPrimaryAction!==null,f=r.phase==="running"&&!e.pluginAction||r.isSendBusy||r.projectSelectionRequired||r.environmentUnavailable!==null||!d.hasSendableContent,g=!e.isComposerCollapsedMobile&&!e.isComposerApprovalState,h=Jf({activeThreadId:r.activeThread?.id??null,isLocalDraftThread:o.routeKind==="draft",isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.activePendingProgress!==null,hasPendingAction:e.pendingPrimaryAction!==null,shellCommandMode:a.shellCommandMode}),y=aD({machineUnavailable:r.environmentUnavailable!==null,sessionStarted:r.activeThread?.session!=null,sessionDisconnected:r.phase==="disconnected"}),x=sD(y),C=iD({t,tailPlaceholderKey:x,isComposerApprovalState:e.isComposerApprovalState,activePendingProgress:e.activePendingProgress!==null,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable});return l("div",{"data-chat-composer-main-surface":"true",className:"group relative z-10 rounded-composer p-px transition-colors duration-200",children:v("div",{ref:e.surfaceRef,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":e.isComposerCollapsedMobile?"true":"false",className:G("rounded-[20px] transition-[background-color] duration-200",e.isDragOverComposer?"bg-accent/45 ring-1 ring-primary/70":null,r.projectSelectionRequired?"opacity-75":null),children:[o.firstRow?l("div",{className:"@container/composer-first-row flex select-none items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:o.firstRow}):null,l(eD,{decisionOccupiesComposer:e.isComposerApprovalState}),e.showCollapsedMobilePromptRow?l(bD,{pluginAction:e.pluginAction,api:o.api,composerDraftTarget:o.composerDraftTarget,pendingCustomAnswer:e.activePendingProgress?e.activePendingProgress.customAnswer:null,noProviderAvailable:n.noProviderAvailable,groupSendEligible:h,modelSendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,environmentUnavailable:r.environmentUnavailable!==null,projectSelectionRequired:r.projectSelectionRequired,onExpand:e.expandMobileComposer,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,submitDisabled:f,submitLabel:t("composer.sendMessage"),onSubmit:()=>a.submitComposerOrShellCommand()}):null,l(fG,{input:e,pendingUserInputs:c,showMobilePendingAnswerActions:p,composerPreviewableImages:u,nonPersistedComposerImageIdSet:m,composerPlaceholder:C}),l(VD,{message:e.providerInputSubmissionError??a.composerSubmissionError,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,agentUnavailableNoChoice:n.agentUnavailableNoChoice,modelSendBlock:n.modelSendBlock,selectedModelStatus:n.selectedModelStatus,modelNotes:n.modelNotes,onChooseModel:e.openModelPicker}),l(QD,{eligible:h}),g?l(xD,{pluginAction:e.pluginAction,isComposerFooterCompact:e.isComposerFooterCompact,isComposerPrimaryActionsCompact:e.isComposerPrimaryActionsCompact,isMobileViewport:e.isMobileViewport,showMobilePendingAnswerActions:p,hasPendingUserInputs:c,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable,composerAttachmentInputRef:e.composerAttachmentInputRef,onComposerAttachmentInputChange:e.onComposerAttachmentInputChange,slots:o.slots,selectedInstanceId:n.selectedInstanceId,unavailableAgentInstanceId:r.unavailableAgentInstanceId,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,providerInstanceEntries:n.providerInstanceEntries,lockedProvider:r.lockedProvider,lockedContinuationGroupKey:n.lockedContinuationGroupKey,onAgentInstanceChange:n.onAgentInstanceChange,selectedModelForPickerWithCustomFallback:n.selectedModelForPickerWithCustomFallback,selectedModelStatus:n.selectedModelStatus,selectedModelUnconfirmed:n.selectedModelUnconfirmed,keybindings:o.keybindings,modelOptionsByInstance:n.modelOptionsByInstance,terminalOpen:o.terminalOpen,isComposerModelPickerOpen:e.isComposerModelPickerOpen,setIsComposerModelPickerOpen:e.setIsComposerModelPickerOpen,getModelDisabledReason:o.getModelDisabledReason,getModelContinuationLabel:o.getModelContinuationLabel,onContinueInModel:o.onContinueInModel,onProviderModelSelect:o.onProviderModelSelect,environmentId:o.environmentId,routeKind:o.routeKind,draftId:o.draftId,activeThread:r.activeThread,interactionMode:r.interactionMode,runtimeMode:r.runtimeMode,composerProviderControls:n.composerProviderControls,composerNativeMode:n.composerNativeMode,canSwitchNativeMode:n.canSwitchNativeMode,providerTraitsMenuContent:i.providerTraitsMenuContent,providerTraitsPicker:i.providerTraitsPicker,toggleInteractionMode:o.toggleInteractionMode,handleRuntimeModeChange:o.handleRuntimeModeChange,handleComposerNativeModeChange:n.handleComposerNativeModeChange,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,activeThreadModelDisplayName:n.activeThreadModelDisplayName,pendingPrimaryAction:e.pendingPrimaryAction,phase:r.phase,continuationChecking:r.continuationChecking,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,composerDraft:d,isSendBusy:r.isSendBusy,sendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,groupSendEligible:h,environmentUnavailable:r.environmentUnavailable,handleInterruptPrimaryAction:e.actions.handleInterruptPrimaryAction,interruptArmed:r.interruptArmed,stopping:r.stopping,handleImplementPlanInNewThreadPrimaryAction:e.actions.handleImplementPlanInNewThreadPrimaryAction,shellCommandMode:a.shellCommandMode,shellCommandUnavailableReason:a.hostShellCommand?.unavailableReason??null,compactDisabled:e.compactDisabled,resolvedCompactDisabledReason:n.resolvedCompactDisabledReason,compactThreadContext:e.compactThreadContext}):null]})})}function fG(e){let{input:t,pendingUserInputs:o,showMobilePendingAnswerActions:n}=e,{props:r,model:a,status:s,submit:i,stash:d,composerDraft:c}=t,u=t.activePendingProgress?.activeQuestion?.allowFreeform===!1;return v("div",{ref:t.setComposerMenuAnchor,className:G("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",t.isComposerApprovalState&&"pb-3 sm:pb-4",t.isComposerCollapsedMobile&&"hidden"),children:[l(rD,{api:r.api,environmentId:r.environmentId,composerDraftTarget:r.composerDraftTarget,isComposerCollapsedMobile:t.isComposerCollapsedMobile,isComposerApprovalState:t.isComposerApprovalState,hasPendingUserInputs:o,supportsAttachmentUploads:r.supportsAttachmentUploads,uploadsByImageId:t.uploadsByImageId,composerImages:t.composerImages,composerPreviewableImages:e.composerPreviewableImages,composerBrowserAnnotations:c.browserAnnotations,composerReviewComments:c.reviewComments,composerElementContexts:c.elementContexts,nonPersistedComposerImageIdSet:e.nonPersistedComposerImageIdSet,removeComposerDraftBrowserAnnotation:t.removeComposerDraftBrowserAnnotation,removeComposerDraftReviewComment:t.removeComposerDraftReviewComment,removeComposerDraftElementContext:t.removeComposerDraftElementContext,removeComposerImage:t.removeComposerImage,onExpandImage:r.onExpandImage}),l(XD,{mode:i.shellCommandMode,isMobileViewport:t.isMobileViewport,unavailableReason:i.hostShellCommand?.unavailableReason??null}),v("div",{className:"relative",children:[l(GD,{handleRef:t.promptInputRef,api:r.api,composerDraftTarget:r.composerDraftTarget,composerDocumentKey:t.composerDocumentKey,promptRef:r.promptRef,editorRef:t.composerEditorRef,menuAnchor:t.composerMenuAnchor,resolvedTheme:r.resolvedTheme,selectedProvider:a.selectedProvider,selectedProviderStatus:a.selectedProviderStatus,planModeUiEnabled:a.planModeUiEnabled,showSkillsInSlashMenu:r.settings.showSkillsInSlashMenu,recentSlashCommandIds:r.recentSlashCommandIds??mG,environmentId:r.environmentId,gitCwd:r.gitCwd,onSlashCommandUsed:r.onSlashCommandUsed,onOpenModelPicker:t.openModelPicker,onInteractionModeChange:t.switchInteractionMode,onToggleInteractionMode:r.toggleInteractionMode,activePendingProgress:t.activePendingProgress,activePendingRequestId:t.pendingUserInputs[0]?.requestId??null,hasPendingUserInputs:o,changeUserInputCustomAnswer:t.changeUserInputCustomAnswer,terminalContexts:c.terminalContexts,showTerminalContexts:!t.isComposerApprovalState&&!o,showEditor:!u,isApprovalState:t.isComposerApprovalState,editorClassName:n?"max-sm:pb-11":void 0,placeholder:e.composerPlaceholder,disabled:t.isComposerApprovalState||s.projectSelectionRequired,onPaste:t.handleComposerPaste,onSubmit:t.handleComposerSubmit,isMobileViewport:t.isMobileViewport,isDraftRoute:r.routeKind==="draft",stashMenuOpen:t.isStashMenuOpen,stashEntries:d.stashQueue,onRestoreStashEntry:d.restoreStashEntry,onDeleteStashEntry:d.deleteStashEntry,onCloseStashMenu:d.closeStashMenu,onPromptEdited:t.onPromptEdited,onUnclaimedEscape:t.handleUnclaimedEscape}),n?l(gG,{input:t}):null]})]})}function gG(e){let{input:t}=e,{model:o,status:n,badges:r}=t;return v("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,l(yl,{compact:!0,pendingAction:t.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:n.isSendBusy,sendDisabledReason:o.sendDisabledReason,isEnvironmentUnavailable:n.environmentUnavailable!==null||o.noProviderAvailable||n.projectSelectionRequired,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:t.actions.handleInterruptPrimaryAction,interruptArmed:n.interruptArmed,stopping:n.stopping,onImplementPlanInNewThread:t.actions.handleImplementPlanInNewThreadPrimaryAction})]})}function JD(e){let{formRef:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,dragHandlers:a,onDragLeaveCapture:s,badges:i,stashQueueLength:d,isStashMenuOpen:c,stashPulse:u,toggleStashMenu:m,drawers:p,children:f}=e;return v("form",{ref:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,onDragEnterCapture:a.onDragEnter,onDragOverCapture:a.onDragOver,onDragLeaveCapture:s,onDropCapture:a.onDrop,className:G("mx-auto w-full min-w-0 max-w-3xl",i.hasShoulderTab&&"pt-7"),"data-chat-composer-form":"true",children:[p,v("div",{className:"relative",children:[i.showShoulderTabs&&i.visibleTasksProgress&&i.visibleTaskSteps?l(ng,{expanded:!1,hasTrailingShoulder:d>0,onDismiss:i.dismissTasks,onToggle:i.toggleTasksDrawer,progress:i.visibleTasksProgress,steps:i.visibleTaskSteps}):null,i.showShoulderTabs?l(og,{count:d,menuOpen:c,pulseKey:u.key,pulsing:u.active,onToggleMenu:m}):null,f]})]})}function ZD(e){let{t}=z(),n=(e.activePendingProgress?.activeQuestion?.multiSelect??!1)||(e.pendingPrimaryAction?.isLastQuestion??!1);return l("div",{className:"px-3 pb-3 sm:px-4",children:v("div",{"data-chat-composer-mobile-pending-compact":"true",className:G("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:l("button",{type:"button",className:G("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:r=>r.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?l(yl,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function e_(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}var t_={accept:0,acceptForSession:1,acceptAlways:2,decline:3,cancel:4};function o_(e){return e.map((t,o)=>({option:t,index:o})).toSorted((t,o)=>t_[t.option.decision]-t_[o.option.decision]||t.index-o.index).map(t=>t.option)}function n_(e){return{leading:e.filter(t=>t.decision==="cancel"),trailing:e.filter(t=>t.decision!=="cancel").toReversed()}}function r_(e){return[...e.filter(t=>t.tone!=="primary"),...e.filter(t=>t.tone==="primary")]}$();var hG=2e3,yG="min-h-8 max-w-full py-1.5 whitespace-normal text-start pointer-coarse:min-h-11 pointer-coarse:min-w-11",vG=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 CG(e,t){if(e.displayKind!=="standard")return e.label;switch(e.decision){case"cancel":return t("composer.cancel");case"decline":return t("composer.decline");case"acceptForSession":return t("composer.alwaysAllowSession");case"acceptAlways":return t("composer.alwaysAllow");case"accept":return t("composer.approve");default:return e.label}}function xG(e,t){let o=[];return t<9&&o.push(String(t+1)),e==="accept"&&o.push("Enter"),e==="cancel"&&o.push("Escape"),o.length>0?o.join(" "):void 0}var ag=pe(function({requestId:t,isResponding:o,options:n,keybindings:r,declineReasonRelay:a,shortcuts:s=!0,onRespondToApproval:i}){let{t:d}=z(),c=o_(n??vG(d)),u=lt(),m=(a==="native"||a==="queued")&&c.some(T=>T.decision==="decline"),[p,f]=q(!1),[g,h]=q(""),y=M([]);H(()=>{h(""),f(!1)},[t]);let x=P(T=>{let S=T==="decline"?g.trim():"";i(t,T,S.length>0?S:void 0)},[g,i,t]),C=P(T=>{if(T==="decline"&&m&&!p){f(!0);return}x(T)},[m,p,x]),b=P(T=>{let S=y.current.filter(N=>N!==null);if(S.length===0)return;let R=S.findIndex(N=>N===document.activeElement),A=R===-1?T===1?0:S.length-1:(R+T+S.length)%S.length;S[A]?.focus()},[]);if(u.pane.useKeydown(T=>{if(!s||o||T.defaultPrevented||u.terminalFocus.getOwner()!==null||T.isComposing||T.keyCode===229||T.key==="Enter"&&!T.metaKey&&!T.ctrlKey&&!T.altKey&&!T.shiftKey&&YI(T.target))return;let S=rr(T.target);if(r&&(!S||T.metaKey||T.ctrlKey||T.altKey)){let N=u.keybindings.approvalDecisionFromCommand(u.keybindings.resolveShortcutCommand(T,r));if(N!==null&&c.some(B=>B.decision===N)){T.preventDefault(),x(N);return}}if(S)return;let R=JI(T,c);if(R===null)return;if(T.preventDefault(),R.type==="move"){b(R.delta);return}let A=c[R.index];A&&C(A.decision)},{target:"document"}),p)return v("div",{className:"flex w-full min-w-0 flex-col gap-1.5",children:[v("div",{className:"flex min-w-0 items-center gap-1",children:[l(Yr,{type:"text",value:g,autoFocus:!0,disabled:o,maxLength:hG,placeholder:d("approval.declineReasonPlaceholder"),"aria-label":d("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-0 flex-1 pointer-coarse:min-h-11",onChange:T=>h(T.target.value),onKeyDown:T=>{if(!(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)){if(T.key==="Enter"){T.preventDefault(),x("decline");return}T.key==="Escape"&&(T.preventDefault(),g.length>0?h(""):f(!1))}}}),l(K,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-foreground",disabled:o,onClick:()=>f(!1),children:d("approval.actions.back")}),l(K,{size:"sm","data-approval-decision":"decline",disabled:o,onClick:()=>x("decline"),children:d("composer.decline")})]}),a==="queued"?l("p",{className:"text-chat-row text-muted-foreground",children:d("approval.declineReasonQueuedNote")}):null]});let{leading:L,trailing:w}=n_(c),k=[...L,...w];y.current.length=k.length;let I=T=>{let S=c.indexOf(T),R=k.indexOf(T),A=s&&S<9?S+1:null,N=T.decision==="accept";return v(K,{ref:B=>{y.current[R]=B},size:"sm",variant:N?"default":"ghost",style:{height:"auto"},"data-approval-decision":T.decision,"aria-keyshortcuts":s?xG(T.decision,S):void 0,className:G(yG,!N&&"text-muted-foreground hover:text-foreground"),disabled:o,onClick:()=>C(T.decision),children:[l("span",{className:"min-w-0 wrap-anywhere",children:CG(T,d)}),A===null?null:l(ai,{className:wi,children:A})]},T.decision)};return v("div",{className:"flex w-full min-w-0 flex-wrap items-center gap-1",children:[L.map(I),l("span",{className:"flex-1"}),w.map(I)]})});$();function s_(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let o=a_(t.oldText??""),n=a_(t.newText);if(o.length===0&&n.length===0)return null;let r=`--- a/${e.path}
|
|
3571
|
+
${F.prompt}`:F.prompt,de=te!==ae;if(de&&(r.current=te,c(d,te),a.current?.syncCursor(uo(te,te.length),null)),F.attachments.length>0){let ne=new Set(i.current.map(Ae=>Ae.id)),Z=new Set(i.current.map(Ae=>`${Ae.mimeType}\0${Ae.sizeBytes}\0${Ae.name}`)),ve=F.attachments.filter(Ae=>!ne.has(Ae.id)&&!Z.has(`${Ae.mimeType}\0${Ae.sizeBytes}\0${Ae.name}`)),he=t.draft.hydrateImagesFromPersisted(ve);he.length>0&&u(d,he)}let ge=[];F.droppedImageNames.length>0&&ge.push(o("composer.stashImagesTooLarge",{names:F.droppedImageNames.join(", ")})),F.unreadableImageNames&&F.unreadableImageNames.length>0&&ge.push(o("composer.stashImagesUnreadable",{names:F.unreadableImageNames.join(", ")})),ge.length>0&&t.notify.warning(o("composer.someImagesNotRestored"),ge.join(" ")),de&&window.requestAnimationFrame(()=>{s.current?.focusAtEnd()})},[u,d,i,r,c,o,B]),D=R(F=>{let{durable:ee}=B(F.id);ee||t.notify.warning(o("composer.stashEntryMayReturn"),o("composer.storageRejectedDelete"))},[o,B]),J=R(async()=>{let F=r.current.split(mr).join("").trim(),ee=[...i.current];if(F.length===0&&ee.length===0){p(de=>!de);return}let Y=`${_C(d)}\0${F}\0${ee.map(de=>de.id).join(",")}`;if(S.current.has(Y))return;S.current.add(Y);let ae=d,te=Es();try{let{evicted:de,written:ge,durable:ne}=N({id:te,createdAt:new Date().toISOString(),prompt:F,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:ee.length});if(!ge){t.notify.error(o("composer.couldNotStash"),o("composer.storageRejectedWrite"));return}ne||t.notify.warning(o("composer.stashNotSurvive"),o("composer.storageUnavailableMemory")),r.current="",m(ae);for(let me of ee)t.uploads.release(me.id);a.current?.syncCursor(0,null),j(),de&&t.notify.warning(o("composer.oldestStashDiscarded"),o("composer.oldestStashDiscardedDetail",{count:t.stash.maxEntries}));let Z=[],ve=[],he=[];for(let me of ee){let Me=await t.imageCompression.compressForStash(me.file);if(!Me.ok){(Me.reason==="too-large"?ve:he).push(me.name);continue}Z.push({id:me.id,name:me.name,mimeType:Me.image.mimeType,sizeBytes:Me.image.sizeBytes,dataUrl:Me.image.dataUrl})}let{kept:Ae,droppedNames:De}=t.stash.partitionAttachments(Z),{attached:je,durable:ot}=O(te,{attachments:Ae,droppedImageNames:[...ve,...De],unreadableImageNames:he});je?!ot&&ne&&ee.length>0&&t.notify.warning(o("composer.stashImagesNotSaved"),o("composer.stashImagesMissingOnReload")):Ae.length>0&&t.notify.warning(o("composer.stashImagesDidNotAttach"),o("composer.stashImagesDidNotAttachDetail",{count:Ae.length}))}finally{S.current.delete(Y)}},[m,d,i,O,r,j,N,o]),G=R(()=>{p(F=>!F)},[]),M=R(()=>{if(g){h(),p(!0);return}G()},[h,g,G]),X=R(()=>{p(!1)},[]);return t.pane.useKeydown(F=>{if(t.keybindings.resolveShortcutCommand(F,y,{context:{terminalFocus:t.terminalFocus.getOwner()!==null,terminalOpen:x,modelPickerOpen:C}})==="composer.stash"&&(F.preventDefault(),F.stopPropagation(),!t.commandPalette.isOpen())){if(b&&!L){p(Y=>!Y);return}L||w||k||J()}},{capture:!0}),{stashQueue:A,restoreStashEntry:U,deleteStashEntry:D,toggleStashMenu:G,toggleInlineStashMenu:M,closeStashMenu:X}}$();function OW(e,t,o){return{...$g({id:Es(),name:t.name||e.t("attachments.defaultFileName"),mimeType:t.type||"application/octet-stream",sizeBytes:t.size,...o?{source:o}:{}}),previewUrl:URL.createObjectURL(t),file:t}}async function kN(e,t,o){let{t:n,supportsAttachmentUploads:r,inlineAttachmentMaxBytes:a}=e;if(!e.activeThreadId||t.length===0)return;if(e.answerQuestionsFirst){e.notifyError(n("attachments.answerQuestionsFirst"));return}let s=e.activeThreadId,i=e.attachmentDocumentKey,d=e.pendingCompressions,c=d.get(i)??0,u=[],m=null;for(let p of t){if(p.size<=0){m=n("attachments.empty",{name:p.name});continue}u.push(p)}if(e.setThreadError(s,m),u.length!==0){d.set(i,c+u.length);try{let p=[],f=null;for(let g of u){let h=await e.imageCompression.prepareFileForAttachment(g,e.attachmentUploadsCapabilityKnown&&!r?a:Number.POSITIVE_INFINITY);if(!h.ok){let x=e.imageCompression.attachmentPreparationError(h,g.name);f=n(x.key,x.values);continue}if(h.kind!=="image"){p.push(OW(e,h.file,h.kind==="file"?o?.source:void 0));continue}let y=h.file;p.push({...$g({id:Es(),name:y.name||n("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),f!==null&&e.setThreadError(s,f)}finally{let p=(d.get(i)??0)-u.length;p>0?d.set(i,p):d.delete(i)}}}function LN(e){let{api:t,t:o,limits:n,setThreadError:r,activeThreadId:a,answerQuestionsFirst:s,attachmentTarget:i,attachmentDocumentKey:d,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,pendingImageCompressionsRef:m,addComposerDraftImage:p,addComposerDraftImages:f,removeComposerDraftImage:g}=e,h=R(w=>{p(i,w)},[i,p]),y=R(w=>{f(i,w)},[i,f]),x=R(w=>{t.uploads.release(w),g(i,w)},[t.uploads,i,g]),C=(w,k)=>kN({activeThreadId:a,answerQuestionsFirst:s,notifyError:I=>t.notify.error(I),t:o,setThreadError:r,attachmentDocumentKey:d,pendingCompressions:m.current,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,inlineAttachmentMaxBytes:n.inlineAttachmentMaxBytes,imageCompression:t.imageCompression,addImage:h,addImages:y},w,k);return{addComposerImages:C,removeComposerImage:w=>{x(w)},onComposerAttachmentInputChange:w=>{let k=Array.from(w.target.files??[]);w.target.value="",k.length!==0&&C(k)}}}$();var PN=e=>({images:e.images,nonPersistedImageIds:e.nonPersistedImageIds});function FW(e){let{supported:t,attachments:o,environmentId:n,threadId:r,requestId:a,question:s,responding:i}=e,d=s?.id,c=s?.allowFreeform;return W(()=>t&&a!==null&&d!==void 0&&c!==!1&&!i&&r?o.questionDraftTarget({environmentId:n,threadId:r,requestId:a,questionId:d}):null,[c,o,n,d,a,i,t,r])}function RN(e){let t=FW(e),o=t??e.composerDraftTarget,n=t?[e.environmentId,e.composerDraftTarget,"question",t].join("\0"):[e.environmentId,e.composerDraftTarget].join("\0");return{questionAttachmentTarget:t,attachmentTarget:o,attachmentDocumentKey:n}}$();function EN(e,t){let o=_n.indexOf(e);if(o===-1)return _n[0];let n=(o+t+_n.length)%_n.length;return _n[n]??_n[0]}function MN(e){let{composerRef:t,sendContextRef:o,api:n,t:r,limits:a,composerData:s,refs:i,composerDraftTarget:d,activeThread:c,addComposerImages:u,addDroppedFolders:m,focusComposer:p,insertComposerTextAtEnd:f,insertComposerDraftTerminalContext:g,composerBrowserAnnotations:h,composerReviewComments:y,isComposerApprovalState:x,pendingUserInputCount:C,projectSelectionRequired:b,noProviderAvailable:L,modelState:w,handleRuntimeModeChange:k,runtimeMode:I,setIsComposerModelPickerOpen:T,setProviderInputSubmissionError:S}=e,{composerEditorRef:P,promptInputRef:A,promptRef:N,composerImagesRef:B,composerTerminalContextsRef:O,composerElementContextsRef:j}=i,{selectedModel:U,selectedModelOptionsForDispatch:D,selectedModelSelection:J,selectedModelStatus:G,selectedNativeModeId:M,selectedProvider:X,selectedProviderEntry:F,selectedProviderModels:ee,composerNativeMode:Y,canSwitchNativeMode:ae,handleComposerNativeModeChange:te}=w,de=R(()=>A.current?.readSnapshot()??{value:N.current,cursor:uo(N.current,N.current.length),expandedCursor:N.current.length,terminalContextIds:O.current.map(ne=>ne.id)},[O,N]),ge=()=>({prompt:N.current,slashSources:{builtIns:["model",...w.planModeUiEnabled?["plan","default"]:[]],skills:w.selectedProviderStatus?.skills??[],commands:w.selectedProviderStatus?.slashCommands??[]},images:B.current,terminalContexts:O.current,elementContexts:j.current,browserAnnotations:h,reviewComments:y,selectedModelOptionsForDispatch:D,selectedModelSelection:J,...M?{selectedNativeModeId:M}:{},providerAvailable:F!==void 0,selectedProvider:X,selectedModel:U,selectedModelStatus:G,selectedProviderModels:ee});o.current=ge,pr(t,()=>({focusAtEnd:()=>{P.current?.focusAtEnd()},focusAt:Z=>{P.current?.focusAt(Z)},addDroppedFiles:Z=>{u(Z),p()},addDroppedFolders:Z=>{m(Z),p()},insertTextAtEnd:f,toggleModelPicker:()=>{T(Z=>!Z)},cyclePermissionMode:Z=>{if(Y===null){k(EN(I,Z));return}let{modes:ve,current:he}=Y;if(!ae||ve.length<2)return;let Ae=ve.findIndex(je=>je.id===he.id),De=ve[(Ae+Z+ve.length)%ve.length];De!==void 0&&te(De.id)},readSnapshot:de,resetCursorState:Z=>{A.current?.resetCursorState(Z)},addTerminalContext:Z=>{if(!c)return;let ve=de(),he=n.terminalContext.insertInlinePlaceholder(ve.value,ve.expandedCursor),Ae=uo(he.prompt,he.cursor);g(d,he.prompt,{id:Es(),threadId:c.id,createdAt:new Date().toISOString(),...Z},he.contextIndex)&&(N.current=he.prompt,A.current?.syncCursor(Ae,Po(he.prompt,he.cursor)),window.requestAnimationFrame(()=>{P.current?.focusAt(Ae)}))},readSendIdentity:()=>({prompt:N.current}),getSendContext:ge,validateProviderInput:Z=>{let ve=PC({prompt:N.current,providerInput:s.assistantQuotes.expandForProvider(Z),submissionTarget:"provider-turn",maxInputChars:a.maxInputChars,t:r});return S(ve),ve===null}}),[c,u,d,g,N,B,O,j,h,y,p,x,C,b,de,U,D,J,M,L,X,ee,s,ge,o,a.maxInputChars,Y,ae,te,k,I,r])}$();function AN(e){let{composerImages:t,composerImagesRef:o,composerTerminalContexts:n,composerTerminalContextsRef:r,composerElementContexts:a,composerElementContextsRef:s}=e;fe(()=>{o.current=t},[t,o]),fe(()=>{r.current=n},[n,r]),fe(()=>{s.current=a},[a,s])}$();var BW=['[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 HW(e){return e.closest(BW)!==null}function NN(e){let{isMobileViewport:t,forceExpandedOnMobile:o,composerEditorRef:n,composerSurfaceRef:r,composerFormRef:a}=e,[s,i]=q(!1),d=t&&!o&&!s,c=E(null),u=E(null),m=E(null),p=E(!1),f=R(()=>{if(!t)return;c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null);let x=document.activeElement;x instanceof HTMLElement&&x.blur(),i(!1)},[t]),g=R(()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current),p.current=!0,i(!0),u.current=window.requestAnimationFrame(()=>{u.current=null,n.current?.focusAtEnd(),m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1})})},[]),h=R(()=>{t&&(p.current||(c.current!==null&&window.cancelAnimationFrame(c.current),c.current=window.requestAnimationFrame(()=>{if(c.current=null,p.current)return;let x=r.current,C=a.current,b=document.activeElement;b instanceof Element&&HW(b)||b instanceof Node&&(x&&x.contains(b)||C&&C.contains(b))||i(!1)})))},[t]);return H(()=>()=>{c.current!==null&&window.cancelAnimationFrame(c.current),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current)},[]),{isComposerCollapsedMobile:d,blurMobileComposerAfterSend:f,expandMobileComposer:g,scheduleComposerCollapseCheck:h,handleFormFocusCapture:x=>{let C=x.target;d&&C instanceof HTMLElement&&C.closest('[data-chat-composer-collapsed-controls="true"]')||(c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),i(!0))}}}$();function DN(e){let{t,threadId:o,setThreadError:n,promptRef:r,promptInputRef:a,respondToApproval:s,respondToDecision:i,selectUserInputOption:d,activePendingProgress:c,activePendingIsResponding:u,activePendingResolvedAnswers:m}=e,p=W(()=>c?{questionIndex:c.questionIndex,isLastQuestion:c.isLastQuestion,canAdvance:c.canAdvance,isResponding:u,isComplete:!!m}:null,[u,c,m]),f=R((y,x)=>{d(y,x),r.current="",a.current?.resetCursorState({cursor:0})},[r,d]),g=R(async(y,x,C)=>{try{await s(y,x,C)}catch(b){n(o,b instanceof Error?b.message:t("approval.respondFailed"))}},[o,s,n,t]),h=R((y,x)=>i(y,x).then(C=>{C!==null&&n(o,C)}),[o,i,n]);return{pendingPrimaryAction:p,onSelectActivePendingUserInputOption:f,onRespondToApproval:g,onRespondToComposerDecision:h}}$();function _N(e){return e.startsWith("!")}function ON(e){return e.slice(1).trim()}function FN(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function UW(){return null}function BN(){let{data:e,target:t,threadKey:o}=Ho();return(e.useShellCommand??UW)({target:t,threadKey:o})}$();function Gf(e){return e.activeThreadId!==null&&!e.isLocalDraftThread&&!e.isComposerApprovalState&&!e.hasPendingProgress&&!e.hasPendingAction&&!e.shellCommandMode}function jf(e,t,o){return e&&t!==void 0?t:o}function Vf(e){let t=e.environmentUnavailable?e.labels.environmentDisconnected:e.projectSelectionRequired?e.labels.chooseProjectToStart:e.pluginAction?null:e.noProviderAvailable&&!e.groupSend?e.labels.enableProviderToSend:jf(e.groupSend,e.groupSendDisabledReason,e.sendDisabledReason);return{disabled:t!==null,reason:t}}function HN({promptRef:e,maxInputChars:t,noProviderAvailable:o,sendDisabledReason:n,groupSendDisabledReason:r,isGroupSend:a,isModelSendBlocked:s,onModelSendBlocked:i,onDispatched:d,activeThreadId:c,activePendingProgress:u,composerDocumentKey:m,pendingImageCompressionsRef:p,onSend:f,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:y}){let{t:x}=z(),[C,b]=q(null),[L,w]=q(!1),k=E(0);H(()=>{k.current+=1,b(null),w(!1)},[m]),H(()=>{n===null&&w(!1)},[n]);let I=R(S=>{b(P=>P===null?P:jc(S,t,x))},[t,x]),T=R((S,P="foreground")=>{let A=a();if(o&&!A){S?.preventDefault();return}if(jf(A,r,n)!==null){S?.preventDefault(),w(!0);return}if(s&&!A){S?.preventDefault(),i();return}if(c&&(p.current.get(m)??0)>0){S?.preventDefault(),g();return}let B=k.current,O=MA({prompt:e.current,submissionTarget:u?"pending-user-input":"provider-turn",maxInputChars:t,t:x,event:S,onSend:U=>f(U,P)}),j=U=>{B===k.current&&(b(U.validationMessage),U.didDispatch&&(d(),h()&&y()))};if(EA(O))return O.then(j);j(O)},[u,c,y,m,s,a,r,t,o,i,d,f,g,p,e,n,h,x]);return{composerSubmissionError:C??(L?jf(a(),r,n):null),setComposerSubmissionError:b,revalidatePromptLength:I,submitComposer:T}}function UN(e){let{api:t,t:o,limits:n,composerDraftTarget:r,composerDraft:a,composerDocumentKey:s,promptRef:i,promptInputRef:d,pendingImageCompressionsRef:c,setComposerDraftPrompt:u,setModelSendBlockShown:m,onSend:p,onCompactContext:f,blurMobileComposerAfterSend:g,isMobileViewport:h,isComposerApprovalState:y,activePendingApproval:x,activePendingProgress:C,activePendingResolvedAnswers:b,pendingUserInputCount:L,activeThreadId:w,phase:k,isSendBusy:I,environmentUnavailable:T,compactDisabled:S,noProviderAvailable:P,isSendDisabled:A,sendDisabledReason:N,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:j,showPlanFollowUpPrompt:U}=e,D=!e.pluginAction&&P,J=!e.pluginAction&&A,G=e.pluginAction?null:N,M=!e.pluginAction&&j,X=BN(),F=t.draft.useThreadDraftSelector(r,De=>_N(De.prompt)),ee=X!==null&&F&&!y&&C===null,Y=R(()=>!h||I||J||D||T!==null||k==="running"?!1:C?C.isLastQuestion&&!!b:U||a.hasSendableContent,[C,b,a.hasSendableContent,T,h,I,J,D,k,U]),{composerSubmissionError:ae,setComposerSubmissionError:te,revalidatePromptLength:de,submitComposer:ge}=HN({promptRef:i,maxInputChars:n.maxInputChars,noProviderAvailable:D,sendDisabledReason:G,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:M,onModelSendBlocked:()=>{m(!0)},onDispatched:()=>{m(!1)},activeThreadId:w,activePendingProgress:C,composerDocumentKey:s,pendingImageCompressionsRef:c,onSend:p,onStillCompressing:()=>{t.notify.info(o("composer.stillCompressing"),o("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:Y,blurMobileComposerAfterSend:g}),ne=E(!1),Z=R(De=>{if(De?.preventDefault(),X===null||ne.current)return;if(X.unavailableReason!==null){te(X.unavailableReason);return}let je=i.current,ot=ON(je),me=FN(ot);if(me==="empty")return;if(me==="multiline"){te(o("composer.shellCommand.singleLine"));return}te(null),ne.current=!0;let Me=r;X.run(ot).then(ue=>{!ue||i.current!==je||(i.current="",u(Me,""),d.current?.syncCursor(0,null))}).finally(()=>{ne.current=!1})},[r,X,i,u,te,o]),ve=R((De,je)=>{if(ee){Z(De);return}ge(De,je)},[Z,ee,ge]),he=R(()=>{if(!ee)return!1;let De=i.current.slice(1);return i.current=De,u(r,De),d.current?.resetCursorState({prompt:De,cursor:De.length}),!0},[r,i,u,ee]),Ae=R(()=>{S||D||x!==null||L>0||k==="running"||I||!w||f()},[x,w,S,I,D,f,L,k]);return{composerSubmissionError:ae,revalidatePromptLength:de,submitComposerOrShellCommand:ve,exitShellCommandMode:he,compactThreadContext:Ae,hostShellCommand:X,shellCommandMode:ee}}$();function BC(){let e=it(),{data:t,target:o}=Ho(),n=e.draft.useThreadDraftSelector(o,a=>a.prompt),r=t.memberMentions?.useMatches({target:o,text:n.trim()});return r===void 0||r.status==="ready"&&r.matches.length===0?"unsupported":r.status}function $W(){return BC()==="ready"}function Qf(e){let t=$W();return e&&t}function $N(e){return R(()=>Gf({activeThreadId:e.activeThreadId,isLocalDraftThread:e.isLocalDraftThread,isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.hasPendingProgress,hasPendingAction:e.hasPendingAction,shellCommandMode:!1})&&(e.memberMentions?.collect(e.target,e.promptRef.current.trim()).length??0)>0,[e.activeThreadId,e.isLocalDraftThread,e.isComposerApprovalState,e.hasPendingProgress,e.hasPendingAction,e.memberMentions,e.target,e.promptRef])}$();$();var Xf=pe(function(t){let{t:o}=z();if(t.count===0)return null;let n=t.placement==="inline",r=l("span",{className:V("text-ui-2xs font-medium 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 n?v(K,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:V("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:[l($s,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):v("button",{type:"button","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:V("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-[var(--control-cursor)] 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:[l($s,{className:"size-3 shrink-0","aria-hidden":"true"}),o("stash.label"),r]})});$();function KN(e){let t=new Map;return e.map(o=>{let n=t.get(o.step)??0;return t.set(o.step,n+1),{key:`${o.step}:${n}`,step:o}})}function zN({className:e,steps:t}){return t.length<=1?null:l("span",{"aria-hidden":!0,className:V("flex w-10 shrink-0 items-center gap-0.5",e),children:KN(t).map(({key:o,step:n})=>l("span",{className:V("h-[3px] min-w-0 flex-1 rounded-full",n.status==="completed"?"bg-success":n.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},o))})}var Yf=pe(function({expanded:t,hasTrailingShoulder:o=!1,onDismiss:n,onToggle:r,placement:a="tab",progress:s,steps:i}){let{t:d}=z();if(s.totalSteps<=0)return null;let c=s.completedSteps>=s.totalSteps,u=d("tasksBadge.ariaLabel",{completed:s.completedSteps,total:s.totalSteps,step:s.step});return a==="inline"?v("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[v(K,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":u,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-3 shrink-0"}),l("span",{children:d("tasksBadge.label")}),l(zN,{steps:i}),v("span",{className:V("font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-2.5"})})]}):v("div",{className:V("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",o?"right-28":"right-4",c&&"text-foreground"),"data-composer-tasks-badge":"true",children:[v("button",{type:"button","aria-expanded":t,"aria-label":u,className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"shrink-0",children:d("tasksBadge.label")}),l("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:s.step}),v("span",{className:V("shrink-0 font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]}),l(zN,{className:"w-20",steps:i})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-3"})})]})}),qN=pe(function({onDismiss:t,onCollapse:o,progress:n,steps:r}){let{t:a}=z(),{formatDuration:s}=_o();return v("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[v("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[v("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:o,onPointerDown:i=>i.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),v("span",{className:"tabular-nums",children:[n.completedSteps,"/",n.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-3"})})]}),l("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:KN(r).map(({key:i,step:d})=>v("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[l("span",{"aria-hidden":!0,className:V("w-3 shrink-0 text-center font-mono text-ui-2xs",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:V("min-w-0 flex-1",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step}),l("span",{className:"ml-auto w-10 shrink-0 text-right text-ui-2xs text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:d.durationMs!==void 0?s(d.durationMs):d.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function WN(e){let{activeThreadId:t,activeThread:o,activeTasksProgress:n,activeTaskSteps:r,isTasksDrawerOpen:a,setIsTasksDrawerOpen:s,dismissedTasksTurnId:i,setDismissedTasksTurnId:d,stashQueue:c,isStashMenuOpen:u,stashPulse:m,toggleInlineStashMenu:p,isComposerApprovalState:f,externalDrawerAttached:g,showComposerTopDrawer:h,isComposerCollapsedMobile:y,hasBlockingComposerTopDrawer:x}=e,C=R(()=>{s(O=>!O)},[]),b=o?.latestTurn?.turnId??null,L=b!==null&&i===b,w=L?null:n,k=L?null:r,I=R(()=>{b!==null&&d(b),s(!1)},[b]),S=c.length>0&&!f&&(g||h||a||y)?l(Xf,{count:c.length,menuOpen:u,placement:"inline",pulseKey:m.key,pulsing:m.active,onToggleMenu:p}):null,A=w!==null&&k!==null&&!a&&!x&&(g||h||y)?l(Yf,{expanded:!1,onDismiss:I,onToggle:C,placement:"inline",progress:w,steps:k}):null,N=!g&&!h&&!a&&!y,B=N&&(c.length>0||w!==null&&k!==null&&w.totalSteps>0);return H(()=>{(w===null||k===null)&&s(!1)},[k,w]),H(()=>{x&&s(!1)},[x]),H(()=>{s(!1)},[t]),{toggleTasksDrawer:C,dismissTasks:I,visibleTasksProgress:w,visibleTaskSteps:k,inlineStashBadge:S,inlineTasksBadge:A,showShoulderTabs:N,hasShoulderTab:B}}$();function GN(e,t){if(!e)return null;let o=t.get(e.instanceId)?.find(n=>n.slug===e.model);return o?IT(o):e.model}function jN(e,t,o){return typeof o=="number"&&o>0?e("contextWindow.compactsAtThreshold",{threshold:o.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}$();function HC(e,t){if(!e)return t("composer.agentPickerLabel");let o=e.agentName?.trim(),n=e.displayName.trim();return o?!n||n===o?o:`${o} (${n})`:n}function UC(e,t){return e.filter(o=>Dd(o)&&yp(o,t))}var $C=pe(function(t){let{t:o}=z(),n=t.instanceEntries.filter(Dd),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(h=>h.instanceId===r)??null,s=t.notChosen===!0&&r===null,i=r!==null||s?null:n.find(h=>h.instanceId===t.activeInstanceId)??null,d=t.lockedProvider!=null&&t.lockedProvider.length>0,c=UC(t.instanceEntries,t),u=c.some(h=>h.instanceId!==t.activeInstanceId),m=t.disabled||!d?null:r!==null?c.length===0?o("composer.agentUnavailableNoChoice"):null:u?null:o("composer.agentSwitchUnavailable"),p=ho(),f=V("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink"),g=v(oe,{children:[r!==null?l(eo,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):s?null:i?l(js,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?v("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?o("composer.agentUnknown"):HC(a,o)," ",o("composer.agentUnavailableBadge")]}):s?l("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:o("composer.agentChoosePlaceholder")}):l("span",{className:"min-w-0 truncate",children:HC(i,o)})]});return m!==null?v(Pe,{children:[v(Ee,{render:l(jn,{"aria-label":o("composer.agentPickerLabel"),"aria-describedby":p,"data-composer-agent-picker":"true",softDisabled:!0,className:f}),children:[g,l("span",{id:p,className:"sr-only",children:m})]}),l(Re,{side:"top",align:"start",className:"max-w-80 leading-snug",children:m})]}):v(Ao,{children:[v(Do,{render:l(jn,{"aria-label":o("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||c.length===0,className:f}),children:[g,l(Mu,{})]}),l(No,{align:"start",children:l(Yr,{value:r!==null||s?"":t.activeInstanceId,onValueChange:h=>{!h||r===null&&!s&&h===t.activeInstanceId||t.onInstanceChange(h)},children:c.map(h=>l(Xn,{value:h.instanceId,children:v("span",{className:"flex min-w-0 items-center gap-2",children:[l(js,{driver:h.driverKind,displayName:h.displayName,accentColor:h.accentColor,className:"size-4",iconClassName:"size-4"}),l("span",{className:"min-w-0 truncate",children:HC(h,o)})]})},h.instanceId))})})]})});function VN(e){return l($C,{...e})}function QN(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function XN(e){if(!e.blockedOnSend||e.submissionTarget!=="provider-turn")return null;switch(e.status){case"probing":return{blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{blockKey:"composer.modelMissing",canChooseModel:!0};case"unavailable":return{blockKey:"composer.modelUnavailable",canChooseModel:!0};default:return{blockKey:"composer.modelReady",canChooseModel:!1}}}function YN(e){return(e?.hints??[]).filter(t=>t.kind==="model-replaced"||t.kind==="option-unsupported"||t.kind==="effort-moved")}function zC(e,t){if(typeof t=="boolean")return e(t?"traits.on":"traits.off");if(t===void 0)return"";let o=RT(t);return o===void 0?t:e(`traits.optionValue.${o}`)}function JN(e,t){switch(t.kind){case"model-replaced":return t.to===null?e("modelNote.replacedNoDefault",{from:t.from}):e("modelNote.replaced",{from:t.from,to:t.to});case"option-unsupported":return e("modelNote.optionUnsupported",{option:AT(e,t.optionId),value:zC(e,t.stored)});case"effort-moved":return e("modelNote.effortMoved",{from:zC(e,t.from),to:zC(e,t.to)})}}function ZN(e){if(e===null||"blocked"in e.dispatch)return;let t=e.dispatch.options;return t.length>0?t:void 0}$();function eD(e){let{threadId:t,isLocalDraftThread:o,selection:n,selectionsEqual:r,onChosen:a}=e,s=E(null);H(()=>{let i=s.current,d=n.model.trim()===""?null:n;if(i===null||i.threadId!==t){s.current={threadId:t,selection:d};return}d!==null&&(s.current={threadId:t,selection:d},!(o||i.selection===null)&&(r(i.selection,d)||a?.(d)))},[t,o,n,r,a])}$();function tD(e){let{api:t,providerStatus:o,instanceId:n,environmentId:r,cwd:a,threadId:s}=e,i=t.providerInventory.useWorkspaceInventory({environmentId:r,instanceId:n,cwd:a,threadId:s});return W(()=>o===null||i===null?o:{...o,slashCommands:i.slashCommands,skills:i.skills},[o,i])}function oD(e){let{api:t,t:o,settings:n,composerDraft:r,composerDraftTarget:a,environmentId:s,gitCwd:i,routeKind:d,threadId:c,activeThread:u,isLocalDraftThread:m,unavailableAgentInstanceId:p,agentNotChosen:f,runtimeMode:g,lockedProvider:h,providerStatuses:y,projectId:x,activeProjectDefaultModelSelection:C,activeThreadModelSelection:b,actualModel:L,compactDisabledReason:w,externalSendDisabledReason:k,attachmentBlockReason:I,answeringQuestion:T,setComposerDraftNativeMode:S,handleNativeModeChange:P,onProviderInstanceSelect:A,onModelSelectionChosen:N}=e,B=W(()=>MT(t.model.applyInstanceSettings(t.model.deriveInstanceEntries(y),n)),[t.model,y,n]),O=r.activeProvider??null,j=u?.session?.providerInstanceId??b?.instanceId??C?.instanceId??null,D=ET(B,O??j)??t.model.makeDriverKind("unconfigured"),J=h??D,G=W(()=>{if(!h||!u)return null;let tt=u.session?.providerInstanceId??b?.instanceId;return tt?B.find(It=>It.instanceId===tt)?.continuationGroupKey??null:null},[u,b?.instanceId,h,B]),M=W(()=>{if(p!==null)return p;let tt=[r.activeProvider,u?.session?.providerInstanceId,b?.instanceId,C?.instanceId];for(let It of tt){if(!It)continue;let po=B.find(Ko=>Ko.instanceId===It&&Dd(Ko));if(po&&yp(po,{lockedProvider:h,lockedContinuationGroupKey:G}))return po.instanceId}return t.model.noProviderSelection.instanceId},[C?.instanceId,u?.session?.providerInstanceId,b?.instanceId,r.activeProvider,G,h,B,p]),X=p!==null,F=W(()=>X||f?void 0:B.find(tt=>tt.instanceId===M),[f,X,B,M]),ee=F===void 0&&!X&&!f,Y=X&&UC(B,{lockedProvider:h,lockedContinuationGroupKey:G}).length===0,ae=w??(ee?o("composer.compactingUnavailable"):null),te=F?.driverKind??J,{modelOptions:de,selectedModel:ge,selectedModelStatus:ne,choice:Z}=t.draft.useEffectiveModelState({threadRef:a,providers:y,selectedProvider:te,selectedInstanceId:M,threadModelSelection:b,projectModelSelection:C,settings:n,purpose:m?"create":"display",actualModel:L}),ve=W(()=>F?.snapshot??null,[F]),he=tD({api:t,providerStatus:ve,instanceId:F?.instanceId??null,environmentId:s,cwd:i,threadId:d==="server"?c:null}),Ae=W(()=>F?.models??[],[F]),De=W(()=>ZN(Z),[Z]),je=W(()=>YN(Z),[Z]),ot=Z?.selected.kind==="model"&&Z.selected.unconfirmed,me=n.planModeEnabled,Me=W(()=>({showInteractionModeToggle:me&&t.model.getInteractionModeToggle(y,te),runtimeModeSwitch:he?.runtimeModeSwitch??"next-turn"}),[me,y,te,he]),ue=he?.supportsNativeModeSwitch===!0,ce=m&&ue?r.nativeModeByProvider?.[M]??null:null,Ze=W(()=>t.model.resolveNativeMode(he,{runtimeMode:g,nativeModeId:m?ce:u?.nativeModeId??null}),[t.model,u?.nativeModeId,he,g,m,ce]),pt=ce&&Ze?.current.id===ce?ce:void 0,ze=R(tt=>{m&&S(a,M,tt),P(tt)},[m,S,a,M,P]),et=W(()=>t.model.createSelection(M,ge,De),[t.model,M,ge,De]);eD({threadId:u?.id??null,isLocalDraftThread:m,selection:et,selectionsEqual:t.model.selectionsEqual,onChosen:X||f?void 0:N});let Et=R(tt=>A(tt,et),[A,et]),ft=Z?.selected.kind==="model"?Z.selected.slug:ge,Ct=W(()=>{let tt=new Map;for(let It of B)tt.set(It.instanceId,t.model.getAppModelOptionsForInstance(n,It,It.instanceId===M?ft:null));return tt},[t.model,B,M,ft,n]),gt=W(()=>(Ct.get(M)??[]).some(It=>It.slug===ft)?ft:t.model.normalizeSlug(ft)??ft,[t.model,Ct,M,ft,te]),Dt=k??(T?null:I),Mt=Dt!==null,[se,Le]=q(!1);H(()=>{Le(!1)},[M]);let be=QN({status:ne,submissionTarget:T?"pending-user-input":"provider-turn"}),Xe=XN({blockedOnSend:se,status:ne,submissionTarget:T?"pending-user-input":"provider-turn"}),xt=W(()=>GN(b,Ct),[b,Ct]);return{providerInstanceEntries:B,lockedContinuationGroupKey:G,selectedInstanceId:M,agentUnavailable:X,selectedProviderEntry:F,noProviderAvailable:ee,agentUnavailableNoChoice:Y,resolvedCompactDisabledReason:ae,selectedProvider:te,composerModelOptions:de,selectedModel:ge,selectedModelStatus:ne,selectedProviderStatus:he,selectedProviderModels:Ae,selectedModelChoice:Z,modelNotes:je,selectedModelUnconfirmed:ot,selectedModelOptionsForDispatch:De,planModeUiEnabled:me,composerProviderControls:Me,canSwitchNativeMode:ue,composerNativeMode:Ze,selectedNativeModeId:pt,handleComposerNativeModeChange:ze,selectedModelSelection:et,onAgentInstanceChange:Et,modelOptionsByInstance:Ct,selectedModelForPickerWithCustomFallback:gt,sendDisabledReason:Dt,isSendDisabled:Mt,setModelSendBlockShown:Le,isModelSendBlocked:be,modelSendBlock:Xe,activeThreadModelDisplayName:xt}}function nD(e,t){let{provider:o,instanceId:n,threadRef:r,draftId:a,model:s,choice:i}=t,d=r!==void 0||a!==void 0,c=LT(i,u=>u);return!d||!ST(c,kT(i))?null:l(e,{provider:o,...n?{instanceId:n}:{},...r?{threadRef:r}:{},...a?{draftId:a}:{},model:s,choice:i})}function rD(e){return nD(Cb,e)}function aD(e){return nD(vb,e)}function sD(e){let{routeKind:t,routeThreadRef:o,draftId:n,selectedProvider:r,selectedInstanceId:a,selectedModel:s,selectedModelChoice:i}=e,d={provider:r,instanceId:a,...t==="server"?{threadRef:o}:{},...t==="draft"&&n?{draftId:n}:{},model:s,choice:i};return{providerTraitsMenuContent:rD(d),providerTraitsPicker:aD(d)}}$();$();var KC="ycodium:status-bar-usage-surface";var iD=pe(function(t){let{data:o,target:n}=Ho(),r=ib(),a=o.useAccountUsageInstance(n),s=`${n.environmentId}:${n.threadId}`;return H(()=>{if(r)return window.dispatchEvent(new CustomEvent(KC,{detail:{owner:s,environmentId:n.environmentId,instanceId:a?.instanceId??null,instanceLabel:a?.instanceLabel??null,decisionOccupiesComposer:t.decisionOccupiesComposer,clear:!1}})),()=>{window.dispatchEvent(new CustomEvent(KC,{detail:{owner:s,clear:!0}}))}},[r,a?.instanceId,a?.instanceLabel,s,t.decisionOccupiesComposer,n.environmentId]),null});function zW(e,t,o){let n=[];n.push(t(e));let r=o(e);return r&&n.push(r),e.pageUrl&&n.push(e.pageUrl),e.selector&&n.push(e.selector),e.htmlPreview.trim().length>0&&(n.push(""),n.push(e.htmlPreview.trim().slice(0,600))),n.join(`
|
|
3572
|
+
`)}function KW({context:e,onRemove:t}){let{t:o}=z(),n=it().elementContext,r=n.formatLabel(e),a=n.formatSourceLabel(e);return v(Pe,{children:[l(Ee,{render:v("span",{className:V(ln,"pr-1"),children:[l(qn,{className:V(Fo,"size-icon-1")}),l("span",{className:Bo,children:r}),a?l("span",{className:"select-none text-ui-2xs font-normal text-muted-foreground/85",children:a}):null,l("button",{type:"button","aria-label":o("pendingContext.removeElement",{label:r}),className:fp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(e.id)},children:l(dt,{className:"size-3","aria-hidden":!0})})]})}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:zW(e,n.formatLabel,n.formatSourceLabel)})]})}function lD({contexts:e,onRemove:t,className:o}){return e.length===0?null:l("div",{className:V("flex flex-wrap gap-1.5",o),children:e.map(n=>l(KW,{context:n,onRemove:t},n.id))})}function dD({comments:e,onRemove:t,className:o}){let{t:n}=z();return e.length===0?null:l("div",{className:V("flex flex-wrap gap-1.5",o),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,s=v("span",{className:V(ln,"pr-1"),children:[l(od,{className:V(Fo,"size-icon-1")}),l("span",{className:Bo,children:a}),l("button",{type:"button","aria-label":n("pendingContext.removeReviewComment",{label:a}),className:fp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(r.id)},children:l(dt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?s:v(Pe,{children:[l(Ee,{render:s}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Jf(e){let{t}=z(),o=t(e.tooltipKey,{count:e.count});return v(Pe,{children:[l(Ee,{render:v("span",{className:"inline-flex items-center gap-1 text-ui-2xs font-medium text-muted-foreground",children:[e.icon,e.count]})}),l(Re,{side:"top",children:o})]})}function cD({annotations:e,images:t,onRemove:o,onExpandImage:n,uploadsByImageId:r,onRetryUpload:a,className:s}){let{t:i}=z(),d=it().elementContext;if(e.length===0)return null;let c=new Map(t.map(u=>[u.id,u]));return l("div",{className:V("flex flex-wrap gap-1.5",s),children:e.map(u=>{let m=c.get(u.id),p=m?r?.[m.id]:void 0,f=u.elements.flatMap(g=>{let h=d.normalizeSelection(g.element);return h?[{id:g.id,label:d.formatLabel(h)}]:[]});return v("section",{className:"group/browser-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[m?.previewUrl?l("button",{type:"button","aria-label":i("browserAnnotation.previewImage",{name:m.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>n(m.id),children:l("img",{src:m.previewUrl,alt:i("browserAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/browser-annotation:scale-[1.03]"})}):l("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:l(qn,{className:"size-icon-2"})}),v("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[u.comment.trim()?l("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:u.comment.trim()}):null,v("div",{className:V("flex min-w-0 items-center gap-2",u.comment.trim()&&"mt-1"),children:[f.length>0?v("div",{className:"flex min-w-0 items-center gap-1",children:[f.slice(0,2).map(({id:g,label:h})=>l("span",{className:"max-w-40 truncate font-mono text-secondary-label text-ui-2xs",children:h},g)),f.length>2?v("span",{className:"text-secondary-label text-ui-2xs",children:["+",f.length-2]}):null]}):null,v("div",{className:"flex shrink-0 items-center gap-2",children:[u.elements.length>0?l(Jf,{icon:l(qn,{className:"size-3"}),count:u.elements.length,tooltipKey:"browserAnnotation.elementCount"}):null,u.regions.length>0?l(Jf,{icon:l(Wl,{className:"size-3"}),count:u.regions.length,tooltipKey:"browserAnnotation.regionCount"}):null,u.strokes.length>0?l(Jf,{icon:l(Wn,{className:"size-3"}),count:u.strokes.length,tooltipKey:"browserAnnotation.drawingCount"}):null,u.styleChanges.length>0?l(Jf,{icon:l(za,{className:"size-3"}),count:u.styleChanges.length,tooltipKey:"browserAnnotation.styleChangeCount"}):null,p?.status==="uploading"?l("span",{className:"text-ui-2xs text-secondary-label",children:Wf(p.progress)}):null,p?.status==="failed"&&m&&a?v(Pe,{children:[l(Ee,{render:l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("attachments.retryUpload",{name:m.name}),onClick:()=>a(m)}),children:l(Ka,{className:"size-3"})}),l(Re,{side:"top",children:qf(p,i)})]}):null]})]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("browserAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>o(u.id),children:l(dt,{className:"size-3"})})]},u.id)})})}function qC(e,t){let o=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name,source:r.source}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,...r.source===void 0?{}:{source:r.source}})),index:n}}function uD(e){let{t}=z(),{api:o,environmentId:n,composerDraftTarget:r,isComposerCollapsedMobile:a,isComposerApprovalState:s,hasPendingUserInputs:i,supportsAttachmentUploads:d,uploadsByImageId:c,composerImages:u,composerPreviewableImages:m,composerBrowserAnnotations:p,composerReviewComments:f,composerElementContexts:g,nonPersistedComposerImageIdSet:h,removeComposerDraftBrowserAnnotation:y,removeComposerDraftReviewComment:x,removeComposerDraftElementContext:C,removeComposerImage:b,onExpandImage:L}=e;return v(oe,{children:[!a&&!s&&!i&&p.length>0&&l(cD,{annotations:p,images:u,...d?{uploadsByImageId:c,onRetryUpload:w=>o.uploads.retry({environmentId:n,image:w})}:{},onRemove:w=>{o.uploads.release(w),y(r,w)},onExpandImage:w=>{let k=qC(m,w);k&&L(k)},className:"mb-3"}),!a&&!s&&!i&&f.length>0&&l(dD,{comments:f,onRemove:w=>x(r,w),className:"mb-3"}),!a&&!s&&!i&&g.length>0&&l(lD,{contexts:g,onRemove:w=>C(r,w),className:"mb-3"}),!a&&!s&&!i&&u.some(w=>!p.some(k=>k.id===w.id))&&l("div",{className:"mb-3 flex flex-wrap gap-2",children:u.filter(w=>!p.some(k=>k.id===w.id)).map(w=>{let k=d?c[w.id]:void 0,I=Jn(w),T=sp(I),S=I==="image"&&!!w.previewUrl;return v("div",{"data-composer-attachment-id":w.id,className:V("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",S?"w-16":"w-44 max-w-full"),children:[S?l("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":t("attachments.preview",{name:w.name}),onClick:()=>{let P=qC(m,w.id);P&&L(P)},children:l("img",{src:w.previewUrl,alt:w.name,className:"h-full w-full object-cover"})}):v("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:[l(T,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0",children:[l("span",{className:"block truncate text-ui-xs text-foreground",children:w.name}),l("span",{className:"block text-ui-2xs text-secondary-label",children:di(w.sizeBytes)})]})]}),h.has(w.id)&&v(Pe,{children:[l(Ee,{render:l("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-warning-foreground",children:l(eo,{className:"size-3"})})}),l(Re,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:t("attachments.draftMayNotPersistDetail")})]}),k?.status==="uploading"&&l("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-ui-2xs text-foreground",children:Wf(k.progress)}),k?.status==="failed"&&v(Pe,{children:[l(Ee,{render:l(K,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>o.uploads.retry({environmentId:n,image:w}),"aria-label":t("attachments.retryUpload",{name:w.name})}),children:l(Ka,{})}),l(Re,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:qf(k,t)})]}),l(K,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>b(w.id),"aria-label":t("attachments.remove",{name:w.name}),children:l(dt,{})})]},w.id)})})]})}function pD(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function mD(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}function fD(e){return e.isComposerApprovalState?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.askAnything")}$();$();var gD=pe(function(t){let{t:o}=z(),n=pl();return v(Ao,{children:[l(Do,{render:l(K,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":o("composer.moreComposerControls")}),children:l(Eo,{"aria-hidden":"true",className:"size-4"})}),v(No,{align:"start",children:[t.traitsMenuContent?v(oe,{children:[t.traitsMenuContent,l(Cd,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.modeMenuTitle")}),v(Yr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[l(Xn,{value:"default",children:o("composer.interactionModeChat")}),l(Xn,{value:"plan",children:o("composer.interactionModePlan")})]}),l(Cd,{})]}):null,t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),l(Yr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:_n.map(r=>l(Xn,{value:r,children:n(r).label},r))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?v(oe,{children:[l(Yr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>l(Xn,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):l("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});function hD(e){let{t}=z(),o=it().environment.useScopedEnvironmentId();return l(yb,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1,emptyLabel:t("composer.chooseModel"),...o===null?{}:{environmentId:o}})}function yD(e){let{slots:t,...o}=e,n=l(hD,{...o}),r=t?.renderSlot("conversation.input.model",o,n);return l("span",{"data-conversation-slot":"conversation.input.model",children:r??n})}function vD(e){return l(hD,{...e})}$();function CD(e){return e.description??e.name}var xD=pe(function(t){let{t:o}=z(),{current:n,modes:r}=t.nativeMode,a=CD(n);return!t.canSwitch||r.length<2?v(Pe,{children:[v(Ee,{render:l(jn,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Vn,{icon:qs}),l("span",{children:n.name})]}),v(Re,{side:"top",children:[l("span",{className:"block font-medium",children:a}),r.length>1?l("span",{className:"mt-1 block text-muted-foreground text-xs",children:o("composer.agentModesList",{modes:r.map(s=>s.name).join(", ")})}):null]})]}):l(oe,{children:v(Pe,{children:[v(Xs,{value:n.id,onValueChange:s=>t.onNativeModeChange(s),children:[v(Ee,{render:l(Au,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Vn,{icon:qs}),l(Ou,{children:n.name})]}),l(Ys,{alignItemWithTrigger:!1,children:r.map(s=>l(qa,{value:s.id,hideIndicator:!0,className:"min-w-56 py-2",children:v("div",{className:"grid min-w-0 gap-0.5",children:[l("span",{className:"font-medium text-foreground",children:s.name}),s.description?l("span",{className:"text-muted-foreground text-xs leading-4",children:s.description}):null]})},s.id))})]}),l(Re,{side:"top",children:t.appliesNextTurn?`${a} ${o("runtimeMode.appliesNextTurnHint")}`:a})]})})});function WC(e){let{t}=z(),o=pl();if(e.nativeMode)return l(xD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let n=o(e.runtimeMode),r=n.icon,a=e.runtimeModeSwitch==="next-turn";return l(oe,{children:v(Pe,{children:[v(Xs,{value:e.runtimeMode,onValueChange:s=>e.onRuntimeModeChange(s),children:[v(Ee,{render:l(Au,{"data-composer-permission":"true",className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[l(Vn,{icon:r}),l(Ou,{children:n.label})]}),l(Ys,{alignItemWithTrigger:!1,children:_n.map(s=>{let i=o(s),d=i.icon;return l(qa,{value:s,hideIndicator:!0,className:"min-w-64 py-2","data-runtime-mode":s,children:v("span",{className:"flex items-center gap-2",children:[l(d,{className:"size-4"}),i.label]})},s)})})]}),l(Re,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):n.label})]})})}function bD(e){return l(WC,{...e})}function GC(e){let{t}=z();if(!e.showInteractionModeToggle)return null;let o=e.interactionMode==="plan",n=t(o?"composer.planModeTooltip":"composer.defaultModeTooltip");return v(Pe,{children:[v(Ee,{render:l(jn,{"data-composer-plan-toggle":"true",className:V("shrink-0 whitespace-nowrap",o?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":n}),children:[o?l(Vn,{icon:sd,className:"text-current opacity-100"}):l(Vn,{icon:Fl,opticalSize:"large"}),l("span",{className:"sr-only sm:not-sr-only",children:t(o?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),l(Re,{side:"top",className:"sm:hidden",children:n})]})}function wD(e){return l(GC,{...e})}function Yc(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return l("span",{"data-conversation-slot":e.name,children:t??e.fallback})}function Or(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 qW(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function TD(e){let{t}=z(),o=ho(),{usage:n,breakdown:r,modelDisplayName:a,onCompact:s,compactDisabled:i,compactDisabledReason:d}=e,c=qW(n.usedPercentage),u=n.usedPercentage??0,m=n.usedPercentage===null?null:100,p=n.totalProcessedTokens??null,f=p!==null&&p>0;return v(rn,{children:[l(sn,{openOnHover:!0,delay:150,closeDelay:s?150:0,render:l(K,{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&&c?t("contextWindow.usedPercentAria",{percentage:c}):t("contextWindow.usedTokensAria",{tokens:Or(n.usedTokens)}),children:l(Rg,{"aria-hidden":!0,"aria-label":t("contextWindow.usage"),limit:m,shape:"ring",used:u})})}),l(an,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"overflow-y-auto p-0",className:"w-72 text-left whitespace-normal",children:v("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[l("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&c?v("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:[l("span",{children:c})," ",v("span",{children:[Or(n.usedTokens),"/",Or(n.maxTokens??null)]})]}):l("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:Or(n.usedTokens)})]}),n.maxTokens!==null?l(Rg,{"aria-label":t("contextWindow.usage"),limit:m,shape:"bar",used:u}):null,r?v("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"system",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.system")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.systemTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"tools",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.toolsTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"messages",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.messageTokens)})]})]}):null,f?v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(p)})]}):null,n.compactsAutomatically?l("div",{className:"mt-1 text-pretty text-secondary-label text-ui-sm font-medium",children:jN(t,a,n.autoCompactThreshold)}):null,s?v(oe,{children:[v(K,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,"aria-describedby":i&&d?o:void 0,onClick:s,children:[l(nd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&d?l("div",{id:o,className:"text-pretty text-secondary-label text-ui-sm",children:d}):null]}):null]})})]})}function jC(e,t){return t==null?void 0:e.find(o=>o.presetId===t)}$();function ID(e){if(e.useDraftPresetId===void 0||e.setDraftPresetId===void 0)throw new Error("missing draft preset api: useDraftPresetId and setDraftPresetId");return{useDraftPresetId:e.useDraftPresetId,setDraftPresetId:e.setDraftPresetId}}var VC="__none__",SD=pe(function({environmentId:t,draftId:o,threadPresetId:n,compact:r}){let{t:a}=z(),s=it().presets,i=ID(s),d=s.useThreadPresets(t),c=i.useDraftPresetId(o);if(o===null){let f=jC(d,n)?.displayName??n;return f===null?null:l(WW,{compact:r,label:f,applied:a("preset.appliedLabel",{name:f}),disabled:!0})}if(d.length===0)return null;let m=jC(d,c)?.displayName??a("preset.none");return v(Ao,{children:[v(Do,{render:l(jn,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"max-w-40 min-w-0 shrink"}),children:[l(kD,{compact:r,label:m,applied:a("preset.appliedLabel",{name:m})}),l(Mu,{})]}),l(No,{align:"start",children:v(Lb,{children:[l("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),v(Yr,{value:c??VC,onValueChange:p=>{i.setDraftPresetId(o,p===VC?null:p)},children:[l(Xn,{value:VC,hideIndicator:!0,closeOnClick:!0,children:l("span",{className:"min-w-0 truncate",children:a("preset.none")})}),d.map(p=>l(Xn,{value:p.presetId,hideIndicator:!0,closeOnClick:!0,children:v("span",{className:"flex w-full min-w-0 flex-col",children:[l("span",{className:"min-w-0 truncate",children:p.displayName}),p.description?l("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:p.description}):null]})},p.presetId))]})]})})]})});function WW(e){return l(jn,{variant:"ghost",disabled:e.disabled,"aria-label":e.applied,className:"max-w-40 min-w-0 shrink",children:l(kD,{compact:e.compact,label:e.label,applied:e.applied})})}function kD(e){return v(Pe,{children:[v(Ee,{render:l("span",{className:"flex min-w-0 items-center gap-1.5"}),children:[l(Vn,{icon:Kr}),e.compact?null:l("span",{className:"min-w-0 truncate",children:e.label})]}),l(Re,{side:"top",children:e.applied})]})}var GW=pe(function(t){let{data:o,target:n}=Ho(),r=o.useContextUsage(n);return r?.window==null?null:l(TD,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),jW=pe(function(t){let{t:o}=z(),n=Qf(t.groupSendEligible),r=Vf({pluginAction:t.pluginAction,groupSend:n,groupSendDisabledReason:t.groupSendDisabledReason,sendDisabledReason:t.sendDisabledReason,noProviderAvailable:t.noProviderAvailable,environmentUnavailable:t.environmentUnavailable,projectSelectionRequired:t.projectSelectionRequired,labels:{environmentDisconnected:o("primaryActions.environmentDisconnected"),chooseProjectToStart:o("composer.chooseProjectToStart"),enableProviderToSend:o("composer.enableProviderToSend")}}).reason;return v(oe,{children:[l(GW,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),l(fl,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt&&!t.pluginAction,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:r,isEnvironmentUnavailable:t.environmentUnavailable||t.noProviderAvailable&&!n&&!t.pluginAction||t.projectSelectionRequired,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:!!(t.showSendWhileRunning||t.pluginAction),onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,stopping:t.stopping,cancelsCheck:t.cancelsCheck,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})});function LD(e){let{t}=z(),{isComposerFooterCompact:o,isComposerPrimaryActionsCompact:n,isMobileViewport:r,showMobilePendingAnswerActions:a,hasPendingUserInputs:s,projectSelectionRequired:i,noProviderAvailable:d,composerAttachmentInputRef:c,onComposerAttachmentInputChange:u,slots:m,selectedInstanceId:p,unavailableAgentInstanceId:f,agentNotChosen:g,agentUnavailable:h,providerInstanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,onAgentInstanceChange:b,selectedModelForPickerWithCustomFallback:L,selectedModelStatus:w,selectedModelUnconfirmed:k,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,isComposerModelPickerOpen:P,setIsComposerModelPickerOpen:A,getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onProviderModelSelect:j,environmentId:U,routeKind:D,draftId:J,activeThread:G,interactionMode:M,runtimeMode:X,composerProviderControls:F,composerNativeMode:ee,canSwitchNativeMode:Y,providerTraitsMenuContent:ae,providerTraitsPicker:te,toggleInteractionMode:de,handleRuntimeModeChange:ge,handleComposerNativeModeChange:ne,inlineTasksBadge:Z,inlineStashBadge:ve,activeThreadModelDisplayName:he,pendingPrimaryAction:Ae,phase:De,continuationChecking:je,showPlanFollowUpPrompt:ot,composerDraft:me,isSendBusy:Me,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,environmentUnavailable:pt,handleInterruptPrimaryAction:ze,interruptArmed:et,stopping:Et,handleImplementPlanInNewThreadPrimaryAction:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:Dt,resolvedCompactDisabledReason:Mt,compactThreadContext:se}=e;return v("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":o?"true":"false",className:V("flex min-w-0 select-none flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s&&"pt-2",o?"gap-1.5":"gap-2 sm:gap-0",a&&"hidden sm:flex"),children:[v("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:[l("input",{ref:c,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:u}),v(Pe,{children:[l(Ee,{render:l(K,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:i||s,"aria-label":t("attachments.add"),onClick:()=>c.current?.click()}),children:l(Vo,{})}),l(Re,{side:"top",children:t("attachments.add")})]}),d?v(K,{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:[l(eo,{className:"size-4"}),t("composer.noProviderAvailable")]}):v(oe,{children:[l(Yc,{name:"conversation.input.agent",...m===void 0?{}:{slots:m},owner:{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b},fallback:l($C,{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b})}),h||g?null:l(yD,{...m===void 0?{}:{slots:m},compact:o,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:p,model:L,modelStatus:w,modelUnconfirmed:k,lockedProvider:x,lockedContinuationGroupKey:C,instanceEntries:y,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,open:P,onOpenChange:Le=>{A(Le)},getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onInstanceModelChange:j})]}),v(oe,{children:[l(SD,{environmentId:U,draftId:D==="draft"?J:null,threadPresetId:G?.presetId??null,compact:o},D==="draft"?J:G?.id??"thread"),o?l(gD,{interactionMode:M,runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,showInteractionModeToggle:F.showInteractionModeToggle,traitsMenuContent:ae,onToggleInteractionMode:de,onRuntimeModeChange:ge,onNativeModeChange:ne}):v(oe,{children:[te?l(Yc,{name:"conversation.input.effort",...m===void 0?{}:{slots:m},fallback:te}):null,ee===null&&F.showInteractionModeToggle?l(Yc,{name:"conversation.input.plan",...m===void 0?{}:{slots:m},owner:{interactionMode:M,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:de},fallback:l(GC,{interactionMode:M,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:de})}):null,l(Yc,{name:"conversation.input.permission",...m===void 0?{}:{slots:m},owner:{runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,onRuntimeModeChange:ge,onNativeModeChange:ne},fallback:l(WC,{runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,onRuntimeModeChange:ge,onNativeModeChange:ne})})]})]})]}),v("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":n?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[a?null:Z,a?null:ve,l(jW,{pluginAction:e.pluginAction,compact:n,activeThreadModelDisplayName:he,pendingAction:Ae,isRunning:De==="running"||je,cancelsCheck:je&&De!=="running",showPlanFollowUpPrompt:!s&&ot,promptHasText:me.promptHasText,isSendBusy:Me,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,noProviderAvailable:d,environmentUnavailable:pt!==null,projectSelectionRequired:i,hasSendableContent:me.hasSendableContent,preserveComposerFocusOnPointerDown:r,showSendWhileRunning:r,onInterrupt:ze,interruptArmed:et,stopping:Et,onImplementPlanInNewThread:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:Dt||d||Me,compactDisabledReason:Mt,onCompactContext:se})]})]})}var VW=e=>e.prompt.trim();function QW(e){let{t}=z(),o=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,VW),n=e.pendingCustomAnswer!==null;return l("button",{type:"button",className:V("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-control-3",(n?e.pendingCustomAnswer:o)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:n?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):o||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}function PD(e){let{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:r,onExpand:a,inlineTasksBadge:s,inlineStashBadge:i,submitDisabled:d,submitLabel:c,onSubmit:u}=e,{t:m}=z(),p=Qf(e.groupSendEligible),f=Vf({pluginAction:e.pluginAction,groupSend:p,groupSendDisabledReason:e.groupSendDisabledReason,sendDisabledReason:e.modelSendDisabledReason,noProviderAvailable:e.noProviderAvailable,environmentUnavailable:e.environmentUnavailable,projectSelectionRequired:e.projectSelectionRequired,labels:{environmentDisconnected:m("primaryActions.environmentDisconnected"),chooseProjectToStart:m("composer.chooseProjectToStart"),enableProviderToSend:m("composer.enableProviderToSend")}});return v("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[l(QW,{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:!p&&!e.pluginAction&&r,onExpand:a}),s,i,l("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:d||f.disabled,"aria-label":c,onPointerDown:g=>g.preventDefault(),onClick:g=>{g.stopPropagation(),u()},children:l("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}$();$();var RD={plugins:"slashMenu.sections.plugins",recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills",files:"slashMenu.sections.files","members-team":"slashMenu.sections.membersTeam","members-project":"slashMenu.sections.membersProject",threads:"slashMenu.sections.threads"},MD=pe(function(t){let{t:o}=z(),n=E(null),r=Co()?.data.threadReferences!==void 0,a=Co()?.data.memberMentions!==void 0;return fe(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),l(zu,{autoHighlight:!1,mode:"none",onItemHighlighted:s=>{t.onHighlightedItemChange(typeof s=="string"?s:null)},children:v("div",{ref:n,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:[t.items.length>1&&t.items.every(s=>s.type==="plugin-slash-command"&&s.command.name===t.items[0].command.name)?l("p",{className:"px-5 pt-2 text-xs text-muted-foreground",children:o("slash.ambiguous",{command:t.items[0].command.name})}):null,t.items.length>0?l(Wu,{className:"max-h-72 scroll-pb-6",children:l(Ku,{children:t.items.map((s,i)=>l(XW,{sectionTitle:s.section!==void 0&&t.items[i-1]?.section!==s.section?s.section:null,sectionLabel:s.type==="path"?s.sectionLabel:void 0,item:s,environmentId:t.environmentId,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===s.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},s.id))})}):l("div",{className:"px-5 pt-3.5 pb-7",children:l("p",{className:"text-secondary-label text-xs",children:t.isLoading?ED(t.triggerKind)?o("composer.searchingSkills"):o("composer.searchingFiles"):ED(t.triggerKind)?o("composer.noSkillsFound"):t.triggerKind==="path"?o(a?"composer.noMatchingFilesThreadsOrMembers":r?"composer.noMatchingFilesOrThreads":"composer.noMatchingFiles"):o("composer.noMatchingCommand")})})]})})});function ED(e){return e==="skill"||e==="slash-skill"}var XW=pe(function(t){let{t:o}=z(),n=Co()?.target,r=t.item.type==="skill"?lA(t.item.skill):null,a=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return v(oe,{children:[t.sectionTitle!==null?l("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:t.sectionLabel??o(RD[t.sectionTitle]??RD.recent)}):null,v(qu,{value:t.item.id,"data-composer-item-id":t.item.id,className:V("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:s=>{s.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?l(Mf,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,t.item.type==="thread"?l(gr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,t.item.type==="member"?l(yr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,v("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[l("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:a?v(oe,{children:[l("span",{className:"text-secondary-label",children:"/skill:"}),tn(a)]}):t.item.label}),l("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),t.item.type==="plugin-slash-command"?l(Mo,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.pluginId}):null,t.item.type==="skill"&&t.item.skill.pluginId?l(Mo,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.skill.pluginId}):r?l(ZW,{kind:r}):null]})]})]})}),YW={app:Fa,repo:zr,project:zr,personal:yr,system:pd,other:ad},JW={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 ZW(e){let{t}=z(),o=YW[e.kind];return v(jr,{className:"ms-auto",variant:"secondary",children:[l(o,{"aria-hidden":"true",className:"text-current"}),t(JW[e.kind])]})}$();function eG(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function AD(e,t){let o=eG(e);if(!o)return"";let n=Date.now()-o.getTime();if(n<0)return t("relativeTime.justNow");let r=Math.floor(n/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 ND=90;function DD(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function tG(e,t){let o=e.prompt.trim().replace(/\s+/g," ");if(o.length>0)return o.length>ND?`${o.slice(0,ND)}\u2026`:o;let n=e.attachments.length+e.droppedImageNames.length;return n>0?t("stash.imageCountLabel",{count:n}):t("stash.emptyEntry")}var _D=pe(function(t){let{entries:o,onRestore:n,onDelete:r,onClose:a}=t,{t:s}=z(),i=it(),d=E(null),[c,u]=q(o[0]?.id??null),m=o.find(p=>p.id===c)??o[0];return H(()=>{let p=f=>{let g=d.current;g&&f.composedPath().includes(g)||f.target instanceof Element&&f.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),H(()=>{o.length!==0&&(o.some(p=>p.id===c)||u(o[0]?.id??null))},[o,c]),i.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(o.length===0)return;p.preventDefault(),p.stopPropagation();let f=o.findIndex(x=>x.id===c),g=p.key==="ArrowDown"?1:-1,y=((f>=0?f:g===1?-1:0)+g+o.length)%o.length;u(o[y]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!m)return;p.preventDefault(),p.stopPropagation(),n(m);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!m)return;p.preventDefault(),p.stopPropagation(),r(m)}},{capture:!0}),l(zu,{autoHighlight:!1,mode:"none",children:v("div",{ref:d,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[l("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:l(K,{variant:"ghost-muted",size:"icon-micro","aria-label":s("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:l(dt,{className:"size-3"})})}),l(Wu,{className:"max-h-64 scroll-pb-6",children:l(Ku,{children:o.length===0?l("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:s("stash.empty")}):o.map(p=>v(qu,{value:p.id,className:V("group/stash relative cursor-[var(--control-cursor)] 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",c===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{c!==p.id&&u(p.id)},onMouseDown:f=>{f.preventDefault()},onClick:()=>{n(p)},children:[l("span",{className:"min-w-0 flex-1 truncate text-xs",children:tG(p,s)}),p.pendingImageCount?l("span",{className:"shrink-0 text-ui-sm text-secondary-label",children:s("stash.savingImage",{count:p.pendingImageCount})}):DD(p)>0?l("span",{className:"shrink-0 text-ui-sm text-warning-foreground",children:s("stash.imagesDropped",{count:DD(p)})}):null,p.attachments.length>0?l("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(f=>l("img",{src:f.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},f.id))}):null,l("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:AD(p.createdAt,s)}),l(K,{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:f=>{f.stopPropagation(),r(p)},children:l(dt,{className:"stroke-2"})})]},p.id))})})]})})});$();function oG(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function QC(e){let t=it(),o=bu(),n=t.pane.useActive(),[r,a]=q(null);return fe(()=>{if(!n)return;let s=e.anchor;if(!s){a(null);return}let i=!0,d=()=>{if(!i)return;let u=s.closest('[data-chat-composer-form="true"]'),p=(u?.querySelector('[data-chat-composer-main-surface="true"]')??u??s).getBoundingClientRect(),f=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(u??s).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*f,y=f+1,x={bottom:window.innerHeight-p.top-y,left:p.left+h,maxHeight:Math.max(96,p.top-24+y),width:Math.max(0,p.width-h*2),overlap:y};a(C=>C&&oG(C,x)?C:x)};d(),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0);let c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);if(c){c.observe(s);for(let u=s.parentElement;u;u=u.parentElement)c.observe(u)}return()=>{i=!1,c?.disconnect(),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[e.anchor,n]),!n||!r?null:t.createPortal(v("div",{className:o,"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:[l(nG,{}),e.children]}),document.body)}function nG(){return nN(),null}$();function rG(e){let t=hT(e);if(t===null)return"";let o=ui(t).visibleText;for(;;){let n=pi(o);if(!n.annotation)break;o=n.promptText}return o=Qa(o).promptText,mi(o).flatMap(n=>n.kind==="text"?[n.text]:[]).join("").trim()}function OD(e){let t=[];for(let o of e){let n=rG(o.text);n!==""&&(t.at(-1)?.prompt===n&&t.pop(),t.push({id:o.id,prompt:n}))}return t}function FD(e){let{direction:t,entries:o,position:n,draft:r}=e,a=-1;if(n!==null&&n.recalled===r&&(a=o.findIndex(i=>i.id===n.id),a<0&&(a=o.findLastIndex(i=>i.prompt===n.recalled))),a<0&&(t==="forward"||r!==""))return null;let s=t==="forward"?o[a+1]:o[(a<0?o.length:a)-1];return s!==void 0?{position:{id:s.id,recalled:s.prompt},prompt:s.prompt}:t==="forward"?{position:null,prompt:""}:null}function BD(e){let{documentKey:t,promptRef:o,editorRef:n,blocked:r,readSentMessages:a,show:s}=e,i=E(null);return(d,c)=>{if(r||c.shiftKey||c.altKey||c.metaKey||c.ctrlKey||c.isComposing||c.keyCode===229)return!1;let u=o.current,m=i.current,p=m?.documentKey===t?m.position:null,f=d==="ArrowUp"?"back":"forward";if(p?.recalled!==u&&(f==="forward"||u!=="")||n.current?.isCaretOnVisualEdge(f==="back"?"start":"end")!==!0)return!1;let g=FD({direction:f,entries:OD(a()),position:p,draft:u});return g===null?!1:(i.current=g.position===null?null:{documentKey:t,position:g.position},s(g.prompt),!0)}}$();function aG(e,t){let o=e.name.toLowerCase(),n=tn(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",s=e.scope?.toLowerCase()??"",i=[On({value:o,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),On({value:n,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),On({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),On({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),On({value:s,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(d=>d!==null);return i.length===0?null:Math.min(...i)}function HD(e,t,o=Number.POSITIVE_INFINITY){let n=e.filter(xr),r=Kf(t,{trimLeadingPattern:/^\$+/});if(!r)return n;let a=[];for(let s of n){let i=aG(s,r);i!==null&&aN(a,{item:s,score:i,tieBreaker:`${tn(s).toLowerCase()}\0${s.name}`},o)}return a.map(s=>s.item)}var UD=[],$D=[],yl=Object.freeze({environmentId:"",threadId:""}),zD=e=>e.prompt,KD=e=>e.images.length>0||e.persistedAttachments.length>0||e.terminalContexts.length>0||e.elementContexts.length>0||e.browserAnnotations.length>0||e.reviewComments.length>0,sG=()=>[],qD=e=>sG,WD=(e,t)=>{let o=new Map(e.map(n=>[n.id,n]));return t.flatMap(n=>{let r=o.get(n);return r?[r]:[]})},GD=(e,t)=>e.length===t.length&&e.every((o,n)=>o.id===t[n]);function XC(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 iG=1e4;function lG(e,t){if(t==="")return 0;let o=e.toLowerCase(),n=o.slice(o.lastIndexOf("/")+1),r=On({value:n,query:t,exactBase:0,prefixBase:100,boundaryBase:200,includesBase:300,fuzzyBase:400});return r!==null?r:On({value:o,query:t,exactBase:1e3,prefixBase:1100,boundaryBase:1200,includesBase:1300,fuzzyBase:1400})??iG}function jD(e){let t=Kf(e.query),o=[];e.folders.forEach((a,s)=>{e.groups.find(d=>d.cwd===a.cwd)?.entries.forEach((d,c)=>{o.push({hit:{folder:a,entry:d},quality:lG(d.path,t),position:c,folderIndex:s})})});let n=o.toSorted((a,s)=>a.quality-s.quality||a.position-s.position||a.folderIndex-s.folderIndex).slice(0,_x),r=[];for(let{hit:a}of n)r.includes(a.folder.id)||r.push(a.folder.id);return r.flatMap(a=>n.filter(({hit:s})=>s.folder.id===a).map(({hit:s})=>s))}function VD(e){return e.map(t=>({id:`member:${t.memberId}`,type:"member",candidate:t,label:t.name,description:[t.title,t.machineLabel].filter(o=>o!==null).join(" / "),section:t.inTeam?"members-team":"members-project"}))}var QD=(e,t,o)=>o.endsWith(" ")&&e[t]===" "?t+1:t,dG=Object.freeze([]),cG=Object.freeze([]),uG=()=>cG,pG=()=>dG,mG=Object.freeze([]),fG=Object.freeze([]),gG=()=>mG,hG=Object.freeze({groups:Object.freeze([]),isPending:!1}),yG=()=>hG,vG=(e,t)=>`${e.replace(/[\\/]+$/,"")}/${t}`;function Jc(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function YD({prompt:e,pluginCommands:t=[],onSelectPluginCommand:o,selectedProvider:n,selectedProviderStatus:r,planModeUiEnabled:a,showSkillsInSlashMenu:s,recentSlashCommandIds:i,environmentId:d,gitCwd:c,useComposerPathSearch:u,useComposerPathSearchAcross:m,readComposerSnapshot:p,applyPromptReplacement:f,onInteractionModeChange:g,onOpenModelPicker:h,onSlashCommandUsed:y}){let{t:x}=z(),C=Zn(),[b,L]=q(()=>Po(e,e.length)),[w,k]=q(null),[I,T]=q(null),[S,P]=q(null),A=w!==null&&Jc(b)===w?null:b,N=A?.kind==="path"?A.query:"",B=A?.kind==="path",O=Co(),j=(O?.data.useThreadFolders??gG)(O?.target??yl),U=j.length>1&&m!==void 0,D=W(()=>U&&B?j.map(me=>me.cwd):fG,[j,B,U]),J=u({environmentId:d,cwd:B&&!U?c:null,query:B&&!U?N:null}),G=(m??yG)({environmentId:d,cwds:D,query:D.length>0?N:null}),M=W(()=>D.length>0?jD({query:N,folders:j,groups:G.groups}):[],[G.groups,D,j,N]),X=U?G.isPending:J.isPending,F=O?.data.threadReferences,ee=(F?.useCandidates??pG)({target:O?.target??yl,query:B?N:null}),Y=O?.data.memberMentions,ae=(Y?.useCandidates??uG)({target:O?.target??yl,query:B?N:null}),te=W(()=>{if(!A)return[];if(A.kind==="path"){let me=ue=>ee.length>0||ae.length>0?{section:ue}:{},Me=U?M.map(({folder:ue,entry:ce})=>({id:`path:${ce.kind}:${ue.id}:${ce.path}`,type:"path",path:ce.path,linkPath:vG(ue.cwd,ce.path),pathKind:ce.kind,label:XD(ce.path),description:ce.path.slice(0,Math.max(0,ce.path.lastIndexOf("/"))),section:`folder:${ue.id}`,sectionLabel:ue.name})):J.entries.map(ue=>({id:`path:${ue.kind}:${ue.path}`,type:"path",path:ue.path,pathKind:ue.kind,label:XD(ue.path),description:ue.path.slice(0,Math.max(0,ue.path.lastIndexOf("/"))),...me("files")}));return[...VD(ae),...Me,...ee.map(ue=>({id:`thread:${ue.reference.environmentId}:${ue.reference.threadId}`,type:"thread",reference:ue.reference,label:C(ue.reference.title),description:[ue.projectLabel,ue.machineLabel].filter(ce=>ce!==null).join(" / "),...me("threads")}))]}if(A.kind==="slash-command"){let me=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:x("composer.switchModelDesc")},...a?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:x("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:x("composer.defaultDesc")}]:[]];return sN({builtIns:me,plugins:t,provider:n,commands:r?.slashCommands??[],skills:r?.skills??[],showSkills:s,query:A.query,recentIds:i,providerDescription:x("composer.runProviderCommand")})}if(A.kind==="skill"||A.kind==="slash-skill"){let me=A.kind==="skill"?r?.skills??[]:iA(r?.skills??[],s);return HD(me,A.query).map(Me=>({id:`skill:${n}:${Me.name}`,type:"skill",provider:n,skill:Me,label:tn(Me),description:Me.shortDescription??Me.description??""}))}return[]},[C,t,A,a,i,n,r,s,x,ee,ae,M,U,J.entries]),de=A!==null&&!(A.kind==="slash-skill"&&te.length===0),ge=A?`${A.kind}:${A.query.trim().toLowerCase()}`:null,ne=W(()=>{let me=XC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});return te.find(Me=>Me.id===me)??null},[te,I,ge,S]),Z=R(()=>{let me=p(),Me=Po(me.value,me.expandedCursor),ue=w!==null&&Jc(Me)===w?null:Me;return{snapshot:me,trigger:ue}},[p,w]),ve=R(me=>{let{snapshot:Me,trigger:ue}=Z();if(!ue)return;if((me.type==="slash-command"||me.type==="provider-slash-command"||me.type==="plugin-slash-command"||me.type==="skill")&&y?.(me.id),me.type==="path"||me.type==="thread"||me.type==="member"){let ze=me.type==="path"?Ls(me.linkPath??me.path):me.type==="thread"?F?.serialize(me.reference)??null:Y?.serialize(me.candidate)??null;if(ze===null)return;let et=`${ze} `,Et=QD(Me.value,ue.rangeEnd,et);f(ue.rangeStart,Et,et,{expectedText:Me.value.slice(ue.rangeStart,Et)})&&T(null);return}if(me.type==="slash-command"){if(me.command==="model"){f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Me.value.slice(ue.rangeStart,ue.rangeEnd),focusEditorAfterReplace:!1})&&(T(null),h());return}g(me.command==="plan"?"plan":"default"),f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Me.value.slice(ue.rangeStart,ue.rangeEnd)})&&T(null);return}let ce=me.type==="provider-slash-command"||me.type==="plugin-slash-command"?`/${me.command.name} `:`$${me.skill.name} `,Ze=QD(Me.value,ue.rangeEnd,ce);f(ue.rangeStart,Ze,ce,{expectedText:Me.value.slice(ue.rangeStart,Ze)})&&(T(null),me.type==="plugin-slash-command"&&o?.({pluginId:me.pluginId,name:me.command.name}))},[f,g,h,y,o,Z,F,Y]);H(()=>{if(!de){T(null),P(null);return}let me=XC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});T(Me=>Me===me?Me:me),P(Me=>Me===ge?Me:ge)},[I,S,te,de,ge]);let he=R(me=>{T(me),P(ge)},[ge]),Ae=R(()=>{let{trigger:me}=Z();return me===null||me.kind==="slash-skill"&&!de?!1:(k(Jc(me)),T(null),!0)},[de,Z]),De=R(me=>{k(Jc(Po(me,me.length))),L(null),T(null)},[]),je=R((me,Me)=>{let ue=en(me,Me),ce=Po(me,ue);L(ce);let Ze=Jc(ce);k(pt=>pt!==null&&pt!==Ze?null:pt),T(null),P(null)},[]),ot=R(()=>{T(null)},[]);return{composerTrigger:b,menuTrigger:A,composerMenuItems:te,composerMenuOpen:de,composerMenuSearchKey:ge,activeComposerMenuItem:ne,resolveActiveComposerTrigger:Z,onSelectComposerItem:ve,onComposerMenuItemHighlighted:he,onMenuEscape:Ae,resetForDocumentChange:je,dismissTrigger:ot,dismissTriggerIn:De,pathSearchPending:X,highlightedItemId:I,setTrigger:L,setHighlightedItemId:T,setHighlightedSearchKey:P}}function XD(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}$();function JD(e,t){let o=W(()=>cp((e??[]).filter(xr)),[e]);return R((n,r)=>{let a=Gw(n,r,o,gC);a!==null&&t(a.start,a.end,a.replacement,{expectedText:r.slice(a.start,a.end)})},[t,o])}var ZD=pe(function(t){let{handleRef:o,api:n,composerDraftTarget:r,composerDocumentKey:a,promptRef:s,editorRef:i,menuAnchor:d,resolvedTheme:c,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,onSlashCommandUsed:x,onOpenModelPicker:C,onInteractionModeChange:b,onToggleInteractionMode:L,activePendingProgress:w,activePendingRequestId:k,hasPendingUserInputs:I,changeUserInputCustomAnswer:T,terminalContexts:S,showTerminalContexts:P,showEditor:A,isApprovalState:N,editorClassName:B,placeholder:O,disabled:j,onPaste:U,onSubmit:D,isMobileViewport:J,isDraftRoute:G,stashMenuOpen:M,stashEntries:X,onRestoreStashEntry:F,onDeleteStashEntry:ee,onCloseStashMenu:Y,onPromptEdited:ae,onUnclaimedEscape:te}=t,de=n.draft.useThreadDraftSelector(r,zD),ge=n.draft.useThreadDraftSelector(r,KD),ne=Co(),Z=(ne?.data.useSentMessagesReader??qD)(ne?.target??yl),ve=n.draft.useStore,he=ve(Ce=>Ce.setPrompt),Ae=ve(Ce=>Ce.setTerminalContexts),De=ve(Ce=>Ce.removeTerminalContext),je=uo(de,de.length),ot=_r(a,de,{cursor:je,expandedCursor:de.length}),[me,Me]=q(()=>({documentKey:a,cursor:ot.cursor})),ue=me.documentKey===a?me.cursor:ot.cursor,ce=R(Ce=>{Me(Ue=>{let rt=Ue.documentKey===a?Ue.cursor:_r(a,s.current).cursor,Lt=typeof Ce=="function"?Ce(rt):Ce,wt=s.current,Ot=en(wt,Lt);return ZM(a,wt,Lt,Ot),Ue.documentKey===a&&Ue.cursor===Lt?Ue:{documentKey:a,cursor:Lt}})},[a,s]),Ze=E(!1),pt=E(!1),ze=E([]),et=E(null),Et=R(Ce=>{he(r,Ce)},[r,he]),ft=R((Ce,Ue,rt,Lt,wt)=>{T(Ce,Ue,rt,Lt,wt),s.current=Ue},[T,s]),Ct=R((Ce,Ue,rt,Lt)=>{let wt=s.current,Ot=Math.max(0,Math.min(wt.length,Ce)),Ro=Math.max(Ot,Math.min(wt.length,Ue));if(Lt?.expectedText!==void 0&&wt.slice(Ot,Ro)!==Lt.expectedText)return!1;let nn=GM(s.current,Ce,Ue,rt),Fr=uo(nn.text,nn.cursor),ka=en(nn.text,Fr);s.current=nn.text;let As=w?.activeQuestion;return As&&I?ft(As.id,nn.text,Fr,ka,!1):Et(nn.text),ce(Fr),Qt(Po(nn.text,ka)),Lt?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{i.current?.focusAt(Fr)}),!0},[w?.activeQuestion,i,I,ft,s,ce,Et]),gt=R(()=>{let Ce=i.current?.readSnapshot();return Ce||{value:s.current,cursor:ue,expandedCursor:en(s.current,ue),terminalContextIds:S.map(Ue=>Ue.id)}},[ue,i,s,S]),Dt=(n.slashCommands?.useCommands??(()=>[]))(h,r),Mt=YD({pluginCommands:Dt,onSelectPluginCommand:Ce=>n.slashCommands?.select(r,Ce),prompt:de,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,useComposerPathSearch:n.pathSearch.useComposerPathSearch,useComposerPathSearchAcross:n.pathSearch.useComposerPathSearchAcross,readComposerSnapshot:gt,applyPromptReplacement:Ct,onInteractionModeChange:b,onOpenModelPicker:C,onSlashCommandUsed:x}),{composerTrigger:se,composerMenuItems:Le,composerMenuOpen:be,activeComposerMenuItem:Xe,resolveActiveComposerTrigger:xt,onComposerMenuItemHighlighted:tt,onMenuEscape:It,pathSearchPending:po,highlightedItemId:Ko,setTrigger:Qt,setHighlightedItemId:hn}=Mt,At=se?.kind??null,St=se?.kind==="path"?se.query:"",bt=w?w.customAnswer:de,mo=N?"":bt,kt=Mt.resetForDocumentChange;H(()=>{kt(bt,ue)},[a,kt,bt,ue]),pt.current=be,ze.current=Le,et.current=Xe;let _t=At==="path"&&St.length>0&&po===!0,Xt=R(Ce=>{let Ue=S.findIndex(wt=>wt.id===Ce);if(Ue<0)return;let rt=n.terminalContext.removeInlinePlaceholder(s.current,Ue);s.current=rt.prompt,Et(rt.prompt),De(r,Ce);let Lt=uo(rt.prompt,rt.cursor);ce(Lt),Qt(Po(rt.prompt,rt.cursor))},[n.terminalContext,r,s,De,ce,Et,S,Qt]);fe(()=>{s.current=de,ce(Ce=>ir(de,Ce))},[a,de,s,ce]),H(()=>{ae(de)},[ae,de]),H(()=>{be&&Y()},[be,Y]);let nt=E(null);H(()=>{let Ce=w?.customAnswer;if(typeof Ce!="string"){if(nt.current!==null){s.current=de;let Ro=uo(de,de.length);ce(Ro),Qt(Po(de,en(de,Ro)))}nt.current=null;return}let Ue=k,rt=w?.activeQuestion?.id??null,Lt=nt.current?.requestId!==Ue||nt.current?.questionId!==rt,wt=s.current!==Ce;if(nt.current={requestId:Ue,questionId:rt},!Lt&&!wt)return;s.current=Ce;let Ot=uo(Ce,Ce.length);ce(Ot),Qt(Po(Ce,en(Ce,Ot))),hn(null)},[w?.customAnswer,w?.activeQuestion?.id,k,de,s]);let lt=JD(m?.skills,Ct),Bt=R((Ce,Ue,rt,Lt,wt)=>{if(w?.activeQuestion&&I){if(w.activeQuestion.allowFreeform===!1)return;ce(Ue),Qt(Lt?null:Po(Ce,rt)),ft(w.activeQuestion.id,Ce,Ue,rt,Lt);return}let Ot=s.current;s.current=Ce,Et(Ce),GD(S,wt)||Ae(r,WD(S,wt)),ce(Ue),Qt(Lt?null:Po(Ce,rt)),n.slashCommands?.readBinding(r)||lt(Ot,Ce)},[w?.activeQuestion,lt,I,ft,s,ce,Et,r,S,Ae,Qt]),Ht=Mt.onSelectComposerItem,Yt=R(Ce=>{Ze.current||(Ze.current=!0,window.requestAnimationFrame(()=>{Ze.current=!1}),Ht(Ce))},[Ht]),qo=R(Ce=>{if(Le.length===0)return;let Ue=Le.findIndex(Ro=>Ro.id===Ko),wt=((Ue>=0?Ue:Ce==="ArrowDown"?-1:0)+(Ce==="ArrowDown"?1:-1)+Le.length)%Le.length,Ot=Le[wt];hn(Ot?.id??null)},[Ko,Le,hn]),fo=Mt.dismissTriggerIn,go=R(Ce=>{s.current=Ce,Et(Ce),ce(uo(Ce,Ce.length)),fo(Ce)},[fo,s,ce,Et]),Jt=BD({documentKey:a,promptRef:s,editorRef:i,blocked:ge||I||N||j||M,readSentMessages:Z,show:go}),Hn=(Ce,Ue)=>{if(Ce==="Escape")return Ue.isComposing||Ue.keyCode===229?!1:It()||(te?.()??!1);if(Ce==="Tab"&&Ue.shiftKey)return p?(L(),!0):!1;if((Ce==="ArrowUp"||Ce==="ArrowDown")&&Jt(Ce,Ue))return!0;let{trigger:rt}=xt();if(pt.current||rt!==null){let Ot=ze.current,Ro=et.current??Ot[0];if(Ce==="ArrowDown"&&Ot.length>0)return qo("ArrowDown"),!0;if(Ce==="ArrowUp"&&Ot.length>0)return qo("ArrowUp"),!0;if((Ce==="Enter"||Ce==="Tab")&&Ro)return Yt(Ro),!0}let wt=Ce==="Enter"?zM({isMobileViewport:J,shiftKey:Ue.shiftKey,modifierKey:Ue.metaKey||Ue.ctrlKey,isDraftThread:G}):null;return wt?(D(void 0,wt),!0):!1};return pr(o,()=>({readSnapshot:gt,readDraftPrompt:()=>de,applyPromptReplacement:Ct,syncCursor:(Ce,Ue)=>{ce(Ce),Qt(Ue)},resetCursorState:Ce=>{let Ue=Ce?.prompt??s.current,rt=ir(Ue,Ce?.cursor??0);hn(null),ce(rt),Qt(Ce?.detectTrigger?Po(Ue,en(Ue,rt)):null)}}),[Ct,de,s,gt,ce,hn,Qt]),v(oe,{children:[M&&!be&&!N&&l(QC,{anchor:d,children:l(_D,{entries:X,onRestore:F,onDelete:ee,onClose:Y})}),be&&!N&&l(QC,{anchor:d,children:l(MD,{environmentId:h,items:Le,resolvedTheme:c,isLoading:_t,triggerKind:At,activeItemId:Xe?.id??null,onHighlightedItemChange:tt,onSelect:Yt})}),A?l(cl,{editorRef:i,documentKey:a,value:mo,cursor:ue,terminalContexts:P?S:UD,skills:m?.skills??$D,...B?{className:B}:{},onRemoveTerminalContext:Xt,onChange:Bt,onCommandKeyDown:Hn,onPaste:U,placeholder:O,disabled:j}):null]})});function e_({message:e}){return e?l("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive-foreground sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function t_(e){let{t}=z(),{message:o,agentNotChosen:n,agentUnavailable:r,agentUnavailableNoChoice:a,modelSendBlock:s,selectedModelStatus:i,modelNotes:d,onChooseModel:c}=e;return v(oe,{children:[l(e_,{message:o}),n?l("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,r?l("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:t(a?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,d.map(u=>l("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-note":u.kind,children:JN(t,u)},`${u.kind}:${u.kind==="option-unsupported"?u.optionId:""}`)),s===null?null:v("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":i,children:[t(s.blockKey),s.canChooseModel?l(K,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{c()},children:t("composer.chooseModel")}):null]})]})}function o_(e){let{t}=z(),o=BC();return!e.eligible||o==="unsupported"?null:l("p",{className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-group-send":"true","data-chat-composer-group-send-state":o,children:t(o==="ready"?"composer.groupSendHint":o==="error"?"composer.groupSendRosterFailed":"composer.groupSendRosterWaiting")})}function n_(e){let{t}=z();if(!e.mode)return null;let o=e.unavailableReason??t(e.isMobileViewport?"composer.shellCommand.touchHint":"composer.shellCommand.hint");return v("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-start gap-1.5 px-1 pb-1 text-xs",children:[l(Qo,{"aria-hidden":"true",className:"mt-0.5 size-3.5 shrink-0 text-primary"}),l("span",{className:"shrink-0 font-medium text-primary",children:t("composer.shellCommand.mode")}),l("span",{className:"min-w-0 flex-1 wrap-break-word text-muted-foreground",children:o})]})}var CG=[];function r_(e){let{t}=z(),{props:o,model:n,status:r,submit:a,badges:s,traits:i,composerDraft:d}=e,c=e.pendingUserInputs.length>0,u=W(()=>e.composerImages.filter(b=>Jn(b)==="image"),[e.composerImages]),m=W(()=>new Set(e.nonPersistedComposerImageIds),[e.nonPersistedComposerImageIds]),p=e.isMobileViewport&&!e.isComposerCollapsedMobile&&e.pendingPrimaryAction!==null,f=r.phase==="running"&&!e.pluginAction||r.isSendBusy||r.projectSelectionRequired||r.environmentUnavailable!==null||!d.hasSendableContent,g=!e.isComposerCollapsedMobile&&!e.isComposerApprovalState,h=Gf({activeThreadId:r.activeThread?.id??null,isLocalDraftThread:o.routeKind==="draft",isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.activePendingProgress!==null,hasPendingAction:e.pendingPrimaryAction!==null,shellCommandMode:a.shellCommandMode}),y=pD({machineUnavailable:r.environmentUnavailable!==null,sessionStarted:r.activeThread?.session!=null,sessionDisconnected:r.phase==="disconnected"}),x=mD(y),C=fD({t,tailPlaceholderKey:x,isComposerApprovalState:e.isComposerApprovalState,activePendingProgress:e.activePendingProgress!==null,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable});return l("div",{"data-chat-composer-main-surface":"true",className:"group relative z-10 rounded-composer p-px transition-colors duration-200",children:v("div",{ref:e.surfaceRef,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":e.isComposerCollapsedMobile?"true":"false",className:V("rounded-[20px] transition-[background-color] duration-200",e.isDragOverComposer?"bg-accent/45 ring-1 ring-primary/70":null,r.projectSelectionRequired?"opacity-75":null),children:[o.firstRow?l("div",{className:"@container/composer-first-row flex select-none items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:o.firstRow}):null,l(iD,{decisionOccupiesComposer:e.isComposerApprovalState}),e.showCollapsedMobilePromptRow?l(PD,{pluginAction:e.pluginAction,api:o.api,composerDraftTarget:o.composerDraftTarget,pendingCustomAnswer:e.activePendingProgress?e.activePendingProgress.customAnswer:null,noProviderAvailable:n.noProviderAvailable,groupSendEligible:h,modelSendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,environmentUnavailable:r.environmentUnavailable!==null,projectSelectionRequired:r.projectSelectionRequired,onExpand:e.expandMobileComposer,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,submitDisabled:f,submitLabel:t("composer.sendMessage"),onSubmit:()=>a.submitComposerOrShellCommand()}):null,l(xG,{input:e,pendingUserInputs:c,showMobilePendingAnswerActions:p,composerPreviewableImages:u,nonPersistedComposerImageIdSet:m,composerPlaceholder:C}),l(t_,{message:e.providerInputSubmissionError??a.composerSubmissionError,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,agentUnavailableNoChoice:n.agentUnavailableNoChoice,modelSendBlock:n.modelSendBlock,selectedModelStatus:n.selectedModelStatus,modelNotes:n.modelNotes,onChooseModel:e.openModelPicker}),l(o_,{eligible:h}),g?l(LD,{pluginAction:e.pluginAction,isComposerFooterCompact:e.isComposerFooterCompact,isComposerPrimaryActionsCompact:e.isComposerPrimaryActionsCompact,isMobileViewport:e.isMobileViewport,showMobilePendingAnswerActions:p,hasPendingUserInputs:c,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable,composerAttachmentInputRef:e.composerAttachmentInputRef,onComposerAttachmentInputChange:e.onComposerAttachmentInputChange,slots:o.slots,selectedInstanceId:n.selectedInstanceId,unavailableAgentInstanceId:r.unavailableAgentInstanceId,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,providerInstanceEntries:n.providerInstanceEntries,lockedProvider:r.lockedProvider,lockedContinuationGroupKey:n.lockedContinuationGroupKey,onAgentInstanceChange:n.onAgentInstanceChange,selectedModelForPickerWithCustomFallback:n.selectedModelForPickerWithCustomFallback,selectedModelStatus:n.selectedModelStatus,selectedModelUnconfirmed:n.selectedModelUnconfirmed,keybindings:o.keybindings,modelOptionsByInstance:n.modelOptionsByInstance,terminalOpen:o.terminalOpen,isComposerModelPickerOpen:e.isComposerModelPickerOpen,setIsComposerModelPickerOpen:e.setIsComposerModelPickerOpen,getModelDisabledReason:o.getModelDisabledReason,getModelContinuationLabel:o.getModelContinuationLabel,onContinueInModel:o.onContinueInModel,onProviderModelSelect:o.onProviderModelSelect,environmentId:o.environmentId,routeKind:o.routeKind,draftId:o.draftId,activeThread:r.activeThread,interactionMode:r.interactionMode,runtimeMode:r.runtimeMode,composerProviderControls:n.composerProviderControls,composerNativeMode:n.composerNativeMode,canSwitchNativeMode:n.canSwitchNativeMode,providerTraitsMenuContent:i.providerTraitsMenuContent,providerTraitsPicker:i.providerTraitsPicker,toggleInteractionMode:o.toggleInteractionMode,handleRuntimeModeChange:o.handleRuntimeModeChange,handleComposerNativeModeChange:n.handleComposerNativeModeChange,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,activeThreadModelDisplayName:n.activeThreadModelDisplayName,pendingPrimaryAction:e.pendingPrimaryAction,phase:r.phase,continuationChecking:r.continuationChecking,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,composerDraft:d,isSendBusy:r.isSendBusy,sendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,groupSendEligible:h,environmentUnavailable:r.environmentUnavailable,handleInterruptPrimaryAction:e.actions.handleInterruptPrimaryAction,interruptArmed:r.interruptArmed,stopping:r.stopping,handleImplementPlanInNewThreadPrimaryAction:e.actions.handleImplementPlanInNewThreadPrimaryAction,shellCommandMode:a.shellCommandMode,shellCommandUnavailableReason:a.hostShellCommand?.unavailableReason??null,compactDisabled:e.compactDisabled,resolvedCompactDisabledReason:n.resolvedCompactDisabledReason,compactThreadContext:e.compactThreadContext}):null]})})}function xG(e){let{input:t,pendingUserInputs:o,showMobilePendingAnswerActions:n}=e,{props:r,model:a,status:s,submit:i,stash:d,composerDraft:c}=t,u=t.activePendingProgress?.activeQuestion?.allowFreeform===!1;return v("div",{ref:t.setComposerMenuAnchor,className:V("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",t.isComposerApprovalState&&"pb-3 sm:pb-4",t.isComposerCollapsedMobile&&"hidden"),children:[l(uD,{api:r.api,environmentId:r.environmentId,composerDraftTarget:r.composerDraftTarget,isComposerCollapsedMobile:t.isComposerCollapsedMobile,isComposerApprovalState:t.isComposerApprovalState,hasPendingUserInputs:o,supportsAttachmentUploads:r.supportsAttachmentUploads,uploadsByImageId:t.uploadsByImageId,composerImages:t.composerImages,composerPreviewableImages:e.composerPreviewableImages,composerBrowserAnnotations:c.browserAnnotations,composerReviewComments:c.reviewComments,composerElementContexts:c.elementContexts,nonPersistedComposerImageIdSet:e.nonPersistedComposerImageIdSet,removeComposerDraftBrowserAnnotation:t.removeComposerDraftBrowserAnnotation,removeComposerDraftReviewComment:t.removeComposerDraftReviewComment,removeComposerDraftElementContext:t.removeComposerDraftElementContext,removeComposerImage:t.removeComposerImage,onExpandImage:r.onExpandImage}),l(n_,{mode:i.shellCommandMode,isMobileViewport:t.isMobileViewport,unavailableReason:i.hostShellCommand?.unavailableReason??null}),v("div",{className:"relative",children:[l(ZD,{handleRef:t.promptInputRef,api:r.api,composerDraftTarget:r.composerDraftTarget,composerDocumentKey:t.composerDocumentKey,promptRef:r.promptRef,editorRef:t.composerEditorRef,menuAnchor:t.composerMenuAnchor,resolvedTheme:r.resolvedTheme,selectedProvider:a.selectedProvider,selectedProviderStatus:a.selectedProviderStatus,planModeUiEnabled:a.planModeUiEnabled,showSkillsInSlashMenu:r.settings.showSkillsInSlashMenu,recentSlashCommandIds:r.recentSlashCommandIds??CG,environmentId:r.environmentId,gitCwd:r.gitCwd,onSlashCommandUsed:r.onSlashCommandUsed,onOpenModelPicker:t.openModelPicker,onInteractionModeChange:t.switchInteractionMode,onToggleInteractionMode:r.toggleInteractionMode,activePendingProgress:t.activePendingProgress,activePendingRequestId:t.pendingUserInputs[0]?.requestId??null,hasPendingUserInputs:o,changeUserInputCustomAnswer:t.changeUserInputCustomAnswer,terminalContexts:c.terminalContexts,showTerminalContexts:!t.isComposerApprovalState&&!o,showEditor:!u,isApprovalState:t.isComposerApprovalState,editorClassName:n?"max-sm:pb-11":void 0,placeholder:e.composerPlaceholder,disabled:t.isComposerApprovalState||s.projectSelectionRequired,onPaste:t.handleComposerPaste,onSubmit:t.handleComposerSubmit,isMobileViewport:t.isMobileViewport,isDraftRoute:r.routeKind==="draft",stashMenuOpen:t.isStashMenuOpen,stashEntries:d.stashQueue,onRestoreStashEntry:d.restoreStashEntry,onDeleteStashEntry:d.deleteStashEntry,onCloseStashMenu:d.closeStashMenu,onPromptEdited:t.onPromptEdited,onUnclaimedEscape:t.handleUnclaimedEscape}),n?l(bG,{input:t}):null]})]})}function bG(e){let{input:t}=e,{model:o,status:n,badges:r}=t;return v("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,l(fl,{compact:!0,pendingAction:t.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:n.isSendBusy,sendDisabledReason:o.sendDisabledReason,isEnvironmentUnavailable:n.environmentUnavailable!==null||o.noProviderAvailable||n.projectSelectionRequired,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:t.actions.handleInterruptPrimaryAction,interruptArmed:n.interruptArmed,stopping:n.stopping,onImplementPlanInNewThread:t.actions.handleImplementPlanInNewThreadPrimaryAction})]})}function a_(e){let{formRef:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,dragHandlers:a,onDragLeaveCapture:s,badges:i,stashQueueLength:d,isStashMenuOpen:c,stashPulse:u,toggleStashMenu:m,drawers:p,children:f}=e;return v("form",{ref:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,onDragEnterCapture:a.onDragEnter,onDragOverCapture:a.onDragOver,onDragLeaveCapture:s,onDropCapture:a.onDrop,className:V("mx-auto w-full min-w-0 max-w-3xl",i.hasShoulderTab&&"pt-7"),"data-chat-composer-form":"true",children:[p,v("div",{className:"relative",children:[i.showShoulderTabs&&i.visibleTasksProgress&&i.visibleTaskSteps?l(Yf,{expanded:!1,hasTrailingShoulder:d>0,onDismiss:i.dismissTasks,onToggle:i.toggleTasksDrawer,progress:i.visibleTasksProgress,steps:i.visibleTaskSteps}):null,i.showShoulderTabs?l(Xf,{count:d,menuOpen:c,pulseKey:u.key,pulsing:u.active,onToggleMenu:m}):null,f]})]})}function s_(e){let{t}=z(),n=(e.activePendingProgress?.activeQuestion?.multiSelect??!1)||(e.pendingPrimaryAction?.isLastQuestion??!1);return l("div",{className:"px-3 pb-3 sm:px-4",children:v("div",{"data-chat-composer-mobile-pending-compact":"true",className:V("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:l("button",{type:"button",className:V("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:r=>r.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?l(fl,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}var i_={accept:0,acceptForSession:1,acceptAlways:2,decline:3,cancel:4};function l_(e){return e.map((t,o)=>({option:t,index:o})).toSorted((t,o)=>i_[t.option.decision]-i_[o.option.decision]||t.index-o.index).map(t=>t.option)}function d_(e){return{leading:e.filter(t=>t.decision==="cancel"),trailing:e.filter(t=>t.decision!=="cancel").toReversed()}}function c_(e){return[...e.filter(t=>t.tone!=="primary"),...e.filter(t=>t.tone==="primary")]}$();var wG=2e3,TG="min-h-8 max-w-full py-1.5 whitespace-normal text-start pointer-coarse:min-h-11 pointer-coarse:min-w-11",IG=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 SG(e,t){if(e.displayKind!=="standard")return e.label;switch(e.decision){case"cancel":return t("composer.cancel");case"decline":return t("composer.decline");case"acceptForSession":return t("composer.alwaysAllowSession");case"acceptAlways":return t("composer.alwaysAllow");case"accept":return t("composer.approve");default:return e.label}}function kG(e,t){let o=[];return t<9&&o.push(String(t+1)),e==="accept"&&o.push("Enter"),e==="cancel"&&o.push("Escape"),o.length>0?o.join(" "):void 0}var Zf=pe(function({requestId:t,isResponding:o,options:n,keybindings:r,declineReasonRelay:a,shortcuts:s=!0,onRespondToApproval:i}){let{t:d}=z(),c=l_(n??IG(d)),u=it(),m=(a==="native"||a==="queued")&&c.some(T=>T.decision==="decline"),[p,f]=q(!1),[g,h]=q(""),y=E([]);H(()=>{h(""),f(!1)},[t]);let x=R(T=>{let S=T==="decline"?g.trim():"";i(t,T,S.length>0?S:void 0)},[g,i,t]),C=R(T=>{if(T==="decline"&&m&&!p){f(!0);return}x(T)},[m,p,x]),b=R(T=>{let S=y.current.filter(N=>N!==null);if(S.length===0)return;let P=S.findIndex(N=>N===document.activeElement),A=P===-1?T===1?0:S.length-1:(P+T+S.length)%S.length;S[A]?.focus()},[]);if(u.pane.useKeydown(T=>{if(!s||o||T.defaultPrevented||u.terminalFocus.getOwner()!==null||T.isComposing||T.keyCode===229||T.key==="Enter"&&!T.metaKey&&!T.ctrlKey&&!T.altKey&&!T.shiftKey&&eS(T.target))return;let S=er(T.target);if(r&&(!S||T.metaKey||T.ctrlKey||T.altKey)){let N=u.keybindings.approvalDecisionFromCommand(u.keybindings.resolveShortcutCommand(T,r));if(N!==null&&c.some(B=>B.decision===N)){T.preventDefault(),x(N);return}}if(S)return;let P=tS(T,c);if(P===null)return;if(T.preventDefault(),P.type==="move"){b(P.delta);return}let A=c[P.index];A&&C(A.decision)},{target:"document"}),p)return v("div",{className:"flex w-full min-w-0 flex-col gap-1.5",children:[v("div",{className:"flex min-w-0 items-center gap-1",children:[l(Vr,{type:"text",value:g,autoFocus:!0,disabled:o,maxLength:wG,placeholder:d("approval.declineReasonPlaceholder"),"aria-label":d("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-0 flex-1 pointer-coarse:min-h-11",onChange:T=>h(T.target.value),onKeyDown:T=>{if(!(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)){if(T.key==="Enter"){T.preventDefault(),x("decline");return}T.key==="Escape"&&(T.preventDefault(),g.length>0?h(""):f(!1))}}}),l(K,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-foreground",disabled:o,onClick:()=>f(!1),children:d("approval.actions.back")}),l(K,{size:"sm","data-approval-decision":"decline",disabled:o,onClick:()=>x("decline"),children:d("composer.decline")})]}),a==="queued"?l("p",{className:"text-chat-row text-muted-foreground",children:d("approval.declineReasonQueuedNote")}):null]});let{leading:L,trailing:w}=d_(c),k=[...L,...w];y.current.length=k.length;let I=T=>{let S=c.indexOf(T),P=k.indexOf(T),A=s&&S<9?S+1:null,N=T.decision==="accept";return v(K,{ref:B=>{y.current[P]=B},size:"sm",variant:N?"default":"ghost",style:{height:"auto"},"data-approval-decision":T.decision,"aria-keyshortcuts":s?kG(T.decision,S):void 0,className:V(TG,!N&&"text-muted-foreground hover:text-foreground"),disabled:o,onClick:()=>C(T.decision),children:[l("span",{className:"min-w-0 wrap-anywhere",children:SG(T,d)}),A===null?null:l(oi,{className:Ci,children:A})]},T.decision)};return v("div",{className:"flex w-full min-w-0 flex-wrap items-center gap-1",children:[L.map(I),l("span",{className:"flex-1"}),w.map(I)]})});$();function p_(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let o=u_(t.oldText??""),n=u_(t.newText);if(o.length===0&&n.length===0)return null;let r=`--- a/${e.path}
|
|
3591
3573
|
+++ b/${e.path}
|
|
3592
3574
|
`,a=`@@ -${o.length===0?"0,0":`1,${o.length}`} +${n.length===0?"0,0":`1,${n.length}`} @@
|
|
3593
3575
|
`,s=[...o.map(i=>`-${i}`),...n.map(i=>`+${i}`)];return`${r}${a}${s.join(`
|
|
3594
3576
|
`)}
|
|
3595
|
-
`}function
|
|
3596
|
-
`);return t.at(-1)===""?t.slice(0,-1):t}function
|
|
3597
|
-
`,v:"\v",f:"\f",r:"\r"};function
|
|
3577
|
+
`}function u_(e){if(e.length===0)return[];let t=e.split(`
|
|
3578
|
+
`);return t.at(-1)===""?t.slice(0,-1):t}function m_(e){let t=new Map;return e.map(o=>{let n=t.get(o.path)??0;return t.set(o.path,n+1),n===0?o.path:`${o.path}#${n}`})}function f_(e){return{additions:e.additions??0,deletions:e.deletions??0}}var LG={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},PG={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"},RG={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"},EG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function YC(e,t){if(e.headline!==null)return e.headline;let o=e.subject!==null?LG[e.kind]:void 0;return o!==void 0?t(o,{name:e.subject}):t(PG[e.kind])}function JC(e,t){return t(RG[e])}function g_(e,t){return t(EG[e])}$();$();var h_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function y_(e){return e==="dark"?h_.dark:h_.light}function Zc(e,t){return e-(t===0?0:1)}function ex(e,t){return Zc(e,t)+t}function tx(e,...t){return`ck1:${JSON.stringify([e,...t])}`}function ox(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var AG=new TextEncoder,NG=new TextDecoder("utf-8",{ignoreBOM:!0}),DG=/[\uD800-\uDFFF]/,nx=1024,vl=new Uint8Array(nx);function w_(){vl.length!==nx&&(vl=new Uint8Array(nx))}function Kt(e){if(e.length===0)return e;if(DG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;vl.length<t&&(vl=new Uint8Array(t));let{written:o}=AG.encodeInto(e,vl);return NG.decode(vl.subarray(0,o))}b_();var _G=new TextDecoder("utf-8",{ignoreBOM:!0}),OG={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:" ",n:`
|
|
3579
|
+
`,v:"\v",f:"\f",r:"\r"};function T_(e){if(e[0]!=='"')return;let t="",o=1;for(;o<e.length;){let n=e[o];if(n==='"')return{fileName:t,rawLength:o+1};if(n!=="\\"){t+=n,o++;continue}let r=OG[e[o+1]];if(r!=null){t+=r,o+=2;continue}let a=[];do{let s=FG(e,o+1);if(s==null)return;a.push(s),o+=4}while(e[o]==="\\"&&e[o+1]>="0"&&e[o+1]<="7");t+=_G.decode(new Uint8Array(a))}}function FG(e,t){let o=e.charCodeAt(t)-48,n=e.charCodeAt(t+1)-48,r=e.charCodeAt(t+2)-48;if(o>=0&&o<=3&&n>=0&&n<=7&&r>=0&&r<=7)return o*64+n*8+r}function S_(e){for(let t of e.hunks)for(let o=0;o<t.hunkContent.length;o++){let n=t.hunkContent[o];if(n.type!=="change")continue;let r=BG(e,n);r!=null&&(t.hunkContent.splice(o,1,...r),o+=r.length-1)}}function BG(e,t){let{deletions:o,additions:n,deletionLineIndex:r,additionLineIndex:a}=t,s=Math.min(o,n),i=Math.abs(n-o);if(s===0||i===0||s*(i+1)>4096)return null;let d=[];for(let h=0;h<o;h++)d.push(I_(e.deletionLines[r+h]??""));let c=[];for(let h=0;h<n;h++)c.push(I_(e.additionLines[a+h]??""));let u=n>o,m=0,p=-1;for(let h=0;h<=i;h++){let y=0;for(let x=0;x<s;x++)y+=UG(d[x+(u?0:h)],c[x+(u?h:0)]);h===0?p=y+s*.5:y>p&&(p=y,m=h)}if(m===0)return null;let f=[],g=(h,y,x,C)=>{(h>0||y>0)&&f.push({type:"change",deletions:h,additions:y,deletionLineIndex:x,additionLineIndex:C})};return u?(g(0,m,r,a),g(s,s,r,a+m),g(0,n-s-m,r+s,a+m+s)):(g(m,0,r,a),g(s,s,r+m,a),g(o-s-m,0,r+m+s,a+s)),f}var HG=/\s+/g;function I_(e){return e.replace(HG,"")}function UG(e,t){if(e===t)return 1;let o=Math.max(e.length,t.length),n=Math.min(e.length,t.length);if(n===0)return 0;let r=0;for(;r<n&&e[r]===t[r];)r++;let a=0;for(;a<n-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/o}var $G=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function zG(e,{cacheKeyPrefix:t,disableLineMatching:o,throwOnError:n=!1}={},r){let a=YG(e),s=a?WG(e):GG(e),i=o===!0?"patch-file-raw":"patch-file",d,c=[];for(let u of s){if(a&&!ZC.test(u)){if(d==null)d=Kt(u);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",u)}continue}else if(!a&&!jG(u)){if(d==null)d=Kt(u);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",u)}continue}let m=KG(u,{cacheKey:t!=null?r==null?tx(i,t,String(c.length)):tx(i,t,String(r),String(c.length)):void 0,isGitDiff:a,disableLineMatching:o,throwOnError:n});m!=null&&c.push(m)}return{patchMetadata:d,files:c}}function KG(e,{cacheKey:t,disableLineMatching:o=!1,isGitDiff:n=ZC.test(e),oldFile:r,newFile:a,throwOnError:s=!1}={}){let i=0,d=N_(e,"@@ "),c,u=r==null||a==null,m=0,p=0;for(let f of d){let g=E_(f),h=g[0];if(h==null){if(s)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",f);continue}let y=A_(h),x=0,C=0;if(y==null||c==null){if(c!=null){if(s)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",f);continue}c={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&r!=null&&a!=null?k_(a.contents):[],deletionLines:!u&&r!=null&&a!=null?k_(r.contents):[],additionCharacterCount:!u&&r!=null&&a!=null?a.contents.length:0,deletionCharacterCount:!u&&r!=null&&a!=null?r.contents.length:0,cacheKey:R_(t)},c.additionLines.length===1&&a?.contents===""&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===""&&(c.deletionLines.length=0);for(let P of g){if(P.startsWith("diff --git")){let N=P.trim().match($G);if(N==null){if(s)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",P);continue}let B=eu(N[1],!0),O=eu(N[2],!0);c.name=Kt(O),B!==O&&(c.prevName=Kt(B));continue}let A=P.startsWith("---")||P.startsWith("+++")?P.match(C_):null;if(A!=null){let[,N,B]=A,O=eu(B,n);if(N==="---"&&O!=="/dev/null"){let j=Kt(O);c.prevName=j,c.name=j}else N==="+++"&&O!=="/dev/null"&&(c.name=Kt(O))}else if(n){if(P.startsWith("new mode ")&&(c.mode=Kt(P.slice(8).trim())),P.startsWith("old mode ")&&(c.prevMode=Kt(P.slice(8).trim())),P.startsWith("new file mode")&&(c.type="new",c.mode=Kt(P.slice(13).trim())),P.startsWith("deleted file mode")&&(c.type="deleted",c.mode=Kt(P.slice(17).trim())),P.startsWith("similarity index")&&(P.startsWith("similarity index 100%")?c.type="rename-pure":c.type="rename-changed"),P.startsWith("index ")){let[,N,B,O]=P.trim().match(x_)??[];N!=null&&(c.prevObjectId=Kt(N)),B!=null&&(c.newObjectId=Kt(B)),O!=null&&(c.mode=Kt(O))}(P.startsWith("rename from ")||P.startsWith("copy from "))&&(c.prevName=Kt(eu(P.slice(P.startsWith("rename")?12:10)))),(P.startsWith("rename to ")||P.startsWith("copy to "))&&(c.name=Kt(eu(P.slice(P.startsWith("rename")?10:8))))}}continue}let b,L;for(;g.length>0&&(g[g.length-1]===`
|
|
3598
3580
|
`||g[g.length-1]==="\r"||g[g.length-1]===`\r
|
|
3599
|
-
`||g[g.length-1]==="");)g.pop();let{additionStart:w,deletionStart:k}=y;m=u?m:k-1,p=u?p:w-1;let I={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:y.additionCount,additionStart:w,additionLines:x,deletionCount:y.deletionCount,deletionStart:k,deletionLines:C,deletionLineIndex:m,additionLineIndex:p,hunkContent:[],hunkContext:
|
|
3600
|
-
From `)}function
|
|
3601
|
-
`,o);if(n===-1)break;t.push(e.slice(o,n+1)),o=n+1}return o<e.length&&t.push(e.slice(o)),t}function
|
|
3602
|
-
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function
|
|
3603
|
-
`,t);return o===-1?e.length:o+1}function
|
|
3604
|
-
`&&o!=="\r")return!1}return!0}function
|
|
3581
|
+
`||g[g.length-1]==="");)g.pop();let{additionStart:w,deletionStart:k}=y;m=u?m:k-1,p=u?p:w-1;let I={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:y.additionCount,additionStart:w,additionLines:x,deletionCount:y.deletionCount,deletionStart:k,deletionLines:C,deletionLineIndex:m,additionLineIndex:p,hunkContent:[],hunkContext:R_(y.hunkContext),hunkSpecs:Kt(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},T=0,S=0;for(let P=1;P<g.length;P++){let A=g[P];if(T>=I.additionCount&&S>=I.deletionCount&&!A.startsWith("\\")){if(!(VG(A)&&!QG(A)))break;if(s)throw Error("parsePatchContent: hunk has more lines than expected")}let N=A[0];if(N!=="+"&&N!=="-"&&N!==" "&&N!=="\\"){if(s)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${N}", full line: "${A}"`),console.error("processFile: invalid rawLine:",A);continue}let B=JG(N);if(B==="addition"){if(s&&T>=I.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let O=rx(A);(b==null||b.type!=="change")&&(b=ax("change",m,p),I.hunkContent.push(b)),p++,T++,u&&(c.additionLines.push(O),c.additionCharacterCount+=O.length),b.additions++,x++,L="addition"}else if(B==="deletion"){if(s&&S>=I.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let O=rx(A);(b==null||b.type!=="change")&&(b=ax("change",m,p),I.hunkContent.push(b)),m++,S++,u&&(c.deletionLines.push(O),c.deletionCharacterCount+=O.length),b.deletions++,C++,L="deletion"}else if(B==="context"){if(s&&(S>=I.deletionCount||T>=I.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let O=rx(A);(b==null||b.type!=="context")&&(b=ax("context",m,p),I.hunkContent.push(b)),p++,m++,T++,S++,u&&(c.deletionLines.push(O),c.additionLines.push(O),c.deletionCharacterCount+=O.length,c.additionCharacterCount+=O.length),b.lines++,L="context"}else if(B==="metadata"&&b!=null){if(b.type==="context"?(I.noEOFCRAdditions=!0,I.noEOFCRDeletions=!0):L==="deletion"?I.noEOFCRDeletions=!0:L==="addition"&&(I.noEOFCRAdditions=!0),u&&(L==="addition"||L==="context")){let O=c.additionLines.length-1;if(O>=0){let j=c.additionLines[O],U=ox(j);c.additionLines[O]=U,c.additionCharacterCount+=U.length-j.length}}if(u&&(L==="deletion"||L==="context")){let O=c.deletionLines.length-1;if(O>=0){let j=c.deletionLines[O],U=ox(j);c.deletionLines[O]=U,c.deletionCharacterCount+=U.length-j.length}}}}if(T!==I.additionCount||S!==I.deletionCount){if(s)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${h.trimEnd()}", declared old/new ${I.deletionCount}/${I.additionCount}, parsed old/new ${S}/${T}`);let P=Zc(I.additionStart,I.additionCount)+(T===0?0:1),A=Zc(I.deletionStart,I.deletionCount)+(S===0?0:1);if(!u){let N=P-I.additionStart,B=A-I.deletionStart;I.additionLineIndex+=N,I.deletionLineIndex+=B;for(let O of I.hunkContent)O.additionLineIndex+=N,O.deletionLineIndex+=B}I.additionStart=P,I.deletionStart=A,I.additionCount=T,I.deletionCount=S}I.additionLines=x,I.deletionLines=C,I.collapsedBefore=Math.max(Zc(I.additionStart,I.additionCount)-i,0),c.hunks.push(I),i=ex(I.additionStart,I.additionCount);for(let P of I.hunkContent)P.type==="context"?(I.splitLineCount+=P.lines,I.unifiedLineCount+=P.lines):(I.splitLineCount+=Math.max(P.additions,P.deletions),I.unifiedLineCount+=P.deletions+P.additions);I.splitLineStart=c.splitLineCount+I.collapsedBefore,I.unifiedLineStart=c.unifiedLineCount+I.collapsedBefore,c.splitLineCount+=I.collapsedBefore+I.splitLineCount,c.unifiedLineCount+=I.collapsedBefore+I.unifiedLineCount}if(c!=null){if(s&&u&&!n&&c.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(c.hunks.length>0&&!u&&c.additionLines.length>0&&c.deletionLines.length>0){let f=c.hunks[c.hunks.length-1],g=ex(f.additionStart,f.additionCount),h=c.additionLines.length,y=Math.max(h-g,0);c.splitLineCount+=y,c.unifiedLineCount+=y}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type="rename-changed":c.type="rename-pure":(r==null||r.contents==="")&&a!=null&&a.contents!==""?c.type="new":r!=null&&r.contents!==""&&(a==null||a.contents==="")&&(c.type="deleted")),c.type!=="rename-pure"&&c.type!=="rename-changed"&&(c.prevName=void 0),o||S_(c),c}}function ix(e,t={}){let{cacheKeyPrefix:o,throwOnError:n=!1}=t,r=[],a=qG(e)?e.split(v_):[e];for(let s of a)try{r.push(zG(s,t,o!=null?r.length:void 0))}catch(i){if(n)throw i;console.error(i)}finally{w_()}return r}function eu(e,t=!1){let o=e.trim(),n=o.startsWith('"')?T_(o)?.fileName??o:o;return t&&(n.startsWith("a/")||n.startsWith("b/"))?n.slice(2):n}function qG(e){return e.startsWith("From ")||e.includes(`
|
|
3582
|
+
From `)}function k_(e){let t=E_(e);for(let o=0;o<t.length;o++)t[o]=Kt(t[o]);return t}function E_(e){if(e.length===0)return[""];let t=[],o=0;for(;;){let n=e.indexOf(`
|
|
3583
|
+
`,o);if(n===-1)break;t.push(e.slice(o,n+1)),o=n+1}return o<e.length&&t.push(e.slice(o)),t}function WG(e){return N_(e,"diff --git")}function GG(e){if(e.length===0)return[""];let t=[],o=0,n=0,r=0,a=0,s=!1;for(;n<e.length;){let i=sx(e,n);if(r<=0&&a<=0){if(M_(e,n)){n>o&&t.push(e.slice(o,n)),o=n,s=!0,n=sx(e,i);continue}if(s&&e.startsWith("@@ -",n)){let c=A_(e.slice(n,i));c!=null&&(r=c.deletionCount,a=c.additionCount)}n=i;continue}let d=e[n];if(d==="\\"){n=i;continue}d===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):d==="-"?r=Math.max(r-1,0):d==="+"&&(a=Math.max(a-1,0)),n=i}return t.push(e.slice(o)),t}function jG(e){return M_(e,0)}function M_(e,t){let o=sx(e,t);return L_(e,t,"---")&&L_(e,o,"+++")}function L_(e,t,o){if(!e.startsWith(o,t))return!1;let n=e[t+o.length];if(n!==" "&&n!==" ")return!1;for(let r=t+o.length+1;r<e.length;r++){let a=e[r];if(a===`
|
|
3584
|
+
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function sx(e,t){let o=e.indexOf(`
|
|
3585
|
+
`,t);return o===-1?e.length:o+1}function VG(e){let t=e[0];return t==="+"||t==="-"||t===" "}function QG(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let o=e[t];if(o!==" "&&o!==" "&&o!==`
|
|
3586
|
+
`&&o!=="\r")return!1}return!0}function A_(e){if(!e.startsWith("@@ -"))return;let t=4,o=eg(e,t);if(o==null)return;let n=o.value;t=o.endIndex;let r=1;if(e[t]===","){let u=eg(e,t+1);if(u==null)return;r=u.value,t=u.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=eg(e,t);if(a==null)return;let s=a.value;t=a.endIndex;let i=1;if(e[t]===","){let u=eg(e,t+1);if(u==null)return;i=u.value,t=u.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let d,c=t+3;return e[c]===" "&&(d=XG(e.slice(c+1))),{additionCount:i,additionStart:s,deletionCount:r,deletionStart:n,hunkContext:d}}function eg(e,t){let o=t,n=0;for(;o<e.length;o++){let r=e.charCodeAt(o)-48;if(r<0||r>9)break;n=n*10+r}if(o!==t)return{value:n,endIndex:o}}function XG(e){return e.endsWith(`\r
|
|
3605
3587
|
`)?e.slice(0,-2):e.endsWith(`
|
|
3606
|
-
`)?e.slice(0,-1):e}function
|
|
3607
|
-
diff --git`)}function
|
|
3608
|
-
${t}`,n=e.startsWith(t)?0:
|
|
3609
|
-
`:t)}function
|
|
3610
|
-
`).length,a=e.text.split(/\r?\n/,1)[0]??"",s=e.command?!0:!e.singleLine&&(r>JG||e.text.length>ZG),i=e.command&&!o,d=i?a:e.text;return v("div",{className:"flex min-w-0 flex-col gap-1",children:[e.hidePreview&&!o?null:l("div",{className:ej,children:l("code",{"aria-label":e.label,className:G(tj,e.singleLine||i?"block truncate whitespace-pre":"whitespace-pre-wrap [overflow-wrap:anywhere]",e.singleLine||i?"block":s&&!o?"line-clamp-4":"block"),"data-approval-detail":i?"preview":"complete",tabIndex:0,children:e.singleLine||i?d:oj(d)})}),s?l(K,{type:"button",variant:"ghost",size:"xs",className:"w-fit text-chat-row text-muted-foreground","aria-expanded":o,onClick:()=>n(c=>!c),children:e.command?t(o?"approval.body.hideCommand":"approval.body.showCommand"):t(o?"approval.body.showLess":"approval.body.showAll")}):null]})}var __=pe(function({approval:t,pendingCount:o,onOpenDiff:n,actions:r,className:a}){let{t:s}=z(),i=t.presentation;if(i===void 0)return l(xr,{state:"pending",className:a,icon:D_(t.requestKind),title:tx(t.requestKind,s),actions:r,children:t.detail?l("p",{className:"whitespace-pre-wrap text-chat-row",children:t.detail}):null});let{body:d}=i,c=i_(i.fileChanges),u=i.headline===null?i.description:null,m=i.outsideSandbox||u||i.justification?v("span",{className:"inline-flex flex-wrap gap-x-2 gap-y-1",children:[i.outsideSandbox?l("span",{className:"text-warning-foreground",children:s("approval.outsideSandbox")}):null,u?l("span",{children:u}):null,i.justification?l("span",{children:i.justification}):null]}):void 0;return l(xr,{state:"pending",className:a,icon:D_(i.kind),title:i.headlineIsCommand?l("span",{className:"block truncate font-mono [font-variant-ligatures:none]",children:ex(i,s)}):ex(i,s),subtitle:m,meta:o>1?`1/${o}`:void 0,actions:r,children:v("div",{"aria-label":tx(i.kind,s),className:"flex min-w-0 flex-col gap-2",role:"group",children:[d.shape==="none"?null:l(nj,{command:d.shape==="command",hidePreview:i.headlineIsCommand,label:d_(d.shape,s),singleLine:d.shape==="path"||d.shape==="url",text:d.shape==="command"?d.command:d.shape==="path"?d.path:d.shape==="url"?d.url:d.shape==="query"?d.query:d.text},t.requestId),i.fileChanges.map((p,f)=>l(N_,{fileChange:p,onOpenDiff:n},c[f])),i.detailArgs.length===0?null:v("details",{className:"min-w-0","data-approval-args":"true",children:[l("summary",{className:"cursor-[var(--control-cursor)] text-chat-row text-muted-foreground",children:s("approval.body.detailsSummary")}),l("dl",{"aria-label":s("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 bg-muted p-2 text-ui-sm [scrollbar-width:thin]",tabIndex:0,children:i.detailArgs.map(p=>v("div",{className:"col-span-2 grid grid-cols-subgrid",children:[l("dt",{className:"font-mono text-muted-foreground",children:p.name}),l("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:p.value})]},p.name))})]})]})})});var au=pe(function(t){return l(__,{...t})});$();function rj(e){return[...e.filter(t=>t.tone==="primary"),...e.filter(t=>t.tone!=="primary")]}var su=pe(function(t){let{t:o}=z(),n=lt(),{shortcuts:r=!0}=t,[a,s]=q(!1),[i,d]=q(!1),c=M(!1),u=t.decision,m=u.requestId,p=rj(u.options),{onRespond:f}=t,g=P(L=>{m===null||c.current||(c.current=!0,d(!0),Promise.resolve(f(m,L)).finally(()=>{c.current=!1,d(!1)}))},[f,m]);if(n.pane.useKeydown(L=>{if(!r||m===null||c.current||L.defaultPrevented||n.terminalFocus.getOwner()!==null||L.isComposing||L.keyCode===229||L.metaKey||L.ctrlKey||L.altKey||L.shiftKey||rr(L.target))return;let w=Ud(L.key,p.length);if(w===null)return;let k=p[w];k&&(L.preventDefault(),g(k.id))},{target:"document"}),m===null)return null;let h=L=>L.key===void 0?L.text:o(L.key,{...L.params,defaultValue:L.text}),y=u.askedBy.kind==="plugin"?u.askedBy.pluginId:null,[x,...C]=u.body,b=L=>{let w=p.indexOf(L),k=L.tone==="primary";return v(K,{size:"sm",variant:k?"default":"ghost",className:G(!k&&(L.tone==="danger"?"text-destructive-foreground hover:text-destructive-foreground":"text-muted-foreground hover:text-foreground")),disabled:i,onClick:()=>g(L.id),children:[h(L.label),r&&w<9?l(ai,{className:wi,children:w+1}):null]},L.id)};return l(xr,{state:"pending",className:G("px-3 py-2 sm:px-4",t.className),icon:y===null?l(Ha,{}):l(pd,{}),title:h(u.title),subtitle:x===void 0?void 0:h(x),meta:y===null?void 0:l(Do,{environmentId:t.environmentId,pluginId:y,iconClassName:"size-3"}),actions:v(oe,{children:[u.detail===null?null:l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground","aria-expanded":a,onClick:()=>s(L=>!L),children:o(a?"decision.hideDetail":"decision.showDetail")}),r_(u.options).map(b)]}),children:v("div",{className:"contents","data-composer-pending-decision":"true",children:[C.map((L,w)=>l("p",{className:"min-w-0 text-chat-row text-muted-foreground",children:h(L)},`${String(w)}:${L.key??L.text}`)),u.detail!==null&&a?l("pre",{className:"max-h-60 min-w-0 overflow-auto rounded-md bg-muted px-2.5 py-2 font-mono text-chat-code whitespace-pre-wrap text-foreground/90 [font-variant-ligatures:none] [overflow-wrap:anywhere]",children:u.detail.text.slice(0,4e3)}):null]})})});$();var ig=pe(function({pendingUserInputs:t,respondingRequestIds:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i=!0}){if(t.length===0)return null;let d=t[0];return d?l(aj,{prompt:d,isResponding:o.includes(d.requestId),answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i},d.requestId):null}),aj=pe(function({prompt:t,isResponding:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i}){let{t:d}=z(),c=lt(),u=jf(t.questions,n,r),m=u.activeQuestion,p=M(null),f=M(s),[g,h]=q(null),[y,x]=q(null),C=y!==null&&y===m?.id;H(()=>{f.current=s},[s]),H(()=>{if(!(!m||m.multiSelect||!g)){if(g.questionId!==m.id){h(null);return}u.customAnswer.trim().length===0&&u.selectedOptionLabels.includes(g.optionLabel)&&h(null)}},[m,g,u.customAnswer,u.selectedOptionLabels]);let b=P(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]);H(()=>b,[b]);let L=P(S=>{b(),s(S)},[b,s]),w=P((S,R)=>{if(m?.multiSelect){a(S,R);return}if(h({questionId:S,optionLabel:R}),a(S,R),b(),u.isLastQuestion)return;let A=u.questionIndex+1;p.current=window.setTimeout(()=>{p.current=null,f.current(A)},200)},[m,b,a,u.isLastQuestion,u.questionIndex]);if(c.pane.useKeydown(S=>{if(!i||!m||o||C||S.metaKey||S.ctrlKey||S.altKey||S.isComposing||S.keyCode===229||rr(S.target))return;let R=Ud(S.key,m.options.length);if(R===null)return;let A=m.options[R];A&&(S.preventDefault(),w(m.id,Ra(A)))},{target:"document"}),!m)return null;let k=u.customAnswer.trim().length>0,I=g?.questionId===m.id?g.optionLabel:null,T=I!==null?[I]:k?[]:u.selectedOptionLabels;return v(xr,{state:"pending",className:"px-3 py-2 sm:px-4",icon:m.kind==="plan"?l(od,{}):l(jn,{}),title:m.header,meta:C&&t.questions.length>1?`${u.questionIndex+1}/${t.questions.length}`:void 0,collapse:{collapsed:C,onCollapsedChange:S=>{x(S?m.id:null)},hint:m.question,toggleLabel:d(C?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion")},children:[l(Vf,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L}),l("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-chat text-foreground","data-pending-user-input-body":m.kind??"question",tabIndex:0,children:m.kind==="plan"?l(Io,{text:m.question,cwd:void 0,isStreaming:!1}):l("p",{className:"whitespace-pre-wrap font-medium",children:m.question})}),m.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:d("pendingUserInput.selectOneOrMore")}):null,l(qu,{mode:m.multiSelect?"multiple":"single","aria-label":m.header,disabled:o,selected:T,onToggle:S=>{w(m.id,S)},onReselect:S=>{w(m.id,S)},options:m.options.map((S,R)=>{let A=Cl(d,m,S);return{value:Ra(S),label:A.label,...A.description&&A.description!==A.label?{description:A.description}:{},...i&&R<9?{trailing:l(ai,{className:wi,children:R+1})}:{}}})},m.id),l(Qf,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L})]})});$();var O_=pe(function({planTitle:t}){let{t:o}=z();return l("div",{className:"px-3 py-2 sm:px-4",children:v("div",{className:"flex flex-wrap items-center gap-2",children:[l("span",{className:"text-xs font-medium text-muted-foreground",children:o("plan.ready")}),t?l("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function F_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return l(ag,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function B_(e){return e.occupant.kind!=="user-input"?null:l(ig,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onGoToQuestion:e.onGoToActivePendingUserInputQuestion})}var H_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:l(au,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:F_(e),className:"px-3 py-2 sm:px-4"}),collapsed:e=>e.occupant.kind!=="approval"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(au,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:F_(e),className:"px-3 pt-2 pb-3 sm:px-4"})})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:l(su,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(su,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:B_,collapsed:e=>v("div",{"data-chat-composer-collapsed-controls":"true",children:[B_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:l(O_,{planTitle:e_(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function U_(e,t){let o=H_[e.occupant.kind],n=t?o.collapsed:o.expanded;return n===null?null:n(e)}var sLe=Object.keys(H_);function $_(e){let{composerOccupant:t,showComposerTopDrawer:o,hasBlockingComposerTopDrawer:n,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,activeProposedPlan:g,activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,badges:C,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,environmentUnavailable:k,noProviderAvailable:I,projectSelectionRequired:T,onGoToActivePendingUserInputQuestion:S,handleInterruptPrimaryAction:R,handleImplementPlanInNewThreadPrimaryAction:A}=e,{inlineTasksBadge:N,inlineStashBadge:B,visibleTasksProgress:O,visibleTaskSteps:V,dismissTasks:U,toggleTasksDrawer:D}=C;return v(oe,{children:[o&&(!r||n)?l("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-occupant":t?.kind??"none",children:t===null?null:U_({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,onGoToActivePendingUserInputQuestion:S,activeProposedPlan:g,collapsedPendingRow:l(ZD,{activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,inlineTasksBadge:N,inlineStashBadge:B,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,isEnvironmentUnavailable:k!==null||I||T,handleInterruptPrimaryAction:R,handleImplementPlanInNewThreadPrimaryAction:A})},a)}):null,r&&!n&&O&&V?l(FN,{onDismiss:U,onCollapse:D,progress:O,steps:V}):null]})}function z_(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,browserAnnotations:e.browserAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,promptHasText:e.prompt.trim().length>0,hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.browserAnnotations.length+e.reviewComments.length}).hasSendableContent}}function K_(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(o=>o.setPrompt),setComposerDraftNativeMode:t(o=>o.setNativeMode),addComposerDraftImage:t(o=>o.addImage),addComposerDraftImages:t(o=>o.addImages),removeComposerDraftImage:t(o=>o.removeImage),insertComposerDraftTerminalContext:t(o=>o.insertTerminalContext),removeComposerDraftElementContext:t(o=>o.removeElementContext),removeComposerDraftBrowserAnnotation:t(o=>o.removeBrowserAnnotation),removeComposerDraftReviewComment:t(o=>o.removeReviewComment),clearComposerDraftPromptAndImages:t(o=>o.clearComposerPromptAndImages)}}$();function q_(e){let{onComposerPaste:t,submitComposer:o,exitShellCommandMode:n}=e,r=M({onComposerPaste:t,submitComposer:o,exitShellCommandMode:n});r.current={onComposerPaste:t,submitComposer:o,exitShellCommandMode:n};let a=P(d=>{r.current.onComposerPaste(d)},[]),s=P((d,c)=>{r.current.submitComposer(d,c)},[]),i=P(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}$();var W_=qe(null);function G_({children:e}){let{data:t,target:o,threadKey:n}=zo(),r=t.useComposerStatus({target:o,threadKey:n});return l(W_.Provider,{value:r,children:e})}function j_(){let e=Rt(W_);if(e===null)throw new Error("Composer status has not been provided.");return e}var V_=pe(function(t){let o=jA(),{data:n,target:r,threadKey:a}=zo(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:d,activePendingResolvedAnswers:c,activePendingIsResponding:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,questionAttachmentsSupported:f,respondingRequestIds:g,occupants:h,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,changeUserInputCustomAnswer:b,goToUserInputQuestion:L}=n.useComposerPending({target:r,threadKey:a}),{runtimeMode:w,interactionMode:k,lockedProvider:I,providerStatuses:T,activeProjectDefaultModelSelection:S,projectId:R,activeThreadModelSelection:A,activeThreadActualModel:N}=n.useComposerModelContext(r),{activeThreadId:B,activeThread:O,isLocalDraftThread:V,projectSelectionRequired:U,phase:D,isSendBusy:X,continuationChecking:j=!1,sendDisabledReason:E,groupSendDisabledReason:Y,unavailableAgentInstanceId:F=null,noAgentChosen:Z=!1,environmentUnavailable:J,compactDisabled:ne,compactDisabledReason:te}=j_(),{t:le}=z(),{composerDraftTarget:ge,environmentId:re,attachmentUploadsCapabilityKnown:ee,supportsAttachmentUploads:ve,routeKind:he,routeThreadRef:Ne,draftId:De,forceExpandedOnMobile:je,settings:nt,keybindings:me,terminalOpen:Ae,gitCwd:ue,promptRef:ce,composerRef:Ze,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et,sendContextRef:Et,onSend:ft,onInterrupt:Ct,interruptArmed:gt=!1,stopping:_t=!1,onCompactContext:Mt,onImplementPlanInNewThread:se,onProviderInstanceSelect:Le,onModelSelectionChosen:be,handleRuntimeModeChange:Ye,handleInteractionModeChange:xt,handleNativeModeChange:tt,focusComposer:It,setThreadError:po}=t,jo=n.useComposerPlan(r),Xt=jo.proposedPlan,xn=jo.tasksProgress,At=jo.taskSteps,St=i.length===0&&k==="plan"&&Xt!==null,bt=M(null),{pendingPrimaryAction:mo,onSelectActivePendingUserInputOption:kt,onRespondToApproval:Ot,onRespondToComposerDecision:Yt}=LN({t:le,threadId:r.threadId,setThreadError:po,promptRef:ce,promptInputRef:bt,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,activePendingProgress:d,activePendingIsResponding:u,activePendingResolvedAnswers:c}),rt=t.api,{limits:dt}=t.attachments,Ht=rt.draft.useThreadDraftSelector(ge,Qo=>z_(Qo,rt.chat.deriveComposerSendState)),Ut=i[0]??null,{questionAttachmentTarget:Jt,attachmentTarget:Vo,attachmentDocumentKey:fo}=wN({supported:f,attachments:t.attachments,environmentId:re,threadId:B,requestId:Ut?.requestId??null,question:d?.activeQuestion??null,responding:u,composerDraftTarget:ge}),go=rt.draft.useThreadDraftSelector(Vo,bN),Zt=go.images,Kn=Ht.terminalContexts,Ce=Ht.elementContexts,Ue=Ht.browserAnnotations,at=Ht.reviewComments,Lt=go.nonPersistedImageIds,wt=rt.uploads.useStore(Qo=>Qo.uploadsByImageId),Ft=!ee&&Zt.length>0?le("attachments.capabilityUnknown"):ve?nN({imageIds:Zt.map(Qo=>Qo.id),uploadsByImageId:wt,environmentId:re},le):null,{setComposerDraftPrompt:Mo,setComposerDraftNativeMode:sn,addComposerDraftImage:Hr,addComposerDraftImages:Pa,removeComposerDraftImage:Fs,insertComposerDraftTerminalContext:fg,removeComposerDraftElementContext:lu,removeComposerDraftBrowserAnnotation:gg,removeComposerDraftReviewComment:du,clearComposerDraftPromptAndImages:Tl}=K_(rt);H(()=>{if(ee){if(!ve){for(let Qo of Zt)rt.uploads.release(Qo.id);return}rt.draft.restoreAttachments();for(let Qo of Zt)rt.uploads.start({environmentId:re,image:Qo})}},[ee,Zt,re,ve]);let Il=d!==null,bn=QN({api:rt,t:le,settings:nt,composerDraft:Ht,composerDraftTarget:ge,environmentId:re,gitCwd:ue,routeKind:he,threadId:r.threadId,activeThread:O,isLocalDraftThread:V,unavailableAgentInstanceId:F,agentNotChosen:Z,runtimeMode:w,lockedProvider:I,providerStatuses:T,projectId:R,activeProjectDefaultModelSelection:S,activeThreadModelSelection:A,actualModel:N,compactDisabledReason:te,externalSendDisabledReason:E,attachmentBlockReason:Ft,answeringQuestion:Il,setComposerDraftNativeMode:sn,handleNativeModeChange:tt,onProviderInstanceSelect:Le,onModelSelectionChosen:be}),{selectedInstanceId:hg,noProviderAvailable:Sl,selectedProvider:kl,selectedModel:cu,selectedModelChoice:yg,sendDisabledReason:uu,isSendDisabled:pu,setModelSendBlockShown:mu,isModelSendBlocked:vg}=bn,Ll=eN({api:rt,environmentId:re,target:ge,provider:bn.selectedProviderStatus,planModeEnabled:bn.planModeUiEnabled}),qn=oN(re,ge),[fu,Bs]=q(!1),[Rl,Hs]=q(null),[Cg,gu]=q(null),[Pl,El]=q(!1),[hu,yu]=q(!1),[xg,vu]=q(null),[Us,Cu]=q({key:0,active:!1}),xu=M(qn);fe(()=>{xu.current!==qn&&(xu.current=qn,Bs(!1),Hs(null),El(!1),yu(!1),vu(null),Cu({key:Us.key,active:!1}))},[qn,Us.key]);let Ea=Zp("max-sm"),Ma=M(null),bg=M(null),$s=M(null),bu=M(null),wu=M(new Map),{isComposerCollapsedMobile:Aa,blurMobileComposerAfterSend:wg,expandMobileComposer:ht,scheduleComposerCollapseCheck:zs,handleFormFocusCapture:$1}=kN({isMobileViewport:Ea,forceExpandedOnMobile:je,composerEditorRef:Ma,composerSurfaceRef:bu,composerFormRef:$s}),z1=P(()=>{Bs(!0)},[]),K1=P(Qo=>{xt(Qo)},[xt]),Na=s!==null,q1=d?.activeQuestion?.allowFreeform===!1,bx=h[0]??null,{showTopDrawer:wx,showCollapsedPromptRow:W1,hasBlocking:Tx}=tN(bx?.kind??null,Aa),G1=St||d!==null,{isComposerFooterCompact:j1,isComposerPrimaryActionsCompact:V1}=sN($s,G1),Q1=ZN({routeKind:he,routeThreadRef:Ne,draftId:De,selectedProvider:kl,selectedInstanceId:hg,selectedModel:cu,selectedModelChoice:yg});H(()=>{Hs(null)},[Ce,Ue,at,Kn,cu,bn.selectedModelOptionsForDispatch,kl]),SN({composerImages:Zt,composerImagesRef:pt,composerTerminalContexts:Kn,composerTerminalContextsRef:ze,composerElementContexts:Ce,composerElementContextsRef:et});let X1=DN({activeThreadId:B,isLocalDraftThread:V,isComposerApprovalState:Na,hasPendingProgress:d!==null,hasPendingAction:mo!==null,memberMentions:n.memberMentions,target:r,promptRef:ce}),Da=NN({pluginAction:Ll,api:rt,t:le,limits:dt,composerDraftTarget:ge,composerDraft:Ht,composerDocumentKey:qn,promptRef:ce,promptInputRef:bt,pendingImageCompressionsRef:wu,setComposerDraftPrompt:Mo,setModelSendBlockShown:mu,onSend:ft,onCompactContext:Mt,blurMobileComposerAfterSend:wg,isMobileViewport:Ea,isComposerApprovalState:Na,activePendingApproval:s,activePendingProgress:d,activePendingResolvedAnswers:c,pendingUserInputCount:i.length,activeThreadId:B,phase:D,isSendBusy:X,environmentUnavailable:J,compactDisabled:ne,noProviderAvailable:Sl,isSendDisabled:pu,sendDisabledReason:uu,groupSendDisabledReason:Y,isGroupSend:X1,isModelSendBlocked:vg,showPlanFollowUpPrompt:St}),Ml=vN({api:rt,t:le,limits:dt,promptRef:ce,promptInputRef:bt,composerEditorRef:Ma,composerImagesRef:pt,composerDraftTarget:ge,setComposerDraftPrompt:Mo,addComposerDraftImages:Pa,clearComposerDraftPromptAndImages:Tl,setIsStashMenuOpen:El,setStashPulse:Cu,isComposerCollapsedMobile:Aa,expandMobileComposer:ht,keybindings:me,terminalOpen:Ae,isComposerModelPickerOpen:fu,hasPendingUserInputs:i.length>0,isComposerApprovalState:Na,projectSelectionRequired:U,answeringQuestion:Il}),Tg=BN({activeThreadId:B,activeThread:O,activeTasksProgress:xn,activeTaskSteps:At,isTasksDrawerOpen:hu,setIsTasksDrawerOpen:yu,dismissedTasksTurnId:xg,setDismissedTasksTurnId:vu,stashQueue:Ml.stashQueue,isStashMenuOpen:Pl,stashPulse:Us,toggleInlineStashMenu:Ml.toggleInlineStashMenu,isComposerApprovalState:Na,externalDrawerAttached:o,showComposerTopDrawer:wx,isComposerCollapsedMobile:Aa,hasBlockingComposerTopDrawer:Tx}),Y1=P(Qo=>{Hs(null),Da.revalidatePromptLength(Qo),El(!1)},[Da.revalidatePromptLength]),{addComposerImages:Ix,removeComposerImage:J1,onComposerAttachmentInputChange:Z1}=xN({api:rt,t:le,limits:dt,setThreadError:po,activeThreadId:B,answerQuestionsFirst:i.length>0&&Jt===null,attachmentTarget:Vo,attachmentDocumentKey:fo,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:ee,pendingImageCompressionsRef:wu,addComposerDraftImage:Hr,addComposerDraftImages:Pa,removeComposerDraftImage:Fs}),{onComposerPaste:eO,insertComposerTextAtEnd:tO,addDroppedFolders:oO,isDragOverComposer:nO,composerMentionDragHandlers:rO,onComposerMentionDragLeaveCapture:aO}=yN({api:rt,t:le,addComposerImages:Ix,attachments:t.attachments,promptRef:ce,promptInputRef:bt,composerEditorRef:Ma,composerFormRef:$s,composerThreadKey:a,attachmentDocumentKey:fo,attachmentImagesRef:pt,limits:dt,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:ee,composerDocumentKey:qn,isComposerApprovalState:Na,pasteBlocked:i.length>0&&Jt===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:U,environmentId:re}),Sx=P(()=>{Ct()},[Ct]),kx=P(()=>{se()},[se]),{handleComposerPaste:sO,handleComposerSubmit:iO,handleUnclaimedEscape:lO}=q_({onComposerPaste:eO,submitComposer:Da.submitComposerOrShellCommand,exitShellCommandMode:Da.exitShellCommandMode});return IN({composerRef:Ze,sendContextRef:Et,api:rt,t:le,limits:dt,composerData:n,refs:{composerEditorRef:Ma,promptInputRef:bt,promptRef:ce,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et},composerDraftTarget:ge,activeThread:O,addComposerImages:Ix,addDroppedFolders:oO,focusComposer:It,insertComposerTextAtEnd:tO,insertComposerDraftTerminalContext:fg,composerBrowserAnnotations:Ue,composerReviewComments:at,isComposerApprovalState:Na,pendingUserInputCount:i.length,projectSelectionRequired:U,noProviderAvailable:Sl,modelState:bn,handleRuntimeModeChange:Ye,runtimeMode:w,setIsComposerModelPickerOpen:Bs,setProviderInputSubmissionError:Hs}),l(JD,{formRef:$s,onSubmit:Da.submitComposerOrShellCommand,onFocusCapture:$1,onBlurCapture:zs,dragHandlers:rO,onDragLeaveCapture:aO,badges:Tg,stashQueueLength:Ml.stashQueue.length,isStashMenuOpen:Pl,stashPulse:Us,toggleStashMenu:Ml.toggleStashMenu,drawers:l($_,{composerOccupant:bx,showComposerTopDrawer:wx,hasBlockingComposerTopDrawer:Tx,isTasksDrawerOpen:hu,isComposerCollapsedMobile:Aa,respondingRequestIds:g,keybindings:me,onRespondToApproval:Ot,onRespondToDecision:Yt,environmentId:re,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:kt,activeProposedPlan:Xt,activePendingProgress:d,isPendingUserInputChoiceOnly:q1,expandMobileComposer:ht,badges:Tg,pendingPrimaryAction:mo,isSendBusy:X,sendDisabledReason:uu,environmentUnavailable:J,noProviderAvailable:Sl,projectSelectionRequired:U,onGoToActivePendingUserInputQuestion:L,handleInterruptPrimaryAction:Sx,handleImplementPlanInNewThreadPrimaryAction:kx}),children:l(YD,{pluginAction:Ll,props:t,composerDraft:Ht,model:bn,traits:Q1,submit:Da,stash:Ml,badges:Tg,uploadsByImageId:wt,composerImages:Zt,nonPersistedComposerImageIds:Lt,removeComposerImage:J1,removeComposerDraftBrowserAnnotation:gg,removeComposerDraftReviewComment:du,removeComposerDraftElementContext:lu,onComposerAttachmentInputChange:Z1,surfaceRef:bu,composerAttachmentInputRef:bg,promptInputRef:bt,composerEditorRef:Ma,composerMenuAnchor:Cg,setComposerMenuAnchor:gu,composerDocumentKey:qn,isComposerCollapsedMobile:Aa,expandMobileComposer:ht,isDragOverComposer:nO,isComposerApprovalState:Na,showCollapsedMobilePromptRow:W1,activePendingProgress:d,pendingUserInputs:i,changeUserInputCustomAnswer:b,pendingPrimaryAction:mo,handleComposerPaste:sO,handleComposerSubmit:iO,onPromptEdited:Y1,handleUnclaimedEscape:lO,openModelPicker:z1,switchInteractionMode:K1,providerInputSubmissionError:Rl,isStashMenuOpen:Pl,isComposerFooterCompact:j1,isComposerPrimaryActionsCompact:V1,isMobileViewport:Ea,isComposerModelPickerOpen:fu,setIsComposerModelPickerOpen:Bs,showPlanFollowUpPrompt:St,compactDisabled:ne,compactThreadContext:Da.compactThreadContext,status:{projectSelectionRequired:U,groupSendDisabledReason:Y,isSendBusy:X,environmentUnavailable:J,interruptArmed:gt,stopping:_t,agentNotChosen:Z,unavailableAgentInstanceId:F,lockedProvider:I,phase:D,continuationChecking:j,activeThread:O,interactionMode:k,runtimeMode:w},actions:{handleInterruptPrimaryAction:Sx,handleImplementPlanInNewThreadPrimaryAction:kx}})})});function Q_(e){let{composerRef:t,...o}=e;return l(ll,{value:o.api,children:l(V_,{...o,composerRef:t})})}function wl({section:e,resetKey:t,children:o}){return l(bi,{resetKey:t,fallback:n=>sj(e,n),children:o})}function sj(e,t){return l(ij,{section:e,error:t})}function ij({section:e,error:t}){let{t:o}=Me();return v("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:[l(Dt,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive-foreground"}),v("div",{className:"min-w-0",children:[l("p",{className:"font-medium text-foreground",children:o(`timeline.sectionUnavailable.${e}`)}),l("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:o("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function X_({hostVersion:e,scopeClass:t}){let{t:o}=Me();return v("div",{role:"status","data-conversation-host-data-mismatch":!0,className:G("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:[l(Dt,{"aria-hidden":!0,className:"size-5 text-destructive-foreground"}),l("p",{className:"font-medium text-foreground",children:o("timeline.hostDataMismatchTitle")}),l("p",{className:"max-w-md text-muted-foreground",children:o("timeline.hostDataMismatchDescription",{host:e??0,plugin:Dl})})]})}$();function Y_(e){let t=Nt();H(()=>{let o=e.current;if(!o)return;let n=r=>{let a=r.detail?.reference;a&&t.openThread({environmentId:a.environmentId,threadId:a.threadId})};return o.addEventListener(qs,n),()=>o.removeEventListener(qs,n)},[t,e])}function J_({data:e,target:t,slots:o,children:n}){return l(Kb,{data:e,target:t,children:l(ch,{value:o,children:n})})}function Z_(e){let{data:t}=e;return t?.version!==Dl?l(X_,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):l(Nu.Provider,{value:e.scope.active,children:l(cj,{...e,data:t})})}var lj=pe(function({threadKey:t,onModeChange:o,summaryContext:n}){let[r]=Ge("turn-navigator",t,null),a=P(s=>{o("chat"),r?.onSelect(s)},[o,r]);return r===null?null:l(tw,{...r,placement:"inline",onSelect:a,summaryContext:n})});function dj({slots:e,children:t}){let{data:o,target:n,threadKey:r}=zo(),a=o.useComposerPending({target:n,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function cj(e){let{scope:t,mode:o,timeline:n,trajectory:r,composer:a,data:s}=e,[,i]=Ge("turn-navigator",t.threadKey,null),d=a.draftHero.active,c=a.sessionActions,u=a.terminalControl,m=a.agentsControl,{mode:p,onModeChange:f}=o,g=W(()=>({data:s,target:{environmentId:t.environmentId,threadId:t.threadId},threadKey:t.threadKey,openTrajectory:()=>f("trajectory"),onOpenFileDiff:n.onOpenFileDiff}),[s,t.environmentId,t.threadId,t.threadKey,f,n.onOpenFileDiff]),h=W(()=>d?v(oe,{children:[c,l("div",{className:"min-w-0 flex-1"}),u]}):v(oe,{children:[c,l(Bb,{mode:p,onModeChange:f}),l("div",{className:"min-w-0 flex-1"}),u,m,l(lj,{threadKey:t.threadKey,onModeChange:f,summaryContext:g})]}),[d,c,u,m,p,f,t.threadKey,g]),{belowSlot:y,teamDock:x,draftHero:C,onOverlayElementChange:b,sessionActions:L,terminalControl:w,agentsControl:k,contextStrip:I,...T}=a,S=l(Q_,{...T,attachments:e.attachments,firstRow:h}),R=W(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[A,N]=q(null),B=P(he=>N(he?{key:t.threadKey,value:he}:null),[t.threadKey]),O=A?.key===t.threadKey?A.value:null,[V,U]=Ge("trajectory-reveal",t.threadKey,null),D=P(he=>{o.onModeChange("chat"),U(Ne=>({rowId:he,nonce:(Ne?.nonce??0)+1}))},[o,U]),X=P(()=>U(null),[U]),j=M(null);Y_(j);let{t:E}=z(),Y=M(a.api);Y.current=a.api;let F=P(he=>Y.current.notify.warning(E(`timeline.quote.${he}`)),[E]),Z=P(()=>Y.current.notify.warning(E("forkRelations.messageMissing")),[E]),[J,ne]=Ge("timeline-quote-reveal",t.threadKey,null);H(()=>{let he=j.current;if(!he)return;let Ne=De=>{let je=De.detail?.quote;if(je){if(je.environmentId!==R.environmentId||je.threadId!==R.threadId){F("otherThread");return}o.onModeChange("chat"),ne({quote:je})}};return he.addEventListener(ku,Ne),()=>he.removeEventListener(ku,Ne)},[o,ne,R.environmentId,R.threadId,F]);let te=P(he=>{ne(null),he==="message-missing"&&F("messageMissing"),he==="passage-missing"&&F("passageMissing")},[ne,F]),le=W(()=>({data:s,target:R,threadKey:t.threadKey}),[s,R,t.threadKey]),{controlRef:ge,...re}=n,ee=s.useChatWindow({target:R,threadKey:t.threadKey,visible:t.visible&&o.mode==="chat"}),ve=RS({inputKey:t.threadKey,visible:t.visible,endInset:n.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:ee.onReturnToLatest,controlRef:ge});return l(J_,{slots:a.slots,data:s,target:R,children:v("div",{ref:j,className:G("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[s.useMessageReveal?l(uj,{read:s.useMessageReveal,target:R,onChange:B,active:t.active&&t.visible,onModeChange:o.onModeChange},t.threadKey):null,l(pj,{data:s,target:R,threadKey:t.threadKey,environmentId:t.environmentId,threadId:t.threadId,slots:a.slots}),l(nw,{data:s,target:R,threadKey:t.threadKey,surfaceRef:j}),l(Hb,{chat:v(wl,{section:"chat",resetKey:t.threadKey,children:[l(wS,{data:s,target:R,visible:t.visible,...re,paneActive:t.active,liveFollowEnabled:ve.liveFollowEnabled,scrollerRef:ve.bindTimelineHandle,onRowsChange:ve.onRowsChange,onIsAtEndChange:ve.onIsAtEndChange,onManualNavigation:ve.onManualNavigation,onDisclosureNavigation:ve.onDisclosureNavigation,loadEarlier:ee.loadEarlier,loadLater:ee.loadLater,pagingBlockedByInteraction:ee.pagingBlockedByInteraction,restoringHistory:ee.restoringHistory??!1,onVisibleTurnRangeChange:ee.onVisibleTurnRangeChange,onReturnToLatest:ee.loadLater===null?null:ve.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:V,messageReveal:t.active?O:null,onMessageRevealMissing:Z,revealQuoteRequest:J,onRevealQuoteDone:te,onRevealMessageHandled:X}),l(IS,{data:s,target:R,bottomInset:n.contentInsetEndAdjustment,showScrollToEnd:ve.showScrollToEnd,onScrollToEnd:ve.returnToEnd})]},"chat"),mode:o.mode,trajectory:l(wl,{section:"trajectory",resetKey:t.threadKey,children:l(zS,{data:s,target:R,inputKey:t.threadKey,paneVisible:t.visible&&o.mode==="trajectory",timestampFormat:r.timestampFormat,contentInsetEndAdjustment:n.contentInsetEndAdjustment,onOpenInChat:D,onOpenFileDiff:n.onOpenFileDiff})},"trajectory"),visible:t.visible}),l(JA,{api:a.api,data:s,draftId:a.draftId,target:R,threadKey:t.threadKey,belowSlot:a.belowSlot,teamDock:a.teamDock,composer:l(wl,{section:"composer",resetKey:t.threadKey,children:l(Bp,{value:le,children:l(G_,{children:l(dj,{slots:a.slots,children:S})})})}),draftHero:a.draftHero,slots:a.slots,environmentId:t.environmentId,threadId:t.threadId,onOverlayElementChange:a.onOverlayElementChange,questions:l(wl,{section:"composer",resetKey:t.threadKey,children:l(UA,{data:s,target:R})}),queue:l(wl,{section:"queue",resetKey:t.threadKey,children:l(FA,{data:s,target:R,inputKey:t.threadKey,attachments:e.attachments})})})]})})}function uj({read:e,target:t,onChange:o,active:n,onModeChange:r}){let a=e(t);return H(()=>{o(a)},[a,o]),H(()=>()=>o(null),[o]),H(()=>{n&&a.request&&r("chat")},[n,a.request,r]),null}function pj(e){let o=e.data.useComposerStatus({target:e.target,threadKey:e.threadKey}).activeThread?.presetId??null;return l("div",{className:"max-h-[min(280px,36vh)] min-h-0 shrink overflow-y-auto empty:hidden","data-conversation-views":!0,children:e.slots?.renderSlot("conversation.view",{environmentId:e.environmentId,threadId:e.threadId,presetId:o})},e.threadKey)}$();$();function px(e){return e.turnOutline??e.turns.map((t,o)=>({messageId:t.messageId,ordinal:Math.max(e.turnCount,e.turns.length)-e.turns.length+o+1,...t.error!==null?{failed:!0}:{},...o===e.turns.length-1&&e.status==="waiting"?{waiting:!0}:{}}))}function e1(e,t,o){let n=px(e),r=[],a=[],s=()=>{if(a.length>=3)r.push({kind:"group",turns:a});else for(let i of a)r.push({kind:"turn",turn:i});a=[]};return n.forEach((i,d)=>{d===0||d===n.length-1||i.failed||i.waiting||i.forkSource||t.has(i.messageId)||o.has(`${e.threadId}:${i.messageId}`)?(s(),r.push({kind:"turn",turn:i})):a.push(i)}),s(),r}var $n=264,pr=136,lg=20,t1=16,o1=16,mj=($n+lg)/3,fj=$n/2,gj={cards:[],edges:[],ticks:[],width:0,height:0};function mx(e){return`${e}:thread`}function dg(e,t){return`${e}:turn:${t}`}function n1(e){if(e.threads.length===0)return gj;let t=[...e.threads].sort((C,b)=>C.createdAt.localeCompare(b.createdAt)||C.threadId.localeCompare(b.threadId)),o=new Map,n=[],r=0,a=null;t.forEach((C,b)=>{let L=e.dayOf(C.createdAt);if(b>0&&(r+=mj+(L===a?0:fj)),L!==a){let w=t[b-1],k=w===void 0?0:Date.parse(C.createdAt)-Date.parse(w.createdAt);n.push({x:r,at:C.createdAt,...k>864e5?{gapDays:Math.floor(k/864e5)}:{}})}a=L,o.set(C.threadId,r)});let s=new Map(t.map(C=>[C.threadId,C])),i=new Map;for(let C of t){if(C.forkedFrom===null)continue;let b=i.get(C.forkedFrom.sourceThreadId)??new Set;b.add(C.forkedFrom.sourceMessageId),i.set(C.forkedFrom.sourceThreadId,b)}let d=new Map(t.map(C=>[C.threadId,e1(C,i.get(C.threadId)??new Set,e.revealed??new Set)])),c=new Map,u=[],m=new Map,p=0,f=[];for(let C of t){let b=o.get(C.threadId)??0,L=hj(C,e.expanded,d.get(C.threadId)??[]),w=C.forkedFrom===null?void 0:s.get(C.forkedFrom.sourceThreadId),k=w!==void 0?c.get(w.threadId):void 0,I=k===void 0?0:k+1;for(;I<f.length&&(f[I]??0)+lg>b;)I+=1;f[I]=b+L,c.set(C.threadId,I),p=Math.max(p,b+L)}let g=Math.max(1,f.length),h=o1*2+g*pr+(g-1)*t1;for(let C of t){let b=o1+(c.get(C.threadId)??0)*(pr+t1),L=o.get(C.threadId)??0,w=yj(C,e.expanded,d.get(C.threadId)??[],L,b);u.push(...w),w[0]!==void 0&&m.set(C.threadId,w[0])}let y=[],x=new Map(u.map(C=>[C.id,C]));for(let C of t){let b=C.forkedFrom,L=m.get(C.threadId);if(b===null||L===void 0)continue;let w=x.get(dg(b.sourceThreadId,b.sourceMessageId))??m.get(b.sourceThreadId);w!==void 0&&y.push({id:`${w.id}->${L.id}`,path:vj(w,L),sourceThreadId:b.sourceThreadId,childThreadId:C.threadId})}return{cards:u,edges:y,ticks:n,width:p,height:h}}function r1(e,t){return t.has(e.threadId)&&px(e).length>0}function hj(e,t,o){let n=r1(e,t)?o.length:1;return n*$n+(n-1)*lg}function yj(e,t,o,n,r){return r1(e,t)?o.map((a,s)=>{let i=a.kind==="turn"?a.turn:a.turns[0];if(i===void 0)throw new Error("Empty turn group");return{id:a.kind==="group"?`${e.threadId}:group:${i.messageId}`:dg(e.threadId,i.messageId),kind:a.kind,threadId:e.threadId,turnIndex:i.ordinal-1,messageId:i.messageId,...a.kind==="group"?{groupedMessageIds:a.turns.map(d=>d.messageId)}:{},x:n+s*($n+lg),y:r}}):[{id:mx(e.threadId),kind:"thread",threadId:e.threadId,turnIndex:-1,x:n,y:r}]}function vj(e,t){let o=e.x+$n/2,n=e.y+pr,r=t.x,a=t.y+pr/2,s=Math.max(24,(a-n)/2);return`M ${o} ${n} C ${o} ${n+s}, ${r-s} ${a}, ${r} ${a}`}function a1(e,t,o,n=240){if(o.width===0||o.height===0)return!1;let r=e.x*t.scale+t.x,a=e.y*t.scale+t.y;return r+$n*t.scale>=-n&&a+pr*t.scale>=-n&&r<=o.width+n&&a<=o.height+n}var zn=24;function iu(e){return{left:0,top:36}}function fx(e,t,o=1){let n=iu(t),r=t.width-n.left-zn*2,a=e.cards.at(-1),s=a===void 0?e.width:a.x+$n,i=s*o<=r?n.left+zn:t.width-zn-s*o,d=Math.min(n.top+zn/2,t.height-zn-(a===void 0?0:a.y+pr)*o);return{x:i,y:d,scale:o}}function i1(e,t,o){return{...e,x:e.x+(o.width-t.width)/2,y:e.y+(o.height-t.height)/2}}function l1(e,t){let o=iu(t);if(e.width===0||t.width===0)return{x:o.left+zn,y:o.top+zn/2,scale:1};let n=m1(Math.min((t.width-o.left-zn*2)/e.width,(t.height-o.top-zn*2)/Math.max(1,e.height)),.25,1);return{x:o.left+zn,y:o.top+zn/2,scale:n}}function d1(e,t,o){let n=iu(o),r=n.left+(o.width-n.left)/2,a=n.top+(o.height-n.top)/2;return{scale:t.scale,x:r-(e.x+$n/2)*t.scale,y:a-(e.y+pr/2)*t.scale}}function cg(e,t,o){let n=m1(e.scale*t,.25,4),r=(o.x-e.x)/e.scale,a=(o.y-e.y)/e.scale;return{scale:n,x:o.x-r*n,y:o.y-a*n}}function c1(e){return e.ctrlKey||e.metaKey}function u1(e,t,o=48){switch(t){case"ArrowLeft":return{...e,x:e.x+o};case"ArrowRight":return{...e,x:e.x-o};case"ArrowUp":return{...e,y:e.y+o};case"ArrowDown":return{...e,y:e.y-o};default:return null}}function gx(e,t){return t?e<=.55:e<.5}function p1(e,t,o){return{...e,x:e.x+(t.x-o.x)*e.scale,y:e.y+(t.y-o.y)*e.scale}}function m1(e,t,o){return Number.isFinite(e)?Math.min(o,Math.max(t,e)):t}$();function hx(e){return e.archived?"map.status.archived":xj[e.status]}var xj={running:"map.status.running",waiting:"map.status.waiting",failed:"map.status.failed",done:"map.status.done"};function bj(e){return e===void 0?"":(e.answer||e.error||e.question).trim()}var f1=pe(function(t){let{t:o,thread:n}=t,r=t.formatTitle?.(n.title)??n.title,a=bj(n.turns.at(-1)),s=n.loaded?n.turns.length>0:n.turnCount>0;return v("article",{className:"session-map-card","data-status":n.archived?"archived":n.status,"data-selected":t.selected?"":void 0,"data-matched":t.matched?"":void 0,"data-current-match":t.current?"":void 0,"data-dimmed":t.dimmed?"":void 0,onPointerEnter:()=>t.onHover(n.threadId),onPointerLeave:()=>t.onHover(null),onFocus:()=>t.onHover(n.threadId),onBlur:()=>t.onHover(null),tabIndex:0,"aria-label":r||o("settings.hiddenUntitled"),style:{left:t.card.x,top:t.card.y},onPointerDown:i=>i.stopPropagation(),onClick:()=>t.onSelect(n.threadId),onKeyDown:i=>{i.target===i.currentTarget&&(i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),t.onSelect(n.threadId)))},children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:r||o("settings.hiddenUntitled")})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,v("p",{className:"session-map-meta",children:[l("span",{className:"session-map-status",children:o(hx(n))}),n.loaded?l("span",{children:o("map.turns",{count:n.turnCount})}):null,l("span",{children:t.updatedLabel})]}),n.loaded?l("p",{className:"session-map-preview",children:a||o("map.noReply")}):l("p",{className:"session-map-preview","data-pending":"","aria-hidden":!0}),v("footer",{onClick:i=>i.stopPropagation(),children:[s?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onExpand(t.card),children:o("map.expand")}):null,l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>t.onOpen(n.threadId),children:o("map.open")}),v(Re,{children:[l(Ee,{render:l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":o("map.hide"),onClick:()=>t.onHide(n.threadId)}),children:l(ql,{})}),l(Pe,{side:"top",children:o("map.hide")})]})]})]})}),g1=pe(function(t){let{t:o,thread:n,card:r}=t,a=t.formatTitle?.(n.title)??n.title,s=n.turns.find(u=>u.messageId===r.messageId),i=n.turnOutline?.find(u=>u.messageId===r.messageId),d=r.turnIndex+1,c=(s?.answer||s?.error||"").trim();return v("article",{className:"session-map-card","data-turn":"","data-status":n.archived?"archived":i?.failed?"failed":i?.waiting?"waiting":d===n.turnCount?n.status:"done","data-selected":t.selected?"":void 0,"data-matched":t.matched?"":void 0,"data-current-match":t.current?"":void 0,"data-dimmed":t.dimmed?"":void 0,onPointerEnter:()=>t.onHover(n.threadId),onPointerLeave:()=>t.onHover(null),onFocus:()=>t.onHover(n.threadId),onBlur:()=>t.onHover(null),tabIndex:0,"aria-label":o("map.turnLabel",{index:d,title:a}),style:{left:r.x,top:r.y},onPointerDown:u=>u.stopPropagation(),onClick:()=>t.onSelect(n.threadId),onKeyDown:u=>{u.target===u.currentTarget&&(u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),t.onSelect(n.threadId)))},children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-ordinal",children:o("map.turnOrdinal",{index:d})}),v("strong",{children:[l("span",{className:"session-map-turn-question",children:s?.question||o(s===void 0?"map.loading":"map.noQuestion")}),l("span",{className:"session-map-compact-title",children:a||o("settings.hiddenUntitled")})]})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,l("p",{className:"session-map-preview","data-error":s?.error!=null&&s.answer.length===0?"":void 0,"data-pending":s===void 0?"":void 0,children:s===void 0?null:c||o("map.noReply")}),v("footer",{onClick:u=>u.stopPropagation(),children:[r.turnIndex===0?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onCollapse(r),children:o("map.collapse")}):null,v(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>{r.messageId!==void 0&&t.onFork(n.threadId,r.messageId)},children:[l(Yl,{}),o("map.fork")]})]})]})}),h1=pe(function(t){return v("article",{className:"session-map-card session-map-group",tabIndex:0,"aria-label":t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0}),onClick:()=>t.onReveal(t.card),onKeyDown:o=>{o.target===o.currentTarget&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t.onReveal(t.card))},"data-status":t.thread.archived?"archived":"done","data-dimmed":t.dimmed?"":void 0,"data-selected":t.selected?"":void 0,onPointerDown:o=>o.stopPropagation(),onPointerEnter:()=>t.onHover(t.thread.threadId),onPointerLeave:()=>t.onHover(null),onFocus:()=>t.onHover(t.thread.threadId),onBlur:()=>t.onHover(null),style:{left:t.card.x,top:t.card.y},children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:(t.formatTitle?.(t.thread.title)??t.thread.title)||t.t("settings.hiddenUntitled")})]}),l(K,{type:"button",size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),t.onReveal(t.card)},children:t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0})})]})});function y1({text:e}){return e.length===0?null:l(Io,{className:"session-map-md",text:e})}var wj=3;function v1(e){let{t,thread:o}=e,n=e.formatTitle?.(o.title)??o.title,a=(e.fuller??o).turns.slice(-wj);return v("aside",{className:"session-map-panel","aria-label":n||t("settings.hiddenUntitled"),children:[v("header",{children:[l("strong",{children:n||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":t("map.closePanel"),onClick:e.onClose,children:l(ot,{})})]}),v("p",{className:"session-map-meta","data-status":o.archived?"archived":o.status,children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-status",children:t(hx(o))})]}),v("p",{className:"session-map-meta",children:[l("span",{children:t("map.created",{time:e.formatTime(o.createdAt)})}),l("span",{children:t("map.updated",{time:e.formatTime(o.updatedAt)})}),o.loaded?l("span",{children:t("map.turns",{count:o.turnCount})}):null]}),l(K,{type:"button",size:"sm",onClick:()=>e.onOpen(o.threadId),children:t("map.open")}),l("h3",{children:t("map.recent")}),e.notice!==null?l(Jr,{title:e.notice}):null,!o.loaded&&e.fuller===null?l(Js,{"aria-label":t("map.loading")}):a.length===0?l(Jr,{title:t("map.noTurns")}):l("ol",{className:"session-map-turns",children:a.map(s=>v("li",{children:[l("p",{className:"session-map-question",children:s.question}),s.answer.length>0?l(y1,{text:s.answer}):s.error!==null?l("p",{className:"session-map-error",children:s.error}):l("p",{className:"session-map-muted",children:t("map.noReply")}),s.answerTruncated||s.questionTruncated?l("p",{className:"session-map-muted",children:t("map.truncated")}):null]},s.messageId))})]})}$();function C1(e){let t=new Map,o=new Map;for(let n of e){if(n.forkedFrom===null)continue;let r=n.forkedFrom.sourceThreadId;t.set(n.threadId,r);let a=o.get(r)??new Set;a.add(n.threadId),o.set(r,a)}return{count:n=>o.get(n)?.size??0,family:n=>{if(n===null)return new Set;let r=t.get(n);return new Set([n,...r===void 0?[]:[r],...o.get(n)??[]])}}}function x1(e,t,o,n,r){return t!==null&&!o.has(e)||n&&!r.has(e)}function b1(e,t,o){if(e.ticks.length===0)return[];let n=0;for(let s=1;s<e.ticks.length&&!(e.ticks[s].x*t.scale+t.x>0);s+=1)n=s;let r=e.ticks[n],a=e.ticks[n+1];return[{...r,gapDays:void 0,sticky:!0,left:Math.min(0,a===void 0?0:a.x*t.scale+t.x-112)},...e.ticks.slice(n+1).flatMap(s=>{let i=s.x*t.scale+t.x;return i<=o.width?[{...s,sticky:!1,left:i}]:[]})]}function w1(e){let t=M(null),o=M(null),n=M(!1),[r,a]=q(null),s=W(()=>C1(Array.from(e.threads.values())),[e.threads]),i=W(()=>s.family(e.selectedThreadId),[s,e.selectedThreadId]),d=M(e.camera),c=M(e.onCamera),u=M(e.onFrame);d.current=e.camera,c.current=e.onCamera,u.current=e.onFrame;let m=M(()=>{}),p=M(null);H(()=>{let w=t.current;if(w===null)return;let k=null,I=0,T=()=>{I=0;let B=k;k=null,B!==null&&c.current(B)},S=B=>{d.current=B,k=B;let O=o.current;O!==null&&(O.style.transform=yx(B),O.style.setProperty("--map-scale",String(B.scale)),n.current=gx(B.scale,n.current),O.toggleAttribute("data-compact",n.current)),I===0&&(I=window.requestAnimationFrame(T))};m.current=S;let R=B=>{B.preventDefault();let O=d.current;if(!c1(B)){S({...O,x:O.x-B.deltaX,y:O.y-B.deltaY});return}let V=w.getBoundingClientRect();S(cg(O,B.deltaY<0?1.08:.92,{x:B.clientX-V.left,y:B.clientY-V.top}))},A=()=>u.current({width:w.clientWidth,height:w.clientHeight});A();let N=new ResizeObserver(A);return N.observe(w),w.addEventListener("wheel",R,{passive:!1}),()=>{N.disconnect(),w.removeEventListener("wheel",R),I!==0&&window.cancelAnimationFrame(I)}},[]),H(()=>{if(p.current!==null)return;let w=o.current;w!==null&&(w.style.transform=yx(e.camera),w.style.setProperty("--map-scale",String(e.camera.scale)),n.current=gx(e.camera.scale,n.current),w.toggleAttribute("data-compact",n.current))},[e.camera]);let f=W(()=>e.layout.cards.filter(w=>a1(w,e.camera,e.frame)),[e.layout,e.camera,e.frame]),g=W(()=>{let w=new Set;for(let k of f)e.threads.get(k.threadId)?.loaded===!1&&w.add(k.threadId);return[...w].sort().join(`
|
|
3611
|
-
`)},[f,e.threads]),h=
|
|
3612
|
-
`))},[g]);let y=W(()=>{let w=new Map;for(let k of f){if(k.kind!=="turn"||k.messageId===void 0||e.threads.get(k.threadId)?.turns.some(T=>T.messageId===k.messageId))continue;let I=w.get(k.threadId)??[];I.push(k.messageId),w.set(k.threadId,I)}return w},[f,e.threads]),x=JSON.stringify(Array.from(y)),C=
|
|
3588
|
+
`)?e.slice(0,-1):e}function YG(e){return e.startsWith("diff --git")||e.includes(`
|
|
3589
|
+
diff --git`)}function N_(e,t){if(e.length===0)return[""];let o=`
|
|
3590
|
+
${t}`,n=e.startsWith(t)?0:P_(e,o,0);if(n===-1)return[e];let r=[];n>0&&r.push(e.slice(0,n));let a=n;for(;;){let s=P_(e,o,a+1);if(s===-1)break;r.push(e.slice(a,s)),a=s}return r.push(e.slice(a)),r}function P_(e,t,o){let n=e.indexOf(t,o);return n===-1?-1:n+1}function R_(e){return e==null?e:Kt(e)}function JG(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function rx(e){let t=e.slice(1);return Kt(t===""?`
|
|
3591
|
+
`:t)}function ax(e,t,o){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:o,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:o,deletionLineIndex:t}}var __=2166136261,O_=16777619,ZG=2654435769,ej=2246822507;function D_(e,t=__,o=O_){let n=t>>>0;for(let r=0;r<e.length;r+=1)n^=e.charCodeAt(r),n=Math.imul(n,o)>>>0;return n>>>0}function tj(e,t="diff-panel"){let o=e.trim(),n=D_(o,__,O_).toString(36),r=D_(o,ZG,ej).toString(36);return`${t}:${o.length}:${n}:${r}`}function lx(e){if(!e.isPartial)return e;let t=0,o=0,n=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:o};return t+=r.splitLineCount,o+=r.unifiedLineCount,a});return{...e,hunks:n,splitLineCount:t,unifiedLineCount:o,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function F_(e,t="diff-panel",o={}){if(!e)return null;let n=e.trim();if(n.length===0)return null;try{let a=ix(n,{cacheKeyPrefix:tj(n,t)}).flatMap(s=>o.compactPartialHunkOffsets?s.files.map(lx):s.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:n,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:n,reason:"Failed to parse patch. Showing raw patch."}}}function B_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}:${e.type}`}function H_({fileChange:e,onOpenDiff:t}){let{t:o}=z(),[n,r]=q(!1),a=W(()=>p_(e),[e]),s=f_(e);return v("div",{className:"min-w-0",children:[v("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[l("span",{className:"min-w-0 shrink truncate font-mono text-ui-sm text-foreground/85",children:e.path}),l("span",{className:"shrink-0 font-mono text-ui-sm text-muted-foreground tabular-nums",children:o("approval.diff.stat",{additions:s.additions,deletions:s.deletions})}),a===null?l("span",{className:"text-ui-sm text-muted-foreground",children:e.omitted==="too-large"?o("approval.diff.tooLarge"):o("approval.diff.unavailable")}):v(K,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":n,onClick:()=>r(i=>!i),children:[n?l(Tt,{className:"size-3 shrink-0"}):l(yo,{className:"size-3 shrink-0"}),l("span",{children:o(n?"approval.diff.hide":"approval.diff.show")})]}),t?l(K,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:o("approval.diff.open")}):null]}),n&&a!==null?l(oj,{path:e.path,unifiedDiff:a}):null]})}function oj({path:e,unifiedDiff:t}){let o=it().theme.useResolvedTheme(),n=W(()=>{let r=F_(t,`approval:${o}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:B_(lx(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[o,t]);return n.length===0?l("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-ui-sm leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):l("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:l(Mb,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:n,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:y_(o),themeType:o,stickyHeaders:!1}})})}var nj={command:l(Qo,{}),"file-read":l(Ha,{}),"file-change":l(Ur,{}),"web-fetch":l(Vl,{}),"web-search":l(cd,{}),skill:l(Gn,{}),"mcp-tool":l(Ws,{}),tool:l(Ws,{}),"mcp-elicitation":l(Al,{})};function U_(e){return nj[e]}var rj=4,aj=300,sj="min-w-0 rounded-md bg-muted px-2.5 py-2",ij="min-w-0 font-mono text-chat-code text-foreground/90 [font-variant-ligatures:none]";function lj(e){return[...e.matchAll(/\S+|\s+/g)].map(t=>/^\s/.test(t[0])?t[0]:l("span",{className:"inline-block max-w-full [overflow-wrap:anywhere]",children:t[0]},t.index))}function dj(e){let{t}=z(),[o,n]=q(!1),r=e.text.split(`
|
|
3592
|
+
`).length,a=e.text.split(/\r?\n/,1)[0]??"",s=e.command?!0:!e.singleLine&&(r>rj||e.text.length>aj),i=e.command&&!o,d=i?a:e.text;return v("div",{className:"flex min-w-0 flex-col gap-1",children:[e.hidePreview&&!o?null:l("div",{className:sj,children:l("code",{"aria-label":e.label,className:V(ij,e.singleLine||i?"block truncate whitespace-pre":"whitespace-pre-wrap [overflow-wrap:anywhere]",e.singleLine||i?"block":s&&!o?"line-clamp-4":"block"),"data-approval-detail":i?"preview":"complete",tabIndex:0,children:e.singleLine||i?d:lj(d)})}),s?l(K,{type:"button",variant:"ghost",size:"xs",className:"w-fit text-chat-row text-muted-foreground","aria-expanded":o,onClick:()=>n(c=>!c),children:e.command?t(o?"approval.body.hideCommand":"approval.body.showCommand"):t(o?"approval.body.showLess":"approval.body.showAll")}):null]})}var $_=pe(function({approval:t,pendingCount:o,onOpenDiff:n,actions:r,className:a}){let{t:s}=z(),i=t.presentation;if(i===void 0)return l(vr,{state:"pending",className:a,icon:U_(t.requestKind),title:JC(t.requestKind,s),actions:r,children:t.detail?l("p",{className:"whitespace-pre-wrap text-chat-row",children:t.detail}):null});let{body:d}=i,c=m_(i.fileChanges),u=i.headline===null?i.description:null,m=i.outsideSandbox||u||i.justification?v("span",{className:"inline-flex flex-wrap gap-x-2 gap-y-1",children:[i.outsideSandbox?l("span",{className:"text-warning-foreground",children:s("approval.outsideSandbox")}):null,u?l("span",{children:u}):null,i.justification?l("span",{children:i.justification}):null]}):void 0;return l(vr,{state:"pending",className:a,icon:U_(i.kind),title:i.headlineIsCommand?l("span",{className:"block truncate font-mono [font-variant-ligatures:none]",children:YC(i,s)}):YC(i,s),subtitle:m,meta:o>1?`1/${o}`:void 0,actions:r,children:v("div",{"aria-label":JC(i.kind,s),className:"flex min-w-0 flex-col gap-2",role:"group",children:[d.shape==="none"?null:l(dj,{command:d.shape==="command",hidePreview:i.headlineIsCommand,label:g_(d.shape,s),singleLine:d.shape==="path"||d.shape==="url",text:d.shape==="command"?d.command:d.shape==="path"?d.path:d.shape==="url"?d.url:d.shape==="query"?d.query:d.text},t.requestId),i.fileChanges.map((p,f)=>l(H_,{fileChange:p,onOpenDiff:n},c[f])),i.detailArgs.length===0?null:v("details",{className:"min-w-0","data-approval-args":"true",children:[l("summary",{className:"cursor-[var(--control-cursor)] text-chat-row text-muted-foreground",children:s("approval.body.detailsSummary")}),l("dl",{"aria-label":s("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 bg-muted p-2 text-ui-sm [scrollbar-width:thin]",tabIndex:0,children:i.detailArgs.map(p=>v("div",{className:"col-span-2 grid grid-cols-subgrid",children:[l("dt",{className:"font-mono text-muted-foreground",children:p.name}),l("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:p.value})]},p.name))})]})]})})});var tu=pe(function(t){return l($_,{...t})});$();function cj(e){return[...e.filter(t=>t.tone==="primary"),...e.filter(t=>t.tone!=="primary")]}var ou=pe(function(t){let{t:o}=z(),n=it(),{shortcuts:r=!0}=t,[a,s]=q(!1),[i,d]=q(!1),c=E(!1),u=t.decision,m=u.requestId,p=cj(u.options),{onRespond:f}=t,g=R(L=>{m===null||c.current||(c.current=!0,d(!0),Promise.resolve(f(m,L)).finally(()=>{c.current=!1,d(!1)}))},[f,m]);if(n.pane.useKeydown(L=>{if(!r||m===null||c.current||L.defaultPrevented||n.terminalFocus.getOwner()!==null||L.isComposing||L.keyCode===229||L.metaKey||L.ctrlKey||L.altKey||L.shiftKey||er(L.target))return;let w=Bd(L.key,p.length);if(w===null)return;let k=p[w];k&&(L.preventDefault(),g(k.id))},{target:"document"}),m===null)return null;let h=L=>L.key===void 0?L.text:o(L.key,{...L.params,defaultValue:L.text}),y=u.askedBy.kind==="plugin"?u.askedBy.pluginId:null,[x,...C]=u.body,b=L=>{let w=p.indexOf(L),k=L.tone==="primary";return v(K,{size:"sm",variant:k?"default":"ghost",className:V(!k&&(L.tone==="danger"?"text-destructive-foreground hover:text-destructive-foreground":"text-muted-foreground hover:text-foreground")),disabled:i,onClick:()=>g(L.id),children:[h(L.label),r&&w<9?l(oi,{className:Ci,children:w+1}):null]},L.id)};return l(vr,{state:"pending",className:V("px-3 py-2 sm:px-4",t.className),icon:y===null?l(Fa,{}):l(dd,{}),title:h(u.title),subtitle:x===void 0?void 0:h(x),meta:y===null?void 0:l(Mo,{environmentId:t.environmentId,pluginId:y,iconClassName:"size-3"}),actions:v(oe,{children:[u.detail===null?null:l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground","aria-expanded":a,onClick:()=>s(L=>!L),children:o(a?"decision.hideDetail":"decision.showDetail")}),c_(u.options).map(b)]}),children:v("div",{className:"contents","data-composer-pending-decision":"true",children:[C.map((L,w)=>l("p",{className:"min-w-0 text-chat-row text-muted-foreground",children:h(L)},`${String(w)}:${L.key??L.text}`)),u.detail!==null&&a?l("pre",{className:"max-h-60 min-w-0 overflow-auto rounded-md bg-muted px-2.5 py-2 font-mono text-chat-code whitespace-pre-wrap text-foreground/90 [font-variant-ligatures:none] [overflow-wrap:anywhere]",children:u.detail.text.slice(0,4e3)}):null]})})});$();var tg=pe(function({pendingUserInputs:t,respondingRequestIds:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i=!0}){if(t.length===0)return null;let d=t[0];return d?l(uj,{prompt:d,isResponding:o.includes(d.requestId),answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i},d.requestId):null}),uj=pe(function({prompt:t,isResponding:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i}){let{t:d}=z(),c=it(),u=Uf(t.questions,n,r),m=u.activeQuestion,p=E(null),f=E(s),[g,h]=q(null),[y,x]=q(null),C=y!==null&&y===m?.id;H(()=>{f.current=s},[s]),H(()=>{if(!(!m||m.multiSelect||!g)){if(g.questionId!==m.id){h(null);return}u.customAnswer.trim().length===0&&u.selectedOptionLabels.includes(g.optionLabel)&&h(null)}},[m,g,u.customAnswer,u.selectedOptionLabels]);let b=R(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]);H(()=>b,[b]);let L=R(S=>{b(),s(S)},[b,s]),w=R((S,P)=>{if(m?.multiSelect){a(S,P);return}if(h({questionId:S,optionLabel:P}),a(S,P),b(),u.isLastQuestion)return;let A=u.questionIndex+1;p.current=window.setTimeout(()=>{p.current=null,f.current(A)},200)},[m,b,a,u.isLastQuestion,u.questionIndex]);if(c.pane.useKeydown(S=>{if(!i||!m||o||C||S.metaKey||S.ctrlKey||S.altKey||S.isComposing||S.keyCode===229||er(S.target))return;let P=Bd(S.key,m.options.length);if(P===null)return;let A=m.options[P];A&&(S.preventDefault(),w(m.id,Sa(A)))},{target:"document"}),!m)return null;let k=u.customAnswer.trim().length>0,I=g?.questionId===m.id?g.optionLabel:null,T=I!==null?[I]:k?[]:u.selectedOptionLabels;return v(vr,{state:"pending",className:"px-3 py-2 sm:px-4",icon:m.kind==="plan"?l(Jl,{}):l(Kn,{}),title:m.header,meta:C&&t.questions.length>1?`${u.questionIndex+1}/${t.questions.length}`:void 0,collapse:{collapsed:C,onCollapsedChange:S=>{x(S?m.id:null)},hint:m.question,toggleLabel:d(C?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion")},children:[l($f,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L}),l("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-chat text-foreground","data-pending-user-input-body":m.kind??"question",tabIndex:0,children:m.kind==="plan"?l(wo,{text:m.question,cwd:void 0,isStreaming:!1}):l("p",{className:"whitespace-pre-wrap font-medium",children:m.question})}),m.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:d("pendingUserInput.selectOneOrMore")}):null,l($u,{mode:m.multiSelect?"multiple":"single","aria-label":m.header,disabled:o,selected:T,onToggle:S=>{w(m.id,S)},onReselect:S=>{w(m.id,S)},options:m.options.map((S,P)=>{let A=hl(d,m,S);return{value:Sa(S),label:A.label,...A.description&&A.description!==A.label?{description:A.description}:{},...i&&P<9?{trailing:l(oi,{className:Ci,children:P+1})}:{}}})},m.id),l(zf,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L})]})});$();var z_=pe(function({planTitle:t}){let{t:o}=z();return l("div",{className:"px-3 py-2 sm:px-4",children:v("div",{className:"flex flex-wrap items-center gap-2",children:[l("span",{className:"text-xs font-medium text-muted-foreground",children:o("plan.ready")}),t?l("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function K_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return l(Zf,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function q_(e){return e.occupant.kind!=="user-input"?null:l(tg,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onGoToQuestion:e.onGoToActivePendingUserInputQuestion})}var W_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:l(tu,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:K_(e),className:"px-3 py-2 sm:px-4"}),collapsed:e=>e.occupant.kind!=="approval"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(tu,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:K_(e),className:"px-3 pt-2 pb-3 sm:px-4"})})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:l(ou,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(ou,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:q_,collapsed:e=>v("div",{"data-chat-composer-collapsed-controls":"true",children:[q_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:l(z_,{planTitle:yi(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function G_(e,t){let o=W_[e.occupant.kind],n=t?o.collapsed:o.expanded;return n===null?null:n(e)}var eLe=Object.keys(W_);function j_(e){let{composerOccupant:t,showComposerTopDrawer:o,hasBlockingComposerTopDrawer:n,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,activeProposedPlan:g,activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,badges:C,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,environmentUnavailable:k,noProviderAvailable:I,projectSelectionRequired:T,onGoToActivePendingUserInputQuestion:S,handleInterruptPrimaryAction:P,handleImplementPlanInNewThreadPrimaryAction:A}=e,{inlineTasksBadge:N,inlineStashBadge:B,visibleTasksProgress:O,visibleTaskSteps:j,dismissTasks:U,toggleTasksDrawer:D}=C;return v(oe,{children:[o&&(!r||n)?l("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-occupant":t?.kind??"none",children:t===null?null:G_({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,onGoToActivePendingUserInputQuestion:S,activeProposedPlan:g,collapsedPendingRow:l(s_,{activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,inlineTasksBadge:N,inlineStashBadge:B,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,isEnvironmentUnavailable:k!==null||I||T,handleInterruptPrimaryAction:P,handleImplementPlanInNewThreadPrimaryAction:A})},a)}):null,r&&!n&&O&&j?l(qN,{onDismiss:U,onCollapse:D,progress:O,steps:j}):null]})}function V_(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,browserAnnotations:e.browserAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,promptHasText:e.prompt.trim().length>0,hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.browserAnnotations.length+e.reviewComments.length}).hasSendableContent}}function Q_(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(o=>o.setPrompt),setComposerDraftNativeMode:t(o=>o.setNativeMode),addComposerDraftImage:t(o=>o.addImage),addComposerDraftImages:t(o=>o.addImages),removeComposerDraftImage:t(o=>o.removeImage),insertComposerDraftTerminalContext:t(o=>o.insertTerminalContext),removeComposerDraftElementContext:t(o=>o.removeElementContext),removeComposerDraftBrowserAnnotation:t(o=>o.removeBrowserAnnotation),removeComposerDraftReviewComment:t(o=>o.removeReviewComment),clearComposerDraftPromptAndImages:t(o=>o.clearComposerPromptAndImages)}}$();function X_(e){let{onComposerPaste:t,submitComposer:o,exitShellCommandMode:n}=e,r=E({onComposerPaste:t,submitComposer:o,exitShellCommandMode:n});r.current={onComposerPaste:t,submitComposer:o,exitShellCommandMode:n};let a=R(d=>{r.current.onComposerPaste(d)},[]),s=R((d,c)=>{r.current.submitComposer(d,c)},[]),i=R(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}$();var Y_=qe(null);function J_({children:e}){let{data:t,target:o,threadKey:n}=Ho(),r=t.useComposerStatus({target:o,threadKey:n});return l(Y_.Provider,{value:r,children:e})}function Z_(){let e=Pt(Y_);if(e===null)throw new Error("Composer status has not been provided.");return e}var e1=pe(function(t){let o=ZA(),{data:n,target:r,threadKey:a}=Ho(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:d,activePendingResolvedAnswers:c,activePendingIsResponding:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,questionAttachmentsSupported:f,respondingRequestIds:g,occupants:h,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,changeUserInputCustomAnswer:b,goToUserInputQuestion:L}=n.useComposerPending({target:r,threadKey:a}),{runtimeMode:w,interactionMode:k,lockedProvider:I,providerStatuses:T,activeProjectDefaultModelSelection:S,projectId:P,activeThreadModelSelection:A,activeThreadActualModel:N}=n.useComposerModelContext(r),{activeThreadId:B,activeThread:O,isLocalDraftThread:j,projectSelectionRequired:U,phase:D,isSendBusy:J,continuationChecking:G=!1,sendDisabledReason:M,groupSendDisabledReason:X,unavailableAgentInstanceId:F=null,noAgentChosen:ee=!1,environmentUnavailable:Y,compactDisabled:ae,compactDisabledReason:te}=Z_(),{t:de}=z(),{composerDraftTarget:ge,environmentId:ne,attachmentUploadsCapabilityKnown:Z,supportsAttachmentUploads:ve,routeKind:he,routeThreadRef:Ae,draftId:De,forceExpandedOnMobile:je,settings:ot,keybindings:me,terminalOpen:Me,gitCwd:ue,promptRef:ce,composerRef:Ze,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et,sendContextRef:Et,onSend:ft,onInterrupt:Ct,interruptArmed:gt=!1,stopping:Dt=!1,onCompactContext:Mt,onImplementPlanInNewThread:se,onProviderInstanceSelect:Le,onModelSelectionChosen:be,handleRuntimeModeChange:Xe,handleInteractionModeChange:xt,handleNativeModeChange:tt,focusComposer:It,setThreadError:po}=t,Ko=n.useComposerPlan(r),Qt=Ko.proposedPlan,hn=Ko.tasksProgress,At=Ko.taskSteps,St=i.length===0&&k==="plan"&&Qt!==null,bt=E(null),{pendingPrimaryAction:mo,onSelectActivePendingUserInputOption:kt,onRespondToApproval:_t,onRespondToComposerDecision:Xt}=DN({t:de,threadId:r.threadId,setThreadError:po,promptRef:ce,promptInputRef:bt,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,activePendingProgress:d,activePendingIsResponding:u,activePendingResolvedAnswers:c}),nt=t.api,{limits:lt}=t.attachments,Bt=nt.draft.useThreadDraftSelector(ge,Wo=>V_(Wo,nt.chat.deriveComposerSendState)),Ht=i[0]??null,{questionAttachmentTarget:Yt,attachmentTarget:qo,attachmentDocumentKey:fo}=RN({supported:f,attachments:t.attachments,environmentId:ne,threadId:B,requestId:Ht?.requestId??null,question:d?.activeQuestion??null,responding:u,composerDraftTarget:ge}),go=nt.draft.useThreadDraftSelector(qo,PN),Jt=go.images,Hn=Bt.terminalContexts,Ce=Bt.elementContexts,Ue=Bt.browserAnnotations,rt=Bt.reviewComments,Lt=go.nonPersistedImageIds,wt=nt.uploads.useStore(Wo=>Wo.uploadsByImageId),Ot=!Z&&Jt.length>0?de("attachments.capabilityUnknown"):ve?cN({imageIds:Jt.map(Wo=>Wo.id),uploadsByImageId:wt,environmentId:ne},de):null,{setComposerDraftPrompt:Ro,setComposerDraftNativeMode:nn,addComposerDraftImage:Fr,addComposerDraftImages:ka,removeComposerDraftImage:As,insertComposerDraftTerminalContext:lg,removeComposerDraftElementContext:ru,removeComposerDraftBrowserAnnotation:dg,removeComposerDraftReviewComment:au,clearComposerDraftPromptAndImages:xl}=Q_(nt);H(()=>{if(Z){if(!ve){for(let Wo of Jt)nt.uploads.release(Wo.id);return}nt.draft.restoreAttachments();for(let Wo of Jt)nt.uploads.start({environmentId:ne,image:Wo})}},[Z,Jt,ne,ve]);let bl=d!==null,yn=oD({api:nt,t:de,settings:ot,composerDraft:Bt,composerDraftTarget:ge,environmentId:ne,gitCwd:ue,routeKind:he,threadId:r.threadId,activeThread:O,isLocalDraftThread:j,unavailableAgentInstanceId:F,agentNotChosen:ee,runtimeMode:w,lockedProvider:I,providerStatuses:T,projectId:P,activeProjectDefaultModelSelection:S,activeThreadModelSelection:A,actualModel:N,compactDisabledReason:te,externalSendDisabledReason:M,attachmentBlockReason:Ot,answeringQuestion:bl,setComposerDraftNativeMode:nn,handleNativeModeChange:tt,onProviderInstanceSelect:Le,onModelSelectionChosen:be}),{selectedInstanceId:cg,noProviderAvailable:wl,selectedProvider:Tl,selectedModel:su,selectedModelChoice:ug,sendDisabledReason:iu,isSendDisabled:lu,setModelSendBlockShown:du,isModelSendBlocked:pg}=yn,Il=iN({api:nt,environmentId:ne,target:ge,provider:yn.selectedProviderStatus,planModeEnabled:yn.planModeUiEnabled}),Un=dN(ne,ge),[cu,Ns]=q(!1),[Sl,Ds]=q(null),[mg,uu]=q(null),[kl,Ll]=q(!1),[pu,mu]=q(!1),[fg,fu]=q(null),[_s,gu]=q({key:0,active:!1}),hu=E(Un);fe(()=>{hu.current!==Un&&(hu.current=Un,Ns(!1),Ds(null),Ll(!1),mu(!1),fu(null),gu({key:_s.key,active:!1}))},[Un,_s.key]);let La=Vp("max-sm"),Pa=E(null),gg=E(null),Os=E(null),yu=E(null),vu=E(new Map),{isComposerCollapsedMobile:Ra,blurMobileComposerAfterSend:hg,expandMobileComposer:ht,scheduleComposerCollapseCheck:Fs,handleFormFocusCapture:Q1}=NN({isMobileViewport:La,forceExpandedOnMobile:je,composerEditorRef:Pa,composerSurfaceRef:yu,composerFormRef:Os}),X1=R(()=>{Ns(!0)},[]),Y1=R(Wo=>{xt(Wo)},[xt]),Ea=s!==null,J1=d?.activeQuestion?.allowFreeform===!1,vx=h[0]??null,{showTopDrawer:Cx,showCollapsedPromptRow:Z1,hasBlocking:xx}=lN(vx?.kind??null,Ra),eO=St||d!==null,{isComposerFooterCompact:tO,isComposerPrimaryActionsCompact:oO}=mN(Os,eO),nO=sD({routeKind:he,routeThreadRef:Ae,draftId:De,selectedProvider:Tl,selectedInstanceId:cg,selectedModel:su,selectedModelChoice:ug});H(()=>{Ds(null)},[Ce,Ue,rt,Hn,su,yn.selectedModelOptionsForDispatch,Tl]),AN({composerImages:Jt,composerImagesRef:pt,composerTerminalContexts:Hn,composerTerminalContextsRef:ze,composerElementContexts:Ce,composerElementContextsRef:et});let rO=$N({activeThreadId:B,isLocalDraftThread:j,isComposerApprovalState:Ea,hasPendingProgress:d!==null,hasPendingAction:mo!==null,memberMentions:n.memberMentions,target:r,promptRef:ce}),Ma=UN({pluginAction:Il,api:nt,t:de,limits:lt,composerDraftTarget:ge,composerDraft:Bt,composerDocumentKey:Un,promptRef:ce,promptInputRef:bt,pendingImageCompressionsRef:vu,setComposerDraftPrompt:Ro,setModelSendBlockShown:du,onSend:ft,onCompactContext:Mt,blurMobileComposerAfterSend:hg,isMobileViewport:La,isComposerApprovalState:Ea,activePendingApproval:s,activePendingProgress:d,activePendingResolvedAnswers:c,pendingUserInputCount:i.length,activeThreadId:B,phase:D,isSendBusy:J,environmentUnavailable:Y,compactDisabled:ae,noProviderAvailable:wl,isSendDisabled:lu,sendDisabledReason:iu,groupSendDisabledReason:X,isGroupSend:rO,isModelSendBlocked:pg,showPlanFollowUpPrompt:St}),Pl=SN({api:nt,t:de,limits:lt,promptRef:ce,promptInputRef:bt,composerEditorRef:Pa,composerImagesRef:pt,composerDraftTarget:ge,setComposerDraftPrompt:Ro,addComposerDraftImages:ka,clearComposerDraftPromptAndImages:xl,setIsStashMenuOpen:Ll,setStashPulse:gu,isComposerCollapsedMobile:Ra,expandMobileComposer:ht,keybindings:me,terminalOpen:Me,isComposerModelPickerOpen:cu,hasPendingUserInputs:i.length>0,isComposerApprovalState:Ea,projectSelectionRequired:U,answeringQuestion:bl}),yg=WN({activeThreadId:B,activeThread:O,activeTasksProgress:hn,activeTaskSteps:At,isTasksDrawerOpen:pu,setIsTasksDrawerOpen:mu,dismissedTasksTurnId:fg,setDismissedTasksTurnId:fu,stashQueue:Pl.stashQueue,isStashMenuOpen:kl,stashPulse:_s,toggleInlineStashMenu:Pl.toggleInlineStashMenu,isComposerApprovalState:Ea,externalDrawerAttached:o,showComposerTopDrawer:Cx,isComposerCollapsedMobile:Ra,hasBlockingComposerTopDrawer:xx}),aO=R(Wo=>{Ds(null),Ma.revalidatePromptLength(Wo),Ll(!1)},[Ma.revalidatePromptLength]),{addComposerImages:bx,removeComposerImage:sO,onComposerAttachmentInputChange:iO}=LN({api:nt,t:de,limits:lt,setThreadError:po,activeThreadId:B,answerQuestionsFirst:i.length>0&&Yt===null,attachmentTarget:qo,attachmentDocumentKey:fo,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:Z,pendingImageCompressionsRef:vu,addComposerDraftImage:Fr,addComposerDraftImages:ka,removeComposerDraftImage:As}),{onComposerPaste:lO,insertComposerTextAtEnd:dO,addDroppedFolders:cO,isDragOverComposer:uO,composerMentionDragHandlers:pO,onComposerMentionDragLeaveCapture:mO}=IN({api:nt,t:de,addComposerImages:bx,attachments:t.attachments,promptRef:ce,promptInputRef:bt,composerEditorRef:Pa,composerFormRef:Os,composerThreadKey:a,attachmentDocumentKey:fo,attachmentImagesRef:pt,limits:lt,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:Z,composerDocumentKey:Un,isComposerApprovalState:Ea,pasteBlocked:i.length>0&&Yt===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:U,environmentId:ne}),wx=R(()=>{Ct()},[Ct]),Tx=R(()=>{se()},[se]),{handleComposerPaste:fO,handleComposerSubmit:gO,handleUnclaimedEscape:hO}=X_({onComposerPaste:lO,submitComposer:Ma.submitComposerOrShellCommand,exitShellCommandMode:Ma.exitShellCommandMode});return MN({composerRef:Ze,sendContextRef:Et,api:nt,t:de,limits:lt,composerData:n,refs:{composerEditorRef:Pa,promptInputRef:bt,promptRef:ce,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et},composerDraftTarget:ge,activeThread:O,addComposerImages:bx,addDroppedFolders:cO,focusComposer:It,insertComposerTextAtEnd:dO,insertComposerDraftTerminalContext:lg,composerBrowserAnnotations:Ue,composerReviewComments:rt,isComposerApprovalState:Ea,pendingUserInputCount:i.length,projectSelectionRequired:U,noProviderAvailable:wl,modelState:yn,handleRuntimeModeChange:Xe,runtimeMode:w,setIsComposerModelPickerOpen:Ns,setProviderInputSubmissionError:Ds}),l(a_,{formRef:Os,onSubmit:Ma.submitComposerOrShellCommand,onFocusCapture:Q1,onBlurCapture:Fs,dragHandlers:pO,onDragLeaveCapture:mO,badges:yg,stashQueueLength:Pl.stashQueue.length,isStashMenuOpen:kl,stashPulse:_s,toggleStashMenu:Pl.toggleStashMenu,drawers:l(j_,{composerOccupant:vx,showComposerTopDrawer:Cx,hasBlockingComposerTopDrawer:xx,isTasksDrawerOpen:pu,isComposerCollapsedMobile:Ra,respondingRequestIds:g,keybindings:me,onRespondToApproval:_t,onRespondToDecision:Xt,environmentId:ne,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:kt,activeProposedPlan:Qt,activePendingProgress:d,isPendingUserInputChoiceOnly:J1,expandMobileComposer:ht,badges:yg,pendingPrimaryAction:mo,isSendBusy:J,sendDisabledReason:iu,environmentUnavailable:Y,noProviderAvailable:wl,projectSelectionRequired:U,onGoToActivePendingUserInputQuestion:L,handleInterruptPrimaryAction:wx,handleImplementPlanInNewThreadPrimaryAction:Tx}),children:l(r_,{pluginAction:Il,props:t,composerDraft:Bt,model:yn,traits:nO,submit:Ma,stash:Pl,badges:yg,uploadsByImageId:wt,composerImages:Jt,nonPersistedComposerImageIds:Lt,removeComposerImage:sO,removeComposerDraftBrowserAnnotation:dg,removeComposerDraftReviewComment:au,removeComposerDraftElementContext:ru,onComposerAttachmentInputChange:iO,surfaceRef:yu,composerAttachmentInputRef:gg,promptInputRef:bt,composerEditorRef:Pa,composerMenuAnchor:mg,setComposerMenuAnchor:uu,composerDocumentKey:Un,isComposerCollapsedMobile:Ra,expandMobileComposer:ht,isDragOverComposer:uO,isComposerApprovalState:Ea,showCollapsedMobilePromptRow:Z1,activePendingProgress:d,pendingUserInputs:i,changeUserInputCustomAnswer:b,pendingPrimaryAction:mo,handleComposerPaste:fO,handleComposerSubmit:gO,onPromptEdited:aO,handleUnclaimedEscape:hO,openModelPicker:X1,switchInteractionMode:Y1,providerInputSubmissionError:Sl,isStashMenuOpen:kl,isComposerFooterCompact:tO,isComposerPrimaryActionsCompact:oO,isMobileViewport:La,isComposerModelPickerOpen:cu,setIsComposerModelPickerOpen:Ns,showPlanFollowUpPrompt:St,compactDisabled:ae,compactThreadContext:Ma.compactThreadContext,status:{projectSelectionRequired:U,groupSendDisabledReason:X,isSendBusy:J,environmentUnavailable:Y,interruptArmed:gt,stopping:Dt,agentNotChosen:ee,unavailableAgentInstanceId:F,lockedProvider:I,phase:D,continuationChecking:G,activeThread:O,interactionMode:k,runtimeMode:w},actions:{handleInterruptPrimaryAction:wx,handleImplementPlanInNewThreadPrimaryAction:Tx}})})});function t1(e){let{composerRef:t,...o}=e;return l(rl,{value:o.api,children:l(e1,{...o,composerRef:t})})}function Cl({section:e,resetKey:t,children:o}){return l(vi,{resetKey:t,fallback:n=>pj(e,n),children:o})}function pj(e,t){return l(mj,{section:e,error:t})}function mj({section:e,error:t}){let{t:o}=Ne();return v("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:[l(eo,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive-foreground"}),v("div",{className:"min-w-0",children:[l("p",{className:"font-medium text-foreground",children:o(`timeline.sectionUnavailable.${e}`)}),l("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:o("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function o1({hostVersion:e,scopeClass:t}){let{t:o}=Ne();return v("div",{role:"status","data-conversation-host-data-mismatch":!0,className:V("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:[l(eo,{"aria-hidden":!0,className:"size-5 text-destructive-foreground"}),l("p",{className:"font-medium text-foreground",children:o("timeline.hostDataMismatchTitle")}),l("p",{className:"max-w-md text-muted-foreground",children:o("timeline.hostDataMismatchDescription",{host:e??0,plugin:El})})]})}$();function n1(e){let t=Nt();H(()=>{let o=e.current;if(!o)return;let n=r=>{let a=r.detail?.reference;a&&t.openThread({environmentId:a.environmentId,threadId:a.threadId})};return o.addEventListener(Hs,n),()=>o.removeEventListener(Hs,n)},[t,e])}function r1({data:e,target:t,slots:o,children:n}){return l($b,{data:e,target:t,children:l(sh,{value:o,children:n})})}function a1(e){let{data:t}=e;return t?.version!==El?l(o1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):l(Ru.Provider,{value:e.scope.active,children:l(hj,{...e,data:t})})}var fj=pe(function({threadKey:t,onModeChange:o,summaryContext:n}){let[r]=Ge(t,null,{namespace:"turn-navigator"}),a=R(s=>{o("chat"),r?.onSelect(s)},[o,r]);return r===null?null:l(Zb,{...r,placement:"inline",onSelect:a,summaryContext:n})});function gj({slots:e,children:t}){let{data:o,target:n,threadKey:r}=Ho(),a=o.useComposerPending({target:n,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function hj(e){let{scope:t,mode:o,timeline:n,trajectory:r,composer:a,data:s}=e,[,i]=Ge(t.threadKey,null,{namespace:"turn-navigator"}),d=a.draftHero.active,c=a.sessionActions,u=a.terminalControl,m=a.agentsControl,{mode:p,onModeChange:f}=o,g=W(()=>({data:s,target:{environmentId:t.environmentId,threadId:t.threadId},threadKey:t.threadKey,openTrajectory:()=>f("trajectory"),onOpenFileDiff:n.onOpenFileDiff}),[s,t.environmentId,t.threadId,t.threadKey,f,n.onOpenFileDiff]),h=W(()=>d?v(oe,{children:[c,l("div",{className:"min-w-0 flex-1"}),u]}):v(oe,{children:[c,l(Ob,{mode:p,onModeChange:f}),l("div",{className:"min-w-0 flex-1"}),u,m,l(fj,{threadKey:t.threadKey,onModeChange:f,summaryContext:g})]}),[d,c,u,m,p,f,t.threadKey,g]),{belowSlot:y,teamDock:x,draftHero:C,onOverlayElementChange:b,sessionActions:L,terminalControl:w,agentsControl:k,contextStrip:I,...T}=a,S=l(t1,{...T,attachments:e.attachments,firstRow:h}),P=W(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[A,N]=q(null),B=R(he=>N(he?{key:t.threadKey,value:he}:null),[t.threadKey]),O=A?.key===t.threadKey?A.value:null,[j,U]=Ge(t.threadKey,null,{namespace:"trajectory-reveal"}),D=R(he=>{o.onModeChange("chat"),U(Ae=>({rowId:he,nonce:(Ae?.nonce??0)+1}))},[o,U]),J=R(()=>U(null),[U]),G=E(null);n1(G);let{t:M}=z(),X=E(a.api);X.current=a.api;let F=R(he=>X.current.notify.warning(M(`timeline.quote.${he}`)),[M]),ee=R(()=>X.current.notify.warning(M("forkRelations.messageMissing")),[M]),[Y,ae]=Ge(t.threadKey,null,{namespace:"timeline-quote-reveal"});H(()=>{let he=G.current;if(!he)return;let Ae=De=>{let je=De.detail?.quote;if(je){if(je.environmentId!==P.environmentId||je.threadId!==P.threadId){F("otherThread");return}o.onModeChange("chat"),ae({quote:je})}};return he.addEventListener(wu,Ae),()=>he.removeEventListener(wu,Ae)},[o,ae,P.environmentId,P.threadId,F]);let te=R(he=>{ae(null),he==="message-missing"&&F("messageMissing"),he==="passage-missing"&&F("passageMissing")},[ae,F]),de=W(()=>({data:s,target:P,threadKey:t.threadKey}),[s,P,t.threadKey]),{controlRef:ge,...ne}=n,Z=s.useChatWindow({target:P,threadKey:t.threadKey,visible:t.visible&&o.mode==="chat"}),ve=MS({inputKey:t.threadKey,visible:t.visible,endInset:n.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:Z.onReturnToLatest,controlRef:ge});return l(r1,{slots:a.slots,data:s,target:P,children:v("div",{ref:G,className:V("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[s.useMessageReveal?l(yj,{read:s.useMessageReveal,target:P,onChange:B,active:t.active&&t.visible,onModeChange:o.onModeChange},t.threadKey):null,l(vj,{data:s,target:P,threadKey:t.threadKey,environmentId:t.environmentId,threadId:t.threadId,slots:a.slots}),l(tw,{data:s,target:P,threadKey:t.threadKey,surfaceRef:G}),l(Fb,{chat:v(Cl,{section:"chat",resetKey:t.threadKey,children:[l(SS,{data:s,target:P,visible:t.visible,...ne,paneActive:t.active,liveFollowEnabled:ve.liveFollowEnabled,scrollerRef:ve.bindTimelineHandle,onRowsChange:ve.onRowsChange,onIsAtEndChange:ve.onIsAtEndChange,onManualNavigation:ve.onManualNavigation,onDisclosureNavigation:ve.onDisclosureNavigation,loadEarlier:Z.loadEarlier,loadLater:Z.loadLater,pagingBlockedByInteraction:Z.pagingBlockedByInteraction,restoringHistory:Z.restoringHistory??!1,onVisibleTurnRangeChange:Z.onVisibleTurnRangeChange,onReturnToLatest:Z.loadLater===null?null:ve.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:j,messageReveal:t.active?O:null,onMessageRevealMissing:ee,revealQuoteRequest:Y,onRevealQuoteDone:te,onRevealMessageHandled:J}),l(LS,{data:s,target:P,bottomInset:n.contentInsetEndAdjustment,showScrollToEnd:ve.showScrollToEnd,onScrollToEnd:ve.returnToEnd})]},"chat"),mode:o.mode,trajectory:l(Cl,{section:"trajectory",resetKey:t.threadKey,children:l(WS,{data:s,target:P,inputKey:t.threadKey,paneVisible:t.visible&&o.mode==="trajectory",timestampFormat:r.timestampFormat,contentInsetEndAdjustment:n.contentInsetEndAdjustment,onOpenInChat:D,onOpenFileDiff:n.onOpenFileDiff})},"trajectory"),visible:t.visible}),l(rN,{api:a.api,data:s,draftId:a.draftId,target:P,threadKey:t.threadKey,belowSlot:a.belowSlot,teamDock:a.teamDock,composer:l(Cl,{section:"composer",resetKey:t.threadKey,children:l(Np,{value:de,children:l(J_,{children:l(gj,{slots:a.slots,children:S})})})}),draftHero:a.draftHero,slots:a.slots,environmentId:t.environmentId,threadId:t.threadId,onOverlayElementChange:a.onOverlayElementChange,questions:l(Cl,{section:"composer",resetKey:t.threadKey,children:l(GA,{data:s,target:P})}),queue:l(Cl,{section:"queue",resetKey:t.threadKey,children:l(KA,{data:s,target:P,inputKey:t.threadKey,attachments:e.attachments})})})]})})}function yj({read:e,target:t,onChange:o,active:n,onModeChange:r}){let a=e(t);return H(()=>{o(a)},[a,o]),H(()=>()=>o(null),[o]),H(()=>{n&&a.request&&r("chat")},[n,a.request,r]),null}function vj(e){let o=e.data.useComposerStatus({target:e.target,threadKey:e.threadKey}).activeThread?.presetId??null;return l("div",{className:"max-h-[min(280px,36vh)] min-h-0 shrink overflow-y-auto empty:hidden","data-conversation-views":!0,children:e.slots?.renderSlot("conversation.view",{environmentId:e.environmentId,threadId:e.threadId,presetId:o})},e.threadKey)}$();$();function dx(e){return e.turnOutline??e.turns.map((t,o)=>({messageId:t.messageId,ordinal:Math.max(e.turnCount,e.turns.length)-e.turns.length+o+1,...t.error!==null?{failed:!0}:{},...o===e.turns.length-1&&e.status==="waiting"?{waiting:!0}:{}}))}function s1(e,t,o){let n=dx(e),r=[],a=[],s=()=>{if(a.length>=3)r.push({kind:"group",turns:a});else for(let i of a)r.push({kind:"turn",turn:i});a=[]};return n.forEach((i,d)=>{d===0||d===n.length-1||i.failed||i.waiting||i.forkSource||t.has(i.messageId)||o.has(`${e.threadId}:${i.messageId}`)?(s(),r.push({kind:"turn",turn:i})):a.push(i)}),s(),r}var Fn=264,cr=136,og=20,i1=16,l1=16,Cj=(Fn+og)/3,xj=Fn/2,bj={cards:[],edges:[],ticks:[],width:0,height:0};function cx(e){return`${e}:thread`}function ng(e,t){return`${e}:turn:${t}`}function d1(e){if(e.threads.length===0)return bj;let t=[...e.threads].sort((C,b)=>C.createdAt.localeCompare(b.createdAt)||C.threadId.localeCompare(b.threadId)),o=new Map,n=[],r=0,a=null;t.forEach((C,b)=>{let L=e.dayOf(C.createdAt);if(b>0&&(r+=Cj+(L===a?0:xj)),L!==a){let w=t[b-1],k=w===void 0?0:Date.parse(C.createdAt)-Date.parse(w.createdAt);n.push({x:r,at:C.createdAt,...k>864e5?{gapDays:Math.floor(k/864e5)}:{}})}a=L,o.set(C.threadId,r)});let s=new Map(t.map(C=>[C.threadId,C])),i=new Map;for(let C of t){if(C.forkedFrom===null)continue;let b=i.get(C.forkedFrom.sourceThreadId)??new Set;b.add(C.forkedFrom.sourceMessageId),i.set(C.forkedFrom.sourceThreadId,b)}let d=new Map(t.map(C=>[C.threadId,s1(C,i.get(C.threadId)??new Set,e.revealed??new Set)])),c=new Map,u=[],m=new Map,p=0,f=[];for(let C of t){let b=o.get(C.threadId)??0,L=wj(C,e.expanded,d.get(C.threadId)??[]),w=C.forkedFrom===null?void 0:s.get(C.forkedFrom.sourceThreadId),k=w!==void 0?c.get(w.threadId):void 0,I=k===void 0?0:k+1;for(;I<f.length&&(f[I]??0)+og>b;)I+=1;f[I]=b+L,c.set(C.threadId,I),p=Math.max(p,b+L)}let g=Math.max(1,f.length),h=l1*2+g*cr+(g-1)*i1;for(let C of t){let b=l1+(c.get(C.threadId)??0)*(cr+i1),L=o.get(C.threadId)??0,w=Tj(C,e.expanded,d.get(C.threadId)??[],L,b);u.push(...w),w[0]!==void 0&&m.set(C.threadId,w[0])}let y=[],x=new Map(u.map(C=>[C.id,C]));for(let C of t){let b=C.forkedFrom,L=m.get(C.threadId);if(b===null||L===void 0)continue;let w=x.get(ng(b.sourceThreadId,b.sourceMessageId))??m.get(b.sourceThreadId);w!==void 0&&y.push({id:`${w.id}->${L.id}`,path:Ij(w,L),sourceThreadId:b.sourceThreadId,childThreadId:C.threadId})}return{cards:u,edges:y,ticks:n,width:p,height:h}}function c1(e,t){return t.has(e.threadId)&&dx(e).length>0}function wj(e,t,o){let n=c1(e,t)?o.length:1;return n*Fn+(n-1)*og}function Tj(e,t,o,n,r){return c1(e,t)?o.map((a,s)=>{let i=a.kind==="turn"?a.turn:a.turns[0];if(i===void 0)throw new Error("Empty turn group");return{id:a.kind==="group"?`${e.threadId}:group:${i.messageId}`:ng(e.threadId,i.messageId),kind:a.kind,threadId:e.threadId,turnIndex:i.ordinal-1,messageId:i.messageId,...a.kind==="group"?{groupedMessageIds:a.turns.map(d=>d.messageId)}:{},x:n+s*(Fn+og),y:r}}):[{id:cx(e.threadId),kind:"thread",threadId:e.threadId,turnIndex:-1,x:n,y:r}]}function Ij(e,t){let o=e.x+Fn/2,n=e.y+cr,r=t.x,a=t.y+cr/2,s=Math.max(24,(a-n)/2);return`M ${o} ${n} C ${o} ${n+s}, ${r-s} ${a}, ${r} ${a}`}function u1(e,t,o,n=240){if(o.width===0||o.height===0)return!1;let r=e.x*t.scale+t.x,a=e.y*t.scale+t.y;return r+Fn*t.scale>=-n&&a+cr*t.scale>=-n&&r<=o.width+n&&a<=o.height+n}var Bn=24;function nu(e){return{left:0,top:36}}function ux(e,t,o=1){let n=nu(t),r=t.width-n.left-Bn*2,a=e.cards.at(-1),s=a===void 0?e.width:a.x+Fn,i=s*o<=r?n.left+Bn:t.width-Bn-s*o,d=Math.min(n.top+Bn/2,t.height-Bn-(a===void 0?0:a.y+cr)*o);return{x:i,y:d,scale:o}}function m1(e,t,o){return{...e,x:e.x+(o.width-t.width)/2,y:e.y+(o.height-t.height)/2}}function f1(e,t){let o=nu(t);if(e.width===0||t.width===0)return{x:o.left+Bn,y:o.top+Bn/2,scale:1};let n=C1(Math.min((t.width-o.left-Bn*2)/e.width,(t.height-o.top-Bn*2)/Math.max(1,e.height)),.25,1);return{x:o.left+Bn,y:o.top+Bn/2,scale:n}}function g1(e,t,o){let n=nu(o),r=n.left+(o.width-n.left)/2,a=n.top+(o.height-n.top)/2;return{scale:t.scale,x:r-(e.x+Fn/2)*t.scale,y:a-(e.y+cr/2)*t.scale}}function rg(e,t,o){let n=C1(e.scale*t,.25,4),r=(o.x-e.x)/e.scale,a=(o.y-e.y)/e.scale;return{scale:n,x:o.x-r*n,y:o.y-a*n}}function h1(e){return e.ctrlKey||e.metaKey}function y1(e,t,o=48){switch(t){case"ArrowLeft":return{...e,x:e.x+o};case"ArrowRight":return{...e,x:e.x-o};case"ArrowUp":return{...e,y:e.y+o};case"ArrowDown":return{...e,y:e.y-o};default:return null}}function px(e,t){return t?e<=.55:e<.5}function v1(e,t,o){return{...e,x:e.x+(t.x-o.x)*e.scale,y:e.y+(t.y-o.y)*e.scale}}function C1(e,t,o){return Number.isFinite(e)?Math.min(o,Math.max(t,e)):t}$();function mx(e){return e.archived?"map.status.archived":kj[e.status]}var kj={running:"map.status.running",waiting:"map.status.waiting",failed:"map.status.failed",done:"map.status.done"};function x1(e,t){return{"data-selected":e.selected?"":void 0,"data-matched":e.matched?"":void 0,"data-current-match":e.current?"":void 0,"data-dimmed":e.dimmed?"":void 0,onPointerEnter:()=>e.onHover(t),onPointerLeave:()=>e.onHover(null),onFocus:()=>e.onHover(t),onBlur:()=>e.onHover(null),tabIndex:0}}function b1(e,t){return{style:{left:e.card.x,top:e.card.y},onPointerDown:o=>o.stopPropagation(),onClick:()=>e.onSelect(t),onKeyDown:o=>{o.target===o.currentTarget&&(o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),e.onSelect(t)))}}}function Lj(e){return e===void 0?"":(e.answer||e.error||e.question).trim()}var w1=pe(function(t){let{t:o,thread:n}=t,r=t.formatTitle?.(n.title)??n.title,a=Lj(n.turns.at(-1)),s=n.loaded?n.turns.length>0:n.turnCount>0;return v("article",{className:"session-map-card","data-status":n.archived?"archived":n.status,...x1(t,n.threadId),"aria-label":r||o("settings.hiddenUntitled"),...b1(t,n.threadId),children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:r||o("settings.hiddenUntitled")})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,v("p",{className:"session-map-meta",children:[l("span",{className:"session-map-status",children:o(mx(n))}),n.loaded?l("span",{children:o("map.turns",{count:n.turnCount})}):null,l("span",{children:t.updatedLabel})]}),n.loaded?l("p",{className:"session-map-preview",children:a||o("map.noReply")}):l("p",{className:"session-map-preview","data-pending":"","aria-hidden":!0}),v("footer",{onClick:i=>i.stopPropagation(),children:[s?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onExpand(t.card),children:o("map.expand")}):null,l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>t.onOpen(n.threadId),children:o("map.open")}),v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":o("map.hide"),onClick:()=>t.onHide(n.threadId)}),children:l($l,{})}),l(Re,{side:"top",children:o("map.hide")})]})]})]})}),T1=pe(function(t){let{t:o,thread:n,card:r}=t,a=t.formatTitle?.(n.title)??n.title,s=n.turns.find(u=>u.messageId===r.messageId),i=n.turnOutline?.find(u=>u.messageId===r.messageId),d=r.turnIndex+1,c=(s?.answer||s?.error||"").trim();return v("article",{className:"session-map-card","data-turn":"","data-status":n.archived?"archived":i?.failed?"failed":i?.waiting?"waiting":d===n.turnCount?n.status:"done",...x1(t,n.threadId),"aria-label":o("map.turnLabel",{index:d,title:a}),...b1(t,n.threadId),children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-ordinal",children:o("map.turnOrdinal",{index:d})}),v("strong",{children:[l("span",{className:"session-map-turn-question",children:s?.question||o(s===void 0?"map.loading":"map.noQuestion")}),l("span",{className:"session-map-compact-title",children:a||o("settings.hiddenUntitled")})]})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,l("p",{className:"session-map-preview","data-error":s?.error!=null&&s.answer.length===0?"":void 0,"data-pending":s===void 0?"":void 0,children:s===void 0?null:c||o("map.noReply")}),v("footer",{onClick:u=>u.stopPropagation(),children:[r.turnIndex===0?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onCollapse(r),children:o("map.collapse")}):null,v(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>{r.messageId!==void 0&&t.onFork(n.threadId,r.messageId)},children:[l(jl,{}),o("map.fork")]})]})]})}),I1=pe(function(t){return v("article",{className:"session-map-card session-map-group",tabIndex:0,"aria-label":t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0}),onClick:()=>t.onReveal(t.card),onKeyDown:o=>{o.target===o.currentTarget&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t.onReveal(t.card))},"data-status":t.thread.archived?"archived":"done","data-dimmed":t.dimmed?"":void 0,"data-selected":t.selected?"":void 0,onPointerDown:o=>o.stopPropagation(),onPointerEnter:()=>t.onHover(t.thread.threadId),onPointerLeave:()=>t.onHover(null),onFocus:()=>t.onHover(t.thread.threadId),onBlur:()=>t.onHover(null),style:{left:t.card.x,top:t.card.y},children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:(t.formatTitle?.(t.thread.title)??t.thread.title)||t.t("settings.hiddenUntitled")})]}),l(K,{type:"button",size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),t.onReveal(t.card)},children:t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0})})]})});function S1({text:e}){return e.length===0?null:l(wo,{className:"session-map-md",text:e})}var Pj=3;function k1(e){let{t,thread:o}=e,n=e.formatTitle?.(o.title)??o.title,a=(e.fuller??o).turns.slice(-Pj);return v("aside",{className:"session-map-panel","aria-label":n||t("settings.hiddenUntitled"),children:[v("header",{children:[l("strong",{children:n||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":t("map.closePanel"),onClick:e.onClose,children:l(dt,{})})]}),v("p",{className:"session-map-meta","data-status":o.archived?"archived":o.status,children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-status",children:t(mx(o))})]}),v("p",{className:"session-map-meta",children:[l("span",{children:t("map.created",{time:e.formatTime(o.createdAt)})}),l("span",{children:t("map.updated",{time:e.formatTime(o.updatedAt)})}),o.loaded?l("span",{children:t("map.turns",{count:o.turnCount})}):null]}),l(K,{type:"button",size:"sm",onClick:()=>e.onOpen(o.threadId),children:t("map.open")}),l("h3",{children:t("map.recent")}),e.notice!==null?l(Qr,{title:e.notice}):null,!o.loaded&&e.fuller===null?l(Qs,{"aria-label":t("map.loading")}):a.length===0?l(Qr,{title:t("map.noTurns")}):l("ol",{className:"session-map-turns",children:a.map(s=>v("li",{children:[l("p",{className:"session-map-question",children:s.question}),s.answer.length>0?l(S1,{text:s.answer}):s.error!==null?l("p",{className:"session-map-error",children:s.error}):l("p",{className:"session-map-muted",children:t("map.noReply")}),s.answerTruncated||s.questionTruncated?l("p",{className:"session-map-muted",children:t("map.truncated")}):null]},s.messageId))})]})}$();function L1(e){let t=new Map,o=new Map;for(let n of e){if(n.forkedFrom===null)continue;let r=n.forkedFrom.sourceThreadId;t.set(n.threadId,r);let a=o.get(r)??new Set;a.add(n.threadId),o.set(r,a)}return{count:n=>o.get(n)?.size??0,family:n=>{if(n===null)return new Set;let r=t.get(n);return new Set([n,...r===void 0?[]:[r],...o.get(n)??[]])}}}function P1(e,t,o,n,r){return t!==null&&!o.has(e)||n&&!r.has(e)}function R1(e,t,o){if(e.ticks.length===0)return[];let n=0;for(let s=1;s<e.ticks.length&&!(e.ticks[s].x*t.scale+t.x>0);s+=1)n=s;let r=e.ticks[n],a=e.ticks[n+1];return[{...r,gapDays:void 0,sticky:!0,left:Math.min(0,a===void 0?0:a.x*t.scale+t.x-112)},...e.ticks.slice(n+1).flatMap(s=>{let i=s.x*t.scale+t.x;return i<=o.width?[{...s,sticky:!1,left:i}]:[]})]}function E1(e){let t=E(null),o=E(null),n=E(!1),[r,a]=q(null),s=W(()=>L1(Array.from(e.threads.values())),[e.threads]),i=W(()=>s.family(e.selectedThreadId),[s,e.selectedThreadId]),d=E(e.camera),c=E(e.onCamera),u=E(e.onFrame);d.current=e.camera,c.current=e.onCamera,u.current=e.onFrame;let m=E(()=>{}),p=E(null);H(()=>{let w=t.current;if(w===null)return;let k=null,I=0,T=()=>{I=0;let B=k;k=null,B!==null&&c.current(B)},S=B=>{d.current=B,k=B;let O=o.current;O!==null&&(O.style.transform=fx(B),O.style.setProperty("--map-scale",String(B.scale)),n.current=px(B.scale,n.current),O.toggleAttribute("data-compact",n.current)),I===0&&(I=window.requestAnimationFrame(T))};m.current=S;let P=B=>{B.preventDefault();let O=d.current;if(!h1(B)){S({...O,x:O.x-B.deltaX,y:O.y-B.deltaY});return}let j=w.getBoundingClientRect();S(rg(O,B.deltaY<0?1.08:.92,{x:B.clientX-j.left,y:B.clientY-j.top}))},A=()=>u.current({width:w.clientWidth,height:w.clientHeight});A();let N=new ResizeObserver(A);return N.observe(w),w.addEventListener("wheel",P,{passive:!1}),()=>{N.disconnect(),w.removeEventListener("wheel",P),I!==0&&window.cancelAnimationFrame(I)}},[]),H(()=>{if(p.current!==null)return;let w=o.current;w!==null&&(w.style.transform=fx(e.camera),w.style.setProperty("--map-scale",String(e.camera.scale)),n.current=px(e.camera.scale,n.current),w.toggleAttribute("data-compact",n.current))},[e.camera]);let f=W(()=>e.layout.cards.filter(w=>u1(w,e.camera,e.frame)),[e.layout,e.camera,e.frame]),g=W(()=>{let w=new Set;for(let k of f)e.threads.get(k.threadId)?.loaded===!1&&w.add(k.threadId);return[...w].sort().join(`
|
|
3593
|
+
`)},[f,e.threads]),h=E(e.onVisible);h.current=e.onVisible,H(()=>{g.length>0&&h.current(g.split(`
|
|
3594
|
+
`))},[g]);let y=W(()=>{let w=new Map;for(let k of f){if(k.kind!=="turn"||k.messageId===void 0||e.threads.get(k.threadId)?.turns.some(T=>T.messageId===k.messageId))continue;let I=w.get(k.threadId)??[];I.push(k.messageId),w.set(k.threadId,I)}return w},[f,e.threads]),x=JSON.stringify(Array.from(y)),C=E(e.onVisibleTurns);C.current=e.onVisibleTurns,H(()=>{for(let[w,k]of y)C.current(w,k)},[x]);let b=nu(e.frame),{camera:L}=e;return v("div",{ref:t,className:"session-map-stage",tabIndex:0,"aria-label":e.t("map.pan"),onKeyDown:w=>{if(w.target!==w.currentTarget)return;let k=y1(d.current,w.key);k!==null&&(w.preventDefault(),e.onCamera(k))},onPointerDown:w=>{w.button===0&&(p.current={x:d.current.x,y:d.current.y,px:w.clientX,py:w.clientY},w.currentTarget.setPointerCapture(w.pointerId))},onPointerMove:w=>{let k=p.current;k!==null&&m.current({...d.current,x:k.x+w.clientX-k.px,y:k.y+w.clientY-k.py})},onPointerUp:w=>{p.current=null,w.currentTarget.hasPointerCapture(w.pointerId)&&w.currentTarget.releasePointerCapture(w.pointerId)},children:[v("div",{ref:o,className:"session-map-world","data-compact":n.current?"":void 0,style:{transform:fx(L),"--map-scale":L.scale},children:[l("svg",{className:"session-map-edges",width:"1",height:"1","aria-hidden":!0,children:e.layout.edges.filter(w=>[e.selectedThreadId,r].some(k=>k!==null&&(w.sourceThreadId===k||w.childThreadId===k))).map(w=>l("path",{d:w.path},w.id))}),f.map(w=>{let k=e.threads.get(w.threadId);if(k===void 0)return null;let I={formatTitle:e.formatTitle,selected:e.selectedThreadId===k.threadId,matched:e.matches.has(k.threadId),current:e.currentMatch===k.threadId,dimmed:P1(k.threadId,e.selectedThreadId,i,e.searching,e.matches),forkCount:s.count(k.threadId),onHover:a};return w.kind==="group"?l(I1,{...I,t:e.t,card:w,thread:k,onReveal:e.onReveal},w.id):w.kind==="thread"?l(w1,{...I,t:e.t,card:w,thread:k,updatedLabel:e.formatTime(k.updatedAt),onSelect:e.onSelect,onExpand:e.onExpand,onOpen:e.onOpen,onHide:e.onHide},w.id):l(T1,{...I,t:e.t,card:w,thread:k,onSelect:e.onSelect,onCollapse:e.onCollapse,onFork:e.onFork},w.id)})]}),l("div",{className:"session-map-ruler",style:{left:b.left,height:b.top},"aria-hidden":!0,children:R1(e.layout,L,e.frame).map(w=>v("span",{"data-sticky-day":w.sticky?"":void 0,style:{left:w.left,...w.sticky?{width:112}:{}},children:[w.gapDays===void 0?null:l("small",{className:"session-map-gap",children:e.t("map.gapDays",{count:w.gapDays})}),e.formatDay(w.at)]},w.at))}),e.children]})}function fx(e){return`translate(${e.x}px, ${e.y}px) scale(${e.scale})`}function M1(e){let{t}=e,o=e.width<720;return v("header",{className:"session-map-bar",children:[l("span",{className:"session-map-count","aria-live":"polite",children:e.pending?t("map.loading"):t("map.sessions",{count:e.count})}),v("div",{className:"session-map-actions",children:[v("div",{className:"session-map-search",children:[l(Tb,{value:e.query,size:"sm","aria-label":t("map.search"),placeholder:t("map.search"),onValueChange:e.onQuery,onKeyDown:n=>{n.key!=="Enter"||e.matches===0||(n.preventDefault(),e.onNextMatch(n.shiftKey))}}),e.query.trim()?l("span",{className:"session-map-muted","aria-live":"polite",children:e.matches===0?t("map.searchNone"):t("map.searchCount",{index:e.matchIndex%e.matches+1,count:e.matches})}):null]}),o?null:v(Du,{className:"session-map-check",children:[l(_u,{checked:e.showArchived,"aria-label":t("map.showArchived"),onCheckedChange:e.onShowArchived}),l("span",{children:t("map.showArchived")})]}),v("div",{className:"session-map-zoom",children:[l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.zoomOut"),onClick:()=>e.onZoom(1/1.2),children:l(rd,{})}),v("span",{"aria-label":t("map.zoom",{percent:Math.round(e.scale*100)}),children:[Math.round(e.scale*100),"%"]}),l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.zoomIn"),onClick:()=>e.onZoom(1.2),children:l(ld,{})})]}),o?v(Ao,{children:[l(Do,{render:l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.more")}),children:l(Eo,{})}),v(No,{align:"end",children:[v(vo,{role:"menuitemcheckbox","aria-checked":e.showArchived,onClick:()=>e.onShowArchived(!e.showArchived),children:[e.showArchived?l(jo,{}):null,t("map.showArchived")]}),v(vo,{onClick:e.onFit,children:[l(zs,{}),t("map.fit")]}),v(vo,{onClick:e.onLatest,children:[l(Ks,{}),t("map.latest")]})]})]}):[{key:"map.fit",icon:l(zs,{}),click:e.onFit},{key:"map.latest",icon:l(Ks,{}),click:e.onLatest}].map(n=>v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t(n.key),onClick:n.click}),children:n.icon}),l(Re,{children:t(n.key)})]},n.key))]})]})}function A1(e,t,o){let n=t.trim().toLocaleLowerCase();return n.length===0?[]:e.filter(r=>{let a=r.turns.at(-1);return`${r.title}
|
|
3613
3595
|
${o?.(r.title)??r.title}
|
|
3614
3596
|
${a?.question??""}
|
|
3615
|
-
${a?.answer??""}`.toLocaleLowerCase().includes(n)}).sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||r.threadId.localeCompare(a.threadId)).map(r=>r.threadId)}var
|
|
3597
|
+
${a?.answer??""}`.toLocaleLowerCase().includes(n)}).sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||r.threadId.localeCompare(a.threadId)).map(r=>r.threadId)}var ag=`
|
|
3616
3598
|
.ycodium-session-map, .ycodium-session-map *, .session-map-chrome, .session-map-chrome * { box-sizing: border-box; }
|
|
3617
3599
|
.ycodium-session-map, .session-map-chrome {
|
|
3618
3600
|
--map-fg: var(--foreground, #e7eaf1);
|
|
@@ -3686,8 +3668,8 @@ ${a?.answer??""}`.toLocaleLowerCase().includes(n)}).sort((r,a)=>r.createdAt.loca
|
|
|
3686
3668
|
}
|
|
3687
3669
|
.session-map-card {
|
|
3688
3670
|
position: absolute;
|
|
3689
|
-
width: ${
|
|
3690
|
-
height: ${
|
|
3671
|
+
width: ${Fn}px;
|
|
3672
|
+
height: ${cr}px;
|
|
3691
3673
|
display: flex;
|
|
3692
3674
|
flex-direction: column;
|
|
3693
3675
|
gap: 6px;
|
|
@@ -3841,4 +3823,4 @@ ${a?.answer??""}`.toLocaleLowerCase().includes(n)}).sort((r,a)=>r.createdAt.loca
|
|
|
3841
3823
|
.session-map-settings h2 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
|
|
3842
3824
|
.session-map-settings h3 { margin: 4px 0 0; font-size: 13px; font-weight: 600; }
|
|
3843
3825
|
.session-map-hidden { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
|
|
3844
|
-
`;function S1(e){let{t,board:o}=e,[n,r]=q(""),[a,s]=q(0),[i,d]=q(()=>new Set),[c,u]=q(()=>new Set),m=M(null),p=M(!1),f=P(J=>{m.current=J,d(ne=>new Set(ne).add(J.threadId))},[]),g=P(J=>{m.current=J,d(ne=>{let te=new Set(ne);return te.delete(J.threadId),te})},[]),h=P(J=>{m.current=J,u(ne=>{let te=new Set(ne);for(let le of J.groupedMessageIds??[])te.add(`${J.threadId}:${le}`);return te})},[]),[y,x]=q({x:0,y:0,scale:1}),[C,b]=q({width:0,height:0}),[L,w]=q(null),k=M(!1),I=M(null),T=W(()=>o?.threads??[],[o]),S=W(()=>{let J=new Map;for(let ne of o?.threads??[])J.set(ne.threadId,ne);return J},[o]),R=P(J=>{w({threadId:J,title:S.get(J)?.title||t("settings.hiddenUntitled")}),e.selectedThreadId===J&&e.onSelect(null),e.onHide(J)},[S,t,e.selectedThreadId,e.onSelect,e.onHide]),A=W(()=>n1({threads:T,expanded:i,revealed:c,dayOf:Rw}),[T,i,c]);fe(()=>{let J=m.current;if(J===null)return;let ne=A.cards.find(te=>te.id===J.id)??(J.messageId===void 0?void 0:A.cards.find(te=>te.id===dg(J.threadId,J.messageId)))??A.cards.find(te=>te.threadId===J.threadId);m.current=ne??null,ne!==void 0&&(J.x!==ne.x||J.y!==ne.y)&&x(te=>p1(te,J,ne))},[A]);let N=W(()=>I1(T,n,e.formatTitle),[T,n,e.formatTitle]),B=W(()=>new Set(N),[N]),O=N.length===0?null:N[a%N.length]??null,V=C.width>0&&C.height>0;fe(()=>{if(!V||A.cards.length===0)return;let J=I.current,ne=J!==null&&(J.width!==C.width||J.height!==C.height);I.current=C,!k.current||ne&&!p.current?(k.current=!0,x(fx(A,C))):ne&&J!==null&&x(te=>i1(te,J,C))},[A,C,V]),H(()=>s(0),[n]),H(()=>{if(O===null||!V)return;let J=A.cards.find(ne=>ne.id===mx(O))??A.cards.find(ne=>ne.threadId===O);m.current=null,p.current=!0,J!==void 0&&x(ne=>d1(J,ne,C))},[O,a]);let U=M(new Set),D=M(null),X=M(new Set),j=M(e.onLoad);j.current=e.onLoad,H(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);let E=P(J=>{for(let ne of J)U.current.has(ne)||X.current.add(ne);X.current.size===0||D.current!==null||(D.current=setTimeout(()=>{D.current=null;let ne=[...X.current];X.current.clear();for(let te of ne)U.current.add(te);j.current(ne)},200))},[]),Y=P(J=>{m.current=null,p.current=!0,x(J)},[]),F=e.selectedThreadId===null?void 0:S.get(e.selectedThreadId),Z={x:C.width/2,y:C.height/2};return v("section",{className:"ycodium-session-map",children:[l("style",{children:ug}),l(T1,{t,width:C.width,query:n,onQuery:r,pending:e.pending&&o===null,count:T.length,matches:N.length,matchIndex:a,onNextMatch:J=>s(ne=>(ne+(J?N.length-1:1))%Math.max(1,N.length)),showArchived:o?.showArchived??!1,onShowArchived:e.onShowArchived,scale:y.scale,onZoom:J=>Y(cg(y,J,Z)),onFit:()=>Y(l1(A,C)),onLatest:()=>Y(fx(A,C,y.scale))}),L===null?null:v("div",{className:"session-map-undo",role:"status",children:[l("span",{children:t("map.hiddenNotice",{title:e.formatTitle?.(L.title)??L.title})}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.onRestore(L.threadId),w(null)},children:t("map.undo")})]}),v("div",{className:"session-map-body",children:[l(w1,{t,layout:A,threads:S,camera:y,frame:C,selectedThreadId:e.selectedThreadId,matches:B,currentMatch:O,searching:n.trim().length>0,formatDay:Lw,formatTime:e.formatTime,formatTitle:e.formatTitle,onCamera:Y,onFrame:b,onVisible:E,onSelect:e.onSelect,onExpand:f,onCollapse:g,onReveal:h,onVisibleTurns:e.onLoadTurns,onOpen:e.onOpenThread,onHide:R,onFork:e.onFork,children:o===null?l("div",{className:"session-map-empty",children:l(Jr,{title:e.pending?t("map.loading"):t("map.noMachine")})}):A.cards.length===0?v("div",{className:"session-map-empty",children:[l("strong",{children:t("map.empty")}),l("p",{className:"session-map-muted",children:t("map.emptyHint")})]}):null}),F===void 0?null:l(v1,{t,thread:F,fuller:e.fuller?.threadId===F.threadId?e.fuller:null,notice:e.panelNotice,formatTime:e.formatTime,formatTitle:e.formatTitle,onOpen:e.onOpenThread,onClose:()=>e.onSelect(null)})]})]})}$();function an(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Bt(e){return typeof e=="string"?e:""}function k1(e){return!an(e)||!Array.isArray(e.threads)||!Array.isArray(e.projects)?null:{projects:e.projects.flatMap(t=>{if(!an(t))return[];let o=Bt(t.projectId);return o.length===0?[]:[{projectId:o,title:Bt(t.title),workspaceRoot:Bt(t.workspaceRoot),archived:t.archived===!0}]}),threads:e.threads.flatMap(t=>{let o=pg(t);return o===null?[]:[o]}),hiddenThreadIds:vx(e.hiddenThreadIds),hiddenThreads:Lj(e.hiddenThreads),showArchived:e.showArchived===!0}}function Cx(e,t){if(!an(t))return e;if(t.patch!==!0)return k1(t)??e;if(e===null)return null;let o=new Set(vx(t.removedThreadIds)),n=t.hiddenThreadIds!==void 0?vx(t.hiddenThreadIds):e.hiddenThreadIds,r=new Set(n),a=t.showArchived!==void 0?t.showArchived===!0:e.showArchived,s=new Map(e.threads.map(d=>[d.threadId,d]));for(let d of o)s.delete(d);if(Array.isArray(t.threads))for(let d of t.threads){let c=pg(d);if(c!==null){if(o.has(c.threadId)||r.has(c.threadId)){s.delete(c.threadId);continue}if(!a&&c.archived){s.delete(c.threadId);continue}s.set(c.threadId,c)}}if(t.hiddenThreadIds!==void 0||t.showArchived!==void 0)for(let[d,c]of s)(r.has(d)||!a&&c.archived)&&s.delete(d);let i=k1({projects:t.projects??e.projects,threads:[],hiddenThreadIds:n,hiddenThreads:t.hiddenThreads??e.hiddenThreads,showArchived:a});return i===null?{...e,threads:[...s.values()]}:{...i,threads:[...s.values()]}}function L1(e){return an(e)?"present"in e?e.present===!0?pg(e.value):null:pg(e):null}function R1(e){return an(e)?{ok:e.ok===!0,threadId:Bt(e.threadId),walkedBack:e.walkedBack===!0,code:Bt(e.code)}:{ok:!1,threadId:"",walkedBack:!1,code:"empty"}}function pg(e){if(!an(e))return null;let t=Bt(e.threadId);if(t.length===0)return null;let o=an(e.forkedFrom)?e.forkedFrom:null,n=o===null?"":Bt(o.sourceThreadId),r=o===null?"":Bt(o.sourceMessageId);return{threadId:t,projectId:Bt(e.projectId),title:Bt(e.title),createdAt:Bt(e.createdAt),updatedAt:Bt(e.updatedAt),archived:e.archived===!0,running:e.running===!0,status:Sj(e.status,e.running===!0),turnCount:typeof e.turnCount=="number"&&Number.isInteger(e.turnCount)&&e.turnCount>0?e.turnCount:0,loaded:e.loaded===!0,forkedFrom:n.length>0&&r.length>0?{sourceThreadId:n,sourceMessageId:r}:null,inheritedMessageCount:typeof e.inheritedMessageCount=="number"?e.inheritedMessageCount:0,cutWalkedBack:e.cutWalkedBack===!0,turns:Array.isArray(e.turns)?e.turns.flatMap(E1):[],...Array.isArray(e.turnOutline)?{turnOutline:e.turnOutline.flatMap(Ij)}:{}}}function Ij(e){return!an(e)||typeof e.messageId!="string"||typeof e.ordinal!="number"?[]:[{messageId:e.messageId,ordinal:e.ordinal,...e.failed===!0?{failed:!0}:{},...e.waiting===!0?{waiting:!0}:{},...e.forkSource===!0?{forkSource:!0}:{}}]}function P1(e,t){return!an(e)||e.threadId!==t||!Array.isArray(e.turns)?[]:e.turns.flatMap(E1)}function Sj(e,t){return e==="running"||e==="waiting"||e==="failed"||e==="done"?e:t?"running":"done"}function E1(e){if(!an(e))return[];let t=Bt(e.messageId);return t.length===0?[]:[{messageId:t,question:Bt(e.question),questionTruncated:e.questionTruncated===!0,answer:Bt(e.answer),answerTruncated:e.answerTruncated===!0,error:typeof e.error=="string"?e.error:null,tools:Array.isArray(e.tools)?e.tools.flatMap(kj):[],running:e.running===!0}]}function kj(e){if(!an(e))return[];let t=Bt(e.callId);return t.length===0?[]:[{callId:t,title:Bt(e.title),status:Bt(e.status)}]}function Lj(e){return Array.isArray(e)?e.flatMap(t=>{if(!an(t))return[];let o=Bt(t.threadId);return o.length===0?[]:[{threadId:o,title:Bt(t.title)}]}):[]}function vx(e){return Array.isArray(e)?e.flatMap(t=>typeof t=="string"&&t.length>0?[t]:[]):[]}function mg(e){let[t,o]=q(()=>({data:e,board:Cx(null,e)}));return t.data!==e&&o({data:e,board:Cx(t.board,e)}),t.board}$();function M1(e){let{bridge:t,environmentId:o,threadId:n,onResult:r}=e,a=t.sessionProjections.useProjection("card",n,{environmentId:o});return H(()=>{let s=!0;return t.commands.invoke("focus",{threadId:n},{environmentId:o}).catch(()=>{s&&r({threadId:n,thread:null,notice:"projection.readFailed"})}),()=>{s=!1}},[t,o,n,r]),H(()=>{let s=L1(a);s!==null&&s.threadId!==n||r({threadId:n,thread:s,notice:a.isUnavailable?"projection.unavailable":a.error!==null?"projection.readFailed":null})},[a.present,a.value,a.isUnavailable,a.error,n,r]),null}$();function A1(e,t,o){let[n,r]=q(()=>new Map),a=M(new Set),s=M(!0);H(()=>(s.current=!0,()=>{s.current=!1}),[]);let i=P((c,u)=>{let m=u.filter(p=>!a.current.has(`${c}:${p}`)).slice(0,60);if(m.length!==0){for(let p of m)a.current.add(`${c}:${p}`);e.commands.invoke("turns",{threadId:c,messageIds:m},{environmentId:t}).then(p=>{if(!s.current)return;let f=P1(p,c);r(g=>{let h=new Map(g),y=new Map(h.get(c));for(let x of f)y.set(x.messageId,x);return h.set(c,y),h})},()=>{for(let p of m)a.current.delete(`${c}:${p}`)})}},[e,t]);return{board:W(()=>o===null?null:{...o,threads:o.threads.map(c=>{let u=n.get(c.threadId);if(u===void 0)return c;let m=new Map(u);for(let p of c.turns)m.set(p.messageId,p);return{...c,turns:[...m.values()]}})},[o,n]),load:i}}function D1(e){let{bridge:t,environmentId:o,projectId:n}=e,r={environmentId:o},a=t.commands.useSubscription("live",{projectId:n},r),s=mg(a.data),i=A1(t,o,s),d=t.i18n.usePluginTranslation(),c=t.useFormatTimestamp(),u=t.useThreadDisplayTitle?.()??Ad,[m,p]=q(null),[f,g]=q(null),h=f?.threadId===m?f:null;return v(oe,{children:[l(S1,{t:d,board:i.board,pending:a.isPending,selectedThreadId:m,fuller:h?.thread??null,panelNotice:h?.notice==null?null:d(h.notice),formatTime:c,formatTitle:u,onSelect:p,onOpenThread:y=>{t.openThread({environmentId:o,threadId:y})},onHide:y=>{t.commands.invoke("hide",{threadId:y},r)},onRestore:y=>{t.commands.invoke("restore",{threadId:y},r)},onShowArchived:y=>{t.commands.invoke("preferences",{patch:{showArchived:y}},r)},onLoad:y=>{for(let x=0;x<y.length;x+=60)t.commands.invoke("load",{threadIds:y.slice(x,x+60)},r)},onLoadTurns:i.load,onFork:(y,x)=>{t.commands.invoke("fork",{threadId:y,messageId:x},r).then(C=>{let b=R1(C);if(!b.ok){t.notify(d(Rj(b.code)),"warning");return}b.walkedBack&&t.notify(d("map.forkWalkedBack"),"info"),t.openThread({environmentId:o,threadId:b.threadId})},()=>t.notify(d("map.forkFailed"),"warning"))}}),m===null?null:l(M1,{bridge:t,environmentId:o,threadId:m,onResult:g},`${o}:${n}:${m}`)]})}function Rj(e){switch(e){case"missing-thread":return"map.forkMissing";case"no-user-message":return"map.forkNoUser";default:return"map.forkFailed"}}function _1(e){let t=e.bridge.i18n.usePluginTranslation(),o=e.bridge.useThreadDisplayTitle?.()??Ad,n=e.environmentId,r=n===null?{}:{environmentId:n},a=e.bridge.commands.useSubscription("live",{},r),s=mg(a.data);return v("section",{className:"session-map-chrome session-map-settings",children:[l("style",{children:ug}),l("h2",{children:t("settings.title")}),s===null?l(Jr,{title:a.isPending?t("map.loading"):t("map.noMachine")}):v(oe,{children:[v(Fu,{className:"session-map-check",children:[l(Bu,{checked:s.showArchived,"aria-label":t("settings.archived"),onCheckedChange:i=>{e.bridge.commands.invoke("preferences",{patch:{showArchived:i}},r)}}),l("span",{children:t("settings.archived")})]}),l("h3",{children:t("settings.hidden")}),s.hiddenThreads.length===0?l(Jr,{title:t("settings.noneHidden")}):null,s.hiddenThreads.map(i=>v("div",{className:"session-map-hidden",children:[l("span",{children:o(i.title)||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.bridge.commands.invoke("restore",{threadId:i.threadId},r)},children:t("settings.restore")})]},i.threadId))]})]})}$();function O1(e){let{t}=z(),{pending:o}=e,[n,r]=q(null),{api:a}=e,s=P(p=>{r(p),a.notify.error(p)},[a]),i=P(async(...p)=>{r(null);try{await o.respondToApproval(...p)}catch(f){s(f instanceof Error?f.message:t("approval.respondFailed"))}},[o,t,s]),d=P((p,f)=>(r(null),o.respondToDecision(p,f).then(g=>{g!==null&&s(g)})),[o,s]),c=P(()=>{r(null),o.advanceUserInput().then(p=>{p!==null&&s(p)})},[o,s]),u=o.activePendingProgress,m=u?.activeQuestion??null;return l(ll,{value:e.api,children:v("div",{className:"flex min-w-0 flex-col","data-pending-requests":e.threadId,children:[o.pendingApprovals.map(p=>l(au,{approval:p,pendingCount:o.pendingApprovals.length,className:"px-3 py-2 sm:px-4",actions:l(ag,{requestId:p.requestId,isResponding:o.respondingRequestIds.includes(p.requestId),options:p.options,declineReasonRelay:p.declineReasonRelay,shortcuts:!1,onRespondToApproval:i})},p.requestId)),o.pendingDecisions.map(p=>l(su,{decision:p,environmentId:e.environmentId,onRespond:d,shortcuts:!1},p.requestId??p.title.text)),l(ig,{pendingUserInputs:o.pendingUserInputs,respondingRequestIds:o.respondingRequestIds,answers:o.activePendingDraftAnswers,questionIndex:o.activePendingQuestionIndex,shortcuts:!1,onToggleOption:o.selectUserInputOption,onGoToQuestion:p=>o.goToUserInputQuestion(p)}),u===null||m===null?null:v("div",{className:"flex min-w-0 flex-col gap-2 px-3 pb-2 sm:px-4","data-pending-answer-controls":!0,children:[m.allowFreeform===!1?null:l(Yr,{type:"text",size:"sm","aria-label":t("composer.writeCustomAnswer"),placeholder:t("composer.writeCustomAnswer"),value:u.customAnswer,disabled:o.activePendingIsResponding,onChange:p=>{let f=p.target.value;o.changeUserInputCustomAnswer(m.id,f,f.length,f.length,!1)}}),l("div",{className:"flex min-w-0 items-center justify-end gap-2",children:l(K,{size:"xs",disabled:o.activePendingIsResponding||(u.isLastQuestion?o.activePendingResolvedAnswers===null:!u.canAdvance),onClick:c,children:Jc(t,{compact:!1,isLastQuestion:u.isLastQuestion,isResponding:o.activePendingIsResponding,questionIndex:u.questionIndex})})})]}),n===null?null:l("p",{role:"alert",className:"px-3 pb-2 text-ui-xs text-destructive-foreground sm:px-4",children:n})]})})}$();var Pj=[],Ej=[],Mj="prompt-font-preview",F1="max-h-40 min-h-12";function B1(){}function Aj(e){let t=0;return Or(e).map(o=>{let n=t;return t+=o.type==="text"?o.text.length:o.type==="mention"?o.source.length:o.type==="skill"?o.name.length+1:1,{key:n,segment:o}})}function Nj(e){return l("div",{className:RC,children:l("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:G(PC,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:l("p",{children:Aj(e.prompt).map(({key:t,segment:o})=>o.type==="mention"?l("span",{className:Ln,children:l(Ff,{path:o.path,theme:e.theme})},t):o.type==="skill"?l("span",{className:Ln,children:l(Bf,{label:nn({name:o.name})})},t):o.type==="text"?l("span",{children:o.text},t):null)})})})}function H1(){let{t:e}=z(),t=e("composer.idlePlaceholder"),o=lt().theme.useResolvedTheme()==="dark"?"dark":"light",n=e("composer.fontPreviewSample"),r=M(null),[a,s]=q(null),i=a?.prompt??n,d=a?.cursor??n.length,[c,u]=q(!1),m=P((f,g)=>{s({prompt:f,cursor:g})},[]),p=P(()=>u(!0),[]);return H(()=>{c&&r.current?.focusAtEnd()},[c]),l("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:c?l(ml,{documentKey:Mj,editorRef:r,value:i,cursor:d,terminalContexts:Pj,skills:Ej,disabled:!1,placeholder:t,className:F1,onRemoveTerminalContext:B1,onChange:m,onPaste:B1}):l(Nj,{className:F1,onActivate:p,placeholder:t,prompt:i,theme:o})})}var Dj=".ycodium-conversation-ui";function _j(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function U1(e,t="conversation"){let o=_j(),n=e.replaceAll(Dj,`.${o}`),r=0,a=null;return{scopeClass:o,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=n,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function Oj(e){let t=U1(Mx);return{views:{[Lu]:Fj(t,e),[kg]:Bj(t,e),[Rg]:Hj(t,e)},viewCapabilities:{[Lu]:[Lg,Fx]},slots:[{name:"project.workbench.tab",needsWidePanel:!0,titleKey:"map.title",icon:"./thread-map.svg",component(o){return l(Ks,{value:e,children:l(D1,{bridge:e,...o},`${o.environmentId}:${o.projectId}`)})}},{name:"conversation.input.agent",order:0,component:$N},{name:"conversation.input.model",order:0,component:uD},{name:"conversation.input.plan",order:0,component:gD},{name:"conversation.input.permission",order:0,component:fD},{name:"settings.section",order:0,component(o){return l(Ks,{value:e,children:l(_1,{bridge:e,environmentId:o.environmentId??null})})}}]}}function Fj(e,t){return function(n){let a=n[Ru]??t,s={...n};return delete s[Ru],v(Ks,{value:a,children:[l(xx,{retain:e.retain}),l(Iu,{value:e.scopeClass,children:l(Z_,{...s,scopeClass:e.scopeClass})})]})}}function Bj(e,t){return function(n){return v(Ks,{value:t,children:[l(xx,{retain:e.retain}),l(Iu,{value:e.scopeClass,children:l(ll,{value:n.api,children:l("div",{className:e.scopeClass,children:l(H1,{})})})})]})}}function Hj(e,t){return function(n){return v(Ks,{value:t,children:[l(xx,{retain:e.retain}),l(Iu,{value:e.scopeClass,children:l("div",{className:e.scopeClass,children:l(O1,{...n})})})]})}}function xx({retain:e}){return Nl(()=>e(),[e]),null}export{Oj as default};
|
|
3826
|
+
`;function N1(e){let{t,board:o}=e,[n,r]=q(""),[a,s]=q(0),[i,d]=q(()=>new Set),[c,u]=q(()=>new Set),m=E(null),p=E(!1),f=R(Y=>{m.current=Y,d(ae=>new Set(ae).add(Y.threadId))},[]),g=R(Y=>{m.current=Y,d(ae=>{let te=new Set(ae);return te.delete(Y.threadId),te})},[]),h=R(Y=>{m.current=Y,u(ae=>{let te=new Set(ae);for(let de of Y.groupedMessageIds??[])te.add(`${Y.threadId}:${de}`);return te})},[]),[y,x]=q({x:0,y:0,scale:1}),[C,b]=q({width:0,height:0}),[L,w]=q(null),k=E(!1),I=E(null),T=W(()=>o?.threads??[],[o]),S=W(()=>{let Y=new Map;for(let ae of o?.threads??[])Y.set(ae.threadId,ae);return Y},[o]),P=R(Y=>{w({threadId:Y,title:S.get(Y)?.title||t("settings.hiddenUntitled")}),e.selectedThreadId===Y&&e.onSelect(null),e.onHide(Y)},[S,t,e.selectedThreadId,e.onSelect,e.onHide]),A=W(()=>d1({threads:T,expanded:i,revealed:c,dayOf:kw}),[T,i,c]);fe(()=>{let Y=m.current;if(Y===null)return;let ae=A.cards.find(te=>te.id===Y.id)??(Y.messageId===void 0?void 0:A.cards.find(te=>te.id===ng(Y.threadId,Y.messageId)))??A.cards.find(te=>te.threadId===Y.threadId);m.current=ae??null,ae!==void 0&&(Y.x!==ae.x||Y.y!==ae.y)&&x(te=>v1(te,Y,ae))},[A]);let N=W(()=>A1(T,n,e.formatTitle),[T,n,e.formatTitle]),B=W(()=>new Set(N),[N]),O=N.length===0?null:N[a%N.length]??null,j=C.width>0&&C.height>0;fe(()=>{if(!j||A.cards.length===0)return;let Y=I.current,ae=Y!==null&&(Y.width!==C.width||Y.height!==C.height);I.current=C,!k.current||ae&&!p.current?(k.current=!0,x(ux(A,C))):ae&&Y!==null&&x(te=>m1(te,Y,C))},[A,C,j]),H(()=>s(0),[n]),H(()=>{if(O===null||!j)return;let Y=A.cards.find(ae=>ae.id===cx(O))??A.cards.find(ae=>ae.threadId===O);m.current=null,p.current=!0,Y!==void 0&&x(ae=>g1(Y,ae,C))},[O,a]);let U=E(new Set),D=E(null),J=E(new Set),G=E(e.onLoad);G.current=e.onLoad,H(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);let M=R(Y=>{for(let ae of Y)U.current.has(ae)||J.current.add(ae);J.current.size===0||D.current!==null||(D.current=setTimeout(()=>{D.current=null;let ae=[...J.current];J.current.clear();for(let te of ae)U.current.add(te);G.current(ae)},200))},[]),X=R(Y=>{m.current=null,p.current=!0,x(Y)},[]),F=e.selectedThreadId===null?void 0:S.get(e.selectedThreadId),ee={x:C.width/2,y:C.height/2};return v("section",{className:"ycodium-session-map",children:[l("style",{children:ag}),l(M1,{t,width:C.width,query:n,onQuery:r,pending:e.pending&&o===null,count:T.length,matches:N.length,matchIndex:a,onNextMatch:Y=>s(ae=>(ae+(Y?N.length-1:1))%Math.max(1,N.length)),showArchived:o?.showArchived??!1,onShowArchived:e.onShowArchived,scale:y.scale,onZoom:Y=>X(rg(y,Y,ee)),onFit:()=>X(f1(A,C)),onLatest:()=>X(ux(A,C,y.scale))}),L===null?null:v("div",{className:"session-map-undo",role:"status",children:[l("span",{children:t("map.hiddenNotice",{title:e.formatTitle?.(L.title)??L.title})}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.onRestore(L.threadId),w(null)},children:t("map.undo")})]}),v("div",{className:"session-map-body",children:[l(E1,{t,layout:A,threads:S,camera:y,frame:C,selectedThreadId:e.selectedThreadId,matches:B,currentMatch:O,searching:n.trim().length>0,formatDay:Sw,formatTime:e.formatTime,formatTitle:e.formatTitle,onCamera:X,onFrame:b,onVisible:M,onSelect:e.onSelect,onExpand:f,onCollapse:g,onReveal:h,onVisibleTurns:e.onLoadTurns,onOpen:e.onOpenThread,onHide:P,onFork:e.onFork,children:o===null?l("div",{className:"session-map-empty",children:l(Qr,{title:e.pending?t("map.loading"):t("map.noMachine")})}):A.cards.length===0?v("div",{className:"session-map-empty",children:[l("strong",{children:t("map.empty")}),l("p",{className:"session-map-muted",children:t("map.emptyHint")})]}):null}),F===void 0?null:l(k1,{t,thread:F,fuller:e.fuller?.threadId===F.threadId?e.fuller:null,notice:e.panelNotice,formatTime:e.formatTime,formatTitle:e.formatTitle,onOpen:e.onOpenThread,onClose:()=>e.onSelect(null)})]})]})}$();function on(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ft(e){return typeof e=="string"?e:""}function D1(e){return!on(e)||!Array.isArray(e.threads)||!Array.isArray(e.projects)?null:{projects:e.projects.flatMap(t=>{if(!on(t))return[];let o=Ft(t.projectId);return o.length===0?[]:[{projectId:o,title:Ft(t.title),workspaceRoot:Ft(t.workspaceRoot),archived:t.archived===!0}]}),threads:e.threads.flatMap(t=>{let o=sg(t);return o===null?[]:[o]}),hiddenThreadIds:gx(e.hiddenThreadIds),hiddenThreads:Nj(e.hiddenThreads),showArchived:e.showArchived===!0}}function hx(e,t){if(!on(t))return e;if(t.patch!==!0)return D1(t)??e;if(e===null)return null;let o=new Set(gx(t.removedThreadIds)),n=t.hiddenThreadIds!==void 0?gx(t.hiddenThreadIds):e.hiddenThreadIds,r=new Set(n),a=t.showArchived!==void 0?t.showArchived===!0:e.showArchived,s=new Map(e.threads.map(d=>[d.threadId,d]));for(let d of o)s.delete(d);if(Array.isArray(t.threads))for(let d of t.threads){let c=sg(d);if(c!==null){if(o.has(c.threadId)||r.has(c.threadId)){s.delete(c.threadId);continue}if(!a&&c.archived){s.delete(c.threadId);continue}s.set(c.threadId,c)}}if(t.hiddenThreadIds!==void 0||t.showArchived!==void 0)for(let[d,c]of s)(r.has(d)||!a&&c.archived)&&s.delete(d);let i=D1({projects:t.projects??e.projects,threads:[],hiddenThreadIds:n,hiddenThreads:t.hiddenThreads??e.hiddenThreads,showArchived:a});return i===null?{...e,threads:[...s.values()]}:{...i,threads:[...s.values()]}}function _1(e){return on(e)?"present"in e?e.present===!0?sg(e.value):null:sg(e):null}function O1(e){return on(e)?{ok:e.ok===!0,threadId:Ft(e.threadId),walkedBack:e.walkedBack===!0,code:Ft(e.code)}:{ok:!1,threadId:"",walkedBack:!1,code:"empty"}}function sg(e){if(!on(e))return null;let t=Ft(e.threadId);if(t.length===0)return null;let o=on(e.forkedFrom)?e.forkedFrom:null,n=o===null?"":Ft(o.sourceThreadId),r=o===null?"":Ft(o.sourceMessageId);return{threadId:t,projectId:Ft(e.projectId),title:Ft(e.title),createdAt:Ft(e.createdAt),updatedAt:Ft(e.updatedAt),archived:e.archived===!0,running:e.running===!0,status:Mj(e.status,e.running===!0),turnCount:typeof e.turnCount=="number"&&Number.isInteger(e.turnCount)&&e.turnCount>0?e.turnCount:0,loaded:e.loaded===!0,forkedFrom:n.length>0&&r.length>0?{sourceThreadId:n,sourceMessageId:r}:null,inheritedMessageCount:typeof e.inheritedMessageCount=="number"?e.inheritedMessageCount:0,cutWalkedBack:e.cutWalkedBack===!0,turns:Array.isArray(e.turns)?e.turns.flatMap(B1):[],...Array.isArray(e.turnOutline)?{turnOutline:e.turnOutline.flatMap(Ej)}:{}}}function Ej(e){return!on(e)||typeof e.messageId!="string"||typeof e.ordinal!="number"?[]:[{messageId:e.messageId,ordinal:e.ordinal,...e.failed===!0?{failed:!0}:{},...e.waiting===!0?{waiting:!0}:{},...e.forkSource===!0?{forkSource:!0}:{}}]}function F1(e,t){return!on(e)||e.threadId!==t||!Array.isArray(e.turns)?[]:e.turns.flatMap(B1)}function Mj(e,t){return e==="running"||e==="waiting"||e==="failed"||e==="done"?e:t?"running":"done"}function B1(e){if(!on(e))return[];let t=Ft(e.messageId);return t.length===0?[]:[{messageId:t,question:Ft(e.question),questionTruncated:e.questionTruncated===!0,answer:Ft(e.answer),answerTruncated:e.answerTruncated===!0,error:typeof e.error=="string"?e.error:null,tools:Array.isArray(e.tools)?e.tools.flatMap(Aj):[],running:e.running===!0}]}function Aj(e){if(!on(e))return[];let t=Ft(e.callId);return t.length===0?[]:[{callId:t,title:Ft(e.title),status:Ft(e.status)}]}function Nj(e){return Array.isArray(e)?e.flatMap(t=>{if(!on(t))return[];let o=Ft(t.threadId);return o.length===0?[]:[{threadId:o,title:Ft(t.title)}]}):[]}function gx(e){return Array.isArray(e)?e.flatMap(t=>typeof t=="string"&&t.length>0?[t]:[]):[]}function ig(e){let[t,o]=q(()=>({data:e,board:hx(null,e)}));return t.data!==e&&o({data:e,board:hx(t.board,e)}),t.board}$();function H1(e){let{bridge:t,environmentId:o,threadId:n,onResult:r}=e,a=t.sessionProjections.useProjection("card",n,{environmentId:o});return H(()=>{let s=!0;return t.commands.invoke("focus",{threadId:n},{environmentId:o}).catch(()=>{s&&r({threadId:n,thread:null,notice:"projection.readFailed"})}),()=>{s=!1}},[t,o,n,r]),H(()=>{let s=_1(a);s!==null&&s.threadId!==n||r({threadId:n,thread:s,notice:a.isUnavailable?"projection.unavailable":a.error!==null?"projection.readFailed":null})},[a.present,a.value,a.isUnavailable,a.error,n,r]),null}$();function U1(e,t,o){let[n,r]=q(()=>new Map),a=E(new Set),s=E(!0);H(()=>(s.current=!0,()=>{s.current=!1}),[]);let i=R((c,u)=>{let m=u.filter(p=>!a.current.has(`${c}:${p}`)).slice(0,60);if(m.length!==0){for(let p of m)a.current.add(`${c}:${p}`);e.commands.invoke("turns",{threadId:c,messageIds:m},{environmentId:t}).then(p=>{if(!s.current)return;let f=F1(p,c);r(g=>{let h=new Map(g),y=new Map(h.get(c));for(let x of f)y.set(x.messageId,x);return h.set(c,y),h})},()=>{for(let p of m)a.current.delete(`${c}:${p}`)})}},[e,t]);return{board:W(()=>o===null?null:{...o,threads:o.threads.map(c=>{let u=n.get(c.threadId);if(u===void 0)return c;let m=new Map(u);for(let p of c.turns)m.set(p.messageId,p);return{...c,turns:[...m.values()]}})},[o,n]),load:i}}function z1(e){let{bridge:t,environmentId:o,projectId:n}=e,r={environmentId:o},a=t.commands.useSubscription("live",{projectId:n},r),s=ig(a.data),i=U1(t,o,s),d=t.i18n.usePluginTranslation(),c=t.useFormatTimestamp(),u=t.useThreadDisplayTitle?.()??Rd,[m,p]=q(null),[f,g]=q(null),h=f?.threadId===m?f:null;return v(oe,{children:[l(N1,{t:d,board:i.board,pending:a.isPending,selectedThreadId:m,fuller:h?.thread??null,panelNotice:h?.notice==null?null:d(h.notice),formatTime:c,formatTitle:u,onSelect:p,onOpenThread:y=>{t.openThread({environmentId:o,threadId:y})},onHide:y=>{t.commands.invoke("hide",{threadId:y},r)},onRestore:y=>{t.commands.invoke("restore",{threadId:y},r)},onShowArchived:y=>{t.commands.invoke("preferences",{patch:{showArchived:y}},r)},onLoad:y=>{for(let x=0;x<y.length;x+=60)t.commands.invoke("load",{threadIds:y.slice(x,x+60)},r)},onLoadTurns:i.load,onFork:(y,x)=>{t.commands.invoke("fork",{threadId:y,messageId:x},r).then(C=>{let b=O1(C);if(!b.ok){t.notify(d(Dj(b.code)),"warning");return}b.walkedBack&&t.notify(d("map.forkWalkedBack"),"info"),t.openThread({environmentId:o,threadId:b.threadId})},()=>t.notify(d("map.forkFailed"),"warning"))}}),m===null?null:l(H1,{bridge:t,environmentId:o,threadId:m,onResult:g},`${o}:${n}:${m}`)]})}function Dj(e){switch(e){case"missing-thread":return"map.forkMissing";case"no-user-message":return"map.forkNoUser";default:return"map.forkFailed"}}function K1(e){let t=e.bridge.i18n.usePluginTranslation(),o=e.bridge.useThreadDisplayTitle?.()??Rd,n=e.environmentId,r=n===null?{}:{environmentId:n},a=e.bridge.commands.useSubscription("live",{},r),s=ig(a.data);return v("section",{className:"session-map-chrome session-map-settings",children:[l("style",{children:ag}),l("h2",{children:t("settings.title")}),s===null?l(Qr,{title:a.isPending?t("map.loading"):t("map.noMachine")}):v(oe,{children:[v(Du,{className:"session-map-check",children:[l(_u,{checked:s.showArchived,"aria-label":t("settings.archived"),onCheckedChange:i=>{e.bridge.commands.invoke("preferences",{patch:{showArchived:i}},r)}}),l("span",{children:t("settings.archived")})]}),l("h3",{children:t("settings.hidden")}),s.hiddenThreads.length===0?l(Qr,{title:t("settings.noneHidden")}):null,s.hiddenThreads.map(i=>v("div",{className:"session-map-hidden",children:[l("span",{children:o(i.title)||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.bridge.commands.invoke("restore",{threadId:i.threadId},r)},children:t("settings.restore")})]},i.threadId))]})]})}$();function q1(e){let{t}=z(),{pending:o}=e,[n,r]=q(null),{api:a}=e,s=R(p=>{r(p),a.notify.error(p)},[a]),i=R(async(...p)=>{r(null);try{await o.respondToApproval(...p)}catch(f){s(f instanceof Error?f.message:t("approval.respondFailed"))}},[o,t,s]),d=R((p,f)=>(r(null),o.respondToDecision(p,f).then(g=>{g!==null&&s(g)})),[o,s]),c=R(()=>{r(null),o.advanceUserInput().then(p=>{p!==null&&s(p)})},[o,s]),u=o.activePendingProgress,m=u?.activeQuestion??null;return l(rl,{value:e.api,children:v("div",{className:"flex min-w-0 flex-col","data-pending-requests":e.threadId,children:[o.pendingApprovals.map(p=>l(tu,{approval:p,pendingCount:o.pendingApprovals.length,className:"px-3 py-2 sm:px-4",actions:l(Zf,{requestId:p.requestId,isResponding:o.respondingRequestIds.includes(p.requestId),options:p.options,declineReasonRelay:p.declineReasonRelay,shortcuts:!1,onRespondToApproval:i})},p.requestId)),o.pendingDecisions.map(p=>l(ou,{decision:p,environmentId:e.environmentId,onRespond:d,shortcuts:!1},p.requestId??p.title.text)),l(tg,{pendingUserInputs:o.pendingUserInputs,respondingRequestIds:o.respondingRequestIds,answers:o.activePendingDraftAnswers,questionIndex:o.activePendingQuestionIndex,shortcuts:!1,onToggleOption:o.selectUserInputOption,onGoToQuestion:p=>o.goToUserInputQuestion(p)}),u===null||m===null?null:v("div",{className:"flex min-w-0 flex-col gap-2 px-3 pb-2 sm:px-4","data-pending-answer-controls":!0,children:[m.allowFreeform===!1?null:l(Vr,{type:"text",size:"sm","aria-label":t("composer.writeCustomAnswer"),placeholder:t("composer.writeCustomAnswer"),value:u.customAnswer,disabled:o.activePendingIsResponding,onChange:p=>{let f=p.target.value;o.changeUserInputCustomAnswer(m.id,f,f.length,f.length,!1)}}),l("div",{className:"flex min-w-0 items-center justify-end gap-2",children:l(K,{size:"xs",disabled:o.activePendingIsResponding||(u.isLastQuestion?o.activePendingResolvedAnswers===null:!u.canAdvance),onClick:c,children:Qc(t,{compact:!1,isLastQuestion:u.isLastQuestion,isResponding:o.activePendingIsResponding,questionIndex:u.questionIndex})})})]}),n===null?null:l("p",{role:"alert",className:"px-3 pb-2 text-ui-xs text-destructive-foreground sm:px-4",children:n})]})})}$();var _j=[],Oj=[],Fj="prompt-font-preview",W1="max-h-40 min-h-12";function G1(){}function Bj(e){let t=0;return Dr(e).map(o=>{let n=t;return t+=o.type==="text"?o.text.length:o.type==="mention"?o.source.length:o.type==="skill"?o.name.length+1:1,{key:n,segment:o}})}function Hj(e){return l("div",{className:kC,children:l("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:V(LC,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:l("p",{children:Bj(e.prompt).map(({key:t,segment:o})=>o.type==="mention"?l("span",{className:Md,children:l(Af,{path:o.path,theme:e.theme})},t):o.type==="skill"?l("span",{className:Md,children:l(Nf,{label:tn({name:o.name})})},t):o.type==="text"?l("span",{children:o.text},t):null)})})})}function j1(){let{t:e}=z(),t=e("composer.idlePlaceholder"),o=it().theme.useResolvedTheme()==="dark"?"dark":"light",n=e("composer.fontPreviewSample"),r=E(null),[a,s]=q(null),i=a?.prompt??n,d=a?.cursor??n.length,[c,u]=q(!1),m=R((f,g)=>{s({prompt:f,cursor:g})},[]),p=R(()=>u(!0),[]);return H(()=>{c&&r.current?.focusAtEnd()},[c]),l("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:c?l(cl,{documentKey:Fj,editorRef:r,value:i,cursor:d,terminalContexts:_j,skills:Oj,disabled:!1,placeholder:t,className:W1,onRemoveTerminalContext:G1,onChange:m,onPaste:G1}):l(Hj,{className:W1,onActivate:p,placeholder:t,prompt:i,theme:o})})}function Uj(e){return`__ycodium${e.split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join("")}Scope`}function $j(e){let t=globalThis,o=Uj(e),n=(t[o]??0)+1;return t[o]=n,`ycodium-${e}-ui-${n}`}function V1(e,t){let o=$j(t),n=e.replaceAll(`.ycodium-${t}-ui`,`.${o}`),r=0,a=null;return{scopeClass:o,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=n,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function zj(e){let t=V1(Px,"conversation");return{views:{[Tu]:Kj(t,e),[xg]:qj(t,e),[wg]:Wj(t,e)},viewCapabilities:{[Tu]:[bg,Dx]},slots:[{name:"project.workbench.tab",needsWidePanel:!0,titleKey:"map.title",icon:"./thread-map.svg",component(o){return l(Bs,{value:e,children:l(z1,{bridge:e,...o},`${o.environmentId}:${o.projectId}`)})}},{name:"conversation.input.agent",order:0,component:VN},{name:"conversation.input.model",order:0,component:vD},{name:"conversation.input.plan",order:0,component:wD},{name:"conversation.input.permission",order:0,component:bD},{name:"settings.section",order:0,component(o){return l(Bs,{value:e,children:l(K1,{bridge:e,environmentId:o.environmentId??null})})}}]}}function Kj(e,t){return function(n){let a=n[Iu]??t,s={...n};return delete s[Iu],v(Bs,{value:a,children:[l(yx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l(a1,{...s,scopeClass:e.scopeClass})})]})}}function qj(e,t){return function(n){return v(Bs,{value:t,children:[l(yx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l(rl,{value:n.api,children:l("div",{className:e.scopeClass,children:l(j1,{})})})})]})}}function Wj(e,t){return function(n){return v(Bs,{value:t,children:[l(yx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l("div",{className:e.scopeClass,children:l(q1,{...n})})})]})}}function yx({retain:e}){return Rl(()=>e(),[e]),null}export{zj as default};
|