nextclaw 0.13.21 → 0.13.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/index.js +206 -192
  3. package/package.json +9 -9
  4. package/templates/USAGE.md +19 -19
  5. package/ui-dist/assets/{ChannelsList-CIMYaIji.js → ChannelsList-a063_8pv.js} +1 -1
  6. package/ui-dist/assets/{ChatPage-B5UpeEIp.js → ChatPage-CMthudUt.js} +1 -1
  7. package/ui-dist/assets/{DocBrowser-BJ610SPa.js → DocBrowser-BOvBC_5q.js} +1 -1
  8. package/ui-dist/assets/{LogoBadge-BKq1GKWP.js → LogoBadge-BUvLZbji.js} +1 -1
  9. package/ui-dist/assets/{MarketplacePage-Bs3sLsgx.js → MarketplacePage-CcbfvtGX.js} +1 -1
  10. package/ui-dist/assets/{McpMarketplacePage-BWTguHCs.js → McpMarketplacePage-D56yvyWI.js} +1 -1
  11. package/ui-dist/assets/{ModelConfig-B-oTP-Bc.js → ModelConfig-D5AuTffd.js} +1 -1
  12. package/ui-dist/assets/{ProvidersList-r7bD0-R0.js → ProvidersList-Bd4n7muZ.js} +1 -1
  13. package/ui-dist/assets/{RemoteAccessPage-D7On6waK.js → RemoteAccessPage-Be8jduPM.js} +1 -1
  14. package/ui-dist/assets/{RuntimeConfig-C11xVxH9.js → RuntimeConfig-D8DYogZ1.js} +1 -1
  15. package/ui-dist/assets/{SearchConfig-BVZdCxiM.js → SearchConfig-BtiGCmXR.js} +1 -1
  16. package/ui-dist/assets/{SecretsConfig-DuEDdC3X.js → SecretsConfig-fwAjbwlq.js} +1 -1
  17. package/ui-dist/assets/{SessionsConfig-Y-Blf_-K.js → SessionsConfig-Y7_TDSk2.js} +1 -1
  18. package/ui-dist/assets/{chat-message-B6VCCEXF.js → chat-message-Cwq8nW0e.js} +1 -1
  19. package/ui-dist/assets/index-C6dwNe7e.js +8 -0
  20. package/ui-dist/assets/{label-DzwitL78.js → label-C0dJBNgU.js} +1 -1
  21. package/ui-dist/assets/{page-layout-DEq5N_8L.js → page-layout-4_789zOC.js} +1 -1
  22. package/ui-dist/assets/{popover-CY54V8F6.js → popover-CWmq2f6H.js} +1 -1
  23. package/ui-dist/assets/{security-config-CgbYP57d.js → security-config-CZeVwEwq.js} +1 -1
  24. package/ui-dist/assets/{skeleton-zjQZMWu9.js → skeleton-kjkadEki.js} +1 -1
  25. package/ui-dist/assets/{status-dot-CU_P0tvO.js → status-dot-C7cVa53V.js} +1 -1
  26. package/ui-dist/assets/{switch-PvjTvlcs.js → switch-C6zdGbY0.js} +1 -1
  27. package/ui-dist/assets/{tabs-custom-Bke5J9ny.js → tabs-custom-BQj0Z-ZC.js} +1 -1
  28. package/ui-dist/assets/{useConfirmDialog-8tzzp_oW.js → useConfirmDialog-yX-ZMNf9.js} +1 -1
  29. package/ui-dist/index.html +1 -1
  30. package/ui-dist/assets/index-DvA7S11O.js +0 -8
