@nextclaw/ui 0.6.14 → 0.7.0

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 (94) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -0
  3. package/dist/assets/ChannelsList-DF2U-LY1.js +1 -0
  4. package/dist/assets/ChatPage-BX39y0U5.js +36 -0
  5. package/dist/assets/DocBrowser-B9ws5JL7.js +1 -0
  6. package/dist/assets/{LogoBadge-BxZJ9BJT.js → LogoBadge-DvGAzkZ3.js} +1 -1
  7. package/dist/assets/MarketplacePage-DG5mHWJ8.js +49 -0
  8. package/dist/assets/ModelConfig-BL_HsOsm.js +1 -0
  9. package/dist/assets/ProvidersList-CH5z00YT.js +1 -0
  10. package/dist/assets/RuntimeConfig-BplBgkwo.js +1 -0
  11. package/dist/assets/SearchConfig-BhaI0fUf.js +1 -0
  12. package/dist/assets/{SecretsConfig-9OABNssV.js → SecretsConfig-CFoimOh9.js} +2 -2
  13. package/dist/assets/SessionsConfig-BHTAYn9T.js +2 -0
  14. package/dist/assets/index-BLeJkJ0o.css +1 -0
  15. package/dist/assets/index-DK4TS5ev.js +8 -0
  16. package/dist/assets/index-X5J6Mm--.js +1 -0
  17. package/dist/assets/{index-CkqvHQAt.js → index-uMsNsQX6.js} +1 -1
  18. package/dist/assets/{label-BIjHWZUm.js → label-D8ly4a2P.js} +1 -1
  19. package/dist/assets/page-layout-BSYfvwbp.js +1 -0
  20. package/dist/assets/security-config-DlKEYHNN.js +1 -0
  21. package/dist/assets/{session-run-status-BZEH0QZp.js → session-run-status-TkIuGbVw.js} +1 -1
  22. package/dist/assets/skeleton-CWbsNx2h.js +1 -0
  23. package/dist/assets/{switch-CnGQpdTp.js → switch-Ce_g9lpN.js} +1 -1
  24. package/dist/assets/tabs-custom-Cf5azvT5.js +1 -0
  25. package/dist/assets/useConfirmDialog-A8Ek8Wu7.js +5 -0
  26. package/dist/assets/vendor-B7ozqnFC.js +412 -0
  27. package/dist/index.html +3 -3
  28. package/package.json +9 -10
  29. package/src/App.tsx +49 -27
  30. package/src/api/client.ts +1 -0
  31. package/src/api/config.ts +60 -0
  32. package/src/api/types.ts +29 -1
  33. package/src/api/websocket.ts +2 -0
  34. package/src/components/auth/login-page.tsx +69 -0
  35. package/src/components/chat/ChatConversationPanel.tsx +12 -54
  36. package/src/components/chat/ChatSidebar.tsx +7 -1
  37. package/src/components/chat/adapters/chat-input-bar.adapter.test.ts +80 -0
  38. package/src/components/chat/adapters/chat-input-bar.adapter.ts +329 -0
  39. package/src/components/chat/adapters/chat-message.adapter.test.ts +137 -0
  40. package/src/components/chat/adapters/chat-message.adapter.ts +200 -0
  41. package/src/components/chat/chat-input/chat-input-bar.controller.test.tsx +128 -0
  42. package/src/components/chat/chat-input/chat-input-bar.controller.ts +105 -0
  43. package/src/components/chat/containers/chat-input-bar.container.tsx +270 -0
  44. package/src/components/chat/containers/chat-message-list.container.tsx +67 -0
  45. package/src/components/chat/index.ts +1 -0
  46. package/src/components/chat/managers/chat-thread.manager.ts +3 -1
  47. package/src/components/chat/nextclaw/index.ts +23 -0
  48. package/src/components/common/BrandHeader.tsx +4 -1
  49. package/src/components/common/StatusBadge.tsx +32 -20
  50. package/src/components/config/runtime-security-card.tsx +276 -0
  51. package/src/components/config/security-config.tsx +12 -0
  52. package/src/components/layout/Sidebar.tsx +6 -1
  53. package/src/components/marketplace/MarketplacePage.test.tsx +170 -0
  54. package/src/components/marketplace/MarketplacePage.tsx +77 -28
  55. package/src/hooks/use-auth.ts +111 -0
  56. package/src/hooks/useMarketplace.ts +9 -0
  57. package/src/hooks/useWebSocket.ts +53 -1
  58. package/src/lib/i18n.ts +72 -0
  59. package/src/test/setup.ts +16 -0
  60. package/tsconfig.json +3 -2
  61. package/vite.config.ts +2 -1
  62. package/vitest.config.ts +16 -0
  63. package/.eslintrc.cjs +0 -48
  64. package/dist/assets/ChannelsList-DiSnpiW0.js +0 -1
  65. package/dist/assets/ChatPage-DsaIrNHN.js +0 -36
  66. package/dist/assets/DocBrowser-CnfcptGM.js +0 -1
  67. package/dist/assets/MarketplacePage-BI_J_DBQ.js +0 -49
  68. package/dist/assets/ModelConfig-DfL8F4tN.js +0 -1
  69. package/dist/assets/ProvidersList-DpT_oFHZ.js +0 -1
  70. package/dist/assets/RuntimeConfig-BNYR_Iag.js +0 -1
  71. package/dist/assets/SearchConfig-TDBl7Fjh.js +0 -1
  72. package/dist/assets/SessionsConfig-BRwntUDz.js +0 -2
  73. package/dist/assets/card-BYnT3Mxo.js +0 -1
  74. package/dist/assets/index-BCfS4UY1.css +0 -1
  75. package/dist/assets/index-BnUxgevr.js +0 -8
  76. package/dist/assets/input-oaepEtqu.js +0 -1
  77. package/dist/assets/page-layout-B6JXiSQB.js +0 -1
  78. package/dist/assets/popover-LJQgv5l1.js +0 -1
  79. package/dist/assets/tabs-custom-CpSv7pDl.js +0 -1
  80. package/dist/assets/useConfirmDialog-pqAlPdQZ.js +0 -5
  81. package/dist/assets/vendor-BKtTvQYU.js +0 -407
  82. package/src/components/chat/ChatThread.tsx +0 -402
  83. package/src/components/chat/SkillsPicker.tsx +0 -137
  84. package/src/components/chat/chat-input/ChatInputBarView.tsx +0 -82
  85. package/src/components/chat/chat-input/ChatInputBottomToolbar.tsx +0 -83
  86. package/src/components/chat/chat-input/components/ChatInputModelStateHint.tsx +0 -39
  87. package/src/components/chat/chat-input/components/ChatInputSelectedSkillsSection.tsx +0 -31
  88. package/src/components/chat/chat-input/components/ChatInputSlashPanelSection.tsx +0 -112
  89. package/src/components/chat/chat-input/components/bottom-toolbar/ChatInputAttachButton.tsx +0 -24
  90. package/src/components/chat/chat-input/components/bottom-toolbar/ChatInputModelSelector.tsx +0 -58
  91. package/src/components/chat/chat-input/components/bottom-toolbar/ChatInputSendControls.tsx +0 -56
  92. package/src/components/chat/chat-input/components/bottom-toolbar/ChatInputSessionTypeSelector.tsx +0 -40
  93. package/src/components/chat/chat-input/components/bottom-toolbar/ChatInputThinkingSelector.tsx +0 -74
  94. package/src/components/chat/chat-input/useChatInputBarController.ts +0 -322