@@ -1,4 +1,4 @@
1
- var Ba=Object.defineProperty;var $a=(e,t,n)=>t in e?Ba(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var D=(e,t,n)=>$a(e,typeof t!="symbol"?t+"":t,n);import{r as k,j as h,ae as Ua,t as Ka,c as Va,y as Ha,z as qa,h as fi,I as Wa,i as rr,n as Ga,o as pi,V as Qa,q as gi,s as Xa,v as sr,w as Ya,k as mi,l as Ja,m as yi,a as Za,af as el,B as ir,G as or,ag as tl,ah as nl,ai as rl,F as sl,aj as il,ak as ol,Z as xi,al as bi,am as Si,an as al,ao as ll,ap as ul,aq as cl,ar as dl,as as hl,d as Xt,at as fl,A as ar,_ as Or,au as pl,a0 as gl,a3 as ml,a1 as yl,a2 as xl,av as Ln,aw as Nn,ax as Pn,ay as Mt,M as bl,az as ki,aA as Sl,aB as kl,aC as vl,a4 as lr,aD as vi,aE as wi,u as wl}from"./vendor-CmQZsDAE.js";import{u as ur}from"./useConfirmDialog-8tzzp_oW.js";import{i as Cl,t as R,u as Ci,a as Ti,j as Tl,k as Il,l as Ml,m as Rl,c as ke,n as El,o as Al,p as cr,q as Ll,T as Fr,L as zr,r as Nl,B as Ze,I as Ii,s as Yt,S as jn,e as Dn,g as _n,h as St,v as Pl,w as jl,x as Dl,y as _l,f as Ol,C as Fl,z as zl,A as Br,E as Bl,F as $l,G as Ul,H as Kl,J as Vl,K as Hl,M as ql,N as Wl,O as Gl,P as Ql,Q as Xl}from"./index-DvA7S11O.js";import{b as Yl,a as Jl,S as Zl,s as eu,c as $r,e as Ur}from"./chat-message-B6VCCEXF.js";import{u as Mi,T as tu,a as nu,b as ru,c as su,P as iu,R as ou,d as au,e as lu,C as Ri,M as uu}from"./MarketplacePage-Bs3sLsgx.js";import{b as Ei,c as Ai,r as Li}from"./provider-models-BOeNnjk9.js";import{R as cu,A as du,P as hu,C as Ni,T as fu,a as pu,b as gu,c as mu}from"./popover-CY54V8F6.js";import{P as yu,a as xu}from"./page-layout-DEq5N_8L.js";import"./tabs-custom-Bke5J9ny.js";import"./skeleton-zjQZMWu9.js";import"./marketplace-localization-Dk31LJJJ.js";const bu="ncp";function Kr(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="legacy"||t==="ncp"?t:null}function Su(e){const t=Kr(new URLSearchParams(e).get("chatChain"));return t||(Kr(void 0)??bu)}function ku(e){var v;const{view:t,selectedSessionKey:n,activeBackendRunId:r,isLocallyRunning:s,resumeRun:i}=e,[o,a]=k.useState(null),l=k.useRef(!1),u=k.useRef(new Map),c=k.useRef(new Map),d=k.useRef(new Map),p=k.useRef(r),f=k.useRef(new Set);k.useEffect(()=>{n&&f.current.add(n)},[n]),k.useEffect(()=>{n&&s&&f.current.delete(n)},[s,n]);const m=Cl(t==="chat"?{states:["queued","running"],limit:200,syncActiveStates:!0,isLocallyRunning:s}:void 0),y=k.useMemo(()=>{var w;return Yl(((w=m.data)==null?void 0:w.runs)??[])},[(v=m.data)==null?void 0:v.runs]),x=k.useMemo(()=>{const w=Jl(y);if(o){const I=y.get(o.sessionKey)??null;I&&(!o.runId||I.runId===o.runId)&&w.delete(o.sessionKey)}return w},[y,o]),g=k.useMemo(()=>{if(!n)return null;const w=y.get(n)??null;return(!w||!o||o.sessionKey!==n?!1:!o.runId||w.runId===o.runId)?null:w},[y,n,o]);return k.useEffect(()=>{r&&(p.current=r)},[r]),k.useEffect(()=>{if(t!=="chat"||!n||!g||!f.current.has(n)||s||r===g.runId||u.current.get(n)===g.runId)return;const I=c.current.get(n);if(I&&I===g.runId)return;const L=d.current.get(n);if(typeof L=="number"){const T=Date.parse(g.requestedAt??"");if(Number.isFinite(T)){if(T<=L+2e3)return}else if(Date.now()-L<=8e3)return}u.current.set(n,g.runId),f.current.delete(n),i(g)},[r,g,s,i,n,t]),k.useEffect(()=>{if(!n){u.current.clear(),c.current.clear(),d.current.clear(),f.current.clear();return}y.has(n)||(u.current.delete(n),c.current.delete(n),d.current.delete(n))},[y,n]),k.useEffect(()=>{var I,L,T;const w=l.current;if(l.current=s,!s&&w&&n){const _=((I=p.current)==null?void 0:I.trim())||((T=(L=y.get(n))==null?void 0:L.runId)==null?void 0:T.trim());_&&c.current.set(n,_),d.current.set(n,Date.now()),a({sessionKey:n,..._?{runId:_}:{}}),m.refetch()}},[y,s,n,m]),k.useEffect(()=>{if(!o)return;const w=y.get(o.sessionKey)??null;if(!w){a(null);return}o.runId&&w.runId!==o.runId&&a(null)},[y,o]),k.useEffect(()=>{s&&(o==null?void 0:o.sessionKey)===n&&a(null)},[s,n,o]),{sessionRunStatusByKey:x}}const Ee="native";function Fe(e){return typeof e!="string"?Ee:e.trim().toLowerCase()||Ee}function lt(e,t){return e==="native"?R("chatSessionTypeNative"):e.trim().split(/[-_]+/g).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")||e}function vu(e){var n;const t=new Map;for(const r of e){const s=Fe(r.value);t.set(s,{value:s,label:((n=r.label)==null?void 0:n.trim())||lt(s),ready:r.ready??!0,reason:r.reason??null,reasonMessage:r.reasonMessage??null,supportedModels:r.supportedModels,recommendedModel:r.recommendedModel??null,cta:r.cta??null})}return t.has(Ee)||t.set(Ee,{value:Ee,label:lt(Ee),ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}),Array.from(t.values()).sort((r,s)=>r.value===Ee?-1:s.value===Ee?1:r.value.localeCompare(s.value))}function Pi(e){const{selectedSession:t,selectedSessionKey:n,pendingSessionType:r,setPendingSessionType:s,sessionTypesData:i}=e,o=k.useMemo(()=>vu((i==null?void 0:i.options)??[]),[i==null?void 0:i.options]),a=k.useMemo(()=>{const x=[...o],g=Fe(t==null?void 0:t.sessionType);return x.some(v=>v.value===g)||x.push({value:g,label:lt(g),ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}),x.sort((v,w)=>v.value===Ee?-1:w.value===Ee?1:v.value.localeCompare(w.value))},[o,t==null?void 0:t.sessionType]),l=k.useMemo(()=>Fe((i==null?void 0:i.defaultType)??Ee),[i==null?void 0:i.defaultType]),u=k.useRef(null),c=k.useMemo(()=>Fe((t==null?void 0:t.sessionType)??r??l),[l,r,t==null?void 0:t.sessionType]),d=k.useMemo(()=>a.find(x=>x.value===c)??null,[c,a]);k.useEffect(()=>{if(n)return;const x=typeof r=="string"?r.trim():"",g=Fe(r);(x.length===0||u.current===g||u.current===null&&g===Ee)&&(u.current=l,g!==l&&s(l))},[l,r,n,s]);const p=!n||!!(t!=null&&t.sessionTypeMutable),f=k.useMemo(()=>new Set(o.map(x=>x.value)),[o]),m=k.useMemo(()=>t&&!f.has(Fe(t.sessionType))?!0:(d==null?void 0:d.ready)===!1,[f,t,d==null?void 0:d.ready]),y=k.useMemo(()=>{var x;return t&&!f.has(Fe(t.sessionType))?`${lt(c)} ${R("chatSessionTypeUnavailableSuffix")}`:(d==null?void 0:d.ready)===!1?((x=d.reasonMessage)==null?void 0:x.trim())||`${d.label} setup required`:null},[f,t,c,d]);return{sessionTypeOptions:a,selectedSessionTypeOption:d,defaultSessionType:l,selectedSessionType:c,canEditSessionType:p,sessionTypeUnavailable:m,sessionTypeUnavailableMessage:y}}function Vr(e){return(e==null?void 0:e.trim().toLowerCase())||"native"}function wu(e,t){if(typeof t!="string")return!1;const n=t.trim();return n?e.some(r=>r.value===n):!1}function Cu(e,t){return typeof t=="string"&&e.includes(t)}function Tu(e){return e.length===0?null:e.includes("off")?"off":e[0]??null}function ji(e){const{currentValue:t,selectedSessionPreferredValue:n,fallbackPreferredValue:r,defaultValue:s,isValueSupported:i,firstAvailableValue:o,preferSessionPreferredValue:a=!1,preserveCurrentValueOnSessionChange:l=!1}=e;return i(t)&&(!a||l)?t:i(n)?n:i(r)?r:i(s)?s:o}function Iu(e){var n;const{modelOptions:t}=e;return t.length===0?"":ji({currentValue:e.currentSelectedModel,selectedSessionPreferredValue:e.selectedSessionPreferredModel,fallbackPreferredValue:e.fallbackPreferredModel,defaultValue:e.defaultModel,isValueSupported:r=>wu(t,r),firstAvailableValue:((n=t[0])==null?void 0:n.value)??"",preferSessionPreferredValue:e.preferSessionPreferredModel,preserveCurrentValueOnSessionChange:e.preserveCurrentSelectedModelOnSessionChange})}function Mu(e){const{supportedThinkingLevels:t}=e;return t.length===0?null:ji({currentValue:e.currentSelectedThinkingLevel,selectedSessionPreferredValue:e.selectedSessionPreferredThinking,fallbackPreferredValue:e.fallbackPreferredThinking,defaultValue:e.defaultThinkingLevel,isValueSupported:n=>Cu(t,n),firstAvailableValue:Tu(t)??"off",preferSessionPreferredValue:e.preferSessionPreferredThinking,preserveCurrentValueOnSessionChange:e.preserveCurrentSelectedThinkingOnSessionChange})}function Di(e){const t=Vr(e.sessionType);let n,r=Number.NEGATIVE_INFINITY;for(const s of e.sessions){if(s.key===e.selectedSessionKey||Vr(s.sessionType)!==t)continue;const i=e.readPreference(s);if(i==null)continue;const o=Date.parse(s.updatedAt),a=Number.isFinite(o)?o:Number.NEGATIVE_INFINITY;(n===void 0||a>r)&&(n=i,r=a)}return n}function _i(e){return Di({sessions:e.sessions,selectedSessionKey:e.selectedSessionKey,sessionType:e.sessionType,readPreference:t=>{var r;return((r=t.preferredModel)==null?void 0:r.trim())||void 0}})}function Oi(e){return Di({sessions:e.sessions,selectedSessionKey:e.selectedSessionKey,sessionType:e.sessionType,readPreference:t=>t.preferredThinking??void 0})}function Fi(e){const{isPreferenceAvailable:t,emptyValue:n,selectedSessionKey:r,selectedSessionExists:s=!1,setValue:i,resolveValue:o}=e,a=k.useRef(void 0),l=k.useRef(o);k.useEffect(()=>{l.current=o},[o]),k.useEffect(()=>{const u=a.current!==r;if(!t){i(n),a.current=r;return}i(c=>l.current({currentValue:c,sessionChanged:u,preserveCurrentValueOnSessionChange:u&&!!r&&!s})),a.current=r},[n,t,s,r,i])}function zi(e){const{modelOptions:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredModel:s,fallbackPreferredModel:i,defaultModel:o,setSelectedModel:a}=e;Fi({isPreferenceAvailable:t.length>0,emptyValue:"",selectedSessionKey:n,selectedSessionExists:r,setValue:a,resolveValue:({currentValue:l,sessionChanged:u,preserveCurrentValueOnSessionChange:c})=>Iu({currentSelectedModel:l,modelOptions:t,selectedSessionPreferredModel:s,fallbackPreferredModel:i,defaultModel:o,preferSessionPreferredModel:u,preserveCurrentSelectedModelOnSessionChange:c})})}function Bi(e){const{supportedThinkingLevels:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredThinking:s,fallbackPreferredThinking:i,defaultThinkingLevel:o,setSelectedThinkingLevel:a}=e;Fi({isPreferenceAvailable:t.length>0,emptyValue:null,selectedSessionKey:n,selectedSessionExists:r,setValue:a,resolveValue:({currentValue:l,sessionChanged:u,preserveCurrentValueOnSessionChange:c})=>Mu({currentSelectedThinkingLevel:l,supportedThinkingLevels:t,selectedSessionPreferredThinking:s,fallbackPreferredThinking:i,defaultThinkingLevel:o,preferSessionPreferredThinking:u,preserveCurrentSelectedThinkingOnSessionChange:c})})}function Ru(e){var I,L,T,_,F,z;const t=Ci(),n=Ti(),r=Tl({q:e.query.trim()||void 0,limit:120,activeMinutes:0}),s=Mi("skill"),i=Il({sessionKey:e.selectedSessionKey,agentId:e.selectedAgentId}),o=Ml(e.selectedSessionKey,300),a=Rl(),l=(t.isFetched||t.isSuccess)&&(n.isFetched||n.isSuccess),u=k.useMemo(()=>{const C=Ei({meta:n.data,config:t.data,onlyConfigured:!0}),j=new Set,N=[];for(const $ of C)for(const O of $.models){const E=Ai($.prefix,O);!E||j.has(E)||(j.add(E),N.push({value:E,modelLabel:O,providerLabel:$.displayName,thinkingCapability:Li($.modelThinking,O,$.aliases)}))}return N.sort(($,O)=>{const E=$.providerLabel.localeCompare(O.providerLabel);return E!==0?E:$.modelLabel.localeCompare(O.modelLabel)})},[n.data,t.data]),c=k.useMemo(()=>{var C;return((C=r.data)==null?void 0:C.sessions)??[]},[(I=r.data)==null?void 0:I.sessions]),d=k.useMemo(()=>{var C;return((C=s.data)==null?void 0:C.records)??[]},[(L=s.data)==null?void 0:L.records]),p=k.useMemo(()=>c.find(C=>C.key===e.selectedSessionKey)??null,[e.selectedSessionKey,c]),f=Pi({selectedSession:p,selectedSessionKey:e.selectedSessionKey,pendingSessionType:e.pendingSessionType,setPendingSessionType:e.setPendingSessionType,sessionTypesData:a.data}),m=k.useMemo(()=>_i({sessions:c,selectedSessionKey:e.selectedSessionKey,sessionType:f.selectedSessionType}),[e.selectedSessionKey,f.selectedSessionType,c]),y=k.useMemo(()=>u.find(C=>C.value===e.currentSelectedModel),[u,e.currentSelectedModel]),x=k.useMemo(()=>{var C;return((C=y==null?void 0:y.thinkingCapability)==null?void 0:C.supported)??[]},[(T=y==null?void 0:y.thinkingCapability)==null?void 0:T.supported]),g=k.useMemo(()=>{var C;return((C=y==null?void 0:y.thinkingCapability)==null?void 0:C.default)??null},[(_=y==null?void 0:y.thinkingCapability)==null?void 0:_.default]),v=k.useMemo(()=>Oi({sessions:c,selectedSessionKey:e.selectedSessionKey,sessionType:f.selectedSessionType}),[e.selectedSessionKey,f.selectedSessionType,c]);zi({modelOptions:u,selectedSessionKey:e.selectedSessionKey,selectedSessionExists:!!p,selectedSessionPreferredModel:p==null?void 0:p.preferredModel,fallbackPreferredModel:m,defaultModel:(F=t.data)==null?void 0:F.agents.defaults.model,setSelectedModel:e.setSelectedModel}),Bi({supportedThinkingLevels:x,selectedSessionKey:e.selectedSessionKey,selectedSessionExists:!!p,selectedSessionPreferredThinking:(p==null?void 0:p.preferredThinking)??null,fallbackPreferredThinking:v??null,defaultThinkingLevel:g,setSelectedThinkingLevel:e.setSelectedThinkingLevel});const w=k.useMemo(()=>{var C;return((C=o.data)==null?void 0:C.messages)??[]},[(z=o.data)==null?void 0:z.messages]);return{configQuery:t,configMetaQuery:n,sessionsQuery:r,installedSkillsQuery:s,chatCapabilitiesQuery:i,historyQuery:o,sessionTypesQuery:a,isProviderStateResolved:l,modelOptions:u,sessions:c,skillRecords:d,selectedSession:p,historyMessages:w,...f}}function $i(e){if(e.label&&e.label.trim())return e.label.trim();const t=e.key.split(":");return t[t.length-1]||e.key}const Eu={connected:{dotClass:"bg-emerald-500"},disconnected:{dotClass:"h-2.5 w-2.5 rounded-full border border-gray-400 bg-transparent"},connecting:{dotClass:"text-amber-600"}};function Au({status:e,className:t}){const n=Eu[e],r=e==="connected"?R("connected"):e==="disconnected"?R("disconnected"):R("connecting");return h.jsx(tu,{delayDuration:250,children:h.jsxs(nu,{children:[h.jsx(ru,{asChild:!0,children:h.jsx("span",{role:"status","aria-label":r,className:ke("inline-flex h-5 w-5 items-center justify-center",t),children:e==="connecting"?h.jsx(Ua,{className:ke("h-3 w-3 animate-spin",n.dotClass)}):h.jsx("span",{className:ke(e==="connected"?"h-2 w-2 rounded-full":"",n.dotClass)})})}),h.jsx(su,{side:"bottom",className:"text-xs",children:r})]})})}const Ui=k.createContext(null);function Ki({presenter:e,children:t}){return h.jsx(Ui.Provider,{value:e,children:t})}function dr(){const e=k.useContext(Ui);if(!e)throw new Error("usePresenter must be used inside ChatPresenterProvider");return e}const Lu=e=>`[data-item-index="${e}"]`;function Vi(e){const t=e.getItemSelector??Lu;k.useEffect(()=>{if(!e.isEnabled||e.itemCount===0)return;const n=e.containerRef.current;if(!n)return;const r=n.querySelector(t(e.activeIndex));r==null||r.scrollIntoView({block:"nearest",inline:"nearest"})},[t,e.activeIndex,e.containerRef,e.isEnabled,e.itemCount])}function Nu(){const e=k.useRef(null),[t,n]=k.useState(null);return k.useEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const s=()=>{n(r.getBoundingClientRect().width)};s();const i=new ResizeObserver(()=>s());return i.observe(r),()=>i.disconnect()},[]),{elementRef:e,width:t}}function ue(...e){return Ka(Va(e))}const Hi=k.forwardRef(({className:e,type:t,...n},r)=>h.jsx("input",{type:t,className:ue("flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Hi.displayName="ChatInput";const Pu=cu,ju=fu,Du=du,qi=k.forwardRef(({className:e,sideOffset:t=8,align:n="start",...r},s)=>h.jsx(hu,{children:h.jsx(Ni,{ref:s,sideOffset:t,align:n,className:ue("z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));qi.displayName=Ni.displayName;const _u=Ha,Ou=qa,Wi=k.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(fi,{ref:r,className:ue("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(Wa,{asChild:!0,children:h.jsx(rr,{className:"h-4 w-4 opacity-50"})})]}));Wi.displayName=fi.displayName;const Gi=k.forwardRef(({className:e,...t},n)=>h.jsx(mi,{ref:n,className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(Ja,{className:"h-4 w-4"})}));Gi.displayName=mi.displayName;const Qi=k.forwardRef(({className:e,...t},n)=>h.jsx(yi,{ref:n,className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(rr,{className:"h-4 w-4"})}));Qi.displayName=yi.displayName;const Xi=k.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>h.jsx(Ga,{children:h.jsxs(pi,{ref:s,className:ue("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(Gi,{}),h.jsx(Qa,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(Qi,{})]})}));Xi.displayName=pi.displayName;const Yi=k.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(gi,{ref:r,className:ue("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100",e),...n,children:[h.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Xa,{children:h.jsx(sr,{className:"h-4 w-4"})})}),h.jsx(Ya,{children:t})]}));Yi.displayName=gi.displayName;const Fu=iu,zu=ou,Bu=au,Ji=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(lu,{children:h.jsx(Ri,{ref:r,sideOffset:t,className:ue("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ji.displayName=Ri.displayName;const Rt={Popover:Pu,PopoverAnchor:Du,PopoverContent:qi,PopoverTrigger:ju,Input:Hi,Select:_u,SelectContent:Xi,SelectItem:Yi,SelectTrigger:Wi,SelectValue:Ou,Tooltip:zu,TooltipContent:Ji,TooltipProvider:Fu,TooltipTrigger:Bu},$u=680,Uu=.82,Ku=560;function Vu(e){const{Popover:t,PopoverAnchor:n,PopoverContent:r}=Rt,{elementRef:s,width:i}=Nu(),o=k.useRef(null),{isOpen:a,isLoading:l,items:u,activeIndex:c,activeItem:d,texts:p,onSelectItem:f,onOpenChange:m,onSetActiveIndex:y}=e,x=k.useMemo(()=>{if(i)return Math.min(i>Ku?i*Uu:i,$u)},[i]);return Vi({containerRef:o,activeIndex:c,itemCount:u.length,isEnabled:a&&!l,getItemSelector:g=>`[data-slash-index="${g}"]`}),h.jsxs(t,{open:a,onOpenChange:m,children:[h.jsx(n,{asChild:!0,children:h.jsx("div",{ref:s,className:"pointer-events-none absolute bottom-full left-3 right-3 h-0"})}),h.jsx(r,{side:"top",align:"start",sideOffset:10,className:"z-[70] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md",onOpenAutoFocus:g=>g.preventDefault(),style:x?{width:`${x}px`}:void 0,children:h.jsxs("div",{className:"grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]",children:[h.jsx("div",{ref:o,role:"listbox","aria-label":p.slashSectionLabel,className:"custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5",children:l?h.jsx("div",{className:"p-2 text-xs text-gray-500",children:p.slashLoadingLabel}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:p.slashSectionLabel}),u.length===0?h.jsx("div",{className:"px-2 text-xs text-gray-400",children:p.slashEmptyLabel}):h.jsx("div",{className:"space-y-1",children:u.map((g,v)=>{const w=v===c;return h.jsxs("button",{type:"button",role:"option","aria-selected":w,"data-slash-index":v,onMouseEnter:()=>y(v),onClick:()=>f(g),className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition ${w?"bg-gray-100 text-gray-900":"text-gray-700 hover:bg-gray-50"}`,children:[h.jsx("span",{className:"truncate text-xs font-semibold",children:g.title}),h.jsx("span",{className:"truncate text-xs text-gray-500",children:g.subtitle})]},g.key)})})]})}),h.jsx("div",{className:"max-w-[320px] p-3.5",children:d?h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary",children:d.subtitle}),h.jsx("span",{className:"text-sm font-semibold text-gray-900",children:d.title})]}),h.jsx("p",{className:"text-xs leading-5 text-gray-600",children:d.description}),h.jsx("div",{className:"space-y-1",children:d.detailLines.map(g=>h.jsx("div",{className:"rounded-md bg-gray-50 px-2 py-1 text-[11px] text-gray-600",children:g},g))}),h.jsx("div",{className:"pt-1 text-[11px] text-gray-500",children:p.slashSkillHintLabel})]}):h.jsx("div",{className:"text-xs text-gray-500",children:p.slashHintLabel})})]})})]})}const Hu=Za("inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600",secondary:"bg-gray-100 text-gray-700 hover:bg-gray-200/80",ghost:"hover:bg-gray-100/80 hover:text-gray-800",link:"text-primary underline-offset-4 hover:underline",primary:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",subtle:"bg-gray-100 text-gray-600 hover:bg-gray-200/80","primary-outline":"border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",lg:"h-11 px-5 text-[14px]",xl:"h-12 px-6 text-[15px]",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),$t=k.forwardRef(({className:e,variant:t,size:n,...r},s)=>h.jsx("button",{className:ue(Hu({variant:t,size:n,className:e})),ref:s,...r}));$t.displayName="ChatButton";function Hr(){return h.jsx("span",{"aria-hidden":"true","data-testid":"chat-stop-icon",className:"block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]"})}function qu(e){var i;const{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:s}=Rt;return h.jsxs("div",{className:"flex flex-col items-end gap-1",children:[(i=e.sendError)!=null&&i.trim()?h.jsx("div",{className:"max-w-[420px] text-right text-[11px] text-red-600",children:e.sendError}):null,h.jsx("div",{className:"flex items-center gap-2",children:e.isSending?e.canStopGeneration?h.jsx($t,{size:"icon",variant:"outline",className:"h-8 w-8 rounded-full","aria-label":e.stopButtonLabel,onClick:()=>void e.onStop(),disabled:e.stopDisabled,children:h.jsx(Hr,{})}):h.jsx(r,{children:h.jsxs(t,{children:[h.jsx(s,{asChild:!0,children:h.jsx("span",{children:h.jsx($t,{size:"icon",variant:"outline",className:"h-8 w-8 rounded-full","aria-label":e.stopButtonLabel,disabled:!0,children:h.jsx(Hr,{})})})}),h.jsx(n,{side:"top",children:h.jsx("p",{className:"text-xs",children:e.stopHint})})]})}):h.jsx($t,{size:"icon",className:"h-8 w-8 rounded-full","aria-label":e.sendButtonLabel,onClick:()=>void e.onSend(),disabled:e.sendDisabled,children:h.jsx(el,{className:"h-5 w-5"})})})]})}function Wu(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>[r.label,r.key,r.description].filter(i=>typeof i=="string"&&i.trim().length>0).join(" ").toLowerCase().includes(n)):e}function Gu(e){const{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:s}=Rt,{picker:i}=e,o=k.useRef(null),a=k.useId(),[l,u]=k.useState(""),[c,d]=k.useState(0),p=k.useMemo(()=>new Set(i.selectedKeys),[i.selectedKeys]),f=i.selectedKeys.length,m=k.useMemo(()=>Wu(i.options,l),[i.options,l]);k.useEffect(()=>{d(0)},[l]),k.useEffect(()=>{d(g=>m.length===0?0:Math.min(g,m.length-1))},[m.length]),Vi({containerRef:o,activeIndex:c,itemCount:m.length,isEnabled:m.length>0,getItemSelector:g=>`[data-skill-index="${g}"]`});const y=g=>{if(p.has(g)){i.onSelectedKeysChange(i.selectedKeys.filter(v=>v!==g));return}i.onSelectedKeysChange([...i.selectedKeys,g])},x=g=>{if(m.length!==0){if(g.key==="ArrowDown"){g.preventDefault(),d(v=>Math.min(v+1,m.length-1));return}if(g.key==="ArrowUp"){g.preventDefault(),d(v=>Math.max(v-1,0));return}if(g.key==="Enter"){g.preventDefault();const v=m[c];v&&y(v.key)}}};return h.jsxs(n,{children:[h.jsx(s,{asChild:!0,children:h.jsxs("button",{type:"button","aria-haspopup":"listbox",className:"inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900",children:[h.jsx(ir,{className:"h-4 w-4"}),h.jsx("span",{children:i.title}),f>0?h.jsx("span",{className:"ml-0.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary",children:f}):null]})}),h.jsxs(r,{side:"top",align:"start",className:"w-[360px] p-0",children:[h.jsxs("div",{className:"space-y-2 border-b border-gray-100 px-4 py-3",children:[h.jsx("div",{className:"text-sm font-semibold text-gray-900",children:i.title}),h.jsxs("div",{className:"relative",children:[h.jsx(or,{className:"pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400"}),h.jsx(t,{value:l,onChange:g=>u(g.target.value),onKeyDown:x,placeholder:i.searchPlaceholder,role:"combobox","aria-controls":a,"aria-expanded":"true","aria-autocomplete":"list","aria-activedescendant":m[c]?`${a}-option-${c}`:void 0,className:"h-8 rounded-lg pl-8 text-xs"})]})]}),h.jsx("div",{ref:o,id:a,role:"listbox","aria-multiselectable":"true",className:"custom-scrollbar max-h-[320px] overflow-y-auto",children:i.isLoading?h.jsx("div",{className:"p-4 text-xs text-gray-500",children:i.loadingLabel}):m.length===0?h.jsx("div",{className:"p-4 text-center text-xs text-gray-500",children:i.emptyLabel}):h.jsx("div",{className:"py-1",children:m.map((g,v)=>{const w=p.has(g.key),I=v===c;return h.jsxs("button",{type:"button",id:`${a}-option-${v}`,role:"option","aria-selected":w,"data-skill-index":v,onClick:()=>y(g.key),onMouseEnter:()=>d(v),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${I?"bg-gray-50":"hover:bg-gray-50"}`,children:[h.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500",children:h.jsx(tl,{className:"h-4 w-4"})}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"truncate text-sm text-gray-900",children:g.label}),g.badgeLabel?h.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:g.badgeLabel}):null]}),h.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-500",children:g.description||g.key})]}),h.jsx("div",{className:"ml-3 shrink-0",children:h.jsx("span",{className:w?"inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white":"inline-flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 bg-white",children:w?h.jsx(sr,{className:"h-3 w-3"}):null})})]},g.key)})})}),i.manageHref&&i.manageLabel?h.jsx("div",{className:"border-t border-gray-100 px-4 py-2.5",children:h.jsxs("a",{href:i.manageHref,className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80",children:[i.manageLabel,h.jsx(nl,{className:"h-3 w-3"})]})}):null]})]})}function Zi({icon:e}){return e==="sparkles"?h.jsx(sl,{className:"h-3.5 w-3.5 shrink-0 text-primary"}):e==="brain"?h.jsx(il,{className:"h-3.5 w-3.5 shrink-0 text-gray-500"}):null}function Qu({icon:e}){return e==="paperclip"?h.jsx(rl,{className:"h-4 w-4"}):h.jsx(Zi,{icon:e})}function Xu(e){return e==="model"?"min-w-[220px]":e==="session-type"?"min-w-[140px]":e==="thinking"?"min-w-[150px]":""}function Yu(e){return e==="model"?"w-[320px]":e==="session-type"?"w-[220px]":e==="thinking"?"w-[180px]":""}function Ju({item:e}){const{Select:t,SelectContent:n,SelectItem:r,SelectTrigger:s,SelectValue:i}=Rt;return h.jsxs(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[h.jsx(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-3 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 ${Xu(e.key)}`,children:e.selectedLabel?h.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-left",children:[h.jsx(Zi,{icon:e.icon}),h.jsx("span",{className:"truncate text-xs font-semibold text-gray-700",children:e.selectedLabel})]}):e.loading?h.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-gray-200"}):h.jsx(i,{placeholder:e.placeholder})}),h.jsxs(n,{className:Yu(e.key),children:[e.options.length===0?e.loading?h.jsxs("div",{className:"space-y-2 px-3 py-2",children:[h.jsx("div",{className:"h-3 w-36 animate-pulse rounded bg-gray-200"}),h.jsx("div",{className:"h-3 w-28 animate-pulse rounded bg-gray-200"}),h.jsx("div",{className:"h-3 w-32 animate-pulse rounded bg-gray-200"})]}):e.emptyLabel?h.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:e.emptyLabel}):null:null,e.options.map(o=>h.jsx(r,{value:o.value,className:"py-2",children:o.description?h.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h.jsx("span",{className:"truncate text-xs font-semibold text-gray-800",children:o.label}),h.jsx("span",{className:"truncate text-[11px] text-gray-500",children:o.description})]}):h.jsx("span",{className:"truncate text-xs font-semibold text-gray-800",children:o.label})},o.value))]})]})}function Zu(e){var i;const{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:s}=Rt;return h.jsxs("div",{className:"flex items-center justify-between px-3 pb-3",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[e.skillPicker?h.jsx(Gu,{picker:e.skillPicker}):null,e.selects.map(o=>h.jsx(Ju,{item:o},o.key)),(i=e.accessories)==null?void 0:i.map(o=>{const a=h.jsxs("button",{type:"button",className:`inline-flex items-center rounded-lg py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:text-gray-400 ${o.iconOnly?"h-8 w-8 justify-center px-0":"gap-1.5 px-3"}`,onClick:o.onClick,disabled:o.disabled,"aria-label":o.label,children:[h.jsx(Qu,{icon:o.icon}),o.iconOnly?null:h.jsx("span",{children:o.label})]});if(!o.tooltip)return h.jsx("div",{children:a},o.key);const l=o.disabled?h.jsx("span",{className:"inline-flex",children:a}):a;return h.jsx(r,{children:h.jsxs(t,{children:[h.jsx(s,{asChild:!0,children:l}),h.jsx(n,{side:"top",children:h.jsx("p",{className:"text-xs",children:o.tooltip})})]})},o.key)})]}),h.jsx(qu,{...e.actions})]})}const ec="";function eo(){return`composer-${Math.random().toString(36).slice(2,10)}`}function Ct(e=""){return{id:eo(),type:"text",text:e}}function hr(e){return{id:eo(),type:"token",tokenKind:e.tokenKind,tokenKey:e.tokenKey,label:e.label}}function Et(e){return e.type==="text"?e.text.length:1}function fr(){return[Ct("")]}function tc(e){return[Ct(e)]}function ut(e){const t=[];for(const n of e){if(n.type==="text"){if(n.text.length===0)continue;const r=t[t.length-1];if((r==null?void 0:r.type)==="text"){t[t.length-1]={...r,text:r.text+n.text};continue}}t.push(n)}return t.length===0?fr():t}function nc(e){return e.map(t=>t.type==="text"?t.text:ec).join("")}function rc(e){return e.filter(t=>t.type==="text").map(t=>t.text).join("")}function pr(e,t){const n=[],r=new Set;for(const s of e)s.type!=="token"||s.tokenKind!==t||r.has(s.tokenKey)||(r.add(s.tokenKey),n.push(s.tokenKey));return n}function sc(e,t,n,r){const s=Math.max(0,n-t),i=Math.max(0,t+e.text.length-r),o=[];return s>0&&o.push({...e,text:e.text.slice(0,s)}),i>0&&o.push({...e,text:e.text.slice(e.text.length-i)}),o}function ic(e,t,n,r){return t<=n||e>=r}function oc(e,t,n,r,s){return!n&&r>=s?(e.push(...t),!0):n}function ac(e,t,n,r,s,i,o){const a=sc(t,n,r,s);a[0]&&e.push(a[0]);let l=o;return l||(e.push(...i),l=!0),a[1]&&e.push(a[1]),l}function lc(e,t,n,r,s,i){return!r&&s<=i?(e.push(...n),!0):(e.push(t),r)}function on(e,t,n,r){const s=Math.max(0,t),i=Math.max(s,n),o=[];let a=0,l=!1;for(const u of e){const c=Et(u),d=a,p=a+c;if(ic(d,p,s,i)){l=oc(o,r,l,d,i),o.push(u),a=p;continue}u.type==="text"?l=ac(o,u,d,s,i,r,l):l=lc(o,u,r,l,s,d),a=p}return l||o.push(...r),ut(o)}function to(e,t){return ut(e.filter(n=>n.type!=="token"||!t(n)))}function uc(e,t){if(!t||t.start!==t.end)return null;const n=nc(e),r=t.end,s=n.slice(0,r),i=/(?:^|\s)\/([^\s\uFFFC]*)$/.exec(s);if(!i)return null;const o=r-i[0].length+(i[0].startsWith("/")?0:1);return{query:(i[1]??"").trim().toLowerCase(),start:o,end:r}}function cc(e,t,n){return e?e.start<n&&e.end>t:!1}function no(e){const t=new Map;let n=0;for(const r of e)t.set(r.id,n),n+=Et(r);return t}function ro(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n?Array.prototype.indexOf.call(e.childNodes,n):e.childNodes.length}function dc(e,t,n){if(e instanceof HTMLElement){const r=e.dataset.composerNodeId;if(r)return n.find(s=>s.id===r)}return n[t]}function so(e,t,n){let r=0;for(let s=0;s<n;s+=1){const i=dc(e.childNodes[s],s,t);i&&(r+=Et(i))}return r}function hc(e,t,n,r){var a;const s=ro(e,t),i=so(e,r,s),o=r[s];return(o==null?void 0:o.type)==="text"?i+Math.min(n,o.text.length):i+Math.min(n,((a=t.textContent)==null?void 0:a.length)??0)}function fc(e,t,n,r,s){return n.type==="text"?e.nodeType===Node.TEXT_NODE?r+Math.min(t,n.text.length):e===s?r+(t>0?n.text.length:0):r+n.text.length:e===s?r+(t>0?1:0):r+1}function On(e,t,n,r,s){var u;if(t===e)return so(e,r,n);if(t.nodeType===Node.TEXT_NODE&&t.parentNode===e)return hc(e,t,n,r);const i=t instanceof HTMLElement?t.closest("[data-composer-node-id]"):((u=t.parentElement)==null?void 0:u.closest("[data-composer-node-id]"))??null;if(!(i instanceof HTMLElement)){const c=ro(e,t);return On(e,e,c,r,s)}const o=i.dataset.composerNodeId;if(!o)return 0;const a=r.find(c=>c.id===o),l=s.get(o)??0;return a?fc(t,n,a,l,i):l}function io(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(!e.contains(r.startContainer)||!e.contains(r.endContainer))return null;const s=no(t),i=On(e,r.startContainer,r.startOffset,t,s),o=On(e,r.endContainer,r.endOffset,t,s);return{start:Math.min(i,o),end:Math.max(i,o)}}function pc(e,t,n){if(!n)return;const r=window.getSelection();if(!r)return;const s=l=>{let u=0;for(let c=0;c<t.length;c+=1){const d=t[c],p=Et(d),f=u,m=u+p,y=e.childNodes[c];if(!y){u=m;continue}if(d.type==="text"){if(l<=m)return{container:y.firstChild??y,offset:Math.max(0,Math.min(l-f,d.text.length))}}else{if(l<=f)return{container:e,offset:c};if(l<=m)return{container:e,offset:c+1}}u=m}return{container:e,offset:e.childNodes.length}},i=s(n.start),o=s(n.end),a=document.createRange();a.setStart(i.container,i.offset),a.setEnd(o.container,o.offset),r.removeAllRanges(),r.addRange(a)}function gc(e){const t=[];for(const n of Array.from(e.childNodes)){if(n.nodeType===Node.TEXT_NODE){t.push(Ct(n.textContent??""));continue}if(!(n instanceof HTMLElement))continue;if(n.dataset.composerNodeType==="token"){const i=n.dataset.composerTokenKind,o=n.dataset.composerTokenKey,a=n.dataset.composerLabel;i&&o&&a&&t.push({id:n.dataset.composerNodeId??hr({tokenKind:i,tokenKey:o,label:a}).id,type:"token",tokenKind:i,tokenKey:o,label:a});continue}const s=n.textContent??"";t.push({id:n.dataset.composerNodeId??Ct(s).id,type:"text",text:s})}return ut(t)}function qr(e){const t=gc(e);return{nodes:t,selection:io(e,t)}}class mc{constructor(){this.nodes=fr(),this.selection=null,this.sync=(t,n)=>(this.nodes=ut(t),this.selection=n,this.getSnapshot()),this.setSelection=t=>(this.selection=t,this.getSnapshot()),this.replaceDocument=(t,n)=>(this.nodes=ut(t),this.selection=n,this.getSnapshot()),this.insertText=t=>{const n=this.selection??{start:0,end:0};this.nodes=on(this.nodes,n.start,n.end,[Ct(t)]);const r=n.start+t.length;return this.selection={start:r,end:r},this.getSnapshot()},this.insertSkillToken=(t,n)=>{var a,l;if(this.getSelectedSkillKeys().includes(t))return this.getSnapshot();const r=this.getSlashTrigger(),s=this.getDocumentLength(),i=(r==null?void 0:r.start)??((a=this.selection)==null?void 0:a.start)??s,o=(r==null?void 0:r.end)??((l=this.selection)==null?void 0:l.end)??i;return this.nodes=on(this.nodes,i,o,[hr({tokenKind:"skill",tokenKey:t,label:n})]),this.selection={start:i+1,end:i+1},this.getSnapshot()},this.syncSelectedSkills=(t,n)=>{const r=this.getSelectedSkillKeys(),s=new Map(n.map(a=>[a.key,a])),i=t.find(a=>!r.includes(a));if(i){const a=s.get(i);return this.insertSkillToken(i,(a==null?void 0:a.label)??i)}const o=r.find(a=>!t.includes(a));return o&&(this.nodes=to(this.nodes,a=>a.tokenKind==="skill"&&a.tokenKey===o)),this.getSnapshot()},this.deleteContent=t=>{const n=this.getDocumentLength(),r=this.selection??{start:n,end:n};let s=r.start,i=r.end;if(r.start===r.end)if(t==="backward"&&r.start>0)s=r.start-1;else if(t==="forward")i=r.end+1;else return this.getSnapshot();return this.nodes=on(this.nodes,s,i,[]),this.selection={start:s,end:s},this.getSnapshot()},this.getSnapshot=()=>({nodes:this.nodes,selection:this.selection,nodeStartMap:no(this.nodes),documentLength:this.getDocumentLength(),selectedSkillKeys:this.getSelectedSkillKeys(),slashTrigger:this.getSlashTrigger()}),this.getDocumentLength=()=>this.nodes.reduce((t,n)=>t+Et(n),0),this.getSelectedSkillKeys=()=>pr(this.nodes,"skill"),this.getSlashTrigger=()=>uc(this.nodes,this.selection)}}function yc(e){const{key:t,shiftKey:n,isComposing:r,isSlashMenuOpen:s,slashItemCount:i,activeSlashIndex:o,isSending:a,canStopGeneration:l}=e;if(s&&i>0){if(t==="ArrowDown")return{type:"move-slash-index",index:(o+1)%i};if(t==="ArrowUp")return{type:"move-slash-index",index:(o-1+i)%i};if(t==="Enter"&&!n||t==="Tab")return{type:"insert-active-slash-item"}}return t==="Escape"?s?{type:"close-slash"}:a&&l?{type:"stop-generation"}:{type:"noop"}:t==="Enter"&&n?{type:"insert-line-break"}:t==="Enter"?{type:"send-message"}:!r&&(t==="Backspace"||t==="Delete")?{type:"delete-content",direction:t==="Backspace"?"backward":"forward"}:{type:"noop"}}const Wr="http://www.w3.org/2000/svg";class xc{constructor(){this.render=(t,n)=>{if(!t)return;const r=document.createDocumentFragment();for(const s of n.nodes){const i=s.type==="text"?this.createTextNodeElement(s):this.createTokenNodeElement(s,n.selectedRange,n.nodeStartMap);i&&r.appendChild(i)}t.replaceChildren(r)},this.createTextNodeElement=t=>{if(t.text.length===0)return null;const n=document.createElement("span");return n.dataset.composerNodeId=t.id,n.dataset.composerNodeType="text",n.textContent=t.text,n},this.createTokenNodeElement=(t,n,r)=>{const s=r.get(t.id)??0,i=cc(n,s,s+1),o=document.createElement("span");o.contentEditable="false",o.dataset.composerNodeId=t.id,o.dataset.composerNodeType="token",o.dataset.composerTokenKind=t.tokenKind,o.dataset.composerTokenKey=t.tokenKey,o.dataset.composerLabel=t.label,o.className=["mx-[2px]","inline-flex","h-6","max-w-full","items-center","gap-1","rounded-md","border","px-1.5","align-baseline","text-[11px]","font-medium","transition",i?"border-primary/30 bg-primary/18 text-primary":"border-primary/12 bg-primary/8 text-primary"].join(" "),o.append(this.createTokenIcon(t.tokenKind));const a=document.createElement("span");return a.className="truncate",a.textContent=t.label,o.append(a),o},this.createTokenIcon=t=>{const n=document.createElement("span");return n.className="inline-flex h-3 w-3 shrink-0 items-center justify-center text-primary/70",n.append(t==="file"?this.createFileIcon():this.createSkillIcon()),n},this.createSkillIcon=()=>this.createSvgIcon([{tag:"path",attrs:{d:"M8.5 2.75 2.75 6l5.75 3.25L14.25 6 8.5 2.75Z"}},{tag:"path",attrs:{d:"M2.75 10 8.5 13.25 14.25 10"}},{tag:"path",attrs:{d:"M2.75 6v4l5.75 3.25V9.25L2.75 6Z"}},{tag:"path",attrs:{d:"M14.25 6v4L8.5 13.25V9.25L14.25 6Z"}}]),this.createFileIcon=()=>this.createSvgIcon([{tag:"path",attrs:{d:"M5.25 2.75h4.5L13 6v7.25A1.75 1.75 0 0 1 11.25 15h-6.5A1.75 1.75 0 0 1 3 13.25v-8.75A1.75 1.75 0 0 1 4.75 2.75Z"}},{tag:"path",attrs:{d:"M9.75 2.75V6H13"}},{tag:"path",attrs:{d:"M5.75 8.75h4.5"}},{tag:"path",attrs:{d:"M5.75 10.75h4.5"}}]),this.createSvgIcon=t=>{const n=document.createElementNS(Wr,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.25"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("class","h-3 w-3");for(const r of t){const s=document.createElementNS(Wr,r.tag);for(const[i,o]of Object.entries(r.attrs))s.setAttribute(i,o);n.append(s)}return n}}}const Gr=188;class bc{constructor(t){this.controller=t,this.surfaceRenderer=new xc,this.sync=(n,r)=>this.controller.sync(n,r),this.syncSelectionFromRoot=n=>this.controller.setSelection(io(n,this.controller.getSnapshot().nodes)),this.restoreSelectionIfFocused=(n,r)=>{!n||document.activeElement!==n||pc(n,this.controller.getSnapshot().nodes,r)},this.syncViewport=n=>{n&&(n.style.maxHeight=`${Gr}px`,n.style.overflowY=n.scrollHeight>Gr?"auto":"hidden")},this.renderSurface=n=>{this.surfaceRenderer.render(n.root,{nodes:n.snapshot.nodes,selectedRange:n.selectedRange,nodeStartMap:n.snapshot.nodeStartMap})},this.insertSlashItem=(n,r)=>{n.value&&r(this.controller.insertSkillToken(n.value,n.title))},this.syncSelectedSkills=(n,r,s)=>{s(this.controller.syncSelectedSkills(n,r))},this.handleBeforeInput=n=>{const{event:r,disabled:s,isComposing:i,commitSnapshot:o}=n,a=r.nativeEvent;s||i||a.isComposing||!(a.inputType==="insertText"||a.inputType==="insertReplacementText")||!a.data||(r.preventDefault(),o(this.controller.insertText(a.data)))},this.handleInput=n=>{const{event:r,isComposing:s,commitSnapshot:i}=n,o=r.nativeEvent;if(s||o.isComposing)return;const a=r.currentTarget,l=qr(a);i(this.controller.replaceDocument(l.nodes,l.selection))},this.handleCompositionEnd=n=>{const{event:r,commitSnapshot:s}=n,i=r.currentTarget,o=qr(i);s(this.controller.replaceDocument(o.nodes,o.selection))},this.handleKeyDown=n=>{const{event:r,slashItems:s,activeSlashIndex:i,activeSlashItem:o,actions:a,commitSnapshot:l,insertSkillToken:u,onSlashActiveIndexChange:c,onSlashQueryChange:d,onSlashOpenChange:p}=n,f=this.controller.getSnapshot(),m=yc({key:r.key,shiftKey:r.shiftKey,isComposing:r.nativeEvent.isComposing,isSlashMenuOpen:f.slashTrigger!==null,slashItemCount:s.length,activeSlashIndex:i,isSending:a.isSending,canStopGeneration:a.canStopGeneration});if(m.type!=="noop"){if(r.preventDefault(),m.type==="move-slash-index"){c(m.index);return}if(m.type==="insert-active-slash-item"){o&&u(o.value??o.key,o.title);return}if(m.type==="close-slash"){d==null||d(null),p(!1);return}if(m.type==="stop-generation"){a.onStop();return}if(m.type==="insert-line-break"){l(this.controller.insertText(`
1
+ var Ba=Object.defineProperty;var $a=(e,t,n)=>t in e?Ba(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var D=(e,t,n)=>$a(e,typeof t!="symbol"?t+"":t,n);import{r as k,j as h,ae as Ua,t as Ka,c as Va,y as Ha,z as qa,h as fi,I as Wa,i as rr,n as Ga,o as pi,V as Qa,q as gi,s as Xa,v as sr,w as Ya,k as mi,l as Ja,m as yi,a as Za,af as el,B as ir,G as or,ag as tl,ah as nl,ai as rl,F as sl,aj as il,ak as ol,Z as xi,al as bi,am as Si,an as al,ao as ll,ap as ul,aq as cl,ar as dl,as as hl,d as Xt,at as fl,A as ar,_ as Or,au as pl,a0 as gl,a3 as ml,a1 as yl,a2 as xl,av as Ln,aw as Nn,ax as Pn,ay as Mt,M as bl,az as ki,aA as Sl,aB as kl,aC as vl,a4 as lr,aD as vi,aE as wi,u as wl}from"./vendor-CmQZsDAE.js";import{u as ur}from"./useConfirmDialog-yX-ZMNf9.js";import{i as Cl,t as R,u as Ci,a as Ti,j as Tl,k as Il,l as Ml,m as Rl,c as ke,n as El,o as Al,p as cr,q as Ll,T as Fr,L as zr,r as Nl,B as Ze,I as Ii,s as Yt,S as jn,e as Dn,g as _n,h as St,v as Pl,w as jl,x as Dl,y as _l,f as Ol,C as Fl,z as zl,A as Br,E as Bl,F as $l,G as Ul,H as Kl,J as Vl,K as Hl,M as ql,N as Wl,O as Gl,P as Ql,Q as Xl}from"./index-C6dwNe7e.js";import{b as Yl,a as Jl,S as Zl,s as eu,c as $r,e as Ur}from"./chat-message-Cwq8nW0e.js";import{u as Mi,T as tu,a as nu,b as ru,c as su,P as iu,R as ou,d as au,e as lu,C as Ri,M as uu}from"./MarketplacePage-CcbfvtGX.js";import{b as Ei,c as Ai,r as Li}from"./provider-models-BOeNnjk9.js";import{R as cu,A as du,P as hu,C as Ni,T as fu,a as pu,b as gu,c as mu}from"./popover-CWmq2f6H.js";import{P as yu,a as xu}from"./page-layout-4_789zOC.js";import"./tabs-custom-BQj0Z-ZC.js";import"./skeleton-kjkadEki.js";import"./marketplace-localization-Dk31LJJJ.js";const bu="ncp";function Kr(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="legacy"||t==="ncp"?t:null}function Su(e){const t=Kr(new URLSearchParams(e).get("chatChain"));return t||(Kr(void 0)??bu)}function ku(e){var v;const{view:t,selectedSessionKey:n,activeBackendRunId:r,isLocallyRunning:s,resumeRun:i}=e,[o,a]=k.useState(null),l=k.useRef(!1),u=k.useRef(new Map),c=k.useRef(new Map),d=k.useRef(new Map),p=k.useRef(r),f=k.useRef(new Set);k.useEffect(()=>{n&&f.current.add(n)},[n]),k.useEffect(()=>{n&&s&&f.current.delete(n)},[s,n]);const m=Cl(t==="chat"?{states:["queued","running"],limit:200,syncActiveStates:!0,isLocallyRunning:s}:void 0),y=k.useMemo(()=>{var w;return Yl(((w=m.data)==null?void 0:w.runs)??[])},[(v=m.data)==null?void 0:v.runs]),x=k.useMemo(()=>{const w=Jl(y);if(o){const I=y.get(o.sessionKey)??null;I&&(!o.runId||I.runId===o.runId)&&w.delete(o.sessionKey)}return w},[y,o]),g=k.useMemo(()=>{if(!n)return null;const w=y.get(n)??null;return(!w||!o||o.sessionKey!==n?!1:!o.runId||w.runId===o.runId)?null:w},[y,n,o]);return k.useEffect(()=>{r&&(p.current=r)},[r]),k.useEffect(()=>{if(t!=="chat"||!n||!g||!f.current.has(n)||s||r===g.runId||u.current.get(n)===g.runId)return;const I=c.current.get(n);if(I&&I===g.runId)return;const L=d.current.get(n);if(typeof L=="number"){const T=Date.parse(g.requestedAt??"");if(Number.isFinite(T)){if(T<=L+2e3)return}else if(Date.now()-L<=8e3)return}u.current.set(n,g.runId),f.current.delete(n),i(g)},[r,g,s,i,n,t]),k.useEffect(()=>{if(!n){u.current.clear(),c.current.clear(),d.current.clear(),f.current.clear();return}y.has(n)||(u.current.delete(n),c.current.delete(n),d.current.delete(n))},[y,n]),k.useEffect(()=>{var I,L,T;const w=l.current;if(l.current=s,!s&&w&&n){const _=((I=p.current)==null?void 0:I.trim())||((T=(L=y.get(n))==null?void 0:L.runId)==null?void 0:T.trim());_&&c.current.set(n,_),d.current.set(n,Date.now()),a({sessionKey:n,..._?{runId:_}:{}}),m.refetch()}},[y,s,n,m]),k.useEffect(()=>{if(!o)return;const w=y.get(o.sessionKey)??null;if(!w){a(null);return}o.runId&&w.runId!==o.runId&&a(null)},[y,o]),k.useEffect(()=>{s&&(o==null?void 0:o.sessionKey)===n&&a(null)},[s,n,o]),{sessionRunStatusByKey:x}}const Ee="native";function Fe(e){return typeof e!="string"?Ee:e.trim().toLowerCase()||Ee}function lt(e,t){return e==="native"?R("chatSessionTypeNative"):e.trim().split(/[-_]+/g).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")||e}function vu(e){var n;const t=new Map;for(const r of e){const s=Fe(r.value);t.set(s,{value:s,label:((n=r.label)==null?void 0:n.trim())||lt(s),ready:r.ready??!0,reason:r.reason??null,reasonMessage:r.reasonMessage??null,supportedModels:r.supportedModels,recommendedModel:r.recommendedModel??null,cta:r.cta??null})}return t.has(Ee)||t.set(Ee,{value:Ee,label:lt(Ee),ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}),Array.from(t.values()).sort((r,s)=>r.value===Ee?-1:s.value===Ee?1:r.value.localeCompare(s.value))}function Pi(e){const{selectedSession:t,selectedSessionKey:n,pendingSessionType:r,setPendingSessionType:s,sessionTypesData:i}=e,o=k.useMemo(()=>vu((i==null?void 0:i.options)??[]),[i==null?void 0:i.options]),a=k.useMemo(()=>{const x=[...o],g=Fe(t==null?void 0:t.sessionType);return x.some(v=>v.value===g)||x.push({value:g,label:lt(g),ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}),x.sort((v,w)=>v.value===Ee?-1:w.value===Ee?1:v.value.localeCompare(w.value))},[o,t==null?void 0:t.sessionType]),l=k.useMemo(()=>Fe((i==null?void 0:i.defaultType)??Ee),[i==null?void 0:i.defaultType]),u=k.useRef(null),c=k.useMemo(()=>Fe((t==null?void 0:t.sessionType)??r??l),[l,r,t==null?void 0:t.sessionType]),d=k.useMemo(()=>a.find(x=>x.value===c)??null,[c,a]);k.useEffect(()=>{if(n)return;const x=typeof r=="string"?r.trim():"",g=Fe(r);(x.length===0||u.current===g||u.current===null&&g===Ee)&&(u.current=l,g!==l&&s(l))},[l,r,n,s]);const p=!n||!!(t!=null&&t.sessionTypeMutable),f=k.useMemo(()=>new Set(o.map(x=>x.value)),[o]),m=k.useMemo(()=>t&&!f.has(Fe(t.sessionType))?!0:(d==null?void 0:d.ready)===!1,[f,t,d==null?void 0:d.ready]),y=k.useMemo(()=>{var x;return t&&!f.has(Fe(t.sessionType))?`${lt(c)} ${R("chatSessionTypeUnavailableSuffix")}`:(d==null?void 0:d.ready)===!1?((x=d.reasonMessage)==null?void 0:x.trim())||`${d.label} setup required`:null},[f,t,c,d]);return{sessionTypeOptions:a,selectedSessionTypeOption:d,defaultSessionType:l,selectedSessionType:c,canEditSessionType:p,sessionTypeUnavailable:m,sessionTypeUnavailableMessage:y}}function Vr(e){return(e==null?void 0:e.trim().toLowerCase())||"native"}function wu(e,t){if(typeof t!="string")return!1;const n=t.trim();return n?e.some(r=>r.value===n):!1}function Cu(e,t){return typeof t=="string"&&e.includes(t)}function Tu(e){return e.length===0?null:e.includes("off")?"off":e[0]??null}function ji(e){const{currentValue:t,selectedSessionPreferredValue:n,fallbackPreferredValue:r,defaultValue:s,isValueSupported:i,firstAvailableValue:o,preferSessionPreferredValue:a=!1,preserveCurrentValueOnSessionChange:l=!1}=e;return i(t)&&(!a||l)?t:i(n)?n:i(r)?r:i(s)?s:o}function Iu(e){var n;const{modelOptions:t}=e;return t.length===0?"":ji({currentValue:e.currentSelectedModel,selectedSessionPreferredValue:e.selectedSessionPreferredModel,fallbackPreferredValue:e.fallbackPreferredModel,defaultValue:e.defaultModel,isValueSupported:r=>wu(t,r),firstAvailableValue:((n=t[0])==null?void 0:n.value)??"",preferSessionPreferredValue:e.preferSessionPreferredModel,preserveCurrentValueOnSessionChange:e.preserveCurrentSelectedModelOnSessionChange})}function Mu(e){const{supportedThinkingLevels:t}=e;return t.length===0?null:ji({currentValue:e.currentSelectedThinkingLevel,selectedSessionPreferredValue:e.selectedSessionPreferredThinking,fallbackPreferredValue:e.fallbackPreferredThinking,defaultValue:e.defaultThinkingLevel,isValueSupported:n=>Cu(t,n),firstAvailableValue:Tu(t)??"off",preferSessionPreferredValue:e.preferSessionPreferredThinking,preserveCurrentValueOnSessionChange:e.preserveCurrentSelectedThinkingOnSessionChange})}function Di(e){const t=Vr(e.sessionType);let n,r=Number.NEGATIVE_INFINITY;for(const s of e.sessions){if(s.key===e.selectedSessionKey||Vr(s.sessionType)!==t)continue;const i=e.readPreference(s);if(i==null)continue;const o=Date.parse(s.updatedAt),a=Number.isFinite(o)?o:Number.NEGATIVE_INFINITY;(n===void 0||a>r)&&(n=i,r=a)}return n}function _i(e){return Di({sessions:e.sessions,selectedSessionKey:e.selectedSessionKey,sessionType:e.sessionType,readPreference:t=>{var r;return((r=t.preferredModel)==null?void 0:r.trim())||void 0}})}function Oi(e){return Di({sessions:e.sessions,selectedSessionKey:e.selectedSessionKey,sessionType:e.sessionType,readPreference:t=>t.preferredThinking??void 0})}function Fi(e){const{isPreferenceAvailable:t,emptyValue:n,selectedSessionKey:r,selectedSessionExists:s=!1,setValue:i,resolveValue:o}=e,a=k.useRef(void 0),l=k.useRef(o);k.useEffect(()=>{l.current=o},[o]),k.useEffect(()=>{const u=a.current!==r;if(!t){i(n),a.current=r;return}i(c=>l.current({currentValue:c,sessionChanged:u,preserveCurrentValueOnSessionChange:u&&!!r&&!s})),a.current=r},[n,t,s,r,i])}function zi(e){const{modelOptions:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredModel:s,fallbackPreferredModel:i,defaultModel:o,setSelectedModel:a}=e;Fi({isPreferenceAvailable:t.length>0,emptyValue:"",selectedSessionKey:n,selectedSessionExists:r,setValue:a,resolveValue:({currentValue:l,sessionChanged:u,preserveCurrentValueOnSessionChange:c})=>Iu({currentSelectedModel:l,modelOptions:t,selectedSessionPreferredModel:s,fallbackPreferredModel:i,defaultModel:o,preferSessionPreferredModel:u,preserveCurrentSelectedModelOnSessionChange:c})})}function Bi(e){const{supportedThinkingLevels:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredThinking:s,fallbackPreferredThinking:i,defaultThinkingLevel:o,setSelectedThinkingLevel:a}=e;Fi({isPreferenceAvailable:t.length>0,emptyValue:null,selectedSessionKey:n,selectedSessionExists:r,setValue:a,resolveValue:({currentValue:l,sessionChanged:u,preserveCurrentValueOnSessionChange:c})=>Mu({currentSelectedThinkingLevel:l,supportedThinkingLevels:t,selectedSessionPreferredThinking:s,fallbackPreferredThinking:i,defaultThinkingLevel:o,preferSessionPreferredThinking:u,preserveCurrentSelectedThinkingOnSessionChange:c})})}function Ru(e){var I,L,T,_,F,z;const t=Ci(),n=Ti(),r=Tl({q:e.query.trim()||void 0,limit:120,activeMinutes:0}),s=Mi("skill"),i=Il({sessionKey:e.selectedSessionKey,agentId:e.selectedAgentId}),o=Ml(e.selectedSessionKey,300),a=Rl(),l=(t.isFetched||t.isSuccess)&&(n.isFetched||n.isSuccess),u=k.useMemo(()=>{const C=Ei({meta:n.data,config:t.data,onlyConfigured:!0}),j=new Set,N=[];for(const $ of C)for(const O of $.models){const E=Ai($.prefix,O);!E||j.has(E)||(j.add(E),N.push({value:E,modelLabel:O,providerLabel:$.displayName,thinkingCapability:Li($.modelThinking,O,$.aliases)}))}return N.sort(($,O)=>{const E=$.providerLabel.localeCompare(O.providerLabel);return E!==0?E:$.modelLabel.localeCompare(O.modelLabel)})},[n.data,t.data]),c=k.useMemo(()=>{var C;return((C=r.data)==null?void 0:C.sessions)??[]},[(I=r.data)==null?void 0:I.sessions]),d=k.useMemo(()=>{var C;return((C=s.data)==null?void 0:C.records)??[]},[(L=s.data)==null?void 0:L.records]),p=k.useMemo(()=>c.find(C=>C.key===e.selectedSessionKey)??null,[e.selectedSessionKey,c]),f=Pi({selectedSession:p,selectedSessionKey:e.selectedSessionKey,pendingSessionType:e.pendingSessionType,setPendingSessionType:e.setPendingSessionType,sessionTypesData:a.data}),m=k.useMemo(()=>_i({sessions:c,selectedSessionKey:e.selectedSessionKey,sessionType:f.selectedSessionType}),[e.selectedSessionKey,f.selectedSessionType,c]),y=k.useMemo(()=>u.find(C=>C.value===e.currentSelectedModel),[u,e.currentSelectedModel]),x=k.useMemo(()=>{var C;return((C=y==null?void 0:y.thinkingCapability)==null?void 0:C.supported)??[]},[(T=y==null?void 0:y.thinkingCapability)==null?void 0:T.supported]),g=k.useMemo(()=>{var C;return((C=y==null?void 0:y.thinkingCapability)==null?void 0:C.default)??null},[(_=y==null?void 0:y.thinkingCapability)==null?void 0:_.default]),v=k.useMemo(()=>Oi({sessions:c,selectedSessionKey:e.selectedSessionKey,sessionType:f.selectedSessionType}),[e.selectedSessionKey,f.selectedSessionType,c]);zi({modelOptions:u,selectedSessionKey:e.selectedSessionKey,selectedSessionExists:!!p,selectedSessionPreferredModel:p==null?void 0:p.preferredModel,fallbackPreferredModel:m,defaultModel:(F=t.data)==null?void 0:F.agents.defaults.model,setSelectedModel:e.setSelectedModel}),Bi({supportedThinkingLevels:x,selectedSessionKey:e.selectedSessionKey,selectedSessionExists:!!p,selectedSessionPreferredThinking:(p==null?void 0:p.preferredThinking)??null,fallbackPreferredThinking:v??null,defaultThinkingLevel:g,setSelectedThinkingLevel:e.setSelectedThinkingLevel});const w=k.useMemo(()=>{var C;return((C=o.data)==null?void 0:C.messages)??[]},[(z=o.data)==null?void 0:z.messages]);return{configQuery:t,configMetaQuery:n,sessionsQuery:r,installedSkillsQuery:s,chatCapabilitiesQuery:i,historyQuery:o,sessionTypesQuery:a,isProviderStateResolved:l,modelOptions:u,sessions:c,skillRecords:d,selectedSession:p,historyMessages:w,...f}}function $i(e){if(e.label&&e.label.trim())return e.label.trim();const t=e.key.split(":");return t[t.length-1]||e.key}const Eu={connected:{dotClass:"bg-emerald-500"},disconnected:{dotClass:"h-2.5 w-2.5 rounded-full border border-gray-400 bg-transparent"},connecting:{dotClass:"text-amber-600"}};function Au({status:e,className:t}){const n=Eu[e],r=e==="connected"?R("connected"):e==="disconnected"?R("disconnected"):R("connecting");return h.jsx(tu,{delayDuration:250,children:h.jsxs(nu,{children:[h.jsx(ru,{asChild:!0,children:h.jsx("span",{role:"status","aria-label":r,className:ke("inline-flex h-5 w-5 items-center justify-center",t),children:e==="connecting"?h.jsx(Ua,{className:ke("h-3 w-3 animate-spin",n.dotClass)}):h.jsx("span",{className:ke(e==="connected"?"h-2 w-2 rounded-full":"",n.dotClass)})})}),h.jsx(su,{side:"bottom",className:"text-xs",children:r})]})})}const Ui=k.createContext(null);function Ki({presenter:e,children:t}){return h.jsx(Ui.Provider,{value:e,children:t})}function dr(){const e=k.useContext(Ui);if(!e)throw new Error("usePresenter must be used inside ChatPresenterProvider");return e}const Lu=e=>`[data-item-index="${e}"]`;function Vi(e){const t=e.getItemSelector??Lu;k.useEffect(()=>{if(!e.isEnabled||e.itemCount===0)return;const n=e.containerRef.current;if(!n)return;const r=n.querySelector(t(e.activeIndex));r==null||r.scrollIntoView({block:"nearest",inline:"nearest"})},[t,e.activeIndex,e.containerRef,e.isEnabled,e.itemCount])}function Nu(){const e=k.useRef(null),[t,n]=k.useState(null);return k.useEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const s=()=>{n(r.getBoundingClientRect().width)};s();const i=new ResizeObserver(()=>s());return i.observe(r),()=>i.disconnect()},[]),{elementRef:e,width:t}}function ue(...e){return Ka(Va(e))}const Hi=k.forwardRef(({className:e,type:t,...n},r)=>h.jsx("input",{type:t,className:ue("flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Hi.displayName="ChatInput";const Pu=cu,ju=fu,Du=du,qi=k.forwardRef(({className:e,sideOffset:t=8,align:n="start",...r},s)=>h.jsx(hu,{children:h.jsx(Ni,{ref:s,sideOffset:t,align:n,className:ue("z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));qi.displayName=Ni.displayName;const _u=Ha,Ou=qa,Wi=k.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(fi,{ref:r,className:ue("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(Wa,{asChild:!0,children:h.jsx(rr,{className:"h-4 w-4 opacity-50"})})]}));Wi.displayName=fi.displayName;const Gi=k.forwardRef(({className:e,...t},n)=>h.jsx(mi,{ref:n,className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(Ja,{className:"h-4 w-4"})}));Gi.displayName=mi.displayName;const Qi=k.forwardRef(({className:e,...t},n)=>h.jsx(yi,{ref:n,className:ue("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(rr,{className:"h-4 w-4"})}));Qi.displayName=yi.displayName;const Xi=k.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>h.jsx(Ga,{children:h.jsxs(pi,{ref:s,className:ue("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(Gi,{}),h.jsx(Qa,{className:ue("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(Qi,{})]})}));Xi.displayName=pi.displayName;const Yi=k.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(gi,{ref:r,className:ue("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100",e),...n,children:[h.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Xa,{children:h.jsx(sr,{className:"h-4 w-4"})})}),h.jsx(Ya,{children:t})]}));Yi.displayName=gi.displayName;const Fu=iu,zu=ou,Bu=au,Ji=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(lu,{children:h.jsx(Ri,{ref:r,sideOffset:t,className:ue("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ji.displayName=Ri.displayName;const Rt={Popover:Pu,PopoverAnchor:Du,PopoverContent:qi,PopoverTrigger:ju,Input:Hi,Select:_u,SelectContent:Xi,SelectItem:Yi,SelectTrigger:Wi,SelectValue:Ou,Tooltip:zu,TooltipContent:Ji,TooltipProvider:Fu,TooltipTrigger:Bu},$u=680,Uu=.82,Ku=560;function Vu(e){const{Popover:t,PopoverAnchor:n,PopoverContent:r}=Rt,{elementRef:s,width:i}=Nu(),o=k.useRef(null),{isOpen:a,isLoading:l,items:u,activeIndex:c,activeItem:d,texts:p,onSelectItem:f,onOpenChange:m,onSetActiveIndex:y}=e,x=k.useMemo(()=>{if(i)return Math.min(i>Ku?i*Uu:i,$u)},[i]);return Vi({containerRef:o,activeIndex:c,itemCount:u.length,isEnabled:a&&!l,getItemSelector:g=>`[data-slash-index="${g}"]`}),h.jsxs(t,{open:a,onOpenChange:m,children:[h.jsx(n,{asChild:!0,children:h.jsx("div",{ref:s,className:"pointer-events-none absolute bottom-full left-3 right-3 h-0"})}),h.jsx(r,{side:"top",align:"start",sideOffset:10,className:"z-[70] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md",onOpenAutoFocus:g=>g.preventDefault(),style:x?{width:`${x}px`}:void 0,children:h.jsxs("div",{className:"grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]",children:[h.jsx("div",{ref:o,role:"listbox","aria-label":p.slashSectionLabel,className:"custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5",children:l?h.jsx("div",{className:"p-2 text-xs text-gray-500",children:p.slashLoadingLabel}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:p.slashSectionLabel}),u.length===0?h.jsx("div",{className:"px-2 text-xs text-gray-400",children:p.slashEmptyLabel}):h.jsx("div",{className:"space-y-1",children:u.map((g,v)=>{const w=v===c;return h.jsxs("button",{type:"button",role:"option","aria-selected":w,"data-slash-index":v,onMouseEnter:()=>y(v),onClick:()=>f(g),className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition ${w?"bg-gray-100 text-gray-900":"text-gray-700 hover:bg-gray-50"}`,children:[h.jsx("span",{className:"truncate text-xs font-semibold",children:g.title}),h.jsx("span",{className:"truncate text-xs text-gray-500",children:g.subtitle})]},g.key)})})]})}),h.jsx("div",{className:"max-w-[320px] p-3.5",children:d?h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary",children:d.subtitle}),h.jsx("span",{className:"text-sm font-semibold text-gray-900",children:d.title})]}),h.jsx("p",{className:"text-xs leading-5 text-gray-600",children:d.description}),h.jsx("div",{className:"space-y-1",children:d.detailLines.map(g=>h.jsx("div",{className:"rounded-md bg-gray-50 px-2 py-1 text-[11px] text-gray-600",children:g},g))}),h.jsx("div",{className:"pt-1 text-[11px] text-gray-500",children:p.slashSkillHintLabel})]}):h.jsx("div",{className:"text-xs text-gray-500",children:p.slashHintLabel})})]})})]})}const Hu=Za("inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600",secondary:"bg-gray-100 text-gray-700 hover:bg-gray-200/80",ghost:"hover:bg-gray-100/80 hover:text-gray-800",link:"text-primary underline-offset-4 hover:underline",primary:"bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm",subtle:"bg-gray-100 text-gray-600 hover:bg-gray-200/80","primary-outline":"border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",lg:"h-11 px-5 text-[14px]",xl:"h-12 px-6 text-[15px]",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),$t=k.forwardRef(({className:e,variant:t,size:n,...r},s)=>h.jsx("button",{className:ue(Hu({variant:t,size:n,className:e})),ref:s,...r}));$t.displayName="ChatButton";function Hr(){return h.jsx("span",{"aria-hidden":"true","data-testid":"chat-stop-icon",className:"block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]"})}function qu(e){var i;const{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:s}=Rt;return h.jsxs("div",{className:"flex flex-col items-end gap-1",children:[(i=e.sendError)!=null&&i.trim()?h.jsx("div",{className:"max-w-[420px] text-right text-[11px] text-red-600",children:e.sendError}):null,h.jsx("div",{className:"flex items-center gap-2",children:e.isSending?e.canStopGeneration?h.jsx($t,{size:"icon",variant:"outline",className:"h-8 w-8 rounded-full","aria-label":e.stopButtonLabel,onClick:()=>void e.onStop(),disabled:e.stopDisabled,children:h.jsx(Hr,{})}):h.jsx(r,{children:h.jsxs(t,{children:[h.jsx(s,{asChild:!0,children:h.jsx("span",{children:h.jsx($t,{size:"icon",variant:"outline",className:"h-8 w-8 rounded-full","aria-label":e.stopButtonLabel,disabled:!0,children:h.jsx(Hr,{})})})}),h.jsx(n,{side:"top",children:h.jsx("p",{className:"text-xs",children:e.stopHint})})]})}):h.jsx($t,{size:"icon",className:"h-8 w-8 rounded-full","aria-label":e.sendButtonLabel,onClick:()=>void e.onSend(),disabled:e.sendDisabled,children:h.jsx(el,{className:"h-5 w-5"})})})]})}function Wu(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>[r.label,r.key,r.description].filter(i=>typeof i=="string"&&i.trim().length>0).join(" ").toLowerCase().includes(n)):e}function Gu(e){const{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:s}=Rt,{picker:i}=e,o=k.useRef(null),a=k.useId(),[l,u]=k.useState(""),[c,d]=k.useState(0),p=k.useMemo(()=>new Set(i.selectedKeys),[i.selectedKeys]),f=i.selectedKeys.length,m=k.useMemo(()=>Wu(i.options,l),[i.options,l]);k.useEffect(()=>{d(0)},[l]),k.useEffect(()=>{d(g=>m.length===0?0:Math.min(g,m.length-1))},[m.length]),Vi({containerRef:o,activeIndex:c,itemCount:m.length,isEnabled:m.length>0,getItemSelector:g=>`[data-skill-index="${g}"]`});const y=g=>{if(p.has(g)){i.onSelectedKeysChange(i.selectedKeys.filter(v=>v!==g));return}i.onSelectedKeysChange([...i.selectedKeys,g])},x=g=>{if(m.length!==0){if(g.key==="ArrowDown"){g.preventDefault(),d(v=>Math.min(v+1,m.length-1));return}if(g.key==="ArrowUp"){g.preventDefault(),d(v=>Math.max(v-1,0));return}if(g.key==="Enter"){g.preventDefault();const v=m[c];v&&y(v.key)}}};return h.jsxs(n,{children:[h.jsx(s,{asChild:!0,children:h.jsxs("button",{type:"button","aria-haspopup":"listbox",className:"inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900",children:[h.jsx(ir,{className:"h-4 w-4"}),h.jsx("span",{children:i.title}),f>0?h.jsx("span",{className:"ml-0.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary",children:f}):null]})}),h.jsxs(r,{side:"top",align:"start",className:"w-[360px] p-0",children:[h.jsxs("div",{className:"space-y-2 border-b border-gray-100 px-4 py-3",children:[h.jsx("div",{className:"text-sm font-semibold text-gray-900",children:i.title}),h.jsxs("div",{className:"relative",children:[h.jsx(or,{className:"pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400"}),h.jsx(t,{value:l,onChange:g=>u(g.target.value),onKeyDown:x,placeholder:i.searchPlaceholder,role:"combobox","aria-controls":a,"aria-expanded":"true","aria-autocomplete":"list","aria-activedescendant":m[c]?`${a}-option-${c}`:void 0,className:"h-8 rounded-lg pl-8 text-xs"})]})]}),h.jsx("div",{ref:o,id:a,role:"listbox","aria-multiselectable":"true",className:"custom-scrollbar max-h-[320px] overflow-y-auto",children:i.isLoading?h.jsx("div",{className:"p-4 text-xs text-gray-500",children:i.loadingLabel}):m.length===0?h.jsx("div",{className:"p-4 text-center text-xs text-gray-500",children:i.emptyLabel}):h.jsx("div",{className:"py-1",children:m.map((g,v)=>{const w=p.has(g.key),I=v===c;return h.jsxs("button",{type:"button",id:`${a}-option-${v}`,role:"option","aria-selected":w,"data-skill-index":v,onClick:()=>y(g.key),onMouseEnter:()=>d(v),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${I?"bg-gray-50":"hover:bg-gray-50"}`,children:[h.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500",children:h.jsx(tl,{className:"h-4 w-4"})}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"truncate text-sm text-gray-900",children:g.label}),g.badgeLabel?h.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:g.badgeLabel}):null]}),h.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-500",children:g.description||g.key})]}),h.jsx("div",{className:"ml-3 shrink-0",children:h.jsx("span",{className:w?"inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white":"inline-flex h-5 w-5 items-center justify-center rounded-full border border-gray-300 bg-white",children:w?h.jsx(sr,{className:"h-3 w-3"}):null})})]},g.key)})})}),i.manageHref&&i.manageLabel?h.jsx("div",{className:"border-t border-gray-100 px-4 py-2.5",children:h.jsxs("a",{href:i.manageHref,className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80",children:[i.manageLabel,h.jsx(nl,{className:"h-3 w-3"})]})}):null]})]})}function Zi({icon:e}){return e==="sparkles"?h.jsx(sl,{className:"h-3.5 w-3.5 shrink-0 text-primary"}):e==="brain"?h.jsx(il,{className:"h-3.5 w-3.5 shrink-0 text-gray-500"}):null}function Qu({icon:e}){return e==="paperclip"?h.jsx(rl,{className:"h-4 w-4"}):h.jsx(Zi,{icon:e})}function Xu(e){return e==="model"?"min-w-[220px]":e==="session-type"?"min-w-[140px]":e==="thinking"?"min-w-[150px]":""}function Yu(e){return e==="model"?"w-[320px]":e==="session-type"?"w-[220px]":e==="thinking"?"w-[180px]":""}function Ju({item:e}){const{Select:t,SelectContent:n,SelectItem:r,SelectTrigger:s,SelectValue:i}=Rt;return h.jsxs(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[h.jsx(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-3 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 ${Xu(e.key)}`,children:e.selectedLabel?h.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-left",children:[h.jsx(Zi,{icon:e.icon}),h.jsx("span",{className:"truncate text-xs font-semibold text-gray-700",children:e.selectedLabel})]}):e.loading?h.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-gray-200"}):h.jsx(i,{placeholder:e.placeholder})}),h.jsxs(n,{className:Yu(e.key),children:[e.options.length===0?e.loading?h.jsxs("div",{className:"space-y-2 px-3 py-2",children:[h.jsx("div",{className:"h-3 w-36 animate-pulse rounded bg-gray-200"}),h.jsx("div",{className:"h-3 w-28 animate-pulse rounded bg-gray-200"}),h.jsx("div",{className:"h-3 w-32 animate-pulse rounded bg-gray-200"})]}):e.emptyLabel?h.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:e.emptyLabel}):null:null,e.options.map(o=>h.jsx(r,{value:o.value,className:"py-2",children:o.description?h.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h.jsx("span",{className:"truncate text-xs font-semibold text-gray-800",children:o.label}),h.jsx("span",{className:"truncate text-[11px] text-gray-500",children:o.description})]}):h.jsx("span",{className:"truncate text-xs font-semibold text-gray-800",children:o.label})},o.value))]})]})}function Zu(e){var i;const{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:s}=Rt;return h.jsxs("div",{className:"flex items-center justify-between px-3 pb-3",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[e.skillPicker?h.jsx(Gu,{picker:e.skillPicker}):null,e.selects.map(o=>h.jsx(Ju,{item:o},o.key)),(i=e.accessories)==null?void 0:i.map(o=>{const a=h.jsxs("button",{type:"button",className:`inline-flex items-center rounded-lg py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:text-gray-400 ${o.iconOnly?"h-8 w-8 justify-center px-0":"gap-1.5 px-3"}`,onClick:o.onClick,disabled:o.disabled,"aria-label":o.label,children:[h.jsx(Qu,{icon:o.icon}),o.iconOnly?null:h.jsx("span",{children:o.label})]});if(!o.tooltip)return h.jsx("div",{children:a},o.key);const l=o.disabled?h.jsx("span",{className:"inline-flex",children:a}):a;return h.jsx(r,{children:h.jsxs(t,{children:[h.jsx(s,{asChild:!0,children:l}),h.jsx(n,{side:"top",children:h.jsx("p",{className:"text-xs",children:o.tooltip})})]})},o.key)})]}),h.jsx(qu,{...e.actions})]})}const ec="";function eo(){return`composer-${Math.random().toString(36).slice(2,10)}`}function Ct(e=""){return{id:eo(),type:"text",text:e}}function hr(e){return{id:eo(),type:"token",tokenKind:e.tokenKind,tokenKey:e.tokenKey,label:e.label}}function Et(e){return e.type==="text"?e.text.length:1}function fr(){return[Ct("")]}function tc(e){return[Ct(e)]}function ut(e){const t=[];for(const n of e){if(n.type==="text"){if(n.text.length===0)continue;const r=t[t.length-1];if((r==null?void 0:r.type)==="text"){t[t.length-1]={...r,text:r.text+n.text};continue}}t.push(n)}return t.length===0?fr():t}function nc(e){return e.map(t=>t.type==="text"?t.text:ec).join("")}function rc(e){return e.filter(t=>t.type==="text").map(t=>t.text).join("")}function pr(e,t){const n=[],r=new Set;for(const s of e)s.type!=="token"||s.tokenKind!==t||r.has(s.tokenKey)||(r.add(s.tokenKey),n.push(s.tokenKey));return n}function sc(e,t,n,r){const s=Math.max(0,n-t),i=Math.max(0,t+e.text.length-r),o=[];return s>0&&o.push({...e,text:e.text.slice(0,s)}),i>0&&o.push({...e,text:e.text.slice(e.text.length-i)}),o}function ic(e,t,n,r){return t<=n||e>=r}function oc(e,t,n,r,s){return!n&&r>=s?(e.push(...t),!0):n}function ac(e,t,n,r,s,i,o){const a=sc(t,n,r,s);a[0]&&e.push(a[0]);let l=o;return l||(e.push(...i),l=!0),a[1]&&e.push(a[1]),l}function lc(e,t,n,r,s,i){return!r&&s<=i?(e.push(...n),!0):(e.push(t),r)}function on(e,t,n,r){const s=Math.max(0,t),i=Math.max(s,n),o=[];let a=0,l=!1;for(const u of e){const c=Et(u),d=a,p=a+c;if(ic(d,p,s,i)){l=oc(o,r,l,d,i),o.push(u),a=p;continue}u.type==="text"?l=ac(o,u,d,s,i,r,l):l=lc(o,u,r,l,s,d),a=p}return l||o.push(...r),ut(o)}function to(e,t){return ut(e.filter(n=>n.type!=="token"||!t(n)))}function uc(e,t){if(!t||t.start!==t.end)return null;const n=nc(e),r=t.end,s=n.slice(0,r),i=/(?:^|\s)\/([^\s\uFFFC]*)$/.exec(s);if(!i)return null;const o=r-i[0].length+(i[0].startsWith("/")?0:1);return{query:(i[1]??"").trim().toLowerCase(),start:o,end:r}}function cc(e,t,n){return e?e.start<n&&e.end>t:!1}function no(e){const t=new Map;let n=0;for(const r of e)t.set(r.id,n),n+=Et(r);return t}function ro(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n?Array.prototype.indexOf.call(e.childNodes,n):e.childNodes.length}function dc(e,t,n){if(e instanceof HTMLElement){const r=e.dataset.composerNodeId;if(r)return n.find(s=>s.id===r)}return n[t]}function so(e,t,n){let r=0;for(let s=0;s<n;s+=1){const i=dc(e.childNodes[s],s,t);i&&(r+=Et(i))}return r}function hc(e,t,n,r){var a;const s=ro(e,t),i=so(e,r,s),o=r[s];return(o==null?void 0:o.type)==="text"?i+Math.min(n,o.text.length):i+Math.min(n,((a=t.textContent)==null?void 0:a.length)??0)}function fc(e,t,n,r,s){return n.type==="text"?e.nodeType===Node.TEXT_NODE?r+Math.min(t,n.text.length):e===s?r+(t>0?n.text.length:0):r+n.text.length:e===s?r+(t>0?1:0):r+1}function On(e,t,n,r,s){var u;if(t===e)return so(e,r,n);if(t.nodeType===Node.TEXT_NODE&&t.parentNode===e)return hc(e,t,n,r);const i=t instanceof HTMLElement?t.closest("[data-composer-node-id]"):((u=t.parentElement)==null?void 0:u.closest("[data-composer-node-id]"))??null;if(!(i instanceof HTMLElement)){const c=ro(e,t);return On(e,e,c,r,s)}const o=i.dataset.composerNodeId;if(!o)return 0;const a=r.find(c=>c.id===o),l=s.get(o)??0;return a?fc(t,n,a,l,i):l}function io(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(!e.contains(r.startContainer)||!e.contains(r.endContainer))return null;const s=no(t),i=On(e,r.startContainer,r.startOffset,t,s),o=On(e,r.endContainer,r.endOffset,t,s);return{start:Math.min(i,o),end:Math.max(i,o)}}function pc(e,t,n){if(!n)return;const r=window.getSelection();if(!r)return;const s=l=>{let u=0;for(let c=0;c<t.length;c+=1){const d=t[c],p=Et(d),f=u,m=u+p,y=e.childNodes[c];if(!y){u=m;continue}if(d.type==="text"){if(l<=m)return{container:y.firstChild??y,offset:Math.max(0,Math.min(l-f,d.text.length))}}else{if(l<=f)return{container:e,offset:c};if(l<=m)return{container:e,offset:c+1}}u=m}return{container:e,offset:e.childNodes.length}},i=s(n.start),o=s(n.end),a=document.createRange();a.setStart(i.container,i.offset),a.setEnd(o.container,o.offset),r.removeAllRanges(),r.addRange(a)}function gc(e){const t=[];for(const n of Array.from(e.childNodes)){if(n.nodeType===Node.TEXT_NODE){t.push(Ct(n.textContent??""));continue}if(!(n instanceof HTMLElement))continue;if(n.dataset.composerNodeType==="token"){const i=n.dataset.composerTokenKind,o=n.dataset.composerTokenKey,a=n.dataset.composerLabel;i&&o&&a&&t.push({id:n.dataset.composerNodeId??hr({tokenKind:i,tokenKey:o,label:a}).id,type:"token",tokenKind:i,tokenKey:o,label:a});continue}const s=n.textContent??"";t.push({id:n.dataset.composerNodeId??Ct(s).id,type:"text",text:s})}return ut(t)}function qr(e){const t=gc(e);return{nodes:t,selection:io(e,t)}}class mc{constructor(){this.nodes=fr(),this.selection=null,this.sync=(t,n)=>(this.nodes=ut(t),this.selection=n,this.getSnapshot()),this.setSelection=t=>(this.selection=t,this.getSnapshot()),this.replaceDocument=(t,n)=>(this.nodes=ut(t),this.selection=n,this.getSnapshot()),this.insertText=t=>{const n=this.selection??{start:0,end:0};this.nodes=on(this.nodes,n.start,n.end,[Ct(t)]);const r=n.start+t.length;return this.selection={start:r,end:r},this.getSnapshot()},this.insertSkillToken=(t,n)=>{var a,l;if(this.getSelectedSkillKeys().includes(t))return this.getSnapshot();const r=this.getSlashTrigger(),s=this.getDocumentLength(),i=(r==null?void 0:r.start)??((a=this.selection)==null?void 0:a.start)??s,o=(r==null?void 0:r.end)??((l=this.selection)==null?void 0:l.end)??i;return this.nodes=on(this.nodes,i,o,[hr({tokenKind:"skill",tokenKey:t,label:n})]),this.selection={start:i+1,end:i+1},this.getSnapshot()},this.syncSelectedSkills=(t,n)=>{const r=this.getSelectedSkillKeys(),s=new Map(n.map(a=>[a.key,a])),i=t.find(a=>!r.includes(a));if(i){const a=s.get(i);return this.insertSkillToken(i,(a==null?void 0:a.label)??i)}const o=r.find(a=>!t.includes(a));return o&&(this.nodes=to(this.nodes,a=>a.tokenKind==="skill"&&a.tokenKey===o)),this.getSnapshot()},this.deleteContent=t=>{const n=this.getDocumentLength(),r=this.selection??{start:n,end:n};let s=r.start,i=r.end;if(r.start===r.end)if(t==="backward"&&r.start>0)s=r.start-1;else if(t==="forward")i=r.end+1;else return this.getSnapshot();return this.nodes=on(this.nodes,s,i,[]),this.selection={start:s,end:s},this.getSnapshot()},this.getSnapshot=()=>({nodes:this.nodes,selection:this.selection,nodeStartMap:no(this.nodes),documentLength:this.getDocumentLength(),selectedSkillKeys:this.getSelectedSkillKeys(),slashTrigger:this.getSlashTrigger()}),this.getDocumentLength=()=>this.nodes.reduce((t,n)=>t+Et(n),0),this.getSelectedSkillKeys=()=>pr(this.nodes,"skill"),this.getSlashTrigger=()=>uc(this.nodes,this.selection)}}function yc(e){const{key:t,shiftKey:n,isComposing:r,isSlashMenuOpen:s,slashItemCount:i,activeSlashIndex:o,isSending:a,canStopGeneration:l}=e;if(s&&i>0){if(t==="ArrowDown")return{type:"move-slash-index",index:(o+1)%i};if(t==="ArrowUp")return{type:"move-slash-index",index:(o-1+i)%i};if(t==="Enter"&&!n||t==="Tab")return{type:"insert-active-slash-item"}}return t==="Escape"?s?{type:"close-slash"}:a&&l?{type:"stop-generation"}:{type:"noop"}:t==="Enter"&&n?{type:"insert-line-break"}:t==="Enter"?{type:"send-message"}:!r&&(t==="Backspace"||t==="Delete")?{type:"delete-content",direction:t==="Backspace"?"backward":"forward"}:{type:"noop"}}const Wr="http://www.w3.org/2000/svg";class xc{constructor(){this.render=(t,n)=>{if(!t)return;const r=document.createDocumentFragment();for(const s of n.nodes){const i=s.type==="text"?this.createTextNodeElement(s):this.createTokenNodeElement(s,n.selectedRange,n.nodeStartMap);i&&r.appendChild(i)}t.replaceChildren(r)},this.createTextNodeElement=t=>{if(t.text.length===0)return null;const n=document.createElement("span");return n.dataset.composerNodeId=t.id,n.dataset.composerNodeType="text",n.textContent=t.text,n},this.createTokenNodeElement=(t,n,r)=>{const s=r.get(t.id)??0,i=cc(n,s,s+1),o=document.createElement("span");o.contentEditable="false",o.dataset.composerNodeId=t.id,o.dataset.composerNodeType="token",o.dataset.composerTokenKind=t.tokenKind,o.dataset.composerTokenKey=t.tokenKey,o.dataset.composerLabel=t.label,o.className=["mx-[2px]","inline-flex","h-6","max-w-full","items-center","gap-1","rounded-md","border","px-1.5","align-baseline","text-[11px]","font-medium","transition",i?"border-primary/30 bg-primary/18 text-primary":"border-primary/12 bg-primary/8 text-primary"].join(" "),o.append(this.createTokenIcon(t.tokenKind));const a=document.createElement("span");return a.className="truncate",a.textContent=t.label,o.append(a),o},this.createTokenIcon=t=>{const n=document.createElement("span");return n.className="inline-flex h-3 w-3 shrink-0 items-center justify-center text-primary/70",n.append(t==="file"?this.createFileIcon():this.createSkillIcon()),n},this.createSkillIcon=()=>this.createSvgIcon([{tag:"path",attrs:{d:"M8.5 2.75 2.75 6l5.75 3.25L14.25 6 8.5 2.75Z"}},{tag:"path",attrs:{d:"M2.75 10 8.5 13.25 14.25 10"}},{tag:"path",attrs:{d:"M2.75 6v4l5.75 3.25V9.25L2.75 6Z"}},{tag:"path",attrs:{d:"M14.25 6v4L8.5 13.25V9.25L14.25 6Z"}}]),this.createFileIcon=()=>this.createSvgIcon([{tag:"path",attrs:{d:"M5.25 2.75h4.5L13 6v7.25A1.75 1.75 0 0 1 11.25 15h-6.5A1.75 1.75 0 0 1 3 13.25v-8.75A1.75 1.75 0 0 1 4.75 2.75Z"}},{tag:"path",attrs:{d:"M9.75 2.75V6H13"}},{tag:"path",attrs:{d:"M5.75 8.75h4.5"}},{tag:"path",attrs:{d:"M5.75 10.75h4.5"}}]),this.createSvgIcon=t=>{const n=document.createElementNS(Wr,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.25"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("class","h-3 w-3");for(const r of t){const s=document.createElementNS(Wr,r.tag);for(const[i,o]of Object.entries(r.attrs))s.setAttribute(i,o);n.append(s)}return n}}}const Gr=188;class bc{constructor(t){this.controller=t,this.surfaceRenderer=new xc,this.sync=(n,r)=>this.controller.sync(n,r),this.syncSelectionFromRoot=n=>this.controller.setSelection(io(n,this.controller.getSnapshot().nodes)),this.restoreSelectionIfFocused=(n,r)=>{!n||document.activeElement!==n||pc(n,this.controller.getSnapshot().nodes,r)},this.syncViewport=n=>{n&&(n.style.maxHeight=`${Gr}px`,n.style.overflowY=n.scrollHeight>Gr?"auto":"hidden")},this.renderSurface=n=>{this.surfaceRenderer.render(n.root,{nodes:n.snapshot.nodes,selectedRange:n.selectedRange,nodeStartMap:n.snapshot.nodeStartMap})},this.insertSlashItem=(n,r)=>{n.value&&r(this.controller.insertSkillToken(n.value,n.title))},this.syncSelectedSkills=(n,r,s)=>{s(this.controller.syncSelectedSkills(n,r))},this.handleBeforeInput=n=>{const{event:r,disabled:s,isComposing:i,commitSnapshot:o}=n,a=r.nativeEvent;s||i||a.isComposing||!(a.inputType==="insertText"||a.inputType==="insertReplacementText")||!a.data||(r.preventDefault(),o(this.controller.insertText(a.data)))},this.handleInput=n=>{const{event:r,isComposing:s,commitSnapshot:i}=n,o=r.nativeEvent;if(s||o.isComposing)return;const a=r.currentTarget,l=qr(a);i(this.controller.replaceDocument(l.nodes,l.selection))},this.handleCompositionEnd=n=>{const{event:r,commitSnapshot:s}=n,i=r.currentTarget,o=qr(i);s(this.controller.replaceDocument(o.nodes,o.selection))},this.handleKeyDown=n=>{const{event:r,slashItems:s,activeSlashIndex:i,activeSlashItem:o,actions:a,commitSnapshot:l,insertSkillToken:u,onSlashActiveIndexChange:c,onSlashQueryChange:d,onSlashOpenChange:p}=n,f=this.controller.getSnapshot(),m=yc({key:r.key,shiftKey:r.shiftKey,isComposing:r.nativeEvent.isComposing,isSlashMenuOpen:f.slashTrigger!==null,slashItemCount:s.length,activeSlashIndex:i,isSending:a.isSending,canStopGeneration:a.canStopGeneration});if(m.type!=="noop"){if(r.preventDefault(),m.type==="move-slash-index"){c(m.index);return}if(m.type==="insert-active-slash-item"){o&&u(o.value??o.key,o.title);return}if(m.type==="close-slash"){d==null||d(null),p(!1);return}if(m.type==="stop-generation"){a.onStop();return}if(m.type==="insert-line-break"){l(this.controller.insertText(`
2
2
  `));return}if(m.type==="send-message"){a.onSend();return}m.type==="delete-content"&&l(this.controller.deleteContent(m.direction))}},this.handlePaste=n=>{const{event:r,commitSnapshot:s}=n,i=r.clipboardData.getData("text/plain");i&&(r.preventDefault(),s(this.controller.insertText(i)))},this.handleBlur=n=>{const{setSelectedRange:r,onSlashQueryChange:s,onSlashOpenChange:i}=n;r(null),s==null||s(null),i(!1)}}}class Sc{constructor(){this.controller=new mc,this.viewController=new bc(this.controller),this.rootElement=null,this.selection=null,this.selectedRange=null,this.snapshot=this.controller.getSnapshot(),this.config=null,this.isComposing=!1,this.bindRootElement=t=>{this.rootElement=t},this.update=t=>(this.config=t,this.snapshot=this.viewController.sync(t.nodes,this.selectedRange),{snapshot:this.snapshot,selectedRange:this.selectedRange,bindRootElement:this.bindRootElement,handleBeforeInput:this.handleBeforeInput,handleInput:this.handleInput,handleCompositionStart:this.handleCompositionStart,handleCompositionEnd:this.handleCompositionEnd,handleKeyDown:this.handleKeyDown,handlePaste:this.handlePaste,handleBlur:this.handleBlur,syncSelectionState:this.syncSelectionState,imperativeHandle:this.createHandle()}),this.createHandle=()=>({insertSlashItem:t=>{this.viewController.insertSlashItem(t,this.commitSnapshot)},syncSelectedSkills:(t,n)=>{this.viewController.syncSelectedSkills(t,n,this.commitSnapshot)}}),this.restoreDomAfterCommit=()=>{this.isComposing||this.viewController.restoreSelectionIfFocused(this.rootElement,this.selection)},this.renderSurface=()=>{this.isComposing||this.viewController.renderSurface({root:this.rootElement,snapshot:this.snapshot,selectedRange:this.selectedRange})},this.syncViewport=()=>{this.viewController.syncViewport(this.rootElement)},this.syncSelectionState=()=>{if(!this.rootElement||this.isComposing)return;const t=this.viewController.syncSelectionFromRoot(this.rootElement);this.selection=t.selection,this.selectedRange=t.selection,this.syncSlashState(t),this.requestRender()},this.handleBeforeInput=t=>{this.viewController.handleBeforeInput({event:t,disabled:this.requireConfig().disabled,isComposing:this.isComposing,commitSnapshot:this.commitSnapshot})},this.handleInput=t=>{this.viewController.handleInput({event:t,isComposing:this.isComposing,commitSnapshot:this.commitSnapshot})},this.handleCompositionStart=()=>{this.isComposing=!0},this.handleCompositionEnd=t=>{this.isComposing=!1,this.viewController.handleCompositionEnd({event:t,commitSnapshot:this.commitSnapshot})},this.handleKeyDown=t=>{const n=this.requireConfig(),r=n.slashItems[n.activeSlashIndex]??null;this.viewController.handleKeyDown({event:t,slashItems:n.slashItems,activeSlashIndex:n.activeSlashIndex,activeSlashItem:r,actions:n.actions,commitSnapshot:this.commitSnapshot,insertSkillToken:this.insertSkillToken,onSlashActiveIndexChange:n.onSlashActiveIndexChange,onSlashQueryChange:n.onSlashQueryChange,onSlashOpenChange:n.onSlashOpenChange})},this.handlePaste=t=>{this.viewController.handlePaste({event:t,commitSnapshot:this.commitSnapshot})},this.handleBlur=()=>{const t=this.requireConfig();this.isComposing=!1,this.viewController.handleBlur({setSelectedRange:this.setSelectedRange,onSlashQueryChange:t.onSlashQueryChange,onSlashOpenChange:t.onSlashOpenChange})},this.setSelectedRange=t=>{this.selectedRange=t,this.selection=t,this.requestRender()},this.commitSnapshot=t=>{const n=this.requireConfig();this.selection=t.selection,this.selectedRange=t.selection,this.snapshot=t,n.onNodesChange(t.nodes),this.syncSlashState(t)},this.insertSkillToken=(t,n)=>{this.commitSnapshot(this.controller.insertSkillToken(t,n))},this.syncSlashState=t=>{var r,s;const n=this.requireConfig();(s=n.onSlashQueryChange)==null||s.call(n,((r=t.slashTrigger)==null?void 0:r.query)??null),n.onSlashOpenChange(t.slashTrigger!==null)},this.requestRender=()=>{this.requireConfig().requestRender()},this.requireConfig=()=>{if(!this.config)throw new Error("ChatComposerRuntime is not configured.");return this.config}}}const kc=k.forwardRef(function(t,n){const{nodes:r,placeholder:s,disabled:i,slashItems:o,actions:a,onNodesChange:l,onSlashQueryChange:u,onSlashOpenChange:c,onSlashActiveIndexChange:d,activeSlashIndex:p}=t,[f,m]=k.useState(0),[y]=k.useState(()=>new Sc),{snapshot:x,bindRootElement:g,handleBeforeInput:v,handleInput:w,handleCompositionStart:I,handleCompositionEnd:L,handleKeyDown:T,handlePaste:_,handleBlur:F,syncSelectionState:z,imperativeHandle:C}=y.update({nodes:r,disabled:i,slashItems:o,actions:a,onNodesChange:l,onSlashQueryChange:u,onSlashOpenChange:c,onSlashActiveIndexChange:d,activeSlashIndex:p,requestRender:()=>m(j=>j+1)});return k.useImperativeHandle(n,()=>C,[C]),k.useLayoutEffect(()=>{y.renderSurface(),y.restoreDomAfterCommit(),y.syncViewport()},[y,x.nodes,x.nodeStartMap,f]),h.jsx("div",{className:"px-4 py-2.5",children:h.jsx("div",{className:"min-h-[60px]",children:h.jsx("div",{ref:g,contentEditable:!i,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","data-placeholder":s,onBeforeInput:v,onInput:w,onCompositionStart:I,onCompositionEnd:L,onKeyDown:T,onKeyUp:z,onMouseUp:z,onFocus:z,onBlur:F,onPaste:_,className:"min-h-7 max-h-[188px] w-full overflow-y-auto whitespace-pre-wrap break-words bg-transparent py-0.5 text-sm leading-6 text-gray-800 outline-none empty:before:pointer-events-none empty:before:text-gray-400 empty:before:content-[attr(data-placeholder)]"})})})});function vc({hint:e}){if(!e)return null;if(e.loading)return h.jsx("div",{className:"px-4 pb-2",children:h.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2",children:[h.jsx("span",{className:"h-3 w-28 animate-pulse rounded bg-gray-200"}),h.jsx("span",{className:"h-3 w-16 animate-pulse rounded bg-gray-200"})]})});const t=e.tone==="warning"?"border-amber-200 bg-amber-50 text-amber-800":"border-gray-200 bg-gray-50 text-gray-700";return h.jsx("div",{className:"px-4 pb-2",children:h.jsxs("div",{className:`inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs ${t}`,children:[e.text?h.jsx("span",{children:e.text}):null,e.actionLabel&&e.onAction?h.jsx("button",{type:"button",onClick:e.onAction,className:"font-semibold underline-offset-2 hover:underline",children:e.actionLabel}):null]})})}function wc(e){const t=k.useRef(null),[n,r]=k.useState(null),[s,i]=k.useState(0),o=n!==null,a=e.slashMenu.items[s]??null;k.useEffect(()=>{i(u=>e.slashMenu.items.length===0?0:Math.min(u,e.slashMenu.items.length-1))},[e.slashMenu.items.length]),k.useEffect(()=>{n!==null&&i(0)},[n]);const l=k.useMemo(()=>e.toolbar.skillPicker?{...e.toolbar,skillPicker:{...e.toolbar.skillPicker,onSelectedKeysChange:u=>{var c,d;(d=t.current)==null||d.syncSelectedSkills(u,((c=e.toolbar.skillPicker)==null?void 0:c.options)??[])}}}:e.toolbar,[e.toolbar]);return h.jsx("div",{className:"border-t border-gray-200/80 bg-white p-4",children:h.jsx("div",{className:"mx-auto w-full max-w-[min(1120px,100%)]",children:h.jsxs("div",{className:"overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-card",children:[h.jsxs("div",{className:"relative",children:[h.jsx(kc,{ref:t,nodes:e.composer.nodes,placeholder:e.composer.placeholder,disabled:e.composer.disabled,slashItems:e.slashMenu.items,actions:e.toolbar.actions,activeSlashIndex:s,onNodesChange:e.composer.onNodesChange,onSlashQueryChange:u=>{var c,d;r(u),(d=(c=e.composer).onSlashQueryChange)==null||d.call(c,u)},onSlashOpenChange:u=>{u||r(null)},onSlashActiveIndexChange:i}),h.jsx(Vu,{isOpen:o,isLoading:e.slashMenu.isLoading,items:e.slashMenu.items,activeIndex:s,activeItem:a,texts:e.slashMenu.texts,onSelectItem:u=>{var c;(c=t.current)==null||c.insertSlashItem(u)},onOpenChange:u=>{u||r(null)},onSetActiveIndex:i})]}),h.jsx(vc,{hint:e.hint}),h.jsx(Zu,{...l})]})})})}function an({role:e}){return e==="user"?h.jsx("div",{"data-testid":"chat-message-avatar-user",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-white shadow-sm",children:h.jsx(ol,{className:"h-4 w-4"})}):e==="tool"?h.jsx("div",{"data-testid":"chat-message-avatar-tool",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-700 shadow-sm",children:h.jsx(xi,{className:"h-4 w-4"})}):h.jsx("div",{"data-testid":"chat-message-avatar-assistant",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200/80 bg-gray-900 text-white shadow-sm",children:h.jsx(bi,{className:"h-4 w-4"})})}function Cc(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Tc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ic=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Mc={};function Qr(e,t){return(Mc.jsx?Ic:Tc).test(e)}const Rc=/[ \t\n\f\r]/g;function Ec(e){return typeof e=="object"?e.type==="text"?Xr(e.value):!1:Xr(e)}function Xr(e){return e.replace(Rc,"")===""}class At{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}At.prototype.normal={};At.prototype.property={};At.prototype.space=void 0;function oo(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new At(n,r,t)}function Fn(e){return e.toLowerCase()}class ve{constructor(t,n){this.attribute=n,this.property=t}}ve.prototype.attribute="";ve.prototype.booleanish=!1;ve.prototype.boolean=!1;ve.prototype.commaOrSpaceSeparated=!1;ve.prototype.commaSeparated=!1;ve.prototype.defined=!1;ve.prototype.mustUseProperty=!1;ve.prototype.number=!1;ve.prototype.overloadedBoolean=!1;ve.prototype.property="";ve.prototype.spaceSeparated=!1;ve.prototype.space=void 0;let Ac=0;const H=tt(),oe=tt(),zn=tt(),A=tt(),ee=tt(),at=tt(),Te=tt();function tt(){return 2**++Ac}const Bn=Object.freeze(Object.defineProperty({__proto__:null,boolean:H,booleanish:oe,commaOrSpaceSeparated:Te,commaSeparated:at,number:A,overloadedBoolean:zn,spaceSeparated:ee},Symbol.toStringTag,{value:"Module"})),ln=Object.keys(Bn);class gr extends ve{constructor(t,n,r,s){let i=-1;if(super(t,n),Yr(this,"space",s),typeof r=="number")for(;++i<ln.length;){const o=ln[i];Yr(this,ln[i],(r&Bn[o])===Bn[o])}}}gr.prototype.defined=!0;function Yr(e,t,n){n&&(e[t]=n)}function dt(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new gr(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Fn(r)]=r,n[Fn(i.attribute)]=r}return new At(t,n,e.space)}const ao=dt({properties:{ariaActiveDescendant:null,ariaAtomic:oe,ariaAutoComplete:null,ariaBusy:oe,ariaChecked:oe,ariaColCount:A,ariaColIndex:A,ariaColSpan:A,ariaControls:ee,ariaCurrent:null,ariaDescribedBy:ee,ariaDetails:null,ariaDisabled:oe,ariaDropEffect:ee,ariaErrorMessage:null,ariaExpanded:oe,ariaFlowTo:ee,ariaGrabbed:oe,ariaHasPopup:null,ariaHidden:oe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ee,ariaLevel:A,ariaLive:null,ariaModal:oe,ariaMultiLine:oe,ariaMultiSelectable:oe,ariaOrientation:null,ariaOwns:ee,ariaPlaceholder:null,ariaPosInSet:A,ariaPressed:oe,ariaReadOnly:oe,ariaRelevant:null,ariaRequired:oe,ariaRoleDescription:ee,ariaRowCount:A,ariaRowIndex:A,ariaRowSpan:A,ariaSelected:oe,ariaSetSize:A,ariaSort:null,ariaValueMax:A,ariaValueMin:A,ariaValueNow:A,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function lo(e,t){return t in e?e[t]:t}function uo(e,t){return lo(e,t.toLowerCase())}const Lc=dt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:at,acceptCharset:ee,accessKey:ee,action:null,allow:null,allowFullScreen:H,allowPaymentRequest:H,allowUserMedia:H,alt:null,as:null,async:H,autoCapitalize:null,autoComplete:ee,autoFocus:H,autoPlay:H,blocking:ee,capture:null,charSet:null,checked:H,cite:null,className:ee,cols:A,colSpan:null,content:null,contentEditable:oe,controls:H,controlsList:ee,coords:A|at,crossOrigin:null,data:null,dateTime:null,decoding:null,default:H,defer:H,dir:null,dirName:null,disabled:H,download:zn,draggable:oe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:H,formTarget:null,headers:ee,height:A,hidden:zn,high:A,href:null,hrefLang:null,htmlFor:ee,httpEquiv:ee,id:null,imageSizes:null,imageSrcSet:null,inert:H,inputMode:null,integrity:null,is:null,isMap:H,itemId:null,itemProp:ee,itemRef:ee,itemScope:H,itemType:ee,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:H,low:A,manifest:null,max:null,maxLength:A,media:null,method:null,min:null,minLength:A,multiple:H,muted:H,name:null,nonce:null,noModule:H,noValidate:H,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:H,optimum:A,pattern:null,ping:ee,placeholder:null,playsInline:H,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:H,referrerPolicy:null,rel:ee,required:H,reversed:H,rows:A,rowSpan:A,sandbox:ee,scope:null,scoped:H,seamless:H,selected:H,shadowRootClonable:H,shadowRootDelegatesFocus:H,shadowRootMode:null,shape:null,size:A,sizes:null,slot:null,span:A,spellCheck:oe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:A,step:null,style:null,tabIndex:A,target:null,title:null,translate:null,type:null,typeMustMatch:H,useMap:null,value:oe,width:A,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ee,axis:null,background:null,bgColor:null,border:A,borderColor:null,bottomMargin:A,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:H,declare:H,event:null,face:null,frame:null,frameBorder:null,hSpace:A,leftMargin:A,link:null,longDesc:null,lowSrc:null,marginHeight:A,marginWidth:A,noResize:H,noHref:H,noShade:H,noWrap:H,object:null,profile:null,prompt:null,rev:null,rightMargin:A,rules:null,scheme:null,scrolling:oe,standby:null,summary:null,text:null,topMargin:A,valueType:null,version:null,vAlign:null,vLink:null,vSpace:A,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:H,disableRemotePlayback:H,prefix:null,property:null,results:A,security:null,unselectable:null},space:"html",transform:uo}),Nc=dt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Te,accentHeight:A,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:A,amplitude:A,arabicForm:null,ascent:A,attributeName:null,attributeType:null,azimuth:A,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:A,by:null,calcMode:null,capHeight:A,className:ee,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:A,diffuseConstant:A,direction:null,display:null,dur:null,divisor:A,dominantBaseline:null,download:H,dx:null,dy:null,edgeMode:null,editable:null,elevation:A,enableBackground:null,end:null,event:null,exponent:A,externalResourcesRequired:null,fill:null,fillOpacity:A,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:at,g2:at,glyphName:at,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:A,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:A,horizOriginX:A,horizOriginY:A,id:null,ideographic:A,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:A,k:A,k1:A,k2:A,k3:A,k4:A,kernelMatrix:Te,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:A,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:A,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:A,overlineThickness:A,paintOrder:null,panose1:null,path:null,pathLength:A,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ee,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:A,pointsAtY:A,pointsAtZ:A,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Te,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Te,rev:Te,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Te,requiredFeatures:Te,requiredFonts:Te,requiredFormats:Te,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:A,specularExponent:A,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:A,strikethroughThickness:A,string:null,stroke:null,strokeDashArray:Te,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:A,strokeOpacity:A,strokeWidth:null,style:null,surfaceScale:A,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Te,tabIndex:A,tableValues:null,target:null,targetX:A,targetY:A,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Te,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:A,underlineThickness:A,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:A,values:null,vAlphabetic:A,vMathematical:A,vectorEffect:null,vHanging:A,vIdeographic:A,version:null,vertAdvY:A,vertOriginX:A,vertOriginY:A,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:A,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:lo}),co=dt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ho=dt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:uo}),fo=dt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Pc={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},jc=/[A-Z]/g,Jr=/-[a-z]/g,Dc=/^data[-\w.:]+$/i;function _c(e,t){const n=Fn(t);let r=t,s=ve;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Dc.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Jr,Fc);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Jr.test(i)){let o=i.replace(jc,Oc);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=gr}return new s(r,t)}function Oc(e){return"-"+e.toLowerCase()}function Fc(e){return e.charAt(1).toUpperCase()}const zc=oo([ao,Lc,co,ho,fo],"html"),mr=oo([ao,Nc,co,ho,fo],"svg");function Bc(e){return e.join(" ").trim()}var rt={},un,Zr;function $c(){if(Zr)return un;Zr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
3
3
  `,u="/",c="*",d="",p="comment",f="declaration";function m(x,g){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];g=g||{};var v=1,w=1;function I(O){var E=O.match(t);E&&(v+=E.length);var U=O.lastIndexOf(l);w=~U?O.length-U:w+O.length}function L(){var O={line:v,column:w};return function(E){return E.position=new T(O),z(),E}}function T(O){this.start=O,this.end={line:v,column:w},this.source=g.source}T.prototype.content=x;function _(O){var E=new Error(g.source+":"+v+":"+w+": "+O);if(E.reason=O,E.filename=g.source,E.line=v,E.column=w,E.source=x,!g.silent)throw E}function F(O){var E=O.exec(x);if(E){var U=E[0];return I(U),x=x.slice(U.length),E}}function z(){F(n)}function C(O){var E;for(O=O||[];E=j();)E!==!1&&O.push(E);return O}function j(){var O=L();if(!(u!=x.charAt(0)||c!=x.charAt(1))){for(var E=2;d!=x.charAt(E)&&(c!=x.charAt(E)||u!=x.charAt(E+1));)++E;if(E+=2,d===x.charAt(E-1))return _("End of comment missing");var U=x.slice(2,E-2);return w+=2,I(U),x=x.slice(E),w+=2,O({type:p,comment:U})}}function N(){var O=L(),E=F(r);if(E){if(j(),!F(s))return _("property missing ':'");var U=F(i),Y=O({type:f,property:y(E[0].replace(e,d)),value:U?y(U[0].replace(e,d)):d});return F(o),Y}}function $(){var O=[];C(O);for(var E;E=N();)E!==!1&&(O.push(E),C(O));return O}return z(),$()}function y(x){return x?x.replace(a,d):d}return un=m,un}var es;function Uc(){if(es)return rt;es=1;var e=rt&&rt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rt,"__esModule",{value:!0}),rt.default=n;const t=e($c());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const o=(0,t.default)(r),a=typeof s=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:c}=l;a?s(u,c,l):c&&(i=i||{},i[u]=c)}),i}return rt}var gt={},ts;function Kc(){if(ts)return gt;ts=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},o=function(u,c){return c.toUpperCase()},a=function(u,c){return"".concat(c,"-")},l=function(u,c){return c===void 0&&(c={}),i(u)?u:(u=u.toLowerCase(),c.reactCompat?u=u.replace(s,a):u=u.replace(r,a),u.replace(t,o))};return gt.camelCase=l,gt}var mt,ns;function Vc(){if(ns)return mt;ns=1;var e=mt&&mt.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Uc()),n=Kc();function r(s,i){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(a,l){a&&l&&(o[(0,n.camelCase)(a,i)]=l)}),o}return r.default=r,mt=r,mt}var Hc=Vc();const qc=Si(Hc),po=go("end"),yr=go("start");function go(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Wc(e){const t=yr(e),n=po(e);if(t&&n)return{start:t,end:n}}function kt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?rs(e.position):"start"in e||"end"in e?rs(e):"line"in e||"column"in e?$n(e):""}function $n(e){return ss(e&&e.line)+":"+ss(e&&e.column)}function rs(e){return $n(e&&e.start)+"-"+$n(e&&e.end)}function ss(e){return e&&typeof e=="number"?e:1}class ge extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=kt(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ge.prototype.file="";ge.prototype.name="";ge.prototype.reason="";ge.prototype.message="";ge.prototype.stack="";ge.prototype.column=void 0;ge.prototype.line=void 0;ge.prototype.ancestors=void 0;ge.prototype.cause=void 0;ge.prototype.fatal=void 0;ge.prototype.place=void 0;ge.prototype.ruleId=void 0;ge.prototype.source=void 0;const xr={}.hasOwnProperty,Gc=new Map,Qc=/[A-Z]/g,Xc=new Set(["table","tbody","thead","tfoot","tr"]),Yc=new Set(["td","th"]),mo="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Jc(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=od(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=id(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?mr:zc,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=yo(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function yo(e,t,n){if(t.type==="element")return Zc(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ed(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return nd(e,t,n);if(t.type==="mdxjsEsm")return td(e,t);if(t.type==="root")return rd(e,t,n);if(t.type==="text")return sd(e,t)}function Zc(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=mr,e.schema=s),e.ancestors.push(t);const i=bo(e,t.tagName,!1),o=ad(e,t);let a=Sr(e,t);return Xc.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Ec(l):!0})),xo(e,o,i,t),br(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function ed(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Tt(e,t.position)}function td(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Tt(e,t.position)}function nd(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=mr,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:bo(e,t.name,!0),o=ld(e,t),a=Sr(e,t);return xo(e,o,i,t),br(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function rd(e,t,n){const r={};return br(r,Sr(e,t)),e.create(t,e.Fragment,r,n)}function sd(e,t){return t.value}function xo(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function br(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function id(e,t,n){return r;function r(s,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function od(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=yr(r);return t(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function ad(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&xr.call(t.properties,s)){const i=ud(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Yc.has(t.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ld(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Tt(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else Tt(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Sr(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Gc;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=s.get(l)||0;o=l+"-"+u,s.set(l,u+1)}}const a=yo(e,i,o);a!==void 0&&n.push(a)}return n}function ud(e,t,n){const r=_c(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Cc(n):Bc(n)),r.property==="style"){let s=typeof n=="object"?n:cd(e,String(n));return e.stylePropertyNameCase==="css"&&(s=dd(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?Pc[r.property]||r.property:r.attribute,n]}}function cd(e,t){try{return qc(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new ge("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=mo+"#cannot-parse-style-attribute",s}}function bo(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const a=Qr(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=Qr(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return xr.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Tt(e)}function Tt(e,t){const n=new ge("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=mo+"#cannot-handle-mdx-estrees-without-createevaluater",n}function dd(e){const t={};let n;for(n in e)xr.call(e,n)&&(t[hd(n)]=e[n]);return t}function hd(e){let t=e.replace(Qc,fd);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function fd(e){return"-"+e.toLowerCase()}const cn={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},pd={};function kr(e,t){const n=pd,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return So(e,r,s)}function So(e,t,n){if(gd(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return is(e.children,t,n)}return Array.isArray(e)?is(e,t,n):""}function is(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=So(e[s],t,n);return r.join("")}function gd(e){return!!(e&&typeof e=="object")}const os=document.createElement("i");function vr(e){const t="&"+e+";";os.innerHTML=t;const n=os.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ie(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Ae(e,t){return e.length>0?(Ie(e,e.length,0,t),e):t}const as={}.hasOwnProperty;function ko(e){const t={};let n=-1;for(;++n<e.length;)md(t,e[n]);return t}function md(e,t){let n;for(n in t){const s=(as.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){as.call(s,o)||(s[o]=[]);const a=i[o];yd(s[o],Array.isArray(a)?a:a?[a]:[])}}}function yd(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ie(e,0,0,r)}function vo(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Pe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ye=Qe(/[A-Za-z]/),pe=Qe(/[\dA-Za-z]/),xd=Qe(/[#-'*+\--9=?A-Z^-~]/);function Ht(e){return e!==null&&(e<32||e===127)}const Un=Qe(/\d/),bd=Qe(/[\dA-Fa-f]/),Sd=Qe(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function Z(e){return e!==null&&(e<0||e===32)}function W(e){return e===-2||e===-1||e===32}const Jt=Qe(new RegExp("\\p{P}|\\p{S}","u")),et=Qe(/\s/);function Qe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ht(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&pe(e.charCodeAt(n+1))&&pe(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function X(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return W(l)?(e.enter(n),a(l)):t(l)}function a(l){return W(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const kd={tokenize:vd};function vd(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),X(e,t,"linePrefix")}function s(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return B(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const wd={tokenize:Cd},ls={tokenize:Td};function Cd(e){const t=this,n=[];let r=0,s,i,o;return a;function a(w){if(r<n.length){const I=n[r];return t.containerState=I[1],e.attempt(I[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const I=t.events.length;let L=I,T;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){T=t.events[L][1].end;break}g(r);let _=I;for(;_<t.events.length;)t.events[_][1].end={...T},_++;return Ie(t.events,L+1,0,t.events.slice(I)),t.events.length=_,u(w)}return a(w)}function u(w){if(r===n.length){if(!s)return p(w);if(s.currentConstruct&&s.currentConstruct.concrete)return m(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ls,c,d)(w)}function c(w){return s&&v(),g(r),p(w)}function d(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(w)}function p(w){return t.containerState={},e.attempt(ls,f,m)(w)}function f(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function m(w){if(w===null){s&&v(),g(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(w)}function y(w){if(w===null){x(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return B(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),y)}function x(w,I){const L=t.sliceStream(w);if(I&&L.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(L),t.parser.lazy[w.start.line]){let T=s.events.length;for(;T--;)if(s.events[T][1].start.offset<o&&(!s.events[T][1].end||s.events[T][1].end.offset>o))return;const _=t.events.length;let F=_,z,C;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(z){C=t.events[F][1].end;break}z=!0}for(g(r),T=_;T<t.events.length;)t.events[T][1].end={...C},T++;Ie(t.events,F+1,0,t.events.slice(_)),t.events.length=T}}function g(w){let I=n.length;for(;I-- >w;){const L=n[I];t.containerState=L[1],L[0].exit.call(t,e)}n.length=w}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Td(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ct(e){if(e===null||Z(e)||et(e))return 1;if(Jt(e))return 2}function Zt(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Kn={name:"attention",resolveAll:Id,tokenize:Md};function Id(e,t){let n=-1,r,s,i,o,a,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[n][1].start};us(d,-l),us(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Ae(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Ae(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Ae(u,Zt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Ae(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Ae(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Ie(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Md(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=ct(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const u=e.exit("attentionSequence"),c=ct(l),d=!c||c===2&&s||n.includes(l),p=!s||s===2&&c||n.includes(r);return u._open=!!(i===42?d:d&&(s||!p)),u._close=!!(i===42?p:p&&(c||!d)),t(l)}}function us(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Rd={name:"autolink",tokenize:Ed};function Ed(e,t,n){let r=0;return s;function s(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return ye(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||pe(f)?(r=1,a(f)):u(f)}function a(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||pe(f))&&r++<32?(e.consume(f),a):(r=0,u(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Ht(f)?n(f):(e.consume(f),l)}function u(f){return f===64?(e.consume(f),c):xd(f)?(e.consume(f),u):n(f)}function c(f){return pe(f)?d(f):n(f)}function d(f){return f===46?(e.consume(f),r=0,c):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||pe(f))&&r++<63){const m=f===45?p:d;return e.consume(f),m}return n(f)}}const Lt={partial:!0,tokenize:Ad};function Ad(e,t,n){return r;function r(i){return W(i)?X(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||B(i)?t(i):n(i)}}const wo={continuation:{tokenize:Nd},exit:Pd,name:"blockQuote",tokenize:Ld};function Ld(e,t,n){const r=this;return s;function s(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return W(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Nd(e,t,n){const r=this;return s;function s(o){return W(o)?X(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(wo,t,n)(o)}}function Pd(e){e.exit("blockQuote")}const Co={name:"characterEscape",tokenize:jd};function jd(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return Sd(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const To={name:"characterReference",tokenize:Dd};function Dd(e,t,n){const r=this;let s=0,i,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=pe,c(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=bd,c):(e.enter("characterReferenceValue"),i=7,o=Un,c(d))}function c(d){if(d===59&&s){const p=e.exit("characterReferenceValue");return o===pe&&!vr(r.sliceSerialize(p))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),c):n(d)}}const cs={partial:!0,tokenize:Od},ds={concrete:!0,name:"codeFenced",tokenize:_d};function _d(e,t,n){const r=this,s={partial:!0,tokenize:L};let i=0,o=0,a;return l;function l(T){return u(T)}function u(T){const _=r.events[r.events.length-1];return i=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,a=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(T)}function c(T){return T===a?(o++,e.consume(T),c):o<3?n(T):(e.exit("codeFencedFenceSequence"),W(T)?X(e,d,"whitespace")(T):d(T))}function d(T){return T===null||B(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(cs,y,I)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||B(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(T)):W(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),X(e,f,"whitespace")(T)):T===96&&T===a?n(T):(e.consume(T),p)}function f(T){return T===null||B(T)?d(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||B(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(T)):T===96&&T===a?n(T):(e.consume(T),m)}function y(T){return e.attempt(s,I,x)(T)}function x(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),g}function g(T){return i>0&&W(T)?X(e,v,"linePrefix",i+1)(T):v(T)}function v(T){return T===null||B(T)?e.check(cs,y,I)(T):(e.enter("codeFlowValue"),w(T))}function w(T){return T===null||B(T)?(e.exit("codeFlowValue"),v(T)):(e.consume(T),w)}function I(T){return e.exit("codeFenced"),t(T)}function L(T,_,F){let z=0;return C;function C(E){return T.enter("lineEnding"),T.consume(E),T.exit("lineEnding"),j}function j(E){return T.enter("codeFencedFence"),W(E)?X(T,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):N(E)}function N(E){return E===a?(T.enter("codeFencedFenceSequence"),$(E)):F(E)}function $(E){return E===a?(z++,T.consume(E),$):z>=o?(T.exit("codeFencedFenceSequence"),W(E)?X(T,O,"whitespace")(E):O(E)):F(E)}function O(E){return E===null||B(E)?(T.exit("codeFencedFence"),_(E)):F(E)}}}function Od(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const dn={name:"codeIndented",tokenize:zd},Fd={partial:!0,tokenize:Bd};function zd(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),X(e,i,"linePrefix",5)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):B(u)?e.attempt(Fd,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||B(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function Bd(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):X(e,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):B(o)?s(o):n(o)}}const $d={name:"codeText",previous:Kd,resolve:Ud,tokenize:Vd};function Ud(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function Kd(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Vd(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),s=0,c(d)):B(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||B(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),u)}function c(d){return d===96?(e.consume(d),s++,c):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class Hd{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&yt(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),yt(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yt(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);yt(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yt(this.left,n.reverse())}}}function yt(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Io(e){const t={};let n=-1,r,s,i,o,a,l,u;const c=new Hd(e);for(;++n<c.length;){for(;n in t;)n=t[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,qd(c,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=c.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(c.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...c.get(s)[1].start},a=c.slice(s,n),a.unshift(r),c.splice(s,n-s+1,a))}}return Ie(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function qd(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let c,d,p=-1,f=n,m=0,y=0;const x=[y];for(;f;){for(;e.get(++s)[1]!==f;);i.push(s),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(y=p+1,x.push(y),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):x.pop(),p=x.length;p--;){const g=a.slice(x[p],x[p+1]),v=i.pop();l.push([v,v+g.length-1]),e.splice(v,2,g)}for(l.reverse(),p=-1;++p<l.length;)u[m+l[p][0]]=m+l[p][1],m+=l[p][1]-l[p][0]-1;return u}const Wd={resolve:Qd,tokenize:Xd},Gd={partial:!0,tokenize:Yd};function Qd(e){return Io(e),e}function Xd(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):B(a)?e.check(Gd,o,i)(a):(e.consume(a),s)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function Yd(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),X(e,i,"linePrefix")}function i(o){if(o===null||B(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Mo(e,t,n,r,s,i,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return d;function d(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||Ht(g)?n(g):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===62?(e.exit("chunkString"),e.exit(a),p(g)):g===null||g===60||B(g)?n(g):(e.consume(g),g===92?m:f)}function m(g){return g===60||g===62||g===92?(e.consume(g),f):f(g)}function y(g){return!c&&(g===null||g===41||Z(g))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(g)):c<u&&g===40?(e.consume(g),c++,y):g===41?(e.consume(g),c--,y):g===null||g===32||g===40||Ht(g)?n(g):(e.consume(g),g===92?x:y)}function x(g){return g===40||g===41||g===92?(e.consume(g),y):y(g)}}function Ro(e,t,n,r,s,i){const o=this;let a=0,l;return u;function u(f){return e.enter(r),e.enter(s),e.consume(f),e.exit(s),e.enter(i),c}function c(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):B(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||B(f)||a++>999?(e.exit("chunkString"),c(f)):(e.consume(f),l||(l=!W(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function Eo(e,t,n,r,s,i){let o;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),o=p===40?41:p,l):n(p)}function l(p){return p===o?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===o?(e.exit(i),l(o)):p===null?n(p):B(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),X(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===o||p===null||B(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?d:c)}function d(p){return p===o||p===92?(e.consume(p),c):c(p)}}function vt(e,t){let n;return r;function r(s){return B(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):W(s)?X(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const Jd={name:"definition",tokenize:eh},Zd={partial:!0,tokenize:th};function eh(e,t,n){const r=this;let s;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return Ro.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return s=Pe(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return Z(f)?vt(e,u)(f):u(f)}function u(f){return Mo(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return e.attempt(Zd,d,d)(f)}function d(f){return W(f)?X(e,p,"whitespace")(f):p(f)}function p(f){return f===null||B(f)?(e.exit("definition"),r.parser.defined.push(s),t(f)):n(f)}}function th(e,t,n){return r;function r(a){return Z(a)?vt(e,s)(a):n(a)}function s(a){return Eo(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return W(a)?X(e,o,"whitespace")(a):o(a)}function o(a){return a===null||B(a)?t(a):n(a)}}const nh={name:"hardBreakEscape",tokenize:rh};function rh(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return B(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const sh={name:"headingAtx",resolve:ih,tokenize:oh};function ih(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ie(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function oh(e,t,n){let r=0;return s;function s(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||Z(c)?(e.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||B(c)?(e.exit("atxHeading"),t(c)):W(c)?X(e,a,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Z(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),u)}}const ah=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],hs=["pre","script","style","textarea"],lh={concrete:!0,name:"htmlFlow",resolveTo:dh,tokenize:hh},uh={partial:!0,tokenize:ph},ch={partial:!0,tokenize:fh};function dh(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function hh(e,t,n){const r=this;let s,i,o,a,l;return u;function u(S){return c(S)}function c(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),d}function d(S){return S===33?(e.consume(S),p):S===47?(e.consume(S),i=!0,y):S===63?(e.consume(S),s=3,r.interrupt?t:b):ye(S)?(e.consume(S),o=String.fromCharCode(S),x):n(S)}function p(S){return S===45?(e.consume(S),s=2,f):S===91?(e.consume(S),s=5,a=0,m):ye(S)?(e.consume(S),s=4,r.interrupt?t:b):n(S)}function f(S){return S===45?(e.consume(S),r.interrupt?t:b):n(S)}function m(S){const ce="CDATA[";return S===ce.charCodeAt(a++)?(e.consume(S),a===ce.length?r.interrupt?t:N:m):n(S)}function y(S){return ye(S)?(e.consume(S),o=String.fromCharCode(S),x):n(S)}function x(S){if(S===null||S===47||S===62||Z(S)){const ce=S===47,we=o.toLowerCase();return!ce&&!i&&hs.includes(we)?(s=1,r.interrupt?t(S):N(S)):ah.includes(o.toLowerCase())?(s=6,ce?(e.consume(S),g):r.interrupt?t(S):N(S)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):i?v(S):w(S))}return S===45||pe(S)?(e.consume(S),o+=String.fromCharCode(S),x):n(S)}function g(S){return S===62?(e.consume(S),r.interrupt?t:N):n(S)}function v(S){return W(S)?(e.consume(S),v):C(S)}function w(S){return S===47?(e.consume(S),C):S===58||S===95||ye(S)?(e.consume(S),I):W(S)?(e.consume(S),w):C(S)}function I(S){return S===45||S===46||S===58||S===95||pe(S)?(e.consume(S),I):L(S)}function L(S){return S===61?(e.consume(S),T):W(S)?(e.consume(S),L):w(S)}function T(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,_):W(S)?(e.consume(S),T):F(S)}function _(S){return S===l?(e.consume(S),l=null,z):S===null||B(S)?n(S):(e.consume(S),_)}function F(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Z(S)?L(S):(e.consume(S),F)}function z(S){return S===47||S===62||W(S)?w(S):n(S)}function C(S){return S===62?(e.consume(S),j):n(S)}function j(S){return S===null||B(S)?N(S):W(S)?(e.consume(S),j):n(S)}function N(S){return S===45&&s===2?(e.consume(S),U):S===60&&s===1?(e.consume(S),Y):S===62&&s===4?(e.consume(S),ie):S===63&&s===3?(e.consume(S),b):S===93&&s===5?(e.consume(S),xe):B(S)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(uh,se,$)(S)):S===null||B(S)?(e.exit("htmlFlowData"),$(S)):(e.consume(S),N)}function $(S){return e.check(ch,O,se)(S)}function O(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),E}function E(S){return S===null||B(S)?$(S):(e.enter("htmlFlowData"),N(S))}function U(S){return S===45?(e.consume(S),b):N(S)}function Y(S){return S===47?(e.consume(S),o="",he):N(S)}function he(S){if(S===62){const ce=o.toLowerCase();return hs.includes(ce)?(e.consume(S),ie):N(S)}return ye(S)&&o.length<8?(e.consume(S),o+=String.fromCharCode(S),he):N(S)}function xe(S){return S===93?(e.consume(S),b):N(S)}function b(S){return S===62?(e.consume(S),ie):S===45&&s===2?(e.consume(S),b):N(S)}function ie(S){return S===null||B(S)?(e.exit("htmlFlowData"),se(S)):(e.consume(S),ie)}function se(S){return e.exit("htmlFlow"),t(S)}}function fh(e,t,n){const r=this;return s;function s(o){return B(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function ph(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Lt,t,n)}}const gh={name:"htmlText",tokenize:mh};function mh(e,t,n){const r=this;let s,i,o;return a;function a(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),l}function l(b){return b===33?(e.consume(b),u):b===47?(e.consume(b),L):b===63?(e.consume(b),w):ye(b)?(e.consume(b),F):n(b)}function u(b){return b===45?(e.consume(b),c):b===91?(e.consume(b),i=0,m):ye(b)?(e.consume(b),v):n(b)}function c(b){return b===45?(e.consume(b),f):n(b)}function d(b){return b===null?n(b):b===45?(e.consume(b),p):B(b)?(o=d,Y(b)):(e.consume(b),d)}function p(b){return b===45?(e.consume(b),f):d(b)}function f(b){return b===62?U(b):b===45?p(b):d(b)}function m(b){const ie="CDATA[";return b===ie.charCodeAt(i++)?(e.consume(b),i===ie.length?y:m):n(b)}function y(b){return b===null?n(b):b===93?(e.consume(b),x):B(b)?(o=y,Y(b)):(e.consume(b),y)}function x(b){return b===93?(e.consume(b),g):y(b)}function g(b){return b===62?U(b):b===93?(e.consume(b),g):y(b)}function v(b){return b===null||b===62?U(b):B(b)?(o=v,Y(b)):(e.consume(b),v)}function w(b){return b===null?n(b):b===63?(e.consume(b),I):B(b)?(o=w,Y(b)):(e.consume(b),w)}function I(b){return b===62?U(b):w(b)}function L(b){return ye(b)?(e.consume(b),T):n(b)}function T(b){return b===45||pe(b)?(e.consume(b),T):_(b)}function _(b){return B(b)?(o=_,Y(b)):W(b)?(e.consume(b),_):U(b)}function F(b){return b===45||pe(b)?(e.consume(b),F):b===47||b===62||Z(b)?z(b):n(b)}function z(b){return b===47?(e.consume(b),U):b===58||b===95||ye(b)?(e.consume(b),C):B(b)?(o=z,Y(b)):W(b)?(e.consume(b),z):U(b)}function C(b){return b===45||b===46||b===58||b===95||pe(b)?(e.consume(b),C):j(b)}function j(b){return b===61?(e.consume(b),N):B(b)?(o=j,Y(b)):W(b)?(e.consume(b),j):z(b)}function N(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),s=b,$):B(b)?(o=N,Y(b)):W(b)?(e.consume(b),N):(e.consume(b),O)}function $(b){return b===s?(e.consume(b),s=void 0,E):b===null?n(b):B(b)?(o=$,Y(b)):(e.consume(b),$)}function O(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||Z(b)?z(b):(e.consume(b),O)}function E(b){return b===47||b===62||Z(b)?z(b):n(b)}function U(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function Y(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),he}function he(b){return W(b)?X(e,xe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):xe(b)}function xe(b){return e.enter("htmlTextData"),o(b)}}const wr={name:"labelEnd",resolveAll:Sh,resolveTo:kh,tokenize:vh},yh={tokenize:wh},xh={tokenize:Ch},bh={tokenize:Th};function Sh(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Ie(e,0,e.length,n),e}function kh(e,t){let n=e.length,r=0,s,i,o,a;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=Ae(a,e.slice(i+1,i+r+3)),a=Ae(a,[["enter",c,t]]),a=Ae(a,Zt(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=Ae(a,[["exit",c,t],e[o-2],e[o-1],["exit",u,t]]),a=Ae(a,e.slice(o+1)),a=Ae(a,[["exit",l,t]]),Ie(e,i,e.length,a),e}function vh(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(p){return i?i._inactive?d(p):(o=r.parser.defined.includes(Pe(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(yh,c,o?c:d)(p):p===91?e.attempt(xh,c,o?u:d)(p):o?c(p):d(p)}function u(p){return e.attempt(bh,c,d)(p)}function c(p){return t(p)}function d(p){return i._balanced=!0,n(p)}}function wh(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return Z(d)?vt(e,i)(d):i(d)}function i(d){return d===41?c(d):Mo(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Z(d)?vt(e,l)(d):c(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?Eo(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return Z(d)?vt(e,c)(d):c(d)}function c(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function Ch(e,t,n){const r=this;return s;function s(a){return Ro.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Pe(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Th(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Ih={name:"labelStartImage",resolveAll:wr.resolveAll,tokenize:Mh};function Mh(e,t,n){const r=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Rh={name:"labelStartLink",resolveAll:wr.resolveAll,tokenize:Eh};function Eh(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const hn={name:"lineEnding",tokenize:Ah};function Ah(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),X(e,t,"linePrefix")}}const Ut={name:"thematicBreak",tokenize:Lh};function Lh(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,a(u)}function a(u){return u===s?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||B(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),W(u)?X(e,a,"whitespace")(u):a(u))}}const Se={continuation:{tokenize:Dh},exit:Oh,name:"list",tokenize:jh},Nh={partial:!0,tokenize:Fh},Ph={partial:!0,tokenize:_h};function jh(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(f){const m=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Un(f)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Ut,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return Un(f)&&++o<10?(e.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Lt,r.interrupt?n:c,e.attempt(Nh,p,d))}function c(f){return r.containerState.initialBlankLine=!0,i++,p(f)}function d(f){return W(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Dh(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Lt,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!W(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ph,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Se,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function _h(e,t,n){const r=this;return X(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function Oh(e){e.exit(this.containerState.type)}function Fh(e,t,n){const r=this;return X(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!W(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const fs={name:"setextUnderline",resolveTo:zh,tokenize:Bh};function zh(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Bh(e,t,n){const r=this;let s;return i;function i(u){let c=r.events.length,d;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){d=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===s?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),W(u)?X(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||B(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const $h={tokenize:Uh};function Uh(e){const t=this,n=e.attempt(Lt,r,e.attempt(this.parser.constructs.flowInitial,s,X(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Wd,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Kh={resolveAll:Lo()},Vh=Ao("string"),Hh=Ao("text");function Ao(e){return{resolveAll:Lo(e==="text"?qh:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,a);return o;function o(c){return u(c)?i(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const d=s[c];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Lo(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function qh(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Wh={42:Se,43:Se,45:Se,48:Se,49:Se,50:Se,51:Se,52:Se,53:Se,54:Se,55:Se,56:Se,57:Se,62:wo},Gh={91:Jd},Qh={[-2]:dn,[-1]:dn,32:dn},Xh={35:sh,42:Ut,45:[fs,Ut],60:lh,61:fs,95:Ut,96:ds,126:ds},Yh={38:To,92:Co},Jh={[-5]:hn,[-4]:hn,[-3]:hn,33:Ih,38:To,42:Kn,60:[Rd,gh],91:Rh,92:[nh,Co],93:wr,95:Kn,96:$d},Zh={null:[Kn,Kh]},ef={null:[42,95]},tf={null:[]},nf=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ef,contentInitial:Gh,disable:tf,document:Wh,flow:Xh,flowInitial:Qh,insideSpan:Zh,string:Yh,text:Jh},Symbol.toStringTag,{value:"Module"}));function rf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],a=[];const l={attempt:_(L),check:_(T),consume:v,enter:w,exit:I,interrupt:_(T,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:m,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:d};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function d(j){return o=Ae(o,j),x(),o[o.length-1]!==null?[]:(F(t,0),u.events=Zt(i,u.events,u),u.events)}function p(j,N){return of(f(j),N)}function f(j){return sf(o,j)}function m(){const{_bufferIndex:j,_index:N,line:$,column:O,offset:E}=r;return{_bufferIndex:j,_index:N,line:$,column:O,offset:E}}function y(j){s[j.line]=j.column,C()}function x(){let j;for(;r._index<o.length;){const N=o[r._index];if(typeof N=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<N.length;)g(N.charCodeAt(r._bufferIndex));else g(N)}}function g(j){c=c(j)}function v(j){B(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,C()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=j}function w(j,N){const $=N||{};return $.type=j,$.start=m(),u.events.push(["enter",$,u]),a.push($),$}function I(j){const N=a.pop();return N.end=m(),u.events.push(["exit",N,u]),N}function L(j,N){F(j,N.from)}function T(j,N){N.restore()}function _(j,N){return $;function $(O,E,U){let Y,he,xe,b;return Array.isArray(O)?se(O):"tokenize"in O?se([O]):ie(O);function ie(ne){return fe;function fe(be){const Me=be!==null&&ne[be],Re=be!==null&&ne.null,je=[...Array.isArray(Me)?Me:Me?[Me]:[],...Array.isArray(Re)?Re:Re?[Re]:[]];return se(je)(be)}}function se(ne){return Y=ne,he=0,ne.length===0?U:S(ne[he])}function S(ne){return fe;function fe(be){return b=z(),xe=ne,ne.partial||(u.currentConstruct=ne),ne.name&&u.parser.constructs.disable.null.includes(ne.name)?we():ne.tokenize.call(N?Object.assign(Object.create(u),N):u,l,ce,we)(be)}}function ce(ne){return j(xe,b),E}function we(ne){return b.restore(),++he<Y.length?S(Y[he]):U}}}function F(j,N){j.resolveAll&&!i.includes(j)&&i.push(j),j.resolve&&Ie(u.events,N,u.events.length-N,j.resolve(u.events.slice(N),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function z(){const j=m(),N=u.previous,$=u.currentConstruct,O=u.events.length,E=Array.from(a);return{from:O,restore:U};function U(){r=j,u.previous=N,u.currentConstruct=$,u.events.length=O,a=E,C()}}function C(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function sf(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function of(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
4
4
  `;break}case-3:{o=`\r
@@ -1 +1 @@
1
- import{r as s,j as t,a3 as oe,bb as ae,bc as ne,X as W,at as ie,$ as le,bd as ce,G as de,ah as ue,be as me}from"./vendor-CmQZsDAE.js";import{n as we,D as Y,t as i,c as X,ar as xe}from"./index-DvA7S11O.js";function pe(){const{isOpen:T,mode:g,tabs:F,activeTabId:N,currentTab:x,currentUrl:l,navVersion:p,close:$,toggleMode:A,goBack:I,goForward:O,canGoBack:G,canGoForward:_,navigate:y,syncUrl:S,setActiveTab:V,closeTab:H,openNewTab:q}=we(),[k,j]=s.useState(""),[E,C]=s.useState(!1),[J,h]=s.useState(!1),[d,D]=s.useState(()=>({x:Math.max(40,window.innerWidth-520),y:80})),[n,B]=s.useState({w:480,h:600}),[L,K]=s.useState(420),u=s.useRef(null),m=s.useRef(null),b=s.useRef(null),z=s.useRef(null),P=s.useRef(p),a=(x==null?void 0:x.kind)==="docs";s.useEffect(()=>{if(!a){j("");return}try{const e=new URL(l);j(e.pathname)}catch{j(l)}},[l,N,a]),s.useEffect(()=>{var e;if(a){if(p!==P.current){P.current=p;return}if((e=z.current)!=null&&e.contentWindow)try{const r=new URL(l).pathname;z.current.contentWindow.postMessage({type:"docs-navigate",path:r},"*")}catch{}}},[l,p,a]),s.useEffect(()=>{g==="floating"&&D(e=>({x:Math.max(40,window.innerWidth-n.w-40),y:e.y}))},[g,n.w]),s.useEffect(()=>{const e=r=>{var o;a&&((o=r.data)==null?void 0:o.type)==="docs-route-change"&&typeof r.data.url=="string"&&S(r.data.url)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[S,a]);const Q=s.useCallback(e=>{if(e.preventDefault(),!a)return;const r=k.trim();r&&(r.startsWith("/")?y(`${Y}${r}`):r.startsWith("http")?y(r):y(`${Y}/${r}`))},[k,y,a]),Z=s.useCallback(e=>{g==="floating"&&(C(!0),u.current={startX:e.clientX,startY:e.clientY,startPosX:d.x,startPosY:d.y})},[g,d]);s.useEffect(()=>{if(!E)return;const e=o=>{u.current&&D({x:u.current.startPosX+(o.clientX-u.current.startX),y:u.current.startPosY+(o.clientY-u.current.startY)})},r=()=>{C(!1),u.current=null};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",r),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",r)}},[E]);const M=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0);const r=e.currentTarget.dataset.axis;m.current={startX:e.clientX,startY:e.clientY,startW:n.w,startH:n.h};const o=w=>{m.current&&B(v=>({w:r==="y"?v.w:Math.max(360,m.current.startW+(w.clientX-m.current.startX)),h:r==="x"?v.h:Math.max(400,m.current.startH+(w.clientY-m.current.startY))}))},f=()=>{h(!1),m.current=null,window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",f)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",f)},[n]),ee=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0),b.current={startX:e.clientX,startW:L};const r=f=>{if(!b.current)return;const w=b.current.startX-f.clientX;K(Math.max(320,Math.min(860,b.current.startW+w)))},o=()=>{h(!1),b.current=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[L]),te=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0);const r=e.clientX,o=n.w,f=d.x,w=re=>{const se=r-re.clientX,U=Math.max(360,o+se);B(R=>({...R,w:U})),D(R=>({...R,x:f-(U-o)}))},v=()=>{h(!1),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",w),window.addEventListener("mouseup",v)},[n.w,d.x]);if(!T)return null;const c=g==="docked";return t.jsxs("div",{className:X("flex flex-col bg-white overflow-hidden relative",c?"h-full border-l border-gray-200 shrink-0":"rounded-2xl shadow-2xl border border-gray-200"),style:c?{width:L}:{position:"fixed",left:d.x,top:d.y,width:n.w,height:n.h,zIndex:9999},children:[c&&t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:ee}),t.jsxs("div",{className:X("flex items-center justify-between px-4 py-2.5 bg-gray-50 border-b border-gray-200 shrink-0 select-none",!c&&"cursor-grab active:cursor-grabbing"),onMouseDown:c?void 0:Z,children:[t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx(oe,{className:"w-4 h-4 text-primary shrink-0"}),t.jsx("span",{className:"text-sm font-semibold text-gray-900 truncate",children:i("docBrowserTitle")})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{onClick:A,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:c?i("docBrowserFloatMode"):i("docBrowserDockMode"),children:c?t.jsx(ae,{className:"w-3.5 h-3.5"}):t.jsx(ne,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:$,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:i("docBrowserClose"),children:t.jsx(W,{className:"w-3.5 h-3.5"})})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2 bg-white border-b border-gray-100 overflow-x-auto custom-scrollbar",children:[F.map(e=>{const r=e.id===N;return t.jsxs("div",{className:X("inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors",r?"bg-blue-50 border-blue-300 text-blue-700":"bg-gray-50 border-gray-200 text-gray-600 hover:bg-gray-100"),children:[t.jsx("button",{type:"button",onClick:()=>V(e.id),className:"truncate text-left px-1",title:e.title,children:e.title||i("docBrowserTabUntitled")}),t.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),H(e.id)},className:"rounded p-0.5 hover:bg-black/10","aria-label":i("docBrowserCloseTab"),children:t.jsx(W,{className:"w-3 h-3"})})]},e.id)}),t.jsx("button",{onClick:()=>q(void 0,{kind:"docs",title:"Docs"}),className:"inline-flex items-center justify-center w-7 h-7 rounded-lg border border-gray-200 bg-white text-gray-600 hover:bg-gray-100 shrink-0",title:i("docBrowserNewTab"),children:t.jsx(ie,{className:"w-3.5 h-3.5"})})]}),a&&t.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0",children:[t.jsx("button",{onClick:I,disabled:!G,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(le,{className:"w-4 h-4"})}),t.jsx("button",{onClick:O,disabled:!_,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(ce,{className:"w-4 h-4"})}),t.jsxs("form",{onSubmit:Q,className:"flex-1 relative",children:[t.jsx(de,{className:"w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),t.jsx("input",{type:"text",value:k,onChange:e=>j(e.target.value),placeholder:i("docBrowserSearchPlaceholder"),className:"w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400"})]})]}),t.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[t.jsx("iframe",{ref:z,src:l,className:"absolute inset-0 w-full h-full border-0",title:(x==null?void 0:x.title)||"NextClaw Docs",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms",allow:"clipboard-read; clipboard-write"},`${N}:${p}`),(J||E)&&t.jsx("div",{className:"absolute inset-0 z-10"})]}),a&&xe(l)&&t.jsx("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0",children:t.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer","data-doc-external":!0,className:"flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors",children:[i("docBrowserOpenExternal"),t.jsx(ue,{className:"w-3 h-3"})]})}),!c&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:te}),t.jsx("div",{className:"absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:M,"data-axis":"x"}),t.jsx("div",{className:"absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:M,"data-axis":"y"}),t.jsx("div",{className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors",onMouseDown:M,children:t.jsx(me,{className:"w-3 h-3 rotate-[-45deg]"})})]})]})}export{pe as DocBrowser};
1
+ import{r as s,j as t,a3 as oe,bb as ae,bc as ne,X as W,at as ie,$ as le,bd as ce,G as de,ah as ue,be as me}from"./vendor-CmQZsDAE.js";import{n as we,D as Y,t as i,c as X,ar as xe}from"./index-C6dwNe7e.js";function pe(){const{isOpen:T,mode:g,tabs:F,activeTabId:N,currentTab:x,currentUrl:l,navVersion:p,close:$,toggleMode:A,goBack:I,goForward:O,canGoBack:G,canGoForward:_,navigate:y,syncUrl:S,setActiveTab:V,closeTab:H,openNewTab:q}=we(),[k,j]=s.useState(""),[E,C]=s.useState(!1),[J,h]=s.useState(!1),[d,D]=s.useState(()=>({x:Math.max(40,window.innerWidth-520),y:80})),[n,B]=s.useState({w:480,h:600}),[L,K]=s.useState(420),u=s.useRef(null),m=s.useRef(null),b=s.useRef(null),z=s.useRef(null),P=s.useRef(p),a=(x==null?void 0:x.kind)==="docs";s.useEffect(()=>{if(!a){j("");return}try{const e=new URL(l);j(e.pathname)}catch{j(l)}},[l,N,a]),s.useEffect(()=>{var e;if(a){if(p!==P.current){P.current=p;return}if((e=z.current)!=null&&e.contentWindow)try{const r=new URL(l).pathname;z.current.contentWindow.postMessage({type:"docs-navigate",path:r},"*")}catch{}}},[l,p,a]),s.useEffect(()=>{g==="floating"&&D(e=>({x:Math.max(40,window.innerWidth-n.w-40),y:e.y}))},[g,n.w]),s.useEffect(()=>{const e=r=>{var o;a&&((o=r.data)==null?void 0:o.type)==="docs-route-change"&&typeof r.data.url=="string"&&S(r.data.url)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[S,a]);const Q=s.useCallback(e=>{if(e.preventDefault(),!a)return;const r=k.trim();r&&(r.startsWith("/")?y(`${Y}${r}`):r.startsWith("http")?y(r):y(`${Y}/${r}`))},[k,y,a]),Z=s.useCallback(e=>{g==="floating"&&(C(!0),u.current={startX:e.clientX,startY:e.clientY,startPosX:d.x,startPosY:d.y})},[g,d]);s.useEffect(()=>{if(!E)return;const e=o=>{u.current&&D({x:u.current.startPosX+(o.clientX-u.current.startX),y:u.current.startPosY+(o.clientY-u.current.startY)})},r=()=>{C(!1),u.current=null};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",r),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",r)}},[E]);const M=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0);const r=e.currentTarget.dataset.axis;m.current={startX:e.clientX,startY:e.clientY,startW:n.w,startH:n.h};const o=w=>{m.current&&B(v=>({w:r==="y"?v.w:Math.max(360,m.current.startW+(w.clientX-m.current.startX)),h:r==="x"?v.h:Math.max(400,m.current.startH+(w.clientY-m.current.startY))}))},f=()=>{h(!1),m.current=null,window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",f)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",f)},[n]),ee=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0),b.current={startX:e.clientX,startW:L};const r=f=>{if(!b.current)return;const w=b.current.startX-f.clientX;K(Math.max(320,Math.min(860,b.current.startW+w)))},o=()=>{h(!1),b.current=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",o)},[L]),te=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),h(!0);const r=e.clientX,o=n.w,f=d.x,w=re=>{const se=r-re.clientX,U=Math.max(360,o+se);B(R=>({...R,w:U})),D(R=>({...R,x:f-(U-o)}))},v=()=>{h(!1),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",w),window.addEventListener("mouseup",v)},[n.w,d.x]);if(!T)return null;const c=g==="docked";return t.jsxs("div",{className:X("flex flex-col bg-white overflow-hidden relative",c?"h-full border-l border-gray-200 shrink-0":"rounded-2xl shadow-2xl border border-gray-200"),style:c?{width:L}:{position:"fixed",left:d.x,top:d.y,width:n.w,height:n.h,zIndex:9999},children:[c&&t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:ee}),t.jsxs("div",{className:X("flex items-center justify-between px-4 py-2.5 bg-gray-50 border-b border-gray-200 shrink-0 select-none",!c&&"cursor-grab active:cursor-grabbing"),onMouseDown:c?void 0:Z,children:[t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx(oe,{className:"w-4 h-4 text-primary shrink-0"}),t.jsx("span",{className:"text-sm font-semibold text-gray-900 truncate",children:i("docBrowserTitle")})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{onClick:A,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:c?i("docBrowserFloatMode"):i("docBrowserDockMode"),children:c?t.jsx(ae,{className:"w-3.5 h-3.5"}):t.jsx(ne,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:$,className:"hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors",title:i("docBrowserClose"),children:t.jsx(W,{className:"w-3.5 h-3.5"})})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-2 bg-white border-b border-gray-100 overflow-x-auto custom-scrollbar",children:[F.map(e=>{const r=e.id===N;return t.jsxs("div",{className:X("inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors",r?"bg-blue-50 border-blue-300 text-blue-700":"bg-gray-50 border-gray-200 text-gray-600 hover:bg-gray-100"),children:[t.jsx("button",{type:"button",onClick:()=>V(e.id),className:"truncate text-left px-1",title:e.title,children:e.title||i("docBrowserTabUntitled")}),t.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),H(e.id)},className:"rounded p-0.5 hover:bg-black/10","aria-label":i("docBrowserCloseTab"),children:t.jsx(W,{className:"w-3 h-3"})})]},e.id)}),t.jsx("button",{onClick:()=>q(void 0,{kind:"docs",title:"Docs"}),className:"inline-flex items-center justify-center w-7 h-7 rounded-lg border border-gray-200 bg-white text-gray-600 hover:bg-gray-100 shrink-0",title:i("docBrowserNewTab"),children:t.jsx(ie,{className:"w-3.5 h-3.5"})})]}),a&&t.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0",children:[t.jsx("button",{onClick:I,disabled:!G,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(le,{className:"w-4 h-4"})}),t.jsx("button",{onClick:O,disabled:!_,className:"p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors",children:t.jsx(ce,{className:"w-4 h-4"})}),t.jsxs("form",{onSubmit:Q,className:"flex-1 relative",children:[t.jsx(de,{className:"w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),t.jsx("input",{type:"text",value:k,onChange:e=>j(e.target.value),placeholder:i("docBrowserSearchPlaceholder"),className:"w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400"})]})]}),t.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[t.jsx("iframe",{ref:z,src:l,className:"absolute inset-0 w-full h-full border-0",title:(x==null?void 0:x.title)||"NextClaw Docs",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms",allow:"clipboard-read; clipboard-write"},`${N}:${p}`),(J||E)&&t.jsx("div",{className:"absolute inset-0 z-10"})]}),a&&xe(l)&&t.jsx("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0",children:t.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer","data-doc-external":!0,className:"flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors",children:[i("docBrowserOpenExternal"),t.jsx(ue,{className:"w-3 h-3"})]})}),!c&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:te}),t.jsx("div",{className:"absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:M,"data-axis":"x"}),t.jsx("div",{className:"absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors",onMouseDown:M,"data-axis":"y"}),t.jsx("div",{className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors",onMouseDown:M,children:t.jsx(me,{className:"w-3 h-3 rotate-[-45deg]"})})]})]})}export{pe as DocBrowser};
@@ -1 +1 @@
1
- import{r as d,j as e}from"./vendor-CmQZsDAE.js";import{c as t}from"./index-DvA7S11O.js";function x({name:s,src:o,className:a,imgClassName:r,fallback:l}){const[n,i]=d.useState(!1),c=!!o&&!n;return e.jsx("div",{className:t("inline-flex shrink-0 items-center justify-center overflow-hidden",a),children:c?e.jsx("img",{src:o,alt:`${s} logo`,className:t("block h-6 w-6 object-contain",r),onError:()=>i(!0),draggable:!1}):l??e.jsx("span",{className:"text-lg font-bold uppercase",children:s.slice(0,1)})})}export{x as L};
1
+ import{r as d,j as e}from"./vendor-CmQZsDAE.js";import{c as t}from"./index-C6dwNe7e.js";function x({name:s,src:o,className:a,imgClassName:r,fallback:l}){const[n,i]=d.useState(!1),c=!!o&&!n;return e.jsx("div",{className:t("inline-flex shrink-0 items-center justify-center overflow-hidden",a),children:c?e.jsx("img",{src:o,alt:`${s} logo`,className:t("block h-6 w-6 object-contain",r),onError:()=>i(!0),draggable:!1}):l??e.jsx("span",{className:"text-lg font-bold uppercase",children:s.slice(0,1)})})}export{x as L};