@@ -0,0 +1,36 @@
1
+ var fa=Object.defineProperty;var pa=(e,t,n)=>t in e?fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var F=(e,t,n)=>pa(e,typeof t!="symbol"?t+"":t,n);import{j as h,a2 as ga,r as T,O as zt,a3 as ma,s as zn,A as Fn,B as Bn,N as fr,a4 as ya,z as xa,F as ba,D as Sa,E as ka,a5 as wa,t as va,c as Ca,R as Ia,o as Ta,T as Ti,I as Ra,C as Ri,P as Ea,h as Ei,V as Aa,i as Ai,k as La,l as $n,m as Ma,S as Li,f as Na,g as Mi,a as ja,a6 as pr,a7 as Pa,a8 as Da,a9 as _a,aa as Oa,q as za,ab as Fa,ac as Ba,ad as Ni,ae as ji,af as Pi,ag as $a,ah as Ua,ai as Ha,aj as Ka,ak as Va,al as qa,am as gn,an as mn,ao as yn,ap as gt,M as Wa,aq as Di,ar as Ga,as as Xa,at as Qa,J as Ya,au as Ja,av as Za}from"./vendor-B7ozqnFC.js";import{u as _i}from"./useConfirmDialog-A8Ek8Wu7.js";import{t as R,c as Ce,i as eo,j as to,k as Un,l as no,T as gr,L as mr,m as ro,B as Ye,I as Oi,n as Ft,S as xn,e as bn,g as Sn,h as ut,o as io,p as so,q as ao,r as oo,f as lo,C as uo,s as co,v as ho,u as fo,a as po,w as go,x as mo,y as yo,z as xo,A as bo,E as So,F as ko,G as wo,H as vo,J as Co}from"./index-DK4TS5ev.js";import{T as Io,a as To,b as Ro,c as Eo,P as Ao,R as Lo,d as Mo,e as No,C as zi,u as jo,M as Po}from"./MarketplacePage-DG5mHWJ8.js";import{S as Do,s as _o,a as yr,b as Oo,c as zo,e as xr}from"./session-run-status-TkIuGbVw.js";import{R as Fo,A as Bo,P as $o,C as Fi,T as Uo}from"./index-X5J6Mm--.js";import{P as Ho,a as Ko}from"./page-layout-BSYfvwbp.js";import{b as Vo,c as qo,r as Wo}from"./provider-models-D3B_xWXx.js";import"./index-uMsNsQX6.js";import"./skeleton-CWbsNx2h.js";import"./tabs-custom-Cf5azvT5.js";const Go={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 Xo({status:e,className:t}){const n=Go[e],r=e==="connected"?R("connected"):e==="disconnected"?R("disconnected"):R("connecting");return h.jsx(Io,{delayDuration:250,children:h.jsxs(To,{children:[h.jsx(Ro,{asChild:!0,children:h.jsx("span",{role:"status","aria-label":r,className:Ce("inline-flex h-5 w-5 items-center justify-center",t),children:e==="connecting"?h.jsx(ga,{className:Ce("h-3 w-3 animate-spin",n.dotClass)}):h.jsx("span",{className:Ce(e==="connected"?"h-2 w-2 rounded-full":"",n.dotClass)})})}),h.jsx(Eo,{side:"bottom",className:"text-xs",children:r})]})})}const Bi=T.createContext(null);function Qo({presenter:e,children:t}){return h.jsx(Bi.Provider,{value:e,children:t})}function Hn(){const e=T.useContext(Bi);if(!e)throw new Error("usePresenter must be used inside ChatPresenterProvider");return e}const Yo={sessionRunStatusByKey:new Map,isLocallyRunning:!1,activeBackendRunId:null},kn=zt(e=>({snapshot:Yo,setSnapshot:t=>e(n=>({snapshot:{...n.snapshot,...t}}))})),Jo={sessions:[],selectedSessionKey:null,selectedAgentId:"main",query:"",isLoading:!1},se=zt(e=>({snapshot:Jo,setSnapshot:t=>e(n=>({snapshot:{...n.snapshot,...t}}))}));function Zo(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-864e5,i=n-7*864e5,s=[],a=[],o=[],u=[];for(const c of e){const d=new Date(c.updatedAt).getTime();d>=n?s.push(c):d>=r?a.push(c):d>=i?o.push(c):u.push(c)}const l=[];return s.length>0&&l.push({label:R("chatSidebarToday"),sessions:s}),a.length>0&&l.push({label:R("chatSidebarYesterday"),sessions:a}),o.length>0&&l.push({label:R("chatSidebarPrevious7Days"),sessions:o}),u.length>0&&l.push({label:R("chatSidebarOlder"),sessions:u}),l}function el(e){if(e.label&&e.label.trim())return e.label.trim();const t=e.key.split(":");return t[t.length-1]||e.key}const tl=[{target:"/cron",label:()=>R("chatSidebarScheduledTasks"),icon:Fn},{target:"/skills",label:()=>R("chatSidebarSkills"),icon:Bn}];function nl(){var f,y;const e=Hn(),t=eo(),n=se(m=>m.snapshot),r=kn(m=>m.snapshot),i=to(m=>m.connectionStatus),{language:s,setLanguage:a}=Un(),{theme:o,setTheme:u}=no(),l=R(((f=gr.find(m=>m.value===o))==null?void 0:f.labelKey)??"themeWarm"),c=((y=mr.find(m=>m.value===s))==null?void 0:y.label)??s,d=T.useMemo(()=>Zo(n.sessions),[n.sessions]),p=m=>{s!==m&&(a(m),window.location.reload())};return h.jsxs("aside",{className:"w-[280px] shrink-0 flex flex-col h-full bg-secondary border-r border-gray-200/60",children:[h.jsx("div",{className:"px-5 pt-5 pb-3",children:h.jsx(ro,{className:"flex items-center gap-2.5 min-w-0",suffix:h.jsx(Xo,{status:i})})}),h.jsx("div",{className:"px-4 pb-3",children:h.jsxs(Ye,{variant:"primary",className:"w-full rounded-xl",onClick:e.chatSessionListManager.createSession,children:[h.jsx(ma,{className:"h-4 w-4 mr-2"}),R("chatSidebarNewTask")]})}),h.jsx("div",{className:"px-4 pb-3",children:h.jsxs("div",{className:"relative",children:[h.jsx(zn,{className:"h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400"}),h.jsx(Oi,{value:n.query,onChange:m=>e.chatSessionListManager.setQuery(m.target.value),placeholder:R("chatSidebarSearchPlaceholder"),className:"pl-8 h-9 rounded-lg text-xs"})]})}),h.jsx("div",{className:"px-3 pb-2",children:h.jsx("ul",{className:"space-y-0.5",children:tl.map(m=>{const S=m.icon;return h.jsx("li",{children:h.jsx(fr,{to:m.target,className:({isActive:g})=>Ce("group w-full flex items-center gap-3 px-3 py-2 rounded-xl text-[13px] font-medium transition-all duration-150",g?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900"),children:({isActive:g})=>h.jsxs(h.Fragment,{children:[h.jsx(S,{className:Ce("h-4 w-4 transition-colors",g?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),h.jsx("span",{children:m.label()})]})})},m.target)})})}),h.jsx("div",{className:"mx-4 border-t border-gray-200/60"}),h.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar px-3 py-2",children:n.isLoading?h.jsx("div",{className:"text-xs text-gray-500 p-3",children:R("sessionsLoading")}):d.length===0?h.jsxs("div",{className:"p-4 text-center",children:[h.jsx(ya,{className:"h-6 w-6 mx-auto mb-2 text-gray-300"}),h.jsx("div",{className:"text-xs text-gray-500",children:R("sessionsEmpty")})]}):h.jsx("div",{className:"space-y-3",children:d.map(m=>h.jsxs("div",{children:[h.jsx("div",{className:"px-2 py-1 text-[11px] font-medium text-gray-400 uppercase tracking-wider",children:m.label}),h.jsx("div",{className:"space-y-0.5",children:m.sessions.map(S=>{const g=n.selectedSessionKey===S.key,k=r.sessionRunStatusByKey.get(S.key);return h.jsxs("button",{onClick:()=>e.chatSessionListManager.selectSession(S.key),className:Ce("w-full rounded-xl px-3 py-2 text-left transition-all text-[13px]",g?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-700 hover:bg-gray-200/60 hover:text-gray-900"),children:[h.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_0.875rem] items-center gap-1.5",children:[h.jsx("span",{className:"truncate font-medium",children:el(S)}),h.jsx("span",{className:"inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:k?h.jsx(Do,{status:k}):null})]}),h.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-400 truncate",children:[S.messageCount," · ",Ft(S.updatedAt)]})]},S.key)})})]},m.label))})}),h.jsxs("div",{className:"px-3 py-3 border-t border-gray-200/60 space-y-0.5",children:[h.jsx(fr,{to:"/settings",className:({isActive:m})=>Ce("group w-full flex items-center gap-2.5 px-3 py-2 rounded-xl text-[13px] font-medium transition-all duration-150",m?"bg-gray-200 text-gray-900 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-200/60 hover:text-gray-900"),children:({isActive:m})=>h.jsxs(h.Fragment,{children:[h.jsx(xa,{className:Ce("h-4 w-4 transition-colors",m?"text-gray-900":"text-gray-500 group-hover:text-gray-800")}),h.jsx("span",{children:R("settings")})]})}),h.jsxs("button",{onClick:()=>t.open(void 0,{kind:"docs",newTab:!0,title:"Docs"}),className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-xl text-[13px] font-medium transition-all duration-150 text-gray-600 hover:bg-gray-200/60 hover:text-gray-800",children:[h.jsx(ba,{className:"h-4 w-4 text-gray-400"}),h.jsx("span",{children:R("docBrowserHelp")})]}),h.jsxs(xn,{value:o,onValueChange:m=>u(m),children:[h.jsxs(bn,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2 text-[13px] font-medium text-gray-600 hover:bg-gray-200/60 focus:ring-0",children:[h.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[h.jsx(Sa,{className:"h-4 w-4 text-gray-400"}),h.jsx("span",{children:R("theme")})]}),h.jsx("span",{className:"ml-auto text-[11px] text-gray-500",children:l})]}),h.jsx(Sn,{children:gr.map(m=>h.jsx(ut,{value:m.value,className:"text-xs",children:R(m.labelKey)},m.value))})]}),h.jsxs(xn,{value:s,onValueChange:m=>p(m),children:[h.jsxs(bn,{className:"w-full h-auto rounded-xl border-0 bg-transparent shadow-none px-3 py-2 text-[13px] font-medium text-gray-600 hover:bg-gray-200/60 focus:ring-0",children:[h.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[h.jsx(ka,{className:"h-4 w-4 text-gray-400"}),h.jsx("span",{children:R("language")})]}),h.jsx("span",{className:"ml-auto text-[11px] text-gray-500",children:c})]}),h.jsx(Sn,{children:mr.map(m=>h.jsx(ut,{value:m.value,className:"text-xs",children:m.label},m.value))})]})]})]})}function rl(e){return h.jsx("textarea",{value:e.value,onChange:t=>e.onValueChange(t.target.value),disabled:e.disabled,onKeyDown:e.onKeyDown,placeholder:e.placeholder,className:"w-full min-h-[68px] max-h-[220px] resize-y bg-transparent px-4 py-3 text-sm text-gray-800 outline-none placeholder:text-gray-400"})}function il(e){return e.items.length===0?null:h.jsx("div",{className:"px-4 pb-2",children:h.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.items.map(t=>h.jsxs("button",{type:"button",onClick:()=>e.onRemove(t.key),className:"inline-flex max-w-[200px] items-center gap-1.5 rounded-full bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary",children:[h.jsx("span",{className:"truncate",children:t.label}),h.jsx(wa,{className:"h-3 w-3 shrink-0"})]},t.key))})})}const sl=e=>`[data-item-index="${e}"]`;function $i(e){const t=e.getItemSelector??sl;T.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 al(){const e=T.useRef(null),[t,n]=T.useState(null);return T.useEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=()=>{n(r.getBoundingClientRect().width)};i();const s=new ResizeObserver(()=>i());return s.observe(r),()=>s.disconnect()},[]),{elementRef:e,width:t}}function ne(...e){return va(Ca(e))}const Ui=T.forwardRef(({className:e,type:t,...n},r)=>h.jsx("input",{type:t,className:ne("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}));Ui.displayName="ChatInput";const ol=Fo,ll=Uo,ul=Bo,Hi=T.forwardRef(({className:e,sideOffset:t=8,align:n="start",...r},i)=>h.jsx($o,{children:h.jsx(Fi,{ref:i,sideOffset:t,align:n,className:ne("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})}));Hi.displayName=Fi.displayName;const cl=Ia,dl=Ta,Ki=T.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Ti,{ref:r,className:ne("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(Ra,{asChild:!0,children:h.jsx(Ri,{className:"h-4 w-4 opacity-50"})})]}));Ki.displayName=Ti.displayName;const Vi=T.forwardRef(({className:e,...t},n)=>h.jsx(Li,{ref:n,className:ne("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(Na,{className:"h-4 w-4"})}));Vi.displayName=Li.displayName;const qi=T.forwardRef(({className:e,...t},n)=>h.jsx(Mi,{ref:n,className:ne("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(Ri,{className:"h-4 w-4"})}));qi.displayName=Mi.displayName;const Wi=T.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>h.jsx(Ea,{children:h.jsxs(Ei,{ref:i,className:ne("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(Vi,{}),h.jsx(Aa,{className:ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(qi,{})]})}));Wi.displayName=Ei.displayName;const Gi=T.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Ai,{ref:r,className:ne("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(La,{children:h.jsx($n,{className:"h-4 w-4"})})}),h.jsx(Ma,{children:t})]}));Gi.displayName=Ai.displayName;const hl=Ao,fl=Lo,pl=Mo,Xi=T.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(No,{children:h.jsx(zi,{ref:r,sideOffset:t,className:ne("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})}));Xi.displayName=zi.displayName;const mt={Popover:ol,PopoverAnchor:ul,PopoverContent:Hi,PopoverTrigger:ll,Input:Ui,Select:cl,SelectContent:Wi,SelectItem:Gi,SelectTrigger:Ki,SelectValue:dl,Tooltip:fl,TooltipContent:Xi,TooltipProvider:hl,TooltipTrigger:pl},gl=680,ml=.82,yl=560;function xl(e){const{Popover:t,PopoverAnchor:n,PopoverContent:r}=mt,{elementRef:i,width:s}=al(),a=T.useRef(null),{isOpen:o,isLoading:u,items:l,activeIndex:c,activeItem:d,texts:p,onSelectItem:f,onOpenChange:y,onSetActiveIndex:m}=e,S=T.useMemo(()=>{if(s)return Math.min(s>yl?s*ml:s,gl)},[s]);return $i({containerRef:a,activeIndex:c,itemCount:l.length,isEnabled:o&&!u,getItemSelector:g=>`[data-slash-index="${g}"]`}),h.jsxs(t,{open:o,onOpenChange:y,children:[h.jsx(n,{asChild:!0,children:h.jsx("div",{ref:i,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:S?{width:`${S}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:a,role:"listbox","aria-label":p.slashSectionLabel,className:"custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5",children:u?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}),l.length===0?h.jsx("div",{className:"px-2 text-xs text-gray-400",children:p.slashEmptyLabel}):h.jsx("div",{className:"space-y-1",children:l.map((g,k)=>{const w=k===c;return h.jsxs("button",{type:"button",role:"option","aria-selected":w,"data-slash-index":k,onMouseEnter:()=>m(k),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 bl=ja("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"}}),At=T.forwardRef(({className:e,variant:t,size:n,...r},i)=>h.jsx("button",{className:ne(bl({variant:t,size:n,className:e})),ref:i,...r}));At.displayName="ChatButton";function Sl(e){var s;const{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=mt;return h.jsxs("div",{className:"flex flex-col items-end gap-1",children:[(s=e.sendError)!=null&&s.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(At,{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(pr,{className:"h-3 w-3 fill-current"})}):h.jsx(r,{children:h.jsxs(t,{children:[h.jsx(i,{asChild:!0,children:h.jsx("span",{children:h.jsx(At,{size:"icon",variant:"outline",className:"h-8 w-8 rounded-full","aria-label":e.stopButtonLabel,disabled:!0,children:h.jsx(pr,{className:"h-3 w-3 fill-current"})})})}),h.jsx(n,{side:"top",children:h.jsx("p",{className:"text-xs",children:e.stopHint})})]})}):h.jsx(At,{size:"icon",className:"h-8 w-8 rounded-full","aria-label":e.sendButtonLabel,onClick:()=>void e.onSend(),disabled:e.sendDisabled,children:h.jsx(Pa,{className:"h-5 w-5"})})})]})}function kl(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>[r.label,r.key,r.description].filter(s=>typeof s=="string"&&s.trim().length>0).join(" ").toLowerCase().includes(n)):e}function wl(e){const{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i}=mt,{picker:s}=e,a=T.useRef(null),o=T.useId(),[u,l]=T.useState(""),[c,d]=T.useState(0),p=T.useMemo(()=>new Set(s.selectedKeys),[s.selectedKeys]),f=s.selectedKeys.length,y=T.useMemo(()=>kl(s.options,u),[s.options,u]);T.useEffect(()=>{d(0)},[u]),T.useEffect(()=>{d(g=>y.length===0?0:Math.min(g,y.length-1))},[y.length]),$i({containerRef:a,activeIndex:c,itemCount:y.length,isEnabled:y.length>0,getItemSelector:g=>`[data-skill-index="${g}"]`});const m=g=>{if(p.has(g)){s.onSelectedKeysChange(s.selectedKeys.filter(k=>k!==g));return}s.onSelectedKeysChange([...s.selectedKeys,g])},S=g=>{if(y.length!==0){if(g.key==="ArrowDown"){g.preventDefault(),d(k=>Math.min(k+1,y.length-1));return}if(g.key==="ArrowUp"){g.preventDefault(),d(k=>Math.max(k-1,0));return}if(g.key==="Enter"){g.preventDefault();const k=y[c];k&&m(k.key)}}};return h.jsxs(n,{children:[h.jsx(i,{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(Bn,{className:"h-4 w-4"}),h.jsx("span",{children:s.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:s.title}),h.jsxs("div",{className:"relative",children:[h.jsx(zn,{className:"pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400"}),h.jsx(t,{value:u,onChange:g=>l(g.target.value),onKeyDown:S,placeholder:s.searchPlaceholder,role:"combobox","aria-controls":o,"aria-expanded":"true","aria-autocomplete":"list","aria-activedescendant":y[c]?`${o}-option-${c}`:void 0,className:"h-8 rounded-lg pl-8 text-xs"})]})]}),h.jsx("div",{ref:a,id:o,role:"listbox","aria-multiselectable":"true",className:"custom-scrollbar max-h-[320px] overflow-y-auto",children:s.isLoading?h.jsx("div",{className:"p-4 text-xs text-gray-500",children:s.loadingLabel}):y.length===0?h.jsx("div",{className:"p-4 text-center text-xs text-gray-500",children:s.emptyLabel}):h.jsx("div",{className:"py-1",children:y.map((g,k)=>{const w=p.has(g.key),M=k===c;return h.jsxs("button",{type:"button",id:`${o}-option-${k}`,role:"option","aria-selected":w,"data-skill-index":k,onClick:()=>m(g.key),onMouseEnter:()=>d(k),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${M?"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(Da,{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($n,{className:"h-3 w-3"}):null})})]},g.key)})})}),s.manageHref&&s.manageLabel?h.jsx("div",{className:"border-t border-gray-100 px-4 py-2.5",children:h.jsxs("a",{href:s.manageHref,className:"inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80",children:[s.manageLabel,h.jsx(_a,{className:"h-3 w-3"})]})}):null]})]})}function Qi({icon:e}){return e==="sparkles"?h.jsx(za,{className:"h-3.5 w-3.5 shrink-0 text-primary"}):e==="brain"?h.jsx(Fa,{className:"h-3.5 w-3.5 shrink-0 text-gray-500"}):null}function vl({icon:e}){return e==="paperclip"?h.jsx(Oa,{className:"h-4 w-4"}):h.jsx(Qi,{icon:e})}function Cl(e){return e==="model"?"min-w-[220px]":e==="session-type"?"min-w-[140px]":e==="thinking"?"min-w-[150px]":""}function Il(e){return e==="model"?"w-[320px]":e==="session-type"?"w-[220px]":e==="thinking"?"w-[180px]":""}function Tl({item:e}){const{Select:t,SelectContent:n,SelectItem:r,SelectTrigger:i,SelectValue:s}=mt;return h.jsxs(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[h.jsx(i,{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 ${Cl(e.key)}`,children:e.selectedLabel?h.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-left",children:[h.jsx(Qi,{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(s,{placeholder:e.placeholder})}),h.jsxs(n,{className:Il(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(a=>h.jsx(r,{value:a.value,className:"py-2",children:a.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:a.label}),h.jsx("span",{className:"truncate text-[11px] text-gray-500",children:a.description})]}):h.jsx("span",{className:"truncate text-xs font-semibold text-gray-800",children:a.label})},a.value))]})]})}function Rl(e){var s;const{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=mt;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(wl,{picker:e.skillPicker}):null,e.selects.map(a=>h.jsx(Tl,{item:a},a.key)),(s=e.accessories)==null?void 0:s.map(a=>{const o=h.jsxs("button",{type:"button",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 disabled:cursor-not-allowed disabled:text-gray-400",onClick:a.onClick,disabled:a.disabled,"aria-label":a.label,children:[h.jsx(vl,{icon:a.icon}),h.jsx("span",{children:a.label})]});return a.tooltip?h.jsx(r,{children:h.jsxs(t,{children:[h.jsx(i,{asChild:!0,children:o}),h.jsx(n,{side:"top",children:h.jsx("p",{className:"text-xs",children:a.tooltip})})]})},a.key):h.jsx("div",{children:o},a.key)})]}),h.jsx(Sl,{...e.actions})]})}function El({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 Al(e){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(rl,{value:e.value,placeholder:e.placeholder,disabled:e.disabled,onValueChange:e.onValueChange,onKeyDown:e.onKeyDown}),h.jsx(xl,{...e.slashMenu})]}),h.jsx(El,{hint:e.hint}),h.jsx(il,{items:e.selectedItems.items,onRemove:e.selectedItems.onRemove}),h.jsx(Rl,{...e.toolbar})]})})})}function qt({role:e}){return e==="user"?h.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-white shadow-sm",children:h.jsx(Ba,{className:"h-4 w-4"})}):e==="assistant"?h.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-slate-900 text-white shadow-sm",children:h.jsx(Ni,{className:"h-4 w-4"})}):h.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-amber-100 text-amber-700 shadow-sm",children:h.jsx(ji,{className:"h-4 w-4"})})}function Ll(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Ml=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nl=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jl={};function br(e,t){return(jl.jsx?Nl:Ml).test(e)}const Pl=/[ \t\n\f\r]/g;function Dl(e){return typeof e=="object"?e.type==="text"?Sr(e.value):!1:Sr(e)}function Sr(e){return e.replace(Pl,"")===""}class yt{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}yt.prototype.normal={};yt.prototype.property={};yt.prototype.space=void 0;function Yi(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new yt(n,r,t)}function wn(e){return e.toLowerCase()}class pe{constructor(t,n){this.attribute=n,this.property=t}}pe.prototype.attribute="";pe.prototype.booleanish=!1;pe.prototype.boolean=!1;pe.prototype.commaOrSpaceSeparated=!1;pe.prototype.commaSeparated=!1;pe.prototype.defined=!1;pe.prototype.mustUseProperty=!1;pe.prototype.number=!1;pe.prototype.overloadedBoolean=!1;pe.prototype.property="";pe.prototype.spaceSeparated=!1;pe.prototype.space=void 0;let _l=0;const U=Ve(),te=Ve(),vn=Ve(),E=Ve(),J=Ve(),Je=Ve(),me=Ve();function Ve(){return 2**++_l}const Cn=Object.freeze(Object.defineProperty({__proto__:null,boolean:U,booleanish:te,commaOrSpaceSeparated:me,commaSeparated:Je,number:E,overloadedBoolean:vn,spaceSeparated:J},Symbol.toStringTag,{value:"Module"})),Wt=Object.keys(Cn);class Kn extends pe{constructor(t,n,r,i){let s=-1;if(super(t,n),kr(this,"space",i),typeof r=="number")for(;++s<Wt.length;){const a=Wt[s];kr(this,Wt[s],(r&Cn[a])===Cn[a])}}}Kn.prototype.defined=!0;function kr(e,t,n){n&&(e[t]=n)}function et(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Kn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[wn(r)]=r,n[wn(s.attribute)]=r}return new yt(t,n,e.space)}const Ji=et({properties:{ariaActiveDescendant:null,ariaAtomic:te,ariaAutoComplete:null,ariaBusy:te,ariaChecked:te,ariaColCount:E,ariaColIndex:E,ariaColSpan:E,ariaControls:J,ariaCurrent:null,ariaDescribedBy:J,ariaDetails:null,ariaDisabled:te,ariaDropEffect:J,ariaErrorMessage:null,ariaExpanded:te,ariaFlowTo:J,ariaGrabbed:te,ariaHasPopup:null,ariaHidden:te,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:J,ariaLevel:E,ariaLive:null,ariaModal:te,ariaMultiLine:te,ariaMultiSelectable:te,ariaOrientation:null,ariaOwns:J,ariaPlaceholder:null,ariaPosInSet:E,ariaPressed:te,ariaReadOnly:te,ariaRelevant:null,ariaRequired:te,ariaRoleDescription:J,ariaRowCount:E,ariaRowIndex:E,ariaRowSpan:E,ariaSelected:te,ariaSetSize:E,ariaSort:null,ariaValueMax:E,ariaValueMin:E,ariaValueNow:E,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Zi(e,t){return t in e?e[t]:t}function es(e,t){return Zi(e,t.toLowerCase())}const Ol=et({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Je,acceptCharset:J,accessKey:J,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:J,autoFocus:U,autoPlay:U,blocking:J,capture:null,charSet:null,checked:U,cite:null,className:J,cols:E,colSpan:null,content:null,contentEditable:te,controls:U,controlsList:J,coords:E|Je,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:vn,draggable:te,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:J,height:E,hidden:vn,high:E,href:null,hrefLang:null,htmlFor:J,httpEquiv:J,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:J,itemRef:J,itemScope:U,itemType:J,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:E,manifest:null,max:null,maxLength:E,media:null,method:null,min:null,minLength:E,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,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:U,optimum:E,pattern:null,ping:J,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:J,required:U,reversed:U,rows:E,rowSpan:E,sandbox:J,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:E,sizes:null,slot:null,span:E,spellCheck:te,src:null,srcDoc:null,srcLang:null,srcSet:null,start:E,step:null,style:null,tabIndex:E,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:te,width:E,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:J,axis:null,background:null,bgColor:null,border:E,borderColor:null,bottomMargin:E,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:E,leftMargin:E,link:null,longDesc:null,lowSrc:null,marginHeight:E,marginWidth:E,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:E,rules:null,scheme:null,scrolling:te,standby:null,summary:null,text:null,topMargin:E,valueType:null,version:null,vAlign:null,vLink:null,vSpace:E,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:E,security:null,unselectable:null},space:"html",transform:es}),zl=et({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:me,accentHeight:E,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:E,amplitude:E,arabicForm:null,ascent:E,attributeName:null,attributeType:null,azimuth:E,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:E,by:null,calcMode:null,capHeight:E,className:J,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:E,diffuseConstant:E,direction:null,display:null,dur:null,divisor:E,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:E,enableBackground:null,end:null,event:null,exponent:E,externalResourcesRequired:null,fill:null,fillOpacity:E,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:Je,g2:Je,glyphName:Je,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:E,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:E,horizOriginX:E,horizOriginY:E,id:null,ideographic:E,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:E,k:E,k1:E,k2:E,k3:E,k4:E,kernelMatrix:me,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:E,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:E,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:E,overlineThickness:E,paintOrder:null,panose1:null,path:null,pathLength:E,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:J,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:E,pointsAtY:E,pointsAtZ:E,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:me,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:me,rev:me,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:me,requiredFeatures:me,requiredFonts:me,requiredFormats:me,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:E,specularExponent:E,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:E,strikethroughThickness:E,string:null,stroke:null,strokeDashArray:me,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:E,strokeOpacity:E,strokeWidth:null,style:null,surfaceScale:E,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:me,tabIndex:E,tableValues:null,target:null,targetX:E,targetY:E,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:me,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:E,underlineThickness:E,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:E,values:null,vAlphabetic:E,vMathematical:E,vectorEffect:null,vHanging:E,vIdeographic:E,version:null,vertAdvY:E,vertOriginX:E,vertOriginY:E,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:E,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Zi}),ts=et({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()}}),ns=et({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:es}),rs=et({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Fl={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"},Bl=/[A-Z]/g,wr=/-[a-z]/g,$l=/^data[-\w.:]+$/i;function Ul(e,t){const n=wn(t);let r=t,i=pe;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&$l.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(wr,Kl);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!wr.test(s)){let a=s.replace(Bl,Hl);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Kn}return new i(r,t)}function Hl(e){return"-"+e.toLowerCase()}function Kl(e){return e.charAt(1).toUpperCase()}const Vl=Yi([Ji,Ol,ts,ns,rs],"html"),Vn=Yi([Ji,zl,ts,ns,rs],"svg");function ql(e){return e.join(" ").trim()}var We={},Gt,vr;function Wl(){if(vr)return Gt;vr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,u=`
2
+ `,l="/",c="*",d="",p="comment",f="declaration";function y(S,g){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];g=g||{};var k=1,w=1;function M(O){var N=O.match(t);N&&(k+=N.length);var G=O.lastIndexOf(u);w=~G?O.length-G:w+O.length}function A(){var O={line:k,column:w};return function(N){return N.position=new C(O),B(),N}}function C(O){this.start=O,this.end={line:k,column:w},this.source=g.source}C.prototype.content=S;function P(O){var N=new Error(g.source+":"+k+":"+w+": "+O);if(N.reason=O,N.filename=g.source,N.line=k,N.column=w,N.source=S,!g.silent)throw N}function j(O){var N=O.exec(S);if(N){var G=N[0];return M(G),S=S.slice(G.length),N}}function B(){j(n)}function v(O){var N;for(O=O||[];N=D();)N!==!1&&O.push(N);return O}function D(){var O=A();if(!(l!=S.charAt(0)||c!=S.charAt(1))){for(var N=2;d!=S.charAt(N)&&(c!=S.charAt(N)||l!=S.charAt(N+1));)++N;if(N+=2,d===S.charAt(N-1))return P("End of comment missing");var G=S.slice(2,N-2);return w+=2,M(G),S=S.slice(N),w+=2,O({type:p,comment:G})}}function _(){var O=A(),N=j(r);if(N){if(D(),!j(i))return P("property missing ':'");var G=j(s),Y=O({type:f,property:m(N[0].replace(e,d)),value:G?m(G[0].replace(e,d)):d});return j(a),Y}}function W(){var O=[];v(O);for(var N;N=_();)N!==!1&&(O.push(N),v(O));return O}return B(),W()}function m(S){return S?S.replace(o,d):d}return Gt=y,Gt}var Cr;function Gl(){if(Cr)return We;Cr=1;var e=We&&We.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(We,"__esModule",{value:!0}),We.default=n;const t=e(Wl());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const a=(0,t.default)(r),o=typeof i=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:l,value:c}=u;o?i(l,c,u):c&&(s=s||{},s[l]=c)}),s}return We}var it={},Ir;function Xl(){if(Ir)return it;Ir=1,Object.defineProperty(it,"__esModule",{value:!0}),it.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(l){return!l||n.test(l)||e.test(l)},a=function(l,c){return c.toUpperCase()},o=function(l,c){return"".concat(c,"-")},u=function(l,c){return c===void 0&&(c={}),s(l)?l:(l=l.toLowerCase(),c.reactCompat?l=l.replace(i,o):l=l.replace(r,o),l.replace(t,a))};return it.camelCase=u,it}var st,Tr;function Ql(){if(Tr)return st;Tr=1;var e=st&&st.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(Gl()),n=Xl();function r(i,s){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(o,u){o&&u&&(a[(0,n.camelCase)(o,s)]=u)}),a}return r.default=r,st=r,st}var Yl=Ql();const Jl=Pi(Yl),is=ss("end"),qn=ss("start");function ss(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 Zl(e){const t=qn(e),n=is(e);if(t&&n)return{start:t,end:n}}function ct(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rr(e.position):"start"in e||"end"in e?Rr(e):"line"in e||"column"in e?In(e):""}function In(e){return Er(e&&e.line)+":"+Er(e&&e.column)}function Rr(e){return In(e&&e.start)+"-"+In(e&&e.end)}function Er(e){return e&&typeof e=="number"?e:1}class oe extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=ct(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}oe.prototype.file="";oe.prototype.name="";oe.prototype.reason="";oe.prototype.message="";oe.prototype.stack="";oe.prototype.column=void 0;oe.prototype.line=void 0;oe.prototype.ancestors=void 0;oe.prototype.cause=void 0;oe.prototype.fatal=void 0;oe.prototype.place=void 0;oe.prototype.ruleId=void 0;oe.prototype.source=void 0;const Wn={}.hasOwnProperty,eu=new Map,tu=/[A-Z]/g,nu=new Set(["table","tbody","thead","tfoot","tr"]),ru=new Set(["td","th"]),as="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function iu(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=hu(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=du(n,t.jsx,t.jsxs)}const i={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"?Vn:Vl,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=os(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function os(e,t,n){if(t.type==="element")return su(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return au(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return lu(e,t,n);if(t.type==="mdxjsEsm")return ou(e,t);if(t.type==="root")return uu(e,t,n);if(t.type==="text")return cu(e,t)}function su(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Vn,e.schema=i),e.ancestors.push(t);const s=us(e,t.tagName,!1),a=fu(e,t);let o=Xn(e,t);return nu.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!Dl(u):!0})),ls(e,a,s,t),Gn(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function au(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)}ft(e,t.position)}function ou(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ft(e,t.position)}function lu(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Vn,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:us(e,t.name,!0),a=pu(e,t),o=Xn(e,t);return ls(e,a,s,t),Gn(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function uu(e,t,n){const r={};return Gn(r,Xn(e,t)),e.create(t,e.Fragment,r,n)}function cu(e,t){return t.value}function ls(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Gn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function du(e,t,n){return r;function r(i,s,a,o){const l=Array.isArray(a.children)?n:t;return o?l(s,a,o):l(s,a)}}function hu(e,t){return n;function n(r,i,s,a){const o=Array.isArray(s.children),u=qn(r);return t(i,s,a,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function fu(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Wn.call(t.properties,i)){const s=gu(e,i,t.properties[i]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&ru.has(t.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function pu(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else ft(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,s=e.evaluater.evaluateExpression(o.expression)}else ft(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Xn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:eu;for(;++r<t.children.length;){const s=t.children[r];let a;if(e.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const l=i.get(u)||0;a=u+"-"+l,i.set(u,l+1)}}const o=os(e,s,a);o!==void 0&&n.push(o)}return n}function gu(e,t,n){const r=Ul(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ll(n):ql(n)),r.property==="style"){let i=typeof n=="object"?n:mu(e,String(n));return e.stylePropertyNameCase==="css"&&(i=yu(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Fl[r.property]||r.property:r.attribute,n]}}function mu(e,t){try{return Jl(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new oe("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=as+"#cannot-parse-style-attribute",i}}function us(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,a;for(;++s<i.length;){const o=br(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=br(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Wn.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ft(e)}function ft(e,t){const n=new oe("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=as+"#cannot-handle-mdx-estrees-without-createevaluater",n}function yu(e){const t={};let n;for(n in e)Wn.call(e,n)&&(t[xu(n)]=e[n]);return t}function xu(e){let t=e.replace(tu,bu);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function bu(e){return"-"+e.toLowerCase()}const Xt={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"]},Su={};function Qn(e,t){const n=Su,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return cs(e,r,i)}function cs(e,t,n){if(ku(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 Ar(e.children,t,n)}return Array.isArray(e)?Ar(e,t,n):""}function Ar(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=cs(e[i],t,n);return r.join("")}function ku(e){return!!(e&&typeof e=="object")}const Lr=document.createElement("i");function Yn(e){const t="&"+e+";";Lr.innerHTML=t;const n=Lr.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ye(e,t,n,r){const i=e.length;let s=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(t,0),e.splice(...a),s+=1e4,t+=1e4}function Se(e,t){return e.length>0?(ye(e,e.length,0,t),e):t}const Mr={}.hasOwnProperty;function ds(e){const t={};let n=-1;for(;++n<e.length;)wu(t,e[n]);return t}function wu(e,t){let n;for(n in t){const i=(Mr.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let a;if(s)for(a in s){Mr.call(i,a)||(i[a]=[]);const o=s[a];vu(i[a],Array.isArray(o)?o:o?[o]:[])}}}function vu(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ye(e,0,0,r)}function hs(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 Ie(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ce=Fe(/[A-Za-z]/),ae=Fe(/[\dA-Za-z]/),Cu=Fe(/[#-'*+\--9=?A-Z^-~]/);function Nt(e){return e!==null&&(e<32||e===127)}const Tn=Fe(/\d/),Iu=Fe(/[\dA-Fa-f]/),Tu=Fe(/[!-/:-@[-`{-~]/);function z(e){return e!==null&&e<-2}function Q(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const Bt=Fe(new RegExp("\\p{P}|\\p{S}","u")),Ke=Fe(/\s/);function Fe(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function tt(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(s===37&&ae(e.charCodeAt(n+1))&&ae(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=e.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function q(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(u){return H(u)?(e.enter(n),o(u)):t(u)}function o(u){return H(u)&&s++<i?(e.consume(u),o):(e.exit(n),t(u))}}const Ru={tokenize:Eu};function Eu(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),q(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),s(o)}function s(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(o)}function a(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return z(o)?(e.consume(o),e.exit("chunkText"),s):(e.consume(o),a)}}const Au={tokenize:Lu},Nr={tokenize:Mu};function Lu(e){const t=this,n=[];let r=0,i,s,a;return o;function o(w){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,u,l)(w)}return l(w)}function u(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&k();const M=t.events.length;let A=M,C;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){C=t.events[A][1].end;break}g(r);let P=M;for(;P<t.events.length;)t.events[P][1].end={...C},P++;return ye(t.events,A+1,0,t.events.slice(M)),t.events.length=P,l(w)}return o(w)}function l(w){if(r===n.length){if(!i)return p(w);if(i.currentConstruct&&i.currentConstruct.concrete)return y(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Nr,c,d)(w)}function c(w){return i&&k(),g(r),p(w)}function d(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(w)}function p(w){return t.containerState={},e.attempt(Nr,f,y)(w)}function f(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function y(w){if(w===null){i&&k(),g(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),m(w)}function m(w){if(w===null){S(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return z(w)?(e.consume(w),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(w),m)}function S(w,M){const A=t.sliceStream(w);if(M&&A.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(A),t.parser.lazy[w.start.line]){let C=i.events.length;for(;C--;)if(i.events[C][1].start.offset<a&&(!i.events[C][1].end||i.events[C][1].end.offset>a))return;const P=t.events.length;let j=P,B,v;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){if(B){v=t.events[j][1].end;break}B=!0}for(g(r),C=P;C<t.events.length;)t.events[C][1].end={...v},C++;ye(t.events,j+1,0,t.events.slice(P)),t.events.length=C}}function g(w){let M=n.length;for(;M-- >w;){const A=n[M];t.containerState=A[1],A[0].exit.call(t,e)}n.length=w}function k(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Mu(e,t,n){return q(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ze(e){if(e===null||Q(e)||Ke(e))return 1;if(Bt(e))return 2}function $t(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Rn={name:"attention",resolveAll:Nu,tokenize:ju};function Nu(e,t){let n=-1,r,i,s,a,o,u,l,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;u=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};jr(d,-u),jr(p,u),a={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Se(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=Se(l,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),l=Se(l,$t(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Se(l,[["exit",s,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,l=Se(l,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,ye(e,r-1,n-r+3,l),n=r+l.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ju(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ze(r);let s;return a;function a(u){return s=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===s)return e.consume(u),o;const l=e.exit("attentionSequence"),c=Ze(u),d=!c||c===2&&i||n.includes(u),p=!i||i===2&&c||n.includes(r);return l._open=!!(s===42?d:d&&(i||!p)),l._close=!!(s===42?p:p&&(c||!d)),t(u)}}function jr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Pu={name:"autolink",tokenize:Du};function Du(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return ce(f)?(e.consume(f),a):f===64?n(f):l(f)}function a(f){return f===43||f===45||f===46||ae(f)?(r=1,o(f)):l(f)}function o(f){return f===58?(e.consume(f),r=0,u):(f===43||f===45||f===46||ae(f))&&r++<32?(e.consume(f),o):(r=0,l(f))}function u(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||Nt(f)?n(f):(e.consume(f),u)}function l(f){return f===64?(e.consume(f),c):Cu(f)?(e.consume(f),l):n(f)}function c(f){return ae(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||ae(f))&&r++<63){const y=f===45?p:d;return e.consume(f),y}return n(f)}}const xt={partial:!0,tokenize:_u};function _u(e,t,n){return r;function r(s){return H(s)?q(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||z(s)?t(s):n(s)}}const fs={continuation:{tokenize:zu},exit:Fu,name:"blockQuote",tokenize:Ou};function Ou(e,t,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),s}return n(a)}function s(a){return H(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function zu(e,t,n){const r=this;return i;function i(a){return H(a)?q(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(fs,t,n)(a)}}function Fu(e){e.exit("blockQuote")}const ps={name:"characterEscape",tokenize:Bu};function Bu(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return Tu(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const gs={name:"characterReference",tokenize:$u};function $u(e,t,n){const r=this;let i=0,s,a;return o;function o(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),s=31,a=ae,c(d))}function l(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,a=Iu,c):(e.enter("characterReferenceValue"),s=7,a=Tn,c(d))}function c(d){if(d===59&&i){const p=e.exit("characterReferenceValue");return a===ae&&!Yn(r.sliceSerialize(p))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&i++<s?(e.consume(d),c):n(d)}}const Pr={partial:!0,tokenize:Hu},Dr={concrete:!0,name:"codeFenced",tokenize:Uu};function Uu(e,t,n){const r=this,i={partial:!0,tokenize:A};let s=0,a=0,o;return u;function u(C){return l(C)}function l(C){const P=r.events[r.events.length-1];return s=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,o=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(C)}function c(C){return C===o?(a++,e.consume(C),c):a<3?n(C):(e.exit("codeFencedFenceSequence"),H(C)?q(e,d,"whitespace")(C):d(C))}function d(C){return C===null||z(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(Pr,m,M)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||z(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(C)):H(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),q(e,f,"whitespace")(C)):C===96&&C===o?n(C):(e.consume(C),p)}function f(C){return C===null||z(C)?d(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||z(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(C)):C===96&&C===o?n(C):(e.consume(C),y)}function m(C){return e.attempt(i,M,S)(C)}function S(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),g}function g(C){return s>0&&H(C)?q(e,k,"linePrefix",s+1)(C):k(C)}function k(C){return C===null||z(C)?e.check(Pr,m,M)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||z(C)?(e.exit("codeFlowValue"),k(C)):(e.consume(C),w)}function M(C){return e.exit("codeFenced"),t(C)}function A(C,P,j){let B=0;return v;function v(N){return C.enter("lineEnding"),C.consume(N),C.exit("lineEnding"),D}function D(N){return C.enter("codeFencedFence"),H(N)?q(C,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):_(N)}function _(N){return N===o?(C.enter("codeFencedFenceSequence"),W(N)):j(N)}function W(N){return N===o?(B++,C.consume(N),W):B>=a?(C.exit("codeFencedFenceSequence"),H(N)?q(C,O,"whitespace")(N):O(N)):j(N)}function O(N){return N===null||z(N)?(C.exit("codeFencedFence"),P(N)):j(N)}}}function Hu(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Qt={name:"codeIndented",tokenize:Vu},Ku={partial:!0,tokenize:qu};function Vu(e,t,n){const r=this;return i;function i(l){return e.enter("codeIndented"),q(e,s,"linePrefix",5)(l)}function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?a(l):n(l)}function a(l){return l===null?u(l):z(l)?e.attempt(Ku,a,u)(l):(e.enter("codeFlowValue"),o(l))}function o(l){return l===null||z(l)?(e.exit("codeFlowValue"),a(l)):(e.consume(l),o)}function u(l){return e.exit("codeIndented"),t(l)}}function qu(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):z(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):q(e,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):z(a)?i(a):n(a)}}const Wu={name:"codeText",previous:Xu,resolve:Gu,tokenize:Qu};function Gu(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Xu(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Qu(e,t,n){let r=0,i,s;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),o(d)}function o(d){return d===96?(e.consume(d),r++,o):(e.exit("codeTextSequence"),u(d))}function u(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),u):d===96?(s=e.enter("codeTextSequence"),i=0,c(d)):z(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("codeTextData"),l(d))}function l(d){return d===null||d===32||d===96||z(d)?(e.exit("codeTextData"),u(d)):(e.consume(d),l)}function c(d){return d===96?(e.consume(d),i++,c):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",l(d))}}class Yu{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 i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&at(this.left,r),s.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),at(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),at(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);at(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);at(this.left,n.reverse())}}}function at(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 ms(e){const t={};let n=-1,r,i,s,a,o,u,l;const c=new Yu(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"&&(u=r[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Ju(c,n)),n=t[n],l=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=c.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(c.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...c.get(i)[1].start},o=c.slice(i,n),o.unshift(r),c.splice(i,n-i+1,o))}}return ye(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!l}function Ju(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,u=[],l={};let c,d,p=-1,f=n,y=0,m=0;const S=[m];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),d&&a.defineSkip(f.start),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(c),f._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(m=p+1,S.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(a.events=[],f?(f._tokenizer=void 0,f.previous=void 0):S.pop(),p=S.length;p--;){const g=o.slice(S[p],S[p+1]),k=s.pop();u.push([k,k+g.length-1]),e.splice(k,2,g)}for(u.reverse(),p=-1;++p<u.length;)l[y+u[p][0]]=y+u[p][1],y+=u[p][1]-u[p][0]-1;return l}const Zu={resolve:tc,tokenize:nc},ec={partial:!0,tokenize:rc};function tc(e){return ms(e),e}function nc(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):z(o)?e.check(ec,a,s)(o):(e.consume(o),i)}function s(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function a(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function rc(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),q(e,s,"linePrefix")}function s(a){if(a===null||z(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function ys(e,t,n,r,i,s,a,o,u){const l=u||Number.POSITIVE_INFINITY;let c=0;return d;function d(g){return g===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(g),e.exit(s),p):g===null||g===32||g===41||Nt(g)?n(g):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(g))}function p(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===62?(e.exit("chunkString"),e.exit(o),p(g)):g===null||g===60||z(g)?n(g):(e.consume(g),g===92?y:f)}function y(g){return g===60||g===62||g===92?(e.consume(g),f):f(g)}function m(g){return!c&&(g===null||g===41||Q(g))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(g)):c<l&&g===40?(e.consume(g),c++,m):g===41?(e.consume(g),c--,m):g===null||g===32||g===40||Nt(g)?n(g):(e.consume(g),g===92?S:m)}function S(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function xs(e,t,n,r,i,s){const a=this;let o=0,u;return l;function l(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),c}function c(f){return o>999||f===null||f===91||f===93&&!u||f===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):z(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||z(f)||o++>999?(e.exit("chunkString"),c(f)):(e.consume(f),u||(u=!H(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(e.consume(f),o++,d):d(f)}}function bs(e,t,n,r,i,s){let a;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),a=p===40?41:p,u):n(p)}function u(p){return p===a?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(s),l(p))}function l(p){return p===a?(e.exit(s),u(a)):p===null?n(p):z(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),q(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===a||p===null||z(p)?(e.exit("chunkString"),l(p)):(e.consume(p),p===92?d:c)}function d(p){return p===a||p===92?(e.consume(p),c):c(p)}}function dt(e,t){let n;return r;function r(i){return z(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):H(i)?q(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ic={name:"definition",tokenize:ac},sc={partial:!0,tokenize:oc};function ac(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),a(f)}function a(f){return xs.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function o(f){return i=Ie(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),u):n(f)}function u(f){return Q(f)?dt(e,l)(f):l(f)}function l(f){return ys(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return e.attempt(sc,d,d)(f)}function d(f){return H(f)?q(e,p,"whitespace")(f):p(f)}function p(f){return f===null||z(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function oc(e,t,n){return r;function r(o){return Q(o)?dt(e,i)(o):n(o)}function i(o){return bs(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return H(o)?q(e,a,"whitespace")(o):a(o)}function a(o){return o===null||z(o)?t(o):n(o)}}const lc={name:"hardBreakEscape",tokenize:uc};function uc(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return z(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const cc={name:"headingAtx",resolve:dc,tokenize:hc};function dc(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ye(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function hc(e,t,n){let r=0;return i;function i(c){return e.enter("atxHeading"),s(c)}function s(c){return e.enter("atxHeadingSequence"),a(c)}function a(c){return c===35&&r++<6?(e.consume(c),a):c===null||Q(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),u(c)):c===null||z(c)?(e.exit("atxHeading"),t(c)):H(c)?q(e,o,"whitespace")(c):(e.enter("atxHeadingText"),l(c))}function u(c){return c===35?(e.consume(c),u):(e.exit("atxHeadingSequence"),o(c))}function l(c){return c===null||c===35||Q(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),l)}}const fc=["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"],_r=["pre","script","style","textarea"],pc={concrete:!0,name:"htmlFlow",resolveTo:yc,tokenize:xc},gc={partial:!0,tokenize:Sc},mc={partial:!0,tokenize:bc};function yc(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 xc(e,t,n){const r=this;let i,s,a,o,u;return l;function l(b){return c(b)}function c(b){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(b),d}function d(b){return b===33?(e.consume(b),p):b===47?(e.consume(b),s=!0,m):b===63?(e.consume(b),i=3,r.interrupt?t:x):ce(b)?(e.consume(b),a=String.fromCharCode(b),S):n(b)}function p(b){return b===45?(e.consume(b),i=2,f):b===91?(e.consume(b),i=5,o=0,y):ce(b)?(e.consume(b),i=4,r.interrupt?t:x):n(b)}function f(b){return b===45?(e.consume(b),r.interrupt?t:x):n(b)}function y(b){const he="CDATA[";return b===he.charCodeAt(o++)?(e.consume(b),o===he.length?r.interrupt?t:_:y):n(b)}function m(b){return ce(b)?(e.consume(b),a=String.fromCharCode(b),S):n(b)}function S(b){if(b===null||b===47||b===62||Q(b)){const he=b===47,Te=a.toLowerCase();return!he&&!s&&_r.includes(Te)?(i=1,r.interrupt?t(b):_(b)):fc.includes(a.toLowerCase())?(i=6,he?(e.consume(b),g):r.interrupt?t(b):_(b)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(b):s?k(b):w(b))}return b===45||ae(b)?(e.consume(b),a+=String.fromCharCode(b),S):n(b)}function g(b){return b===62?(e.consume(b),r.interrupt?t:_):n(b)}function k(b){return H(b)?(e.consume(b),k):v(b)}function w(b){return b===47?(e.consume(b),v):b===58||b===95||ce(b)?(e.consume(b),M):H(b)?(e.consume(b),w):v(b)}function M(b){return b===45||b===46||b===58||b===95||ae(b)?(e.consume(b),M):A(b)}function A(b){return b===61?(e.consume(b),C):H(b)?(e.consume(b),A):w(b)}function C(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),u=b,P):H(b)?(e.consume(b),C):j(b)}function P(b){return b===u?(e.consume(b),u=null,B):b===null||z(b)?n(b):(e.consume(b),P)}function j(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||Q(b)?A(b):(e.consume(b),j)}function B(b){return b===47||b===62||H(b)?w(b):n(b)}function v(b){return b===62?(e.consume(b),D):n(b)}function D(b){return b===null||z(b)?_(b):H(b)?(e.consume(b),D):n(b)}function _(b){return b===45&&i===2?(e.consume(b),G):b===60&&i===1?(e.consume(b),Y):b===62&&i===4?(e.consume(b),de):b===63&&i===3?(e.consume(b),x):b===93&&i===5?(e.consume(b),xe):z(b)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(gc,ue,W)(b)):b===null||z(b)?(e.exit("htmlFlowData"),W(b)):(e.consume(b),_)}function W(b){return e.check(mc,O,ue)(b)}function O(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),N}function N(b){return b===null||z(b)?W(b):(e.enter("htmlFlowData"),_(b))}function G(b){return b===45?(e.consume(b),x):_(b)}function Y(b){return b===47?(e.consume(b),a="",le):_(b)}function le(b){if(b===62){const he=a.toLowerCase();return _r.includes(he)?(e.consume(b),de):_(b)}return ce(b)&&a.length<8?(e.consume(b),a+=String.fromCharCode(b),le):_(b)}function xe(b){return b===93?(e.consume(b),x):_(b)}function x(b){return b===62?(e.consume(b),de):b===45&&i===2?(e.consume(b),x):_(b)}function de(b){return b===null||z(b)?(e.exit("htmlFlowData"),ue(b)):(e.consume(b),de)}function ue(b){return e.exit("htmlFlow"),t(b)}}function bc(e,t,n){const r=this;return i;function i(a){return z(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Sc(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(xt,t,n)}}const kc={name:"htmlText",tokenize:wc};function wc(e,t,n){const r=this;let i,s,a;return o;function o(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),u}function u(x){return x===33?(e.consume(x),l):x===47?(e.consume(x),A):x===63?(e.consume(x),w):ce(x)?(e.consume(x),j):n(x)}function l(x){return x===45?(e.consume(x),c):x===91?(e.consume(x),s=0,y):ce(x)?(e.consume(x),k):n(x)}function c(x){return x===45?(e.consume(x),f):n(x)}function d(x){return x===null?n(x):x===45?(e.consume(x),p):z(x)?(a=d,Y(x)):(e.consume(x),d)}function p(x){return x===45?(e.consume(x),f):d(x)}function f(x){return x===62?G(x):x===45?p(x):d(x)}function y(x){const de="CDATA[";return x===de.charCodeAt(s++)?(e.consume(x),s===de.length?m:y):n(x)}function m(x){return x===null?n(x):x===93?(e.consume(x),S):z(x)?(a=m,Y(x)):(e.consume(x),m)}function S(x){return x===93?(e.consume(x),g):m(x)}function g(x){return x===62?G(x):x===93?(e.consume(x),g):m(x)}function k(x){return x===null||x===62?G(x):z(x)?(a=k,Y(x)):(e.consume(x),k)}function w(x){return x===null?n(x):x===63?(e.consume(x),M):z(x)?(a=w,Y(x)):(e.consume(x),w)}function M(x){return x===62?G(x):w(x)}function A(x){return ce(x)?(e.consume(x),C):n(x)}function C(x){return x===45||ae(x)?(e.consume(x),C):P(x)}function P(x){return z(x)?(a=P,Y(x)):H(x)?(e.consume(x),P):G(x)}function j(x){return x===45||ae(x)?(e.consume(x),j):x===47||x===62||Q(x)?B(x):n(x)}function B(x){return x===47?(e.consume(x),G):x===58||x===95||ce(x)?(e.consume(x),v):z(x)?(a=B,Y(x)):H(x)?(e.consume(x),B):G(x)}function v(x){return x===45||x===46||x===58||x===95||ae(x)?(e.consume(x),v):D(x)}function D(x){return x===61?(e.consume(x),_):z(x)?(a=D,Y(x)):H(x)?(e.consume(x),D):B(x)}function _(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),i=x,W):z(x)?(a=_,Y(x)):H(x)?(e.consume(x),_):(e.consume(x),O)}function W(x){return x===i?(e.consume(x),i=void 0,N):x===null?n(x):z(x)?(a=W,Y(x)):(e.consume(x),W)}function O(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||Q(x)?B(x):(e.consume(x),O)}function N(x){return x===47||x===62||Q(x)?B(x):n(x)}function G(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function Y(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),le}function le(x){return H(x)?q(e,xe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):xe(x)}function xe(x){return e.enter("htmlTextData"),a(x)}}const Jn={name:"labelEnd",resolveAll:Tc,resolveTo:Rc,tokenize:Ec},vc={tokenize:Ac},Cc={tokenize:Lc},Ic={tokenize:Mc};function Tc(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ye(e,0,e.length,n),e}function Rc(e,t){let n=e.length,r=0,i,s,a,o;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},l={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},c={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[a-2][1].start}};return o=[["enter",u,t],["enter",l,t]],o=Se(o,e.slice(s+1,s+r+3)),o=Se(o,[["enter",c,t]]),o=Se(o,$t(t.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),t)),o=Se(o,[["exit",c,t],e[a-2],e[a-1],["exit",l,t]]),o=Se(o,e.slice(a+1)),o=Se(o,[["exit",u,t]]),ye(e,s,e.length,o),e}function Ec(e,t,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return o;function o(p){return s?s._inactive?d(p):(a=r.parser.defined.includes(Ie(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),u):n(p)}function u(p){return p===40?e.attempt(vc,c,a?c:d)(p):p===91?e.attempt(Cc,c,a?l:d)(p):a?c(p):d(p)}function l(p){return e.attempt(Ic,c,d)(p)}function c(p){return t(p)}function d(p){return s._balanced=!0,n(p)}}function Ac(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Q(d)?dt(e,s)(d):s(d)}function s(d){return d===41?c(d):ys(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return Q(d)?dt(e,u)(d):c(d)}function o(d){return n(d)}function u(d){return d===34||d===39||d===40?bs(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function l(d){return Q(d)?dt(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 Lc(e,t,n){const r=this;return i;function i(o){return xs.call(r,e,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(Ie(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function a(o){return n(o)}}function Mc(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const Nc={name:"labelStartImage",resolveAll:Jn.resolveAll,tokenize:jc};function jc(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),s}function s(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Pc={name:"labelStartLink",resolveAll:Jn.resolveAll,tokenize:Dc};function Dc(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Yt={name:"lineEnding",tokenize:_c};function _c(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),q(e,t,"linePrefix")}}const Lt={name:"thematicBreak",tokenize:Oc};function Oc(e,t,n){let r=0,i;return s;function s(l){return e.enter("thematicBreak"),a(l)}function a(l){return i=l,o(l)}function o(l){return l===i?(e.enter("thematicBreakSequence"),u(l)):r>=3&&(l===null||z(l))?(e.exit("thematicBreak"),t(l)):n(l)}function u(l){return l===i?(e.consume(l),r++,u):(e.exit("thematicBreakSequence"),H(l)?q(e,o,"whitespace")(l):o(l))}}const fe={continuation:{tokenize:$c},exit:Hc,name:"list",tokenize:Bc},zc={partial:!0,tokenize:Kc},Fc={partial:!0,tokenize:Uc};function Bc(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(f){const y=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Tn(f)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Lt,n,l)(f):l(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(f)}return n(f)}function u(f){return Tn(f)&&++a<10?(e.consume(f),u):(!r.interrupt||a<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),l(f)):n(f)}function l(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(xt,r.interrupt?n:c,e.attempt(zc,p,d))}function c(f){return r.containerState.initialBlankLine=!0,s++,p(f)}function d(f){return H(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function $c(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(xt,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,q(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!H(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Fc,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,q(e,e.attempt(fe,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Uc(e,t,n){const r=this;return q(e,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(s):n(s)}}function Hc(e){e.exit(this.containerState.type)}function Kc(e,t,n){const r=this;return q(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!H(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Or={name:"setextUnderline",resolveTo:Vc,tokenize:qc};function Vc(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function qc(e,t,n){const r=this;let i;return s;function s(l){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"),i=l,a(l)):n(l)}function a(l){return e.enter("setextHeadingLineSequence"),o(l)}function o(l){return l===i?(e.consume(l),o):(e.exit("setextHeadingLineSequence"),H(l)?q(e,u,"lineSuffix")(l):u(l))}function u(l){return l===null||z(l)?(e.exit("setextHeadingLine"),t(l)):n(l)}}const Wc={tokenize:Gc};function Gc(e){const t=this,n=e.attempt(xt,r,e.attempt(this.parser.constructs.flowInitial,i,q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Zu,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Xc={resolveAll:ks()},Qc=Ss("string"),Yc=Ss("text");function Ss(e){return{resolveAll:ks(e==="text"?Jc:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,o);return a;function a(c){return l(c)?s(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),u}function u(c){return l(c)?(n.exit("data"),s(c)):(n.consume(c),u)}function l(c){if(c===null)return!0;const d=i[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 ks(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function Jc(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],i=t.sliceStream(r);let s=i.length,a=-1,o=0,u;for(;s--;){const l=i[s];if(typeof l=="string"){for(a=l.length;l.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(l===-2)u=!0,o++;else if(l!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const l={type:n===e.length||u||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...l.start},r.start.offset===r.end.offset?Object.assign(r,l):(e.splice(n,0,["enter",l,t],["exit",l,t]),n+=2)}n++}return e}const Zc={42:fe,43:fe,45:fe,48:fe,49:fe,50:fe,51:fe,52:fe,53:fe,54:fe,55:fe,56:fe,57:fe,62:fs},ed={91:ic},td={[-2]:Qt,[-1]:Qt,32:Qt},nd={35:cc,42:Lt,45:[Or,Lt],60:pc,61:Or,95:Lt,96:Dr,126:Dr},rd={38:gs,92:ps},id={[-5]:Yt,[-4]:Yt,[-3]:Yt,33:Nc,38:gs,42:Rn,60:[Pu,kc],91:Pc,92:[lc,ps],93:Jn,95:Rn,96:Wu},sd={null:[Rn,Xc]},ad={null:[42,95]},od={null:[]},ld=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ad,contentInitial:ed,disable:od,document:Zc,flow:nd,flowInitial:td,insideSpan:sd,string:rd,text:id},Symbol.toStringTag,{value:"Module"}));function ud(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 i={},s=[];let a=[],o=[];const u={attempt:P(A),check:P(C),consume:k,enter:w,exit:M,interrupt:P(C,{interrupt:!0})},l={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:d};let c=t.tokenize.call(l,u);return t.resolveAll&&s.push(t),l;function d(D){return a=Se(a,D),S(),a[a.length-1]!==null?[]:(j(t,0),l.events=$t(s,l.events,l),l.events)}function p(D,_){return dd(f(D),_)}function f(D){return cd(a,D)}function y(){const{_bufferIndex:D,_index:_,line:W,column:O,offset:N}=r;return{_bufferIndex:D,_index:_,line:W,column:O,offset:N}}function m(D){i[D.line]=D.column,v()}function S(){let D;for(;r._index<a.length;){const _=a[r._index];if(typeof _=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<_.length;)g(_.charCodeAt(r._bufferIndex));else g(_)}}function g(D){c=c(D)}function k(D){z(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,v()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=D}function w(D,_){const W=_||{};return W.type=D,W.start=y(),l.events.push(["enter",W,l]),o.push(W),W}function M(D){const _=o.pop();return _.end=y(),l.events.push(["exit",_,l]),_}function A(D,_){j(D,_.from)}function C(D,_){_.restore()}function P(D,_){return W;function W(O,N,G){let Y,le,xe,x;return Array.isArray(O)?ue(O):"tokenize"in O?ue([O]):de(O);function de(ee){return Oe;function Oe(ke){const Le=ke!==null&&ee[ke],Me=ke!==null&&ee.null,Be=[...Array.isArray(Le)?Le:Le?[Le]:[],...Array.isArray(Me)?Me:Me?[Me]:[]];return ue(Be)(ke)}}function ue(ee){return Y=ee,le=0,ee.length===0?G:b(ee[le])}function b(ee){return Oe;function Oe(ke){return x=B(),xe=ee,ee.partial||(l.currentConstruct=ee),ee.name&&l.parser.constructs.disable.null.includes(ee.name)?Te():ee.tokenize.call(_?Object.assign(Object.create(l),_):l,u,he,Te)(ke)}}function he(ee){return D(xe,x),N}function Te(ee){return x.restore(),++le<Y.length?b(Y[le]):G}}}function j(D,_){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&ye(l.events,_,l.events.length-_,D.resolve(l.events.slice(_),l)),D.resolveTo&&(l.events=D.resolveTo(l.events,l))}function B(){const D=y(),_=l.previous,W=l.currentConstruct,O=l.events.length,N=Array.from(o);return{from:O,restore:G};function G(){r=D,l.previous=_,l.currentConstruct=W,l.events.length=O,o=N,v()}}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function cd(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,s)];else{if(a=e.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function dd(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
3
+ `;break}case-3:{a=`\r
4
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function hd(e){const r={constructs:ds([ld,...(e||{}).extensions||[]]),content:i(Ru),defined:[],document:i(Au),flow:i(Wc),lazy:{},string:i(Qc),text:i(Yc)};return r;function i(s){return a;function a(o){return ud(r,s,o)}}}function fd(e){for(;!ms(e););return e}const zr=/[\0\t\n\r]/g;function pd(){let e=1,t="",n=!0,r;return i;function i(s,a,o){const u=[];let l,c,d,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(zr.lastIndex=d,l=zr.exec(s),p=l&&l.index!==void 0?l.index:s.length,f=s.charCodeAt(p),!l){t=s.slice(d);break}if(f===10&&d===p&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),d<p&&(u.push(s.slice(d,p)),e+=p-d),f){case 0:{u.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,u.push(-2);e++<c;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}d=p+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const gd=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function md(e){return e.replace(gd,yd)}function yd(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return hs(n.slice(s?2:1),s?16:10)}return Yn(n)||e}const ws={}.hasOwnProperty;function xd(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),bd(n)(fd(hd(n).document().write(pd()(e,t,!0))))}function bd(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(dr),autolinkProtocol:B,autolinkEmail:B,atxHeading:s(lr),blockQuote:s(Me),characterEscape:B,characterReference:B,codeFenced:s(Be),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(Be,a),codeText:s(be,a),codeTextData:B,data:B,codeFlowValue:B,definition:s(St),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(kt),hardBreakEscape:s(ur),hardBreakTrailing:s(ur),htmlFlow:s(cr,a),htmlFlowData:B,htmlText:s(cr,a),htmlTextData:B,image:s(oa),label:a,link:s(dr),listItem:s(la),listItemValue:p,listOrdered:s(hr,d),listUnordered:s(hr),paragraph:s(ua),reference:b,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(lr),strong:s(ca),thematicBreak:s(ha)},exit:{atxHeading:u(),atxHeadingSequence:A,autolink:u(),autolinkEmail:Le,autolinkProtocol:ke,blockQuote:u(),characterEscapeValue:v,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:ee,characterReference:Oe,codeFenced:u(S),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:y,codeFlowValue:v,codeIndented:u(g),codeText:u(N),codeTextData:v,data:v,definition:u(),definitionDestinationString:M,definitionLabelString:k,definitionTitleString:w,emphasis:u(),hardBreakEscape:u(_),hardBreakTrailing:u(_),htmlFlow:u(W),htmlFlowData:v,htmlText:u(O),htmlTextData:v,image:u(Y),label:xe,labelText:le,lineEnding:D,link:u(G),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:he,resourceDestinationString:x,resourceTitleString:de,resource:ue,setextHeading:u(j),setextHeadingLineSequence:P,setextHeadingText:C,strong:u(),thematicBreak:u()}};vs(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(I){let L={type:"root",children:[]};const $={stack:[L],tokenStack:[],config:t,enter:o,exit:l,buffer:a,resume:c,data:n},V=[];let X=-1;for(;++X<I.length;)if(I[X][1].type==="listOrdered"||I[X][1].type==="listUnordered")if(I[X][0]==="enter")V.push(X);else{const we=V.pop();X=i(I,we,X)}for(X=-1;++X<I.length;){const we=t[I[X][0]];ws.call(we,I[X][1].type)&&we[I[X][1].type].call(Object.assign({sliceSerialize:I[X][2].sliceSerialize},$),I[X][1])}if($.tokenStack.length>0){const we=$.tokenStack[$.tokenStack.length-1];(we[1]||Fr).call($,void 0,we[0])}for(L.position={start:ze(I.length>0?I[0][1].start:{line:1,column:1,offset:0}),end:ze(I.length>0?I[I.length-2][1].end:{line:1,column:1,offset:0})},X=-1;++X<t.transforms.length;)L=t.transforms[X](L)||L;return L}function i(I,L,$){let V=L-1,X=-1,we=!1,$e,Ne,nt,rt;for(;++V<=$;){const ge=I[V];switch(ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ge[0]==="enter"?X++:X--,rt=void 0;break}case"lineEndingBlank":{ge[0]==="enter"&&($e&&!rt&&!X&&!nt&&(nt=V),rt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:rt=void 0}if(!X&&ge[0]==="enter"&&ge[1].type==="listItemPrefix"||X===-1&&ge[0]==="exit"&&(ge[1].type==="listUnordered"||ge[1].type==="listOrdered")){if($e){let qe=V;for(Ne=void 0;qe--;){const je=I[qe];if(je[1].type==="lineEnding"||je[1].type==="lineEndingBlank"){if(je[0]==="exit")continue;Ne&&(I[Ne][1].type="lineEndingBlank",we=!0),je[1].type="lineEnding",Ne=qe}else if(!(je[1].type==="linePrefix"||je[1].type==="blockQuotePrefix"||je[1].type==="blockQuotePrefixWhitespace"||je[1].type==="blockQuoteMarker"||je[1].type==="listItemIndent"))break}nt&&(!Ne||nt<Ne)&&($e._spread=!0),$e.end=Object.assign({},Ne?I[Ne][1].start:ge[1].end),I.splice(Ne||V,0,["exit",$e,ge[2]]),V++,$++}if(ge[1].type==="listItemPrefix"){const qe={type:"listItem",_spread:!1,start:Object.assign({},ge[1].start),end:void 0};$e=qe,I.splice(V,0,["enter",qe,ge[2]]),V++,$++,nt=void 0,rt=!0}}}return I[L][1]._spread=we,$}function s(I,L){return $;function $(V){o.call(this,I(V),V),L&&L.call(this,V)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(I,L,$){this.stack[this.stack.length-1].children.push(I),this.stack.push(I),this.tokenStack.push([L,$||void 0]),I.position={start:ze(L.start),end:void 0}}function u(I){return L;function L($){I&&I.call(this,$),l.call(this,$)}}function l(I,L){const $=this.stack.pop(),V=this.tokenStack.pop();if(V)V[0].type!==I.type&&(L?L.call(this,I,V[0]):(V[1]||Fr).call(this,I,V[0]));else throw new Error("Cannot close `"+I.type+"` ("+ct({start:I.start,end:I.end})+"): it’s not open");$.position.end=ze(I.end)}function c(){return Qn(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(I){if(this.data.expectingFirstListItemValue){const L=this.stack[this.stack.length-2];L.start=Number.parseInt(this.sliceSerialize(I),10),this.data.expectingFirstListItemValue=void 0}}function f(){const I=this.resume(),L=this.stack[this.stack.length-1];L.lang=I}function y(){const I=this.resume(),L=this.stack[this.stack.length-1];L.meta=I}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const I=this.resume(),L=this.stack[this.stack.length-1];L.value=I.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const I=this.resume(),L=this.stack[this.stack.length-1];L.value=I.replace(/(\r?\n|\r)$/g,"")}function k(I){const L=this.resume(),$=this.stack[this.stack.length-1];$.label=L,$.identifier=Ie(this.sliceSerialize(I)).toLowerCase()}function w(){const I=this.resume(),L=this.stack[this.stack.length-1];L.title=I}function M(){const I=this.resume(),L=this.stack[this.stack.length-1];L.url=I}function A(I){const L=this.stack[this.stack.length-1];if(!L.depth){const $=this.sliceSerialize(I).length;L.depth=$}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function P(I){const L=this.stack[this.stack.length-1];L.depth=this.sliceSerialize(I).codePointAt(0)===61?1:2}function j(){this.data.setextHeadingSlurpLineEnding=void 0}function B(I){const $=this.stack[this.stack.length-1].children;let V=$[$.length-1];(!V||V.type!=="text")&&(V=da(),V.position={start:ze(I.start),end:void 0},$.push(V)),this.stack.push(V)}function v(I){const L=this.stack.pop();L.value+=this.sliceSerialize(I),L.position.end=ze(I.end)}function D(I){const L=this.stack[this.stack.length-1];if(this.data.atHardBreak){const $=L.children[L.children.length-1];$.position.end=ze(I.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(L.type)&&(B.call(this,I),v.call(this,I))}function _(){this.data.atHardBreak=!0}function W(){const I=this.resume(),L=this.stack[this.stack.length-1];L.value=I}function O(){const I=this.resume(),L=this.stack[this.stack.length-1];L.value=I}function N(){const I=this.resume(),L=this.stack[this.stack.length-1];L.value=I}function G(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=L,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function Y(){const I=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";I.type+="Reference",I.referenceType=L,delete I.url,delete I.title}else delete I.identifier,delete I.label;this.data.referenceType=void 0}function le(I){const L=this.sliceSerialize(I),$=this.stack[this.stack.length-2];$.label=md(L),$.identifier=Ie(L).toLowerCase()}function xe(){const I=this.stack[this.stack.length-1],L=this.resume(),$=this.stack[this.stack.length-1];if(this.data.inReference=!0,$.type==="link"){const V=I.children;$.children=V}else $.alt=L}function x(){const I=this.resume(),L=this.stack[this.stack.length-1];L.url=I}function de(){const I=this.resume(),L=this.stack[this.stack.length-1];L.title=I}function ue(){this.data.inReference=void 0}function b(){this.data.referenceType="collapsed"}function he(I){const L=this.resume(),$=this.stack[this.stack.length-1];$.label=L,$.identifier=Ie(this.sliceSerialize(I)).toLowerCase(),this.data.referenceType="full"}function Te(I){this.data.characterReferenceType=I.type}function ee(I){const L=this.sliceSerialize(I),$=this.data.characterReferenceType;let V;$?(V=hs(L,$==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):V=Yn(L);const X=this.stack[this.stack.length-1];X.value+=V}function Oe(I){const L=this.stack.pop();L.position.end=ze(I.end)}function ke(I){v.call(this,I);const L=this.stack[this.stack.length-1];L.url=this.sliceSerialize(I)}function Le(I){v.call(this,I);const L=this.stack[this.stack.length-1];L.url="mailto:"+this.sliceSerialize(I)}function Me(){return{type:"blockquote",children:[]}}function Be(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function St(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function kt(){return{type:"emphasis",children:[]}}function lr(){return{type:"heading",depth:0,children:[]}}function ur(){return{type:"break"}}function cr(){return{type:"html",value:""}}function oa(){return{type:"image",title:null,url:"",alt:null}}function dr(){return{type:"link",title:null,url:"",children:[]}}function hr(I){return{type:"list",ordered:I.type==="listOrdered",start:null,spread:I._spread,children:[]}}function la(I){return{type:"listItem",spread:I._spread,checked:null,children:[]}}function ua(){return{type:"paragraph",children:[]}}function ca(){return{type:"strong",children:[]}}function da(){return{type:"text",value:""}}function ha(){return{type:"thematicBreak"}}}function ze(e){return{line:e.line,column:e.column,offset:e.offset}}function vs(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?vs(e,r):Sd(e,r)}}function Sd(e,t){let n;for(n in t)if(ws.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Fr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ct({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ct({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ct({start:t.start,end:t.end})+") is still open")}function kd(e){const t=this;t.parser=n;function n(r){return xd(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function wd(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function vd(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
5
+ `}]}function Cd(e,t){const n=t.value?t.value+`
6
+ `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Id(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Td(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Rd(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=tt(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,o+=1,e.footnoteCounts.set(r,o);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const l={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,l),e.applyData(t,l)}function Ed(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ad(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Cs(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function Ld(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cs(e,t);const i={src:tt(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function Md(e,t){const n={src:tt(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Nd(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function jd(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cs(e,t);const i={href:tt(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Pd(e,t){const n={href:tt(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Dd(e,t,n){const r=e.all(t),i=n?_d(n):Is(t),s={},a=[];if(typeof t.checked=="boolean"){const c=r[0];let d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const c=r[o];(i||o!==0||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
7
+ `}),c.type==="element"&&c.tagName==="p"&&!i?a.push(...c.children):a.push(c)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
8
+ `});const l={type:"element",tagName:"li",properties:s,children:a};return e.patch(t,l),e.applyData(t,l)}function _d(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Is(n[r])}return t}function Is(e){const t=e.spread;return t??e.children.length>1}function Od(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function zd(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fd(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Bd(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $d(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=qn(t.children[1]),u=is(t.children[t.children.length-1]);o&&u&&(a.position={start:o,end:u}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function Ud(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let u=-1;const l=[];for(;++u<o;){const d=t.children[u],p={},f=a?a[u]:void 0;f&&(p.align=f);let y={type:"element",tagName:s,properties:p,children:[]};d&&(y.children=e.all(d),e.patch(d,y),y=e.applyData(d,y)),l.push(y)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)}function Hd(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Br=9,$r=32;function Kd(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Ur(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Ur(t.slice(i),i>0,!1)),s.join("")}function Ur(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Br||s===$r;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Br||s===$r;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Vd(e,t){const n={type:"text",value:Kd(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function qd(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Wd={blockquote:wd,break:vd,code:Cd,delete:Id,emphasis:Td,footnoteReference:Rd,heading:Ed,html:Ad,imageReference:Ld,image:Md,inlineCode:Nd,linkReference:jd,link:Pd,listItem:Dd,list:Od,paragraph:zd,root:Fd,strong:Bd,table:$d,tableCell:Hd,tableRow:Ud,text:Vd,thematicBreak:qd,toml:wt,yaml:wt,definition:wt,footnoteDefinition:wt};function wt(){}const Ts=-1,Ut=0,ht=1,jt=2,Zn=3,er=4,tr=5,nr=6,Rs=7,Es=8,Hr=typeof self=="object"?self:globalThis,Gd=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case Ut:case Ts:return n(a,i);case ht:{const o=n([],i);for(const u of a)o.push(r(u));return o}case jt:{const o=n({},i);for(const[u,l]of a)o[r(u)]=r(l);return o}case Zn:return n(new Date(a),i);case er:{const{source:o,flags:u}=a;return n(new RegExp(o,u),i)}case tr:{const o=n(new Map,i);for(const[u,l]of a)o.set(r(u),r(l));return o}case nr:{const o=n(new Set,i);for(const u of a)o.add(r(u));return o}case Rs:{const{name:o,message:u}=a;return n(new Hr[o](u),i)}case Es:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new Hr[s](a),i)};return r},Kr=e=>Gd(new Map,e)(0),Ge="",{toString:Xd}={},{keys:Qd}=Object,ot=e=>{const t=typeof e;if(t!=="object"||!e)return[Ut,t];const n=Xd.call(e).slice(8,-1);switch(n){case"Array":return[ht,Ge];case"Object":return[jt,Ge];case"Date":return[Zn,Ge];case"RegExp":return[er,Ge];case"Map":return[tr,Ge];case"Set":return[nr,Ge];case"DataView":return[ht,n]}return n.includes("Array")?[ht,n]:n.includes("Error")?[Rs,n]:[jt,n]},vt=([e,t])=>e===Ut&&(t==="function"||t==="symbol"),Yd=(e,t,n,r)=>{const i=(a,o)=>{const u=r.push(a)-1;return n.set(o,u),u},s=a=>{if(n.has(a))return n.get(a);let[o,u]=ot(a);switch(o){case Ut:{let c=a;switch(u){case"bigint":o=Es,c=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);c=null;break;case"undefined":return i([Ts],a)}return i([o,c],a)}case ht:{if(u){let p=a;return u==="DataView"?p=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(p=new Uint8Array(a)),i([u,[...p]],a)}const c=[],d=i([o,c],a);for(const p of a)c.push(s(p));return d}case jt:{if(u)switch(u){case"BigInt":return i([u,a.toString()],a);case"Boolean":case"Number":case"String":return i([u,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const c=[],d=i([o,c],a);for(const p of Qd(a))(e||!vt(ot(a[p])))&&c.push([s(p),s(a[p])]);return d}case Zn:return i([o,a.toISOString()],a);case er:{const{source:c,flags:d}=a;return i([o,{source:c,flags:d}],a)}case tr:{const c=[],d=i([o,c],a);for(const[p,f]of a)(e||!(vt(ot(p))||vt(ot(f))))&&c.push([s(p),s(f)]);return d}case nr:{const c=[],d=i([o,c],a);for(const p of a)(e||!vt(ot(p)))&&c.push(s(p));return d}}const{message:l}=a;return i([o,{name:u,message:l}],a)};return s},Vr=(e,{json:t,lossy:n}={})=>{const r=[];return Yd(!(t||n),!!t,new Map,r)(e),r},Pt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Kr(Vr(e,t)):structuredClone(e):(e,t)=>Kr(Vr(e,t));function Jd(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Zd(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function eh(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Jd,r=e.options.footnoteBackLabel||Zd,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let u=-1;for(;++u<e.footnoteOrder.length;){const l=e.footnoteById.get(e.footnoteOrder[u]);if(!l)continue;const c=e.all(l),d=String(l.identifier).toUpperCase(),p=tt(d.toLowerCase());let f=0;const y=[],m=e.footnoteCounts.get(d);for(;m!==void 0&&++f<=m;){y.length>0&&y.push({type:"text",value:" "});let k=typeof n=="string"?n:n(u,f);typeof k=="string"&&(k={type:"text",value:k}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,f),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const S=c[c.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const k=S.children[S.children.length-1];k&&k.type==="text"?k.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else c.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(c,!0)};e.patch(l,g),o.push(g)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Pt(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
9
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
10
+ `}]}}const Ht=(function(e){if(e==null)return ih;if(typeof e=="function")return Kt(e);if(typeof e=="object")return Array.isArray(e)?th(e):nh(e);if(typeof e=="string")return rh(e);throw new Error("Expected function, string, or object as test")});function th(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ht(e[n]);return Kt(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function nh(e){const t=e;return Kt(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function rh(e){return Kt(t);function t(n){return n&&n.type===e}}function Kt(e){return t;function t(n,r,i){return!!(sh(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function ih(){return!0}function sh(e){return e!==null&&typeof e=="object"&&"type"in e}const As=[],ah=!0,En=!1,oh="skip";function Ls(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Ht(i),a=r?-1:1;o(e,void 0,[])();function o(u,l,c){const d=u&&typeof u=="object"?u:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(u.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=As,y,m,S;if((!t||s(u,l,c[c.length-1]||void 0))&&(f=lh(n(u,c)),f[0]===En))return f;if("children"in u&&u.children){const g=u;if(g.children&&f[0]!==oh)for(m=(r?g.children.length:-1)+a,S=c.concat(g);m>-1&&m<g.children.length;){const k=g.children[m];if(y=o(k,m,S)(),y[0]===En)return y;m=typeof y[1]=="number"?y[1]:m+a}}return f}}}function lh(e){return Array.isArray(e)?e:typeof e=="number"?[ah,e]:e==null?As:[e]}function rr(e,t,n,r){let i,s,a;typeof t=="function"&&typeof n!="function"?(s=void 0,a=t,i=n):(s=t,a=n,i=r),Ls(e,s,o,i);function o(u,l){const c=l[l.length-1],d=c?c.children.indexOf(u):void 0;return a(u,d,c)}}const An={}.hasOwnProperty,uh={};function ch(e,t){const n=t||uh,r=new Map,i=new Map,s=new Map,a={...Wd,...n.handlers},o={all:l,applyData:hh,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:u,options:n,patch:dh,wrap:ph};return rr(e,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const d=c.type==="definition"?r:i,p=String(c.identifier).toUpperCase();d.has(p)||d.set(p,c)}}),o;function u(c,d){const p=c.type,f=o.handlers[p];if(An.call(o.handlers,p)&&f)return f(o,c,d);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in c){const{children:m,...S}=c,g=Pt(S);return g.children=o.all(c),g}return Pt(c)}return(o.options.unknownHandler||fh)(o,c,d)}function l(c){const d=[];if("children"in c){const p=c.children;let f=-1;for(;++f<p.length;){const y=o.one(p[f],c);if(y){if(f&&p[f-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=qr(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=qr(m.value))}Array.isArray(y)?d.push(...y):d.push(y)}}}return d}}function dh(e,t){e.position&&(t.position=Zl(e))}function hh(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,Pt(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function fh(e,t){const n=t.data||{},r="value"in t&&!(An.call(n,"hProperties")||An.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ph(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
11
+ `});++r<e.length;)r&&n.push({type:"text",value:`
12
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
13
+ `}),n}function qr(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Wr(e,t){const n=ch(e,t),r=n.one(e,void 0),i=eh(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
14
+ `},i),s}function gh(e,t){return e&&"run"in e?async function(n,r){const i=Wr(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Wr(n,{file:r,...e||t})}}function Gr(e){if(e)throw e}var Jt,Xr;function mh(){if(Xr)return Jt;Xr=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(l){return typeof Array.isArray=="function"?Array.isArray(l):t.call(l)==="[object Array]"},s=function(l){if(!l||t.call(l)!=="[object Object]")return!1;var c=e.call(l,"constructor"),d=l.constructor&&l.constructor.prototype&&e.call(l.constructor.prototype,"isPrototypeOf");if(l.constructor&&!c&&!d)return!1;var p;for(p in l);return typeof p>"u"||e.call(l,p)},a=function(l,c){n&&c.name==="__proto__"?n(l,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):l[c.name]=c.newValue},o=function(l,c){if(c==="__proto__")if(e.call(l,c)){if(r)return r(l,c).value}else return;return l[c]};return Jt=function u(){var l,c,d,p,f,y,m=arguments[0],S=1,g=arguments.length,k=!1;for(typeof m=="boolean"&&(k=m,m=arguments[1]||{},S=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});S<g;++S)if(l=arguments[S],l!=null)for(c in l)d=o(m,c),p=o(l,c),m!==p&&(k&&p&&(s(p)||(f=i(p)))?(f?(f=!1,y=d&&i(d)?d:[]):y=d&&s(d)?d:{},a(m,{name:c,newValue:u(k,y,p)})):typeof p<"u"&&a(m,{name:c,newValue:p}));return m},Jt}var yh=mh();const Zt=Pi(yh);function Ln(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function xh(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(u,...l){const c=e[++s];let d=-1;if(u){a(u);return}for(;++d<i.length;)(l[d]===null||l[d]===void 0)&&(l[d]=i[d]);i=l,c?bh(c,o)(...l):a(null,...l)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function bh(e,t){let n;return r;function r(...a){const o=e.length>a.length;let u;o&&a.push(i);try{u=e.apply(this,a)}catch(l){const c=l;if(o&&n)throw c;return i(c)}o||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(a,...o){n||(n=!0,t(a,...o))}function s(a){i(null,a)}}const Ee={basename:Sh,dirname:kh,extname:wh,join:vh,sep:"/"};function Sh(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');bt(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function kh(e){if(bt(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function wh(e){bt(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function vh(...e){let t=-1,n;for(;++t<e.length;)bt(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Ch(n)}function Ch(e){bt(e);const t=e.codePointAt(0)===47;let n=Ih(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Ih(e,t){let n="",r=0,i=-1,s=0,a=-1,o,u;for(;++a<=e.length;){if(a<e.length)o=e.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function bt(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Th={cwd:Rh};function Rh(){return"/"}function Mn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Eh(e){if(typeof e=="string")e=new URL(e);else if(!Mn(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Ah(e)}function Ah(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const en=["history","path","basename","stem","extname","dirname"];class Ms{constructor(t){let n;t?Mn(t)?n={path:t}:typeof t=="string"||Lh(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Th.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<en.length;){const s=en[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)en.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ee.basename(this.path):void 0}set basename(t){nn(t,"basename"),tn(t,"basename"),this.path=Ee.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ee.dirname(this.path):void 0}set dirname(t){Qr(this.basename,"dirname"),this.path=Ee.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ee.extname(this.path):void 0}set extname(t){if(tn(t,"extname"),Qr(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ee.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Mn(t)&&(t=Eh(t)),nn(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ee.basename(this.path,this.extname):void 0}set stem(t){nn(t,"stem"),tn(t,"stem"),this.path=Ee.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new oe(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function tn(e,t){if(e&&e.includes(Ee.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ee.sep+"`")}function nn(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Qr(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Lh(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Mh=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),Nh={}.hasOwnProperty;class ir extends Mh{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=xh()}copy(){const t=new ir;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Zt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(an("data",this.frozen),this.namespace[t]=n,this):Nh.call(this.namespace,t)&&this.namespace[t]||void 0:t?(an("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Ct(t),r=this.parser||this.Parser;return rn("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),rn("process",this.parser||this.Parser),sn("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=Ct(t),u=r.parse(o);r.run(u,o,function(c,d,p){if(c||!d||!p)return l(c);const f=d,y=r.stringify(f,p);Dh(y)?p.value=y:p.result=y,l(c,p)});function l(c,d){c||!d?a(c):s?s(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),rn("processSync",this.parser||this.Parser),sn("processSync",this.compiler||this.Compiler),this.process(t,i),Jr("processSync","process",n),r;function i(s,a){n=!0,Gr(s),r=a}}run(t,n,r){Yr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,o){const u=Ct(n);i.run(t,u,l);function l(c,d,p){const f=d||t;c?o(c):a?a(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),Jr("runSync","run",r),i;function s(a,o){Gr(a),i=o,r=!0}}stringify(t,n){this.freeze();const r=Ct(n),i=this.compiler||this.Compiler;return sn("stringify",i),Yr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(an("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(l){if(typeof l=="function")u(l,[]);else if(typeof l=="object")if(Array.isArray(l)){const[c,...d]=l;u(c,d)}else a(l);else throw new TypeError("Expected usable value, not `"+l+"`")}function a(l){if(!("plugins"in l)&&!("settings"in l))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(l.plugins),l.settings&&(i.settings=Zt(!0,i.settings,l.settings))}function o(l){let c=-1;if(l!=null)if(Array.isArray(l))for(;++c<l.length;){const d=l[c];s(d)}else throw new TypeError("Expected a list of plugins, not `"+l+"`")}function u(l,c){let d=-1,p=-1;for(;++d<r.length;)if(r[d][0]===l){p=d;break}if(p===-1)r.push([l,...c]);else if(c.length>0){let[f,...y]=c;const m=r[p][1];Ln(m)&&Ln(f)&&(f=Zt(!0,m,f)),r[p]=[l,f,...y]}}}}const jh=new ir().freeze();function rn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function sn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function an(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yr(e){if(!Ln(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Jr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ct(e){return Ph(e)?e:new Ms(e)}function Ph(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Dh(e){return typeof e=="string"||_h(e)}function _h(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Oh="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Zr=[],ei={allowDangerousHtml:!0},zh=/^(https?|ircs?|mailto|xmpp)$/i,Fh=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Bh(e){const t=$h(e),n=Uh(e);return Hh(t.runSync(t.parse(n),n),e)}function $h(e){const t=e.rehypePlugins||Zr,n=e.remarkPlugins||Zr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ei}:ei;return jh().use(kd).use(n).use(gh,r).use(t)}function Uh(e){const t=e.children||"",n=new Ms;return typeof t=="string"&&(n.value=t),n}function Hh(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,u=t.urlTransform||Kh;for(const c of Fh)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+Oh+c.id,void 0);return rr(e,l),iu(e,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function l(c,d,p){if(c.type==="raw"&&p&&typeof d=="number")return a?p.children.splice(d,1):p.children[d]={type:"text",value:c.value},d;if(c.type==="element"){let f;for(f in Xt)if(Object.hasOwn(Xt,f)&&Object.hasOwn(c.properties,f)){const y=c.properties[f],m=Xt[f];(m===null||m.includes(c.tagName))&&(c.properties[f]=u(String(y||""),f,c))}}if(c.type==="element"){let f=n?!n.includes(c.tagName):s?s.includes(c.tagName):!1;if(!f&&r&&typeof d=="number"&&(f=!r(c,d,p)),f&&p&&typeof d=="number")return o&&c.children?p.children.splice(d,1,...c.children):p.children.splice(d,1),d}}}function Kh(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||zh.test(e.slice(0,t))?e:""}function ti(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Vh(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function qh(e,t,n){const i=Ht((n||{}).ignore||[]),s=Wh(t);let a=-1;for(;++a<s.length;)Ls(e,"text",o);function o(l,c){let d=-1,p;for(;++d<c.length;){const f=c[d],y=p?p.children:void 0;if(i(f,y?y.indexOf(f):void 0,p))return;p=f}if(p)return u(l,c)}function u(l,c){const d=c[c.length-1],p=s[a][0],f=s[a][1];let y=0;const S=d.children.indexOf(l);let g=!1,k=[];p.lastIndex=0;let w=p.exec(l.value);for(;w;){const M=w.index,A={index:w.index,input:w.input,stack:[...c,l]};let C=f(...w,A);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?p.lastIndex=M+1:(y!==M&&k.push({type:"text",value:l.value.slice(y,M)}),Array.isArray(C)?k.push(...C):C&&k.push(C),y=M+w[0].length,g=!0),!p.global)break;w=p.exec(l.value)}return g?(y<l.value.length&&k.push({type:"text",value:l.value.slice(y)}),d.children.splice(S,1,...k)):k=[l],S+k.length}}function Wh(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([Gh(i[0]),Xh(i[1])])}return t}function Gh(e){return typeof e=="string"?new RegExp(Vh(e),"g"):e}function Xh(e){return typeof e=="function"?e:function(){return e}}const on="phrasing",ln=["autolink","link","image","label"];function Qh(){return{transforms:[rf],enter:{literalAutolink:Jh,literalAutolinkEmail:un,literalAutolinkHttp:un,literalAutolinkWww:un},exit:{literalAutolink:nf,literalAutolinkEmail:tf,literalAutolinkHttp:Zh,literalAutolinkWww:ef}}}function Yh(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:on,notInConstruct:ln},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:on,notInConstruct:ln},{character:":",before:"[ps]",after:"\\/",inConstruct:on,notInConstruct:ln}]}}function Jh(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function un(e){this.config.enter.autolinkProtocol.call(this,e)}function Zh(e){this.config.exit.autolinkProtocol.call(this,e)}function ef(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function tf(e){this.config.exit.autolinkEmail.call(this,e)}function nf(e){this.exit(e)}function rf(e){qh(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,sf],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),af]],{ignore:["link","linkReference"]})}function sf(e,t,n,r,i){let s="";if(!Ns(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!of(n)))return!1;const a=lf(n+r);if(!a[0])return!1;const o={type:"link",title:null,url:s+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[o,{type:"text",value:a[1]}]:o}function af(e,t,n,r){return!Ns(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function of(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function lf(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=ti(e,"(");let s=ti(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Ns(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ke(n)||Bt(n))&&(!t||n!==47)}js.peek=yf;function uf(){this.buffer()}function cf(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function df(){this.buffer()}function hf(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ff(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ie(this.sliceSerialize(e)).toLowerCase(),n.label=t}function pf(e){this.exit(e)}function gf(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ie(this.sliceSerialize(e)).toLowerCase(),n.label=t}function mf(e){this.exit(e)}function yf(){return"["}function js(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),o(),a(),s+=i.move("]"),s}function xf(){return{enter:{gfmFootnoteCallString:uf,gfmFootnoteCall:cf,gfmFootnoteDefinitionLabelString:df,gfmFootnoteDefinition:hf},exit:{gfmFootnoteCallString:ff,gfmFootnoteCall:pf,gfmFootnoteDefinitionLabelString:gf,gfmFootnoteDefinition:mf}}}function bf(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:js},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const o=s.createTracker(a);let u=o.move("[^");const l=s.enter("footnoteDefinition"),c=s.enter("label");return u+=o.move(s.safe(s.associationId(r),{before:u,after:"]"})),c(),u+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),u+=o.move((t?`
15
+ `:" ")+s.indentLines(s.containerFlow(r,o.current()),t?Ps:Sf))),l(),u}}function Sf(e,t,n){return t===0?e:Ps(e,t,n)}function Ps(e,t,n){return(n?"":" ")+e}const kf=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ds.peek=Tf;function wf(){return{canContainEols:["delete"],enter:{strikethrough:Cf},exit:{strikethrough:If}}}function vf(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:kf}],handlers:{delete:Ds}}}function Cf(e){this.enter({type:"delete",children:[]},e)}function If(e){this.exit(e)}function Ds(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function Tf(){return"~"}function Rf(e){return e.length}function Ef(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Rf,s=[],a=[],o=[],u=[];let l=0,c=-1;for(;++c<e.length;){const m=[],S=[];let g=-1;for(e[c].length>l&&(l=e[c].length);++g<e[c].length;){const k=Af(e[c][g]);if(n.alignDelimiters!==!1){const w=i(k);S[g]=w,(u[g]===void 0||w>u[g])&&(u[g]=w)}m.push(k)}a[c]=m,o[c]=S}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<l;)s[d]=ni(r[d]);else{const m=ni(r);for(;++d<l;)s[d]=m}d=-1;const p=[],f=[];for(;++d<l;){const m=s[d];let S="",g="";m===99?(S=":",g=":"):m===108?S=":":m===114&&(g=":");let k=n.alignDelimiters===!1?1:Math.max(1,u[d]-S.length-g.length);const w=S+"-".repeat(k)+g;n.alignDelimiters!==!1&&(k=S.length+k+g.length,k>u[d]&&(u[d]=k),f[d]=k),p[d]=w}a.splice(1,0,p),o.splice(1,0,f),c=-1;const y=[];for(;++c<a.length;){const m=a[c],S=o[c];d=-1;const g=[];for(;++d<l;){const k=m[d]||"";let w="",M="";if(n.alignDelimiters!==!1){const A=u[d]-(S[d]||0),C=s[d];C===114?w=" ".repeat(A):C===99?A%2?(w=" ".repeat(A/2+.5),M=" ".repeat(A/2-.5)):(w=" ".repeat(A/2),M=w):M=" ".repeat(A)}n.delimiterStart!==!1&&!d&&g.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&k==="")&&(n.delimiterStart!==!1||d)&&g.push(" "),n.alignDelimiters!==!1&&g.push(w),g.push(k),n.alignDelimiters!==!1&&g.push(M),n.padding!==!1&&g.push(" "),(n.delimiterEnd!==!1||d!==l-1)&&g.push("|")}y.push(n.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return y.join(`
16
+ `)}function Af(e){return e==null?"":String(e)}function ni(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Lf(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),Mf);return i(),a}function Mf(e,t,n){return">"+(n?"":" ")+e}function Nf(e,t){return ri(e,t.inConstruct,!0)&&!ri(e,t.notInConstruct,!1)}function ri(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ii(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
17
+ `&&Nf(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
18
+ `}function jf(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+t.length,r=n.indexOf(t,i);return a}function Pf(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Df(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function _f(e,t,n,r){const i=Df(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(Pf(e,n)){const d=n.enter("codeIndented"),p=n.indentLines(s,Of);return d(),p}const o=n.createTracker(r),u=i.repeat(Math.max(jf(s,i)+1,3)),l=n.enter("codeFenced");let c=o.move(u);if(e.lang){const d=n.enter(`codeFencedLang${a}`);c+=o.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${a}`);c+=o.move(" "),c+=o.move(n.safe(e.meta,{before:c,after:`
19
+ `,encode:["`"],...o.current()})),d()}return c+=o.move(`
20
+ `),s&&(c+=o.move(s+`
21
+ `)),c+=o.move(u),l(),c}function Of(e,t,n){return(n?"":" ")+e}function sr(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function zf(e,t,n,r){const i=sr(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const u=n.createTracker(r);let l=u.move("[");return l+=u.move(n.safe(n.associationId(e),{before:l,after:"]",...u.current()})),l+=u.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),l+=u.move("<"),l+=u.move(n.safe(e.url,{before:l,after:">",...u.current()})),l+=u.move(">")):(o=n.enter("destinationRaw"),l+=u.move(n.safe(e.url,{before:l,after:e.title?" ":`
22
+ `,...u.current()}))),o(),e.title&&(o=n.enter(`title${s}`),l+=u.move(" "+i),l+=u.move(n.safe(e.title,{before:l,after:i,...u.current()})),l+=u.move(i),o()),a(),l}function Ff(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function pt(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Dt(e,t,n){const r=Ze(e),i=Ze(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_s.peek=Bf;function _s(e,t,n,r){const i=Ff(n),s=n.enter("emphasis"),a=n.createTracker(r),o=a.move(i);let u=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const l=u.charCodeAt(0),c=Dt(r.before.charCodeAt(r.before.length-1),l,i);c.inside&&(u=pt(l)+u.slice(1));const d=u.charCodeAt(u.length-1),p=Dt(r.after.charCodeAt(0),d,i);p.inside&&(u=u.slice(0,-1)+pt(d));const f=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:c.outside},o+u+f}function Bf(e,t,n){return n.options.emphasis||"*"}function $f(e,t){let n=!1;return rr(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,En}),!!((!e.depth||e.depth<3)&&Qn(e)&&(t.options.setext||n))}function Uf(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if($f(e,n)){const c=n.enter("headingSetext"),d=n.enter("phrasing"),p=n.containerPhrasing(e,{...s.current(),before:`
23
+ `,after:`
24
+ `});return d(),c(),p+`
25
+ `+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
26
+ `))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),u=n.enter("phrasing");s.move(a+" ");let l=n.containerPhrasing(e,{before:"# ",after:`
27
+ `,...s.current()});return/^[\t ]/.test(l)&&(l=pt(l.charCodeAt(0))+l.slice(1)),l=l?a+" "+l:a,n.options.closeAtx&&(l+=" "+a),u(),o(),l}Os.peek=Hf;function Os(e){return e.value||""}function Hf(){return"<"}zs.peek=Kf;function zs(e,t,n,r){const i=sr(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const u=n.createTracker(r);let l=u.move("![");return l+=u.move(n.safe(e.alt,{before:l,after:"]",...u.current()})),l+=u.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),l+=u.move("<"),l+=u.move(n.safe(e.url,{before:l,after:">",...u.current()})),l+=u.move(">")):(o=n.enter("destinationRaw"),l+=u.move(n.safe(e.url,{before:l,after:e.title?" ":")",...u.current()}))),o(),e.title&&(o=n.enter(`title${s}`),l+=u.move(" "+i),l+=u.move(n.safe(e.title,{before:l,after:i,...u.current()})),l+=u.move(i),o()),l+=u.move(")"),a(),l}function Kf(){return"!"}Fs.peek=Vf;function Fs(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("![");const l=n.safe(e.alt,{before:u,after:"]",...o.current()});u+=o.move(l+"]["),a();const c=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return a(),n.stack=c,s(),i==="full"||!l||l!==d?u+=o.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function Vf(){return"!"}Bs.peek=qf;function Bs(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const a=n.unsafe[s],o=n.compilePattern(a);let u;if(a.atBreak)for(;u=o.exec(r);){let l=u.index;r.charCodeAt(l)===10&&r.charCodeAt(l-1)===13&&l--,r=r.slice(0,l)+" "+r.slice(u.index+1)}}return i+r+i}function qf(){return"`"}function $s(e,t){const n=Qn(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Us.peek=Wf;function Us(e,t,n,r){const i=sr(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,u;if($s(e,n)){const c=n.stack;n.stack=[],o=n.enter("autolink");let d=a.move("<");return d+=a.move(n.containerPhrasing(e,{before:d,after:">",...a.current()})),d+=a.move(">"),o(),n.stack=c,d}o=n.enter("link"),u=n.enter("label");let l=a.move("[");return l+=a.move(n.containerPhrasing(e,{before:l,after:"](",...a.current()})),l+=a.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),l+=a.move("<"),l+=a.move(n.safe(e.url,{before:l,after:">",...a.current()})),l+=a.move(">")):(u=n.enter("destinationRaw"),l+=a.move(n.safe(e.url,{before:l,after:e.title?" ":")",...a.current()}))),u(),e.title&&(u=n.enter(`title${s}`),l+=a.move(" "+i),l+=a.move(n.safe(e.title,{before:l,after:i,...a.current()})),l+=a.move(i),u()),l+=a.move(")"),o(),l}function Wf(e,t,n){return $s(e,n)?"<":"["}Hs.peek=Gf;function Hs(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let u=o.move("[");const l=n.containerPhrasing(e,{before:u,after:"]",...o.current()});u+=o.move(l+"]["),a();const c=n.stack;n.stack=[],a=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return a(),n.stack=c,s(),i==="full"||!l||l!==d?u+=o.move(d+"]"):i==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function Gf(){return"["}function ar(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Xf(e){const t=ar(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Qf(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ks(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Yf(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?Qf(n):ar(n);const o=e.ordered?a==="."?")":".":Xf(n);let u=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const c=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),Ks(n)===a&&c){let d=-1;for(;++d<e.children.length;){const p=e.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=o),n.bulletCurrent=a;const l=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=s,i(),l}function Jf(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Zf(e,t,n,r){const i=Jf(n);let s=n.bulletCurrent||ar(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(s+" ".repeat(a-s.length)),o.shift(a);const u=n.enter("listItem"),l=n.indentLines(n.containerFlow(e,o.current()),c);return u(),l;function c(d,p,f){return p?(f?"":" ".repeat(a))+d:(f?s:s+" ".repeat(a-s.length))+d}}function ep(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const tp=Ht(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function np(e,t,n,r){return(e.children.some(function(a){return tp(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function rp(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Vs.peek=ip;function Vs(e,t,n,r){const i=rp(n),s=n.enter("strong"),a=n.createTracker(r),o=a.move(i+i);let u=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const l=u.charCodeAt(0),c=Dt(r.before.charCodeAt(r.before.length-1),l,i);c.inside&&(u=pt(l)+u.slice(1));const d=u.charCodeAt(u.length-1),p=Dt(r.after.charCodeAt(0),d,i);p.inside&&(u=u.slice(0,-1)+pt(d));const f=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:c.outside},o+u+f}function ip(e,t,n){return n.options.strong||"*"}function sp(e,t,n,r){return n.safe(e.value,r)}function ap(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function op(e,t,n){const r=(Ks(n)+(n.options.ruleSpaces?" ":"")).repeat(ap(n));return n.options.ruleSpaces?r.slice(0,-1):r}const qs={blockquote:Lf,break:ii,code:_f,definition:zf,emphasis:_s,hardBreak:ii,heading:Uf,html:Os,image:zs,imageReference:Fs,inlineCode:Bs,link:Us,linkReference:Hs,list:Yf,listItem:Zf,paragraph:ep,root:np,strong:Vs,text:sp,thematicBreak:op};function lp(){return{enter:{table:up,tableData:si,tableHeader:si,tableRow:dp},exit:{codeText:hp,table:cp,tableData:cn,tableHeader:cn,tableRow:cn}}}function up(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function cp(e){this.exit(e),this.data.inTable=void 0}function dp(e){this.enter({type:"tableRow",children:[]},e)}function cn(e){this.exit(e)}function si(e){this.enter({type:"tableCell",children:[]},e)}function hp(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,fp));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function fp(e,t){return t==="|"?t:e}function pp(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
28
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:a,tableCell:u,tableRow:o}};function a(f,y,m,S){return l(c(f,m,S),f.align)}function o(f,y,m,S){const g=d(f,m,S),k=l([g]);return k.slice(0,k.indexOf(`
29
+ `))}function u(f,y,m,S){const g=m.enter("tableCell"),k=m.enter("phrasing"),w=m.containerPhrasing(f,{...S,before:s,after:s});return k(),g(),w}function l(f,y){return Ef(f,{align:y,alignDelimiters:r,padding:n,stringLength:i})}function c(f,y,m){const S=f.children;let g=-1;const k=[],w=y.enter("table");for(;++g<S.length;)k[g]=d(S[g],y,m);return w(),k}function d(f,y,m){const S=f.children;let g=-1;const k=[],w=y.enter("tableRow");for(;++g<S.length;)k[g]=u(S[g],f,y,m);return w(),k}function p(f,y,m){let S=qs.inlineCode(f,y,m);return m.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function gp(){return{exit:{taskListCheckValueChecked:ai,taskListCheckValueUnchecked:ai,paragraph:yp}}}function mp(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:xp}}}function ai(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function yp(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,a;for(;++s<i.length;){const o=i[s];if(o.type==="paragraph"){a=o;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function xp(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);s&&o.move(a);let u=qs.listItem(e,t,n,{...r,...o.current()});return s&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),u;function l(c){return c+a}}function bp(){return[Qh(),xf(),wf(),lp(),gp()]}function Sp(e){return{extensions:[Yh(),bf(e),vf(),pp(e),mp()]}}const kp={tokenize:Rp,partial:!0},Ws={tokenize:Ep,partial:!0},Gs={tokenize:Ap,partial:!0},Xs={tokenize:Lp,partial:!0},wp={tokenize:Mp,partial:!0},Qs={name:"wwwAutolink",tokenize:Ip,previous:Js},Ys={name:"protocolAutolink",tokenize:Tp,previous:Zs},_e={name:"emailAutolink",tokenize:Cp,previous:ea},Ae={};function vp(){return{text:Ae}}let Ue=48;for(;Ue<123;)Ae[Ue]=_e,Ue++,Ue===58?Ue=65:Ue===91&&(Ue=97);Ae[43]=_e;Ae[45]=_e;Ae[46]=_e;Ae[95]=_e;Ae[72]=[_e,Ys];Ae[104]=[_e,Ys];Ae[87]=[_e,Qs];Ae[119]=[_e,Qs];function Cp(e,t,n){const r=this;let i,s;return a;function a(d){return!Nn(d)||!ea.call(r,r.previous)||or(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(d))}function o(d){return Nn(d)?(e.consume(d),o):d===64?(e.consume(d),u):n(d)}function u(d){return d===46?e.check(wp,c,l)(d):d===45||d===95||ae(d)?(s=!0,e.consume(d),u):c(d)}function l(d){return e.consume(d),i=!0,u}function c(d){return s&&i&&ce(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function Ip(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!Js.call(r,r.previous)||or(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(kp,e.attempt(Ws,e.attempt(Gs,s),n),n)(a))}function s(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function Tp(e,t,n){const r=this;let i="",s=!1;return a;function a(d){return(d===72||d===104)&&Zs.call(r,r.previous)&&!or(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),o):n(d)}function o(d){if(ce(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),o;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(d),u}return n(d)}function u(d){return d===47?(e.consume(d),s?l:(s=!0,u)):n(d)}function l(d){return d===null||Nt(d)||Q(d)||Ke(d)||Bt(d)?n(d):e.attempt(Ws,e.attempt(Gs,c),n)(d)}function c(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function Rp(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),s):n(a)}function s(a){return a===null?n(a):t(a)}}function Ep(e,t,n){let r,i,s;return a;function a(l){return l===46||l===95?e.check(Xs,u,o)(l):l===null||Q(l)||Ke(l)||l!==45&&Bt(l)?u(l):(s=!0,e.consume(l),a)}function o(l){return l===95?r=!0:(i=r,r=void 0),e.consume(l),a}function u(l){return i||r||!s?n(l):t(l)}}function Ap(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(Xs,t,s)(a):a===null||Q(a)||Ke(a)?t(a):(e.consume(a),i)}function s(a){return a===41&&r++,e.consume(a),i}}function Lp(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),s):o===93?(e.consume(o),i):o===60||o===null||Q(o)||Ke(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||Q(o)||Ke(o)?t(o):r(o)}function s(o){return ce(o)?a(o):n(o)}function a(o){return o===59?(e.consume(o),r):ce(o)?(e.consume(o),a):n(o)}}function Mp(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return ae(s)?n(s):t(s)}}function Js(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Q(e)}function Zs(e){return!ce(e)}function ea(e){return!(e===47||Nn(e))}function Nn(e){return e===43||e===45||e===46||e===95||ae(e)}function or(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Np={tokenize:Bp,partial:!0};function jp(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Op,continuation:{tokenize:zp},exit:Fp}},text:{91:{name:"gfmFootnoteCall",tokenize:_p},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Pp,resolveTo:Dp}}}}function Pp(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const u=r.events[i][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!a||!a._balanced)return n(u);const l=Ie(r.sliceSerialize({start:a.end,end:r.now()}));return l.codePointAt(0)!==94||!s.includes(l.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function Dp(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function _p(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),u}function u(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(d){if(s>999||d===93&&!a||d===null||d===91||Q(d))return n(d);if(d===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(Ie(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Q(d)||(a=!0),s++,e.consume(d),d===92?c:l}function c(d){return d===91||d===92||d===93?(e.consume(d),s++,l):l(d)}}function Op(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,o;return u;function u(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),l}function l(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(y)}function c(y){if(a>999||y===93&&!o||y===null||y===91||Q(y))return n(y);if(y===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return s=Ie(r.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Q(y)||(o=!0),a++,e.consume(y),y===92?d:c}function d(y){return y===91||y===92||y===93?(e.consume(y),a++,c):c(y)}function p(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),i.includes(s)||i.push(s),q(e,f,"gfmFootnoteDefinitionWhitespace")):n(y)}function f(y){return t(y)}}function zp(e,t,n){return e.check(xt,t,e.attempt(Np,t,n))}function Fp(e){e.exit("gfmFootnoteDefinition")}function Bp(e,t,n){const r=this;return q(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function $p(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let l=u;for(;l--;)if(a[l][0]==="exit"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[l][1].end.offset-a[l][1].start.offset){a[u][1].type="strikethroughSequence",a[l][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},a[l][1].start),end:Object.assign({},a[u][1].end)},d={type:"strikethroughText",start:Object.assign({},a[l][1].end),end:Object.assign({},a[u][1].start)},p=[["enter",c,o],["enter",a[l][1],o],["exit",a[l][1],o],["enter",d,o]],f=o.parser.constructs.insideSpan.null;f&&ye(p,p.length,0,$t(f,a.slice(l+1,u),o)),ye(p,p.length,0,[["exit",d,o],["enter",a[u][1],o],["exit",a[u][1],o],["exit",c,o]]),ye(a,l-1,u-l+3,p),u=l+p.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function s(a,o,u){const l=this.previous,c=this.events;let d=0;return p;function p(y){return l===126&&c[c.length-1][1].type!=="characterEscape"?u(y):(a.enter("strikethroughSequenceTemporary"),f(y))}function f(y){const m=Ze(l);if(y===126)return d>1?u(y):(a.consume(y),d++,f);if(d<2&&!n)return u(y);const S=a.exit("strikethroughSequenceTemporary"),g=Ze(y);return S._open=!g||g===2&&!!m,S._close=!m||m===2&&!!g,o(y)}}}class Up{constructor(){this.map=[]}add(t,n,r){Hp(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function Hp(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Kp(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Vp(){return{flow:{null:{name:"table",tokenize:qp,resolveAll:Wp}}}}function qp(e,t,n){const r=this;let i=0,s=0,a;return o;function o(v){let D=r.events.length-1;for(;D>-1;){const O=r.events[D][1].type;if(O==="lineEnding"||O==="linePrefix")D--;else break}const _=D>-1?r.events[D][1].type:null,W=_==="tableHead"||_==="tableRow"?C:u;return W===C&&r.parser.lazy[r.now().line]?n(v):W(v)}function u(v){return e.enter("tableHead"),e.enter("tableRow"),l(v)}function l(v){return v===124||(a=!0,s+=1),c(v)}function c(v){return v===null?n(v):z(v)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),f):n(v):H(v)?q(e,c,"whitespace")(v):(s+=1,a&&(a=!1,i+=1),v===124?(e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),a=!0,c):(e.enter("data"),d(v)))}function d(v){return v===null||v===124||Q(v)?(e.exit("data"),c(v)):(e.consume(v),v===92?p:d)}function p(v){return v===92||v===124?(e.consume(v),d):d(v)}function f(v){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(v):(e.enter("tableDelimiterRow"),a=!1,H(v)?q(e,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):y(v))}function y(v){return v===45||v===58?S(v):v===124?(a=!0,e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),m):A(v)}function m(v){return H(v)?q(e,S,"whitespace")(v):S(v)}function S(v){return v===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(v),e.exit("tableDelimiterMarker"),g):v===45?(s+=1,g(v)):v===null||z(v)?M(v):A(v)}function g(v){return v===45?(e.enter("tableDelimiterFiller"),k(v)):A(v)}function k(v){return v===45?(e.consume(v),k):v===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(v),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(v))}function w(v){return H(v)?q(e,M,"whitespace")(v):M(v)}function M(v){return v===124?y(v):v===null||z(v)?!a||i!==s?A(v):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(v)):A(v)}function A(v){return n(v)}function C(v){return e.enter("tableRow"),P(v)}function P(v){return v===124?(e.enter("tableCellDivider"),e.consume(v),e.exit("tableCellDivider"),P):v===null||z(v)?(e.exit("tableRow"),t(v)):H(v)?q(e,P,"whitespace")(v):(e.enter("data"),j(v))}function j(v){return v===null||v===124||Q(v)?(e.exit("data"),P(v)):(e.consume(v),v===92?B:j)}function B(v){return v===92||v===124?(e.consume(v),j):j(v)}}function Wp(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],o=!1,u=0,l,c,d;const p=new Up;for(;++n<e.length;){const f=e[n],y=f[1];f[0]==="enter"?y.type==="tableHead"?(o=!1,u!==0&&(oi(p,t,u,l,c),c=void 0,u=0),l={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",l,t]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],a=[0,n+1,0,0],o&&(o=!1,c={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",c,t]])),i=y.type==="tableDelimiterRow"?2:c?3:1):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],d=It(p,t,s,i,void 0,d),s=[0,0,0,0]),a[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],d=It(p,t,s,i,void 0,d)),s=a,a=[s[1],n,0,0])):y.type==="tableHead"?(o=!0,u=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(u=n,s[1]!==0?(a[0]=a[1],d=It(p,t,s,i,n,d)):a[1]!==0&&(d=It(p,t,a,i,n,d)),i=0):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(a[3]=n)}for(u!==0&&oi(p,t,u,l,c),p.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=Kp(t.events,n))}return e}function It(e,t,n,r,i,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(s.end=Object.assign({},Qe(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const u=Qe(t.events,n[1]);if(s={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const l=Qe(t.events,n[2]),c=Qe(t.events,n[3]),d={type:o,start:Object.assign({},l),end:Object.assign({},c)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const p=t.events[n[2]],f=t.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const y=n[2]+1,m=n[3]-n[2]-1;e.add(y,m,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(s.end=Object.assign({},Qe(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function oi(e,t,n,r,i){const s=[],a=Qe(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function Qe(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Gp={name:"tasklistCheck",tokenize:Qp};function Xp(){return{text:{91:Gp}}}function Qp(e,t,n){const r=this;return i;function i(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),s)}function s(u){return Q(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):n(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(u)}function o(u){return z(u)?t(u):H(u)?e.check({tokenize:Yp},t,n)(u):n(u)}}function Yp(e,t,n){return q(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Jp(e){return ds([vp(),jp(),$p(e),Vp(),Xp()])}const Zp={};function eg(e){const t=this,n=e||Zp,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Jp(n)),s.push(bp()),a.push(Sp(n))}function tg(){var e;return typeof navigator<"u"&&typeof((e=navigator.clipboard)==null?void 0:e.writeText)=="function"}function ng(e){if(typeof document>"u")return;const t=document.getSelection();t&&(t.removeAllRanges(),e.forEach(n=>t.addRange(n)))}function li(e){if(typeof document>"u"||!document.body)return!1;const t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null,r=n?{start:n.selectionStart,end:n.selectionEnd}:null,i=document.getSelection(),s=i?Array.from({length:i.rangeCount},(u,l)=>i.getRangeAt(l).cloneRange()):[],a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.setAttribute("aria-hidden","true"),a.style.position="fixed",a.style.top="0",a.style.left="-9999px",a.style.opacity="0",a.style.pointerEvents="none",a.style.fontSize="12pt",document.body.appendChild(a);try{a.focus({preventScroll:!0})}catch{a.focus()}a.select(),a.setSelectionRange(0,a.value.length);let o=!1;try{o=typeof document.execCommand=="function"&&document.execCommand("copy")}catch{o=!1}if(a.remove(),t)try{t.focus({preventScroll:!0})}catch{t.focus()}return n&&r?n.setSelectionRange(r.start,r.end):ng(s),o}async function rg(e){if(!e)return!1;if(tg())try{return await navigator.clipboard.writeText(e),!0}catch{return li(e)}return li(e)}const ig=1300;function sg(e){const[t,n]=T.useState(!1),r=T.useCallback(async()=>{if(!e.text)return;const i=await rg(e.text);n(!!i)},[e.text]);return T.useEffect(()=>{if(!t||typeof window>"u")return;const i=window.setTimeout(()=>n(!1),e.resetDelayMs??ig);return()=>window.clearTimeout(i)},[t,e.resetDelayMs]),{copied:t,copy:r}}const ag=/language-([a-z0-9-]+)/i;function ta(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(ta).join(""):""}function og(e){const t=ta(e);return t.endsWith(`
30
+ `)?t.slice(0,-1):t}function lg(e){var n;const t=e?ag.exec(e):null;return((n=t==null?void 0:t[1])==null?void 0:n.toLowerCase())||"text"}function ug(e){const t=T.useMemo(()=>lg(e.className),[e.className]),n=T.useMemo(()=>og(e.children),[e.children]),{copied:r,copy:i}=sg({text:n});return h.jsxs("div",{className:"chat-codeblock",children:[h.jsxs("div",{className:"chat-codeblock-toolbar",children:[h.jsx("span",{className:"chat-codeblock-language",children:t}),h.jsxs("button",{type:"button",className:"chat-codeblock-copy",onClick:()=>void i(),"aria-label":r?e.texts.copiedCodeLabel:e.texts.copyCodeLabel,children:[r?h.jsx($n,{className:"h-3.5 w-3.5"}):h.jsx($a,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:r?e.texts.copiedCodeLabel:e.texts.copyCodeLabel})]})]}),h.jsx("pre",{children:h.jsx("code",{className:e.className,children:n})})]})}const ui=14e4,cg=new Set(["http:","https:","mailto:","tel:"]);function dg(e){return e.length<=ui?e:`${e.slice(0,ui)}
31
+
32
+ ...`}function ci(e){if(!e)return null;if(e.startsWith("#")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return e;try{const t=new URL(e);return cg.has(t.protocol)?e:null}catch{return null}}function hg(e){return/^https?:\/\//i.test(e)}function fg(e){const t=e.role==="user",n=T.useMemo(()=>({a:({href:r,children:i,...s})=>{const a=ci(r);if(!a)return h.jsx("span",{className:"chat-link-invalid",children:i});const o=hg(a);return h.jsx("a",{...s,href:a,target:o?"_blank":void 0,rel:o?"noreferrer noopener":void 0,children:i})},table:({children:r,...i})=>h.jsx("div",{className:"chat-table-wrap",children:h.jsx("table",{...i,children:r})}),input:({type:r,checked:i,...s})=>r!=="checkbox"?h.jsx("input",{...s,type:r}):h.jsx("input",{...s,type:"checkbox",checked:i,readOnly:!0,disabled:!0,className:"chat-task-checkbox"}),img:({src:r,alt:i,...s})=>{const a=ci(r);return a?h.jsx("img",{...s,src:a,alt:i||"",loading:"lazy",decoding:"async"}):null},code:({className:r,children:i,...s})=>{const a=String(i??"");return!r&&!a.includes(`
33
+ `)?h.jsx("code",{...s,className:ne("chat-inline-code",r),children:i}):h.jsx(ug,{className:r,texts:e.texts,children:i})}}),[e.texts]);return h.jsx("div",{className:ne("chat-markdown",t?"chat-markdown-user":"chat-markdown-assistant"),children:h.jsx(Bh,{skipHtml:!0,remarkPlugins:[eg],components:n,children:dg(e.text)})})}function pg(e){return h.jsxs("details",{className:"mt-3",children:[h.jsx("summary",{className:ne("cursor-pointer text-xs",e.isUser?"text-primary-100":"text-gray-500"),children:e.label}),h.jsx("pre",{className:ne("mt-2 whitespace-pre-wrap break-words rounded-lg p-2 text-[11px]",e.isUser?"bg-primary-700/60":"bg-gray-100"),children:e.text})]})}const di=220;function gg(e){const t=e.toLowerCase();return t.includes("exec")||t.includes("shell")||t.includes("command")?h.jsx(Ua,{className:"h-3.5 w-3.5"}):t.includes("search")?h.jsx(zn,{className:"h-3.5 w-3.5"}):t.includes("fetch")||t.includes("http")||t.includes("web")?h.jsx(Ha,{className:"h-3.5 w-3.5"}):t.includes("read")||t.includes("file")?h.jsx(Ka,{className:"h-3.5 w-3.5"}):t.includes("message")||t.includes("send")?h.jsx(Va,{className:"h-3.5 w-3.5"}):t.includes("cron")||t.includes("schedule")?h.jsx(qa,{className:"h-3.5 w-3.5"}):h.jsx(ji,{className:"h-3.5 w-3.5"})}function mg({card:e}){var s;const t=((s=e.output)==null?void 0:s.trim())??"",n=t.length>di||t.includes(`
34
+ `),r=n?`${t.slice(0,di)}...`:t,i=e.kind==="result"||e.hasResult;return h.jsxs("div",{className:"rounded-xl border border-amber-200/80 bg-amber-50/60 px-3 py-2.5",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-semibold text-amber-800",children:[gg(e.toolName),h.jsx("span",{children:e.titleLabel}),h.jsx("span",{className:"font-mono text-[11px] text-amber-900/80",children:e.toolName})]}),e.summary?h.jsx("div",{className:"mt-1 break-words font-mono text-[11px] text-amber-800/90",children:e.summary}):null,i?h.jsx("div",{className:"mt-2",children:t?n?h.jsxs("details",{className:"group",children:[h.jsx("summary",{className:"cursor-pointer text-[11px] text-amber-700",children:e.outputLabel}),h.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words rounded-lg border border-amber-200 bg-amber-100/40 p-2 text-[11px] text-amber-900",children:t})]}):h.jsx("pre",{className:"rounded-lg border border-amber-200 bg-amber-100/40 p-2 text-[11px] whitespace-pre-wrap break-words text-amber-900",children:r}):h.jsx("div",{className:"text-[11px] text-amber-700/80",children:e.emptyLabel})}):null]})}function yg(e){return h.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-2.5 py-2 text-xs text-gray-600",children:[h.jsxs("div",{className:"font-semibold text-gray-700",children:[e.label,": ",e.rawType]}),e.text?h.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-[11px] text-gray-500",children:e.text}):null]})}function xg(e){const{message:t,texts:n}=e,{role:r}=t,i=r==="user";return h.jsx("div",{className:ne("inline-block w-fit max-w-full rounded-2xl border px-4 py-3 shadow-sm",i?"border-primary bg-primary text-white":r==="assistant"?"border-gray-200 bg-white text-gray-900":"border-orange-200/80 bg-orange-50/70 text-gray-900"),children:h.jsx("div",{className:"space-y-2",children:t.parts.map((s,a)=>s.type==="markdown"?h.jsx(fg,{text:s.text,role:r,texts:n},`markdown-${a}`):s.type==="reasoning"?h.jsx(pg,{label:s.label,text:s.text,isUser:i},`reasoning-${a}`):s.type==="tool-card"?h.jsx("div",{className:"mt-0.5",children:h.jsx(mg,{card:s.card})},`tool-${a}`):s.type==="unknown"?h.jsx(yg,{label:s.label,rawType:s.rawType,text:s.text},`unknown-${a}`):null)})})}function bg(e){return h.jsxs("div",{className:ne("px-1 text-[11px]",e.isUser?"text-primary-300":"text-gray-400"),children:[e.roleLabel," · ",e.timestampLabel]})}function Sg(e){return h.jsxs("div",{className:ne("space-y-5",e.className),children:[e.messages.map(t=>{const n=t.role==="user";return h.jsxs("div",{className:ne("flex gap-3",n?"justify-end":"justify-start"),children:[n?null:h.jsx(qt,{role:t.role}),h.jsxs("div",{className:ne("w-fit max-w-[92%] space-y-2",n&&"flex flex-col items-end"),children:[h.jsx(xg,{message:t,texts:e.texts}),h.jsx(bg,{roleLabel:t.roleLabel,timestampLabel:t.timestampLabel,isUser:n})]}),n?h.jsx(qt,{role:t.role}):null]},t.id)}),e.isSending&&!e.hasStreamingDraft?h.jsxs("div",{className:"flex justify-start gap-3",children:[h.jsx(qt,{role:"assistant"}),h.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white px-4 py-3 text-sm text-gray-500 shadow-sm",children:e.texts.typingLabel})]}):null]})}const kg=10;function hi(e){e.scrollTop=e.scrollHeight}function wg(e){const t=T.useRef(!0),n=T.useRef(!1),r=T.useRef(null),i=T.useRef(!1),s=T.useCallback(()=>{if(n.current){n.current=!1;return}const a=e.scrollRef.current;if(!a)return;const o=a.scrollHeight-a.scrollTop-a.clientHeight;t.current=o<=(e.stickyThresholdPx??kg)},[e.scrollRef,e.stickyThresholdPx]);return T.useEffect(()=>{r.current!==e.resetKey&&(r.current=e.resetKey,t.current=!0,i.current=!0)},[e.resetKey]),T.useLayoutEffect(()=>{if(!i.current||e.isLoading||!e.hasContent)return;const a=e.scrollRef.current;a&&(i.current=!1,n.current=!0,hi(a))},[e.hasContent,e.isLoading,e.scrollRef]),T.useLayoutEffect(()=>{if(!t.current||!e.hasContent)return;const a=e.scrollRef.current;a&&(n.current=!0,hi(a))},[e.contentVersion,e.hasContent,e.scrollRef]),{onScroll:s}}const Re={exactSpec:1200,exactLabel:1150,prefixSpec:1e3,prefixLabel:950,prefixToken:900,containsSpec:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function vg(e){const t=/^\/([^\s]*)$/.exec(e);return t?(t[1]??"").trim().toLowerCase():null}function Tt(e){return(e??"").trim().toLowerCase()}function fi(e,t){if(!e||!t)return!1;let n=0;for(const r of t)if(r===e[n]&&(n+=1,n>=e.length))return!0;return!1}function Cg(e,t){const n=Tt(t);if(!n)return Re.fallback;const r=Tt(e.key),i=Tt(e.label||e.key),s=Tt(`${e.descriptionZh??""} ${e.description??""}`),a=i.split(/[\s/_-]+/).filter(Boolean);return r===n?Re.exactSpec:i===n?Re.exactLabel:r.startsWith(n)?Re.prefixSpec:i.startsWith(n)?Re.prefixLabel:a.some(o=>o.startsWith(n))?Re.prefixToken:r.includes(n)?Re.containsSpec:i.includes(n)?Re.containsLabel:s.includes(n)?Re.containsDescription:fi(n,i)||fi(n,r)?Re.subsequence:0}function Ig(e,t,n){const r=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0});return e.map((i,s)=>({record:i,order:s,score:Cg(i,t)})).filter(i=>i.score>0).sort((i,s)=>{if(s.score!==i.score)return s.score-i.score;const a=(i.record.label||i.record.key).trim(),o=(s.record.label||s.record.key).trim(),u=r.compare(a,o);return u!==0?u:i.order-s.order}).map(({record:i})=>({key:`skill:${i.key}`,title:i.label||i.key,subtitle:n.slashSkillSubtitle,description:(i.descriptionZh??i.description??"").trim()||n.noSkillDescription,detailLines:[`${n.slashSkillSpecLabel}: ${i.key}`],value:i.key}))}function Tg(e,t){return e.map(n=>{const r=t.find(i=>i.key===n);return{key:n,label:(r==null?void 0:r.label)||n}})}function Rg(e){return e.map(t=>({key:t.key,label:t.label,description:t.descriptionZh||t.description||"",badgeLabel:t.badgeLabel}))}function Eg(e){return{title:e.texts.title,searchPlaceholder:e.texts.searchPlaceholder,emptyLabel:e.texts.emptyLabel,loadingLabel:e.texts.loadingLabel,isLoading:e.isLoading,manageLabel:e.texts.manageLabel,manageHref:"/marketplace/skills",options:Rg(e.skillRecords),selectedKeys:e.selectedSkills,onSelectedKeysChange:e.onSelectedKeysChange}}function Ag(e){return!e.isModelOptionsLoading&&!e.isModelOptionsEmpty?null:e.isModelOptionsLoading?{tone:"neutral",loading:!0}:{tone:"warning",text:e.texts.noModelOptionsLabel,actionLabel:e.texts.configureProviderLabel,onAction:e.onGoToProviders}}function Lg(e){const t=e.modelOptions.find(n=>n.value===e.selectedModel);return{key:"model",value:e.hasModelOptions?e.selectedModel:void 0,placeholder:e.texts.modelSelectPlaceholder,selectedLabel:t?`${t.providerLabel}/${t.modelLabel}`:void 0,icon:"sparkles",options:e.modelOptions.map(n=>({value:n.value,label:n.modelLabel,description:n.providerLabel})),disabled:!e.hasModelOptions,loading:e.isModelOptionsLoading,emptyLabel:e.texts.modelNoOptionsLabel,onValueChange:e.onValueChange}}function Mg(e){var t;return e.shouldShow?{key:"session-type",value:e.selectedSessionType,placeholder:e.texts.sessionTypePlaceholder,selectedLabel:(t=e.selectedSessionTypeOption)==null?void 0:t.label,options:e.sessionTypeOptions.map(n=>({value:n.value,label:n.label})),disabled:!e.canEditSessionType,onValueChange:e.onValueChange}:null}function Ng(e){const t=[];for(const n of["off",...e])t.includes(n)||t.push(n);return t}function jg(e){if(e.supportedLevels.length===0)return null;const t=Ng(e.supportedLevels),n=t.includes("off")?"off":t[0],r=e.selectedThinkingLevel&&t.includes(e.selectedThinkingLevel)&&e.selectedThinkingLevel||e.defaultThinkingLevel&&t.includes(e.defaultThinkingLevel)&&e.defaultThinkingLevel||n;return{key:"thinking",value:r,placeholder:e.texts.thinkingLabels[r],selectedLabel:e.texts.thinkingLabels[r],icon:"brain",options:t.map(i=>({value:i,label:e.texts.thinkingLabels[i]})),onValueChange:i=>e.onValueChange(i)}}function Pg(e){const[t,n]=T.useState(0),[r,i]=T.useState(!1),s=e.isSlashMode&&!r,a=e.slashItems[t]??null;T.useEffect(()=>{if(!s||e.slashItems.length===0){n(0);return}n(l=>l<0?0:l>=e.slashItems.length?e.slashItems.length-1:l)},[s,e.slashItems.length]),T.useEffect(()=>{!e.isSlashMode&&r&&i(!1)},[r,e.isSlashMode]);const o=T.useCallback(l=>{e.onSelectSlashItem(l),i(!1)},[e]),u=T.useCallback(l=>{if(s&&!l.nativeEvent.isComposing&&(l.key===" "||l.code==="Space")&&i(!0),s&&e.slashItems.length>0){if(l.key==="ArrowDown"){l.preventDefault(),n(c=>(c+1)%e.slashItems.length);return}if(l.key==="ArrowUp"){l.preventDefault(),n(c=>(c-1+e.slashItems.length)%e.slashItems.length);return}if(l.key==="Enter"&&!l.shiftKey||l.key==="Tab"){l.preventDefault();const c=e.slashItems[t];c&&o(c);return}}if(l.key==="Escape"){if(s){l.preventDefault(),i(!0);return}if(e.isSending&&e.canStopGeneration){l.preventDefault(),e.onStop();return}}l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),e.onSend())},[t,o,s,e]);return{isSlashPanelOpen:s,activeSlashIndex:t,activeSlashItem:a,onSelectSlashItem:o,onSlashPanelOpenChange:l=>{l||i(!0)},onSetActiveSlashIndex:n,onTextareaKeyDown:u}}const Dg={isProviderStateResolved:!1,draft:"",pendingSessionType:"native",defaultSessionType:"native",canStopGeneration:!1,stopDisabledReason:null,sendError:null,isSending:!1,modelOptions:[],selectedModel:"",selectedThinkingLevel:null,sessionTypeOptions:[],selectedSessionType:void 0,stopSupported:!1,stopReason:void 0,canEditSessionType:!1,sessionTypeUnavailable:!1,skillRecords:[],isSkillsLoading:!1,selectedSkills:[]},Z=zt(e=>({snapshot:Dg,setSnapshot:t=>e(n=>({snapshot:{...n.snapshot,...t}}))}));function _g(){return{off:R("chatThinkingLevelOff"),minimal:R("chatThinkingLevelMinimal"),low:R("chatThinkingLevelLow"),medium:R("chatThinkingLevelMedium"),high:R("chatThinkingLevelHigh"),adaptive:R("chatThinkingLevelAdaptive"),xhigh:R("chatThinkingLevelXhigh")}}function Og(e,t){return e.map(n=>({key:n.spec,label:n.label||n.spec,description:n.description,descriptionZh:n.descriptionZh,badgeLabel:n.origin==="builtin"?t:void 0}))}function zg(e){return e.map(t=>({value:t.value,modelLabel:t.modelLabel,providerLabel:t.providerLabel,thinkingCapability:t.thinkingCapability?{supported:t.thinkingCapability.supported,default:t.thinkingCapability.default??null}:null}))}function Fg(){var P;const e=Hn(),{language:t}=Un(),n=Z(j=>j.snapshot),r=T.useMemo(()=>R("chatSkillsPickerOfficial"),[t]),i=T.useMemo(()=>({slashSkillSubtitle:R("chatSlashTypeSkill"),slashSkillSpecLabel:R("chatSlashSkillSpec"),noSkillDescription:R("chatSkillsPickerNoDescription")}),[t]),s=T.useMemo(()=>Og(n.skillRecords,r),[n.skillRecords,r]),a=T.useMemo(()=>zg(n.modelOptions),[n.modelOptions]),o=a.length>0,u=!n.isProviderStateResolved&&!o,l=n.isProviderStateResolved&&!o,c=(u||l)&&!n.isSending||n.sessionTypeUnavailable,d=u?"":o?R("chatInputPlaceholder"):R("chatModelNoOptions"),p=vg(n.draft),f=T.useMemo(()=>Ig(s,p??"",i),[p,s,i]),y=Pg({isSlashMode:p!==null,slashItems:f,isSlashLoading:n.isSkillsLoading,onSelectSlashItem:j=>{j.value&&(n.selectedSkills.includes(j.value)||e.chatInputManager.selectSkills([...n.selectedSkills,j.value]),e.chatInputManager.setDraft(""))},onSend:e.chatInputManager.send,onStop:e.chatInputManager.stop,isSending:n.isSending,canStopGeneration:n.canStopGeneration}),m=n.sessionTypeOptions.find(j=>j.value===n.selectedSessionType)??(n.selectedSessionType?{value:n.selectedSessionType,label:n.selectedSessionType}:null),S=n.canEditSessionType&&(n.sessionTypeOptions.length>1||!!(n.selectedSessionType&&n.selectedSessionType!=="native")),g=a.find(j=>j.value===n.selectedModel),k=g==null?void 0:g.thinkingCapability,w=(k==null?void 0:k.supported)??[],M=n.stopDisabledReason==="__preparing__"?R("chatStopPreparing"):((P=n.stopDisabledReason)==null?void 0:P.trim())||R("chatStopUnavailable"),A=[Mg({selectedSessionType:n.selectedSessionType,selectedSessionTypeOption:m,sessionTypeOptions:n.sessionTypeOptions,onValueChange:e.chatInputManager.selectSessionType,canEditSessionType:n.canEditSessionType,shouldShow:S,texts:{sessionTypePlaceholder:R("chatSessionTypeLabel")}}),Lg({modelOptions:a,selectedModel:n.selectedModel,isModelOptionsLoading:u,hasModelOptions:o,onValueChange:e.chatInputManager.selectModel,texts:{modelSelectPlaceholder:R("chatSelectModel"),modelNoOptionsLabel:R("chatModelNoOptions")}}),jg({supportedLevels:w,selectedThinkingLevel:n.selectedThinkingLevel,defaultThinkingLevel:(k==null?void 0:k.default)??null,onValueChange:j=>e.chatInputManager.selectThinkingLevel(j),texts:{thinkingLabels:_g()}})].filter(j=>j!==null),C=Eg({skillRecords:s,selectedSkills:n.selectedSkills,isLoading:n.isSkillsLoading,onSelectedKeysChange:e.chatInputManager.selectSkills,texts:{title:R("chatSkillsPickerTitle"),searchPlaceholder:R("chatSkillsPickerSearchPlaceholder"),emptyLabel:R("chatSkillsPickerEmpty"),loadingLabel:R("sessionsLoading"),manageLabel:R("chatSkillsPickerManage")}});return h.jsx(Al,{value:n.draft,placeholder:d,disabled:c,onValueChange:e.chatInputManager.setDraft,onKeyDown:y.onTextareaKeyDown,slashMenu:{isOpen:y.isSlashPanelOpen,isLoading:n.isSkillsLoading,items:f,activeIndex:y.activeSlashIndex,activeItem:y.activeSlashItem,texts:{slashLoadingLabel:R("chatSlashLoading"),slashSectionLabel:R("chatSlashSectionSkills"),slashEmptyLabel:R("chatSlashNoResult"),slashHintLabel:R("chatSlashHint"),slashSkillHintLabel:R("chatSlashSkillHint")},onSelectItem:y.onSelectSlashItem,onOpenChange:y.onSlashPanelOpenChange,onSetActiveIndex:y.onSetActiveSlashIndex},hint:Ag({isModelOptionsLoading:u,isModelOptionsEmpty:l,onGoToProviders:e.chatInputManager.goToProviders,texts:{noModelOptionsLabel:R("chatModelNoOptions"),configureProviderLabel:R("chatGoConfigureProvider")}}),selectedItems:{items:Tg(n.selectedSkills,s),onRemove:j=>e.chatInputManager.selectSkills(n.selectedSkills.filter(B=>B!==j))},toolbar:{selects:A,accessories:[{key:"attach",label:R("chatInputAttachComingSoon"),icon:"paperclip",disabled:!0,tooltip:R("chatInputAttachComingSoon")}],skillPicker:C,actions:{sendError:n.sendError,isSending:n.isSending,canStopGeneration:n.canStopGeneration,sendDisabled:n.draft.trim().length===0||!o||n.sessionTypeUnavailable,stopDisabled:!n.canStopGeneration,stopHint:M,sendButtonLabel:R("chatSend"),stopButtonLabel:R("chatStop"),onSend:e.chatInputManager.send,onStop:e.chatInputManager.stop}}})}function De(e){return typeof e=="function"}function na(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var dn=na(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
35
+ `+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
36
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function jn(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Vt=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=gn(a),u=o.next();!u.done;u=o.next()){var l=u.value;l.remove(this)}}catch(m){t={error:m}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}else a.remove(this);var c=this.initialTeardown;if(De(c))try{c()}catch(m){s=m instanceof dn?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var p=gn(d),f=p.next();!f.done;f=p.next()){var y=f.value;try{pi(y)}catch(m){s=s??[],m instanceof dn?s=mn(mn([],yn(s)),yn(m.errors)):s.push(m)}}}catch(m){r={error:m}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(s)throw new dn(s)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)pi(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&jn(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&jn(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),ra=Vt.EMPTY;function ia(e){return e instanceof Vt||e&&"closed"in e&&De(e.remove)&&De(e.add)&&De(e.unsubscribe)}function pi(e){De(e)?e():e.unsubscribe()}var Bg={Promise:void 0},$g={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,mn([e,t],yn(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function Ug(e){$g.setTimeout(function(){throw e})}function gi(){}function Mt(e){e()}var sa=(function(e){gt(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ia(n)&&n.add(r)):r.destination=Vg,r}return t.create=function(n,r,i){return new Pn(n,r,i)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(Vt),Hg=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){Rt(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){Rt(r)}else Rt(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){Rt(n)}},e})(),Pn=(function(e){gt(t,e);function t(n,r,i){var s=e.call(this)||this,a;return De(n)||!n?a={next:n??void 0,error:r??void 0,complete:i??void 0}:a=n,s.destination=new Hg(a),s}return t})(sa);function Rt(e){Ug(e)}function Kg(e){throw e}var Vg={closed:!0,next:gi,error:Kg,complete:gi},qg=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Wg(e){return e}function Gg(e){return e.length===0?Wg:e.length===1?e[0]:function(n){return e.reduce(function(r,i){return i(r)},n)}}var _t=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var i=this,s=Qg(t)?t:new Pn(t,n,r);return Mt(function(){var a=i,o=a.operator,u=a.source;s.add(o?o.call(s,u):u?i._subscribe(s):i._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=mi(n),new n(function(i,s){var a=new Pn({next:function(o){try{t(o)}catch(u){s(u),a.unsubscribe()}},error:s,complete:i});r.subscribe(a)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[qg]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Gg(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=mi(t),new t(function(r,i){var s;n.subscribe(function(a){return s=a},function(a){return i(a)},function(){return r(s)})})},e.create=function(t){return new e(t)},e})();function mi(e){var t;return(t=e??Bg.Promise)!==null&&t!==void 0?t:Promise}function Xg(e){return e&&De(e.next)&&De(e.error)&&De(e.complete)}function Qg(e){return e&&e instanceof sa||Xg(e)&&ia(e)}var Yg=na(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Pe=(function(e){gt(t,e);function t(){var n=e.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return t.prototype.lift=function(n){var r=new yi(this,this);return r.operator=n,r},t.prototype._throwIfClosed=function(){if(this.closed)throw new Yg},t.prototype.next=function(n){var r=this;Mt(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var a=gn(r.currentObservers),o=a.next();!o.done;o=a.next()){var u=o.value;u.next(n)}}catch(l){i={error:l}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(n){var r=this;Mt(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},t.prototype.complete=function(){var n=this;Mt(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,i=this,s=i.hasError,a=i.isStopped,o=i.observers;return s||a?ra:(this.currentObservers=null,o.push(n),new Vt(function(){r.currentObservers=null,jn(o,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,s=r.thrownError,a=r.isStopped;i?n.error(s):a&&n.complete()},t.prototype.asObservable=function(){var n=new _t;return n.source=this,n},t.create=function(n,r){return new yi(n,r)},t})(_t),yi=(function(e){gt(t,e);function t(n,r){var i=e.call(this)||this;return i.destination=n,i.source=r,i}return t.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},t.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:ra},t})(Pe),Xe=(function(e){gt(t,e);function t(n){var r=e.call(this)||this;return r._value=n,r}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(n){var r=e.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},t.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,s=n._value;if(r)throw i;return this._throwIfClosed(),s},t.prototype.next=function(n){e.prototype.next.call(this,this._value=n)},t})(Pe);const re=[];for(let e=0;e<256;++e)re.push((e+256).toString(16).slice(1));function Jg(e,t=0){return(re[e[t+0]]+re[e[t+1]]+re[e[t+2]]+re[e[t+3]]+"-"+re[e[t+4]]+re[e[t+5]]+"-"+re[e[t+6]]+re[e[t+7]]+"-"+re[e[t+8]]+re[e[t+9]]+"-"+re[e[t+10]]+re[e[t+11]]+re[e[t+12]]+re[e[t+13]]+re[e[t+14]]+re[e[t+15]]).toLowerCase()}let hn;const Zg=new Uint8Array(16);function em(){if(!hn){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");hn=crypto.getRandomValues.bind(crypto)}return hn(Zg)}const tm=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xi={randomUUID:tm};function Dn(e,t,n){var i;if(xi.randomUUID&&!e)return xi.randomUUID();e=e||{};const r=e.random??((i=e.rng)==null?void 0:i.call(e))??em();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Jg(r)}var ie=(e=>(e.CALL="call",e.RESULT="result",e.PARTIAL_CALL="partial-call",e.ERROR="error",e.CANCELLED="cancelled",e))(ie||{}),K=(e=>(e.TEXT_START="TEXT_START",e.TEXT_DELTA="TEXT_DELTA",e.TEXT_END="TEXT_END",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_ARGS_DELTA="TOOL_CALL_ARGS_DELTA",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.RUN_METADATA="RUN_METADATA",e.REASONING_START="REASONING_START",e.REASONING_DELTA="REASONING_DELTA",e.REASONING_END="REASONING_END",e))(K||{});function nm(e){return!e||e.remoteStopCapable&&e.remoteRunId?null:e.remoteStopCapable?"__preparing__":e.remoteStopReason??""}const rm=e=>{try{return JSON.parse(e)}catch{return}},bi=e=>({toolCallId:e.id,toolName:e.function.name,args:e.function.arguments,parsedArgs:rm(e.function.arguments),status:ie.CALL});function im(e,t){const n={error:"tool_call_interrupted",note:"User continued before tool produced a result."};return e.map(r=>{var i;return(i=r.parts)!=null&&i.length?{...r,parts:r.parts.map(s=>{if(s.type!=="tool-invocation"||![ie.CALL,ie.PARTIAL_CALL].includes(s.toolInvocation.status))return s;let a;if(typeof s.toolInvocation.args=="string")try{a=JSON.parse(s.toolInvocation.args)}catch{return{...s,toolInvocation:{...s.toolInvocation,args:JSON.stringify({}),parsedArgs:a,status:ie.RESULT,result:{error:"invalid_args",raw:s.toolInvocation.args}}}}return{...s,toolInvocation:{...s.toolInvocation,args:s.toolInvocation.args,parsedArgs:a,status:ie.RESULT,result:n}}})}:r})}function _n(e){if(e instanceof DOMException&&e.name==="AbortError")return!0;if(e instanceof Error){if(e.name==="AbortError")return!0;const t=e.message.toLowerCase();return t.includes("aborted")||t.includes("abort")}return!1}function Si(e){if(e instanceof Error){const n=e.message.trim();if(n)return n}return String(e??"").trim()||"Failed to send message"}function ki(e,t){return{id:`local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,role:"assistant",parts:[{type:"text",text:e}],meta:{source:"local",status:(t==null?void 0:t.status)??"final",sessionKey:t==null?void 0:t.sessionKey,timestamp:new Date().toISOString()}}}class sm{constructor(t){F(this,"currentMessageId");F(this,"currentReasoningMessageId");F(this,"currentReasoningContent","");F(this,"currentToolCallId");F(this,"currentToolCallMessageId");F(this,"currentToolCallName");F(this,"currentToolCallArgs","");F(this,"emittedToolCallIds",new Set);this.sessionManager=t}findAssistantMessageById(t){const n=t==null?void 0:t.trim();return n?this.sessionManager.getMessages().find(i=>i.role==="assistant"&&i.id===n)??null:null}findAssistantMessageByToolCallId(t){var r;if(!t)return null;const n=this.sessionManager.getMessages();for(let i=n.length-1;i>=0;i-=1){const s=n[i];if(s.role!=="assistant")continue;if((r=s.parts)==null?void 0:r.some(o=>o.type==="tool-invocation"&&o.toolInvocation.toolCallId===t))return s}return null}findAssistantMessageForCurrentTool(t){var r;const n=this.findAssistantMessageById(this.currentToolCallMessageId);return(r=n==null?void 0:n.parts)!=null&&r.some(i=>i.type==="tool-invocation"&&i.toolInvocation.toolCallId===t)?n:this.findAssistantMessageByToolCallId(t)}reset(){this.currentMessageId=void 0,this.currentReasoningMessageId=void 0,this.currentReasoningContent="",this.currentToolCallId=void 0,this.currentToolCallMessageId=void 0,this.currentToolCallName=void 0,this.currentToolCallArgs="",this.emittedToolCallIds.clear()}emitToolCallEvents(){const t=this.sessionManager.getMessages();for(const n of t)if(!(n.role!=="assistant"||!n.parts))for(const r of n.parts){if(r.type!=="tool-invocation")continue;const i=r.toolInvocation;i.status===ie.CALL&&!this.emittedToolCallIds.has(i.toolCallId)&&(this.emittedToolCallIds.add(i.toolCallId),this.sessionManager.toolCall$.next({toolCall:{id:i.toolCallId,type:"function",function:{name:i.toolName,arguments:i.args}}}))}}handleEvent(t){switch(t.type){case K.RUN_STARTED:break;case K.TEXT_START:this.handleTextStart(t);break;case K.TEXT_DELTA:this.handleTextContent(t);break;case K.TEXT_END:this.handleTextEnd();break;case K.REASONING_START:this.handleReasoningStart(t);break;case K.REASONING_DELTA:this.handleReasoningContent(t);break;case K.REASONING_END:this.handleReasoningEnd();break;case K.TOOL_CALL_START:this.handleToolCallStart(t);break;case K.TOOL_CALL_ARGS_DELTA:this.handleToolCallArgsDelta(t);break;case K.TOOL_CALL_ARGS:this.handleToolCallArgs(t);break;case K.TOOL_CALL_END:this.handleToolCallEnd(),this.emitToolCallEvents();break;case K.TOOL_CALL_RESULT:this.handleToolCallResult(t);break}}handleTextStart(t){this.currentMessageId=t.messageId}appendTextDelta(t,n){const r=[...t.parts||[]],i=r[r.length-1];return i&&i.type==="text"?{...t,parts:[...r.slice(0,-1),{type:"text",text:`${i.text}${n}`}]}:{...t,parts:[...r,{type:"text",text:n}]}}handleTextContent(t){if(!t.delta||this.currentMessageId!==t.messageId)return;const r=this.sessionManager.getMessages().find(i=>i.role==="assistant"&&i.id===this.currentMessageId);r?this.sessionManager.updateMessage(this.appendTextDelta(r,t.delta)):this.sessionManager.addMessages([{id:this.currentMessageId,role:"assistant",parts:[{type:"text",text:t.delta}]}])}handleTextEnd(){this.currentMessageId=void 0}updateReasoningPart(t,n){var s;const r=[...t.parts||[]];let i=-1;for(let a=r.length-1;a>=0;a-=1)if(((s=r[a])==null?void 0:s.type)==="reasoning"){i=a;break}return i>=0?{...t,parts:[...r.slice(0,i),{type:"reasoning",reasoning:n,details:[]},...r.slice(i+1)]}:{...t,parts:[...r,{type:"reasoning",reasoning:n,details:[]}]}}handleReasoningStart(t){this.currentReasoningMessageId=t.messageId,this.currentReasoningContent=""}handleReasoningContent(t){if(!t.delta||this.currentReasoningMessageId!==t.messageId)return;this.currentReasoningContent+=t.delta;const n=this.currentReasoningContent,r=this.currentReasoningMessageId,s=this.sessionManager.getMessages().find(a=>a.role==="assistant"&&a.id===r);s?this.sessionManager.updateMessage(this.updateReasoningPart(s,n)):this.sessionManager.addMessages([{id:r,role:"assistant",parts:[{type:"reasoning",reasoning:n,details:[]}]}])}handleReasoningEnd(){this.currentReasoningMessageId=void 0,this.currentReasoningContent=""}handleToolCallStart(t){var u;this.currentToolCallId=t.toolCallId,this.currentToolCallName=t.toolName,this.currentToolCallArgs="",this.currentToolCallMessageId=t.messageId;const n={type:"tool-invocation",toolInvocation:{status:ie.PARTIAL_CALL,toolCallId:this.currentToolCallId,toolName:this.currentToolCallName,args:""}},r=this.sessionManager.getMessages(),i=(u=t.messageId)==null?void 0:u.trim(),s=this.findAssistantMessageById(i);if(s){this.currentToolCallMessageId=s.id;const l=s.parts.find(c=>c.type==="tool-invocation"&&c.toolInvocation.toolCallId===this.currentToolCallId);if(l&&l.type==="tool-invocation"){this.currentToolCallArgs=l.toolInvocation.args;return}this.sessionManager.updateMessage({...s,parts:[...s.parts||[],n]});return}if(i){this.currentToolCallMessageId=i,this.sessionManager.addMessages([{id:i,role:"assistant",parts:[n]}]);return}const a=this.findAssistantMessageByToolCallId(this.currentToolCallId);if(a){this.currentToolCallMessageId=a.id;const l=a.parts.find(c=>c.type==="tool-invocation"&&c.toolInvocation.toolCallId===this.currentToolCallId);this.currentToolCallArgs=(l==null?void 0:l.type)==="tool-invocation"?l.toolInvocation.args:"";return}const o=r[r.length-1];if(o&&o.role==="assistant")this.currentToolCallMessageId=o.id,this.sessionManager.updateMessage({...o,parts:[...o.parts||[],n]});else{const l=Dn();this.currentToolCallMessageId=l,this.sessionManager.addMessages([{id:l,role:"assistant",parts:[n]}])}}handleToolCallArgsDelta(t){var i;if(this.currentToolCallId!==t.toolCallId)return;this.currentToolCallArgs+=t.argsDelta;const n=this.findAssistantMessageForCurrentTool(t.toolCallId);if(!n||n.role!=="assistant"||!((i=n.parts)!=null&&i.length))return;const r=[...n.parts];for(let s=r.length-1;s>=0;s--){const a=r[s];if(a.type==="tool-invocation"&&a.toolInvocation.toolCallId===t.toolCallId){let o;try{o=JSON.parse(this.currentToolCallArgs)}catch{}r[s]={...a,toolInvocation:{...a.toolInvocation,status:ie.PARTIAL_CALL,args:this.currentToolCallArgs,parsedArgs:o}};break}}this.sessionManager.updateMessage({...n,parts:r})}handleToolCallArgs(t){this.currentToolCallId===t.toolCallId&&(this.currentToolCallArgs=t.args,this.handleToolCallArgsDelta({type:K.TOOL_CALL_ARGS_DELTA,toolCallId:t.toolCallId,argsDelta:""}))}handleToolCallEnd(){var t;if(!(!this.currentToolCallId||!this.currentToolCallName)){try{const n={id:this.currentToolCallId,type:"function",function:{name:this.currentToolCallName,arguments:this.currentToolCallArgs}},r=this.findAssistantMessageForCurrentTool(this.currentToolCallId);if(r&&r.role==="assistant"){const i=[...r.parts||[]];for(let s=i.length-1;s>=0;s--){const a=i[s];if(a.type==="tool-invocation"&&a.toolInvocation.toolCallId===this.currentToolCallId){i[s]={...a,toolInvocation:{...bi(n),status:ie.CALL}};break}}this.sessionManager.updateMessage({...r,parts:i})}else{const i=((t=this.currentToolCallMessageId)==null?void 0:t.trim())||Dn();this.sessionManager.addMessages([{id:i,role:"assistant",parts:[{type:"tool-invocation",toolInvocation:{...bi(n),status:ie.CALL}}]}])}}catch{}this.currentToolCallId=void 0,this.currentToolCallMessageId=void 0,this.currentToolCallName=void 0,this.currentToolCallArgs=""}}handleToolCallResult(t){this.sessionManager.addToolResult({toolCallId:t.toolCallId,result:t.content,status:ie.RESULT})}}class am{constructor(){F(this,"disposables",[]);F(this,"addDisposable",t=>{this.disposables.push(t)});F(this,"dispose",()=>{this.disposables.forEach(t=>t()),this.disposables=[]})}}class om extends am{constructor(n=null,r){super();F(this,"_messages$",new Xe([]));F(this,"messages$");F(this,"threadId$",new Xe(null));F(this,"isAgentResponding$",new Xe(!1));F(this,"activeRun$",new Xe(null));F(this,"lastError$",new Xe(null));F(this,"isAwaitingResponse$",new Xe(!1));F(this,"runCompleted$",new Pe);F(this,"runError$",new Pe);F(this,"runMetadata$",new Pe);F(this,"activeSubscription",null);F(this,"addMessagesEvent$",new Pe);F(this,"updateMessageEvent$",new Pe);F(this,"setMessagesEvent$",new Pe);F(this,"toolCall$",new Pe);F(this,"eventHandler",new sm(this));F(this,"runIdCounter",0);F(this,"metadataParsers");F(this,"callbacks");F(this,"getMessages",()=>this._messages$.getValue());F(this,"setMessages",n=>{this._messages$.next(n),this.setMessagesEvent$.next({messages:n})});F(this,"handleEvent",n=>{this.eventHandler.handleEvent(n)});F(this,"setCallbacks",n=>{this.callbacks=n});F(this,"reset",()=>{this.abortAgentRun(),this._messages$.next([]),this.eventHandler.reset(),this.threadId$.next(null),this.isAgentResponding$.next(!1),this.activeRun$.next(null),this.lastError$.next(null),this.isAwaitingResponse$.next(!1),this.runIdCounter+=1});F(this,"addMessages",n=>{const i=[...this.getMessages()];for(const s of n){const a=i.findIndex(o=>o.id===s.id);a>=0?i[a]=s:i.push(s)}this._messages$.next(i),this.addMessagesEvent$.next({messages:n}),this.isAwaitingResponse$.getValue()&&n.some(s=>s.role==="assistant")&&this.isAwaitingResponse$.next(!1)});F(this,"removeMessages",n=>{n.length!==0&&this._messages$.next(this.getMessages().filter(r=>!n.includes(r.id)))});F(this,"updateMessage",n=>{this._messages$.next(this.getMessages().map(r=>r.id===n.id?n:r)),this.updateMessageEvent$.next({message:n}),this.isAwaitingResponse$.getValue()&&n.role==="assistant"&&this.isAwaitingResponse$.next(!1)});F(this,"addToolResult",(n,r)=>{const i=this.getMessages().find(a=>a.parts.find(o=>o.type==="tool-invocation"&&o.toolInvocation.toolCallId===n.toolCallId));if(!i)return;const s={...i,parts:i.parts.map(a=>a.type==="tool-invocation"&&a.toolInvocation.toolCallId===n.toolCallId?{...a,toolInvocation:{...a.toolInvocation,result:n.result??void 0,status:n.status,error:n.error??void 0,cancelled:n.cancelled??void 0}}:a)};this.updateMessage(s)});F(this,"send",async n=>{(this.activeRun$.getValue()||this.activeSubscription)&&this.abortAgentRun(),this.lastError$.next(null);const r=n.message.trim();r&&(this.addMessages([{id:Dn(),role:"user",parts:[{type:"text",text:r}]}]),await this.runAgent({metadata:n.metadata,sessionId:n.sessionId,agentId:n.agentId,stopCapable:n.stopCapable,stopReason:n.stopReason,sourceMessage:r,restoreDraftOnError:n.restoreDraftOnError}))});F(this,"resume",async n=>{var a,o;const r=(a=n.remoteRunId)==null?void 0:a.trim(),i=(o=n.sessionId)==null?void 0:o.trim();if(!r)return;const s=this.activeRun$.getValue();(s==null?void 0:s.remoteRunId)!==r&&(s||(this.lastError$.next(null),await this.runAgent({metadata:n.metadata,sessionId:i,agentId:n.agentId,stopCapable:n.stopCapable,stopReason:n.stopReason})))});F(this,"stop",async()=>{var i,s;const n=this.activeRun$.getValue();if(!n)return;const r=n.sessionId;this.abortAgentRun(),r&&await((s=(i=this.callbacks).onRunSettled)==null?void 0:s.call(i,{sourceSessionId:r}))});F(this,"handleAgentResponse",n=>{this.activeSubscription&&this.activeSubscription.unsubscribe(),this.activeSubscription=n.subscribe(r=>{var i,s,a,o,u,l,c,d,p;if(r.type===K.RUN_METADATA){const f=r,y=this.activeRun$.getValue(),m=((i=f.runId)==null?void 0:i.trim())||(y?`ui-${y.localRunId}`:"");this.metadataParsers&&y&&this.isMatchingRun(y,m)&&this.processRunMetadata(y,f.metadata),this.runMetadata$.next({runId:m,metadata:f.metadata});return}if(this.handleEvent(r),r.type===K.RUN_FINISHED){this.isAgentResponding$.next(!1),this.isAwaitingResponse$.next(!1),this.activeSubscription=null;const f=this.activeRun$.getValue(),y=((s=r.runId)==null?void 0:s.trim())||(f?`ui-${f.localRunId}`:"");if(!f||!this.isMatchingRun(f,y))return;const m=f.sessionId;this.activeRun$.next(null),m&&((o=(a=this.callbacks).onRunSettled)==null||o.call(a,{sourceSessionId:m}))}else if(r.type===K.RUN_ERROR){this.isAgentResponding$.next(!1),this.isAwaitingResponse$.next(!1),this.activeSubscription=null;const f=this.activeRun$.getValue(),y=((u=r.runId)==null?void 0:u.trim())||(f?`ui-${f.localRunId}`:""),m=_n(r.error);if(this.runError$.next({runId:y,error:r.error,isAbort:m}),!f||!this.isMatchingRun(f,y)){this.activeRun$.next(null);return}const S=f.sessionId;if(m){this.activeRun$.next(null),S&&((c=(l=this.callbacks).onRunSettled)==null||c.call(l,{sourceSessionId:S}));return}const g=Si(r.error);this.lastError$.next(g),this.activeRun$.next(null),S&&this.addMessages([ki(g,{sessionKey:S,status:"error"})]),(p=(d=this.callbacks).onRunError)==null||p.call(d,{error:g,sourceMessage:f.sourceMessage,restoreDraft:f.restoreDraftOnError})}})});F(this,"abortAgentRun",()=>{var n,r,i;(i=(n=this.agentProvider)==null?void 0:(r=n.agent).abortRun)==null||i.call(r),this.activeSubscription&&(this.activeSubscription.unsubscribe(),this.activeSubscription=null,this.isAgentResponding$.next(!1),this.isAwaitingResponse$.next(!1)),this.activeRun$.next(null)});F(this,"runAgent",async n=>{var a,o,u,l;if(!this.agentProvider)return;(this.activeRun$.getValue()||this.activeSubscription)&&this.abortAgentRun();const r=++this.runIdCounter,i=`ui-${r}`,s={localRunId:r,sessionId:n==null?void 0:n.sessionId,...n!=null&&n.agentId?{agentId:n.agentId}:{},remoteStopCapable:!!(n!=null&&n.stopCapable),...n!=null&&n.stopReason?{remoteStopReason:n.stopReason}:{},sourceMessage:n==null?void 0:n.sourceMessage,restoreDraftOnError:n==null?void 0:n.restoreDraftOnError};this.activeRun$.next(s),this.isAgentResponding$.next(!0),this.isAwaitingResponse$.next(!0);try{const c=im(this.getMessages()),d=typeof(n==null?void 0:n.threadId)=="string"&&n.threadId.trim()?n.threadId:this.threadId$.getValue()??"",p=await this.agentProvider.agent.run({threadId:d,runId:i,messages:c,tools:this.agentProvider.getToolDefs(),context:this.agentProvider.getContexts(),...n!=null&&n.metadata?{metadata:n.metadata}:{}});this.handleAgentResponse(p)}catch(c){const d=_n(c);d?console.info("Agent run aborted"):console.error("Error running agent:",c),this.isAgentResponding$.next(!1),this.isAwaitingResponse$.next(!1);const p=this.activeRun$.getValue();if(this.activeRun$.next(null),this.runError$.next({runId:i,error:c,isAbort:d}),!d&&p){const f=Si(c);this.lastError$.next(f),p.sessionId&&this.addMessages([ki(f,{sessionKey:p.sessionId,status:"error"})]),(o=(a=this.callbacks).onRunError)==null||o.call(a,{error:f,sourceMessage:p.sourceMessage,restoreDraft:p.restoreDraftOnError})}else d&&(p!=null&&p.sessionId)&&((l=(u=this.callbacks).onRunSettled)==null||l.call(u,{sourceSessionId:p.sessionId}))}});F(this,"processRunMetadata",(n,r)=>{if(!this.metadataParsers)return;const i=this.metadataParsers.parseReady(r);if(i){this.applyReadyMetadata(n,i);return}const s=this.metadataParsers.parseFinal(r);s&&this.applyFinalMetadata(n,s)});F(this,"applyReadyMetadata",(n,r)=>{var s,a,o,u,l;const i={...n};(s=r.remoteRunId)!=null&&s.trim()&&(i.remoteRunId=r.remoteRunId.trim()),typeof r.stopCapable=="boolean"&&(i.remoteStopCapable=r.stopCapable),(a=r.stopReason)!=null&&a.trim()&&(i.remoteStopReason=r.stopReason.trim()),(o=r.sessionId)!=null&&o.trim()&&(i.sessionId=r.sessionId.trim(),(l=(u=this.callbacks).onSessionChanged)==null||l.call(u,i.sessionId)),this.activeRun$.next(i)});F(this,"applyFinalMetadata",(n,r)=>{var a,o,u,l;const i=n.sessionId,s=r.sessionId;s&&s!==i&&((o=(a=this.callbacks).onSessionChanged)==null||o.call(a,s)),this.activeRun$.next(null),i&&((l=(u=this.callbacks).onRunSettled)==null||l.call(u,{sourceSessionId:i,resultSessionId:s}))});F(this,"isMatchingRun",(n,r)=>r.trim()?r===`ui-${n.localRunId}`:!1);F(this,"connectToolExecutor",()=>{const n=this.toolCall$.subscribe(async({toolCall:r})=>{var s;const i=(s=this.agentProvider)==null?void 0:s.getToolExecutor(r.function.name);if(i)try{const a=JSON.parse(r.function.arguments),o=await i(a);this.addToolResult({toolCallId:r.id,result:o,status:ie.RESULT}),this.runAgent()}catch(a){console.error("[AgentChatController] handleAddToolResult error",a),this.addToolResult({toolCallId:r.id,error:a instanceof Error?a.message:String(a),status:ie.ERROR}),this.runAgent()}});return()=>n.unsubscribe()});this.agentProvider=n;const{initialMessages:i=[],metadataParsers:s,callbacks:a={}}=r||{};this.metadataParsers=s??null,this.callbacks=a,this._messages$.next(i),this.messages$=this._messages$.asObservable(),this.agentProvider&&this.addDisposable(this.connectToolExecutor())}}function lm(e){return typeof e=="object"&&e!==null}function um(e){return e.type==="text"&&typeof e.text=="string"}function cm(e){return e.type==="reasoning"&&typeof e.reasoning=="string"}function dm(e){return e.type!=="tool-invocation"||!lm(e.toolInvocation)?!1:typeof e.toolInvocation.toolName=="string"}function hm(e){var n;const t=(n=e.meta)==null?void 0:n.timestamp;return t&&Number.isFinite(Date.parse(t))?t:new Date().toISOString()}function fm(e,t){return e==="user"?t.user:e==="assistant"?t.assistant:e==="tool"?t.tool:e==="system"?t.system:t.fallback}function pm(e){return e==="user"||e==="assistant"||e==="tool"||e==="system"?e:"message"}function gm(e,t){return{kind:e.kind,toolName:e.name,summary:e.detail,output:e.text,hasResult:!!e.hasResult,titleLabel:e.kind==="call"?t.toolCallLabel:t.toolResultLabel,outputLabel:t.toolOutputLabel,emptyLabel:t.toolNoOutputLabel}}function mm(e){return e.uiMessages.map(t=>{var n;return{id:t.id,role:pm(t.role),roleLabel:fm(t.role,e.texts.roleLabels),timestampLabel:e.formatTimestamp(hm(t)),status:(n=t.meta)==null?void 0:n.status,parts:t.parts.map(r=>{if(um(r)){const i=r.text.trim();return i?{type:"markdown",text:i}:null}if(cm(r)){const i=r.reasoning.trim();return i?{type:"reasoning",text:i,label:e.texts.reasoningLabel}:null}if(dm(r)){const i=r.toolInvocation,s=_o(i.parsedArgs??i.args),a=typeof i.error=="string"&&i.error.trim()?i.error.trim():i.result!=null?yr(i.result).trim():"",o=i.status==="result"||i.status==="error"||i.status==="cancelled",u={kind:o?"result":"call",name:i.toolName,detail:s,text:a||void 0,callId:i.toolCallId||void 0,hasResult:o};return{type:"tool-card",card:gm(u,e.texts)}}return{type:"unknown",label:e.texts.unknownPartLabel,rawType:typeof r.type=="string"?r.type:"unknown",text:yr(r)}}).filter(r=>r!==null)}})}function ym(e){const{language:t}=Un(),n=T.useMemo(()=>e.uiMessages.map(i=>{var s,a;return{id:i.id,role:i.role,meta:{timestamp:(s=i.meta)==null?void 0:s.timestamp,status:(a=i.meta)==null?void 0:a.status},parts:i.parts}}),[e.uiMessages]),r=T.useMemo(()=>mm({uiMessages:n,formatTimestamp:i=>Ft(i,t),texts:{roleLabels:{user:R("chatRoleUser"),assistant:R("chatRoleAssistant"),tool:R("chatRoleTool"),system:R("chatRoleSystem"),fallback:R("chatRoleMessage")},reasoningLabel:R("chatReasoning"),toolCallLabel:R("chatToolCall"),toolResultLabel:R("chatToolResult"),toolNoOutputLabel:R("chatToolNoOutput"),toolOutputLabel:R("chatToolOutput"),unknownPartLabel:R("chatUnknownPart")}}),[t,n]);return h.jsx(Sg,{messages:r,isSending:e.isSending,hasStreamingDraft:e.uiMessages.some(i=>{var s;return((s=i.meta)==null?void 0:s.status)==="streaming"}),className:e.className,texts:{copyCodeLabel:R("chatCodeCopy"),copiedCodeLabel:R("chatCodeCopied"),typingLabel:R("chatTyping")}})}const xm=[{icon:Wa,titleKey:"chatWelcomeCapability1Title",descKey:"chatWelcomeCapability1Desc"},{icon:Bn,titleKey:"chatWelcomeCapability2Title",descKey:"chatWelcomeCapability2Desc"},{icon:Fn,titleKey:"chatWelcomeCapability3Title",descKey:"chatWelcomeCapability3Desc"}];function bm({onCreateSession:e}){return h.jsx("div",{className:"h-full flex items-center justify-center p-8",children:h.jsxs("div",{className:"max-w-lg w-full text-center",children:[h.jsx("div",{className:"mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center",children:h.jsx(Ni,{className:"h-8 w-8 text-primary"})}),h.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:R("chatWelcomeTitle")}),h.jsx("p",{className:"text-sm text-gray-500 mb-8",children:R("chatWelcomeSubtitle")}),h.jsx("div",{className:"grid grid-cols-3 gap-3",children:xm.map(t=>{const n=t.icon;return h.jsxs("button",{onClick:e,className:"rounded-2xl border border-gray-200 bg-white p-4 text-left shadow-card hover:shadow-card-hover transition-shadow cursor-pointer",children:[h.jsx("div",{className:"h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3",children:h.jsx(n,{className:"h-4.5 w-4.5 text-primary"})}),h.jsx("div",{className:"text-sm font-semibold text-gray-900 mb-1",children:R(t.titleKey)}),h.jsx("div",{className:"text-[11px] text-gray-500 leading-relaxed",children:R(t.descKey)})]},t.titleKey)})})]})})}const Sm={isProviderStateResolved:!1,modelOptions:[],sessionTypeUnavailable:!1,sessionTypeUnavailableMessage:null,selectedSessionKey:null,sessionDisplayName:void 0,canDeleteSession:!1,isDeletePending:!1,threadRef:null,isHistoryLoading:!1,uiMessages:[],isSending:!1,isAwaitingAssistantOutput:!1},lt=zt(e=>({snapshot:Sm,setSnapshot:t=>e(n=>({snapshot:{...n.snapshot,...t}}))}));function km(){return h.jsxs("section",{className:"flex-1 min-h-0 flex flex-col overflow-hidden bg-gradient-to-b from-gray-50/60 to-white",children:[h.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar",children:h.jsx("div",{className:"mx-auto w-full max-w-[min(1120px,100%)] px-6 py-5",children:h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-gray-200"}),h.jsx("div",{className:"h-24 w-[78%] animate-pulse rounded-2xl bg-gray-200/80"}),h.jsx("div",{className:"h-20 w-[62%] animate-pulse rounded-2xl bg-gray-200/80"}),h.jsx("div",{className:"h-28 w-[84%] animate-pulse rounded-2xl bg-gray-200/80"})]})})}),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:"rounded-2xl border border-gray-200 bg-white shadow-card p-4",children:[h.jsx("div",{className:"h-16 w-full animate-pulse rounded-xl bg-gray-200/80"}),h.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[h.jsx("div",{className:"h-8 w-36 animate-pulse rounded-lg bg-gray-200/80"}),h.jsx("div",{className:"h-8 w-20 animate-pulse rounded-lg bg-gray-200/80"})]})]})})})]})}function wm(){var l;const e=Hn(),t=lt(c=>c.snapshot),n=T.useRef(null),r=t.threadRef??n,i=!t.selectedSessionKey&&t.uiMessages.length===0&&!t.isSending,s=t.modelOptions.length>0,a=t.isProviderStateResolved&&!s,o=t.isHistoryLoading&&t.uiMessages.length===0&&!t.isSending&&!t.isAwaitingAssistantOutput,{onScroll:u}=wg({scrollRef:r,resetKey:t.selectedSessionKey,isLoading:t.isHistoryLoading,hasContent:t.uiMessages.length>0,contentVersion:t.uiMessages});return t.isProviderStateResolved?h.jsxs("section",{className:"flex-1 min-h-0 flex flex-col overflow-hidden bg-gradient-to-b from-gray-50/60 to-white",children:[h.jsxs("div",{className:Ce("px-5 border-b border-gray-200/60 bg-white/80 backdrop-blur-sm flex items-center justify-between shrink-0 overflow-hidden transition-all duration-200",t.selectedSessionKey?"py-3 opacity-100":"h-0 py-0 opacity-0 border-b-0"),children:[h.jsx("div",{className:"min-w-0 flex-1",children:h.jsx("span",{className:"text-sm font-medium text-gray-700 truncate",children:t.sessionDisplayName||t.selectedSessionKey})}),h.jsx(Ye,{variant:"ghost",size:"icon",className:"rounded-lg shrink-0 text-gray-400 hover:text-destructive",onClick:e.chatThreadManager.deleteSession,disabled:!t.canDeleteSession||t.isDeletePending,children:h.jsx(Di,{className:"h-4 w-4"})})]}),a&&h.jsxs("div",{className:"px-5 py-2.5 border-b border-amber-200/70 bg-amber-50/70 flex items-center justify-between gap-3 shrink-0",children:[h.jsx("span",{className:"text-xs text-amber-800",children:R("chatModelNoOptions")}),h.jsx("button",{type:"button",onClick:e.chatThreadManager.goToProviders,className:"text-xs font-semibold text-amber-900 underline-offset-2 hover:underline",children:R("chatGoConfigureProvider")})]}),t.sessionTypeUnavailable&&((l=t.sessionTypeUnavailableMessage)==null?void 0:l.trim())&&h.jsx("div",{className:"px-5 py-2.5 border-b border-amber-200/70 bg-amber-50/70 shrink-0",children:h.jsx("span",{className:"text-xs text-amber-800",children:t.sessionTypeUnavailableMessage})}),h.jsx("div",{ref:r,onScroll:u,className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar",children:i?h.jsx(bm,{onCreateSession:e.chatThreadManager.createSession}):o?h.jsx("div",{className:"h-full"}):t.uiMessages.length===0?h.jsx("div",{className:"px-5 py-5 text-sm text-gray-500",children:R("chatNoMessages")}):h.jsx("div",{className:"mx-auto w-full max-w-[min(1120px,100%)] px-6 py-5",children:h.jsx(ym,{uiMessages:t.uiMessages,isSending:t.isSending&&t.isAwaitingAssistantOutput})})}),h.jsx(Fg,{})]}):h.jsx(km,{})}function wi(e){return Ft(e??void 0)}function vm(e){return typeof e!="number"||!Number.isFinite(e)?"-":Ft(new Date(e))}function Cm(e){if(typeof e!="number"||!Number.isFinite(e))return"-";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function Im(e){const t=e.schedule;return t.kind==="cron"?t.expr?`cron ${t.expr}`:"cron":t.kind==="every"?`every ${Cm(t.everyMs)}`:t.kind==="at"?`at ${vm(t.atMs)}`:"-"}function Tm(e){if(!e.payload.deliver)return"-";const t=e.payload.channel??"-",n=e.payload.to??"-";return`${t}:${n}`}function Rm(e,t){const n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.channel??"",e.payload.to??""].join(" ").toLowerCase().includes(n):!0}function Em(e,t){return t==="all"?!0:t==="enabled"?e.enabled:!e.enabled}function Am(){var y;const[e,t]=T.useState(""),[n,r]=T.useState("all"),i=io({all:!0}),s=so(),a=ao(),o=oo(),{confirm:u,ConfirmDialog:l}=_i(),c=T.useMemo(()=>{var S;return(((S=i.data)==null?void 0:S.jobs)??[]).filter(g=>Rm(g,e)).filter(g=>Em(g,n))},[i.data,e,n]),d=async m=>{await u({title:`${R("cronDeleteConfirm")}?`,description:m.name?`${m.name} (${m.id})`:m.id,variant:"destructive",confirmLabel:R("delete")})&&s.mutate({id:m.id})},p=async m=>{const S=!m.enabled;await u({title:S?`${R("cronEnableConfirm")}?`:`${R("cronDisableConfirm")}?`,description:m.name?`${m.name} (${m.id})`:m.id,variant:S?"default":"destructive",confirmLabel:S?R("cronEnable"):R("cronDisable")})&&a.mutate({id:m.id,enabled:S})},f=async m=>{const S=!m.enabled;await u({title:S?`${R("cronRunForceConfirm")}?`:`${R("cronRunConfirm")}?`,description:m.name?`${m.name} (${m.id})`:m.id,confirmLabel:R("cronRunNow")})&&o.mutate({id:m.id,force:S})};return h.jsxs(Ho,{fullHeight:!0,children:[h.jsx(Ko,{title:R("cronPageTitle"),description:R("cronPageDescription"),actions:h.jsx(Ye,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>i.refetch(),children:h.jsx(Ga,{className:Ce("h-4 w-4",i.isFetching&&"animate-spin")})})}),h.jsx("div",{className:"mb-6",children:h.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[h.jsxs("div",{className:"relative flex-1 min-w-[240px]",children:[h.jsx(Oi,{value:e,onChange:m=>t(m.target.value),placeholder:R("cronSearchPlaceholder"),className:"pl-9"}),h.jsx(Fn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"})]}),h.jsx("div",{className:"min-w-[180px]",children:h.jsxs(xn,{value:n,onValueChange:m=>r(m),children:[h.jsx(bn,{className:"w-full",children:h.jsx(lo,{placeholder:R("cronStatusLabel")})}),h.jsxs(Sn,{children:[h.jsx(ut,{value:"all",children:R("cronStatusAll")}),h.jsx(ut,{value:"enabled",children:R("cronStatusEnabled")}),h.jsx(ut,{value:"disabled",children:R("cronStatusDisabled")})]})]})}),h.jsxs("div",{className:"text-xs text-gray-500 ml-auto",children:[R("cronTotalLabel"),": ",((y=i.data)==null?void 0:y.total)??0," / ",c.length]})]})}),h.jsx("div",{className:"flex-1 overflow-auto custom-scrollbar",children:i.isLoading?h.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:R("cronLoading")}):c.length===0?h.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:R("cronEmpty")}):h.jsx("div",{className:"space-y-4",children:c.map(m=>h.jsx(uo,{className:"border border-gray-200",children:h.jsx(co,{className:"pt-5 pb-5",children:h.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[h.jsxs("div",{className:"min-w-[220px] flex-1",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx("span",{className:"text-sm font-semibold text-gray-900",children:m.name||m.id}),h.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500",children:m.id}),h.jsx("span",{className:Ce("text-[10px] font-semibold px-2 py-0.5 rounded-full",m.enabled?"bg-emerald-50 text-emerald-700":"bg-gray-100 text-gray-500"),children:m.enabled?R("enabled"):R("disabled")}),m.deleteAfterRun&&h.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full bg-amber-50 text-amber-700",children:R("cronOneShot")})]}),h.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[R("cronScheduleLabel"),": ",Im(m)]}),h.jsx("div",{className:"mt-2 text-sm text-gray-700 whitespace-pre-wrap break-words",children:m.payload.message}),h.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:[R("cronDeliverTo"),": ",Tm(m)]})]}),h.jsxs("div",{className:"min-w-[220px] text-xs text-gray-500 space-y-2",children:[h.jsxs("div",{children:[h.jsxs("span",{className:"font-medium text-gray-700",children:[R("cronNextRun"),":"]})," ",wi(m.state.nextRunAt)]}),h.jsxs("div",{children:[h.jsxs("span",{className:"font-medium text-gray-700",children:[R("cronLastRun"),":"]})," ",wi(m.state.lastRunAt)]}),h.jsxs("div",{children:[h.jsxs("span",{className:"font-medium text-gray-700",children:[R("cronLastStatus"),":"]})," ",m.state.lastStatus??"-"]}),m.state.lastError&&h.jsx("div",{className:"text-[11px] text-red-500 break-words",children:m.state.lastError})]}),h.jsxs("div",{className:"flex items-start gap-2 flex-wrap justify-end",children:[h.jsxs(Ye,{variant:"subtle",size:"sm",onClick:()=>f(m),className:"gap-1",children:[h.jsx(Xa,{className:"h-3.5 w-3.5"}),R("cronRunNow")]}),h.jsxs(Ye,{variant:m.enabled?"outline":"primary",size:"sm",onClick:()=>p(m),className:"gap-1",children:[h.jsx(Qa,{className:"h-3.5 w-3.5"}),m.enabled?R("cronDisable"):R("cronEnable")]}),h.jsxs(Ye,{variant:"destructive",size:"sm",onClick:()=>d(m),className:"gap-1",children:[h.jsx(Di,{className:"h-3.5 w-3.5"}),R("delete")]})]})]})})},m.id))})}),h.jsx(l,{})]})}function Lm(e){const{modelOptions:t,selectedSessionPreferredModel:n,defaultModel:r,setSelectedModel:i}=e;T.useEffect(()=>{if(t.length===0){i("");return}i(s=>{var u;if(t.some(l=>l.value===s))return s;const a=n==null?void 0:n.trim();if(a&&t.some(l=>l.value===a))return a;const o=r==null?void 0:r.trim();return o&&t.some(l=>l.value===o)?o:((u=t[0])==null?void 0:u.value)??""})},[r,t,n,i])}function Mm(e){var k;const{view:t,selectedSessionKey:n,activeBackendRunId:r,isLocallyRunning:i,resumeRun:s}=e,[a,o]=T.useState(null),u=T.useRef(!1),l=T.useRef(new Map),c=T.useRef(new Map),d=T.useRef(new Map),p=T.useRef(r),f=T.useRef(new Set);T.useEffect(()=>{n&&f.current.add(n)},[n]),T.useEffect(()=>{n&&i&&f.current.delete(n)},[i,n]);const y=ho(t==="chat"?{states:["queued","running"],limit:200,syncActiveStates:!0,isLocallyRunning:i}:void 0),m=T.useMemo(()=>{var w;return Oo(((w=y.data)==null?void 0:w.runs)??[])},[(k=y.data)==null?void 0:k.runs]),S=T.useMemo(()=>{const w=zo(m);if(a){const M=m.get(a.sessionKey)??null;M&&(!a.runId||M.runId===a.runId)&&w.delete(a.sessionKey)}return w},[m,a]),g=T.useMemo(()=>{if(!n)return null;const w=m.get(n)??null;return(!w||!a||a.sessionKey!==n?!1:!a.runId||w.runId===a.runId)?null:w},[m,n,a]);return T.useEffect(()=>{r&&(p.current=r)},[r]),T.useEffect(()=>{if(t!=="chat"||!n||!g||!f.current.has(n)||i||r===g.runId||l.current.get(n)===g.runId)return;const M=c.current.get(n);if(M&&M===g.runId)return;const A=d.current.get(n);if(typeof A=="number"){const C=Date.parse(g.requestedAt??"");if(Number.isFinite(C)){if(C<=A+2e3)return}else if(Date.now()-A<=8e3)return}l.current.set(n,g.runId),f.current.delete(n),s(g)},[r,g,i,s,n,t]),T.useEffect(()=>{if(!n){l.current.clear(),c.current.clear(),d.current.clear(),f.current.clear();return}m.has(n)||(l.current.delete(n),c.current.delete(n),d.current.delete(n))},[m,n]),T.useEffect(()=>{var M,A,C;const w=u.current;if(u.current=i,!i&&w&&n){const P=((M=p.current)==null?void 0:M.trim())||((C=(A=m.get(n))==null?void 0:A.runId)==null?void 0:C.trim());P&&c.current.set(n,P),d.current.set(n,Date.now()),o({sessionKey:n,...P?{runId:P}:{}}),y.refetch()}},[m,i,n,y]),T.useEffect(()=>{if(!a)return;const w=m.get(a.sessionKey)??null;if(!w){o(null);return}a.runId&&w.runId!==a.runId&&o(null)},[m,a]),T.useEffect(()=>{i&&(a==null?void 0:a.sessionKey)===n&&o(null)},[i,n,a]),{sessionRunStatusByKey:S}}const Nm={parseReady:e=>e.driver!=="nextbot-stream"||e.kind!=="ready"?null:{remoteRunId:typeof e.backendRunId=="string"?e.backendRunId:void 0,sessionId:typeof e.sessionKey=="string"?e.sessionKey:void 0,stopCapable:typeof e.stopSupported=="boolean"?e.stopSupported:void 0,stopReason:typeof e.stopReason=="string"?e.stopReason:void 0},parseFinal:e=>e.driver!=="nextbot-stream"||e.kind!=="final"?null:{sessionId:typeof e.sessionKey=="string"?e.sessionKey:void 0,hasOutput:!!e.hasAssistantSessionEvent}};function jm(e,t){return{driver:"nextbot-stream",mode:"send",payload:e,requestedSkills:t}}function Pm(e){const t=Number.isFinite(e.eventCount)&&e.eventCount>0?Math.max(0,Math.trunc(e.eventCount)):void 0;return{driver:"nextbot-stream",mode:"resume",runId:e.runId,...typeof t=="number"?{fromEventIndex:t}:{},sessionKey:e.sessionKey,...e.agentId?{agentId:e.agentId}:{},stopSupported:e.stopSupported,...e.stopReason?{stopReason:e.stopReason}:{}}}function Dm(e){if(!Array.isArray(e))return[];const t=new Set;for(const n of e){const r=n.trim();r&&t.add(r)}return[...t]}function _m(e){var m;const t=new Set(["tool","tool_result","toolresult","function"]),n=[];let r=0,i=0,s=null;const a=(S,g)=>(r+=1,`history-${S}-${g||"unknown"}-${r}`),o=S=>{const g=typeof S=="string"?S:JSON.stringify(S??{});try{return{args:g,parsedArgs:JSON.parse(g)}}catch{return{args:g}}},u=(S,g)=>{for(let k=S.length-1;k>=0;k-=1){const w=S[k];if(w.type==="tool-invocation"&&w.toolInvocation.toolCallId===g)return k}return-1},l=S=>s?(s={...s,meta:{...s.meta,timestamp:S}},s):(i+=1,s={id:`history-assistant-${i}-${S||"unknown"}`,role:"assistant",parts:[],meta:{source:"history",status:"final",timestamp:S}},s),c=()=>{s&&(s.parts.length>0&&n.push(s),s=null)},d=(S,g)=>{if(!g)return;const k=l(S);k.parts=[...k.parts,{type:"text",text:g}]},p=(S,g)=>{if(!g)return;const k=l(S);k.parts=[...k.parts,{type:"reasoning",reasoning:g,details:[]}]},f=S=>{const g=l(S.timestamp),k=u(g.parts,S.toolCallId),w={type:"tool-invocation",toolInvocation:{status:ie.CALL,toolCallId:S.toolCallId,toolName:S.toolName,args:S.args,parsedArgs:S.parsedArgs}};if(k>=0){g.parts=[...g.parts.slice(0,k),w,...g.parts.slice(k+1)];return}g.parts=[...g.parts,w]},y=S=>{if(!S.toolCallId)return;const g=l(S.timestamp),k=u(g.parts,S.toolCallId);if(k<0){g.parts=[...g.parts,{type:"tool-invocation",toolInvocation:{status:ie.RESULT,toolCallId:S.toolCallId,toolName:S.toolName,args:"{}",parsedArgs:void 0,result:S.result}}];return}const w=g.parts[k];w.type==="tool-invocation"&&(g.parts=[...g.parts.slice(0,k),{...w,toolInvocation:{...w.toolInvocation,status:ie.RESULT,result:S.result}},...g.parts.slice(k+1)])};for(const S of e){const g=(m=S.role)==null?void 0:m.toLowerCase().trim();if(!g)continue;const k=S.timestamp;if(g==="user"||g==="system"||g==="data"){c();const w=xr(S.content).trim();if(!w)continue;n.push({id:a(g,k),role:g,parts:[{type:"text",text:w}],meta:{source:"history",status:"final",timestamp:k}});continue}if(g==="assistant"){const w=xr(S.content).trim();if(w&&d(k,w),typeof S.reasoning_content=="string"&&S.reasoning_content.trim()&&p(k,S.reasoning_content.trim()),Array.isArray(S.tool_calls))for(const M of S.tool_calls){if(!M||typeof M!="object")continue;const A=M,C=A.function,P=typeof C=="object"&&C?C:null,j=typeof A.id=="string"?A.id.trim():"";if(!j)continue;const B=typeof(P==null?void 0:P.name)=="string"?P.name:typeof A.name=="string"?A.name:"tool",v=o((P==null?void 0:P.arguments)??A.arguments??"");f({timestamp:k,toolCallId:j,toolName:B,args:v.args,parsedArgs:v.parsedArgs})}continue}if(t.has(g)){const w=typeof S.tool_call_id=="string"?S.tool_call_id.trim():"",M=typeof S.name=="string"&&S.name.trim()?S.name.trim():"tool";y({timestamp:k,toolCallId:w,toolName:M,result:S.content})}}return c(),n}function Et(e){const[t,n]=T.useState(e.getValue());return T.useEffect(()=>{const r=e.subscribe(n);return()=>r.unsubscribe()},[e]),t}function Om(e,t){const[n,r]=T.useState(t);return T.useEffect(()=>{const i=e.subscribe(r);return()=>i.unsubscribe()},[e]),n}function zm(e,t){const n=T.useRef(e);T.useEffect(()=>{n.current=e});const r=T.useRef(null);T.useEffect(()=>{t.setCallbacks({onRunSettled:async({sourceSessionId:g,resultSessionId:k})=>{const w=n.current;await w.refetchSessions();const M=w.selectedSessionKeyRef.current;(!M||M===g||k&&M===k)&&await w.refetchHistory()},onRunError:({sourceMessage:g,restoreDraft:k})=>{k&&n.current.setDraft(w=>w.trim().length===0&&g?g:w)},onSessionChanged:g=>{n.current.setSelectedSessionKey(k=>k===g?k:g)}})},[t]);const i=Om(t.messages$,t.getMessages()),s=Et(t.isAgentResponding$),a=Et(t.isAwaitingResponse$),o=Et(t.activeRun$),u=Et(t.lastError$),l=(o==null?void 0:o.remoteRunId)??null,c=nm(o),d=!!(o&&(c===null||o.remoteStopCapable&&!l)),p=T.useCallback(async g=>{const k=Dm(g.requestedSkills),w=jm(g,k);await t.send({message:g.message,sessionId:g.sessionKey,agentId:g.agentId,metadata:w,restoreDraftOnError:g.restoreDraftOnError,stopCapable:g.stopSupported,stopReason:g.stopReason})},[t]),f=T.useCallback(async g=>{var A,C;const k=(A=g.runId)==null?void 0:A.trim(),w=(C=g.sessionKey)==null?void 0:C.trim();if(!k||!w)return;const M=Pm(g);await t.resume({remoteRunId:k,sessionId:w,agentId:g.agentId,metadata:M,stopCapable:g.stopSupported,stopReason:g.stopReason})},[t]),y=T.useCallback(async()=>{await t.stop()},[t]),m=T.useCallback(()=>{r.current=null,t.reset()},[t]),S=T.useCallback((g,k)=>{if(!!(t.activeRun$.getValue()||t.isAgentResponding$.getValue()))return;const M=n.current.selectedSessionKeyRef.current;if(M!==r.current&&(r.current=M,t.getMessages().length>0&&t.setMessages([])),!M){t.getMessages().length>0&&t.setMessages([]);return}k!=null&&k.isLoading&&g.length===0||t.setMessages(_m(g))},[t]);return{uiMessages:i,isSending:s,isAwaitingAssistantOutput:a,canStopCurrentRun:d,stopDisabledReason:c,lastSendError:u,activeBackendRunId:l,sendMessage:p,stopCurrentRun:y,resumeRun:f,resetStreamState:m,applyHistoryMessages:S}}const On="sid_";function Fm(e){var r;const t=/^agent:([^:]+):/i.exec(e.trim());if(!t)return null;const n=(r=t[1])==null?void 0:r.trim();return n||null}function Bm(e){const t=Math.random().toString(36).slice(2,8);return`agent:${e}:ui:direct:web-${Date.now().toString(36)}${t}`}function $m(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);const r=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"");return`${On}${r}`}function Um(e){if(!e.startsWith(On))return null;const t=e.slice(On.length).replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4===0?"":"=".repeat(4-t.length%4);try{const r=atob(t+n),i=Uint8Array.from(r,s=>s.charCodeAt(0));return new TextDecoder().decode(i)}catch{return null}}function Hm(e){if(!e)return null;const t=Um(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function Km(e){return`/chat/${$m(e)}`}const ve="native";function He(e){return typeof e!="string"?ve:e.trim().toLowerCase()||ve}function Ot(e,t){return e==="native"?R("chatSessionTypeNative"):e==="codex-sdk"?R("chatSessionTypeCodex"):e==="claude-agent-sdk"?R("chatSessionTypeClaude"):(t==null?void 0:t.trim())||e}function Vm(e){var n;const t=new Map;for(const r of e){const i=He(r.value);t.set(i,{value:i,label:((n=r.label)==null?void 0:n.trim())||Ot(i)})}return t.has(ve)||t.set(ve,{value:ve,label:Ot(ve)}),Array.from(t.values()).sort((r,i)=>r.value===ve?-1:i.value===ve?1:r.value.localeCompare(i.value))}function qm(e){const{selectedSession:t,selectedSessionKey:n,pendingSessionType:r,setPendingSessionType:i,sessionTypesData:s}=e,a=T.useMemo(()=>Vm((s==null?void 0:s.options)??[]),[s==null?void 0:s.options]),o=T.useMemo(()=>{const y=[...a],m=He(t==null?void 0:t.sessionType);return y.some(S=>S.value===m)||y.push({value:m,label:Ot(m)}),y.sort((S,g)=>S.value===ve?-1:g.value===ve?1:S.value.localeCompare(g.value))},[a,t==null?void 0:t.sessionType]),u=T.useMemo(()=>He((s==null?void 0:s.defaultType)??ve),[s==null?void 0:s.defaultType]),l=T.useMemo(()=>He((t==null?void 0:t.sessionType)??r??u),[u,r,t==null?void 0:t.sessionType]);T.useEffect(()=>{n||i(u)},[u,n,i]);const c=!n||!!(t!=null&&t.sessionTypeMutable),d=T.useMemo(()=>new Set(a.map(y=>y.value)),[a]),p=!!(t&&!d.has(He(t.sessionType))),f=p?`${Ot(l)} ${R("chatSessionTypeUnavailableSuffix")}`:null;return{sessionTypeOptions:o,defaultSessionType:u,selectedSessionType:l,canEditSessionType:c,sessionTypeUnavailable:p,sessionTypeUnavailableMessage:f}}const Wm=new Set(["off","minimal","low","medium","high","adaptive","xhigh"]);function Gm(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t&&Wm.has(t)?t:null}function Xm(e){var S,g,k,w,M;const t=fo(),n=po(),r=go({q:e.query.trim()||void 0,limit:120,activeMinutes:0}),i=jo("skill"),s=mo({sessionKey:e.selectedSessionKey,agentId:e.selectedAgentId}),a=yo(e.selectedSessionKey,300),o=xo(),u=(t.isFetched||t.isSuccess)&&(n.isFetched||n.isSuccess),l=T.useMemo(()=>{const A=Vo({meta:n.data,config:t.data,onlyConfigured:!0}),C=new Set,P=[];for(const j of A)for(const B of j.models){const v=qo(j.prefix,B);!v||C.has(v)||(C.add(v),P.push({value:v,modelLabel:B,providerLabel:j.displayName,thinkingCapability:Wo(j.modelThinking,B,j.aliases)}))}return P.sort((j,B)=>{const v=j.providerLabel.localeCompare(B.providerLabel);return v!==0?v:j.modelLabel.localeCompare(B.modelLabel)})},[n.data,t.data]),c=T.useMemo(()=>{var A;return((A=r.data)==null?void 0:A.sessions)??[]},[(S=r.data)==null?void 0:S.sessions]),d=T.useMemo(()=>{var A;return((A=i.data)==null?void 0:A.records)??[]},[(g=i.data)==null?void 0:g.records]),p=T.useMemo(()=>c.find(A=>A.key===e.selectedSessionKey)??null,[e.selectedSessionKey,c]),f=qm({selectedSession:p,selectedSessionKey:e.selectedSessionKey,pendingSessionType:e.pendingSessionType,setPendingSessionType:e.setPendingSessionType,sessionTypesData:o.data});Lm({modelOptions:l,selectedSessionPreferredModel:p==null?void 0:p.preferredModel,defaultModel:(k=t.data)==null?void 0:k.agents.defaults.model,setSelectedModel:e.setSelectedModel});const y=T.useMemo(()=>{var A;return((A=a.data)==null?void 0:A.messages)??[]},[(w=a.data)==null?void 0:w.messages]),m=T.useMemo(()=>{var P;if(!e.selectedSessionKey)return null;const A=(P=a.data)==null?void 0:P.metadata;if(!A||typeof A!="object")return null;const C=[A.preferred_thinking,A.thinking,A.thinking_level,A.thinkingLevel];for(const j of C){const B=Gm(j);if(B)return B}return null},[(M=a.data)==null?void 0:M.metadata,e.selectedSessionKey]);return{configQuery:t,configMetaQuery:n,sessionsQuery:r,installedSkillsQuery:i,chatCapabilitiesQuery:s,historyQuery:a,sessionTypesQuery:o,isProviderStateResolved:u,modelOptions:l,sessions:c,skillRecords:d,selectedSession:p,historyMessages:y,selectedSessionThinkingLevel:m,...f}}function Qm(e){if(e.label&&e.label.trim())return e.label.trim();const t=e.key.split(":");return t[t.length-1]||e.key}class Ym{constructor(t,n){this.uiManager=t,this.streamActionsManager=n,this.hasSnapshotChanges=r=>{const i=Z.getState().snapshot;for(const[s,a]of Object.entries(r))if(!Object.is(i[s],a))return!0;return!1},this.resolveUpdateValue=(r,i)=>typeof i=="function"?i(r):i,this.syncSnapshot=r=>{if(this.hasSnapshotChanges(r)&&(Z.getState().setSnapshot(r),Object.prototype.hasOwnProperty.call(r,"modelOptions")||Object.prototype.hasOwnProperty.call(r,"selectedModel")||Object.prototype.hasOwnProperty.call(r,"selectedThinkingLevel"))){const i=Z.getState().snapshot;this.reconcileThinkingForModel(i.selectedModel)}},this.setDraft=r=>{const i=Z.getState().snapshot.draft,s=this.resolveUpdateValue(i,r);s!==i&&Z.getState().setSnapshot({draft:s})},this.setPendingSessionType=r=>{const i=Z.getState().snapshot.pendingSessionType,s=this.resolveUpdateValue(i,r);s!==i&&Z.getState().setSnapshot({pendingSessionType:s})},this.send=async()=>{const r=Z.getState().snapshot,i=se.getState().snapshot,s=r.draft.trim();if(!s)return;const a=r.selectedSkills,o=!!i.selectedSessionKey,u=i.selectedSessionKey??Bm(i.selectedAgentId);o||this.uiManager.goToSession(u,{replace:!0}),this.setDraft(""),this.setSelectedSkills([]),await this.streamActionsManager.sendMessage({message:s,sessionKey:u,agentId:i.selectedAgentId,sessionType:r.selectedSessionType,model:r.selectedModel||void 0,thinkingLevel:r.selectedThinkingLevel??void 0,stopSupported:r.stopSupported,stopReason:r.stopReason,requestedSkills:a,restoreDraftOnError:!0})},this.stop=async()=>{await this.streamActionsManager.stopCurrentRun()},this.goToProviders=()=>{this.uiManager.goToProviders()},this.setSelectedModel=r=>{const i=Z.getState().snapshot.selectedModel,s=this.resolveUpdateValue(i,r);s!==i&&(Z.getState().setSnapshot({selectedModel:s}),this.reconcileThinkingForModel(s))},this.setSelectedThinkingLevel=r=>{const i=Z.getState().snapshot.selectedThinkingLevel,s=this.resolveUpdateValue(i,r);s!==i&&Z.getState().setSnapshot({selectedThinkingLevel:s})},this.selectSessionType=r=>{const i=He(r);Z.getState().setSnapshot({selectedSessionType:i,pendingSessionType:i}),this.syncRemoteSessionType(i)},this.setSelectedSkills=r=>{const i=Z.getState().snapshot.selectedSkills,s=this.resolveUpdateValue(i,r);Object.is(s,i)||Z.getState().setSnapshot({selectedSkills:s})},this.selectModel=r=>{this.setSelectedModel(r)},this.selectThinkingLevel=r=>{this.setSelectedThinkingLevel(r)},this.selectSkills=r=>{this.setSelectedSkills(r)},this.syncRemoteSessionType=async r=>{const i=se.getState().snapshot,s=i.selectedSessionKey;if(!s)return;const a=i.sessions.find(o=>o.key===s);a!=null&&a.sessionTypeMutable&&He(a.sessionType)!==r&&await bo(s,{sessionType:r})}}resolveThinkingForModel(t,n){const r=t==null?void 0:t.thinkingCapability;return!r||r.supported.length===0?null:n==="off"?"off":n&&r.supported.includes(n)?n:r.default&&r.supported.includes(r.default)?r.default:"off"}reconcileThinkingForModel(t){const n=Z.getState().snapshot,r=n.modelOptions.find(s=>s.value===t),i=this.resolveThinkingForModel(r,n.selectedThinkingLevel);i!==n.selectedThinkingLevel&&Z.getState().setSnapshot({selectedThinkingLevel:i})}}function Jm(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(!Object.is(r,t.get(n)))return!1;return!0}class Zm{constructor(){this.syncSnapshot=t=>{const n=kn.getState().snapshot,r=t.sessionRunStatusByKey;(!r||Jm(n.sessionRunStatusByKey,r))&&(t.isLocallyRunning===void 0||Object.is(n.isLocallyRunning,t.isLocallyRunning))&&(t.activeBackendRunId===void 0||Object.is(n.activeBackendRunId,t.activeBackendRunId))||kn.getState().setSnapshot(t)}}}class ey{constructor(t,n){this.uiManager=t,this.streamActionsManager=n,this.hasSnapshotChanges=r=>{const i=se.getState().snapshot;for(const[s,a]of Object.entries(r))if(!Object.is(i[s],a))return!0;return!1},this.resolveUpdateValue=(r,i)=>typeof i=="function"?i(r):i,this.syncSnapshot=r=>{this.hasSnapshotChanges(r)&&se.getState().setSnapshot(r)},this.setSelectedAgentId=r=>{const i=se.getState().snapshot.selectedAgentId,s=this.resolveUpdateValue(i,r);s!==i&&se.getState().setSnapshot({selectedAgentId:s})},this.setSelectedSessionKey=r=>{const i=se.getState().snapshot.selectedSessionKey,s=this.resolveUpdateValue(i,r);s!==i&&se.getState().setSnapshot({selectedSessionKey:s})},this.createSession=()=>{const r=Z.getState().snapshot.defaultSessionType||"native";this.streamActionsManager.resetStreamState(),this.setSelectedSessionKey(null),Z.getState().setSnapshot({pendingSessionType:r}),this.uiManager.goToChatRoot()},this.selectSession=r=>{this.setSelectedSessionKey(r),this.uiManager.goToSession(r)},this.setQuery=r=>{const i=se.getState().snapshot.query,s=this.resolveUpdateValue(i,r);s!==i&&se.getState().setSnapshot({query:s})}}}const fn=async()=>{},vi=()=>{};class ty{constructor(){this.actions={sendMessage:fn,stopCurrentRun:fn,resumeRun:fn,resetStreamState:vi,applyHistoryMessages:vi},this.bind=t=>{this.actions={...this.actions,...t}},this.sendMessage=t=>this.actions.sendMessage(t),this.stopCurrentRun=()=>this.actions.stopCurrentRun(),this.resumeRun=t=>this.actions.resumeRun(t),this.resetStreamState=()=>this.actions.resetStreamState(),this.applyHistoryMessages=(t,n)=>this.actions.applyHistoryMessages(t,n)}}const ny=async()=>{};class ry{constructor(t,n,r){this.uiManager=t,this.sessionListManager=n,this.streamActionsManager=r,this.actions={refetchSessions:ny},this.bindActions=i=>{this.actions={...this.actions,...i}},this.hasSnapshotChanges=i=>{const s=lt.getState().snapshot;for(const[a,o]of Object.entries(i))if(!Object.is(s[a],o))return!0;return!1},this.syncSnapshot=i=>{this.hasSnapshotChanges(i)&&lt.getState().setSnapshot(i)},this.deleteSession=()=>{this.deleteCurrentSession()},this.createSession=()=>{this.sessionListManager.createSession()},this.goToProviders=()=>{this.uiManager.goToProviders()},this.deleteCurrentSession=async()=>{const{snapshot:{selectedSessionKey:i}}=se.getState();if(!(!i||!await this.uiManager.confirm({title:R("chatDeleteSessionConfirm"),variant:"destructive",confirmLabel:R("delete")}))){lt.getState().setSnapshot({isDeletePending:!0});try{await So(i),this.streamActionsManager.resetStreamState(),se.getState().setSnapshot({selectedSessionKey:null}),this.uiManager.goToChatRoot({replace:!0}),await this.actions.refetchSessions()}finally{lt.getState().setSnapshot({isDeletePending:!1})}}}}}const iy=async e=>!1;class sy{constructor(){this.state={pathname:""},this.actions={navigate:null,confirm:iy},this.syncState=t=>{this.state={...this.state,...t}},this.bindActions=t=>{this.actions={...this.actions,...t}},this.confirm=async t=>this.actions.confirm(t),this.navigateTo=(t,n)=>{this.actions.navigate&&(this.state.pathname===t&&!(n!=null&&n.replace)||(this.actions.navigate(t,n),this.state.pathname=t))},this.goToProviders=()=>{this.navigateTo("/providers")},this.goToChatRoot=t=>{this.navigateTo("/chat",t)},this.goToSession=(t,n)=>{this.navigateTo(Km(t),n)}}}function ay(e){return e.delta?e.started?[{type:K.TEXT_DELTA,messageId:e.messageId,delta:e.delta}]:[{type:K.TEXT_START,messageId:e.messageId},{type:K.TEXT_DELTA,messageId:e.messageId,delta:e.delta}]:[]}function oy(e){return!1}function ly(e){var n,r;return((r=(n=e.message)==null?void 0:n.role)==null?void 0:r.toLowerCase().trim())==="assistant"}function uy(e){var a;const{event:t,messageId:n}=e,r=t.message;if(!r)return[];const i=(a=r.role)==null?void 0:a.toLowerCase().trim();if(!i)return[];const s=[];if(typeof r.reasoning_content=="string"&&r.reasoning_content.trim()&&(s.push({type:K.REASONING_START,messageId:n}),s.push({type:K.REASONING_DELTA,messageId:n,delta:r.reasoning_content.trim()}),s.push({type:K.REASONING_END,messageId:n})),Array.isArray(r.tool_calls))for(let o=0;o<r.tool_calls.length;o+=1){const u=r.tool_calls[o];if(!u||typeof u!="object")continue;const l=u,c=l.function,d=typeof c=="object"&&c?c:null,p=typeof t.seq=="number"?String(t.seq):"unknown",f=typeof l.id=="string"?l.id:`tool-${p}-${o}`,y=typeof(d==null?void 0:d.name)=="string"?d.name:typeof l.name=="string"?l.name:"tool",m=(d==null?void 0:d.arguments)??l.arguments??"",S=typeof m=="string"?m:JSON.stringify(m??{});s.push({type:K.TOOL_CALL_START,messageId:n,toolCallId:f,toolName:y}),s.push({type:K.TOOL_CALL_ARGS,toolCallId:f,args:S}),s.push({type:K.TOOL_CALL_END,toolCallId:f})}if(i==="tool"||i==="tool_result"||i==="toolresult"||i==="function"){const o=typeof r.tool_call_id=="string"?r.tool_call_id.trim():"";o&&s.push({type:K.TOOL_CALL_RESULT,toolCallId:o,content:r.content})}return s}function aa(){return`stream-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function cy(e,t){const n={};return e.sessionType&&(n.session_type=e.sessionType),e.thinkingLevel&&(n.thinking=e.thinkingLevel),t.length>0&&(n.requested_skills=t),{message:e.message,...e.runId?{runId:e.runId}:{},sessionKey:e.sessionKey,agentId:e.agentId,...e.model?{model:e.model}:{},...Object.keys(n).length>0?{metadata:n}:{},channel:"ui",chatId:"web-ui"}}async function dy(e){return ko(cy(e.item,e.requestedSkills),{signal:e.signal,onReady:e.onReady,onDelta:e.onDelta,onSessionEvent:e.onSessionEvent})}async function hy(e){return wo({runId:e.runId,...typeof e.fromEventIndex=="number"?{fromEventIndex:e.fromEventIndex}:{}},{signal:e.signal,onReady:e.onReady,onDelta:e.onDelta,onSessionEvent:e.onSessionEvent})}async function fy(e){var t;if(e.backendStopSupported)try{const n=new Set,r=(t=e.backendRunId)==null?void 0:t.trim();if(r&&(n.add(r),await pn(r)))return;const i=await py(e);for(const s of i){if(n.has(s))continue;if(n.add(s),await pn(s))return}if(r&&await pn(r))return}catch{}}async function pn(e){const t=e.trim();if(!t)return!1;try{return(await vo({runId:t})).stopped===!0}catch{return!1}}async function py(e){var i;const t=(i=e.sessionKey)==null?void 0:i.trim();if(!t)return[];const n=8,r=120;for(let s=0;s<n;s+=1){const a=await gy(e,t);if(a.length>0)return a;s<n-1&&await my(r)}return[]}async function gy(e,t){try{const n=await Co({sessionKey:t,states:["queued","running"],limit:50}),r=n.runs.filter(i=>{var s;return((s=i.runId)==null?void 0:s.trim())&&i.sessionKey===t&&i.agentId===e.agentId}).map(i=>i.runId.trim());return r.length>0?r:n.runs.filter(i=>{var s;return((s=i.runId)==null?void 0:s.trim())&&i.sessionKey===t}).map(i=>i.runId.trim())}catch{return[]}}function my(e){return new Promise(t=>{window.setTimeout(t,e)})}function yy(){const e=Date.now().toString(36),t=Math.random().toString(36).slice(2,10);return`run-${e}-${t}`}function xy(e){const t=e.metadata;if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t;if(n.driver!=="nextbot-stream")return null;const r=n.mode;if(r==="send"){const i=n.payload;if(!i||typeof i!="object"||Array.isArray(i))return null;const s=Array.isArray(n.requestedSkills)?n.requestedSkills.filter(a=>typeof a=="string"):[];return{driver:"nextbot-stream",mode:"send",payload:i,requestedSkills:s}}if(r==="resume"){const i=typeof n.runId=="string"?n.runId.trim():"";if(!i)return null;const s=typeof n.fromEventIndex=="number"&&Number.isFinite(n.fromEventIndex)?Math.max(0,Math.trunc(n.fromEventIndex)):void 0,a=typeof n.sessionKey=="string"?n.sessionKey.trim():"",o=typeof n.agentId=="string"?n.agentId.trim():"",u=typeof n.stopSupported=="boolean"?n.stopSupported:void 0,l=typeof n.stopReason=="string"?n.stopReason.trim():"";return{driver:"nextbot-stream",mode:"resume",runId:i,...typeof s=="number"?{fromEventIndex:s}:{},...a?{sessionKey:a}:{},...o?{agentId:o}:{},...typeof u=="boolean"?{stopSupported:u}:{},...l?{stopReason:l}:{}}}return null}function by(e){var t;if(e.mode==="send"){const n=((t=e.payload.runId)==null?void 0:t.trim())||"";return{localRunId:0,sessionKey:e.payload.sessionKey,...e.payload.agentId?{agentId:e.payload.agentId}:{},...n?{backendRunId:n}:{},backendStopSupported:!!e.payload.stopSupported,...e.payload.stopReason?{backendStopReason:e.payload.stopReason}:{}}}return{localRunId:0,sessionKey:e.sessionKey??"",...e.agentId?{agentId:e.agentId}:{},backendRunId:e.runId,backendStopSupported:!!e.stopSupported,...e.stopReason?{backendStopReason:e.stopReason}:{}}}function Sy(e){var n;return e.mode!=="send"||((n=e.payload.runId)==null?void 0:n.trim())?e:{...e,payload:{...e.payload,runId:yy()}}}function ky(e,t){var n,r,i;e.backendRunId=((n=t.runId)==null?void 0:n.trim())||e.backendRunId,e.backendStopSupported=typeof t.stopSupported=="boolean"?t.stopSupported:e.backendStopSupported,(r=t.stopReason)!=null&&r.trim()&&(e.backendStopReason=t.stopReason.trim()),(i=t.sessionKey)!=null&&i.trim()&&(e.sessionKey=t.sessionKey.trim())}function wy(){return{deltaMessageId:aa(),deltaStarted:!1,deltaClosed:!1,hasAssistantSessionEvent:!1,hasAssistantOutput:!1}}function vy(e){var t,n,r;return{driver:"nextbot-stream",kind:"ready",...(t=e.sessionKey)!=null&&t.trim()?{sessionKey:e.sessionKey.trim()}:{},...(n=e.runId)!=null&&n.trim()?{backendRunId:e.runId.trim()}:{},...typeof e.stopSupported=="boolean"?{stopSupported:e.stopSupported}:{},...(r=e.stopReason)!=null&&r.trim()?{stopReason:e.stopReason.trim()}:{},...e.requestedAt?{requestedAt:e.requestedAt}:{}}}function Cy(e,t){return{driver:"nextbot-stream",kind:"final",sessionKey:e.sessionKey,reply:e.reply,hasAssistantSessionEvent:t}}function Ci(e,t,n){e({type:K.RUN_METADATA,runId:t,metadata:n})}function Ii(e,t){!e.deltaStarted||e.deltaClosed||(t({type:K.TEXT_END,messageId:e.deltaMessageId}),e.deltaClosed=!0)}function Iy(e,t,n){const r=ay({messageId:e.deltaMessageId,delta:n.delta,started:e.deltaStarted});r.length>0&&(e.deltaStarted=!0,e.deltaClosed=!1,e.hasAssistantOutput=!0);for(const i of r)t(i)}function Ty(e,t,n){oy(n.data),ly(n.data)&&(e.hasAssistantSessionEvent=!0);for(const r of uy({event:n.data,messageId:e.deltaMessageId}))t(r)}function Ry(e,t,n){const r=n.trim();if(e.hasAssistantOutput||!r)return;const i=aa();t({type:K.TEXT_START,messageId:i}),t({type:K.TEXT_DELTA,messageId:i,delta:r}),t({type:K.TEXT_END,messageId:i})}class Ey{constructor(){this.activeAbortController=null,this.activeRunState=null,this.buildMissingMetadataObservable=t=>new _t(n=>{n.next({type:K.RUN_ERROR,runId:t,error:"nextbot runtime metadata is required"}),n.complete()}),this.openRunStream=t=>{const{metadata:n,signal:r,onReady:i,onDelta:s,onSessionEvent:a}=t;return n.mode==="send"?dy({item:n.payload,requestedSkills:n.requestedSkills,signal:r,onReady:i,onDelta:s,onSessionEvent:a}):hy({runId:n.runId,fromEventIndex:n.fromEventIndex,signal:r,onReady:i,onDelta:s,onSessionEvent:a})},this.finalizeRunState=(t,n)=>{this.activeAbortController===t&&(this.activeAbortController=null),this.activeRunState===n&&(this.activeRunState=null)},this.createRunObservable=({metadata:t,clientRunId:n,abortController:r,runState:i})=>new _t(s=>{const a=wy();let o=!1;const u=c=>{o||s.next(c)};return u({type:K.RUN_STARTED,runId:n}),this.openRunStream({metadata:t,signal:r.signal,onReady:c=>{this.activeRunState&&ky(this.activeRunState,c),Ci(u,n,vy(c))},onDelta:c=>{Iy(a,u,c)},onSessionEvent:c=>{Ty(a,u,c)}}).then(c=>{Ii(a,u),Ry(a,u,c.reply),Ci(u,n,Cy(c,a.hasAssistantSessionEvent)),u({type:K.RUN_FINISHED,runId:n}),s.complete()}).catch(c=>{Ii(a,u),_n(c)||u({type:K.RUN_ERROR,runId:n,error:c instanceof Error?c.message:String(c)}),s.complete()}).finally(()=>{this.finalizeRunState(r,i)}),()=>{o=!0,r.abort(),this.activeAbortController===r&&(this.activeAbortController=null)}}),this.abortRun=()=>{var n;const t=this.activeRunState;t!=null&&t.backendStopSupported&&fy(t),(n=this.activeAbortController)==null||n.abort(),this.activeAbortController=null,this.activeRunState=null},this.run=t=>{const n=xy(t),r=typeof t.runId=="string"&&t.runId.trim()?t.runId:`run-${Date.now()}`;if(!n)return this.buildMissingMetadataObservable(r);const i=Sy(n);this.abortRun();const s=new AbortController;this.activeAbortController=s;const a=by(i);return this.activeRunState=a,this.createRunObservable({metadata:i,clientRunId:r,abortController:s,runState:a})}}}class Ay{constructor(){this.chatUiManager=new sy,this.runtimeAgent=new Ey,this.chatController=new om({agent:this.runtimeAgent,getToolDefs:()=>[],getContexts:()=>[],getToolExecutor:()=>{}},{metadataParsers:Nm}),this.chatStreamActionsManager=new ty,this.chatInputManager=new Ym(this.chatUiManager,this.chatStreamActionsManager),this.chatSessionListManager=new ey(this.chatUiManager,this.chatStreamActionsManager),this.chatRunStatusManager=new Zm,this.chatThreadManager=new ry(this.chatUiManager,this.chatSessionListManager,this.chatStreamActionsManager)}}function Ly(e){const{view:t,routeSessionKey:n,selectedSessionKey:r,selectedAgentId:i,setSelectedSessionKey:s,setSelectedAgentId:a,selectedSessionKeyRef:o,resetStreamState:u}=e;T.useEffect(()=>{if(t==="chat"){if(n){r!==n&&s(n);return}r!==null&&(s(null),u())}},[u,n,r,s,t]),T.useEffect(()=>{const l=r?Fm(r):null;l&&i!==l&&a(l)},[i,r,a]),T.useEffect(()=>{o.current=r},[r,o])}function My({view:e,confirmDialog:t}){return h.jsxs("div",{className:"h-full flex",children:[h.jsx(nl,{}),e==="chat"?h.jsx(wm,{}):h.jsx("section",{className:"flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white",children:e==="cron"?h.jsx("div",{className:"h-full overflow-auto custom-scrollbar",children:h.jsx("div",{className:"mx-auto w-full max-w-[min(1120px,100%)] px-6 py-5",children:h.jsx(Am,{})})}):h.jsx("div",{className:"h-full overflow-hidden",children:h.jsx("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-6 py-5",children:h.jsx(Po,{forcedType:"skills"})})})}),t]})}function Ky({view:e}){var Me,Be;const[t]=T.useState(()=>new Ay),n=se(be=>be.snapshot.query),r=se(be=>be.snapshot.selectedSessionKey),i=se(be=>be.snapshot.selectedAgentId),s=Z(be=>be.snapshot.pendingSessionType),{confirm:a,ConfirmDialog:o}=_i(),u=Ya(),l=Ja(),{sessionId:c}=Za(),d=T.useRef(null),p=T.useRef(r),f=T.useRef(null),y=T.useMemo(()=>Hm(c),[c]),{sessionsQuery:m,installedSkillsQuery:S,chatCapabilitiesQuery:g,historyQuery:k,isProviderStateResolved:w,modelOptions:M,sessions:A,skillRecords:C,selectedSession:P,historyMessages:j,selectedSessionThinkingLevel:B,sessionTypeOptions:v,defaultSessionType:D,selectedSessionType:_,canEditSessionType:W,sessionTypeUnavailable:O,sessionTypeUnavailableMessage:N}=Xm({query:n,selectedSessionKey:r,selectedAgentId:i,pendingSessionType:s,setPendingSessionType:t.chatInputManager.setPendingSessionType,setSelectedModel:t.chatInputManager.setSelectedModel}),{uiMessages:G,isSending:Y,isAwaitingAssistantOutput:le,canStopCurrentRun:xe,stopDisabledReason:x,lastSendError:de,activeBackendRunId:ue,sendMessage:b,stopCurrentRun:he,resumeRun:Te,resetStreamState:ee,applyHistoryMessages:Oe}=zm({selectedSessionKeyRef:p,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,setDraft:t.chatInputManager.setDraft,refetchSessions:m.refetch,refetchHistory:k.refetch},t.chatController);console.log("[ChatPage] uiMessages",{uiMessages:G,historyMessages:j}),T.useEffect(()=>{t.chatStreamActionsManager.bind({sendMessage:b,stopCurrentRun:he,resumeRun:Te,resetStreamState:ee,applyHistoryMessages:Oe})},[Oe,t,ee,Te,b,he]);const{sessionRunStatusByKey:ke}=Mm({view:e,selectedSessionKey:r,activeBackendRunId:ue,isLocallyRunning:Y||!!ue,resumeRun:t.chatStreamActionsManager.resumeRun});Ly({view:e,routeSessionKey:y,selectedSessionKey:r,selectedAgentId:i,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,setSelectedAgentId:t.chatSessionListManager.setSelectedAgentId,selectedSessionKeyRef:p,resetStreamState:t.chatStreamActionsManager.resetStreamState}),T.useEffect(()=>{t.chatStreamActionsManager.applyHistoryMessages(j,{isLoading:k.isLoading})},[j,k.isLoading,t]),T.useEffect(()=>{t.chatUiManager.syncState({pathname:u.pathname}),t.chatUiManager.bindActions({navigate:l,confirm:a})},[a,u.pathname,l,t]);const Le=P?Qm(P):void 0;return T.useEffect(()=>{t.chatThreadManager.bindActions({refetchSessions:m.refetch})},[t,m.refetch]),T.useEffect(()=>{var St,kt;const be=!Y&&!le&&!k.isLoading&&r!==f.current;t.chatInputManager.syncSnapshot({isProviderStateResolved:w,defaultSessionType:D,canStopGeneration:xe,stopDisabledReason:x,stopSupported:((St=g.data)==null?void 0:St.stopSupported)??!1,stopReason:(kt=g.data)==null?void 0:kt.stopReason,sendError:de,isSending:Y,modelOptions:M,sessionTypeOptions:v,selectedSessionType:_,...be?{selectedThinkingLevel:B}:{},canEditSessionType:W,sessionTypeUnavailable:O,skillRecords:C,isSkillsLoading:S.isLoading}),be&&(f.current=r),r||(f.current=null),t.chatSessionListManager.syncSnapshot({sessions:A,query:n,isLoading:m.isLoading}),t.chatRunStatusManager.syncSnapshot({sessionRunStatusByKey:ke,isLocallyRunning:Y||!!ue,activeBackendRunId:ue}),t.chatThreadManager.syncSnapshot({isProviderStateResolved:w,modelOptions:M,sessionTypeUnavailable:O,sessionTypeUnavailableMessage:N,selectedSessionKey:r,sessionDisplayName:Le,canDeleteSession:!!P,threadRef:d,isHistoryLoading:k.isLoading,uiMessages:G,isSending:Y,isAwaitingAssistantOutput:le})},[ue,W,xe,Le,(Me=g.data)==null?void 0:Me.stopReason,(Be=g.data)==null?void 0:Be.stopSupported,D,k.isLoading,S.isLoading,le,w,Y,de,G,M,t,n,P,B,r,i,_,ke,v,O,N,A,m.isLoading,x,d,C]),h.jsx(Qo,{presenter:t,children:h.jsx(My,{view:e,confirmDialog:h.jsx(o,{})})})}export{Ky as ChatPage};