nextclaw 0.18.0 → 0.18.2

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 (102) hide show
  1. package/dist/cli/{index.js → app/index.js} +11531 -9137
  2. package/package.json +20 -20
  3. package/resources/USAGE.md +30 -3
  4. package/ui-dist/assets/ChannelsList-SQ7Oxotv.js +8 -0
  5. package/ui-dist/assets/DocBrowser-BCO2k6XD.js +1 -0
  6. package/ui-dist/assets/{DocBrowser-6ReNjvzF.js → DocBrowser-rDOjI3ga.js} +1 -1
  7. package/ui-dist/assets/{DocBrowserContext-B6SpA7Qs.js → DocBrowserContext-BUq3Wo8O.js} +1 -1
  8. package/ui-dist/assets/{LogoBadge-ByNLYg65.js → LogoBadge-DP8Ye7wJ.js} +1 -1
  9. package/ui-dist/assets/ModelConfig-C77Ae9ru.js +1 -0
  10. package/ui-dist/assets/ProviderScopedModelInput-CEnK61uo.js +1 -0
  11. package/ui-dist/assets/ProvidersList-BCupBayq.js +1 -0
  12. package/ui-dist/assets/RuntimeConfig-Ad-CAcmy.js +1 -0
  13. package/ui-dist/assets/SearchConfig-BfCz4wJ4.js +1 -0
  14. package/ui-dist/assets/SecretsConfig-DjmBIhyy.js +3 -0
  15. package/ui-dist/assets/{SessionsConfig-ChHQ7M5c.js → SessionsConfig-CvjxU40H.js} +2 -2
  16. package/ui-dist/assets/{book-open-BdcxxoQu.js → book-open-BE8M56IM.js} +1 -1
  17. package/ui-dist/assets/chat-page-JKC6ln-y.js +58 -0
  18. package/ui-dist/assets/chat-session-display-YcRMrAMa.js +1 -0
  19. package/ui-dist/assets/{chunk-JZWAC4HX-DK5HPmIK.js → chunk-JZWAC4HX-erTUn3b8.js} +1 -1
  20. package/ui-dist/assets/client-CszWMVKi.js +7 -0
  21. package/ui-dist/assets/config-split-page-BAGSzUR3.js +1 -0
  22. package/ui-dist/assets/{createLucideIcon-BSeTgkZW.js → createLucideIcon-CCiTGX8L.js} +1 -1
  23. package/ui-dist/assets/desktop-DfkLlkG2.js +1 -0
  24. package/ui-dist/assets/desktop-update-config-BXeGlqHD.js +1 -0
  25. package/ui-dist/assets/dialog-BghZFPch.js +5 -0
  26. package/ui-dist/assets/{dist-6TrrnPCR.js → dist-Dd9cr-kz.js} +1 -1
  27. package/ui-dist/assets/dist-ZwoAXs46.js +9 -0
  28. package/ui-dist/assets/{download-BhDxnyvU.js → download-D7LOizcW.js} +1 -1
  29. package/ui-dist/assets/es2015-CEAreese.js +41 -0
  30. package/ui-dist/assets/{external-link-BgErLCNT.js → external-link-qsnCMhw1.js} +1 -1
  31. package/ui-dist/assets/{hash-Bl7dr_UG.js → hash-0zjWsNl-.js} +1 -1
  32. package/ui-dist/assets/{i18n-eDHeDY0n.js → i18n-DvzXOGQX.js} +1 -1
  33. package/ui-dist/assets/index-DvVTC9FF.css +1 -0
  34. package/ui-dist/assets/index-lr6rQUSd.js +2 -0
  35. package/ui-dist/assets/key-round-BLe9D8ND.js +1 -0
  36. package/ui-dist/assets/loader-circle-wj7kARHv.js +1 -0
  37. package/ui-dist/assets/{logos-x89HbrZ4.js → logos-_v5b2SdG.js} +1 -1
  38. package/ui-dist/assets/marketplace-page-CAAk1Khc.js +1 -0
  39. package/ui-dist/assets/marketplace-page-CfCiq90S.js +49 -0
  40. package/ui-dist/assets/mcp-marketplace-page-D0Pp9Hs-.js +40 -0
  41. package/ui-dist/assets/play-o6NmwGTi.js +1 -0
  42. package/ui-dist/assets/plus-I9pBS4Fl.js +1 -0
  43. package/ui-dist/assets/{refresh-cw-C47QSEwg.js → refresh-cw-MNqgR3LZ.js} +1 -1
  44. package/ui-dist/assets/remote-C9fXm4V5.js +1 -0
  45. package/ui-dist/assets/{save-3S6-H3Xw.js → save-D4bObrmH.js} +1 -1
  46. package/ui-dist/assets/search-DxmL3IWE.js +1 -0
  47. package/ui-dist/assets/security-config-BUm6FFfl.js +1 -0
  48. package/ui-dist/assets/select-BILPf7zs.js +1 -0
  49. package/ui-dist/assets/setting-row-BATDgg4r.js +1 -0
  50. package/ui-dist/assets/skeleton-COKMAnJy.js +1 -0
  51. package/ui-dist/assets/{switch-BsLtHOH-.js → switch-CBOzecWS.js} +1 -1
  52. package/ui-dist/assets/{tabs-custom-D3HYMt6k.js → tabs-custom-Bx3cNhD-.js} +1 -1
  53. package/ui-dist/assets/tag-chip-zUaDE2-H.js +1 -0
  54. package/ui-dist/assets/{trash-2-G48scll7.js → trash-2-CQUgYyRn.js} +1 -1
  55. package/ui-dist/assets/use-infinite-scroll-loader-B5V2Klve.js +1 -0
  56. package/ui-dist/assets/useConfirmDialog-patAnl1g.js +1 -0
  57. package/ui-dist/assets/{useMutation-CBWjE2uj.js → useMutation-__AYv-Pz.js} +1 -1
  58. package/ui-dist/assets/x-BHUGQIUv.js +1 -0
  59. package/ui-dist/index.html +22 -22
  60. package/ui-dist/runtime-icons/claude.ico +0 -0
  61. package/ui-dist/runtime-icons/codex-openai.svg +6 -0
  62. package/ui-dist/runtime-icons/hermes-agent.png +0 -0
  63. package/ui-dist/assets/ChannelsList-Ita2Zm1_.js +0 -8
  64. package/ui-dist/assets/DocBrowser-BNwbPHf4.js +0 -1
  65. package/ui-dist/assets/MarketplacePage-CjX2MWww.js +0 -1
  66. package/ui-dist/assets/MarketplacePage-D0sDlYX4.js +0 -49
  67. package/ui-dist/assets/McpMarketplacePage-BGKJm1sJ.js +0 -40
  68. package/ui-dist/assets/ModelConfig-BzZenCH-.js +0 -1
  69. package/ui-dist/assets/ProviderScopedModelInput-Da7khnBA.js +0 -1
  70. package/ui-dist/assets/ProvidersList-BbVzRxjY.js +0 -1
  71. package/ui-dist/assets/RemoteAccessPage-BaDH_X1Q.js +0 -1
  72. package/ui-dist/assets/RuntimeConfig-F_XKGgLm.js +0 -1
  73. package/ui-dist/assets/SearchConfig-BGkzXQP-.js +0 -1
  74. package/ui-dist/assets/SecretsConfig-D281Rotl.js +0 -3
  75. package/ui-dist/assets/app-query-client-VnFElj4E.js +0 -1
  76. package/ui-dist/assets/chat-page-Doe0yTtB.js +0 -58
  77. package/ui-dist/assets/chat-session-display-cw78aiI_.js +0 -1
  78. package/ui-dist/assets/client-_i4MU2bB.js +0 -7
  79. package/ui-dist/assets/config-DtIQwrHF.js +0 -1
  80. package/ui-dist/assets/config-layout-CHs0mAaR.js +0 -1
  81. package/ui-dist/assets/desktop-update-config-Dpcf4BKG.js +0 -1
  82. package/ui-dist/assets/dist-ccBFUi-o.js +0 -9
  83. package/ui-dist/assets/index-CF9xve0E.js +0 -6
  84. package/ui-dist/assets/index-FgA52VBt.css +0 -1
  85. package/ui-dist/assets/infiniteQueryBehavior-ZDS92Qpp.js +0 -1
  86. package/ui-dist/assets/loader-circle-ACM1s51e.js +0 -1
  87. package/ui-dist/assets/page-layout-vZnghcFy.js +0 -1
  88. package/ui-dist/assets/play-CFUwCA2E.js +0 -1
  89. package/ui-dist/assets/plus-rYsv72JG.js +0 -1
  90. package/ui-dist/assets/popover-Bg1VoTZ6.js +0 -1
  91. package/ui-dist/assets/refresh-ccw-DT98i__E.js +0 -1
  92. package/ui-dist/assets/rotate-cw-JtFzpNn6.js +0 -1
  93. package/ui-dist/assets/search-3kFR_zh9.js +0 -1
  94. package/ui-dist/assets/security-config-BWaiARNk.js +0 -1
  95. package/ui-dist/assets/select-DJ2MUjBB.js +0 -41
  96. package/ui-dist/assets/skeleton-ByQepn0M.js +0 -1
  97. package/ui-dist/assets/status-dot-vbanNPFU.js +0 -1
  98. package/ui-dist/assets/use-infinite-scroll-loader-DkNhD-42.js +0 -1
  99. package/ui-dist/assets/useConfirmDialog-BkvTN-vd.js +0 -1
  100. package/ui-dist/assets/x-ByDbItbq.js +0 -1
  101. /package/dist/cli/{index.d.ts → app/index.d.ts} +0 -0
  102. /package/ui-dist/assets/{config-hints-BhTmc9P1.js → config-hints-DSQQbeOA.js} +0 -0
@@ -0,0 +1,58 @@
1
+ import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,m as s,n as c,p as l,u}from"./i18n-DvzXOGQX.js";import{a as d,c as f,i as p,n as m,o as h,r as g,s as _}from"./dist-ZwoAXs46.js";import{c as v,o as y,s as b}from"./chunk-JZWAC4HX-erTUn3b8.js";import{H as x,L as S,R as C,c as w,o as T,r as E,t as ee,y as te,z as ne}from"./client-CszWMVKi.js";import{t as re}from"./useMutation-__AYv-Pz.js";import{a as ie,i as D,n as ae,o as oe,r as se,t as ce}from"./dialog-BghZFPch.js";import{t as O}from"./createLucideIcon-CCiTGX8L.js";import{n as le}from"./DocBrowser-rDOjI3ga.js";import{t as ue}from"./book-open-BE8M56IM.js";import{D as de,O as fe,_ as pe,a as me,b as he,c as ge,d as _e,f as ve,g as ye,h as be,i as xe,k as Se,l as Ce,m as we,n as Te,o as Ee,p as De,r as Oe,s as ke,t as Ae,u as je,v as Me,y as Ne}from"./select-BILPf7zs.js";import{a as Pe,i as Fe,n as Ie,r as Le,t as Re}from"./ProviderScopedModelInput-CEnK61uo.js";import{t as ze}from"./external-link-qsnCMhw1.js";import{n as Be,t as Ve}from"./logos-_v5b2SdG.js";import{t as He}from"./loader-circle-wj7kARHv.js";import{t as Ue}from"./play-o6NmwGTi.js";import{t as We}from"./plus-I9pBS4Fl.js";import{t as Ge}from"./refresh-cw-MNqgR3LZ.js";import{t as Ke}from"./search-DxmL3IWE.js";import{t as qe}from"./trash-2-CQUgYyRn.js";import{a as Je,c as Ye,i as Xe,l as Ze,n as Qe,o as $e,r as et,s as tt,t as nt,u as rt}from"./chat-session-display-YcRMrAMa.js";import{t as it}from"./x-BHUGQIUv.js";import{i as at}from"./DocBrowserContext-BUq3Wo8O.js";import{A as ot,D as st,Dt as ct,Et as lt,G as ut,H as dt,K as ft,N as pt,O as mt,Ot as ht,St as gt,Tt as _t,U as vt,V as yt,W as bt,_ as xt,_t as St,a as Ct,b as wt,bt as Tt,c as Et,d as Dt,dt as Ot,f as kt,g as At,gt as jt,h as Mt,ht as Nt,i as Pt,kt as Ft,l as It,m as Lt,n as Rt,o as zt,p as Bt,r as Vt,s as Ht,u as Ut,ut as Wt,vt as Gt,wt as Kt,x as qt,xt as Jt,yt as Yt}from"./index-lr6rQUSd.js";import{a as Xt,c as Zt,i as Qt,l as $t,n as en,o as tn,r as nn,s as rn,t as an,u as on}from"./marketplace-page-CfCiq90S.js";import{t as sn}from"./LogoBadge-DP8Ye7wJ.js";import{t as cn}from"./skeleton-COKMAnJy.js";import{t as ln}from"./tag-chip-zUaDE2-H.js";import{t as un}from"./useConfirmDialog-patAnl1g.js";var dn=O(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),fn=O(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),pn=O(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),mn=O(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),hn=O(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),gn=O(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),_n=O(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),vn=O(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),yn=O(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),bn=O(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),xn=O(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Sn=O(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Cn=O(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),wn=O(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Tn=O(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),En=O(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Dn=O(`FolderGit2`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),On=O(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),kn=O(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),An=O(`FolderUp`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),jn=O(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),Mn=O(`HeartPulse`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}],[`path`,{d:`M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`1uw2ng`}]]),Nn=O(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),Pn=O(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),Fn=O(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),In=O(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),Ln=O(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Rn=O(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),zn=O(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Bn=O(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Vn=O(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),Hn=O(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),k=e(s(),1),Un=function(e){return e.EndpointReady=`endpoint.ready`,e.EndpointError=`endpoint.error`,e.MessageRequest=`message.request`,e.MessageStreamRequest=`message.stream-request`,e.MessageSent=`message.sent`,e.MessageAccepted=`message.accepted`,e.MessageIncoming=`message.incoming`,e.MessageCompleted=`message.completed`,e.MessageFailed=`message.failed`,e.MessageAbort=`message.abort`,e.MessageTextStart=`message.text-start`,e.MessageTextDelta=`message.text-delta`,e.MessageTextEnd=`message.text-end`,e.MessageReasoningStart=`message.reasoning-start`,e.MessageReasoningDelta=`message.reasoning-delta`,e.MessageReasoningEnd=`message.reasoning-end`,e.MessageToolCallStart=`message.tool-call-start`,e.MessageToolCallArgs=`message.tool-call-args`,e.MessageToolCallArgsDelta=`message.tool-call-args-delta`,e.MessageToolCallEnd=`message.tool-call-end`,e.MessageToolCallResult=`message.tool-call-result`,e.MessageRead=`message.read`,e.MessageDelivered=`message.delivered`,e.MessageRecalled=`message.recalled`,e.MessageReaction=`message.reaction`,e.RunStarted=`run.started`,e.RunFinished=`run.finished`,e.RunError=`run.error`,e.RunMetadata=`run.metadata`,e.TypingStart=`typing.start`,e.TypingEnd=`typing.end`,e.PresenceUpdated=`presence.updated`,e}({}),Wn=/\[\[\s*reply_to_current\s*\]\]/gi,Gn=/\[\[\s*reply_to\s*:\s*([^\]]+?)\s*\]\]/i;function Kn(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function qn(e,t){let n=e,r;Wn.test(n)&&(r=Kn(t),n=n.replace(Wn,``).trim());let i=n.match(Gn)?.[1];return i&&(r=Kn(i),n=n.replace(Gn,``).trim()),r?{content:n,replyTo:r}:{content:n}}function Jn(e,t=e.id){if(e.role!==`assistant`)return{...e,parts:[...e.parts],metadata:e.metadata?{...e.metadata}:void 0};let n=e.parts.findIndex(e=>e.type===`text`),r=e.metadata?{...e.metadata}:void 0,i=Kn(r?.reply_to);if(n<0)return{...e,parts:[...e.parts],metadata:r};let a=e.parts[n];if(!a||a.type!==`text`)return{...e,parts:[...e.parts],metadata:r};let{content:o,replyTo:s}=qn(a.text,t),c=s??i,l=e.parts.flatMap((e,t)=>t!==n||e.type!==`text`?[e]:o.length===0?[]:[{...e,text:o}]);return c?{...e,parts:l,metadata:{...r,reply_to:c}}:{...e,parts:l,metadata:r}}function Yn(e){return{...e,parts:[...e.parts],metadata:e.metadata?{...e.metadata}:void 0}}function Xn(e){return Yn(Jn(e))}var Zn=`__nextclaw_aborted_tool_call__`;function Qn(e){let t=e.error?.trim();return{code:`runtime-error`,message:t&&t.length>0?t:`Agent run failed.`,details:{sessionId:e.sessionId,messageId:e.messageId,threadId:e.threadId,runId:e.runId}}}function $n(e,t){return t.trim()?e.id.startsWith(`tool-`)?!0:e.parts.some(e=>e.type===`tool-invocation`):!1}function er(e,t,n){for(let[r,i]of e)i===t&&e.set(r,n)}function tr(e,t,n){for(let[r,i]of e)i===n&&(e.delete(r),t.delete(r))}function nr(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n];if(r.type===`tool-invocation`&&r.toolCallId===t)return r}return null}function rr(e,t){return nr(e,t)?.toolName??null}function ir(e,t){let n=[...e];for(let e=n.length-1;e>=0;--e){let r=n[e];if(r.type===`tool-invocation`&&r.toolCallId===t.toolCallId)return n[e]={...r,...t},n}return n.push(t),n}function ar(e){let t=[];return{parts:e.map(e=>e.type!==`tool-invocation`||!e.toolCallId||e.state===`result`||e.state===`cancelled`?e:(t.push(e.toolCallId),{...e,state:`cancelled`})),toolCallIds:t}}var or=`assistant`,sr=class{messages=[];streamingMessage=null;error=null;activeRun=null;listeners=new Set;toolCallMessageIdByCallId=new Map;toolCallArgsRawByCallId=new Map;lastSettledRunId=null;snapshotCache=null;snapshotVersion=-1;stateVersion=0;getSnapshot=()=>{if(this.snapshotCache&&this.snapshotVersion===this.stateVersion)return this.snapshotCache;let e={messages:this.messages,streamingMessage:this.streamingMessage,error:this.error?{...this.error,details:this.error.details?{...this.error.details}:void 0}:null,activeRun:this.activeRun?{...this.activeRun}:null};return this.snapshotCache=e,this.snapshotVersion=this.stateVersion,e};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));reset=()=>{this.messages.length===0&&!this.streamingMessage&&!this.error&&!this.activeRun&&this.toolCallMessageIdByCallId.size===0&&this.toolCallArgsRawByCallId.size===0||(this.messages=[],this.streamingMessage=null,this.error=null,this.activeRun=null,this.toolCallMessageIdByCallId.clear(),this.toolCallArgsRawByCallId.clear(),this.lastSettledRunId=null,this.stateVersion+=1,this.notifyListeners())};hydrate=e=>{this.messages=e.messages.map(e=>Xn(e)),this.streamingMessage=null,this.error=null,this.activeRun=e.activeRun?{...e.activeRun,sessionId:e.activeRun.sessionId??e.sessionId,abortDisabledReason:e.activeRun.abortDisabledReason??null}:null,this.toolCallMessageIdByCallId.clear(),this.toolCallArgsRawByCallId.clear(),this.lastSettledRunId=null,this.stateVersion+=1,this.notifyListeners()};dispatch=e=>this.dispatchBatch([e]);dispatchBatch=async e=>{if(!e.length)return;let t=this.stateVersion;e.forEach(this.applyEvent),this.stateVersion!==t&&this.notifyListeners()};applyEvent=e=>{switch(e.type){case Un.MessageSent:this.handleMessageSent(e.payload);break;case Un.MessageAbort:this.handleMessageAbort(e.payload);break;case Un.MessageTextStart:this.handleMessageTextStart(e.payload);break;case Un.MessageTextDelta:this.handleMessageTextDelta(e.payload);break;case Un.MessageTextEnd:this.handleMessageTextEnd(e.payload);break;case Un.MessageReasoningStart:this.handleMessageReasoningStart(e.payload);break;case Un.MessageReasoningDelta:this.handleMessageReasoningDelta(e.payload);break;case Un.MessageReasoningEnd:this.handleMessageReasoningEnd(e.payload);break;case Un.MessageToolCallStart:this.handleMessageToolCallStart(e.payload);break;case Un.MessageToolCallArgs:this.handleMessageToolCallArgs(e.payload);break;case Un.MessageToolCallArgsDelta:this.handleMessageToolCallArgsDelta(e.payload);break;case Un.MessageToolCallEnd:this.handleMessageToolCallEnd(e.payload);break;case Un.MessageToolCallResult:this.handleMessageToolCallResult(e.payload);break;case Un.RunStarted:this.handleRunStarted(e.payload);break;case Un.RunFinished:this.handleRunFinished(e.payload);break;case Un.RunError:this.handleRunError(e.payload);break;case Un.RunMetadata:this.handleRunMetadata(e.payload);break;case Un.EndpointError:this.handleEndpointError(e.payload);break;default:break}};handleMessageSent=e=>{this.upsertMessage(e.message),this.setError(null)};handleMessageAbort=e=>{let t=e.messageId?.trim();if(this.clearActiveRun(),this.setError(null),this.streamingMessage&&(!t||this.streamingMessage.id===t)){let e=this.streamingMessage.id,{parts:n,toolCallIds:r}=ar(this.streamingMessage.parts);this.upsertMessage({...this.streamingMessage,status:`final`,parts:n}),this.replaceStreamingMessage(null),t?tr(this.toolCallMessageIdByCallId,this.toolCallArgsRawByCallId,t):tr(this.toolCallMessageIdByCallId,this.toolCallArgsRawByCallId,e),r.forEach(e=>this.toolCallArgsRawByCallId.set(e,Zn))}};handleMessageTextStart=e=>{this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),this.setError(null)};handleMessageTextDelta=e=>{if(!e.delta)return;let t=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),n=[...t.parts],r=n[n.length-1];r?.type===`text`?n[n.length-1]={type:`text`,text:`${r.text}${e.delta}`}:n.push({type:`text`,text:e.delta}),this.replaceStreamingMessage({...t,parts:n,status:`streaming`})};handleMessageTextEnd=e=>{this.streamingMessage?.id===e.messageId&&this.streamingMessage.status===`streaming`&&this.replaceStreamingMessage({...this.streamingMessage,status:`pending`})};handleMessageReasoningStart=e=>{this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`)};handleMessageReasoningDelta=e=>{if(!e.delta)return;let t=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),n=[...t.parts],r=n[n.length-1];r?.type===`reasoning`?n[n.length-1]={type:`reasoning`,text:`${r.text}${e.delta}`}:n.push({type:`reasoning`,text:e.delta}),this.replaceStreamingMessage({...t,parts:n,status:`streaming`})};handleMessageReasoningEnd=e=>{this.streamingMessage?.id,e.messageId};handleMessageToolCallStart=e=>{if(this.toolCallArgsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId,e.messageId);this.toolCallArgsRawByCallId.set(e.toolCallId,``);let n=ir(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:e.toolName,state:`partial-call`,args:``});this.replaceStreamingMessage({...t,parts:n,status:`streaming`}),this.setError(null)};handleMessageToolCallArgs=e=>{this.toolCallArgsRawByCallId.get(e.toolCallId)!==`__nextclaw_aborted_tool_call__`&&(this.toolCallArgsRawByCallId.set(e.toolCallId,e.args),this.applyToolCallArgs(e.sessionId,e.toolCallId,e.args))};handleMessageToolCallArgsDelta=e=>{if(this.toolCallArgsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=`${this.toolCallArgsRawByCallId.get(e.toolCallId)??``}${e.delta}`;this.toolCallArgsRawByCallId.set(e.toolCallId,t),this.applyToolCallArgs(e.sessionId,e.toolCallId,t,e.messageId)};handleMessageToolCallEnd=e=>{if(this.toolCallArgsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId),n=this.toolCallArgsRawByCallId.get(e.toolCallId)??``,r=ir(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:rr(t.parts,e.toolCallId)??`unknown`,state:`call`,args:n});this.replaceStreamingMessage({...t,parts:r,status:`streaming`})};handleMessageToolCallResult=e=>{if(this.toolCallArgsRawByCallId.get(e.toolCallId)!==`__nextclaw_aborted_tool_call__`&&!this.updateMessageContainingToolCall(e.toolCallId,(t,n)=>{let r={type:`tool-invocation`,toolCallId:e.toolCallId,toolName:n.toolName,state:`result`,args:n.args,result:e.content};return ir(t.parts,r)})){let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId),n=ir(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:`unknown`,state:`result`,result:e.content});this.replaceStreamingMessage({...t,parts:n,status:`streaming`})}};handleRunStarted=e=>{this.isSettledRunId(e.runId)||(this.setError(null),this.activeRun={runId:e.runId??null,sessionId:e.sessionId},this.stateVersion+=1)};handleRunFinished=e=>{this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.settleStreamingMessage(`final`),this.setError(null),this.clearActiveRun()};handleRunError=e=>{this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.settleStreamingMessage(`error`),this.setError(Qn(e)),this.clearActiveRun()};handleRunMetadata=e=>{let t=e.metadata;if(t?.kind===`ready`){let e=t;if(this.isSettledRunId(e.runId))return;this.activeRun={runId:e.runId??this.activeRun?.runId??null,sessionId:e.sessionId??this.activeRun?.sessionId,abortDisabledReason:e.supportsAbort===!1?e.abortDisabledReason??`Unsupported`:null},this.stateVersion+=1}else t?.kind===`final`&&(this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.clearActiveRun())};handleEndpointError=e=>{if(e.code===`abort-error`){this.handleMessageAbort({sessionId:this.activeRun?.sessionId??this.streamingMessage?.sessionId??``,...this.streamingMessage?.id?{messageId:this.streamingMessage.id}:{}});return}this.settleStreamingMessage(`error`),this.clearActiveRun(),this.setError(e)};applyToolCallArgs=(e,t,n,r)=>{let i=this.resolveToolCallTargetMessage(e,t,r),a=rr(i.parts,t)??`unknown`,o=ir(i.parts,{type:`tool-invocation`,toolCallId:t,toolName:a,state:`partial-call`,args:n});this.replaceStreamingMessage({...i,parts:o,status:`streaming`})};ensureStreamingMessage=(e,t,n)=>{if(this.streamingMessage?.id===t){if(this.streamingMessage.status===n)return this.streamingMessage;let e={...this.streamingMessage,status:n};return this.replaceStreamingMessage(e),e}let r=this.messages.findIndex(e=>e.id===t);if(r>=0){let t=Yn(this.messages[r]),i=[...this.messages];i.splice(r,1),this.messages=i,this.stateVersion+=1;let a={...t,sessionId:e,status:n};return this.replaceStreamingMessage(a),a}let i=this.streamingMessage;if(i&&i.id!==t&&i.sessionId===e&&$n(i,t)){let r={...i,id:t,sessionId:e,status:n};return er(this.toolCallMessageIdByCallId,i.id,t),this.replaceStreamingMessage(r),r}let a={id:t,sessionId:e,role:or,status:n,parts:[],timestamp:new Date().toISOString()};return this.replaceStreamingMessage(a),a};resolveToolCallTargetMessage=(e,t,n)=>{let r=n?.trim()||this.toolCallMessageIdByCallId.get(t)||this.streamingMessage?.id||`tool-${t}`;return this.toolCallMessageIdByCallId.set(t,r),this.ensureStreamingMessage(e,r,`streaming`)};updateMessageContainingToolCall=(e,t)=>{if(this.streamingMessage){let n=nr(this.streamingMessage.parts,e);if(n){let e=t(this.streamingMessage,n);return this.replaceStreamingMessage({...this.streamingMessage,parts:e}),!0}}for(let n=this.messages.length-1;n>=0;--n){let r=this.messages[n],i=nr(r.parts,e);if(!i)continue;let a=[...this.messages];return a[n]={...r,parts:t(r,i)},this.messages=a,this.stateVersion+=1,!0}return!1};upsertMessage=e=>{let t=Xn(e),n=this.messages.findIndex(e=>e.id===t.id);if(n<0){this.messages=[...this.messages,t],this.stateVersion+=1;return}let r=[...this.messages];r[n]=t,this.messages=r,this.stateVersion+=1};replaceStreamingMessage=e=>{!e&&!this.streamingMessage||(this.streamingMessage=e?Xn(e):null,this.stateVersion+=1)};setError=e=>{this.error?.code===e?.code&&this.error?.message===e?.message&&this.error?.details===e?.details&&this.error?.cause===e?.cause||(this.error=e?{...e,details:e.details?{...e.details}:void 0}:null,this.stateVersion+=1)};clearActiveRun=()=>{this.activeRun&&(this.activeRun=null,this.stateVersion+=1)};isSettledRunId=e=>!!e?.trim()&&e===this.lastSettledRunId;markRunAsSettled=e=>{this.lastSettledRunId=e?.trim()||null};settleStreamingMessage=e=>{if(!this.streamingMessage)return;let t={...this.streamingMessage,status:e};this.upsertMessage(t),this.replaceStreamingMessage(null),tr(this.toolCallMessageIdByCallId,this.toolCallArgsRawByCallId,t.id)};notifyListeners=()=>{let e=this.getSnapshot();for(let t of this.listeners)t(e)}},cr=16,lr=class{constructor(e){this.dispatchBatch=e,this.queue=[],this.flushTimerId=null,this.isFlushing=!1,this.isDisposed=!1,this.enqueue=e=>{this.isDisposed||(this.queue.push(e),this.scheduleFlush())},this.dispose=()=>{this.isDisposed=!0,this.flushTimerId!==null&&(window.clearTimeout(this.flushTimerId),this.flushTimerId=null),this.queue.length=0},this.scheduleFlush=()=>{this.flushTimerId!==null||this.isFlushing||this.queue.length===0||(this.flushTimerId=window.setTimeout(()=>{this.flushTimerId=null,this.flush()},cr))},this.flush=async()=>{if(!(this.isDisposed||this.isFlushing||this.queue.length===0)){this.isFlushing=!0;try{for(;this.queue.length>0;){let e=this.queue.splice(0);await this.dispatchBatch(e)}}finally{this.isFlushing=!1,this.scheduleFlush()}}}}};function ur(e,t){let n=e.dispatchBatch;return typeof n==`function`?n.call(e,t):t.reduce((t,n)=>t.then(()=>e.dispatch(n)),Promise.resolve())}function dr(e,t){let n=`payload`in e?e.payload:null;return!n||typeof n!=`object`||!(`sessionId`in n)||typeof n.sessionId!=`string`?!0:n.sessionId===t}function fr(e){return e.parts.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function pr(e,t){if(typeof e==`string`){let n=e.trim();return n?{sessionId:t,message:{id:`user-${Date.now().toString(36)}`,sessionId:t,role:`user`,status:`final`,parts:[{type:`text`,text:n}],timestamp:new Date().toISOString()}}:null}return fr(e.message)?{...e,sessionId:e.sessionId,message:{...e.message,sessionId:e.message.sessionId||e.sessionId}}:null}function mr(e){let t=(0,k.useRef)();return(!t.current||t.current.sessionId!==e)&&(t.current={sessionId:e,manager:new sr}),t.current.manager}function hr({sessionId:e,client:t,manager:n}){let r=(0,k.useSyncExternalStore)(e=>n.subscribe(()=>e()),()=>n.getSnapshot(),()=>n.getSnapshot()),[i,a]=(0,k.useState)(!1);(0,k.useEffect)(()=>{a(!1)},[e]),(0,k.useEffect)(()=>{let r=new lr(e=>ur(n,e)),i=t.subscribe(t=>{dr(t,e)&&r.enqueue(t)});return()=>{i(),r.dispose(),t.stop()}},[t,n,e]);let o=r.streamingMessage?[...r.messages,r.streamingMessage]:r.messages,s=r.activeRun?.runId??null,c=!!r.activeRun;return{snapshot:r,visibleMessages:o,activeRunId:s,isRunning:c,isSending:i,send:async r=>{if(i||c)return;let o=pr(r,e);if(o){a(!0),await n.dispatch({type:Un.MessageSent,payload:{sessionId:e,message:o.message,metadata:o.metadata}});try{await t.send(o)}finally{a(!1)}}},abort:async()=>{r.activeRun&&await t.abort({sessionId:e})},streamRun:async()=>{await t.stop(),await t.stream({sessionId:e})}}}function gr(e){return e instanceof Error?e:Error(String(e))}function _r(e){return e.isHydrating||e.hydratedSessionId!==e.sessionId}function vr({sessionId:e,client:t,loadSeed:n}){let r=mr(e),i=hr({sessionId:e,client:t,manager:r}),[a,o]=(0,k.useState)(!0),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(null),d=(0,k.useRef)({requestId:0,controller:null}),f=(0,k.useCallback)(async()=>{d.current.controller?.abort();let i=new AbortController,a=d.current.requestId+1;d.current={requestId:a,controller:i},await t.stop(),r.reset(),c(null),o(!0);try{let s=await n(e,i.signal);if(i.signal.aborted||d.current.requestId!==a)return;r.hydrate({sessionId:e,messages:s.messages,activeRun:s.status===`running`?{runId:null,sessionId:e,abortDisabledReason:null}:null}),c(null),u(e),o(!1),t.stream({sessionId:e}).catch(e=>{d.current.requestId===a&&c(gr(e))})}catch(t){if(i.signal.aborted||d.current.requestId!==a)return;c(gr(t)),u(e),o(!1)}finally{d.current.controller===i&&(d.current.controller=null)}},[t,n,r,e]);return(0,k.useEffect)(()=>(f(),()=>{d.current.controller?.abort(),d.current.controller=null}),[f]),{...i,isHydrating:_r({sessionId:e,hydratedSessionId:l,isHydrating:a}),hydrateError:s}}var yr=200*1024*1024,br=`application/octet-stream`;function xr(e){let t=e.type.trim().toLowerCase();return t.length>0?t:br}function Sr(e,t){let n=t.acceptedMimeTypes&&t.acceptedMimeTypes.length>0?new Set(t.acceptedMimeTypes.map(e=>e.trim().toLowerCase())):null,r=t.maxBytes??209715200,i=xr(e);return n&&!n.has(i)?{ok:!1,rejected:{fileName:e.name,mimeType:i,sizeBytes:e.size,reason:`unsupported-type`}}:e.size>r?{ok:!1,rejected:{fileName:e.name,mimeType:i,sizeBytes:e.size,reason:`too-large`}}:{ok:!0,mimeType:i}}function Cr(e){let t=e.parts&&e.parts.length>0?e.parts.map(e=>structuredClone(e)):[...e.text?.trim()??``?[{type:`text`,text:e.text.trim()}]:[],...(e.attachments??[]).map(e=>({type:`file`,name:e.name,mimeType:e.mimeType,...e.assetUri?.trim()?{assetUri:e.assetUri.trim()}:{},...e.url?.trim()?{url:e.url.trim()}:{},...e.contentBase64?.trim()?{contentBase64:e.contentBase64.trim()}:{},sizeBytes:e.sizeBytes}))];if(t.length===0)return null;let n=e.timestamp??new Date().toISOString(),r=e.messageId??`user-${Date.now().toString(36)}`;return{sessionId:e.sessionId,message:{id:r,sessionId:e.sessionId,role:`user`,status:`final`,parts:t,timestamp:n,...e.metadata?{metadata:e.metadata}:{}},...e.metadata?{metadata:e.metadata}:{}}}async function wr(e,t){let n=[],r=[];for(let i of e){let e=Sr(i,t);if(!e.ok){r.push(e.rejected);continue}n.push(i)}if(n.length===0)return{attachments:[],rejected:r};try{return{attachments:await t.uploadBatch(n),rejected:r}}catch{return r.push(...n.map(e=>({fileName:e.name,mimeType:xr(e),sizeBytes:e.size,reason:`read-failed`}))),{attachments:[],rejected:r}}}var A=l(),Tr={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 Er({status:e,className:t}){let n=Tr[e],r=o(e===`connected`?`connected`:e===`disconnected`?`disconnected`:`connecting`);return(0,A.jsx)(Qt,{delayDuration:250,children:(0,A.jsxs)(en,{children:[(0,A.jsx)(Xt,{asChild:!0,children:(0,A.jsx)(`span`,{role:`status`,"aria-label":r,className:u(`inline-flex h-5 w-5 items-center justify-center`,t),children:e===`connecting`?(0,A.jsx)(He,{className:u(`h-3 w-3 animate-spin`,n.dotClass)}):(0,A.jsx)(`span`,{className:u(e===`connected`?`h-2 w-2 rounded-full`:``,n.dotClass)})})}),(0,A.jsx)(nn,{side:`bottom`,className:`text-xs`,children:r})]})})}var Dr=[[`bg-amber-100`,`text-amber-700`],[`bg-emerald-100`,`text-emerald-700`],[`bg-blue-100`,`text-blue-700`],[`bg-rose-100`,`text-rose-700`],[`bg-cyan-100`,`text-cyan-700`],[`bg-violet-100`,`text-violet-700`]];function Or(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function kr(e){let t=e.trim();return t?t.slice(0,1).toUpperCase():`A`}function Ar({agentId:e,displayName:t,avatarUrl:n,className:r}){let i=t?.trim()||e,[a,o]=Dr[Or(e)%Dr.length]??Dr[0];return n?.trim()?(0,A.jsx)(`img`,{src:n,alt:t?.trim()||e,className:u(`rounded-full object-cover`,r)}):(0,A.jsx)(`div`,{className:u(`rounded-full flex items-center justify-center font-semibold`,a,o,r),"aria-label":t?.trim()||e,children:kr(i)})}var jr={wx:`weixin`,lark:`feishu`},Mr={heartbeat:{icon:`heartbeat`},cron:{icon:`cron`}},Nr={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function Pr(e){return e?.trim().toLowerCase()??``}function Fr(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Ir(e,t){let n=Pr(e);if(!n||n===`native`)return null;let r=t.find(e=>Pr(e.value)===n);return r?.label.trim()?r.label.trim():Fr(n)}function Lr(e,t){let n=Pr(e);return!n||n===`native`?null:t.find(e=>Pr(e.value)===n)??null}function Rr(e){let t=Pr(e);if(!t)return null;let n=jr[t]??t;return Ve(n)?n:null}function zr(e,t){let n=Rr(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=Mr[Pr(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=Pr(e.sessionType),a=Lr(i,t);if(a?.icon?.src?.trim())return{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},label:null};let s=Nr[i];return s?{icon:null,label:o(s)}:{icon:null,label:a?.label?.trim()||Ir(e.sessionType,t)}}var Br=`app://`;function Vr(e){let t=e.trim().replace(/^\/+/,``);if(!t)return null;let n=t.split(`/`);return n.some(e=>e.trim().length===0||e===`.`||e===`..`)?null:n.join(`/`)}function Hr(e){let t=e.trim();if(!t)return null;if(!t.startsWith(Br))return t;let n=Vr(t.slice(6));return n?`/${n}`:null}function Ur({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,A.jsx)(Wr,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=Hr(e.src);return(0,A.jsx)(sn,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,A.jsx)(ht,{className:u(`h-3 w-3 text-gray-500`,t)})})}return e.icon===`heartbeat`?(0,A.jsx)(Mn,{className:u(`h-3.5 w-3.5`,t)}):(0,A.jsx)(Ft,{className:u(`h-3.5 w-3.5`,t)})}function Wr({channel:e,className:t}){return(0,A.jsx)(sn,{name:e,src:Ve(e),className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,A.jsx)(ht,{className:`h-3 w-3 text-gray-500`})})}function Gr({session:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(St,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:o(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-gray-300 bg-white text-xs`,autoFocus:!0,disabled:n}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsx)(`div`,{className:`min-w-0 text-[11px] text-gray-400 truncate`,children:e.key}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(h,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:()=>void i(),disabled:n,"aria-label":o(`save`),children:(0,A.jsx)(Se,{className:`h-3.5 w-3.5`})}),(0,A.jsx)(h,{type:`button`,size:`icon`,variant:`ghost`,className:`h-7 w-7 rounded-lg text-gray-500 hover:bg-white hover:text-gray-900`,onClick:a,disabled:n,"aria-label":o(`cancel`),children:(0,A.jsx)(it,{className:`h-3.5 w-3.5`})})]})]})]})}function Kr({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:s,agentLabel:l,agentAvatarUrl:d,childSessionCount:f=0,onSelect:p,onOpenChildSessions:m,onStartEditing:h}){let g=t?`text-gray-700`:`text-gray-500`,_=s?.trim()??``;return(0,A.jsxs)(`div`,{className:`group/session relative`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:p,className:`w-full text-left`,children:[(0,A.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-1.5 pr-8`,children:[(0,A.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[_&&_.toLowerCase()!==`main`?(0,A.jsx)(Ar,{agentId:_,displayName:l,avatarUrl:d,className:`h-5 w-5 shrink-0`}):null,(0,A.jsx)(`span`,{className:`truncate font-medium`,children:a}),i.label?(0,A.jsx)(`span`,{className:u(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,t?`border-gray-300 bg-white/80 text-gray-700`:`border-gray-200 bg-gray-100 text-gray-500`),children:i.label}):null,i.icon?(0,A.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center`,children:(0,A.jsx)(Ur,{icon:i.icon,className:g})}):null]}),(0,A.jsxs)(`span`,{className:`inline-flex shrink-0 items-center justify-end gap-1.5`,children:[n?(0,A.jsx)(`span`,{"aria-label":o(`chatSessionUnread`),className:`h-2 w-2 rounded-full bg-primary`}):null,(0,A.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 items-center justify-center`,children:r?(0,A.jsx)(Ze,{status:r}):null})]})]}),(0,A.jsx)(`div`,{className:`mt-0.5 text-[11px] text-gray-400 truncate`,children:(0,A.jsxs)(`span`,{children:[l?.trim()?`${l} · `:``,e.messageCount,` · `,c(e.updatedAt)]})})]}),f>0&&m?(0,A.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:u(`absolute right-7 top-0 inline-flex h-7 items-center gap-1 rounded-lg px-1.5 text-[10px] font-medium text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`chatSessionOpenChildSessions`),title:o(`chatSessionOpenChildSessions`),children:[(0,A.jsx)(lt,{className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{children:f})]}):null,(0,A.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h()},className:u(`absolute right-0 top-0 inline-flex h-7 w-7 items-center justify-center rounded-lg text-gray-400 transition-all hover:bg-white hover:text-gray-900`,t?`opacity-100`:`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":o(`edit`),children:(0,A.jsx)(Ln,{className:`h-3.5 w-3.5`})})]})}function qr({session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,childSessionCount:l,isEditing:d,draftLabel:f,isSaving:p,onSelect:m,onOpenChildSessions:h,onStartEditing:g,onDraftLabelChange:_,onSave:v,onCancel:y}){return(0,A.jsx)(`div`,{className:u(`w-full rounded-xl px-3 py-2 text-left transition-all text-[13px]`,t?`bg-gray-200 text-gray-900 font-semibold shadow-sm`:`text-gray-700 hover:bg-gray-200/60 hover:text-gray-900`),children:d?(0,A.jsx)(Gr,{session:e,draftLabel:f,isSaving:p,onDraftLabelChange:_,onSave:v,onCancel:y}):(0,A.jsx)(Kr,{session:e,active:t,showUnreadDot:n,runStatus:r,context:i,title:a,agentId:o,agentLabel:s,agentAvatarUrl:c,onSelect:m,childSessionCount:l,onOpenChildSessions:h,onStartEditing:g})})}function Jr(e){let{option:t,onSelect:n}=e,r=t.ready===!1?t.reasonMessage?.trim()||o(`statusSetup`):null;return(0,A.jsx)(`button`,{type:`button`,onClick:n,className:`w-full rounded-2xl px-3 py-2.5 text-left transition-colors hover:bg-gray-50`,children:(0,A.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[t.icon?.src?(0,A.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,A.jsx)(Ur,{icon:{kind:`runtime-image`,src:t.icon.src,alt:t.icon.alt??null,name:t.label}})}):null,(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:t.label}),(0,A.jsxs)(`span`,{className:u(`inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium`,t.ready===!1?`text-amber-700`:`text-emerald-600`),children:[(0,A.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,t.ready===!1?`bg-amber-500`:`bg-emerald-500`)}),t.ready===!1?o(`statusSetup`):o(`statusReady`)]})]}),r?(0,A.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:r}):null]})]})})})}function Yr(e){let{isProjectFirstView:t,onSelectMode:n}=e;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,A.jsx)(`button`,{type:`button`,"aria-pressed":!t,onClick:()=>n(`time-first`),className:u(`transition-colors`,t?`text-gray-400 hover:text-gray-600`:`font-medium text-gray-600`),children:o(`chatSidebarViewTime`)}),(0,A.jsx)(`span`,{className:`text-gray-300`,children:`/`}),(0,A.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>n(`project-first`),className:u(`transition-colors`,t?`font-medium text-gray-600`:`text-gray-400 hover:text-gray-600`),children:o(`chatSidebarViewProject`)})]})}function Xr(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function Zr(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,onCreateSession:a}=e,[s,c]=(0,k.useState)(null),l=(0,k.useMemo)(()=>Xr(n,r),[n,r]),u=r.length>1;return(0,A.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>{let t=`${o(`chatSidebarNewTask`)} · ${e.projectName}`;return(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-0.5`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`div`,{className:`truncate text-[11px] font-medium uppercase tracking-wider text-gray-500`,title:e.projectRoot,children:e.projectName}),(0,A.jsx)(`span`,{className:`shrink-0 text-[10px] text-gray-400`,children:e.items.length})]}),u?(0,A.jsxs)(Et,{open:s===e.projectRoot,onOpenChange:t=>{c(t?e.projectRoot:null)},children:[(0,A.jsx)(Ut,{asChild:!0,children:(0,A.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,"aria-label":t,title:t,children:(0,A.jsx)(We,{className:`h-3.5 w-3.5`})})}),(0,A.jsxs)(It,{align:`end`,className:`w-56 rounded-2xl border border-gray-200/80 bg-white p-1.5 shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:[(0,A.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:o(`chatSessionTypeLabel`)}),(0,A.jsx)(`div`,{className:`space-y-1`,children:r.map(t=>(0,A.jsx)(Jr,{option:t,onSelect:()=>{a(t.value,e.projectRoot),c(null)}},`${e.projectRoot}:${t.value}`))})]})]}):(0,A.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-lg text-gray-400 hover:bg-white hover:text-gray-900`,onClick:()=>a(l,e.projectRoot),"aria-label":t,title:t,children:(0,A.jsx)(We,{className:`h-3.5 w-3.5`})})]}),(0,A.jsx)(`div`,{className:`space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}function Qr(){let e=x();return async t=>{let{sessionKey:n,patch:r,successMessage:i}=t;try{ut(e,await vt(n,r)),await e.invalidateQueries({queryKey:[`ncp-session-skills`,n]}),m.success(i??o(`configSavedApplied`))}catch(e){throw m.error(o(`configSaveFailed`)+`: `+(e instanceof Error?e.message:String(e))),e}}}function $r(){let e=Qr();return async t=>{await e({sessionKey:t.sessionKey,patch:{label:t.label},successMessage:o(`configSavedApplied`)})}}function ei(){let e=$r(),[t,n]=(0,k.useState)(null),[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(null),s=e=>{n(e.key),i(e.label?.trim()??``)},c=()=>{n(null),i(``),o(null)};return{editingSessionKey:t,draftLabel:r,savingSessionKey:a,setDraftLabel:i,startEditingSessionLabel:s,cancelEditingSessionLabel:c,saveSessionLabel:async t=>{let n=r.trim();if(n===(t.label?.trim()??``)){c();return}o(t.key);try{await e({sessionKey:t.key,label:n||null}),c()}catch{o(null)}}}}function ti(e,t){let n=e?.trim();if(!n)return!1;let r=t?.trim();return r?n.localeCompare(r)>0:!1}function ni(e){let{active:t,readAt:n,runStatus:r,lastMessageAt:i}=e;return t||r===`running`?!1:ti(i,n)}var ri={selectedSessionKey:null,draftSessionKey:$e(),selectedAgentId:`main`,query:``,listMode:`time-first`};function ii(e){return t=>e(e=>({snapshot:{...e.snapshot,...t}}))}function ai(e){return(t,n)=>e(e=>{let r=t.trim(),i=n?.trim();if(!r||!i)return e;let a=e.optimisticReadAtBySessionKey[r];return a&&a.localeCompare(i)>=0?e:{...e,optimisticReadAtBySessionKey:{...e.optimisticReadAtBySessionKey,[r]:i}}})}var j=g(e=>({snapshot:ri,optimisticReadAtBySessionKey:{},setSnapshot:ii(e),markSessionRead:ai(e)}));function oi(e,t){return e.filter(e=>Qe(e,t))}function si(e){return e.isChildSession?e.isPromotedChildSession===!0:!0}function ci(e={}){let t=j(e=>e.snapshot.query),n=mt({limit:e.limit??200}),r=(0,k.useMemo)(()=>{let e=n.data?.sessions??[],r=oi(Xe(e).filter(si),t),i=new Map(e.map(e=>[e.sessionId,e]));return r.map(e=>({session:e,runStatus:i.get(e.key)?.status===`running`?`running`:void 0}))},[t,n.data?.sessions]);return{isLoading:n.isLoading,items:r}}var li=(0,k.createContext)(null);function ui({presenter:e,children:t}){return(0,A.jsx)(li.Provider,{value:e,children:t})}function di(){let e=(0,k.useContext)(li);if(!e)throw Error(`usePresenter must be used inside ChatPresenterProvider`);return e}var fi=e=>`[data-item-index="${e}"]`;function pi(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??fi;(0,k.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function mi(){let e=(0,k.useRef)(null),[t,n]=(0,k.useState)(null);return(0,k.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function M(...e){return n(r(e))}var hi=k.forwardRef(({className:e,type:t,...n},r)=>(0,A.jsx)(`input`,{type:t,className:M(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));hi.displayName=`ChatInput`;var gi=Lt,_i=Mt,vi=Dt,yi=k.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,...r},i)=>(0,A.jsx)(Bt,{children:(0,A.jsx)(kt,{ref:i,sideOffset:t,align:n,className:M(`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})}));yi.displayName=kt.displayName;var bi=we,xi=ke,Si=Ne,Ci=k.forwardRef(({className:e,children:t,...n},r)=>(0,A.jsxs)(Me,{ref:r,className:M(`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,(0,A.jsx)(ge,{asChild:!0,children:(0,A.jsx)(fe,{className:`h-4 w-4 opacity-50`})})]}));Ci.displayName=Me.displayName;var wi=k.forwardRef(({className:e,...t},n)=>(0,A.jsx)(ye,{ref:n,className:M(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,A.jsx)(de,{className:`h-4 w-4`})}));wi.displayName=ye.displayName;var Ti=k.forwardRef(({className:e,...t},n)=>(0,A.jsx)(be,{ref:n,className:M(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,A.jsx)(fe,{className:`h-4 w-4`})}));Ti.displayName=be.displayName;var Ei=k.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,A.jsx)(De,{children:(0,A.jsxs)(Ee,{ref:i,className:M(`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:[(0,A.jsx)(wi,{}),(0,A.jsx)(he,{className:M(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,A.jsx)(Ti,{})]})}));Ei.displayName=Ee.displayName;var Di=k.forwardRef(({className:e,...t},n)=>(0,A.jsx)(ve,{ref:n,className:M(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-gray-500`,e),...t}));Di.displayName=ve.displayName;var Oi=k.forwardRef(({className:e,children:t,...n},r)=>(0,A.jsxs)(Ce,{ref:r,className:M(`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:[(0,A.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,A.jsx)(je,{children:(0,A.jsx)(Se,{className:`h-4 w-4`})})}),(0,A.jsx)(_e,{children:t})]}));Oi.displayName=Ce.displayName;var ki=k.forwardRef(({className:e,...t},n)=>(0,A.jsx)(pe,{ref:n,className:M(`-mx-1 my-1 h-px bg-gray-100`,e),...t}));ki.displayName=pe.displayName;var Ai=Zt,ji=$t,Mi=on,Ni=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,A.jsx)(rn,{children:(0,A.jsx)(tn,{ref:r,sideOffset:t,className:M(`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})}));Ni.displayName=tn.displayName;var Pi={Popover:gi,PopoverAnchor:vi,PopoverContent:yi,PopoverTrigger:_i,Input:hi,Select:bi,SelectContent:Ei,SelectGroup:xi,SelectItem:Oi,SelectLabel:Di,SelectSeparator:ki,SelectTrigger:Ci,SelectValue:Si,Tooltip:ji,TooltipContent:Ni,TooltipProvider:Ai,TooltipTrigger:Mi},Fi=680,Ii=.82,Li=560;function Ri(e){let{Popover:t,PopoverAnchor:n,PopoverContent:r}=Pi,{elementRef:i,width:a}=mi(),o=(0,k.useRef)(null),{isOpen:s,isLoading:c,items:l,activeIndex:u,activeItem:d,texts:f,onSelectItem:p,onOpenChange:m,onSetActiveIndex:h}=e,g=(0,k.useMemo)(()=>{if(a)return Math.min(a>Li?a*Ii:a,Fi)},[a]);return pi({containerRef:o,activeIndex:u,itemCount:l.length,isEnabled:s&&!c,getItemSelector:e=>`[data-slash-index="${e}"]`}),(0,A.jsxs)(t,{open:s,onOpenChange:m,children:[(0,A.jsx)(n,{asChild:!0,children:(0,A.jsx)(`div`,{ref:i,className:`pointer-events-none absolute bottom-full left-3 right-3 h-0`})}),(0,A.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:e=>e.preventDefault(),style:g?{width:`${g}px`}:void 0,children:(0,A.jsxs)(`div`,{className:`grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,A.jsx)(`div`,{ref:o,role:`listbox`,"aria-label":f.slashSectionLabel,className:`custom-scrollbar max-h-[320px] overflow-y-auto border-r border-gray-200 p-2.5`,children:c?(0,A.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:f.slashLoadingLabel}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:f.slashSectionLabel}),l.length===0?(0,A.jsx)(`div`,{className:`px-2 text-xs text-gray-400`,children:f.slashEmptyLabel}):(0,A.jsx)(`div`,{className:`space-y-1`,children:l.map((e,t)=>{let n=t===u;return(0,A.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-slash-index":t,onMouseEnter:()=>h(t),onClick:()=>p(e),className:`flex w-full items-start gap-2 rounded-lg px-2 py-1.5 text-left transition ${n?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-50`}`,children:[(0,A.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.title}),(0,A.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:e.subtitle})]},e.key)})})]})}),(0,A.jsx)(`div`,{className:`min-w-0 p-2.5`,children:d?(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:d.subtitle}),(0,A.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:d.title})]}),(0,A.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:d.description}),(0,A.jsx)(`div`,{className:`space-y-1`,children:d.detailLines.map(e=>(0,A.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,A.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:f.slashSkillHintLabel})]}):(0,A.jsx)(`div`,{className:`text-xs text-gray-500`,children:f.slashHintLabel})})]})})]})}var zi=_(`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`}}),Bi=k.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,A.jsx)(`button`,{className:M(zi({variant:t,size:n,className:e})),ref:i,...r}));Bi.displayName=`ChatButton`;var Vi=120;function Hi(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=Vi?t:`${t.slice(0,Vi-1)}…`}function Ui(){return(0,A.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-gray-700 shadow-[inset_0_0_0_1px_rgba(17,24,39,0.06)]`})}function Wi({sendError:e,sendErrorDetailsLabel:t,isSending:n,canStopGeneration:r,sendDisabled:i,stopDisabled:a,stopHint:o,sendButtonLabel:s,stopButtonLabel:c,onSend:l,onStop:u}){let{Popover:d,PopoverContent:f,PopoverTrigger:p,Tooltip:m,TooltipContent:h,TooltipProvider:g,TooltipTrigger:_}=Pi,v=e?.trim()??``,y=v?Hi(v):``,b=t?.trim()||`Details`;return(0,A.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[v?(0,A.jsxs)(`div`,{className:`flex max-w-[420px] items-start justify-end gap-2 text-right`,children:[(0,A.jsx)(`div`,{className:`min-w-0 flex-1 text-[11px] text-red-600`,children:(0,A.jsx)(`span`,{className:`block truncate`,title:v,children:y})}),(0,A.jsxs)(d,{children:[(0,A.jsx)(p,{asChild:!0,children:(0,A.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-full border border-red-200/80 bg-red-50 px-2 py-0.5 text-[10px] font-semibold text-red-700 transition-colors hover:bg-red-100`,children:b})}),(0,A.jsxs)(f,{align:`end`,className:`w-[min(32rem,calc(100vw-1.5rem))] border-red-100/80 p-0`,children:[(0,A.jsx)(`div`,{className:`border-b border-red-100 bg-red-50/80 px-4 py-2 text-xs font-semibold text-red-700`,children:b}),(0,A.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs leading-relaxed text-red-700`,children:v})]})]})]}):null,(0,A.jsx)(`div`,{className:`flex items-center gap-2`,children:n?r?(0,A.jsx)(Bi,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,onClick:()=>void u(),disabled:a,children:(0,A.jsx)(Ui,{})}):(0,A.jsx)(g,{children:(0,A.jsxs)(m,{children:[(0,A.jsx)(_,{asChild:!0,children:(0,A.jsx)(`span`,{children:(0,A.jsx)(Bi,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,disabled:!0,children:(0,A.jsx)(Ui,{})})})}),(0,A.jsx)(h,{side:`top`,children:(0,A.jsx)(`p`,{className:`text-xs`,children:o})})]})}):(0,A.jsx)(Bi,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void l(),disabled:i,children:(0,A.jsx)(fn,{className:`h-5 w-5`})})})]})}function Gi(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}function Ki(e){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i}=Pi,{picker:a}=e,o=(0,k.useRef)(null),s=(0,k.useId)(),[c,l]=(0,k.useState)(``),[u,d]=(0,k.useState)(0),f=(0,k.useMemo)(()=>new Set(a.selectedKeys),[a.selectedKeys]),p=a.selectedKeys.length,m=c.trim().length>0,h=(0,k.useMemo)(()=>{if(m)return null;let e=a.groups?.filter(e=>e.options.length>0)??[];return e.length>0?e:null},[m,a.groups]),g=(0,k.useMemo)(()=>h?h.flatMap(e=>e.options):Gi(a.options,c),[h,a.options,c]);(0,k.useEffect)(()=>{d(0)},[c]),(0,k.useEffect)(()=>{d(e=>g.length===0?0:Math.min(e,g.length-1))},[g.length]),pi({containerRef:o,activeIndex:u,itemCount:g.length,isEnabled:g.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let _=e=>{if(f.has(e)){a.onSelectedKeysChange(a.selectedKeys.filter(t=>t!==e));return}a.onSelectedKeysChange([...a.selectedKeys,e])},v=e=>{if(g.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),d(e=>Math.min(e+1,g.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),d(e=>Math.max(e-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=g[u];t&&_(t.key)}}};return(0,A.jsxs)(n,{children:[(0,A.jsx)(i,{asChild:!0,children:(0,A.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:[(0,A.jsx)(ct,{className:`h-4 w-4`}),(0,A.jsx)(`span`,{children:a.title}),p>0?(0,A.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:p}):null]})}),(0,A.jsxs)(r,{side:`top`,align:`start`,className:`w-[360px] p-0`,children:[(0,A.jsxs)(`div`,{className:`space-y-2 border-b border-gray-100 px-4 py-3`,children:[(0,A.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:a.title}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Ke,{className:`pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400`}),(0,A.jsx)(t,{value:c,onChange:e=>l(e.target.value),onKeyDown:v,placeholder:a.searchPlaceholder,role:`combobox`,"aria-controls":s,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":g[u]?`${s}-option-${u}`:void 0,className:`h-8 rounded-lg pl-8 text-xs`})]})]}),(0,A.jsx)(`div`,{ref:o,id:s,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar max-h-[320px] overflow-y-auto`,children:a.isLoading?(0,A.jsx)(`div`,{className:`p-4 text-xs text-gray-500`,children:a.loadingLabel}):g.length===0?(0,A.jsx)(`div`,{className:`p-4 text-center text-xs text-gray-500`,children:a.emptyLabel}):(0,A.jsx)(`div`,{className:`py-1`,children:(()=>{let e=h??[{key:`all-skills`,options:g}],t=0;return e.map(e=>(0,A.jsxs)(`div`,{children:[e.label?(0,A.jsx)(`div`,{className:`px-4 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=f.has(e.key),i=n===u;return(0,A.jsxs)(`button`,{type:`button`,id:`${s}-option-${n}`,role:`option`,"aria-selected":r,"data-skill-index":n,onClick:()=>_(e.key),onMouseEnter:()=>d(n),className:`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors ${i?`bg-gray-50`:`hover:bg-gray-50`}`,children:[(0,A.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:(0,A.jsx)(zn,{className:`h-4 w-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`truncate text-sm text-gray-900`,children:e.label}),e.badgeLabel?(0,A.jsx)(`span`,{className:`shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:e.badgeLabel}):null]}),(0,A.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-gray-500`,children:e.description||e.key})]}),(0,A.jsx)(`div`,{className:`ml-3 shrink-0`,children:(0,A.jsx)(`span`,{className:r?`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:r?(0,A.jsx)(Se,{className:`h-3 w-3`}):null})})]},e.key)})]},e.key))})()})}),a.manageHref&&a.manageLabel?(0,A.jsx)(`div`,{className:`border-t border-gray-100 px-4 py-2.5`,children:(0,A.jsxs)(`a`,{href:a.manageHref,className:`inline-flex items-center gap-1.5 text-xs font-medium text-primary transition-colors hover:text-primary/80`,children:[a.manageLabel,(0,A.jsx)(ze,{className:`h-3 w-3`})]})}):null]})]})}function qi({icon:e}){return e===`sparkles`?(0,A.jsx)(Yt,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e===`brain`?(0,A.jsx)(pn,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}):null}function Ji({icon:e}){return e===`paperclip`?(0,A.jsx)(In,{className:`h-4 w-4`}):(0,A.jsx)(qi,{icon:e})}function Yi(e){return e===`model`?`min-w-[220px]`:e===`session-type`?`min-w-[140px]`:e===`thinking`?`min-w-[150px]`:``}function Xi(e){return e===`model`?`w-[320px]`:e===`session-type`?`w-[220px]`:e===`thinking`?`w-[180px]`:``}function Zi({item:e}){let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=Pi,l=e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[]),u=l.some(e=>e.options.length>0);return(0,A.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,A.jsx)(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-3 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 ${Yi(e.key)}`,children:e.selectedLabel?(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,A.jsx)(qi,{icon:e.icon}),(0,A.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-700`,children:e.selectedLabel})]}):e.loading?(0,A.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-gray-200`}):(0,A.jsx)(c,{placeholder:e.placeholder})}),(0,A.jsxs)(n,{className:Xi(e.key),children:[u?null:e.loading?(0,A.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,A.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-gray-200`}),(0,A.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,A.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-gray-200`})]}):e.emptyLabel?(0,A.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500`,children:e.emptyLabel}):null,l.map((e,t)=>(0,A.jsxs)(`div`,{children:[t>0?(0,A.jsx)(o,{}):null,(0,A.jsxs)(r,{children:[e.label?(0,A.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,A.jsx)(i,{value:e.value,className:`py-2`,children:e.description?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,A.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label}),(0,A.jsx)(`span`,{className:`truncate text-[11px] text-gray-500`,children:e.description})]}):(0,A.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label})},e.value))]})]},e.key))]})]})}function Qi(e){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=Pi;return(0,A.jsxs)(`div`,{className:`flex items-center justify-between px-3 pb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.skillPicker?(0,A.jsx)(Ki,{picker:e.skillPicker}):null,e.selects.map(e=>(0,A.jsx)(Zi,{item:e},e.key)),e.accessories?.map(e=>{let a=(0,A.jsxs)(`button`,{type:`button`,className:`inline-flex items-center rounded-lg py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:text-gray-400 ${e.iconOnly?`h-8 w-8 justify-center px-0`:`gap-1.5 px-3`}`,onClick:e.onClick,disabled:e.disabled,"aria-label":e.label,children:[(0,A.jsx)(Ji,{icon:e.icon}),e.iconOnly?null:(0,A.jsx)(`span`,{children:e.label})]});return e.tooltip?(0,A.jsx)(r,{children:(0,A.jsxs)(t,{children:[(0,A.jsx)(i,{asChild:!0,children:e.disabled?(0,A.jsx)(`span`,{className:`inline-flex`,children:a}):a}),(0,A.jsx)(n,{side:`top`,children:(0,A.jsx)(`p`,{className:`text-xs`,children:e.tooltip})})]})},e.key):(0,A.jsx)(`div`,{children:a},e.key)})]}),(0,A.jsx)(Wi,{...e.actions})]})}var $i=(0,k.createContext)(null);function ea(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function ta(){let e=(0,k.useContext)($i);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function N(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function na(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var ra=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,ia=ra&&`documentMode`in document?document.documentMode:null,aa=ra&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),oa=ra&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),sa=!(!ra||!(`InputEvent`in window)||ia)&&`getTargetRanges`in new window.InputEvent(`input`),ca=ra&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,la=ra&&/Android/.test(navigator.userAgent),ua=ra&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!la,da=ra&&/^(?=.*Chrome).*/i.test(navigator.userAgent),fa=ra&&la&&da,pa=ra&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&aa&&!da,ma=0,ha=1,ga=2,_a=1,va=2,ya=3,ba=4,xa=5,Sa=6,Ca=ua||ca||pa?`\xA0`:`​`,wa=`
2
+
3
+ `,Ta=oa?`\xA0`:Ca,Ea={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Da={directionless:1,unmergeable:2},Oa={center:2,end:6,justify:4,left:1,right:3,start:5},ka={[va]:`center`,[Sa]:`end`,[ba]:`justify`,[_a]:`left`,[ya]:`right`,[xa]:`start`},Aa={normal:0,segmented:2,token:1},ja={[ma]:`normal`,[ga]:`segmented`,[ha]:`token`},Ma=`$config`;function Na(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(z(o)&&Na(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var Pa=!1,Fa=0;function Ia(e){Fa=e.timeStamp}function La(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Nu(e,n)!==void 0}function Ra(e,t,n){let r=xd(pd(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&Ku(t,o,i,a,!1)}function za(e,t,n){if(I(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Su(t)&&n.isAttached()}function Ba(e,t,n,r){for(let i=e;i&&!Id(i);i=sd(i)){let e=Nu(i,t);if(e!==void 0){let t=ju(e,n);if(t)return B(t)||!Cd(i)?void 0:[i,t]}else if(i===r)return[r,Ru(n)]}}function Va(e,t,n){Pa=!0;let r=performance.now()-Fa>100;try{Rl(e,()=>{let i=L()||function(e){return e.getEditorState().read(()=>{let e=L();return e===null?null:e.clone()})}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=Ba(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&F(g)&&Su(p)&&za(i,p,g)&&Ra(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Mu(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!La(r,a,e)){if(oa){let e=(Cd(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(La(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||La(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&zu(i),oa&&ad(e)&&i.insertRawText(u))})}finally{Pa=!1}}function Ha(e){let t=e._observer;t!==null&&Va(e,t.takeRecords(),t)}function Ua(e){(function(e){Fa===0&&pd(e).addEventListener(`textInput`,Ia,!0)})(e),e._observer=new MutationObserver((t,n)=>{Va(e,t,n)})}var Wa=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Za).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Ga(e,t){return new Wa(e,t)}function Ka(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=Rd(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var qa=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState;this.size=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return Xa(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=Xa(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function Ja(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new qa(t,Ya(t));return t.__state=n,n}function Ya(e){return e.__state?e.__state.sharedNodeState:du(kd(),e.getType()).sharedNodeState}function Xa(e){if(e)for(let t in e)return e}function Za(e){return e}function Qa(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function $a(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function eo(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function to(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&Qa(n,e,t)||t&&Qa(n,t,e)||e&&$a(n,e,t)||t&&$a(n,t,e))}(c,l))}function no(e,t){let n=e.mergeWithSibling(t),r=R()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function ro(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&F(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(to(t,r)){r=no(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&F(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(to(r,n)){r=no(r,n);break}break}n.remove()}}else r.remove()}function io(e){return ao(e.anchor),ao(e.focus),e}function ao(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),F(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!z(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var oo,so,co,lo,uo,fo,po,mo,ho,go,_o=``,vo=null,yo=null,bo=!1,xo=!1;function So(e,t){let n=po.get(e);if(t!==null){let n=Bo(e);n.parentNode===t&&t.removeChild(n)}if(mo.has(e)||so._keyToDOMMap.delete(e),z(n)){let e=Po(n,po);Co(e,0,e.length-1,null)}n!==void 0&&nd(go,co,lo,n,`destroyed`)}function Co(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&So(t,r)}}function wo(e,t){e.setProperty(`text-align`,t)}var To=`40px`;function Eo(e,t){let n=oo.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty(`padding-inline-start`,``);let r=getComputedStyle(so._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||To;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function Do(e,t){let n=e.style;t===0?wo(n,``):t===1?wo(n,`left`):t===2?wo(n,`center`):t===3?wo(n,`right`):t===4?wo(n,`justify`):t===5?wo(n,`start`):t===6&&wo(n,`end`)}function Oo(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(Gl(e))return null;let n=e.getParentOrThrow();return Gl(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function ko(e,t){let n=mo.get(e);n===void 0&&N(60);let r=n.createDOM(oo,so);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,so),F(n)?r.setAttribute(`data-lexical-text`,`true`):B(n)&&r.setAttribute(`data-lexical-decorator`,`true`),z(n)){let e=n.__indent,t=n.__size;if(Oo(r,n),e!==0&&Eo(r,e),t!==0){let e=t-1;Ao(Po(n,mo),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&Do(r,i),n.isInline()||Mo(null,n,r)}else{let t=n.getTextContent();if(B(n)){let t=n.decorate(so,oo);t!==null&&Io(e,t),r.contentEditable=`false`}_o+=t}return t!==null&&t.insertChild(r),nd(go,co,lo,n,`created`),r}function Ao(e,t,n,r,i){let a=_o;_o=``;let o=n;for(;o<=r;++o){ko(e[o],i);let t=mo.get(e[o]);t!==null&&F(t)?vo===null&&(vo=t.getFormat(),yo=t.getStyle()):z(t)&&o<r&&!t.isInline()&&(_o+=wa)}i.element.__lexicalTextContent=_o,_o=a+_o}function jo(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return _c(e)?`line-break`:B(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function Mo(e,t,n){let r=jo(e,po),i=jo(t,mo);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function No(e,t,n){var r;vo=null,yo=null,function(e,t,n){let r=_o,i=e.__size,a=t.__size;_o=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)Fo(n,o);else{let e=Bo(n),t=ko(r,null);try{o.replaceChild(t,e)}catch(i){if(typeof i==`object`&&i){let a=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw Error(a)}throw i}So(n,null)}let i=mo.get(r);F(i)&&vo===null&&(vo=i.getFormat(),yo=i.getStyle())}else{let r=Po(e,po),s=Po(t,mo);if(r.length!==i&&N(227),s.length!==a&&N(228),i===0)a!==0&&Ao(s,0,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;Co(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else (function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f];if(e===r)u=Lo(Fo(r,a.element)),d++,f++;else{if(l===void 0&&(l=Ro(n,f)),c===void 0)c=Ro(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=Lo(Bo(e)),So(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=od(so,r);e!==u&&a.withBefore(u).insertChild(e),u=Lo(Fo(r,a.element)),d++,f++}else ko(r,a.withBefore(u)),f++}let i=mo.get(r);i!==null&&F(i)?vo===null&&(vo=i.getFormat(),yo=i.getStyle()):z(i)&&f<=s&&!i.isInline()&&(_o+=wa)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:so.getElementByKey(e);Ao(n,0,f,s,a.withBefore(t))}else m&&!p&&Co(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=_o,_o=r+_o}(e,t,t.getDOMSlot(n)),r=t,vo==null||vo===r.__textFormat||xo||r.setTextFormat(vo),function(e){yo==null||yo===e.__textStyle||xo||e.setTextStyle(yo)}(t)}function Po(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&N(101),n.push(r),r=e.__next}return n}function Fo(e,t){let n=po.get(e),r=mo.get(e);n!==void 0&&r!==void 0||N(61);let i=bo||fo.has(e)||uo.has(e),a=od(so,e);if(n===r&&!i){let e;if(z(n)){let t=a.__lexicalTextContent;typeof t==`string`?e=t:(e=n.getTextContent(),a.__lexicalTextContent=e)}else e=n.getTextContent();return _o+=e,a}if(n!==r&&i&&nd(go,co,lo,r,`updated`),r.updateDOM(n,a,oo)){let n=ko(e,null);return t===null&&N(62),t.replaceChild(n,a),So(e,null),n}if(z(n)){z(r)||N(334,e);let t=r.__indent;(bo||t!==n.__indent)&&Eo(a,t);let o=r.__format;if((bo||o!==n.__format)&&Do(a,o),i)No(n,r,a),Gl(r)||r.isInline()||Mo(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),_o+=t}if((bo||r.__dir!==n.__dir)&&(Oo(a,r),Gl(r)&&!bo))for(let e of r.getChildren())z(e)&&Oo(od(so,e.getKey()),e)}else{let t=r.getTextContent();if(B(r)){let t=r.decorate(so,oo);t!==null&&Io(e,t)}_o+=t}if(!xo&&Gl(r)&&r.__cachedText!==_o){let e=r.getWritable();e.__cachedText=_o,r=e}return a}function Io(e,t){let n=so._pendingDecorators,r=so._decorators;if(n===null){if(r[e]===t)return;n=Fu(so)}n[e]=t}function Lo(e){let t=e.nextSibling;return t!==null&&t===so._blockCursorElement&&(t=t.nextSibling),t}function Ro(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function zo(e,t,n,r,i,a){_o=``,bo=r===2,so=n,oo=n._config,co=n._nodes,lo=so._listeners.mutation,uo=i,fo=a,po=e._nodeMap,mo=t._nodeMap,xo=t._readOnly,ho=new Map(n._keyToDOMMap);let o=new Map;return go=o,Fo(`root`,null),so=void 0,co=void 0,uo=void 0,fo=void 0,po=void 0,mo=void 0,oo=void 0,ho=void 0,go=void 0,o}function Bo(e){let t=ho.get(e);return t===void 0&&N(75,e),t}function P(e){return{type:e}}var Vo=P(`SELECTION_CHANGE_COMMAND`),Ho=P(`CLICK_COMMAND`),Uo=P(`BEFORE_INPUT_COMMAND`),Wo=P(`INPUT_COMMAND`),Go=P(`COMPOSITION_START_COMMAND`),Ko=P(`COMPOSITION_END_COMMAND`),qo=P(`DELETE_CHARACTER_COMMAND`),Jo=P(`INSERT_LINE_BREAK_COMMAND`),Yo=P(`INSERT_PARAGRAPH_COMMAND`),Xo=P(`CONTROLLED_TEXT_INSERTION_COMMAND`),Zo=P(`PASTE_COMMAND`),Qo=P(`REMOVE_TEXT_COMMAND`),$o=P(`DELETE_WORD_COMMAND`),es=P(`DELETE_LINE_COMMAND`),ts=P(`FORMAT_TEXT_COMMAND`),ns=P(`UNDO_COMMAND`),rs=P(`REDO_COMMAND`),is=P(`KEYDOWN_COMMAND`),as=P(`KEY_ARROW_RIGHT_COMMAND`),os=P(`MOVE_TO_END`),ss=P(`KEY_ARROW_LEFT_COMMAND`),cs=P(`MOVE_TO_START`),ls=P(`KEY_ARROW_UP_COMMAND`),us=P(`KEY_ARROW_DOWN_COMMAND`),ds=P(`KEY_ENTER_COMMAND`),fs=P(`KEY_SPACE_COMMAND`),ps=P(`KEY_BACKSPACE_COMMAND`),ms=P(`KEY_ESCAPE_COMMAND`),hs=P(`KEY_DELETE_COMMAND`),gs=P(`KEY_TAB_COMMAND`),_s=P(`DROP_COMMAND`),vs=P(`DRAGSTART_COMMAND`),ys=P(`DRAGOVER_COMMAND`),bs=P(`DRAGEND_COMMAND`),xs=P(`COPY_COMMAND`),Ss=P(`CUT_COMMAND`),Cs=P(`SELECT_ALL_COMMAND`),ws=P(`FOCUS_COMMAND`),Ts=P(`BLUR_COMMAND`),Es=P(`KEY_MODIFIER_COMMAND`),Ds=Object.freeze({}),Os=[[`keydown`,function(e,t){ks=e.timeStamp,As=e.key,!t.isComposing()&&H(t,is,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;wd(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&Rl(t,()=>{mu(n)||(Is=!0)})}],[`compositionstart`,function(e,t){H(t,Go,e)}],[`compositionend`,function(e,t){oa?Rs=!0:ca||!ua&&!pa?H(t,Ko,e):(zs=!0,Bs=e.data)}],[`input`,function(e,t){e.stopPropagation(),Rl(t,()=>{t.dispatchCommand(Wo,e)},{event:e}),Ms=null}],[`click`,function(e,t){Rl(t,()=>{let n=L(),r=xd(pd(t)),i=al();if(r){if(I(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!Gl(a)&&Lu().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&a!==n.focus.getNode()){let e=Bd(a,e=>z(e)&&!e.isInline());z(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(Cd(n)||Su(n))&&zu(il(i,r,t,e))}}H(t,Ho,e)})}],[`cut`,Ds],[`copy`,Ds],[`dragstart`,Ds],[`dragover`,Ds],[`dragend`,Ds],[`paste`,Ds],[`focus`,Ds],[`blur`,Ds],[`drop`,Ds]];sa&&Os.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||oa&&ad(t)||n!==`insertCompositionText`&&H(t,Uo,e)}(e,t)]);var ks=0,As=null,js=0,Ms=null,Ns=new WeakMap,Ps=new WeakMap,Fs=!1,Is=!1,Ls=!1,Rs=!1,zs=!1,Bs=``,Vs=null,Hs=[0,``,0,`root`,0];function Us(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=R(),l=xd(pd(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!F(s)||(!i&&(!sa||js<r+50)||s.isDirty()&&p<2||Vu(n))&&a.offset!==o.offset&&!s.isComposing()||xu(s)||s.isDirty()&&p>1||(i||!sa)&&f!==null&&!s.isComposing()&&u!==wu(f)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=bu(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(F(t)||z(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function Ws(e,t){return Su(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Gs(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;Fs&&(Fs=!1,Ws(r,i)&&Ws(a,o)&&!Vs)||Rl(t,()=>{if(!n)return void zu(null);if(!gu(t,r,a))return;let s=L();if(Vs&&I(s)&&s.isCollapsed()){let e=s.anchor,t=Vs.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=Vs.clone(),zu(s))}if(Vs=null,I(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=pd(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=Hs,f=Lu(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)Ks(s,o,c);else if(n.type===`text`)F(r)||N(141),qs(s,r);else if(n.type===`element`&&!p){z(r)||N(259);let e=n.getNode();e.isEmpty()?function(e,t){Ks(e,t.getTextFormat(),t.getTextStyle())}(s,e):Ks(s,s.format,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(F(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}H(t,Vo,void 0)})}function Ks(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function qs(e,t){Ks(e,t.getFormat(),t.getStyle())}function Js(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Ys(e){let t=e.inputType,n=Js(e),r=R(),i=L();if(t===`deleteContentBackward`){if(i===null){let e=al();if(!I(e))return!0;zu(e.clone())}if(I(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,As===`MediaLast`&&a<ks+30&&r.isComposing()&&t){if(ku(null),ks=0,setTimeout(()=>{Rl(r,()=>{ku(null)})},30),I(i)){let e=i.anchor.getNode();e.markDirty(),F(e)||N(142),qs(i,e)}}else{ku(null),e.preventDefault();let n=i.anchor.getNode(),a=n.getTextContent(),o=n.canInsertTextAfter(),s=i.anchor.offset===0&&i.focus.offset===a.length,c=fa&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!B(id(i.anchor,!0))),!c){H(r,qo,!0);let e=L();fa&&I(e)&&e.isCollapsed()&&(Vs=e,setTimeout(()=>Vs=null))}}return!0}}var a;if(!I(i))return!0;let o=e.data;Ms!==null&&Gu(!1,r,Ms),i.dirty&&Ms===null||!i.isCollapsed()||Gl(i.anchor.getNode())||n===null||i.applyDOMRange(n),Ms=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
4
+ `)e.preventDefault(),H(r,Jo,!1);else if(o===wa)e.preventDefault(),H(r,Yo,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&Us(i,n,o,e.timeStamp,!0)?(e.preventDefault(),H(r,Xo,o)):Ms=o;return js=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:H(r,Xo,e);break;case`insertFromComposition`:ku(null),H(r,Xo,e);break;case`insertLineBreak`:ku(null),H(r,Jo,!1);break;case`insertParagraph`:ku(null),Ls&&!ca?(Ls=!1,H(r,Jo,!1)):H(r,Yo,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:H(r,Zo,e);break;case`deleteByComposition`:(function(e,t){return e!==t||z(e)||z(t)||!bu(e)||!bu(t)})(l,u)&&H(r,Qo,e);break;case`deleteByDrag`:case`deleteByCut`:H(r,Qo,e);break;case`deleteContent`:H(r,qo,!1);break;case`deleteWordBackward`:H(r,$o,!0);break;case`deleteWordForward`:H(r,$o,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:H(r,es,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:H(r,es,!1);break;case`formatStrikeThrough`:H(r,ts,`strikethrough`);break;case`formatBold`:H(r,ts,`bold`);break;case`formatItalic`:H(r,ts,`italic`);break;case`formatUnderline`:H(r,ts,`underline`);break;case`historyUndo`:H(r,ns,void 0);break;case`historyRedo`:H(r,rs,void 0)}return!0}function Xs(e){if(Cd(e.target)&&mu(e.target))return!0;let t=R(),n=L(),r=e.data,i=Js(e);if(r!=null&&I(n)&&Us(n,i,r,e.timeStamp,!1)){Rs&&=($s(t,r),!1);let i=n.anchor.getNode(),a=xd(pd(t));if(a===null)return!0;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;sa&&!n.isCollapsed()&&F(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===Wu(a.anchorNode)||H(t,Xo,r);let l=r.length;oa&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),fa&&t.isComposing()&&(ks=0,ku(null))}else Gu(!1,t,r===null?void 0:r),Rs&&=($s(t,r||void 0),!1);return function(){Cl(),Ha(R())}(),!0}function Zs(e){let t=R(),n=L();if(I(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();ku(r.key),ld(fc),(e.timeStamp<ks+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||F(i)&&i.getStyle()!==n.style)&&H(t,Xo,Ta)}return!0}function Qs(e){return $s(R(),e.data),ld(pc),!0}function $s(e,t){let n=e._compositionKey;if(ku(null),n!==null&&t!=null){if(t===``){let t=ju(n),r=wu(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&F(t)){let n=xd(pd(e)),i=null,a=null;n!==null&&n.anchorNode===r&&(i=n.anchorOffset,a=n.focusOffset),Ku(t,r.nodeValue,i,a,!0)}return}if(t[t.length-1]===`
5
+ `){let t=L();if(I(t)||Gc(t)){if(I(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}H(e,ds,null);return}}}Gu(!0,e,t)}function ec(e){let t=R();if(e.key==null)return!0;if(zs){if(Qu(e))return Rl(t,()=>{$s(t,Bs)}),zs=!1,Bs=``,!0;zs=!1,Bs=``}if(function(e){return V(e,`ArrowRight`,{shiftKey:`any`})}(e))H(t,as,e);else if(function(e){return V(e,`ArrowRight`,Xu)}(e))H(t,os,e);else if(function(e){return V(e,`ArrowLeft`,{shiftKey:`any`})}(e))H(t,ss,e);else if(function(e){return V(e,`ArrowLeft`,Xu)}(e))H(t,cs,e);else if(function(e){return V(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))H(t,ls,e);else if(function(e){return V(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))H(t,us,e);else if(function(e){return V(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))Ls=!0,H(t,ds,e);else if(function(e){return e.key===` `}(e))H(t,fs,e);else if(function(e){return aa&&V(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),Ls=!0,H(t,Jo,!0);else if(function(e){return V(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))Ls=!1,H(t,ds,e);else if(function(e){return V(e,`Backspace`,{shiftKey:`any`})||aa&&V(e,`h`,{ctrlKey:!0})}(e))Qu(e)?H(t,ps,e):(e.preventDefault(),H(t,qo,!0));else if(function(e){return e.key===`Escape`}(e))H(t,ms,e);else if(function(e){return V(e,`Delete`,{})||aa&&V(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?H(t,hs,e):(e.preventDefault(),H(t,qo,!1));else if(function(e){return V(e,`Backspace`,Zu)}(e))e.preventDefault(),H(t,$o,!0);else if(function(e){return V(e,`Delete`,Zu)}(e))e.preventDefault(),H(t,$o,!1);else if(function(e){return aa&&V(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),H(t,es,!0);else if(function(e){return aa&&(V(e,`Delete`,{metaKey:!0})||V(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),H(t,es,!1);else if(function(e){return V(e,`b`,Xu)}(e))e.preventDefault(),H(t,ts,`bold`);else if(function(e){return V(e,`u`,Xu)}(e))e.preventDefault(),H(t,ts,`underline`);else if(function(e){return V(e,`i`,Xu)}(e))e.preventDefault(),H(t,ts,`italic`);else if(function(e){return V(e,`Tab`,{shiftKey:`any`})}(e))H(t,gs,e);else if(function(e){return V(e,`z`,Xu)}(e))e.preventDefault(),H(t,ns,void 0);else if(function(e){return aa?V(e,`z`,{metaKey:!0,shiftKey:!0}):V(e,`y`,{ctrlKey:!0})||V(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),H(t,rs,void 0);else{let n=t._editorState._selection;n===null||I(n)?$u(e)&&(e.preventDefault(),H(t,Cs,e)):function(e){return V(e,`c`,Xu)}(e)?(e.preventDefault(),H(t,xs,e)):function(e){return V(e,`x`,Xu)}(e)?(e.preventDefault(),H(t,Ss,e)):$u(e)&&(e.preventDefault(),H(t,Cs,e))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Es,e),!0}function tc(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var nc=new Map;function rc(e){let t=Sd(e.target);if(t===null)return;let n=vu(t.anchorNode);if(n===null)return;Is&&(Is=!1,Rl(n,()=>{let r=al(),i=t.anchorNode;(Cd(i)||Su(i))&&zu(il(r,t,n,e))}));let r=Hu(n),i=r[r.length-1],a=i._key,o=nc.get(a),s=o||i;s!==n&&Gs(t,s,!1),Gs(t,n,!0),n===i?o&&nc.delete(a):nc.set(a,n)}function ic(e){e._lexicalHandled=!0}function ac(e){return!0===e._lexicalHandled}function oc(e){let t=Ns.get(e);if(t===void 0)return;let n=Ps.get(t);if(n===void 0)return;let r=n-1;r>=0||N(164),Ns.delete(e),Ps.set(t,r),r===0&&t.removeEventListener(`selectionchange`,rc);let i=yu(e);_u(i)?(function(e){if(e._parentEditor!==null){let t=Hu(e),n=t[t.length-1]._key;nc.get(n)===e&&nc.delete(n)}else nc.delete(e._key)}(i),e.__lexicalEditor=null):i&&N(198);let a=tc(e);for(let e=0;e<a.length;e++)a[e]();e.__lexicalEventHandles=[]}function sc(e,t,n){Cl();let r=e.__key,i=e.getParent();if(i===null)return;let a=function(e){let t=L();if(!I(t)||!z(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return dd(i,e)&&n.set(e.__key,0,`element`),dd(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(I(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(cl(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(cl(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else Gc(a)&&t&&e.isSelected()&&e.selectPrevious();if(I(a)&&t&&!o){let t=e.getIndexWithinParent();Du(e),ol(a,i,t,-1)}else Du(e);n||hd(i)||i.canBeEmpty()||!i.isEmpty()||sc(i,t),t&&a&&Gl(i)&&i.isEmpty()&&i.selectEnd()}var cc=Symbol.for(`ephemeral`);function lc(e){return e[cc]||!1}var uc=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:e}=Rd(this);return e===void 0&&N(64,this.name),e}static clone(e){N(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,`__state`,{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Eu(this,e)}getType(){return this.__type}isInline(){N(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=ju(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){let t=e||L();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(F(this))return n;if(I(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(B(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:ju(e)}getParentOrThrow(){let e=this.getParent();return e===null&&N(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(hd(t))return z(e)||e===this&&B(e)||N(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&N(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:ju(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:ju(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=z(this)?this:this.getParent(),n=z(e)?e:e.getParent(),r=t&&n?yf(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=yf(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?gf(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&N(279),!1)))}isParentOf(e){let t=yf(this,e);return t!==null&&t.type===`ancestor`}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=z(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&N(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=R()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(lc(this))return this;let e=ju(this.__key);return e===null&&N(113),e}getWritable(){if(lc(this))return this;Cl();let e=Tl(),t=R(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=L();if(o!==null&&o.setCachedNodes(null),a.has(r))return Ou(i),i;let s=Nd(i);return a.add(r),Ou(s),n.set(r,s),s}getTextContent(){return``}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){N(70)}updateDOM(e,t,n){N(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){N(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of Ya(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&Ja(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){sc(this,!0,e)}replace(e,t){Cl();let n=L();n!==null&&(n=n.clone()),_d(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size;Du(o);let l=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,f=r.__next,p=r.__parent;if(sc(r,!1,!0),l===null?s.__first=a:l.getWritable().__next=a,o.__prev=d,u===null?s.__last=a:u.getWritable().__prev=a,o.__next=f,o.__parent=p,s.__size=c,t&&(z(this)&&z(o)||N(139),this.getChildren().forEach(e=>{o.append(e)})),I(n)){zu(n);let e=n.anchor,t=n.focus;e.key===i&&Hc(e,o),t.key===i&&Hc(t,o)}return Au()===i&&ku(a),o}insertAfter(e,t=!0){Cl(),_d(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),a=L(),o=!1,s=!1;if(i!==null){let t=e.getIndexWithinParent();if(Du(r),I(a)){let e=i.__key,n=a.anchor,r=a.focus;o=n.type===`element`&&n.key===e&&n.offset===t+1,s=r.type===`element`&&r.key===e&&r.offset===t+1}}let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&I(a)){let e=this.getIndexWithinParent();ol(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){Cl(),_d(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key;Du(r);let a=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),s=n.__prev,c=this.getIndexWithinParent();a===null?o.__first=i:a.getWritable().__next=i,o.__size++,n.__prev=i,r.__prev=s,r.__next=n.__key,r.__parent=n.__parent;let l=L();return t&&I(l)&&ol(l,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return eu()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Cl();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(z(n))return n.select();if(!F(n)){let e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){Cl();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(z(n))return n.select(0,0);if(!F(n)){let e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}},dc=`history-merge`,fc=`composition-start`,pc=`composition-end`,mc=class e extends uc{static getType(){return`linebreak`}static clone(t){return new e(t.__key)}constructor(e){super(e)}getTextContent(){return`
6
+ `}createDOM(){return document.createElement(`br`)}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){let t=e.parentElement;if(t!==null&&Dd(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&vc(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&vc(n))return!0}}return!1}(e)||function(e){let t=e.parentElement;if(t!==null&&Dd(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&vc(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&vc(r))return!0}return!1}(e)?null:{conversion:hc,priority:0}}}static importJSON(e){return gc().updateFromJSON(e)}};function hc(e){return{node:gc()}}function gc(){return gd(new mc)}function _c(e){return e instanceof mc}function vc(e){return Su(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}function yc(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function bc(e,t){return 1&t?`strong`:2&t?`em`:`span`}function xc(e,t,n,r,i){let a=r.classList,o=td(i,`base`);o!==void 0&&a.add(...o),o=td(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in Ea){let r=Ea[e];if(o=td(i,e),o!==void 0)if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}function Sc(e,t,n){let r=t.firstChild,i=n.isComposing(),a=e+(i?Ca:``);if(r==null)t.textContent=a;else{let e=r.nodeValue;if(e!==a)if(i||oa){let[t,n,i]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(e,a);n!==0&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=a}}function Cc(e,t,n,r,i,a){Sc(i,e,t);let o=a.theme.text;o!==void 0&&xc(0,0,r,e,o)}function wc(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Tc=class e extends uc{__text;__format;__style;__mode;__detail;static getType(){return`text`}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return ja[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Au()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=Ea[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Tu(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=yc(0,n),i=bc(0,n),a=r===null?i:r,o=document.createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=document.createElement(i),o.appendChild(s)),Cc(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&(o.style.cssText=c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=yc(0,i),s=yc(0,a),c=bc(0,i),l=bc(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??N(48);let i=document.createElement(l);return Cc(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??N(49)),Sc(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&xc(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Ac,priority:0}),b:()=>({conversion:Dc,priority:0}),code:()=>({conversion:Nc,priority:0}),em:()=>({conversion:Nc,priority:0}),i:()=>({conversion:Nc,priority:0}),mark:()=>({conversion:Nc,priority:0}),s:()=>({conversion:Nc,priority:0}),span:()=>({conversion:Ec,priority:0}),strong:()=>({conversion:Nc,priority:0}),sub:()=>({conversion:Nc,priority:0}),sup:()=>({conversion:Nc,priority:0}),u:()=>({conversion:Nc,priority:0})}}static importJSON(e){return Pc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Cd(t)||N(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=wc(t,`b`)),this.hasFormat(`italic`)&&(t=wc(t,`i`)),this.hasFormat(`strikethrough`)&&(t=wc(t,`s`)),this.hasFormat(`underline`)&&(t=wc(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?Ea[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Da[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=Tu(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=Aa[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Cl();let n=e,r=t,i=L(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!I(i))return tl(o,n,o,r,`text`,`text`);{let e=Au();e!==i.anchor.key&&e!==i.focus.key||ku(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=L();if(r&&I(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Cl();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Au(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=L();if(I(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=Pc(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=eo(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=Pc(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=eo(t,n);let a=n.__key;i===r&&ku(a),y.push(n)}let b=g?g.offset:null,x=_?_.offset:null,S=0;for(let e of y){if(!g&&!_)break;let t=S+e.getTextContentSize();if(g!==null&&b!==null&&b<=t&&b>=S&&(g.set(e.getKey(),b-S,`text`),b<t&&(g=null)),_!==null&&x!==null&&x<=t&&x>=S){_.set(e.getKey(),x-S,`text`);break}S=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&Ou(t),n!==null&&Ou(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),I(v)&&ol(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||N(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Au()===r&&ku(n);let o=L();if(I(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&ll(i,t,n,e,a),s!==null&&s.key===r&&ll(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function Ec(e){return{forChild:Fc(e.style),node:null}}function Dc(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Fc(t.style,n?void 0:`bold`),node:null}}var Oc=new WeakMap;function kc(e){if(!Cd(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function Ac(e){let t=e;e.parentElement===null&&N(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=Oc.get(n))===void 0&&!kc(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)Oc.set(r[e],i);return i}(t)!==null){let e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){let r=e[n];r===`
7
+ `||r===`\r
8
+ `?t.push(gc()):r===` `?t.push(Lc()):r!==``&&t.push(Pc(r))}return{node:t}}if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=jc(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=jc(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:Pc(n)}}function jc(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,Cd(n)){let e=n.style.display;if(e===``&&!Ed(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Su(n))return n;if(n.nodeName===`BR`)return null}}var Mc={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function Nc(e){let t=Mc[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Fc(e.style,t),node:null}}function Pc(e=``){return gd(new Tc(e))}function F(e){return e instanceof Tc}function Fc(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>F(e)?(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}var Ic=class e extends Tc{static getType(){return`tab`}static clone(t){return new e(t.__key)}constructor(e){super(` `,e),this.__detail=2}static importDOM(){return null}createDOM(e){let t=super.createDOM(e),n=td(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}static importJSON(e){return Lc().updateFromJSON(e)}setTextContent(e){return e!==` `&&e!==``&&na(126),super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||N(286),this}setDetail(e){return e!==2&&N(127),this}setMode(e){return e!==`normal`&&N(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Lc(){return gd(new Ic)}function Rc(e){return e instanceof Ic}var zc=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:hf(kf(bf(this,`next`)),kf(bf(e,`next`)))<0}getNode(){let e=ju(this.key);return e===null&&N(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,Sl()||(Au()===a&&ku(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function Bc(e,t,n){return new zc(e,t,n)}function Vc(e,t){let n=t.__key,r=e.offset,i=`element`;if(F(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!z(t)){let e=t.getNextSibling();if(F(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Hc(e,t){if(z(t)){let n=t.getLastDescendant();z(n)||F(n)?Vc(e,n):Vc(e,t)}else Vc(e,t)}var Uc=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Gc(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes(),n=t.length,r=t[n-1],i;if(F(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=ju(e);t!==null&&n.push(t)}return Sl()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes();if((L()||al())===this&&e[0]){let t=tf(e[0],`next`);Sf(pf(t,t))}for(let t of e)t.remove()}};function I(e){return e instanceof Wc}var Wc=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!I(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,a=new Set;for(let n of e)if(Zd(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;z(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Xd(e.focus)&&z(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=of(e.focus.origin,`previous`);Zd(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=cf(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!z(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=kf(e.anchor),r=kf(e.anchor.getFlipped()),i=e=>Yd(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(Mf(wf(this),`next`));return Sl()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`)}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=qc(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(z(d)&&!d.isInline())l||(c+=`
9
+ `),l=!d.isEmpty();else if(l=!1,F(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else !B(d)&&!_c(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=R(),n=t.getEditorState()._selection,r=el(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),io(this)}clone(){let t=this.anchor,n=this.focus;return new e(Bc(t.key,t.offset,t.type),Bc(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=Tu(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=Ea[e];return(this.format&t)!==0}insertRawText(e){let t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e];r===`
10
+ `||r===`\r
11
+ `?n.push(gc()):r===` `?n.push(Lc()):n.push(Pc(r))}this.insertNodes(n)}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,a=t,o=n;!this.isCollapsed()&&n.isBefore(t)&&(a=n,o=t),a.type===`element`&&function(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=Pc();if(o.setFormat(n),o.setStyle(r),tu(a))a.splice(0,0,[o]);else{let e=Gl(i)?eu().append(o):o;a===null?i.append(e):a.insertBefore(e)}e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}(a,o,r,i),o.type===`element`&&xf(o,kf(bf(o,`next`)));let s=a.offset,c=o.offset,l=this.getNodes(),u=l.length,d=l[0];F(d)||N(26);let f=d.getTextContent().length,p=d.getParentOrThrow(),m=l[u-1];if(u===1&&o.type===`element`&&(c=f,o.set(a.key,c,`text`)),this.isCollapsed()&&s===f&&(xu(d)||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let t=d.getNextSibling();if(F(t)&&t.canInsertTextBefore()&&!xu(t)||(t=Pc(),t.setFormat(r),t.setStyle(i),p.canInsertTextAfter()?d.insertAfter(t):p.insertAfter(t)),t.select(0,0),d=t,e!==``)return void this.insertText(e)}else if(this.isCollapsed()&&s===0&&(xu(d)||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let t=d.getPreviousSibling();if(F(t)&&!xu(t)||(t=Pc(),t.setFormat(r),p.canInsertTextBefore()?d.insertBefore(t):p.insertBefore(t)),t.select(),d=t,e!==``)return void this.insertText(e)}else if(d.isSegmented()&&s!==f){let e=Pc(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&e!==``){let t=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||z(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(``),$c(this.anchor,this.focus),void this.insertText(e)}if(u===1){if(bu(d)){let t=Pc(e);t.select(),d.replace(t);return}let t=d.getFormat(),n=d.getStyle();if(s!==c||t===r&&n===i){if(Rc(d)){let t=Pc(e);t.setFormat(r),t.setStyle(i),t.select(),d.replace(t);return}}else{if(d.getTextContent()!==``){let t=Pc(e);if(t.setFormat(r),t.setStyle(i),t.select(),s===0)d.insertBefore(t,!1);else{let[e]=d.splitText(s);e.insertAfter(t,!1)}t.isComposing()&&this.anchor.type===`text`&&(this.anchor.offset-=e.length);return}d.setFormat(r),d.setStyle(i)}let a=c-s;d=d.spliceText(s,a,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length))}else{let t=new Set([...d.getParentKeys(),...m.getParentKeys()]),n=z(d)?d:d.getParentOrThrow(),r=z(m)?m:m.getParentOrThrow(),i=m;if(!n.is(r)&&r.isInline())do i=r,r=r.getParentOrThrow();while(r.isInline());if(o.type===`text`&&(c!==0||m.getTextContent()===``)||o.type===`element`&&m.getIndexWithinParent()<c)if(F(m)&&!bu(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let e=Pc(m.getTextContent());m.replace(e),m=e}Gl(o.getNode())||o.type!==`text`||(m=m.spliceText(0,c,``)),t.add(m.__key)}else{let e=m.getParentOrThrow();e.canBeEmpty()||e.getChildrenSize()!==1?m.remove():e.remove()}else t.add(m.__key);let a=r.getChildren(),p=new Set(l),h=n.is(r),g=n.isInline()&&d.getNextSibling()===null?n:d;for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.is(d)||z(t)&&t.isParentOf(d))break;t.isAttached()&&(!p.has(t)||t.is(i)?h||g.insertAfter(t,!1):t.remove())}if(!h){let e=r,n=null;for(;e!==null;){let r=e.getChildren(),i=r.length;(i===0||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(bu(d))if(s===f)d.select();else{let t=Pc(e);t.select(),d.replace(t)}else d=d.spliceText(s,f-s,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<u;e++){let n=l[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){let e=L()===this;Cf(this,Of(wf(this))),e&&L()!==this&&zu(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void ku(null);let n=this.getNodes(),r=[];for(let e of n)F(e)&&r.push(e);let i=t=>{n.forEach(n=>{if(z(n)){let r=n.getFormatFlags(e,t);n.setTextFormat(r)}})},a=r.length;if(a===0)return this.toggleFormat(e),ku(null),void i(t);let o=this.anchor,s=this.focus,c=this.isBackward(),l=c?s:o,u=c?o:s,d=0,f=r[0],p=l.type===`element`?0:l.offset;if(l.type===`text`&&p===f.getTextContentSize()&&(d=1,f=r[1],p=0),f==null)return;let m=f.getFormatFlags(e,t);i(m);let h=a-1,g=r[h],_=u.type===`text`?u.offset:g.getTextContentSize();if(f.is(g)){if(p===_)return;if(xu(f)||p===0&&_===f.getTextContentSize())f.setFormat(m);else{let e=f.splitText(p,_),t=p===0?e[0]:e[1];t.setFormat(m),l.type===`text`&&l.set(t.__key,0,`text`),u.type===`text`&&u.set(t.__key,_-p,`text`)}this.format=m;return}p===0||xu(f)||([,f]=f.splitText(p),p=0),f.setFormat(m);let v=g.getFormatFlags(e,m);_>0&&(_===g.getTextContentSize()||xu(g)||([g]=g.splitText(_)),g.setFormat(v));for(let t=d+1;t<h;t++){let n=r[t],i=n.getFormatFlags(e,v);n.setFormat(i)}l.type===`text`&&l.set(f.__key,p,`text`),u.type===`text`&&u.set(g.__key,_,`text`),this.format=m|v}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key===`root`){this.insertParagraph();let t=L();return I(t)||N(134),t.insertNodes(e)}let t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Bd(t,Od),r=e[e.length-1];if(z(n)&&`__language`in n){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=pl(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some(e=>(z(e)||B(e))&&!e.isInline())){z(n)||N(211,t.constructor.name,t.getType());let i=pl(this);n.splice(i,0,e),r.selectEnd();return}let i=function(e){let t=eu(),n=null;for(let r=0;r<e.length;r++){let i=e[r],a=_c(i);if(a||B(i)&&i.isInline()||z(i)&&i.isInline()||F(i)||i.isParentRequired()){if(n===null&&(n=i.createParentElementNode(),t.append(n),a))continue;n!==null&&n.append(i)}else t.append(i),n=null}return t}(e),a=i.getLastDescendant(),o=i.getChildren(),s=!z(n)||!n.isEmpty()?this.insertParagraph():null,c=o[o.length-1],l=o[0];var u;z(u=l)&&Od(u)&&!u.isEmpty()&&z(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(z(n)||N(211,t.constructor.name,t.getType()),n.append(...l.getChildren()),l=o[1]),l&&(n===null&&N(212,t.constructor.name,t.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||N(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(n,l));let d=Bd(a,Od);s&&z(d)&&(s.canMergeWhenEmpty()||Od(c))&&(d.append(...s.getChildren()),s.remove()),z(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let f=z(n)?n.getLastChild():null;_c(f)&&d!==n&&f.remove()}insertParagraph(){if(this.anchor.key===`root`){let e=eu();return Lu().splice(this.anchor.offset,0,[e]),e.select(),e}let e=pl(this),t=Bd(this.anchor.getNode(),Od);z(t)||N(213);let n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let t=gc();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=qc(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(F(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(F(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),F(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(hl(this,e,t,n))return;let r=e===`move`,i=R(),a=xd(pd(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();if(s===null||o===null||!z(c)||c.isInline()||c.canBeEmpty()||bd(o,i,s),this.dirty){let e=od(i,this.anchor.key),t=od(i,this.focus.key);this.anchor.type===`text`&&(e=wu(e)),this.focus.type===`text`&&(t=wu(t)),e&&t&&ul(a,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=a.getRangeAt(0),n=this.anchor.getNode(),i=Gl(n)?n:md(n);if(this.applyDOMRange(e),this.dirty=!0,!r){let n=this.getNodes(),r=[],o=!1;for(let e=0;e<n.length;e++){let t=n[e];dd(t,i)?r.push(t):o=!0}if(o&&r.length>0)if(t){let e=r[0];z(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{let e=r[r.length-1];z(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}a.anchorNode===e.startContainer&&a.anchorOffset===e.startOffset||function(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}(this)}}n===`lineboundary`&&hl(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&z(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(z(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=df(bf(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(Zd(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(z(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=kf(t);Cf(this,pf(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(Xd(t)){if(z(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(B(t.origin)){if(!t.origin.isIsolated())if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&z(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=rl();e.add(t.origin.getKey()),zu(e)}else t.origin.remove();return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return Cf(this,pf(!t.origin.isEmpty()&&n.isEmpty()?Tf(tf(n,t.direction)):r.anchor,t)),this.removeText()}}let i=this.focus;if(this.modify(`extend`,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&Jc(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void Xc(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void Xc(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(Vu(e)||Yc(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&Gl(e.getParent())&&e.getPreviousSibling()===null&&Jc(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify(`extend`,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify(`extend`,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Gc(e){return e instanceof Uc}function Kc(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function qc(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[Kc(n),Kc(r)]}function Jc(e,t){for(let n=t;n;n=n.getParent()){if(z(n)){if(n.collapseAtStart(e))return!0;if(hd(n))break}if(n.getPreviousSibling())break}return!1}var Yc=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function Xc(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function Zc(e,t,n,r){let i,a=t;if(Cd(e)){let o=!1,s=e.childNodes,c=s.length,l=r._blockCursorElement;a===c&&(o=!0,a=c-1);let u=s[a],d=!1;if(u===l)u=s[a+1],d=!0;else if(l!==null){let n=l.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,l)&&a--}if(i=Bu(u),F(i))a=rf(i,o?`next`:`previous`);else{let s=Bu(e);if(s===null)return null;if(z(s)){let c=r.getElementByKey(s.getKey());c===null&&N(214);let l=s.getDOMSlot(c);[s,a]=l.resolveChildIndex(s,c,e,t),z(s)||N(215),o&&a>=s.getChildrenSize()&&(a=Math.max(0,s.getChildrenSize()-1));let u=s.getChildAtIndex(a);if(z(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=o?u.getLastDescendant():u.getFirstDescendant();e===null?s=u:(u=e,s=z(u)?u:u.getParentOrThrow()),a=0}F(u)?(i=u,s=null,a=rf(u,o?`next`:`previous`)):u!==s&&o&&!d&&(z(s)||N(216),a=Math.min(s.getChildrenSize(),a+1))}else{let n=s.getIndexWithinParent();a=t===0&&B(s)&&Bu(e)===s?n:n+1,s=s.getParentOrThrow()}if(z(s))return Bc(s.__key,a,`element`)}}else i=Bu(e);return F(i)?Bc(i.__key,rf(i,a,`clamp`),`text`):null}function Qc(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&z(a)&&a.isInline()){let t=a.getPreviousSibling();F(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else z(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):F(r)&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&z(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&z(a)&&a.isInline()&&!a.canInsertTextAfter()){let t=a.getNextSibling();F(t)&&e.set(t.__key,0,`text`)}}}function $c(e,t,n){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);Qc(e,n,r),Qc(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function el(e,t,n,r,i,a){if(e===null||n===null||!gu(i,e,n))return null;let o=Zc(e,t,I(a)?a.anchor:null,i);if(o===null)return null;let s=Zc(n,r,I(a)?a.focus:null,i);if(s===null)return null;if(o.type===`element`&&s.type===`element`){let t=Bu(e),r=Bu(n);if(B(t)&&B(r))return null}return $c(o,s),[o,s]}function tl(e,t,n,r,i,a){let o=Tl(),s=new Wc(Bc(e,t,i),Bc(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function nl(){return new Wc(Bc(`root`,0,`element`),Bc(`root`,0,`element`),0,``)}function rl(){return new Uc(new Set)}function il(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!Pa&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(I(e)&&!c)return e.clone();if(t===null)return null;if(l=t.anchorNode,u=t.focusNode,d=t.anchorOffset,f=t.focusOffset,(s||o===void 0)&&I(e)&&!gu(n,l,u))return e.clone();let p=el(l,d,u,f,n,e);if(p===null)return null;let[m,h]=p,g=0,_=``;if(I(e)){let t=e.anchor;if(m.key===t.key)g=e.format,_=e.style;else{let e=m.getNode();F(e)?(g=e.getFormat(),_=e.getStyle()):z(e)&&(g=e.getTextFormat(),_=e.getTextStyle())}}return new Wc(m,h,g,_)}function L(){return Tl()._selection}function al(){return R()._editorState._selection}function ol(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),sl(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}sl(e)}function sl(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!z(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(F(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}return}if(z(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(F(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(z(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(F(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}function cl(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,F(i)?s=`text`:z(i)&&(s=`element`)):(a=r.__key,F(r)?(o=r.getTextContentSize(),s=`text`):z(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function ll(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function ul(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function dl(e,t,n){let r=od(e,t.getKey());if(z(t)){let e=t.getDOMSlot(r);return[e.element,n+e.getFirstChildOffset()]}return[r,n]}function fl(e,t,n,r,i,a,o){let s=r.anchorNode,c=r.focusNode,l=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(i.has(`collaboration`)&&d!==a||d!==null&&hu(d))return;if(!I(t))return void(e!==null&&gu(n,s,c)&&r.removeAllRanges());let f=t.anchor,p=t.focus,m=f.getNode(),h=p.getNode(),[g,_]=dl(n,m,f.offset),[v,y]=dl(n,h,p.offset),b=t.format,x=t.style,S=t.isCollapsed(),C=g,w=v,T=!1;var E,ee,te,ne,re;if((f.type===`text`?(C=wu(g),T=m.getFormat()!==b||m.getStyle()!==x):I(e)&&e.anchor.type===`text`&&(T=!0),p.type===`text`&&(w=wu(v)),C!==null&&w!==null)&&(S&&(e===null||T||I(e)&&(e.format!==b||e.style!==x))&&(E=b,ee=x,te=_,ne=f.key,re=performance.now(),Hs=[E,ee,te,ne,re]),l!==_||u!==y||s!==C||c!==w||r.type===`Range`&&S||(d!==null&&a.contains(d)||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0}),f.type===`element`))){if(ul(r,C,_,w,y),!oa||!t.isCollapsed()||a===null||i.has(`skip-selection-focus`)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let e=I(t)&&t.anchor.type===`element`?C.childNodes[_]||null:r.rangeCount>0?r.getRangeAt(0):null;if(e!==null){let t;if(e instanceof Text){let n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=cd(n),i=fd(r);if(r===null||i===null)return;let{top:a,bottom:o}=t,s=0,c=0,l=n;for(;l!==null;){let t=l===r.body;if(t){s=0,c=pd(e).innerHeight;let t=i.getComputedStyle(r.documentElement),n=parseFloat(t.scrollPaddingTop),a=parseFloat(t.scrollPaddingBottom);isFinite(n)&&(s+=n),isFinite(a)&&(c-=a)}else{let e=l.getBoundingClientRect();s=e.top,c=e.bottom}let n=0;if(a<s?n=-(s-a):o>c&&(n=o-c),n!==0)if(t)i.scrollBy(0,n);else{let e=l.scrollTop;l.scrollTop+=n;let t=l.scrollTop-e;a-=t,o-=t}if(t)break;l=sd(l)}})(n,t,a)}}Fs=!0}}function pl(e){let t=e;e.isCollapsed()||t.removeText();let n=L();I(n)&&(t=n),I(t)||N(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!Od(i);){let e=i;if([i,a]=ml(i,a),e.is(i))break}return a}function ml(e,t){let n=e.getParent();if(!n){let e=eu();return Lu().append(e),e.select(),[Lu(),0]}if(F(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!z(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new Wc(Bc(e.__key,t,`element`),Bc(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function hl(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=bf(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!Af(c)){for(let e of c){l=!1;let{origin:t}=e;if(!B(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of df(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(Zd(e))e.origin.isInline()||(c=e);else{if(z(e.origin))continue;B(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&B(c.origin)&&c.origin.isKeyboardSelectable()){let e=rl();return e.add(c.origin.getKey()),zu(e),!0}return c=kf(c),s&&xf(e.anchor,c),xf(e.focus,c),l||!o}var gl=null,_l=null,vl=!1,yl=!1,bl=0,xl={characterData:!0,childList:!0,subtree:!0};function Sl(){return vl||gl!==null&&gl._readOnly}function Cl(){vl&&N(13)}function wl(){bl>99&&N(14)}function Tl(){return gl===null&&N(195,El()),gl}function R(){return _l===null&&N(196,El()),_l}function El(){let e=0,t=new Set,n=su.version;if(typeof window<`u`)for(let r of document.querySelectorAll(`[contenteditable]`)){let i=yu(r);if(_u(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function Dl(){return _l}function Ol(e,t,n){let r=t.__type,i=du(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function kl(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Al(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function jl(e,t){let n=e.type,r=t.get(n);r===void 0&&N(17,n);let i=r.klass;e.type!==i.getType()&&N(18,i.name);let a=i.importJSON(e),o=e.children;if(z(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=jl(o[e],t);a.append(n)}return a}function Ml(e,t,n){let r=gl,i=vl,a=_l;gl=t,vl=!0,_l=e;try{return n()}finally{gl=r,vl=i,_l=a}}function Nl(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return;let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=gl,u=vl,d=_l,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){_l=e,gl=n,vl=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=zo(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),yl)throw t;nu(e,null,r,n),Ua(e),e._dirtyType=2,yl=!0,Nl(e,a),yl=!1;return}finally{p.observe(r,xl),e._updating=f,gl=l,vl=u,_l=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags,y=e._deferred;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=Fu(e)),delete r[a])}(e,n);let b=i?null:xd(pd(e));if(e._editable&&b!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){_l=e,gl=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&bd(t,e,r),fl(o,s,e,b,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(I(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(document.activeElement)){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())yd(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&yd(t)){let n=t.getPreviousSibling();(n===null||yd(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=e.getElementByKey(a.__key);r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=document.createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=Lf(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&bd(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,xl),_l=d,gl=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),I(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(Vo,void 0);let x=e._pendingDecorators;x!==null&&(e._decorators=x,e._pendingDecorators=null,Pl(`decorator`,e,!0,x)),function(e,t,n){let r=Iu(t),i=Iu(n);r!==i&&Pl(`textcontent`,e,!0,i)}(e,t||a,n),Pl(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),function(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}(e,y),function(e){let t=e._updates;if(t.length!==0){let n=t.shift();if(n){let[t,r]=n;Ll(e,t,r)}}}(e)}function Pl(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function Fl(e,t,n,r){let i=Hu(e),a;for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t!==void 0){let e=Array.from(t),i=e.length,a=!1;if(Rl(s,()=>{for(let t=0;t<i;t++)if(e[t](n,r))return void(a=!0)}),a)return a}}}return a&&a.update(()=>{Fl(a,t,n,r)}),!1}function Il(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&N(191),a._flushSync=!0),o&&e._deferred.push(o),Al(e,i.tag)),a==null?Ll(e,n,i):n()}}return r}function Ll(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,Al(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=Kl(c||s),l=!0),c._flushSync=o;let u=gl,d=vl,f=_l,p=e._updating;gl=c,vl=!1,e._updating=!0,_l=e;let m=e._headless||e.getRootElement()===null;lu(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=xd(pd(e));return I(n)||n==null?il(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=Il(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(I(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==0&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);F(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&ro(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Au(),o=new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(let e of s){let r=i.get(e);F(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&ro(r),r!==void 0&&kl(r,a)&&Ol(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){bl++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&kl(c,a)&&Ol(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,bl++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),Il(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(z(t)&&Na(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of o)a.delete(e);for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(i.has(e)||n.delete(e),a.delete(e))}}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(I(i)){let e=c._nodeMap,t=i.anchor.key,n=i.focus.key;e.get(t)!==void 0&&e.get(n)!==void 0||N(19)}else Gc(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),Nl(e);return}finally{gl=u,vl=d,_l=f,e._updating=p,bl=0}e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,Nl(e)):l&&pu(()=>{Nl(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Rl(e,t,n){_l===e&&n===void 0?t():Ll(e,t,n)}var zl=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&N(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&N(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&N(224),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(pa||ca||ua);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=document.createElement(`br`);if(n.insertBefore(i,r),e){let e=document.createElement(`img`);e.setAttribute(`data-lexical-linebreak`,`true`),e.style.cssText=`display: inline !important; border: 0px !important; margin: 0px !important;`,e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}let i=Bl(t,n);i.push(r);let a=Bl(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function Bl(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&N(225),n.reverse()}var Vl=class extends uc{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){return ka[this.getFormat()]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=R()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[],t=this.getFirstChild();for(;t!==null;){if(F(t)&&e.push(t),z(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;z(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;z(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return z(e)&&e.getLastDescendant()||e||null}let r=t[e];return z(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:ju(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&N(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:ju(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&N(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=``,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),z(i)&&r!==n-1&&!i.isInline()&&(e+=wa)}return e}getTextContentSize(){let e=0,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),z(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=Oa[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=Ea[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return Tu(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Cl();let n=L(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(F(e)||z(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(F(e)||z(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return I(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):tl(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e===``?0:Oa[e],this}setStyle(e){return this.getWritable().__style=e||``,this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){lc(this)&&N(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||N(226,String(e),String(t),String(r));let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0)if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}if(t>0){let e=l===null?this.getFirstChild():l.getNextSibling();for(let n=0;n<t;n++){e===null&&N(100);let t=e.getNextSibling(),n=e.__key;Du(e.getWritable()),s.push(n),e=t}}let d=l;for(let e of n){d!==null&&e.is(d)&&(l=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===a&&u--,Du(t);let n=e.__key;if(d===null)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===a&&N(76),t.__parent=a,o.push(n),d=e}if(e+t===r)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(c!==null){let e=c.getWritable();if(d!==null){let t=d.getWritable();e.__prev=d.__key,t.__next=c.__key}else e.__prev=null}if(i.__size=u,s.length){let e=L();if(I(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;Hl(r,t,n)&&cl(r,r.getNode(),this,l,c),Hl(i,t,n)&&cl(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||hd(this)||this.remove()}}return i}getDOMSlot(e){return new zl(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(Cd(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return t===0&&n===``||hd(this)||this.getChildren().some(F)||(t!==0&&(e.textFormat=t),n!==``&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||``)}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=this.getDOMSlot(e),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());i!==null&&(r==null?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}};function z(e){return e instanceof Vl}function Hl(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var Ul=class extends uc{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function B(e){return e instanceof Ul}var Wl=class e extends Vl{__cachedText;static getType(){return`root`}static clone(){return new e}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){N(51)}getTextContent(){let e=this.__cachedText;return!Sl()&&R()._dirtyType!==0||e===null?super.getTextContent():e}remove(){N(52)}replace(e){N(53)}insertBefore(e){N(54)}insertAfter(e){N(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)z(e)||B(e)||N(282);return super.splice(e,t,n)}static importJSON(e){return Lu().updateFromJSON(e)}collapseAtStart(){return!0}};function Gl(e){return e instanceof Wl}function Kl(e){return new Xl(new Map(e._nodeMap))}function ql(){return new Xl(new Map([[`root`,new Wl]]))}function Jl(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&N(130,n.name),z(e)){let r=t.children;Array.isArray(r)||N(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=Jl(i[e]);r.push(t)}}return t}function Yl(e){return e instanceof Xl}var Xl=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Ml(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return Ml(null,this,()=>({root:Jl(Lu())}))}},Zl=class extends Vl{static getType(){return`artificial`}createDOM(e){return document.createElement(`div`)}},Ql=class e extends Vl{static getType(){return`paragraph`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`p`),n=td(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:$l,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(Cd(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return eu().updateFromJSON(e)}exportJSON(){let e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){let t=this.getChildren().find(F);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=eu();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||F(e[0])&&e[0].getTextContent().trim()===``){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function $l(e){let t=eu();if(e.style&&(t.setFormat(e.style.textAlign),Fd(e,t)),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Oa&&t.setFormat(n)}return{node:t}}function eu(){return gd(new Ql)}function tu(e){return e instanceof Ql}function nu(e,t,n,r){let i=e._keyToDOMMap;i.clear(),e._editorState=ql(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=``),n!==null&&(n.textContent=``,i.set(`root`,n))}function ru(e){let t=new Set,n=new Set,r=e;for(;r;){let{ownNodeConfig:e}=Rd(r),i=r.transform;if(!n.has(i)){n.add(i);let e=r.transform();e&&t.add(e)}if(e){let n=e.$transform;n&&t.add(n),r=e.extends}else{let e=Object.getPrototypeOf(r);r=e.prototype instanceof uc&&e!==uc?e:void 0}}return t}function iu(e){let t=e||{},n=Dl(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=ql(),s=t.namespace||(i===null?Uu():i._config.namespace),c=t.editorState,l=[Wl,Tc,mc,Ic,Ql,Zl,...t.nodes||[]],{onError:u,html:d}=t,f=t.editable===void 0||t.editable,p;if(e===void 0&&n!==null)p=n._nodes;else{p=new Map;for(let e=0;e<l.length;e++){let t=l[e],n=null,r=null;if(typeof t!=`function`){let e=t;t=e.replace,n=e.with,r=e.withKlass||null}Rd(t);let i=t.getType(),a=ru(t);p.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:Ka(l[e]),transforms:a})}}let m=new su(o,i,p,{disableEvents:a,namespace:s,theme:r},u||console.error,function(e,t){let n=new Map,r=new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(p,d?d.import:void 0),f,e);return c!==void 0&&(m._pendingEditorState=c,m._dirtyType=2),function(e){e.registerCommand(Uo,Ys,0),e.registerCommand(Wo,Xs,0),e.registerCommand(Go,Zs,0),e.registerCommand(Ko,Qs,0),e.registerCommand(is,ec,0)}(m),m}function au(e,t){let n=e.get(t);e.delete(t),n&&n()}function ou(e,t,n){return e.set(t,n),au.bind(null,e,t)}var su=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,a,o,s){this._createEditorArgs=s,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Uu(),this._onError=i,this._htmlConversions=a,this._editable=o,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return ou(this._listeners.update,e)}registerEditableListener(e){return ou(this._listeners.editable,e)}registerDecoratorListener(e){return ou(this._listeners.decorator,e)}registerTextContentListener(e){return ou(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return zf(ou(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&N(35);let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&N(36,String(e));let a=i[n];return a.add(t),()=>{a.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&N(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=Md(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=Md(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=ju(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:dc}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return H(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=td(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,nu(this,t,e,r),t!==null&&(this._config.disableEvents||oc(t),n!=null&&t.classList.remove(...n)),e!==null){let t=fd(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,Ua(this),this._updateTags.add(dc),Nl(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;Ns.set(e,n);let r=Ps.get(n)??0;r<1&&n.addEventListener(`selectionchange`,rc),Ps.set(n,r+1),e.__lexicalEditor=t;let i=tc(e);for(let n=0;n<Os.length;n++){let[r,a]=Os[n],o=typeof a==`function`?e=>{ac(e)||(ic(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(ac(e))return;ic(e);let n=t.isEditable();switch(r){case`cut`:return n&&H(t,Ss,e);case`copy`:return H(t,xs,e);case`paste`:return n&&H(t,Zo,e);case`dragstart`:return n&&H(t,vs,e);case`dragover`:return n&&H(t,ys,e);case`dragend`:return n&&H(t,bs,e);case`focus`:return n&&H(t,ws,e);case`blur`:return n&&H(t,Ts,e);case`drop`:return n&&H(t,_s,e)}};e.addEventListener(r,o),i.push(()=>{e.removeEventListener(r,o)})}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(dc),Nl(this);Pl(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&N(38);let n=e;n._readOnly&&(n=Kl(e),n._selection=e._selection?e._selection.clone():null),Ha(this);let r=this._pendingEditorState,i=this._updateTags,a=t===void 0?null:t.tag;r===null||r.isEmpty()||(a!=null&&i.add(a),Nl(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||Nl(this)}parseEditorState(e,t){return function(e,t,n){let r=ql(),i=gl,a=vl,o=_l,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,gl=r,vl=!1,_l=t,lu(null);try{let i=t._nodes;jl(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,gl=i,vl=a,_l=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(e){return Nl(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):Ll(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),Rl(this,()=>{let r=L(),i=Lu();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||zu(r.clone()),ld(`focus`),ud(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=xd(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Pl(`editable`,this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};su.version=`0.43.0+prod.esm`;var cu=null;function lu(e){cu=e}var uu=1;function du(e,t){let n=fu(e,t);return n===void 0&&N(30,t),n}function fu(e,t){return e._nodes.get(t)}var pu=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function mu(e){return B(Pu(e))}function hu(e){let t=document.activeElement;if(!Cd(t))return!1;let n=t.nodeName;return B(Pu(e))&&(n===`INPUT`||n===`TEXTAREA`||t.contentEditable===`true`&&yu(t)==null)}function gu(e,t,n){let r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!hu(t)&&vu(t)===e}catch{return!1}}function _u(e){return e instanceof su}function vu(e){let t=e;for(;t!=null;){let e=yu(t);if(_u(e))return e;t=sd(t)}return null}function yu(e){return e?e.__lexicalEditor:null}function bu(e){return Rc(e)||e.isToken()}function xu(e){return bu(e)||e.isSegmented()}function Su(e){return wd(e)&&e.nodeType===3}function Cu(e){return wd(e)&&e.nodeType===9}function wu(e){let t=e;for(;t!=null;){if(Su(t))return t;t=t.firstChild}return null}function Tu(e,t,n){let r=Ea[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~Ea.superscript:t===`superscript`?i&=~Ea.subscript:t===`lowercase`?(i&=~Ea.uppercase,i&=~Ea.capitalize):t===`uppercase`?(i&=~Ea.lowercase,i&=~Ea.capitalize):t===`capitalize`&&(i&=~Ea.lowercase,i&=~Ea.uppercase),i}function Eu(e,t){let n=function(){let e=cu;return cu=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Cl(),wl();let r=R(),i=Tl(),a=``+ uu++;i._nodeMap.set(a,e),z(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType=1,e.__key=a}function Du(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),a=e.getNextSibling(),o=a===null?null:a.__key,s=i===null?null:i.__key,c=i===null?null:i.getWritable(),l=a===null?null:a.getWritable();i===null&&(r.__first=o),a===null&&(r.__last=s),c!==null&&(c.__next=o),l!==null&&(l.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Ou(e){wl(),lc(e)&&N(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,r=Tl(),i=R(),a=r._nodeMap,o=i._dirtyElements;n!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent}}(n,a,o);let s=t.__key;i._dirtyType=1,z(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function ku(e){Cl();let t=R(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=ju(n);e!==null&&e.getWritable()}if(e!==null){let t=ju(e);t!==null&&t.getWritable()}}}function Au(){return Sl()?null:R()._compositionKey}function ju(e,t){let n=(t||Tl())._nodeMap.get(e);return n===void 0?null:n}function Mu(e,t){let n=Nu(e,R());return n===void 0?null:ju(n,t)}function Nu(e,t){return e[`__lexicalKey_${t._key}`]}function Pu(e,t){let n=e;for(;n!=null;){let e=Mu(n,t);if(e!==null)return e;n=sd(n)}return null}function Fu(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Iu(e){return e.read(()=>Lu().getTextContent())}function Lu(){return Ru(Tl())}function Ru(e){return e._nodeMap.get(`root`)}function zu(e){Cl();let t=Tl();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Bu(e){let t=R(),n=function(e,t){let n=e;for(;n!=null;){let e=Nu(n,t);if(e!==void 0)return e;n=sd(n)}return null}(e,t);return n===null?e===t.getRootElement()?ju(`root`):null:ju(n)}function Vu(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Hu(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function Uu(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function Wu(e){return Su(e)?e.nodeValue:null}function Gu(e,t,n){let r=xd(pd(t));if(r===null)return;let i=r.anchorNode,{anchorOffset:a,focusOffset:o}=r;if(i!==null){let t=Wu(i),r=Pu(i);if(t!==null&&F(r)){if((t===Ca||t===Ta)&&n){let e=n.length;t=n,a=e,o=e}t!==null&&Ku(r,t,a,o,e)}}}function Ku(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing(),s=t;if((o||i)&&(t.endsWith(Ca)&&(s=t.slice(0,-Ca.length)),i)){let e=Ta,t;for(;(t=s.indexOf(e))!==-1;)s=s.slice(0,t)+s.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let c=a.getTextContent();if(i||s!==c){if(s===``){if(ku(null),ua||ca||pa)a.remove();else{let e=R();setTimeout(()=>{e.update(()=>{a.isAttached()&&a.remove()})},20)}return}let t=a.getParent(),i=al(),c=a.getTextContentSize(),l=Au(),u=a.getKey();if(a.isToken()||l!==null&&u===l&&!o||I(i)&&(t!==null&&!t.canInsertTextBefore()&&i.anchor.offset===0||i.anchor.key===e.__key&&i.anchor.offset===0&&!a.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===c&&!a.canInsertTextAfter()&&!o))return void a.markDirty();let d=L();if(!I(d)||n===null||r===null)return void qu(a,s,d);if(d.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=Pc(a.getTextContent());a.replace(e),a=e}qu(a,s,d)}}}function qu(e,t,n){if(e.setTextContent(t),I(n)){let t=e.getKey();for(let r of[`anchor`,`focus`]){let i=n[r];i.type===`text`&&i.key===t&&(i.offset=rf(e,i.offset,`clamp`))}}}function Ju(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function Yu(e,t){return Ju(e,t,`altKey`)&&Ju(e,t,`ctrlKey`)&&Ju(e,t,`shiftKey`)&&Ju(e,t,`metaKey`)}function V(e,t,n){if(!Yu(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let r=`Key`+t.toUpperCase();return e.code===r}var Xu={ctrlKey:!aa,metaKey:aa},Zu={altKey:aa,ctrlKey:!aa};function Qu(e){return e.key===`Backspace`}function $u(e){return V(e,`a`,Xu)}function ed(e){let t=Lu();if(I(e)){let t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),io(e),e}{let e=t.select(0,t.getChildrenSize());return zu(io(e)),e}}function td(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=Lf(i);return n[t]=e,e}return i}function nd(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&N(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function rd(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function id(e,t){let n=e.offset;if(e.type===`element`)return rd(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?rd(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function ad(e){let t=pd(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function H(e,t,n){return Fl(e,t,n,e)}function od(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&N(75,t),n}function sd(e){let t=e.assignedSlot||e.parentElement;return Td(t)?t.host:t}function cd(e){return Cu(e)?e:Cd(e)?e.ownerDocument:null}function ld(e){Cl(),R()._updateTags.add(e)}function ud(e){Cl(),R()._deferred.push(e)}function dd(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function fd(e){let t=cd(e);return t?t.defaultView:null}function pd(e){let t=e._window;return t===null&&N(78),t}function md(e){let t=e.getParentOrThrow();for(;t!==null;){if(hd(t))return t;t=t.getParentOrThrow()}return t}function hd(e){return Gl(e)||z(e)&&e.isShadowRoot()}function gd(e){let t=R(),n=e.getType(),r=fu(t,n);r===void 0&&N(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||N(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||N(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&N(203,e.constructor.name,n,r.name,r.getType()),t}return e}function _d(e,t){!Gl(e.getParent())||z(t)||B(t)||N(99)}function vd(e){let t=ju(e);return t===null&&N(63,e),t}function yd(e){return(B(e)||z(e)&&!e.canBeEmpty())&&!e.isInline()}function bd(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function xd(e){return ra?(e||window).getSelection():null}function Sd(e){let t=fd(e);return t?t.getSelection():null}function Cd(e){return wd(e)&&e.nodeType===1}function wd(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Td(e){return wd(e)&&e.nodeType===11}function Ed(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,`i`);return e.nodeName.match(t)!==null}function Dd(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,`i`);return e.nodeName.match(t)!==null}function Od(e){if(B(e)&&!e.isInline())return!0;if(!z(e)||hd(e))return!1;let t=e.getFirstChild(),n=t===null||_c(t)||F(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function kd(){return R()}var Ad=new WeakMap,jd=new Map;function Md(e){if(!e._readOnly&&e.isEmpty())return jd;e._readOnly||N(192);let t=Ad.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),Ad.set(e,t)),t}function Nd(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Pd(e){return(t=Nd(e))[cc]=!0,t;var t}function Fd(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function Id(e){return!0===e.__lexicalUnmanaged}function Ld(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==uc[t]}function Rd(e){let t=Ma in e.prototype?e.prototype[Ma]():void 0,n=function(e){if(!(e===uc||e.prototype instanceof uc)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{su.version&&(n=JSON.parse(su.version))}catch{}N(290,e.name,t,n)}return e===Ul||e===Vl||e===uc}(e),r=!n&&Ld(e,`getType`)?e.getType():void 0,i,a=r;if(t)if(r)i=t[r];else for(let[e,n]of Object.entries(t))a=e,i=n;if(!n&&a&&(Ld(e,`getType`)||(e.getType=()=>a),Ld(e,`clone`)||(e.clone=t=>(lu(t),new e)),Ld(e,`importJSON`)||(e.importJSON=i&&i.$importJSON||(t=>new e().updateFromJSON(t))),!Ld(e,`importDOM`)&&i)){let{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:a}}function zd(e){let t=kd();return Cl(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Bd=(e,t)=>{let n=e;for(;n!=null&&!Gl(n);){if(t(n))return n;n=n.getParent()}return null},Vd={next:`previous`,previous:`next`},Hd=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return mf({hasNext:Xd,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return tf(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return tf(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&N(263,Array.from(o).join(` `))}else i.insert(e);i=tf(e,this.direction)}for(let e of o.values())e.remove();return this}},Ud=class e extends Hd{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:of(e,this.direction)}getParentCaret(e=`root`){return tf(Kd(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=Gd(this.direction);return tf(this.getNodeAtCaret(),e)||of(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},Wd={root:Gl,shadowRoot:hd};function Gd(e){return Vd[e]}function Kd(e,t=`root`){return Wd[t](e)?null:e}var qd=class e extends Hd{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:tf(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return z(this.origin)?of(this.origin,this.direction):null}getParentCaret(e=`root`){return tf(Kd(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=Gd(this.direction);return tf(this.getNodeAtCaret(),e)||of(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Jd)&&this.direction===t.direction&&this.origin.is(t.origin)}},Jd=class e extends Hd{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:nf(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return tf(Kd(this.getParentAtCaret(),e),this.direction)}getFlipped(){return nf(this.origin,Gd(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof qd||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return tf(this.origin,this.direction)}};function Yd(e){return e instanceof Jd}function Xd(e){return e instanceof qd}function Zd(e){return e instanceof Ud}var Qd={next:class extends Jd{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Jd{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},$d={next:class extends qd{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends qd{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},ef={next:class extends Ud{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Ud{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function tf(e,t){return e?new $d[t](e):null}function nf(e,t,n){return e?new Qd[t](e,rf(e,n)):null}function rf(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&na(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function af(e,t){return new uf(e,t)}function of(e,t){return z(e)?new ef[t](e):null}function sf(e){return e&&e.getChildCaret()||e}function cf(e){return e&&sf(e.getAdjacentCaret())}var lf=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return Yd(t)?function(e,t){let{direction:n,origin:r}=e;return af(e,rf(r,t===`focus`?Gd(n):n)-e.offset)}(t,e):null},t=e(`anchor`),n=e(`focus`);if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[af(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=Yd(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Yd(n),i=t=>t.isSameNodeCaret(n)?null:cf(t)||t.getParentCaret(e);return mf({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},uf=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return nf(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function df(e){return pf(e,tf(Lu(),e.direction))}function ff(e){return pf(e,e)}function pf(e,t){return e.direction!==t.direction&&N(265),new lf(e,t,e.direction)}function mf(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function hf(e,t){let n=yf(e.origin,t.origin);switch(n===null&&N(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:{let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return gf(n)}}function gf(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function _f(e,t){return t.is(e)}function vf(e){return z(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function yf(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=vf(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=vf(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(_f(e,r)||N(276),{commonAncestor:r,type:`ancestor`}):i===null?(_f(t,r)||N(277),{commonAncestor:r,type:`descendant`}):((z(a)||_f(e,a))&&(z(i)||_f(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||N(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function bf(e,t){let{type:n,key:r,offset:i}=e,a=vd(e.key);return n===`text`?(F(a)||N(266,a.getType(),r),nf(a,t,i)):(z(a)||N(267,a.getType(),r),Nf(a,e.offset,t))}function xf(e,t){let{origin:n,direction:r}=t,i=r===`next`;Yd(t)?e.set(n.getKey(),t.offset,`text`):Xd(t)?F(n)?e.set(n.getKey(),rf(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),`element`):(Zd(t)&&z(n)||N(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function Sf(e){let t=L(),n=I(t)?t:nl();return Cf(n,e),zu(n),n}function Cf(e,t){xf(e.anchor,t.anchor),xf(e.focus,t.focus)}function wf(e){let{anchor:t,focus:n}=e,r=bf(t,`next`),i=bf(n,`next`),a=hf(r,i)<=0?`next`:`previous`;return pf(jf(r,a),jf(i,a))}function Tf(e){let{direction:t,origin:n}=e,r=tf(n,Gd(t)).getNodeAtCaret();return r?tf(r,t):of(n.getParentOrThrow(),t)}function Ef(e,t=`root`){let n=[e];for(let r=Zd(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(Tf(r));return n}function Df(e){return!!e&&e.origin.isAttached()}function Of(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=Mf(e,r),o=Ef(a.anchor,n),s=Ef(a.focus.getFlipped(),n),c=new Set,l=[];for(let e of a.iterNodeCarets(n))if(Zd(e))c.add(e.origin.getKey());else if(Xd(e)){let{origin:t}=e;z(t)&&!c.has(t.getKey())||l.push(t)}for(let e of l)e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=Tf(tf(t,r)),c=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||c===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(c===`segmented`){let e=t.origin,n=Pc(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=nf(n,r,t.offset)}n.is(o[0].origin)&&(o[0]=t),n.is(s[0].origin)&&(s[0]=t.getFlipped())}}let u,d;for(let e of o)if(Df(e)){u=kf(e);break}for(let e of s)if(Df(e)){d=kf(e);break}let f=function(e,t,n){if(!e||!t)return null;let r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;let a=r.getParents().reverse();a.push(r);let o=i.getParents().reverse();o.push(i);let s=Math.min(a.length,o.length),c;for(c=0;c<s&&a[c]===o[c];c++);let l=(e,t)=>{let n;for(let r=c;r<e.length;r++){let i=e[r];if(hd(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,Od),d=u&&l(o,e=>n.has(e.getKey())&&Od(e));return u&&d?[u,d]:null}(u,d,c);if(f){let[e,t]=f;of(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}let p=[u,d,...o,...s].find(Df);if(p)return ff(jf(kf(p),e.direction));N(269,JSON.stringify(o.map(e=>e.origin.__key)))}function kf(e){let t=function(e){let t=e;for(;Zd(t);){let e=cf(t);if(!Zd(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(F(t.origin))return Yd(t)?t:nf(t.origin,n,n);let r=t.getAdjacentCaret();return Xd(r)&&F(r.origin)?nf(r.origin,n,Gd(n)):t}function Af(e){return Yd(e)&&e.offset!==rf(e.origin,e.direction)}function jf(e,t){return e.direction===t?e:e.getFlipped()}function Mf(e,t){return e.direction===t?e:pf(jf(e.focus,t),jf(e.anchor,t))}function Nf(e,t,n){let r=of(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return jf(r,n)}function Pf(e){return e}function Ff(e){return e}function If(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Lf(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function Rf(e,...t){let n=Lf(...t);n.length>0&&e.classList.add(...n)}function zf(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Bf(){return Lu().getTextContent()}function Vf(e,t=!0){if(e)return!1;let n=Bf();return t&&(n=n.trim()),n===``}function Hf(e){if(!Vf(e,!1))return!1;let t=Lu().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(B(n))return!1;if(z(n)){if(!tu(n)||n.__indent!==0)return!1;let t=n.getChildren(),r=t.length;for(let n=0;n<r;n++){let n=t[e];if(!F(n))return!1}}}return!0}function Uf(e){return()=>Hf(e)}function Wf(e){let t=kd().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function Gf(e){return Wf(Gl(e)?e:e.getParentOrThrow())}function Kf(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!xu(t)&&r!==null){let[i,a]=r,o=e.isBackward(),s=i.getNode(),c=a.getNode(),l=t.is(s),u=t.is(c);if(l||u){let[r,i]=qc(e),a=s.is(c),l=t.is(o?c:s),u=t.is(o?s:c),d,f=0;a?(f=r>i?i:r,d=r>i?r:i):l?(f=o?i:r,d=void 0):u&&(f=0,d=o?r:i);let p=t.__text.slice(f,d);p!==t.__text&&(n===`clone`&&(t=Pd(t)),t.__text=p)}}return t}function qf(e){let t=Jf(e);return t!==null&&t.writingMode===`vertical-rl`}function Jf(e){let t=e.anchor.getNode();return z(t)?Wf(t):Gf(t)}function Yf(e,t){let n=qf(e)?!t:t;Zf(e)&&(n=!n);let r=bf(e.focus,n?`previous`:`next`);if(Af(r))return!1;for(let e of df(r)){if(Zd(e))return!e.origin.isInline();if(!z(e.origin)){if(B(e.origin))return!0;break}}return!1}function Xf(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function Zf(e){let t=Jf(e);return t!==null&&t.direction===`rtl`}function Qf(e,t,n){let r=Zf(e),i;i=qf(e)||r?!n:n,Xf(e,t,i,`character`)}var $f=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,ep=$f&&`documentMode`in document?document.documentMode:null;$f&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),$f&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),!(!$f||!(`InputEvent`in window)||ep)&&`getTargetRanges`in new window.InputEvent(`input`),$f&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&window.MSStream,$f&&/Android/.test(navigator.userAgent),$f&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),$f&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$f&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent);function tp(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}var np=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?k.useLayoutEffect:k.useEffect;function rp({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:o,ariaInvalid:s,ariaLabel:c,ariaLabelledBy:l,ariaMultiline:u,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:g=`textbox`,spellCheck:_=!0,style:v,tabIndex:y,"data-testid":b,...x},S){let[C,w]=(0,k.useState)(e.isEditable()),T=(0,k.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,k.useMemo)(()=>function(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}(S,T),[T,S]);return np(()=>(w(e.isEditable()),e.registerEditableListener(e=>{w(e)})),[e]),(0,A.jsx)(`div`,{"aria-activedescendant":C?t:void 0,"aria-autocomplete":C?n:`none`,"aria-controls":C?r:void 0,"aria-describedby":i,...a==null?{}:{"aria-errormessage":a},"aria-expanded":C&&g===`combobox`?!!o:void 0,...s==null?{}:{"aria-invalid":s},"aria-label":c,"aria-labelledby":l,"aria-multiline":u,"aria-owns":C?d:void 0,"aria-readonly":!C||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:C,"data-testid":b,id:h,ref:E,role:g,spellCheck:_,style:v,tabIndex:y,...x})}var ip=(0,k.forwardRef)(rp);function ap(e){return e.getEditorState().read(Uf(e.isComposing()))}var op=(0,k.forwardRef)(sp);function sp(e,t){let{placeholder:n,...r}=e,[i]=ta();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ip,{editor:i,...r,ref:t}),n!=null&&(0,A.jsx)(cp,{editor:i,content:n})]})}function cp({content:e,editor:t}){let n=function(e){let[t,n]=(0,k.useState)(()=>ap(e));return np(()=>{function t(){n(ap(e))}return t(),zf(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,k.useState)(t.isEditable());if((0,k.useLayoutEffect)(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let a=null;return typeof e==`function`?a=e(r):e!==null&&(a=e),a===null?null:(0,A.jsx)(`div`,{"aria-hidden":!0,children:a})}var lp=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,up=lp?k.useLayoutEffect:k.useEffect,dp={tag:dc};function fp({initialConfig:e,children:t}){let n=(0,k.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,editorState:a,html:o}=e,s=ea(null,t),c=iu({editable:e.editable,html:o,namespace:n,nodes:r,onError:e=>i(e,c),theme:t});return function(e,t){if(t!==null){if(t===void 0)e.update(()=>{let t=Lu();if(t.isEmpty()){let n=eu();t.append(n);let r=lp?document.activeElement:null;(L()!==null||r!==null&&r===e.getRootElement())&&n.select()}},dp);else if(t!==null)switch(typeof t){case`string`:{let n=e.parseEditorState(t);e.setEditorState(n,dp);break}case`object`:e.setEditorState(t,dp);break;case`function`:e.update(()=>{Lu().isEmpty()&&t(e)},dp)}}}(c,a),[c,s]},[]);return up(()=>{let t=e.editable,[r]=n;r.setEditable(t===void 0||t)},[]),(0,A.jsx)($i.Provider,{value:n,children:t})}function pp({editorRef:e}){let[t]=ta();return k.useEffect(()=>{typeof e==`function`?e(t):typeof e==`object`&&(e.current=t)},[t]),null}var mp=(0,k.createContext)(null),hp={didCatch:!1,error:null},gp=class extends k.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=hp}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(hp))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&_p(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(hp))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,k.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,k.createElement)(mp.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function _p(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function vp({children:e,onError:t}){return(0,A.jsx)(gp,{fallback:(0,A.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}),onError:t,children:e})}var yp=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?k.useLayoutEffect:k.useEffect;function bp(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function xp(){return function(e){let[t]=ta(),n=(0,k.useMemo)(()=>e(t),[t,e]),[r,i]=(0,k.useState)(()=>n.initialValueFn()),a=(0,k.useRef)(r);return yp(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return a.current!==r&&(a.current=r,i(r)),t(e=>{a.current=e,i(e)})},[n,e]),r}(bp)}var Sp=Symbol.for(`preact-signals`);function Cp(){if(Dp>1)return void Dp--;let e,t=!1;for(function(){let e=Ep;for(Ep=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();wp!==void 0;){let n=wp;for(wp=void 0,Op++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Np(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Op=0,Dp--,t)throw e}var U,wp;function Tp(e){let t=U;U=void 0;try{return e()}finally{U=t}}var Ep,Dp=0,Op=0,kp=0,Ap=0;function jp(e){if(U===void 0)return;let t=e.n;return t===void 0||t.t!==U?(t={i:0,S:e,p:U.s,n:void 0,t:U,e:void 0,x:void 0,r:t},U.s!==void 0&&(U.s.n=t),U.s=t,e.n=t,32&U.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=U.s,t.n=void 0,U.s.n=t,U.s=t),t):void 0}function Mp(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Np(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Pp(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Fp(e){let t,n=e.s;for(;n!==void 0;){let e=n.p;n.i===-1?(n.S.U(n),e!==void 0&&(e.n=n.n),n.n!==void 0&&(n.n.p=e)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=e}e.s=t}function Ip(e,t){Mp.call(this,void 0),this.x=e,this.s=void 0,this.g=Ap-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Lp(e){let t=e.m;if(e.m=void 0,typeof t==`function`){Dp++;let n=U;U=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Rp(e),t}finally{U=n,Cp()}}}function Rp(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Lp(e)}function zp(e){if(U!==this)throw Error(`Out-of-order effect`);Fp(this),U=e,this.f&=-2,8&this.f&&Rp(this),Cp()}function Bp(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function Vp(e,t){let n=new Bp(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}Mp.prototype.brand=Sp,Mp.prototype.h=function(){return!0},Mp.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?Tp(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},Mp.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Tp(()=>{var e;(e=this.Z)==null||e.call(this)}))}},Mp.prototype.subscribe=function(e){return Vp(()=>{let t=this.value,n=U;U=void 0;try{e(t)}finally{U=n}},{name:`sub`})},Mp.prototype.valueOf=function(){return this.value},Mp.prototype.toString=function(){return this.value+``},Mp.prototype.toJSON=function(){return this.value},Mp.prototype.peek=function(){let e=U;U=void 0;try{return this.value}finally{U=e}},Object.defineProperty(Mp.prototype,`value`,{get(){let e=jp(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Op>100)throw Error(`Cycle detected`);(function(e){Dp!==0&&Op===0&&e.l!==kp&&(e.l=kp,Ep={S:e,v:e.v,i:e.i,o:Ep})})(this),this.v=e,this.i++,Ap++,Dp++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Cp()}}}}),Ip.prototype=new Mp,Ip.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ap))return!0;if(this.g=Ap,this.f|=1,this.i>0&&!Np(this))return this.f&=-2,!0;let e=U;try{Pp(this),U=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return U=e,Fp(this),this.f&=-2,!0},Ip.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Mp.prototype.S.call(this,e)},Ip.prototype.U=function(e){if(this.t!==void 0&&(Mp.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},Ip.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Ip.prototype,`value`,{get(){if(1&this.f)throw Error(`Cycle detected`);let e=jp(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Bp.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e==`function`&&(this.m=e)}finally{e()}},Bp.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Lp(this),Pp(this),Dp++;let e=U;return U=this,zp.bind(this,e)},Bp.prototype.N=function(){2&this.f||(this.f|=2,this.u=wp,wp=this)},Bp.prototype.d=function(){this.f|=8,1&this.f||Rp(this)},Bp.prototype.dispose=function(){this.d()};function Hp(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}Ga(`format`,{parse:e=>typeof e==`number`?e:0});function W(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Up(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)n[e]=Up(n[e],r[e]);return e}return t}var Wp=0,Gp=1,Kp=2,qp=3,Jp=4,Yp=5,Xp=6,Zp=7;function Qp(e){return e.id===Wp}function $p(e){return e.id===Kp}function em(e){return function(e){return e.id===Gp}(e)||W(305,String(e.id),String(Gp)),Object.assign(e,{id:Kp})}var tm=new Set,nm=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:Wp}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):If;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;$p(t)||W(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:qp,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:Jp,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==Jp&&W(307,String(t.id),String(Yp)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:Yp,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==Yp&&W(308,String(n.id),String(Yp));let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:Xp})}(n),()=>{let e=this.state;e.id!==Zp&&W(309,String(n.id),String(Zp)),this.state=function(e){return Object.assign(e,{id:Yp})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==Xp&&W(310,String(t.id),String(Xp)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:Zp})}(t),n}getSignal(){return this._signal===void 0&&W(311),this._signal}getInitResult(){this.extension.init===void 0&&W(312,this.extension.name);let e=this.state;return function(e){return e.id>=Jp}(e)||W(313,String(e.id),String(Jp)),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=qp}(e)||W(314,String(e.id),String(qp)),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&W(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&W(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=Zp}(e)||W(316,String(e.id),String(Zp)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||tm}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=Yp})(e)||W(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}},rm={tag:dc};function im(){let e=Lu();e.isEmpty()&&e.append(eu())}var am=Pf({config:Ff({setOptions:rm,updateOptions:rm}),init:({$initialEditorState:e=im})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(Yl(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[Wl,Tc,mc,Ic,Ql]}),om=Symbol.for(`@lexical/extension/LexicalBuilder`);function sm(){}function cm(e){throw e}function lm(e){return Array.isArray(e)?e:[e]}var um=`0.43.0+prod.esm`,dm=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=um,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[lm(am)];for(let e of t)n.push(lm(e));return new e(n)}static maybeFromEditor(t){let n=t[om];return n&&(n.PACKAGE_VERSION!==um&&W(292,n.PACKAGE_VERSION,um),n instanceof e||W(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&W(294),n}constructEditor(){let{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(iu({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[om]:this});for(let e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=sm;function t(){try{e()}finally{e=sm}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=zf(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&W(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&W(296);let[t]=lm(e);typeof t.name!=`string`&&W(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&W(298,t.name),!n){n=new nm(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&W(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&W(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=lm(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if($p(i))return;let a=n.extension.name;var o;Qp(i)||W(300,a,r||`[unknown]`),Qp(o=i)||W(304,String(o.id),String(Wp)),i=Object.assign(o,{id:Gp}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=em(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())Qp(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&W(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return zf(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of Hp(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&W(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&Up(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=[...t]);let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=cm,e}},fm=class e extends Ul{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return mm().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:pm,priority:0})}}exportDOM(){return{element:document.createElement(`hr`)}}createDOM(e){let t=document.createElement(`hr`);return Rf(t,e.theme.hr),t}getTextContent(){return`
12
+ `}isInline(){return!1}updateDOM(){return!1}};function pm(){return{node:mm()}}function mm(){return zd(fm)}var hm=Pf({name:`@lexical/react/ReactProvider`}),gm=e(f(),1);function _m(e){let t=window.location.origin,n=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let i=n.data;if(typeof i==`string`){let t;try{t=JSON.parse(i)}catch{return}if(t&&t.protocol===`nuanria_messaging`&&t.type===`request`){let r=t.payload;if(r&&r.functionId===`makeChanges`){let t=r.args;if(t){let[r,i,a,o,s]=t;e.update(()=>{let e=L();if(I(e)){let t=e.anchor,c=t.getNode(),l=0,u=0;if(F(c)&&r>=0&&i>=0&&(l=r,u=r+i,e.setTextNodeRange(c,l,c,u)),l===u&&a===``||(e.insertRawText(a),c=t.getNode()),F(c)){l=o,u=o+s;let t=c.getTextContentSize();l=l>t?t:l,u=u>t?t:u,e.setTextNodeRange(c,l,c,u)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener(`message`,n,!0),()=>{window.removeEventListener(`message`,n,!0)}}function vm(e,t){if(typeof document>`u`||typeof window>`u`&&global.window===void 0)throw Error(`To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.`);let n=document.createElement(`div`),r=Lu().getChildren();for(let i=0;i<r.length;i++)ym(e,r[i],n,t);return n.innerHTML}function ym(e,t,n,r=null){let i=r===null||t.isSelected(r),a=z(t)&&t.excludeFromCopy(`html`),o=t;r!==null&&F(t)&&(o=Kf(r,t,`clone`));let s=z(o)?o.getChildren():[],c=fu(e,o.getType()),l;l=c&&c.exportDOM!==void 0?c.exportDOM(e,o):o.exportDOM(e);let{element:u,after:d}=l;if(!u)return!1;let f=document.createDocumentFragment();for(let n=0;n<s.length;n++){let a=s[n],o=ym(e,a,f,r);!i&&z(t)&&o&&t.extractWithChild(a,r,`html`)&&(i=!0)}if(i&&!a){if((Cd(u)||Td(u))&&u.append(f),n.append(u),d){let e=d.call(o,u);e&&(Td(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(f);return i}function bm(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function xm(e,t=L()){return t??bm(166),I(t)&&t.isCollapsed()||t.getNodes().length===0?``:vm(e,t)}function Sm(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}var Cm=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,wm=Cm&&`documentMode`in document?document.documentMode:null,Tm=Cm&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Em=!(!Cm||!(`InputEvent`in window)||wm)&&`getTargetRanges`in new window.InputEvent(`input`),Dm=Cm&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Om=Cm&&/Android/.test(navigator.userAgent),km=Cm&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Om,Am=Cm&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jm=Cm&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Tm&&!Am;function Mm(e,t){t.update(()=>{if(e!==null){let n=tp(e,KeyboardEvent)?null:e.clipboardData,r=L();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=xm(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Nm(e){return zf(e.registerCommand(qo,e=>{let t=L();return!!I(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand($o,e=>{let t=L();return!!I(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(es,e=>{let t=L();return!!I(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(Xo,e=>{let t=L();if(!I(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)Sm(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(Qo,()=>{let e=L();return!!I(e)&&(e.removeText(),!0)},0),e.registerCommand(Jo,e=>{let t=L();return!!I(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(Yo,()=>{let e=L();return!!I(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(ss,e=>{let t=L();if(!I(t))return!1;let n=e,r=n.shiftKey;return!!Yf(t,!0)&&(n.preventDefault(),Qf(t,r,!0),!0)},0),e.registerCommand(as,e=>{let t=L();if(!I(t))return!1;let n=e,r=n.shiftKey;return!!Yf(t,!1)&&(n.preventDefault(),Qf(t,r,!1),!0)},0),e.registerCommand(ps,t=>!!I(L())&&(!Dm||navigator.language!==`ko-KR`)&&(t.preventDefault(),e.dispatchCommand(qo,!0)),0),e.registerCommand(hs,t=>!!I(L())&&(t.preventDefault(),e.dispatchCommand(qo,!1)),0),e.registerCommand(ds,t=>{if(!I(L()))return!1;if(t!==null){if((Dm||km||jm)&&Em)return!1;t.preventDefault()}return e.dispatchCommand(Jo,!1)},0),e.registerCommand(Cs,()=>(ed(),!0),0),e.registerCommand(xs,t=>!!I(L())&&(Mm(t,e),!0),0),e.registerCommand(Ss,t=>!!I(L())&&(function(e,t){Mm(e,t),t.update(()=>{let e=L();I(e)&&e.removeText()})}(t,e),!0),0),e.registerCommand(Zo,t=>!!I(L())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=L(),n=tp(e,ClipboardEvent)?e.clipboardData:null;n!=null&&I(t)&&Sm(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(_s,e=>!!I(L())&&(e.preventDefault(),!0),0),e.registerCommand(vs,e=>!!I(L())&&(e.preventDefault(),!0),0))}function Pm(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Fm=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?k.useLayoutEffect:k.useEffect;function Im({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,k.useState)(()=>e.getDecorators());return Fm(()=>e.registerDecoratorListener(e=>{(0,gm.flushSync)(()=>{r(e)})}),[e]),(0,k.useEffect)(()=>{r(e.getDecorators())},[e]),(0,k.useMemo)(()=>{let r=[],i=Object.keys(n);for(let a=0;a<i.length;a++){let o=i[a],s=(0,A.jsx)(t,{onError:t=>e._onError(t),children:(0,A.jsx)(k.Suspense,{fallback:null,children:n[o]})}),c=e.getElementByKey(o);c!==null&&r.push((0,gm.createPortal)(s,c,o))}return r},[t,n,e])}(e,t)}function Lm({editor:e,ErrorBoundary:t}){return function(e){let t=dm.maybeFromEditor(e);if(t&&t.hasExtensionByName(hm.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&Pm(320,e);return!0}return!1}(e)?null:(0,A.jsx)(Im,{editor:e,ErrorBoundary:t})}function Rm(e){return e.getEditorState().read(Uf(e.isComposing()))}function zm({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=ta();return function(e){Fm(()=>zf(Nm(e),_m(e)),[e])}(r),(0,A.jsxs)(A.Fragment,{children:[e,(0,A.jsx)(Bm,{content:t}),(0,A.jsx)(Lm,{editor:r,ErrorBoundary:n})]})}function Bm({content:e}){let[t]=ta(),n=function(e){let[t,n]=(0,k.useState)(()=>Rm(e));return Fm(()=>{function t(){n(Rm(e))}return t(),zf(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=xp();return n?typeof e==`function`?e(r):e:null}function Vm(){return`composer-${Math.random().toString(36).slice(2,10)}`}function Hm(e=``){return{id:Vm(),type:`text`,text:e}}function Um(e){return{id:Vm(),type:`token`,tokenKind:e.tokenKind,tokenKey:e.tokenKey,label:e.label}}function Wm(e){return e.type===`text`?e.text.length:1}function Gm(){return[Hm(``)]}function Km(e){return[Hm(e)]}function qm(e){let t=[];for(let n of e){if(n.type===`text`){if(n.text.length===0)continue;let e=t[t.length-1];if(e?.type===`text`){t[t.length-1]={...e,text:e.text+n.text};continue}}t.push(n)}return t.length===0?Gm():t}function Jm(e){return e.map(e=>e.type===`text`?e.text:``).join(``)}function Ym(e){return e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Xm(e,t){let n=[],r=new Set;for(let i of e)i.type!==`token`||i.tokenKind!==t||r.has(i.tokenKey)||(r.add(i.tokenKey),n.push(i.tokenKey));return n}function Zm(e,t,n,r){let i=Math.max(0,n-t),a=Math.max(0,t+e.text.length-r),o=[];return i>0&&o.push({...e,text:e.text.slice(0,i)}),a>0&&o.push({...e,text:e.text.slice(e.text.length-a)}),o}function Qm(e,t,n,r){return t<=n||e>=r}function $m(e,t,n,r,i){return!n&&r>=i?(e.push(...t),!0):n}function eh(e,t,n,r,i,a,o){let s=Zm(t,n,r,i);s[0]&&e.push(s[0]);let c=o;return c||=(e.push(...a),!0),s[1]&&e.push(s[1]),c}function th(e,t,n,r,i,a){return!r&&i<=a?(e.push(...n),!0):(e.push(t),r)}function nh(e,t,n,r){let i=Math.max(0,t),a=Math.max(i,n),o=[],s=0,c=!1;for(let t of e){let e=Wm(t),n=s,l=s+e;if(Qm(n,l,i,a)){c=$m(o,r,c,n,a),o.push(t),s=l;continue}c=t.type===`text`?eh(o,t,n,i,a,r,c):th(o,t,r,c,i,n),s=l}return c||o.push(...r),qm(o)}function rh(e,t){return qm(e.filter(e=>e.type!==`token`||!t(e)))}function ih(e,t){if(!t||t.start!==t.end)return null;let n=Jm(e),r=t.end,i=n.slice(0,r),a=/(?:^|\s)\/([^\s\uFFFC]*)$/.exec(i);if(!a)return null;let o=r-a[0].length+(a[0].startsWith(`/`)?0:1);return{query:(a[1]??``).trim().toLowerCase(),start:o,end:r}}function ah(e){return e===`file`?[`mx-[2px]`,`inline-flex`,`h-7`,`max-w-[min(100%,17rem)]`,`items-center`,`gap-1.5`,`rounded-lg`,`border`,`border-slate-200/80`,`bg-slate-50`,`px-2`,`align-baseline`,`text-slate-700`,`transition-[border-color,background-color,box-shadow,color]`,`duration-150`].join(` `):[`mx-[2px]`,`inline-flex`,`h-7`,`max-w-full`,`items-center`,`gap-1.5`,`rounded-lg`,`border`,`border-primary/12`,`bg-primary/8`,`px-2`,`align-baseline`,`text-[11px]`,`font-medium`,`text-primary`,`transition`].join(` `)}function oh(e){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:e.tokenKind===`file`?`inline-flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-md bg-white text-slate-500 ring-1 ring-black/5`:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-primary/70`,children:e.tokenKind===`file`?(0,A.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`h-3 w-3`,children:[(0,A.jsx)(`path`,{d:`M3.25 4.25A1.5 1.5 0 0 1 4.75 2.75h6.5a1.5 1.5 0 0 1 1.5 1.5v7.5a1.5 1.5 0 0 1-1.5 1.5h-6.5a1.5 1.5 0 0 1-1.5-1.5v-7.5Z`}),(0,A.jsx)(`path`,{d:`m4.75 10 2.25-2.5 1.75 1.75 1.25-1.25 2 2`}),(0,A.jsx)(`path`,{d:`M9.75 6.25h.01`})]}):(0,A.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`h-3 w-3`,children:[(0,A.jsx)(`path`,{d:`M8.5 2.75 2.75 6l5.75 3.25L14.25 6 8.5 2.75Z`}),(0,A.jsx)(`path`,{d:`M2.75 10 8.5 13.25 14.25 10`}),(0,A.jsx)(`path`,{d:`M2.75 6v4l5.75 3.25V9.25L2.75 6Z`}),(0,A.jsx)(`path`,{d:`M14.25 6v4L8.5 13.25V9.25L14.25 6Z`})]})}),(0,A.jsx)(`span`,{className:e.tokenKind===`file`?`min-w-0 flex-1 truncate text-[12px] font-medium text-slate-700`:`truncate`,children:e.label})]})}var sh=class e extends Ul{static getType(){return`chat-composer-token`}static clone(t){return new e(t.__composerId,t.__tokenKind,t.__tokenKey,t.__label,t.__key)}static importJSON(e){return ch({composerId:e.composerId,label:e.label,tokenKey:e.tokenKey,tokenKind:e.tokenKind})}constructor(e,t,n,r,i){super(i),this.applyTokenDom=e=>{e.contentEditable=`false`,e.dataset.composerNodeId=this.__composerId,e.dataset.composerNodeType=`token`,e.dataset.composerTokenKind=this.__tokenKind,e.dataset.composerTokenKey=this.__tokenKey,e.dataset.composerLabel=this.__label,e.title=this.__label,e.className=ah(this.__tokenKind)},this.createDOM=(e,t)=>{let n=document.createElement(`span`);return this.applyTokenDom(n),n},this.updateDOM=(e,t)=>(this.applyTokenDom(t),!1),this.decorate=()=>(0,A.jsx)(oh,{label:this.__label,tokenKind:this.__tokenKind}),this.exportJSON=()=>({composerId:this.__composerId,label:this.__label,tokenKey:this.__tokenKey,tokenKind:this.__tokenKind,type:`chat-composer-token`,version:1}),this.getComposerId=()=>this.getLatest().__composerId,this.getTokenKind=()=>this.getLatest().__tokenKind,this.getTokenKey=()=>this.getLatest().__tokenKey,this.getLabel=()=>this.getLatest().__label,this.getTextContent=()=>``,this.isInline=()=>!0,this.isIsolated=()=>!0,this.isKeyboardSelectable=()=>!1,this.__composerId=e,this.__tokenKind=t,this.__tokenKey=n,this.__label=r}};function ch(e){let{composerId:t,label:n,tokenKey:r,tokenKind:i}=e;return gd(new sh(t,i,r,n))}function lh(e){return e instanceof sh}function uh(){let e=Lu(),t=e.getFirstChild();if(!z(t))return{descriptors:[],paragraphKey:e.getKey(),paragraphSize:0,totalLength:0};let n=t.getChildren(),r=[],i=0;for(let[e,t]of n.entries()){if(F(t)){let n=t.getTextContent();r.push({index:e,key:t.getKey(),length:n.length,node:t,start:i,text:n,type:`text`}),i+=n.length;continue}if(lh(t)){r.push({index:e,key:t.getKey(),length:1,node:t,start:i,type:`token`}),i+=1;continue}r.push({index:e,key:t.getKey(),length:t.getTextContent().length,node:t,start:i,type:`linebreak`}),i+=t.getTextContent().length}return{descriptors:r,paragraphKey:t.getKey(),paragraphSize:n.length,totalLength:i}}function dh(e){let{descriptors:t,paragraphKey:n,paragraphSize:r,totalLength:i}=uh(),a=Math.max(0,Math.min(e,i));if(t.length===0)return{key:n,offset:0,type:`element`};for(let e of t){let r=e.start+e.length;if(e.type===`text`&&a>=e.start&&a<=r)return{key:e.key,offset:a-e.start,type:`text`};if(e.type!==`text`){if(a===e.start)return{key:n,offset:e.index,type:`element`};if(a===r){let r=t[e.index+1];return r?.type===`text`&&r.length===0?{key:r.key,offset:0,type:`text`}:{key:n,offset:e.index+1,type:`element`}}}}return{key:n,offset:r,type:`element`}}function fh(e){let{descriptors:t,paragraphKey:n,totalLength:r}=uh();if(e.key===n){let n=t[e.offset-1];return n?n.start+n.length:0}let i=t.find(t=>t.key===e.key);return i?i.start+Math.min(e.offset,i.length):r}function ph(e){if(e.type===`element`)return fh(e);let{descriptors:t,totalLength:n}=uh(),r=t.find(t=>t.key===e.key);return r?r.start+Math.min(e.offset,r.length):n}function mh(){let{descriptors:e}=uh(),t=[],n=``,r=``,i=()=>{n.length!==0&&(t.push({id:r,type:`text`,text:n}),n=``,r=``)};for(let a of e){if(a.type===`text`){n.length===0&&(r=a.key),n+=a.text;continue}if(a.type===`linebreak`){n.length===0&&(r=a.key),n+=`
13
+ `;continue}i();let e=a.node;t.push({id:e.getComposerId(),label:e.getLabel(),tokenKey:e.getTokenKey(),tokenKind:e.getTokenKind(),type:`token`})}return i(),qm(t)}function hh(e){return e.read(()=>{let e=L(),t=mh();return I(e)?{nodes:t,selection:{start:ph(e.anchor),end:ph(e.focus)}}:{nodes:t,selection:null}})}function gh(e,t){let n=Lu();n.clear();let r=eu();n.append(r);for(let t of qm(e)){if(t.type===`token`){r.append(ch({composerId:t.id,label:t.label,tokenKey:t.tokenKey,tokenKind:t.tokenKind}));continue}let e=t.text.split(`
14
+ `);for(let[t,n]of e.entries())n.length>0&&r.append(Pc(n)),t<e.length-1&&r.append(gc())}if(lh(r.getLastChild())&&r.append(Pc(``)),!t)return;let i=nl(),a=dh(t.start),o=dh(t.end);i.anchor.set(a.key,a.offset,a.type),i.focus.set(o.key,o.offset,o.type),zu(i)}function _h(e,t,n){e.update(()=>{gh(t,n)})}function vh(e,t){e.update(()=>{let e=nl(),n=dh(t.start),r=dh(t.end);e.anchor.set(n.key,n.offset,n.type),e.focus.set(r.key,r.offset,r.type),zu(e)})}function yh(e){return e.reduce((e,t)=>e+Wm(t),0)}function bh(e){let{label:t,nodes:n,selection:r,tokenKey:i,tokenKind:a,trigger:o}=e,s=yh(n),c=o?.start??r?.start??s;return{nodes:nh(n,c,o?.end??r?.end??c,[Um({label:t,tokenKey:i,tokenKind:a})]),selection:{start:c+1,end:c+1}}}function xh(e){return e.map(e=>e.type===`text`?`text:${e.id}:${e.text}`:`token:${e.id}:${e.tokenKind}:${e.tokenKey}:${e.label}`).join(``)}function Sh(e){let{nodes:t,selection:n,text:r}=e,i=n??{start:yh(t),end:yh(t)},a=i.start+r.length;return{nodes:nh(t,i.start,i.end,[Hm(r)]),selection:{start:a,end:a}}}function Ch(e){let{label:t,nodes:n,selection:r,tokenKey:i}=e;return bh({label:t,nodes:n,selection:r,tokenKey:i,tokenKind:`file`})}function wh(e){let{label:t,nodes:n,selection:r,tokenKey:i}=e;return Xm(n,`skill`).includes(i)?{nodes:qm(n),selection:r}:bh({label:t,nodes:n,selection:r,tokenKey:i,tokenKind:`skill`,trigger:ih(n,r)})}function Th(e){let{nextKeys:t,nodes:n,options:r,selection:i}=e,a=Xm(n,`skill`),o=new Map(r.map(e=>[e.key,e])),s=t.find(e=>!a.includes(e));if(s)return wh({label:o.get(s)?.label??s,nodes:n,selection:i,tokenKey:s});let c=a.find(e=>!t.includes(e));return c?{nodes:rh(n,e=>e.tokenKind===`skill`&&e.tokenKey===c),selection:i}:{nodes:qm(n),selection:i}}function Eh(e){let{direction:t,nodes:n,selection:r}=e,i=yh(n),a=r??{start:i,end:i},o=a.start,s=a.end;if(a.start===a.end)if(t===`backward`&&a.start>0)o=a.start-1;else if(t===`forward`&&a.end<i)s=a.end+1;else return{nodes:qm(n),selection:a};return{nodes:nh(n,o,s,[]),selection:{start:o,end:o}}}function Dh(e){let{activeSlashIndex:t,canStopGeneration:n,isComposing:r,isSending:i,isSlashMenuOpen:a,key:o,shiftKey:s,slashItemCount:c}=e;if(o===`Enter`&&!s&&i)return{type:`consume`};if(a&&c>0){if(o===`ArrowDown`)return{type:`move-slash-index`,index:(t+1)%c};if(o===`ArrowUp`)return{type:`move-slash-index`,index:(t-1+c)%c};if(o===`Enter`&&!s||o===`Tab`)return{type:`insert-active-slash-item`}}return o===`Escape`?a?{type:`close-slash`}:i&&n?{type:`stop-generation`}:{type:`noop`}:o===`Enter`&&s?{type:`insert-line-break`}:o===`Enter`?{type:`send-message`}:!r&&(o===`Backspace`||o===`Delete`)?{type:`delete-content`,direction:o===`Backspace`?`backward`:`forward`}:{type:`noop`}}var Oh=class{constructor(e){this.params=e,this.insertSlashItem=e=>{e.value&&(this.params.onSlashItemSelect?.(e),this.params.publishSnapshot(wh({label:e.title,nodes:this.params.optionsReader().nodes,selection:this.params.optionsReader().selection,tokenKey:e.value}),{focusAfterSync:!0}))},this.insertFileToken=(e,t)=>{this.params.publishSnapshot(Ch({label:t,nodes:this.params.optionsReader().nodes,selection:this.params.optionsReader().selection,tokenKey:e}),{focusAfterSync:!0})},this.insertFileTokens=e=>{let t=this.params.optionsReader().nodes,n=this.params.optionsReader().selection;for(let r of e){let e=Ch({label:r.label,nodes:t,selection:n,tokenKey:r.tokenKey});t=e.nodes,n=e.selection}this.params.publishSnapshot({nodes:t,selection:n},{focusAfterSync:!0})},this.focusComposer=()=>{this.params.focusComposer()},this.syncSelectedSkills=(e,t)=>{this.params.publishSnapshot(Th({nextKeys:e,nodes:this.params.optionsReader().nodes,options:t,selection:this.params.optionsReader().selection}),{focusAfterSync:!0})}}};function kh(e){return new Oh(e)}function Ah(e){return JSON.stringify(e.map(e=>e.type===`text`?{text:e.text,type:e.type}:{label:e.label,tokenKey:e.tokenKey,tokenKind:e.tokenKind,type:e.type}))}function jh(e){let{disabled:t,event:n,isComposing:r,publishSnapshot:i,snapshotReader:a}=e,o=n.nativeEvent,s=o.inputType===`insertText`||o.inputType===`insertReplacementText`;t||r||o.isComposing||!s||!o.data||(n.preventDefault(),i(Sh({nodes:a().nodes,selection:a().selection,text:o.data})))}function Mh(e){let{data:t,fallbackSnapshot:n,publishSnapshot:r,snapshotReader:i}=e,a=i(),o=n();r(Ah(o.nodes)===Ah(a.nodes)&&t.length>0?Sh({nodes:a.nodes,selection:a.selection,text:t}):o,{forcePublish:!0})}function Nh(e){let{actions:t,activeSlashIndex:n,nativeEvent:r,onSlashActiveIndexChange:i,onSlashItemSelect:a,onSlashOpenChange:o,onSlashQueryChange:s,publishSnapshot:c,slashItems:l,snapshot:u}=e,d=Dh({activeSlashIndex:n,canStopGeneration:t.canStopGeneration,isComposing:r.isComposing,isSending:t.isSending,isSlashMenuOpen:ih(u.nodes,u.selection)!==null,key:r.key,shiftKey:r.shiftKey,slashItemCount:l.length}),f=l[n]??null;switch(d.type!==`noop`&&r.preventDefault(),d.type){case`move-slash-index`:return i(d.index),!0;case`insert-active-slash-item`:return f?(a?.(f),c(wh({label:f.title,nodes:u.nodes,selection:u.selection,tokenKey:f.value??f.key}),{focusAfterSync:!0}),!0):!0;case`close-slash`:return s?.(null),o(!1),!0;case`consume`:return!0;case`stop-generation`:return t.onStop(),!0;case`insert-line-break`:return c(Sh({nodes:u.nodes,selection:u.selection,text:`
15
+ `})),!0;case`send-message`:return t.onSend(),!0;case`delete-content`:return c(Eh({direction:d.direction,nodes:u.nodes,selection:u.selection})),!0;case`noop`:return!1}}function Ph(e){let[t]=ta();return(0,k.useLayoutEffect)(()=>(e.editorRef.current=t,()=>{e.editorRef.current===t&&(e.editorRef.current=null)}),[t,e.editorRef]),(0,k.useLayoutEffect)(()=>{t.setEditable(!e.disabled)},[t,e.disabled]),(0,k.useLayoutEffect)(()=>{let n=xh(e.nodes),r=e.pendingSelectionRef.current,i=n!==e.editorSignatureRef.current;if(!(!i&&!r)){if(e.isApplyingExternalUpdateRef.current=!0,i?(_h(t,e.nodes,r),e.editorSignatureRef.current=n,e.lastPublishedSignatureRef.current=n):r&&vh(t,r),r&&(e.selectionRef.current=r,e.pendingSelectionRef.current=null),e.shouldFocusAfterSyncRef.current){e.shouldFocusAfterSyncRef.current=!1;let n=e.selectionRef.current;t.focus(()=>{n&&vh(t,n)})}requestAnimationFrame(()=>{e.isApplyingExternalUpdateRef.current=!1})}},[t,e.editorSignatureRef,e.isApplyingExternalUpdateRef,e.lastPublishedSignatureRef,e.nodes,e.pendingSelectionRef,e.selectionRef,e.shouldFocusAfterSyncRef]),(0,k.useEffect)(()=>zf(t.registerUpdateListener(({editorState:t})=>{let n=hh(t),r=xh(n.nodes);e.selectionRef.current=n.selection,e.editorSignatureRef.current=r,e.syncSlashState(n.nodes,n.selection),!(e.isApplyingExternalUpdateRef.current||e.isComposingRef.current)&&r!==e.lastPublishedSignatureRef.current&&(e.lastPublishedSignatureRef.current=r,e.onNodesChange(n.nodes))}),t.registerCommand(Vo,()=>{let n=hh(t.getEditorState());return e.selectionRef.current=n.selection,e.isComposingRef.current||e.syncSlashState(n.nodes,n.selection),!1},0),t.registerCommand(Ts,()=>(e.onBlur(),!1),0),t.registerCommand(is,t=>e.onKeyDown(t),3)),[t,e.editorSignatureRef,e.isApplyingExternalUpdateRef,e.isComposingRef,e.lastPublishedSignatureRef,e.onBlur,e.onKeyDown,e.onNodesChange,e.selectionRef,e.syncSlashState]),null}var Fh=(0,k.forwardRef)(function(e,t){let n=(0,k.useRef)(null),r=(0,k.useRef)(null),i=(0,k.useRef)(null),a=(0,k.useRef)(!1),o=(0,k.useRef)(!1),s=(0,k.useRef)(!1),c=(0,k.useRef)(``),l=(0,k.useRef)(``),u=(t,n)=>{let r=ih(t,n);e.onSlashTriggerChange?.(r),e.onSlashQueryChange?.(r?.query??null),e.onSlashOpenChange(r!==null)},d=()=>e.nodes,f=()=>{if(r.current)return r.current;if(!n.current)return null;let e=hh(n.current.getEditorState());return r.current=e.selection,e.selection},p=(t,n)=>{r.current=t.selection,i.current=t.selection,n?.focusAfterSync&&(a.current=!0);let o=xh(t.nodes);u(t.nodes,t.selection),(n?.forcePublish||o!==l.current)&&(l.current=o,e.onNodesChange(t.nodes))},m=()=>{let e=n.current;if(!e)return;let t=r.current;e.focus(()=>{t&&vh(e,t)})},h=()=>({nodes:d(),selection:f()});return(0,k.useImperativeHandle)(t,()=>kh({focusComposer:m,onSlashItemSelect:e.onSlashItemSelect,optionsReader:h,publishSnapshot:p}),[e.onSlashItemSelect]),(0,A.jsxs)(fp,{initialConfig:(0,k.useMemo)(()=>({editable:!e.disabled,editorState:()=>{gh(e.nodes,null)},namespace:`NextClawChatComposerLexical`,nodes:[sh],onError:e=>{throw e},theme:{}}),[e.disabled,e.nodes]),children:[(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,A.jsx)(`div`,{className:`min-h-[60px]`,children:(0,A.jsx)(zm,{contentEditable:(0,A.jsx)(op,{className:`min-h-7 max-h-[188px] w-full overflow-y-auto whitespace-pre-wrap break-words bg-transparent py-0.5 text-sm leading-6 text-gray-800 outline-none`,onBeforeInput:t=>{jh({disabled:e.disabled,event:t,isComposing:o.current,publishSnapshot:p,snapshotReader:h})},onCompositionEnd:e=>{o.current=!1;let t=e.nativeEvent;Mh({data:typeof t.data==`string`?t.data:``,fallbackSnapshot:()=>{let e=n.current;return e?hh(e.getEditorState()):h()},publishSnapshot:p,snapshotReader:h})},onCompositionStart:()=>{o.current=!0},onPaste:t=>{let n=Array.from(t.clipboardData.files??[]);n.length>0&&e.onFilesAdd&&(t.preventDefault(),e.onFilesAdd(n))}}),placeholder:(0,A.jsx)(`div`,{className:`pointer-events-none absolute left-4 top-2.5 select-none text-sm leading-6 text-gray-400`,children:e.placeholder}),ErrorBoundary:vp})})}),(0,A.jsx)(pp,{editorRef:n}),(0,A.jsx)(Ph,{disabled:e.disabled,editorRef:n,editorSignatureRef:c,isApplyingExternalUpdateRef:s,isComposingRef:o,lastPublishedSignatureRef:l,nodes:e.nodes,onBlur:()=>{e.onSlashQueryChange?.(null),e.onSlashOpenChange(!1)},onKeyDown:t=>{let i=n.current;if(!i)return!1;let a=hh(i.getEditorState());return r.current=a.selection,Nh({actions:e.actions,activeSlashIndex:e.activeSlashIndex,nativeEvent:t,onSlashActiveIndexChange:e.onSlashActiveIndexChange,onSlashItemSelect:e.onSlashItemSelect,onSlashOpenChange:e.onSlashOpenChange,onSlashQueryChange:e.onSlashQueryChange,publishSnapshot:p,slashItems:e.slashItems,snapshot:a})},onNodesChange:e.onNodesChange,pendingSelectionRef:i,selectionRef:r,shouldFocusAfterSyncRef:a,syncSlashState:u})]})});Fh.displayName=`LexicalChatInputBarTokenizedComposer`;function Ih({hint:e}){return e?e.loading?(0,A.jsx)(`div`,{className:`px-4 pb-2`,children:(0,A.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2`,children:[(0,A.jsx)(`span`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,A.jsx)(`span`,{className:`h-3 w-16 animate-pulse rounded bg-gray-200`})]})}):(0,A.jsx)(`div`,{className:`px-4 pb-2`,children:(0,A.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs ${e.tone===`warning`?`border-amber-200 bg-amber-50 text-amber-800`:`border-gray-200 bg-gray-50 text-gray-700`}`,children:[e.text?(0,A.jsx)(`span`,{children:e.text}):null,e.actionLabel&&e.onAction?(0,A.jsx)(`button`,{type:`button`,onClick:e.onAction,className:`font-semibold underline-offset-2 hover:underline`,children:e.actionLabel}):null]})}):null}var Lh=(0,k.forwardRef)(function(e,t){let n=(0,k.useRef)(null),[r,i]=(0,k.useState)(null),[a,o]=(0,k.useState)(0),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(null),d=s!==null&&l!==s,f=e.slashMenu.items[a]??null;(0,k.useEffect)(()=>{o(t=>e.slashMenu.items.length===0?0:Math.min(t,e.slashMenu.items.length-1))},[e.slashMenu.items.length]),(0,k.useEffect)(()=>{r!==null&&o(0)},[r]),(0,k.useEffect)(()=>{s===null&&l!==null&&u(null)},[s,l]);let p=(0,k.useMemo)(()=>e.toolbar.skillPicker?{...e.toolbar,skillPicker:{...e.toolbar.skillPicker,onSelectedKeysChange:t=>{n.current?.syncSelectedSkills(t,e.toolbar.skillPicker?.options??[]),e.toolbar.skillPicker?.onSelectedKeysChange(t)}}}:e.toolbar,[e.toolbar]);return(0,k.useImperativeHandle)(t,()=>({insertFileToken:(e,t)=>n.current?.insertFileToken(e,t),insertFileTokens:e=>n.current?.insertFileTokens(e),focusComposer:()=>n.current?.focusComposer()}),[]),(0,A.jsx)(`div`,{className:`border-t border-gray-200/80 bg-white p-4`,children:(0,A.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)]`,children:(0,A.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-card`,children:[(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Fh,{ref:n,nodes:e.composer.nodes,placeholder:e.composer.placeholder,disabled:e.composer.disabled,slashItems:e.slashMenu.items,onSlashItemSelect:e.slashMenu.onSelectItem,actions:e.toolbar.actions,activeSlashIndex:a,onNodesChange:e.composer.onNodesChange,onFilesAdd:e.composer.onFilesAdd,onSlashQueryChange:t=>{i(t),e.composer.onSlashQueryChange?.(t)},onSlashTriggerChange:e=>{c(e?.start??null)},onSlashOpenChange:e=>{!e&&s!==null&&u(s)},onSlashActiveIndexChange:o}),(0,A.jsx)(Ri,{isOpen:d,isLoading:e.slashMenu.isLoading,items:e.slashMenu.items,activeIndex:a,activeItem:f,texts:e.slashMenu.texts,onSelectItem:e=>{u(null),n.current?.insertSlashItem(e)},onOpenChange:e=>{!e&&s!==null&&u(s)},onSetActiveIndex:o})]}),(0,A.jsx)(Ih,{hint:e.hint}),(0,A.jsx)(Qi,{...p})]})})})});Lh.displayName=`ChatInputBar`;function Rh({role:e}){return e===`user`?(0,A.jsx)(`div`,{"data-testid":`chat-message-avatar-user`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-white shadow-sm`,children:(0,A.jsx)(rt,{className:`h-4 w-4`})}):e===`tool`?(0,A.jsx)(`div`,{"data-testid":`chat-message-avatar-tool`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-700 shadow-sm`,children:(0,A.jsx)(Gt,{className:`h-4 w-4`})}):(0,A.jsx)(`div`,{"data-testid":`chat-message-avatar-assistant`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-b from-gray-700 to-gray-950 text-white shadow-md ring-1 ring-inset ring-white/20`,children:(0,A.jsx)(ht,{className:`h-[18px] w-[18px] text-white/95`,strokeWidth:2.5})})}function zh(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Bh=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vh=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hh={};function Uh(e,t){return((t||Hh).jsx?Vh:Bh).test(e)}var Wh=/[ \t\n\f\r]/g;function Gh(e){return typeof e==`object`?e.type===`text`?Kh(e.value):!1:Kh(e)}function Kh(e){return e.replace(Wh,``)===``}var qh=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};qh.prototype.normal={},qh.prototype.property={},qh.prototype.space=void 0;function Jh(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new qh(n,r,t)}function Yh(e){return e.toLowerCase()}var Xh=class{constructor(e,t){this.attribute=t,this.property=e}};Xh.prototype.attribute=``,Xh.prototype.booleanish=!1,Xh.prototype.boolean=!1,Xh.prototype.commaOrSpaceSeparated=!1,Xh.prototype.commaSeparated=!1,Xh.prototype.defined=!1,Xh.prototype.mustUseProperty=!1,Xh.prototype.number=!1,Xh.prototype.overloadedBoolean=!1,Xh.prototype.property=``,Xh.prototype.spaceSeparated=!1,Xh.prototype.space=void 0;var Zh=i({boolean:()=>G,booleanish:()=>$h,commaOrSpaceSeparated:()=>rg,commaSeparated:()=>ng,number:()=>K,overloadedBoolean:()=>eg,spaceSeparated:()=>tg}),Qh=0,G=ig(),$h=ig(),eg=ig(),K=ig(),tg=ig(),ng=ig(),rg=ig();function ig(){return 2**++Qh}var ag=Object.keys(Zh),og=class extends Xh{constructor(e,t,n,r){let i=-1;if(super(e,t),sg(this,`space`,r),typeof n==`number`)for(;++i<ag.length;){let e=ag[i];sg(this,ag[i],(n&Zh[e])===Zh[e])}}};og.prototype.defined=!0;function sg(e,t,n){n&&(e[t]=n)}function cg(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new og(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Yh(r)]=r,n[Yh(a.attribute)]=r}return new qh(t,n,e.space)}var lg=cg({properties:{ariaActiveDescendant:null,ariaAtomic:$h,ariaAutoComplete:null,ariaBusy:$h,ariaChecked:$h,ariaColCount:K,ariaColIndex:K,ariaColSpan:K,ariaControls:tg,ariaCurrent:null,ariaDescribedBy:tg,ariaDetails:null,ariaDisabled:$h,ariaDropEffect:tg,ariaErrorMessage:null,ariaExpanded:$h,ariaFlowTo:tg,ariaGrabbed:$h,ariaHasPopup:null,ariaHidden:$h,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tg,ariaLevel:K,ariaLive:null,ariaModal:$h,ariaMultiLine:$h,ariaMultiSelectable:$h,ariaOrientation:null,ariaOwns:tg,ariaPlaceholder:null,ariaPosInSet:K,ariaPressed:$h,ariaReadOnly:$h,ariaRelevant:null,ariaRequired:$h,ariaRoleDescription:tg,ariaRowCount:K,ariaRowIndex:K,ariaRowSpan:K,ariaSelected:$h,ariaSetSize:K,ariaSort:null,ariaValueMax:K,ariaValueMin:K,ariaValueNow:K,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ug(e,t){return t in e?e[t]:t}function dg(e,t){return ug(e,t.toLowerCase())}var fg=cg({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ng,acceptCharset:tg,accessKey:tg,action:null,allow:null,allowFullScreen:G,allowPaymentRequest:G,allowUserMedia:G,alt:null,as:null,async:G,autoCapitalize:null,autoComplete:tg,autoFocus:G,autoPlay:G,blocking:tg,capture:null,charSet:null,checked:G,cite:null,className:tg,cols:K,colSpan:null,content:null,contentEditable:$h,controls:G,controlsList:tg,coords:K|ng,crossOrigin:null,data:null,dateTime:null,decoding:null,default:G,defer:G,dir:null,dirName:null,disabled:G,download:eg,draggable:$h,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:G,formTarget:null,headers:tg,height:K,hidden:eg,high:K,href:null,hrefLang:null,htmlFor:tg,httpEquiv:tg,id:null,imageSizes:null,imageSrcSet:null,inert:G,inputMode:null,integrity:null,is:null,isMap:G,itemId:null,itemProp:tg,itemRef:tg,itemScope:G,itemType:tg,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:G,low:K,manifest:null,max:null,maxLength:K,media:null,method:null,min:null,minLength:K,multiple:G,muted:G,name:null,nonce:null,noModule:G,noValidate:G,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:G,optimum:K,pattern:null,ping:tg,placeholder:null,playsInline:G,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:G,referrerPolicy:null,rel:tg,required:G,reversed:G,rows:K,rowSpan:K,sandbox:tg,scope:null,scoped:G,seamless:G,selected:G,shadowRootClonable:G,shadowRootDelegatesFocus:G,shadowRootMode:null,shape:null,size:K,sizes:null,slot:null,span:K,spellCheck:$h,src:null,srcDoc:null,srcLang:null,srcSet:null,start:K,step:null,style:null,tabIndex:K,target:null,title:null,translate:null,type:null,typeMustMatch:G,useMap:null,value:$h,width:K,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tg,axis:null,background:null,bgColor:null,border:K,borderColor:null,bottomMargin:K,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:G,declare:G,event:null,face:null,frame:null,frameBorder:null,hSpace:K,leftMargin:K,link:null,longDesc:null,lowSrc:null,marginHeight:K,marginWidth:K,noResize:G,noHref:G,noShade:G,noWrap:G,object:null,profile:null,prompt:null,rev:null,rightMargin:K,rules:null,scheme:null,scrolling:$h,standby:null,summary:null,text:null,topMargin:K,valueType:null,version:null,vAlign:null,vLink:null,vSpace:K,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:G,disableRemotePlayback:G,prefix:null,property:null,results:K,security:null,unselectable:null},space:`html`,transform:dg}),pg=cg({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:rg,accentHeight:K,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:K,amplitude:K,arabicForm:null,ascent:K,attributeName:null,attributeType:null,azimuth:K,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:K,by:null,calcMode:null,capHeight:K,className:tg,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:K,diffuseConstant:K,direction:null,display:null,dur:null,divisor:K,dominantBaseline:null,download:G,dx:null,dy:null,edgeMode:null,editable:null,elevation:K,enableBackground:null,end:null,event:null,exponent:K,externalResourcesRequired:null,fill:null,fillOpacity:K,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:ng,g2:ng,glyphName:ng,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:K,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:K,horizOriginX:K,horizOriginY:K,id:null,ideographic:K,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:K,k:K,k1:K,k2:K,k3:K,k4:K,kernelMatrix:rg,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:K,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:K,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:K,overlineThickness:K,paintOrder:null,panose1:null,path:null,pathLength:K,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tg,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:K,pointsAtY:K,pointsAtZ:K,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rg,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rg,rev:rg,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rg,requiredFeatures:rg,requiredFonts:rg,requiredFormats:rg,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:K,specularExponent:K,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:K,strikethroughThickness:K,string:null,stroke:null,strokeDashArray:rg,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:K,strokeOpacity:K,strokeWidth:null,style:null,surfaceScale:K,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rg,tabIndex:K,tableValues:null,target:null,targetX:K,targetY:K,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rg,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:K,underlineThickness:K,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:K,values:null,vAlphabetic:K,vMathematical:K,vectorEffect:null,vHanging:K,vIdeographic:K,version:null,vertAdvY:K,vertOriginX:K,vertOriginY:K,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:K,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ug}),mg=cg({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()}}),hg=cg({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:dg}),gg=cg({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),_g={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`},vg=/[A-Z]/g,yg=/-[a-z]/g,bg=/^data[-\w.:]+$/i;function xg(e,t){let n=Yh(t),r=t,i=Xh;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&bg.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(yg,Cg);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!yg.test(e)){let n=e.replace(vg,Sg);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=og}return new i(r,t)}function Sg(e){return`-`+e.toLowerCase()}function Cg(e){return e.charAt(1).toUpperCase()}var wg=Jh([lg,fg,mg,hg,gg],`html`),Tg=Jh([lg,pg,mg,hg,gg],`svg`);function Eg(e){return e.join(` `).trim()}var Dg=a(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
16
+ `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Og=a((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Dg());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),kg=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Ag=a(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Og()),r=kg();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),jg=Ng(`end`),Mg=Ng(`start`);function Ng(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Pg(e){let t=Mg(e),n=jg(e);if(t&&n)return{start:t,end:n}}function Fg(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Lg(e.position):`start`in e||`end`in e?Lg(e):`line`in e||`column`in e?Ig(e):``}function Ig(e){return Rg(e&&e.line)+`:`+Rg(e&&e.column)}function Lg(e){return Ig(e&&e.start)+`-`+Ig(e&&e.end)}function Rg(e){return e&&typeof e==`number`?e:1}var zg=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Fg(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};zg.prototype.file=``,zg.prototype.name=``,zg.prototype.reason=``,zg.prototype.message=``,zg.prototype.stack=``,zg.prototype.column=void 0,zg.prototype.line=void 0,zg.prototype.ancestors=void 0,zg.prototype.cause=void 0,zg.prototype.fatal=void 0,zg.prototype.place=void 0,zg.prototype.ruleId=void 0,zg.prototype.source=void 0;var Bg=e(Ag(),1),Vg={}.hasOwnProperty,Hg=new Map,Ug=/[A-Z]/g,Wg=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Gg=new Set([`td`,`th`]),Kg=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function qg(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=i_(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=r_(n,t.jsx,t.jsxs)}let 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`?Tg:wg,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Jg(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Jg(e,t,n){if(t.type===`element`)return Yg(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Xg(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Qg(e,t,n);if(t.type===`mdxjsEsm`)return Zg(e,t);if(t.type===`root`)return $g(e,t,n);if(t.type===`text`)return e_(e,t)}function Yg(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Tg,e.schema=i),e.ancestors.push(t);let a=u_(e,t.tagName,!1),o=a_(e,t),s=s_(e,t);return Wg.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Gh(e):!0})),t_(e,o,a,t),n_(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Xg(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}d_(e,t.position)}function Zg(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);d_(e,t.position)}function Qg(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Tg,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:u_(e,t.name,!0),o=o_(e,t),s=s_(e,t);return t_(e,o,a,t),n_(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function $g(e,t,n){let r={};return n_(r,s_(e,t)),e.create(t,e.Fragment,r,n)}function e_(e,t){return t.value}function t_(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function n_(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function r_(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function i_(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Mg(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function a_(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Vg.call(t.properties,i)){let a=c_(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Gg.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function o_(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else d_(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else d_(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function s_(e,t){let n=[],r=-1,i=e.passKeys?new Map:Hg;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Jg(e,a,o);s!==void 0&&n.push(s)}return n}function c_(e,t,n){let r=xg(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?zh(n):Eg(n)),r.property===`style`){let t=typeof n==`object`?n:l_(e,String(n));return e.stylePropertyNameCase===`css`&&(t=f_(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?_g[r.property]||r.property:r.attribute,n]}}function l_(e,t){try{return(0,Bg.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new zg("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Kg+`#cannot-parse-style-attribute`,r}}function u_(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Uh(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Uh(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Vg.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);d_(e)}function d_(e,t){let n=new zg("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=Kg+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function f_(e){let t={},n;for(n in e)Vg.call(e,n)&&(t[p_(n)]=e[n]);return t}function p_(e){let t=e.replace(Ug,m_);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function m_(e){return`-`+e.toLowerCase()}var h_={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`]},g_={};function __(e,t){let n=t||g_;return v_(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function v_(e,t,n){if(b_(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 y_(e.children,t,n)}return Array.isArray(e)?y_(e,t,n):``}function y_(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=v_(e[i],t,n);return r.join(``)}function b_(e){return!!(e&&typeof e==`object`)}var x_=document.createElement(`i`);function S_(e){let t=`&`+e+`;`;x_.innerHTML=t;let n=x_.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function C_(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function w_(e,t){return e.length>0?(C_(e,e.length,0,t),e):t}var T_={}.hasOwnProperty;function E_(e){let t={},n=-1;for(;++n<e.length;)D_(t,e[n]);return t}function D_(e,t){let n;for(n in t){let r=(T_.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){T_.call(r,a)||(r[a]=[]);let e=i[a];O_(r[a],Array.isArray(e)?e:e?[e]:[])}}}function O_(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);C_(e,0,0,r)}function k_(e,t){let 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 A_(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var j_=B_(/[A-Za-z]/),M_=B_(/[\dA-Za-z]/),N_=B_(/[#-'*+\--9=?A-Z^-~]/);function P_(e){return e!==null&&(e<32||e===127)}var F_=B_(/\d/),I_=B_(/[\dA-Fa-f]/),L_=B_(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var R_=B_(/\p{P}|\p{S}/u),z_=B_(/\s/);function B_(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function V_(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&M_(e.charCodeAt(n+1))&&M_(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var H_={tokenize:U_};function U_(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var W_={tokenize:K_},G_={tokenize:q_};function K_(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return C_(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(G_,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(G_,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return q(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;C_(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function q_(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function J_(e){if(e===null||J(e)||z_(e))return 1;if(R_(e))return 2}function Y_(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var X_={name:`attention`,resolveAll:Z_,tokenize:Q_};function Z_(e,t){let n=-1,r,i,a,o,s,c,l,u;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;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};$_(d,-c),$_(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=w_(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=w_(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=w_(l,Y_(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=w_(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=w_(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,C_(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Q_(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=J_(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=J_(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function $_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ev={name:`autolink`,tokenize:tv};function tv(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return j_(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||M_(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||M_(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||P_(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):N_(t)?(e.consume(t),l):n(t)}function u(e){return M_(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||M_(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var nv={partial:!0,tokenize:rv};function rv(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||q(e)?t(e):n(e)}}var iv={continuation:{tokenize:ov},exit:sv,name:`blockQuote`,tokenize:av};function av(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Y(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ov(e,t,n){let r=this;return i;function i(t){return Y(t)?X(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(iv,t,n)(r)}}function sv(e){e.exit(`blockQuote`)}var cv={name:`characterEscape`,tokenize:lv};function lv(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return L_(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var uv={name:`characterReference`,tokenize:dv};function dv(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=M_,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=I_,u):(e.enter(`characterReferenceValue`),a=7,o=F_,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===M_&&!S_(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var fv={partial:!0,tokenize:hv},pv={concrete:!0,name:`codeFenced`,tokenize:mv};function mv(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(fv,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),X(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(fv,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function hv(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var gv={name:`codeIndented`,tokenize:vv},_v={partial:!0,tokenize:yv};function vv(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),X(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):q(t)?e.attempt(_v,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function yv(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):X(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):q(e)?i(e):n(e)}}var bv={name:`codeText`,previous:Sv,resolve:xv,tokenize:Cv};function xv(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 Sv(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Cv(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var wv=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Tv(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Tv(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Tv(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Tv(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Tv(this.left,t.reverse())}}};function Tv(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 Ev(e){let t={},n=-1,r,i,a,o,s,c,l,u=new wv(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Dv(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return C_(e,0,1/0,u.slice(0)),!l}function Dv(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Ov={resolve:Av,tokenize:jv},kv={partial:!0,tokenize:Mv};function Av(e){return Ev(e),e}function jv(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):q(t)?e.check(kv,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Mv(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,a,`linePrefix`)}function a(i){if(i===null||q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Nv(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||P_(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||P_(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Pv(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Fv(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Iv(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Lv={name:`definition`,tokenize:zv},Rv={partial:!0,tokenize:Bv};function zv(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Pv.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=A_(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?Iv(e,l)(t):l(t)}function l(t){return Nv(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Rv,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Bv(e,t,n){return r;function r(t){return J(t)?Iv(e,i)(t):n(t)}function i(t){return Fv(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var Vv={name:`hardBreakEscape`,tokenize:Hv};function Hv(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Uv={name:`headingAtx`,resolve:Wv,tokenize:Gv};function Wv(e,t){let n=e.length-2,r=3,i,a;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},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},C_(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Gv(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Kv=`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`.split(`.`),qv=[`pre`,`script`,`style`,`textarea`],Jv={concrete:!0,name:`htmlFlow`,resolveTo:Zv,tokenize:Qv},Yv={partial:!0,tokenize:ey},Xv={partial:!0,tokenize:$v};function Zv(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 Qv(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):j_(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):j_(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:te:m):n(i)}function h(t){return j_(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&qv.includes(l)?(i=1,r.interrupt?t(s):te(s)):Kv.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):te(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||M_(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:te):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||j_(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||M_(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||q(t)?te(t):Y(t)?(e.consume(t),ee):n(t)}function te(t){return t===45&&i===2?(e.consume(t),D):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),O):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Yv,le,ne)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),ne(t)):(e.consume(t),te)}function ne(t){return e.check(Xv,re,le)(t)}function re(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return t===null||q(t)?ne(t):(e.enter(`htmlFlowData`),te(t))}function D(t){return t===45?(e.consume(t),ce):te(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):te(t)}function oe(t){if(t===62){let n=o.toLowerCase();return qv.includes(n)?(e.consume(t),O):te(t)}return j_(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):te(t)}function se(t){return t===93?(e.consume(t),ce):te(t)}function ce(t){return t===62?(e.consume(t),O):t===45&&i===2?(e.consume(t),ce):te(t)}function O(t){return t===null||q(t)?(e.exit(`htmlFlowData`),le(t)):(e.consume(t),O)}function le(n){return e.exit(`htmlFlow`),t(n)}}function $v(e,t,n){let r=this;return i;function i(t){return q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function ey(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(nv,t,n)}}var ty={name:`htmlText`,tokenize:ny};function ny(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):j_(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):j_(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?D(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?D(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?D(t):q(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?D(e):y(e)}function x(t){return j_(t)?(e.consume(t),S):n(t)}function S(t){return t===45||M_(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,ae(t)):Y(t)?(e.consume(t),C):D(t)}function w(t){return t===45||M_(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),D):t===58||t===95||j_(t)?(e.consume(t),E):q(t)?(o=T,ae(t)):Y(t)?(e.consume(t),T):D(t)}function E(t){return t===45||t===46||t===58||t===95||M_(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),te):q(t)?(o=ee,ae(t)):Y(t)?(e.consume(t),ee):T(t)}function te(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ne):q(t)?(o=te,ae(t)):Y(t)?(e.consume(t),te):(e.consume(t),re)}function ne(t){return t===i?(e.consume(t),i=void 0,ie):t===null?n(t):q(t)?(o=ne,ae(t)):(e.consume(t),ne)}function re(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),re)}function ie(e){return e===47||e===62||J(e)?T(e):n(e)}function D(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return Y(t)?X(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var ry={name:`labelEnd`,resolveAll:sy,resolveTo:cy,tokenize:ly},iy={tokenize:uy},ay={tokenize:dy},oy={tokenize:fy};function sy(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&C_(e,0,e.length,n),e}function cy(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=w_(s,e.slice(a+1,a+r+3)),s=w_(s,[[`enter`,u,t]]),s=w_(s,Y_(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=w_(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=w_(s,e.slice(o+1)),s=w_(s,[[`exit`,c,t]]),C_(e,a,e.length,s),e}function ly(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(A_(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(iy,u,o?u:d)(t):t===91?e.attempt(ay,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(oy,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function uy(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?Iv(e,a)(t):a(t)}function a(t){return t===41?u(t):Nv(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?Iv(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Fv(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?Iv(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function dy(e,t,n){let r=this;return i;function i(t){return Pv.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(A_(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function fy(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var py={name:`labelStartImage`,resolveAll:ry.resolveAll,tokenize:my};function my(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var hy={name:`labelStartLink`,resolveAll:ry.resolveAll,tokenize:gy};function gy(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var _y={name:`lineEnding`,tokenize:vy};function vy(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var yy={name:`thematicBreak`,tokenize:by};function by(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var xy={continuation:{tokenize:Ty},exit:Dy,name:`list`,tokenize:wy},Sy={partial:!0,tokenize:Oy},Cy={partial:!0,tokenize:Ey};function wy(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:F_(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(yy,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return F_(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(nv,r.interrupt?n:u,e.attempt(Sy,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Ty(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(nv,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Cy,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(xy,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Ey(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Dy(e){e.exit(this.containerState.type)}function Oy(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ky={name:`setextUnderline`,resolveTo:Ay,tokenize:jy};function Ay(e,t){let n=e.length,r,i,a;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),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function jy(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var My={tokenize:Ny};function Ny(e){let t=this,n=e.attempt(nv,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Ov,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Py={resolveAll:Ry()},Fy=Ly(`string`),Iy=Ly(`text`);function Ly(e){return{resolveAll:Ry(e===`text`?zy:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Ry(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function zy(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var By=i({attentionMarkers:()=>Jy,contentInitial:()=>Hy,disable:()=>Yy,document:()=>Vy,flow:()=>Wy,flowInitial:()=>Uy,insideSpan:()=>qy,string:()=>Gy,text:()=>Ky}),Vy={42:xy,43:xy,45:xy,48:xy,49:xy,50:xy,51:xy,52:xy,53:xy,54:xy,55:xy,56:xy,57:xy,62:iv},Hy={91:Lv},Uy={[-2]:gv,[-1]:gv,32:gv},Wy={35:Uv,42:yy,45:[ky,yy],60:Jv,61:ky,95:yy,96:pv,126:pv},Gy={38:uv,92:cv},Ky={[-5]:_y,[-4]:_y,[-3]:_y,33:py,38:uv,42:X_,60:[ev,ty],91:hy,92:[Vv,cv],93:ry,95:X_,96:bv},qy={null:[X_,Py]},Jy={null:[42,95]},Yy={null:[]};function Xy(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=w_(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Y_(a,l.events,l),l.events):[]}function f(e,t){return Qy(p(e),t)}function p(e){return Zy(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){q(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&C_(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Zy(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Qy(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
17
+ `;break;case-3:o=`\r
18
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function $y(e){let t={constructs:E_([By,...(e||{}).extensions||[]]),content:n(H_),defined:[],document:n(W_),flow:n(My),lazy:{},string:n(Fy),text:n(Iy)};return t;function n(e){return n;function n(n){return Xy(t,e,n)}}}function eb(e){for(;!Ev(e););return e}var tb=/[\0\t\n\r]/g;function nb(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(tb.lastIndex=u,c=tb.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var rb=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ib(e){return e.replace(rb,ab)}function ab(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return k_(n.slice(t?2:1),t?16:10)}return S_(n)||e}var ob={}.hasOwnProperty;function sb(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),cb(n)(eb($y(n).document().write(nb()(e,t,!0))))}function cb(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Ee),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(Se),blockQuote:a(_e),characterEscape:T,characterReference:T,codeFenced:a(ve),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ve,o),codeText:a(ye,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(be),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(xe),hardBreakEscape:a(Ce),hardBreakTrailing:a(Ce),htmlFlow:a(we,o),htmlFlowData:T,htmlText:a(we,o),htmlTextData:T,image:a(Te),label:o,link:a(Ee),listItem:a(Oe),listItemValue:f,listOrdered:a(De,d),listUnordered:a(De),paragraph:a(ke),reference:ue,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Se),strong:a(Ae),thematicBreak:a(Me)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ge,autolinkProtocol:he,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:pe,characterReference:me,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ie),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(te),hardBreakTrailing:c(te),htmlFlow:c(ne),htmlFlowData:E,htmlText:c(re),htmlTextData:E,image:c(ae),label:se,labelText:oe,lineEnding:ee,link:c(D),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:de,resourceDestinationString:ce,resourceTitleString:O,resource:le,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};ub(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];ob.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||fb).call(a,void 0,e[0])}for(r.position={start:lb(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:lb(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:lb(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||fb).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Fg({start:e.start,end:e.end})+`): it’s not open`);n.position.end=lb(e.end)}function u(){return __(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=A_(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=je(),n.position={start:lb(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=lb(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=lb(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function te(){this.data.atHardBreak=!0}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function D(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ae(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function oe(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=ib(t),n.identifier=A_(t).toLowerCase()}function se(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function O(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function le(){this.data.inReference=void 0}function ue(){this.data.referenceType=`collapsed`}function de(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=A_(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function fe(e){this.data.characterReferenceType=e.type}function pe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=k_(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=S_(t);let i=this.stack[this.stack.length-1];i.value+=r}function me(e){let t=this.stack.pop();t.position.end=lb(e.end)}function he(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ge(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function _e(){return{type:`blockquote`,children:[]}}function ve(){return{type:`code`,lang:null,meta:null,value:``}}function ye(){return{type:`inlineCode`,value:``}}function be(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function xe(){return{type:`emphasis`,children:[]}}function Se(){return{type:`heading`,depth:0,children:[]}}function Ce(){return{type:`break`}}function we(){return{type:`html`,value:``}}function Te(){return{type:`image`,title:null,url:``,alt:null}}function Ee(){return{type:`link`,title:null,url:``,children:[]}}function De(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Oe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function ke(){return{type:`paragraph`,children:[]}}function Ae(){return{type:`strong`,children:[]}}function je(){return{type:`text`,value:``}}function Me(){return{type:`thematicBreak`}}}function lb(e){return{line:e.line,column:e.column,offset:e.offset}}function ub(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?ub(e,r):db(e,r)}}function db(e,t){let n;for(n in t)if(ob.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function fb(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Fg({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fg({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Fg({start:t.start,end:t.end})+`) is still open`)}function pb(e){let t=this;t.parser=n;function n(n){return sb(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function mb(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function hb(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
19
+ `}]}function gb(e,t){let n=t.value?t.value+`
20
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function _b(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vb(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yb(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=V_(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function bb(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xb(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Sb(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Cb(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sb(e,t);let i={src:V_(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function wb(e,t){let n={src:V_(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Tb(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Eb(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sb(e,t);let i={href:V_(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Db(e,t){let n={href:V_(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ob(e,t,n){let r=e.all(t),i=n?kb(n):Ab(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
21
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
22
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function kb(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Ab(n[r])}return t}function Ab(e){return e.spread??e.children.length>1}function jb(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Mb(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Nb(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Pb(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fb(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Mg(t.children[1]),o=jg(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Ib(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Lb(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Rb=9,zb=32;function Bb(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Vb(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Vb(t.slice(i),i>0,!1)),a.join(``)}function Vb(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Rb||t===zb;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Rb||t===zb;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Hb(e,t){let n={type:`text`,value:Bb(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Ub(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Wb={blockquote:mb,break:hb,code:gb,delete:_b,emphasis:vb,footnoteReference:yb,heading:bb,html:xb,imageReference:Cb,image:wb,inlineCode:Tb,linkReference:Eb,link:Db,listItem:Ob,list:jb,paragraph:Mb,root:Nb,strong:Pb,table:Fb,tableCell:Lb,tableRow:Ib,text:Hb,thematicBreak:Ub,toml:Gb,yaml:Gb,definition:Gb,footnoteDefinition:Gb};function Gb(){}var Kb=typeof self==`object`?self:globalThis,qb=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new Kb[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new Kb[a](o),i)};return r},Jb=e=>qb(new Map,e)(0),Yb=``,{toString:Xb}={},{keys:Zb}=Object,Qb=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Xb.call(e).slice(8,-1);switch(n){case`Array`:return[1,Yb];case`Object`:return[2,Yb];case`Date`:return[3,Yb];case`RegExp`:return[4,Yb];case`Map`:return[5,Yb];case`Set`:return[6,Yb];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},$b=([e,t])=>e===0&&(t===`function`||t===`symbol`),ex=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Qb(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Zb(r))(e||!$b(Qb(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!($b(Qb(n))||$b(Qb(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!$b(Qb(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},tx=(e,{json:t,lossy:n}={})=>{let r=[];return ex(!(t||n),!!t,new Map,r)(e),r},nx=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Jb(tx(e,t)):structuredClone(e):(e,t)=>Jb(tx(e,t));function rx(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function ix(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function ax(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||rx,r=e.options.footnoteBackLabel||ix,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=V_(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...nx(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
23
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
24
+ `}]}}var ox=(function(e){if(e==null)return dx;if(typeof e==`function`)return ux(e);if(typeof e==`object`)return Array.isArray(e)?sx(e):cx(e);if(typeof e==`string`)return lx(e);throw Error(`Expected function, string, or object as test`)});function sx(e){let t=[],n=-1;for(;++n<e.length;)t[n]=ox(e[n]);return ux(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function cx(e){let t=e;return ux(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function lx(e){return ux(t);function t(t){return t&&t.type===e}}function ux(e){return t;function t(t,n,r){return!!(fx(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function dx(){return!0}function fx(e){return typeof e==`object`&&!!e&&`type`in e}function px(e){return e}var mx=[];function hx(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=ox(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+px(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=mx,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=gx(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function gx(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?mx:[e]}function _x(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),hx(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var vx={}.hasOwnProperty,yx={};function bx(e,t){let n=t||yx,r=new Map,i=new Map,a={all:s,applyData:Sx,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Wb,...n.handlers},one:o,options:n,patch:xx,wrap:wx};return _x(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(vx.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=nx(n);return r.children=a.all(e),r}return nx(e)}return(a.options.unknownHandler||Cx)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=Tx(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Tx(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function xx(e,t){e.position&&(t.position=Pg(e))}function Sx(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,nx(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Cx(e,t){let n=t.data||{},r=`value`in t&&!(vx.call(n,`hProperties`)||vx.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 wx(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
25
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
26
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
27
+ `}),n}function Tx(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ex(e,t){let n=bx(e,t),r=n.one(e,void 0),i=ax(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
28
+ `},i)),a}function Dx(e,t){return e&&`run`in e?async function(n,r){let i=Ex(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Ex(n,{file:r,...e||t})}}function Ox(e){if(e)throw e}var kx=a(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Ax(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function jx(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Mx(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Mx(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Nx={basename:Px,dirname:Fx,extname:Ix,join:Lx,sep:`/`};function Px(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Bx(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Fx(e){if(Bx(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||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Ix(e){Bx(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Lx(...e){let t=-1,n;for(;++t<e.length;)Bx(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Rx(n)}function Rx(e){Bx(e);let t=e.codePointAt(0)===47,n=zx(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function zx(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Bx(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Vx={cwd:Hx};function Hx(){return`/`}function Ux(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Wx(e){if(typeof e==`string`)e=new URL(e);else if(!Ux(e)){let t=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:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Gx(e)}function Gx(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Kx=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],qx=class{constructor(e){let t;t=e?Ux(e)?{path:e}:typeof e==`string`||Zx(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Vx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Kx.length;){let e=Kx[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Kx.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Nx.basename(this.path):void 0}set basename(e){Yx(e,`basename`),Jx(e,`basename`),this.path=Nx.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Nx.dirname(this.path):void 0}set dirname(e){Xx(this.basename,`dirname`),this.path=Nx.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Nx.extname(this.path):void 0}set extname(e){if(Jx(e,`extname`),Xx(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Nx.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Ux(e)&&(e=Wx(e)),Yx(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Nx.basename(this.path,this.extname):void 0}set stem(e){Yx(e,`stem`),Jx(e,`stem`),this.path=Nx.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new zg(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Jx(e,t){if(e&&e.includes(Nx.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Nx.sep+"`")}function Yx(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Xx(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Zx(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Qx=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),$x=e(kx(),1),eS={}.hasOwnProperty,tS=new class e extends Qx{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=jx()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,$x.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(iS(`data`,this.frozen),this.namespace[e]=t,this):eS.call(this.namespace,e)&&this.namespace[e]||void 0:e?(iS(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=sS(e),n=this.parser||this.Parser;return nS(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),nS(`process`,this.parser||this.Parser),rS(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=sS(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);lS(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),nS(`processSync`,this.parser||this.Parser),rS(`processSync`,this.compiler||this.Compiler),this.process(e,r),oS(`processSync`,`process`,t),n;function r(e,r){t=!0,Ox(e),n=r}}run(e,t,n){aS(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=sS(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),oS(`runSync`,`run`,n),r;function i(e,t){Ox(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=sS(t),r=this.compiler||this.Compiler;return rS(`stringify`,r),aS(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(iS(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw 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(e.plugins),e.settings&&(r.settings=(0,$x.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Ax(o)&&Ax(r)&&(r=(0,$x.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function nS(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function rS(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function iS(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function aS(e){if(!Ax(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function oS(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function sS(e){return cS(e)?e:new qx(e)}function cS(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function lS(e){return typeof e==`string`||uS(e)}function uS(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var dS=[],fS={allowDangerousHtml:!0},pS=/^(https?|ircs?|mailto|xmpp)$/i,mS=[{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 hS(e){let t=gS(e),n=_S(e);return vS(t.runSync(t.parse(n),n),e)}function gS(e){let t=e.rehypePlugins||dS,n=e.remarkPlugins||dS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fS}:fS;return tS().use(pb).use(n).use(Dx,r).use(t)}function _S(e){let t=e.children||``,n=new qx;return typeof t==`string`?n.value=t:``+t,n}function vS(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||yS;for(let e of mS)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return _x(e,l),qg(e,{Fragment:A.Fragment,components:i,ignoreInvalidStyle:!0,jsx:A.jsx,jsxs:A.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in h_)if(Object.hasOwn(h_,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=h_[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function yS(e){let 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||pS.test(e.slice(0,t))?e:``}function bS(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function xS(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function SS(e,t,n){let r=ox((n||{}).ignore||[]),i=CS(t),a=-1;for(;++a<i.length;)hx(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function CS(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([wS(e[0]),TS(e[1])])}return t}function wS(e){return typeof e==`string`?new RegExp(xS(e),`g`):e}function TS(e){return typeof e==`function`?e:function(){return e}}var ES=`phrasing`,DS=[`autolink`,`link`,`image`,`label`];function OS(){return{transforms:[IS],enter:{literalAutolink:AS,literalAutolinkEmail:jS,literalAutolinkHttp:jS,literalAutolinkWww:jS},exit:{literalAutolink:FS,literalAutolinkEmail:PS,literalAutolinkHttp:MS,literalAutolinkWww:NS}}}function kS(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:ES,notInConstruct:DS},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:ES,notInConstruct:DS},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:ES,notInConstruct:DS}]}}function AS(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function jS(e){this.config.enter.autolinkProtocol.call(this,e)}function MS(e){this.config.exit.autolinkProtocol.call(this,e)}function NS(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function PS(e){this.config.exit.autolinkEmail.call(this,e)}function FS(e){this.exit(e)}function IS(e){SS(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,LS],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,RS]],{ignore:[`link`,`linkReference`]})}function LS(e,t,n,r,i){let a=``;if(!VS(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!zS(n)))return!1;let o=BS(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function RS(e,t,n,r){return!VS(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function zS(e){let 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 BS(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=bS(e,`(`),a=bS(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function VS(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||z_(n)||R_(n))&&(!t||n!==47)}ZS.peek=XS;function HS(){this.buffer()}function US(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function WS(){this.buffer()}function GS(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function KS(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=A_(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qS(e){this.exit(e)}function JS(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=A_(this.sliceSerialize(e)).toLowerCase(),n.label=t}function YS(e){this.exit(e)}function XS(){return`[`}function ZS(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function QS(){return{enter:{gfmFootnoteCallString:HS,gfmFootnoteCall:US,gfmFootnoteDefinitionLabelString:WS,gfmFootnoteDefinition:GS},exit:{gfmFootnoteCallString:KS,gfmFootnoteCall:qS,gfmFootnoteDefinitionLabelString:JS,gfmFootnoteDefinition:YS}}}function $S(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ZS},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
29
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?tC:eC))),s(),o}}function eC(e,t,n){return t===0?e:tC(e,t,n)}function tC(e,t,n){return(n?``:` `)+e}var nC=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];sC.peek=cC;function rC(){return{canContainEols:[`delete`],enter:{strikethrough:aC},exit:{strikethrough:oC}}}function iC(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:nC}],handlers:{delete:sC}}}function aC(e){this.enter({type:`delete`,children:[]},e)}function oC(e){this.exit(e)}function sC(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function cC(){return`~`}function lC(e){return e.length}function uC(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||lC,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=dC(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=fC(r[d]);else{let e=fC(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
30
+ `)}function dC(e){return e==null?``:String(e)}function fC(e){let 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 pC(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),mC);return i(),o}function mC(e,t,n){return`>`+(n?``:` `)+e}function hC(e,t){return gC(e,t.inConstruct,!0)&&!gC(e,t.notInConstruct,!1)}function gC(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 _C(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
31
+ `&&hC(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
32
+ `}function vC(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function yC(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 bC(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function xC(e,t,n,r){let i=bC(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(yC(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,SC);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(vC(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
33
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
34
+ `),a&&(u+=s.move(a+`
35
+ `)),u+=s.move(c),l(),u}function SC(e,t,n){return(n?``:` `)+e}function CC(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function wC(e,t,n,r){let i=CC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
36
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function TC(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function EC(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function DC(e,t,n){let r=J_(e),i=J_(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}}OC.peek=kC;function OC(e,t,n,r){let i=TC(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=DC(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=EC(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=DC(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+EC(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function kC(e,t,n){return n.options.emphasis||`*`}function AC(e,t){let n=!1;return _x(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&__(e)&&(t.options.setext||n))}function jC(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(AC(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
37
+ `,after:`
38
+ `});return r(),t(),o+`
39
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
40
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
41
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=EC(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}MC.peek=NC;function MC(e){return e.value||``}function NC(){return`<`}PC.peek=FC;function PC(e,t,n,r){let i=CC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function FC(){return`!`}IC.peek=LC;function IC(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function LC(){return`!`}RC.peek=zC;function RC(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function zC(){return"`"}function BC(e,t){let n=__(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))}VC.peek=HC;function VC(e,t,n,r){let i=CC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(BC(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function HC(e,t,n){return BC(e,n)?`<`:`[`}UC.peek=WC;function UC(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function WC(){return`[`}function GC(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function KC(e){let t=GC(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function qC(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function JC(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function YC(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?qC(n):GC(n),s=e.ordered?o===`.`?`)`:`.`:KC(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.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&&(c=!0),JC(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function XC(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function ZC(e,t,n,r){let i=XC(n),a=n.bulletCurrent||GC(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function QC(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var $C=ox([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function ew(e,t,n,r){return(e.children.some(function(e){return $C(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function tw(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}nw.peek=rw;function nw(e,t,n,r){let i=tw(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=DC(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=EC(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=DC(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+EC(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function rw(e,t,n){return n.options.strong||`*`}function iw(e,t,n,r){return n.safe(e.value,r)}function aw(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ow(e,t,n){let r=(JC(n)+(n.options.ruleSpaces?` `:``)).repeat(aw(n));return n.options.ruleSpaces?r.slice(0,-1):r}var sw={blockquote:pC,break:_C,code:xC,definition:wC,emphasis:OC,hardBreak:_C,heading:jC,html:MC,image:PC,imageReference:IC,inlineCode:RC,link:VC,linkReference:UC,list:YC,listItem:ZC,paragraph:QC,root:ew,strong:nw,text:iw,thematicBreak:ow};function cw(){return{enter:{table:lw,tableData:pw,tableHeader:pw,tableRow:dw},exit:{codeText:mw,table:uw,tableData:fw,tableHeader:fw,tableRow:fw}}}function lw(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function uw(e){this.exit(e),this.data.inTable=void 0}function dw(e){this.enter({type:`tableRow`,children:[]},e)}function fw(e){this.exit(e)}function pw(e){this.enter({type:`tableCell`,children:[]},e)}function mw(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,hw));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function hw(e,t){return t===`|`?t:e}function gw(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
42
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
43
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return uC(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=sw.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function _w(){return{exit:{taskListCheckValueChecked:yw,taskListCheckValueUnchecked:yw,paragraph:bw}}}function vw(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:xw}}}function yw(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function bw(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function xw(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=sw.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Sw(){return[OS(),QS(),rC(),cw(),_w()]}function Cw(e){return{extensions:[kS(),$S(e),iC(),gw(e),vw()]}}var ww={tokenize:Rw,partial:!0},Tw={tokenize:zw,partial:!0},Ew={tokenize:Bw,partial:!0},Dw={tokenize:Vw,partial:!0},Ow={tokenize:Hw,partial:!0},kw={name:`wwwAutolink`,tokenize:Iw,previous:Uw},Aw={name:`protocolAutolink`,tokenize:Lw,previous:Ww},jw={name:`emailAutolink`,tokenize:Fw,previous:Gw},Mw={};function Nw(){return{text:Mw}}for(var Pw=48;Pw<123;)Mw[Pw]=jw,Pw++,Pw===58?Pw=65:Pw===91&&(Pw=97);Mw[43]=jw,Mw[45]=jw,Mw[46]=jw,Mw[95]=jw,Mw[72]=[jw,Aw],Mw[104]=[jw,Aw],Mw[87]=[jw,kw],Mw[119]=[jw,kw];function Fw(e,t,n){let r=this,i,a;return o;function o(t){return!Kw(t)||!Gw.call(r,r.previous)||qw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Kw(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Ow,u,l)(t):t===45||t===95||M_(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&j_(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Iw(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Uw.call(r,r.previous)||qw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(ww,e.attempt(Tw,e.attempt(Ew,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Lw(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Ww.call(r,r.previous)&&!qw(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(j_(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||P_(t)||J(t)||z_(t)||R_(t)?n(t):e.attempt(Tw,e.attempt(Ew,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Rw(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function zw(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Dw,c,s)(t):t===null||J(t)||z_(t)||t!==45&&R_(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Bw(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Dw,t,a)(o):o===null||J(o)||z_(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Vw(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),a):o===93?(e.consume(o),i):o===60||o===null||J(o)||z_(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||J(e)||z_(e)?t(e):r(e)}function a(e){return j_(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):j_(t)?(e.consume(t),o):n(t)}}function Hw(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return M_(e)?n(e):t(e)}}function Uw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||J(e)}function Ww(e){return!j_(e)}function Gw(e){return!(e===47||Kw(e))}function Kw(e){return e===43||e===45||e===46||e===95||M_(e)}function qw(e){let t=e.length,n=!1;for(;t--;){let 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}var Jw={tokenize:nT,partial:!0};function Yw(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:$w,continuation:{tokenize:eT},exit:tT}},text:{91:{name:`gfmFootnoteCall`,tokenize:Qw},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Xw,resolveTo:Zw}}}}function Xw(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=A_(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Zw(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`;let 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++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Qw(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||J(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(A_(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return J(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function $w(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||J(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=A_(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return J(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),X(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function eT(e,t,n){return e.check(nv,t,e.attempt(Jw,t,n))}function tT(e){e.exit(`gfmFootnoteDefinition`)}function nT(e,t,n){let r=this;return X(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function rT(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&C_(o,o.length,0,Y_(s,e.slice(r+1,n),t)),C_(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),C_(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=J_(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=J_(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var iT=class{constructor(){this.map=[]}add(e,t,n){aT(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function aT(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 oT(e,t){let n=!1,r=[];for(;t<e.length;){let 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`){let e=r.length-1;r[e]=r[e]===`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 sT(){return{flow:{null:{name:`table`,tokenize:cT,resolveAll:lT}}}}function cT(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Y(t)?X(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||J(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Y(t)?X(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Y(t)?X(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Y(t)?X(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||q(n)?(e.exit(`tableRow`),t(n)):Y(n)?X(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||J(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function lT(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new iT;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(dT(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=uT(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=uT(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=uT(f,t,o,i,n,d)):(o[0]=o[1],d=uT(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&dT(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=oT(t.events,n))}return e}function uT(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},fT(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=fT(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=fT(t.events,n[2]),a=fT(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},fT(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function dT(e,t,n,r,i){let a=[],o=fT(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function fT(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var pT={name:`tasklistCheck`,tokenize:hT};function mT(){return{text:{91:pT}}}function hT(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return J(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return q(r)?t(r):Y(r)?e.check({tokenize:gT},t,n)(r):n(r)}}function gT(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function _T(e){return E_([Nw(),Yw(),rT(e),sT(),mT()])}var vT={};function yT(e){let t=this,n=e||vT,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(_T(n)),a.push(Sw()),o.push(Cw(n))}function bT(){return typeof navigator<`u`&&typeof navigator.clipboard?.writeText==`function`}function xT(e){if(typeof document>`u`)return;let t=document.getSelection();t&&(t.removeAllRanges(),e.forEach(e=>t.addRange(e)))}function ST(e){if(typeof document>`u`||!document.body)return!1;let 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(),a=i?Array.from({length:i.rangeCount},(e,t)=>i.getRangeAt(t).cloneRange()):[],o=document.createElement(`textarea`);o.value=e,o.setAttribute(`readonly`,``),o.setAttribute(`aria-hidden`,`true`),o.style.position=`fixed`,o.style.top=`0`,o.style.left=`-9999px`,o.style.opacity=`0`,o.style.pointerEvents=`none`,o.style.fontSize=`12pt`,document.body.appendChild(o);try{o.focus({preventScroll:!0})}catch{o.focus()}o.select(),o.setSelectionRange(0,o.value.length);let s=!1;try{s=typeof document.execCommand==`function`&&document.execCommand(`copy`)}catch{s=!1}if(o.remove(),t)try{t.focus({preventScroll:!0})}catch{t.focus()}return n&&r?n.setSelectionRange(r.start,r.end):xT(a),s}async function CT(e){if(!e)return!1;if(bT())try{return await navigator.clipboard.writeText(e),!0}catch{return ST(e)}return ST(e)}var wT=1300;function TT(e){let[t,n]=(0,k.useState)(!1),r=(0,k.useCallback)(async()=>{e.text&&(await CT(e.text)?n(!0):n(!1))},[e.text]);return(0,k.useEffect)(()=>{if(!t||typeof window>`u`)return;let r=window.setTimeout(()=>n(!1),e.resetDelayMs??wT);return()=>window.clearTimeout(r)},[t,e.resetDelayMs]),{copied:t,copy:r}}var ET=/language-([a-z0-9-]+)/i;function DT(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(DT).join(``):``}function OT(e){let t=DT(e);return t.endsWith(`
44
+ `)?t.slice(0,-1):t}function kT(e){return(e?ET.exec(e):null)?.[1]?.toLowerCase()||`text`}function AT(e){let t=(0,k.useMemo)(()=>kT(e.className),[e.className]),n=(0,k.useMemo)(()=>OT(e.children),[e.children]),{copied:r,copy:i}=TT({text:n});return(0,A.jsxs)(`div`,{className:`chat-codeblock`,children:[(0,A.jsxs)(`div`,{className:`chat-codeblock-toolbar`,children:[(0,A.jsx)(`span`,{className:`chat-codeblock-language`,children:t}),(0,A.jsxs)(`button`,{type:`button`,className:`chat-codeblock-copy`,onClick:()=>void i(),"aria-label":r?e.texts.copiedCodeLabel:e.texts.copyCodeLabel,children:[r?(0,A.jsx)(Se,{className:`h-3.5 w-3.5`}):(0,A.jsx)(gn,{className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{children:r?e.texts.copiedCodeLabel:e.texts.copyCodeLabel})]})]}),(0,A.jsx)(`pre`,{children:(0,A.jsx)(`code`,{className:e.className,children:n})})]})}var jT=14e4,MT=new Set([`http:`,`https:`,`mailto:`,`tel:`]);function NT(e){return e.length<=jT?e:`${e.slice(0,jT)}\n\n...`}function PT(e){if(!e)return null;if(e.startsWith(`#`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))return e;try{let t=new URL(e);return MT.has(t.protocol)?e:null}catch{return null}}function FT(e){return/^https?:\/\//i.test(e)}function IT(e){return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`/Users/`)||e.startsWith(`/home/`)||e.startsWith(`/tmp/`)||e.startsWith(`/var/`)||/^\/.+\.[A-Za-z0-9_-]+(?::\d+(?::\d+)?)?$/.test(e)}function LT(e){let t=e.split(`#`)[0]?.split(`?`)[0]??e,n=decodeURIComponent(t);if(!IT(n))return null;let r=/^(.*?)(?::(\d+)(?::(\d+))?)$/.exec(n),i=r?.[1]??n,a=r?.[2]?Number(r[2]):void 0,o=r?.[3]?Number(r[3]):void 0;return{path:i,label:i.split(`/`).filter(Boolean).pop()??i,viewMode:`preview`,...typeof a==`number`?{line:a}:{},...typeof o==`number`?{column:o}:{}}}function RT({text:e,role:t,texts:n,inline:r=!1,onFileOpen:i}){let a=t===`user`,o=(0,k.useMemo)(()=>({p:({children:e})=>r?(0,A.jsx)(A.Fragment,{children:e}):(0,A.jsx)(`p`,{children:e}),a:({href:e,children:t,...n})=>{let r=PT(e);if(!r)return(0,A.jsx)(`span`,{className:`chat-link-invalid`,children:t});let a=FT(r),o=a?null:LT(r),s=e=>{!i||!o||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),i(o))};return(0,A.jsx)(`a`,{...n,href:r,onClick:s,target:a?`_blank`:void 0,rel:a?`noreferrer noopener`:void 0,children:t})},table:({children:e,...t})=>(0,A.jsx)(`div`,{className:`chat-table-wrap`,children:(0,A.jsx)(`table`,{...t,children:e})}),input:({type:e,checked:t,...n})=>e===`checkbox`?(0,A.jsx)(`input`,{...n,type:`checkbox`,checked:t,readOnly:!0,disabled:!0,className:`chat-task-checkbox`}):(0,A.jsx)(`input`,{...n,type:e}),img:({src:e,alt:t,...n})=>{let r=PT(e);return r?(0,A.jsx)(`img`,{...n,src:r,alt:t||``,loading:`lazy`,decoding:`async`}):null},code:({className:e,children:t,...r})=>!e&&!String(t??``).includes(`
45
+ `)?(0,A.jsx)(`code`,{...r,className:M(`chat-inline-code`,e),children:t}):(0,A.jsx)(AT,{className:e,texts:n,children:t})}),[r,i,n]);return(0,A.jsx)(r?`span`:`div`,{className:M(`chat-markdown`,a?`chat-markdown-user`:`chat-markdown-assistant`),children:(0,A.jsx)(hS,{skipHtml:!0,remarkPlugins:[yT],components:o,children:NT(e)})})}function zT(e){return e.split(`​`).join(``).split(`‌`).join(``).split(`‍`).join(``).split(`⁠`).join(``).split(``).join(``).length>0}function BT(){return(0,A.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`h-3 w-3`,children:[(0,A.jsx)(`path`,{d:`M8.5 2.75 2.75 6l5.75 3.25L14.25 6 8.5 2.75Z`}),(0,A.jsx)(`path`,{d:`M2.75 10 8.5 13.25 14.25 10`}),(0,A.jsx)(`path`,{d:`M2.75 6v4l5.75 3.25V9.25L2.75 6Z`}),(0,A.jsx)(`path`,{d:`M14.25 6v4L8.5 13.25V9.25L14.25 6Z`})]})}function VT({kind:e,label:t,isUser:n}){let r=e===`skill`;return(0,A.jsxs)(`span`,{className:M(`mx-[2px] inline-flex h-7 max-w-full items-center gap-1.5 rounded-xl border px-2.5 align-baseline text-[11px] font-medium shadow-[0_0_0_1px_rgba(15,23,42,0.03)]`,r?n?`border-emerald-200/35 bg-emerald-400/18 text-emerald-50/95`:`border-emerald-200/70 bg-emerald-50 text-emerald-700`:n?`border-white/30 bg-white/18 text-white`:`border-slate-200/80 bg-slate-100 text-slate-700`),title:t,children:[(0,A.jsx)(`span`,{className:M(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center`,r?n?`text-emerald-100/90`:`text-emerald-600`:n?`text-white/70`:`text-slate-500`),children:(0,A.jsx)(BT,{})}),(0,A.jsx)(`span`,{className:`truncate`,children:t})]})}function HT({segments:e,role:t,texts:n,onFileOpen:r}){let i=t===`user`;return(0,A.jsx)(`div`,{className:`whitespace-pre-wrap break-words leading-6`,children:e.map((e,a)=>e.type===`token`?(0,A.jsx)(VT,{kind:e.token.kind,label:e.token.label,isUser:i},`token-${a}-${e.token.kind}-${e.token.key}`):zT(e.text)?(0,A.jsx)(RT,{text:e.text,role:t,texts:n,inline:!0,onFileOpen:r},`markdown-${a}`):(0,A.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e.text},`space-${a}`))})}var UT={archive:`border-amber-200/80 bg-amber-50 text-amber-700`,audio:`border-fuchsia-200/80 bg-fuchsia-50 text-fuchsia-700`,code:`border-cyan-200/80 bg-cyan-50 text-cyan-700`,data:`border-slate-200/80 bg-slate-50 text-slate-700`,document:`border-blue-200/80 bg-blue-50 text-blue-700`,generic:`border-slate-200/80 bg-slate-50 text-slate-700`,image:`border-emerald-200/80 bg-emerald-50 text-emerald-700`,pdf:`border-rose-200/80 bg-rose-50 text-rose-700`,sheet:`border-lime-200/80 bg-lime-50 text-lime-700`,video:`border-violet-200/80 bg-violet-50 text-violet-700`},WT=new Set([`c`,`cpp`,`css`,`go`,`html`,`java`,`js`,`jsx`,`md`,`php`,`py`,`rb`,`rs`,`sh`,`sql`,`svg`,`ts`,`tsx`]),GT=new Set([`graphql`,`json`,`toml`,`xml`,`yaml`,`yml`]),KT=new Set([`avif`,`bmp`,`gif`,`heic`,`heif`,`ico`,`jpeg`,`jpg`,`png`,`svg`,`tif`,`tiff`,`webp`]),qT=new Set([`aac`,`flac`,`m4a`,`mp3`,`ogg`,`opus`,`wav`,`weba`]),JT=new Set([`avi`,`m4v`,`mov`,`mp4`,`mkv`,`webm`,`wmv`]),YT=new Set([`doc`,`docx`,`odt`,`pages`,`rtf`,`txt`]),XT=new Set([`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]),ZT=new Set([`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`zip`]);function QT(e){if(!Number.isFinite(e)||e==null||e<0)return null;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;let i=n>=10||r===0?0:1;return`${n.toFixed(i).replace(/\.0$/,``)} ${t[r]}`}function $T(e,t){let n=eE(e);if(n)return n.toUpperCase();let r=(t.split(`/`)[1]??``).split(/[+.;-]/)[0]?.trim();return r?r.slice(0,6).toUpperCase():`FILE`}function eE(e){return/\.([a-z0-9]{1,12})$/i.exec(e.trim())?.[1]?.toLowerCase()??``}function tE(e){return typeof e==`string`&&/^data:image\//i.test(e.trim())}function nE(e){return KT.has(e)?e===`jpg`||e===`jpeg`?`image/jpeg`:e===`svg`?`image/svg+xml`:`image/${e}`:qT.has(e)?e===`mp3`?`audio/mpeg`:e===`m4a`?`audio/mp4`:e===`weba`?`audio/webm`:`audio/${e}`:JT.has(e)?e===`mov`?`video/quicktime`:e===`m4v`?`video/mp4`:`video/${e}`:e===`pdf`?`application/pdf`:null}function rE(e){let t=eE(e);return t?nE(t):null}function iE(e){let t=e.mimeType.trim().toLowerCase();return t.length>0&&t!==`application/octet-stream`?t:rE(e.label)}function aE(e){let t=e.mimeType.trim().toLowerCase(),n=eE(e.label);return e.isImage||t.startsWith(`image/`)||KT.has(n)||tE(e.dataUrl)}function oE(e,t){let n=eE(e),r=t.toLowerCase();return r.startsWith(`image/`)||KT.has(n)?`image`:r.startsWith(`audio/`)||qT.has(n)?`audio`:r.startsWith(`video/`)||JT.has(n)?`video`:r.includes(`pdf`)||n===`pdf`?`pdf`:ZT.has(n)||/(zip|tar|gzip|rar|compressed|archive)/.test(r)?`archive`:XT.has(n)||/(spreadsheet|sheet|excel|csv)/.test(r)?`sheet`:GT.has(n)||/(json|xml|yaml|toml)/.test(r)?`data`:WT.has(n)||/(javascript|typescript|jsx|tsx|css|html)/.test(r)?`code`:YT.has(n)||/(msword|document|opendocument|rtf|text\/)/.test(r)?`document`:`generic`}function sE(e){let t=oE(e.label,e.mimeType),n=QT(e.sizeBytes);return{category:t,extension:$T(e.label,e.mimeType),sizeLabel:n}}var cE={archive:`Archive`,audio:`Audio`,code:`Code file`,data:`Data file`,document:`Document`,generic:`File`,image:`Image`,pdf:`PDF document`,sheet:`Spreadsheet`,video:`Video`},lE={archive:vn,audio:yn,code:bn,data:Sn,document:wn,generic:En,image:xn,pdf:wn,sheet:Cn,video:Tn};function uE(e,t){return t?.attachmentCategoryLabels?.[e]??cE[e]}function dE(e,t,n){return(0,A.jsx)(`div`,{className:M(`mt-1 text-xs leading-5`,n?`text-white/70`:`text-slate-500`),children:t?`${e} · ${t}`:e})}function fE(e,t,n){return(0,A.jsx)(`span`,{className:M(`inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium`,n?t?`border-white/14 bg-white/12 text-white`:`border-slate-200/80 bg-white text-slate-700`:t?`border-white/10 bg-white/6 text-white/62`:`border-slate-200/70 bg-slate-100/80 text-slate-500`),children:e})}function pE(e,t,n){return(0,A.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:M(`inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium transition duration-200`,n?`border-white/14 bg-white/12 text-white hover:border-white/20 hover:bg-white/16`:`border-slate-200/80 bg-white text-slate-700 hover:border-slate-300 hover:bg-slate-50`),children:e})}function mE({category:e,isUser:t}){let n=lE[e];return(0,A.jsx)(`div`,{className:M(`flex h-14 w-14 shrink-0 items-center justify-center rounded-[1rem] border`,t?`border-white/12 bg-white/10 text-white`:UT[e]),children:(0,A.jsx)(n,{className:M(`h-7 w-7`,t?`text-white/92`:`text-current`),strokeWidth:2.2})})}function hE(e){let{file:t,categoryLabel:n,sizeLabel:r,isUser:i}=e;return t.dataUrl?(0,A.jsx)(`a`,{href:t.dataUrl,target:`_blank`,rel:`noreferrer`,className:`group block`,children:(0,A.jsxs)(`div`,{className:M(`relative overflow-hidden rounded-[1rem]`,i?`ring-1 ring-white/10`:`bg-slate-100/80 ring-1 ring-slate-200/80`),children:[(0,A.jsx)(`img`,{src:t.dataUrl,alt:t.label,className:`block h-auto max-h-[26rem] w-full rounded-[1rem] bg-transparent object-contain transition duration-300 group-hover:scale-[1.01]`}),(0,A.jsxs)(`div`,{className:`pointer-events-none absolute right-3 top-3 flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:M(`inline-flex items-center rounded-full px-2 py-1 text-[10px] font-semibold tracking-[0.18em] text-white backdrop-blur-sm`,i?`bg-slate-950/36`:`bg-slate-950/58`),children:n}),r?(0,A.jsx)(`span`,{className:M(`inline-flex items-center rounded-full px-2 py-1 text-[10px] font-medium text-white/92 backdrop-blur-sm`,i?`bg-slate-950/28`:`bg-slate-950/46`),children:r}):null]})]})}):null}function gE(e){let{category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,action:o}=e;return(0,A.jsxs)(`div`,{className:`flex items-center gap-3 p-3.5`,children:[(0,A.jsx)(mE,{category:t,isUser:a}),(0,A.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`truncate text-[15px] font-semibold leading-5`,children:n.label}),dE(r,i,a)]}),o]})})]})}function _E(e){let{category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,shellClasses:o,actionLabel:s}=e;if(!n.dataUrl||t!==`audio`&&t!==`video`)return null;let c=iE(n);return(0,A.jsxs)(`div`,{className:o,children:[gE({category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,action:pE(s,n.dataUrl,a)}),(0,A.jsx)(`div`,{className:`px-3.5 pb-3.5`,children:t===`audio`?(0,A.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":n.label,className:`block w-full`,children:(0,A.jsx)(`source`,{src:n.dataUrl,...c?{type:c}:{}})}):(0,A.jsx)(`div`,{className:M(`overflow-hidden rounded-[1rem] border`,a?`border-white/10 bg-slate-950/26`:`border-slate-200/80 bg-slate-100/80`),children:(0,A.jsx)(`video`,{controls:!0,preload:`metadata`,playsInline:!0,"aria-label":n.label,className:`block max-h-[28rem] w-full bg-black`,children:(0,A.jsx)(`source`,{src:n.dataUrl,...c?{type:c}:{}})})})})]})}function vE({file:e,isUser:t=!1,texts:n}){let{category:r,sizeLabel:i}=sE(e),a=aE(e)&&!!e.dataUrl,o=r===`audio`&&!!e.dataUrl,s=r===`video`&&!!e.dataUrl,c=!!e.dataUrl,l=c?n?.attachmentOpenLabel??`Open`:n?.attachmentAttachedLabel??`Attached`,u=uE(r,n),d=M(`block overflow-hidden rounded-[1.25rem] border transition duration-200`,t?`border-white/12 bg-white/10 text-white`:`border-slate-200/80 bg-white/95 text-slate-900`,c&&(t?`hover:border-white/18 hover:bg-white/13`:`hover:border-slate-300 hover:bg-white`));if(a)return hE({file:e,categoryLabel:u,sizeLabel:i,isUser:t});if(o||s)return _E({category:r,file:e,categoryLabel:u,sizeLabel:i,isUser:t,shellClasses:d,actionLabel:l});let f=gE({category:r,file:e,categoryLabel:u,sizeLabel:i,isUser:t,action:fE(l,t,c)});return!c||!e.dataUrl?(0,A.jsx)(`div`,{className:d,children:f}):(0,A.jsx)(`a`,{href:e.dataUrl,target:`_blank`,rel:`noreferrer`,className:M(d,`group`),children:f})}function yE(e){let{isInProgress:t}=e,[n,r]=(0,k.useState)(t),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(t);(0,k.useEffect)(()=>{let e=o.current;!e&&t?(r(!0),a(!1)):e&&!t&&!i&&r(!1),o.current=t},[t,i]);function s(e){e.preventDefault();let i=!n;if(r(i),!i){a(!1);return}t&&a(!0)}return{isOpen:n,onSummaryClick:s}}var bE=10;function xE(e){e.scrollTop=e.scrollHeight}function SE(e){e.scrollRef.current&&(e.scheduledScrollFrameRef.current!==null&&cancelAnimationFrame(e.scheduledScrollFrameRef.current),e.scheduledScrollFrameRef.current=requestAnimationFrame(()=>{e.scheduledScrollFrameRef.current=null;let t=e.scrollRef.current;t&&(e.isProgrammaticScrollRef.current=!0,xE(t))}))}function CE(e){let t=(0,k.useRef)(!0),n=(0,k.useRef)(!1),r=(0,k.useRef)(null),i=(0,k.useRef)(!1),a=(0,k.useRef)(null);return(0,k.useEffect)(()=>{r.current!==e.resetKey&&(r.current=e.resetKey,t.current=!0,i.current=!0)},[e.resetKey]),(0,k.useEffect)(()=>{let e=a.current;return()=>{e!==null&&cancelAnimationFrame(e)}},[]),(0,k.useLayoutEffect)(()=>{!i.current||e.isLoading||!e.hasContent||e.scrollRef.current&&(i.current=!1,SE({scrollRef:e.scrollRef,scheduledScrollFrameRef:a,isProgrammaticScrollRef:n}))},[e.hasContent,e.isLoading,e.scrollRef]),(0,k.useLayoutEffect)(()=>{!t.current||!e.hasContent||e.scrollRef.current&&SE({scrollRef:e.scrollRef,scheduledScrollFrameRef:a,isProgrammaticScrollRef:n})},[e.contentVersion,e.hasContent,e.scrollRef]),{onScroll:()=>{if(n.current){n.current=!1;return}let r=e.scrollRef.current;r&&(t.current=r.scrollHeight-r.scrollTop-r.clientHeight<=(e.stickyThresholdPx??bE))}}}function wE(e){let t=e.trim().toLowerCase();return t===`reasoning`||t===`thinking`||t===`推理`||t===`推理过程`||t===`思考过程`||t===`思考`?`思考`:e}function TE({label:e,text:t,isUser:n,isInProgress:r}){let{isOpen:i,onSummaryClick:a}=yE({isInProgress:r}),o=(0,k.useRef)(null),s=wE(e),{onScroll:c}=CE({scrollRef:o,resetKey:`${s}:${r?`streaming`:`idle`}`,isLoading:!1,hasContent:t.length>0,contentVersion:t,stickyThresholdPx:20});return(0,A.jsxs)(`details`,{className:`mt-2`,open:i,children:[(0,A.jsx)(`summary`,{className:M(`cursor-pointer text-xs`,n?`text-primary-100`:`text-gray-500`),onClick:a,children:s}),(0,A.jsx)(`div`,{ref:o,onScroll:c,"data-reasoning-scroll":`true`,className:M(`mt-2 w-fit max-w-[500px] max-h-56 overflow-y-auto rounded-lg custom-scrollbar-amber`,n?`bg-primary-700/60`:`bg-gray-100`),children:(0,A.jsx)(`pre`,{className:`min-w-0 whitespace-pre-wrap break-all p-2 text-[11px]`,children:t})})]})}function EE({children:e,className:t}){return(0,A.jsx)(`div`,{className:M(`my-2 rounded-lg border border-amber-200/50 bg-amber-100/30 shadow-sm overflow-hidden text-[12px]`,`w-[280px] sm:w-[360px] md:w-[480px] min-w-full max-w-full transition-all flex flex-col`,t),children:e})}function DE({children:e,className:t}){return(0,A.jsx)(`div`,{className:M(`border-t border-amber-200/15 bg-amber-50/50 px-3 pt-1 pb-2 w-full overflow-hidden`,t),children:e})}var OE={running:{text:`text-amber-500/80`,icon:He,spin:!0},success:{text:`text-amber-500/80`,icon:Se,spin:!1},error:{text:`text-amber-500/80`,icon:Hn,spin:!1},cancelled:{text:`text-amber-500/80`,icon:Fn,spin:!1}};function kE({card:e}){let t=OE[e.statusTone]||OE.cancelled,n=t.icon;return(0,A.jsxs)(`span`,{className:M(`inline-flex items-center gap-1.5 text-[11px] font-medium leading-none shrink-0`,t.text),children:[(0,A.jsx)(n,{className:M(`h-3.5 w-3.5`,t.spin&&`animate-spin`),strokeWidth:3}),e.statusTone===`running`?e.statusLabel:null]})}function AE({action:e,onAction:t}){let n=e.sessionKind===`child`?`Open child session`:`Open session`;return(0,A.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),t(e)},className:M(`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-[10px] font-semibold uppercase tracking-[0.08em] transition-colors`,`border-amber-200/80 bg-white/80 text-amber-800 hover:bg-amber-50`),"aria-label":n,title:n,children:(0,A.jsx)(dn,{className:`h-3 w-3`,strokeWidth:2.5})})}function jE({card:e,icon:t,expanded:n,canExpand:r,hideSummary:i=!1,actionSlot:a,onToggle:o}){let s=i?``:e.summary?.replace(/^(command|path|args|query|input):\s*/i,``)??``;return(0,A.jsxs)(`div`,{className:M(`flex items-center gap-3 px-3 py-2.5 transition-colors bg-transparent`,r?`cursor-pointer hover:bg-amber-100/30`:``),onClick:o,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 overflow-hidden font-mono text-amber-950/80`,children:[(0,A.jsx)(t,{className:`h-4 w-4 text-amber-600/80 shrink-0`,strokeWidth:3}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden`,children:[(0,A.jsx)(`span`,{className:`font-bold shrink-0 tracking-tight`,children:e.toolName}),s&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`text-amber-300 font-bold select-none shrink-0`,children:`›`}),(0,A.jsx)(`span`,{className:`block min-w-0 flex-1 truncate font-normal`,title:s,children:s})]})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[a,(0,A.jsx)(kE,{card:e}),r&&(n?(0,A.jsx)(fe,{className:`h-4 w-4 text-amber-400/80`,strokeWidth:3}):(0,A.jsx)(mn,{className:`h-4 w-4 text-amber-400/80`,strokeWidth:3}))]})]})}function ME({action:e,onAction:t}){return(0,A.jsx)(AE,{action:e,onAction:t})}var NE=`font-mono text-[11px] leading-5`,PE=`flex h-5 w-full ${NE}`,FE=`flex h-5 items-center justify-center px-2.5 tabular-nums select-none`;function IE(e){let t=e.newLineNumber??e.oldLineNumber;return typeof t==`number`?String(t):``}function LE(e,t,n){return`${e}-${n}-${t.oldLineNumber??`x`}-${t.newLineNumber??`x`}`}function RE(e){return typeof e.newLineNumber==`number`||typeof e.oldLineNumber==`number`}function zE(e){return e.lines.some(RE)}function BE(e){let t=e.lines.reduce((e,t)=>RE(t)?Math.max(e,IE(t).length):e,0);return`${Math.max(6.5,Math.min(8,t+3.5))}ch`}function VE(e){return`calc(${e.lines.reduce((e,t)=>Math.max(e,Math.max(1,t.text.length)),1)}ch + 1.25rem)`}function HE(e){return e.kind===`remove`?`border-r border-rose-200 bg-rose-50 text-rose-700`:e.kind===`add`?`border-r border-emerald-200 bg-emerald-50 text-emerald-700`:`border-r border-stone-200 bg-stone-100 text-stone-500`}function UE(e){return e.kind===`remove`?`bg-rose-50 text-rose-950`:e.kind===`add`?`bg-emerald-50 text-emerald-950`:`bg-white text-amber-950/80`}function WE({layout:e,line:t,lineNumberColumnWidth:n}){return(0,A.jsx)(`span`,{"data-file-line-number-cell":`true`,style:e===`compact`?{width:n,minWidth:n}:void 0,className:M(FE,e===`compact`?`sticky left-0 z-[1]`:`w-full shrink-0`,HE(t)),children:IE(t)})}function GE({line:e}){return(0,A.jsx)(`span`,{"data-file-code-row":`true`,className:M(`block min-w-0 flex-1 whitespace-pre px-2.5`,UE(e)),children:e.text||` `})}function KE({line:e,showLineNumbers:t,lineNumberColumnWidth:n}){return(0,A.jsxs)(`div`,{"data-file-line-row":`true`,className:PE,children:[t?(0,A.jsx)(WE,{layout:`compact`,line:e,lineNumberColumnWidth:n}):null,(0,A.jsx)(GE,{line:e})]})}function qE({block:e}){let t=zE(e),n=BE(e),r=VE(e);return(0,A.jsxs)(`div`,{"data-file-code-surface":`true`,"data-file-code-surface-layout":`workspace`,className:`flex h-full min-h-full min-w-full bg-white`,children:[t?(0,A.jsxs)(`div`,{"data-file-code-gutter":`true`,style:{width:n,minWidth:n},className:M(`flex h-full min-h-full shrink-0 flex-col`,NE),children:[e.lines.map((e,t)=>(0,A.jsx)(WE,{layout:`workspace`,line:e,lineNumberColumnWidth:n},LE(`gutter`,e,t))),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 border-r border-stone-200 bg-stone-100`})]}):null,(0,A.jsxs)(`div`,{"data-file-code-canvas":`true`,className:`flex h-full min-h-full min-w-0 flex-1 flex-col bg-white`,children:[(0,A.jsx)(`div`,{"data-file-code-stack":`true`,className:`min-w-full`,style:{minWidth:r},children:e.lines.map((e,t)=>(0,A.jsx)(`div`,{"data-file-code-canvas-row":`true`,className:PE,children:(0,A.jsx)(GE,{line:e})},LE(`code`,e,t)))}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 bg-white`})]})]})}function JE({block:e,layout:t=`compact`}){if(t===`workspace`)return(0,A.jsx)(qE,{block:e});let n=zE(e),r=BE(e),i=VE(e),a=n?`calc(${r} + ${i})`:i;return(0,A.jsx)(`div`,{"data-file-code-surface":`true`,"data-file-code-surface-layout":`compact`,className:`overflow-x-auto custom-scrollbar-amber bg-white`,children:(0,A.jsx)(`div`,{"data-file-code-stack":`true`,className:`min-w-full`,style:{minWidth:a},children:e.lines.map((e,t)=>(0,A.jsx)(KE,{line:e,showLineNumbers:n,lineNumberColumnWidth:r},LE(`row`,e,t)))})})}function YE({block:e}){return(0,A.jsx)(JE,{block:e,layout:`compact`})}function XE(e){return e.display===`preview`}function ZE(e){return e.rawText?e.rawText:e.lines.map(e=>[e.kind,e.oldLineNumber??``,e.newLineNumber??``,e.text].join(`:`)).join(`
46
+ `)}function QE(e){return/^\+\d+$/.test(e)?`text-emerald-700`:/^-\d+$/.test(e)?`text-rose-700`:`text-stone-500`}function $E(e){let t=e.split(`·`).map(e=>e.trim()).filter(e=>/^\+\d+$/.test(e)||/^-\d+$/.test(e));return t.length===0?null:(0,A.jsx)(`div`,{className:`flex shrink-0 items-center gap-x-1 whitespace-nowrap text-[10px] font-medium uppercase tracking-[0.08em]`,children:t.map((e,t)=>(0,A.jsxs)(k.Fragment,{children:[t>0?(0,A.jsx)(`span`,{className:`text-stone-300`,children:`·`}):null,(0,A.jsx)(`span`,{className:M(QE(e)),children:e})]},`${e}-${t}`))})}function eD(e){return{path:e.path,label:e.path.split(`/`).filter(Boolean).pop()??e.path,viewMode:e.display===`diff`?`diff`:`preview`,...e.rawText?{rawText:e.rawText}:{},...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...e.patchText?{patchText:e.patchText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{},fullLines:e.fullLines??e.lines}}function tD({children:e,contentVersion:t,resetKey:n,className:r,scrollKind:i}){let a=(0,k.useRef)(null),{onScroll:o}=CE({scrollRef:a,resetKey:n,isLoading:!1,hasContent:!0,contentVersion:t,stickyThresholdPx:20});return(0,A.jsx)(`div`,{ref:a,onScroll:o,"data-file-scroll-kind":i,className:M(`overflow-y-auto bg-white custom-scrollbar-amber`,r),children:e})}function nD({block:e,showPathRow:t,isFirst:n,onFileOpen:r}){let{Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=Pi,c=XE(e),l=t||!!e.caption;return(0,A.jsxs)(`section`,{className:M(`overflow-hidden bg-white`,!n&&`border-t border-stone-200/80`),children:[l?(0,A.jsxs)(`div`,{className:M(`flex items-center justify-between gap-4 border-b border-stone-200/80 px-4 text-stone-700`,t?`py-2`:`py-1.5`),children:[(0,A.jsx)(`div`,{className:`min-w-0 flex-1`,children:t?(0,A.jsx)(o,{delayDuration:250,children:(0,A.jsxs)(i,{children:[(0,A.jsx)(s,{asChild:!0,children:(0,A.jsx)(`button`,{type:`button`,onClick:()=>{r&&r(eD(e))},className:M(`w-full truncate whitespace-nowrap text-left font-mono text-[12px] font-medium text-stone-700`,r&&`transition-colors hover:text-amber-900 hover:underline`),title:e.path,children:e.path})}),(0,A.jsx)(a,{side:`top`,className:`max-w-[420px] text-xs font-mono break-all`,children:e.path})]})}):null}),e.caption?$E(e.caption):null]}):null,e.lines.length>0?(0,A.jsx)(tD,{resetKey:`block:${e.key}`,contentVersion:ZE(e),className:`max-h-72`,scrollKind:`block`,children:(0,A.jsx)(YE,{block:e})}):e.rawText?(0,A.jsx)(tD,{resetKey:`raw:${e.key}`,contentVersion:e.rawText,className:`max-h-72`,scrollKind:`raw`,children:(0,A.jsx)(`div`,{className:`overflow-x-auto custom-scrollbar-amber`,children:(0,A.jsx)(`pre`,{className:`min-w-max whitespace-pre bg-white px-4 py-2 font-mono text-[11px] leading-5 text-amber-950/80`,children:e.rawText})})}):null,e.truncated&&!c?(0,A.jsx)(`div`,{className:`border-t border-stone-200/85 bg-stone-50 px-4 py-2 text-[10px] text-stone-500`,children:`Showing a shortened diff preview.`}):null]})}function rD({card:e,className:t,onFileOpen:n}){let r=e.fileOperation?.blocks??[],i=e.output?.trim()??``;return r.length===0&&!i?null:(0,A.jsxs)(`div`,{className:M(`overflow-hidden bg-white`,t),children:[r.map((e,t)=>(0,A.jsx)(nD,{block:e,showPathRow:!0,isFirst:t===0,onFileOpen:n},e.key)),i?(0,A.jsx)(tD,{resetKey:`output:${e.toolName}:${e.summary??`none`}`,contentVersion:i,className:M(`max-h-56`,r.length>0&&`border-t border-stone-200/80`),scrollKind:`output`,children:(0,A.jsx)(`div`,{className:`overflow-x-auto custom-scrollbar-amber`,children:(0,A.jsx)(`pre`,{className:`min-w-max whitespace-pre bg-white px-4 py-2 font-mono text-[11px] leading-5 text-amber-950/80`,children:i})})}):null]})}var iD=200,aD=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`g`);function oD(e){return typeof e==`string`&&e.length>0?e:null}function sD(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cD(e){return e.replace(aD,``)}function lD(e){return`command`in e||`workingDir`in e||`exitCode`in e||`durationMs`in e||`stdout`in e||`stderr`in e||`aggregated_output`in e||`combinedOutput`in e}function uD(e){let t=oD(e.aggregated_output)??oD(e.combinedOutput)??oD(e.output);if(t)return t;let n=oD(e.stdout),r=oD(e.stderr);return!n&&!r?null:[n,r].filter(e=>!!e).join(`
47
+ `)}function dD(e,t){if(sD(t)){let e=uD(t);if(e)return cD(e);if(lD(t))return``}if(!e)return``;let n=e.trim();if(!n.startsWith(`{`))return cD(e);try{let t=JSON.parse(n);if(!sD(t))return cD(e);let r=uD(t);return r?cD(r):lD(t)?``:cD(e)}catch{return cD(e)}}function fD(e){return e===`write_file`||e===`edit_file`}function pD({canExpand:e,isRunning:t,autoExpandWhileRunning:n=!0,expandOnError:r=!1,statusTone:i}){let[a,o]=(0,k.useState)(!1),[s,c]=(0,k.useState)(!1),l=(0,k.useRef)(null),u=(0,k.useRef)(t),d=(0,k.useRef)(!0);return(0,k.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]),(0,k.useEffect)(()=>{if(r&&i===`error`&&e&&!s){l.current!==null&&(window.clearTimeout(l.current),l.current=null),o(!0),u.current=t,d.current=!1;return}n&&t&&e&&!s&&!a&&(d.current||!u.current)&&(l.current=window.setTimeout(()=>{o(!0),l.current=null},iD)),t||(l.current!==null&&(window.clearTimeout(l.current),l.current=null),u.current&&!s&&o(!1)),u.current=t,d.current=!1},[n,e,r,a,s,t,i]),{expanded:a,onToggle:()=>{e&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),o(e=>!e),c(!0))}}}function mD({label:e,tone:t,children:n}){let r={input:{shell:`border-stone-200/80 bg-stone-50/90`,header:`border-stone-200/80 bg-stone-100/85 text-stone-500`,dot:`bg-stone-400/80`,body:`text-stone-700`},output:{shell:`border-amber-200/70 bg-white/90`,header:`border-amber-200/70 bg-amber-50/90 text-amber-700`,dot:`bg-amber-500/80`,body:`text-amber-950/80`},error:{shell:`border-rose-200/80 bg-rose-50/85`,header:`border-rose-200/80 bg-rose-100/80 text-rose-700`,dot:`bg-rose-500/80`,body:`text-rose-950/85`}}[t];return(0,A.jsxs)(`section`,{className:M(`overflow-hidden rounded-md border shadow-[inset_0_1px_0_rgba(255,255,255,0.45)]`,r.shell),children:[(0,A.jsxs)(`div`,{className:M(`flex items-center gap-2 border-b px-3 py-2 text-[10px] font-semibold uppercase tracking-[0.16em]`,r.header),children:[(0,A.jsx)(`span`,{className:M(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,A.jsx)(`span`,{children:e})]}),(0,A.jsx)(`div`,{className:`w-full overflow-hidden`,children:(0,A.jsx)(`pre`,{className:M(`w-full max-w-full min-w-0 max-h-64 overflow-x-auto overflow-y-auto px-3 py-2.5 font-mono text-[12px] leading-relaxed whitespace-pre custom-scrollbar-amber`,r.body),children:n})})]})}function hD({card:e}){let t=dD(e.output,e.outputData),n=e.statusTone===`running`,r=!!(e.summary?.trim()||t.trim().length>0),{expanded:i,onToggle:a}=pD({canExpand:t.trim().length>0||n,isRunning:n,autoExpandWhileRunning:!1,expandOnError:r,statusTone:e.statusTone}),o=e.summary?.replace(/^(command|path|args|query|input):\s*/i,``);return(0,A.jsxs)(EE,{children:[(0,A.jsx)(jE,{card:e,icon:Vn,expanded:i,canExpand:t.trim().length>0||n,onToggle:a}),i&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`px-3 pb-2 font-mono w-full max-h-48 overflow-y-auto custom-scrollbar-amber min-h-0 text-[12px]`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-2 leading-relaxed`,children:[(0,A.jsx)(`span`,{className:`text-amber-500/50 font-medium shrink-0 select-none mt-[1px]`,children:`$`}),(0,A.jsx)(`div`,{className:`flex-1 min-w-0`,children:o?(0,A.jsxs)(`div`,{className:`text-amber-950/80 break-words whitespace-pre-wrap tracking-tight font-medium inline-block`,children:[o,n&&!t&&(0,A.jsx)(`span`,{className:`inline-block w-1.5 h-3 ml-1 bg-amber-500/60 animate-pulse align-middle`})]}):(0,A.jsx)(`div`,{className:`h-3 w-32 bg-amber-200/30 rounded animate-pulse mt-2`})})]})}),t&&(0,A.jsx)(DE,{children:(0,A.jsxs)(`pre`,{className:`font-mono text-[12px] text-amber-950/70 whitespace-pre-wrap break-all w-full max-w-full max-h-64 overflow-y-auto overflow-x-hidden min-w-0 custom-scrollbar-amber leading-relaxed px-0`,children:[t,n&&(0,A.jsx)(`span`,{className:`inline-block w-1.5 h-3 ml-1 bg-amber-500/60 animate-pulse align-middle`})]})})]})]})}function gD({card:e,onFileOpen:t}){let n=e.output?.trim()??``,r=e.statusTone===`running`,i=!!e.fileOperation?.blocks.length,a=i||!!n,o=e.fileOperation?.blocks??[],s=o.reduce((e,t)=>e+t.lines.length,0),c=o.reduce((e,t)=>t.rawText?e+t.rawText.length:e+t.lines.reduce((e,t)=>e+t.text.length+1,0),0),l=fD(e.toolName)&&!(r&&e.toolName===`write_file`&&(s>24||c>1200)),{expanded:u,onToggle:d}=pD({canExpand:a||r,isRunning:r,autoExpandWhileRunning:l,expandOnError:a,statusTone:e.statusTone});return(0,A.jsxs)(EE,{children:[(0,A.jsx)(jE,{card:e,icon:e.toolName===`edit_file`||e.toolName===`write_file`||e.toolName===`apply_patch`||e.toolName===`file_change`?hn:wn,expanded:u,canExpand:a||r,hideSummary:u&&i,onToggle:d}),u&&a&&(0,A.jsx)(DE,{className:`border-t border-amber-200/20 bg-transparent px-0 pt-0 pb-0`,children:(0,A.jsx)(rD,{card:e,onFileOpen:t})})]})}function _D({card:e}){let t=e.statusTone===`running`,n=e.output?.trim()??``,{expanded:r,onToggle:i}=pD({canExpand:!!n||t,isRunning:t,autoExpandWhileRunning:!1,statusTone:e.statusTone});return(0,A.jsxs)(EE,{children:[(0,A.jsx)(jE,{card:e,icon:Ke,expanded:r,canExpand:!!n||t,onToggle:i}),r&&n&&(0,A.jsx)(DE,{children:(0,A.jsx)(`pre`,{className:`font-mono text-[12px] text-amber-950/70 whitespace-pre-wrap break-all w-full max-w-full max-h-64 overflow-y-auto overflow-x-hidden min-w-0 custom-scrollbar-amber leading-relaxed`,children:n})})]})}function vD({card:e,onToolAction:t,renderToolAgent:n}){let r=e.input?.trim()??``,i=e.output?.trim()??``,a=e.statusTone===`running`,o=r.length>0,s=i.length>0,c=o||s,l=e.inputLabel?.trim()||`Input`,u=e.outputLabel?.trim()||`Output`,{expanded:d,onToggle:f}=pD({canExpand:c||a,isRunning:a,autoExpandWhileRunning:!1,statusTone:e.statusTone});return(0,A.jsxs)(EE,{children:[(0,A.jsx)(jE,{card:e,icon:Be,expanded:d,canExpand:c||a,actionSlot:e.agentId||e.action&&t?(0,A.jsxs)(A.Fragment,{children:[e.agentId&&n?n(e.agentId):null,e.action&&t?(0,A.jsx)(ME,{action:e.action,onAction:t}):null]}):void 0,onToggle:f}),d&&c&&(0,A.jsxs)(DE,{className:`bg-transparent px-2.5 py-2.5`,children:[o&&(0,A.jsx)(mD,{label:l,tone:`input`,children:r}),o&&s&&(0,A.jsx)(`div`,{className:`h-2`}),s&&(0,A.jsx)(mD,{label:u,tone:e.statusTone===`error`?`error`:`output`,children:i})]})]})}function yD(e){let t=e.toLowerCase();return t===`exec`||t===`exec_command`||t===`execute_command`||t===`command_execution`||t===`bash`||t===`shell`||t.includes(`run_`)}function bD(e){let t=e.toLowerCase();return t===`read_file`||t===`write_file`||t===`edit_file`||t===`apply_patch`||t===`file_change`}function xD(e){let t=e.toLowerCase();return t===`grep_search`||t===`find_files`||t.includes(`search`)}function SD({card:e,onToolAction:t,onFileOpen:n,renderToolAgent:r}){return yD(e.toolName)?(0,A.jsx)(hD,{card:e}):bD(e.toolName)?(0,A.jsx)(gD,{card:e,onFileOpen:n}):xD(e.toolName)?(0,A.jsx)(_D,{card:e}):(0,A.jsx)(vD,{card:e,onToolAction:t,renderToolAgent:r})}function CD(e){return(0,A.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-gray-50 px-2.5 py-2 text-xs text-gray-600`,children:[(0,A.jsxs)(`div`,{className:`font-semibold text-gray-700`,children:[e.label,`: `,e.rawType]}),e.text?(0,A.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-gray-500`,children:e.text}):null]})}var wD=(0,k.memo)(function(e){let{message:t,texts:n,onToolAction:r,onFileOpen:i,renderToolAgent:a}=e,{role:o}=t,s=o===`user`,c=t.status===`pending`||t.status===`streaming`;return(0,A.jsx)(`div`,{className:M(`inline-block w-fit max-w-full rounded-2xl border px-4 shadow-sm`,s?`border-primary bg-primary py-3 text-white`:o===`assistant`?`border-gray-200 bg-white pb-3 pt-4 text-gray-900`:`border-orange-200/80 bg-orange-50/70 py-3 text-gray-900`),children:(0,A.jsx)(`div`,{className:`space-y-2`,children:t.parts.map((e,l)=>{let{type:u}=e;return u===`markdown`?(0,A.jsx)(RT,{text:e.text,role:o,texts:n,onFileOpen:i},`markdown-${l}`):u===`inline-content`?(0,A.jsx)(HT,{segments:e.segments,role:o,texts:n,onFileOpen:i},`inline-content-${l}`):u===`reasoning`?(0,A.jsx)(TE,{label:e.label,text:e.text,isUser:s,isInProgress:c&&l===t.parts.length-1},`reasoning-${l}`):u===`tool-card`?(0,A.jsx)(`div`,{className:`mt-0.5`,children:(0,A.jsx)(SD,{card:e.card,onToolAction:r,onFileOpen:i,renderToolAgent:a})},`tool-${l}`):u===`file`?(0,A.jsx)(vE,{file:e.file,isUser:s,texts:n},`file-${l}`):u===`unknown`?(0,A.jsx)(CD,{label:e.label,rawType:e.rawType,text:e.text},`unknown-${l}`):null})})})});function TD(e){return(0,A.jsxs)(`div`,{className:M(`px-1 text-[11px] leading-4 text-gray-400`,e.isUser?`text-right`:`text-left`),children:[e.roleLabel,` · `,e.timestampLabel]})}function ED({message:e,texts:t}){let n=(0,k.useMemo)(()=>e.parts.map(e=>e.type===`markdown`||e.type===`unknown`?e.text:``).filter(e=>!!e&&e.trim().length>0).join(`
48
+
49
+ `),[e.parts]),{copied:r,copy:i}=TT({text:n});return n?(0,A.jsx)(`button`,{type:`button`,onClick:()=>void i(),className:`text-gray-400 hover:text-gray-600 transition-colors p-1 rounded-md hover:bg-gray-100 flex items-center justify-center`,"aria-label":r?t.copiedMessageLabel:t.copyMessageLabel,title:r?t.copiedMessageLabel:t.copyMessageLabel,children:r?(0,A.jsx)(Se,{className:`h-3.5 w-3.5`}):(0,A.jsx)(gn,{className:`h-3.5 w-3.5`})}):null}var DD=/\u200B|\u200C|\u200D|\u2060|\uFEFF/g;function OD(e){let t=e.trim();return t?t.replace(DD,``).trim().length>0:!1}function kD(e){return e.parts.some(e=>e.type===`markdown`||e.type===`reasoning`?OD(e.text):!0)}function AD(){return(0,A.jsx)(`div`,{className:`flex items-center gap-2 px-1 py-0.5 text-[11px] text-gray-400`,children:(0,A.jsxs)(`div`,{className:`flex space-x-1 items-center h-full`,children:[(0,A.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-gray-400 animate-pulse`}),(0,A.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-gray-400 animate-pulse [animation-delay:200ms]`}),(0,A.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-gray-400 animate-pulse [animation-delay:400ms]`})]})})}function jD(e){let t=e.messages.filter(kD),n=t.some(e=>e.role===`assistant`&&(e.status===`streaming`||e.status===`pending`));return(0,A.jsxs)(`div`,{className:M(`space-y-5`,e.className),children:[t.map(t=>{let n=t.role===`user`,r=!n&&(t.status===`streaming`||t.status===`pending`);return(0,A.jsxs)(`div`,{className:M(`flex gap-3`,n?`justify-end`:`justify-start`),children:[n?null:(0,A.jsx)(Rh,{role:t.role}),(0,A.jsxs)(`div`,{className:M(`w-fit max-w-[92%] space-y-2`,n&&`flex flex-col items-end`),children:[(0,A.jsx)(wD,{message:t,texts:e.texts,onToolAction:e.onToolAction,onFileOpen:e.onFileOpen,renderToolAgent:e.renderToolAgent}),(0,A.jsx)(`div`,{className:M(`flex items-center gap-2`,n&&`justify-end`),children:r?(0,A.jsx)(AD,{}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(TD,{roleLabel:t.roleLabel,timestampLabel:t.timestampLabel,isUser:n}),n?null:(0,A.jsx)(ED,{message:t,texts:e.texts})]})})]}),n?(0,A.jsx)(Rh,{role:t.role}):null]},t.id)}),e.isSending&&!n?(0,A.jsxs)(`div`,{className:`flex justify-start gap-3`,children:[(0,A.jsx)(Rh,{role:`assistant`}),(0,A.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]})}var MD=`$`;function ND(e){return`${MD}${e}`}function PD(e,t){if(t.length===0)return;let n=e[e.length-1];if(n?.type===`text`){n.text+=t;return}e.push({type:`text`,text:t})}function FD(){return Gm()}function ID(e){return Km(e)}function LD(e){return Ym(e)}function RD(e){return Xm(e,`skill`)}function zD(e){return Xm(e,`file`)}function BD(e,t,n){let r=new Set(t),i=rh(e,e=>e.tokenKind===`skill`&&!r.has(e.tokenKey)),a=Xm(i,`skill`),o=new Map(n.map(e=>[e.ref,e])),s=t.filter(e=>!a.includes(e)).map(e=>Um({tokenKind:`skill`,tokenKey:e,label:o.get(e)?.name||e}));return s.length===0?i:qm([...i,...s])}function VD(e,t){let n=new Set(t.map(e=>e.id));return rh(e,e=>e.tokenKind===`file`&&!n.has(e.tokenKey))}function HD(e,t){let n=new Set(zD(e));return t.filter(e=>n.has(e.id))}function UD(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){if(t.type===`text`){PD(r,t.text);continue}if(t.tokenKind===`skill`){PD(r,ND(t.tokenKey));continue}if(t.tokenKind!==`file`)continue;let e=n.get(t.tokenKey);e&&r.push({type:`file`,name:e.name,mimeType:e.mimeType,...e.assetUri?{assetUri:e.assetUri}:{},...e.url?{url:e.url}:{},...e.contentBase64?{contentBase64:e.contentBase64}:{},sizeBytes:e.sizeBytes})}return r}var WD={isProviderStateResolved:!1,composerNodes:FD(),attachments:[],draft:``,pendingSessionType:`native`,pendingProjectRoot:null,pendingProjectRootSessionKey:null,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=g(e=>({snapshot:WD,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))}));async function GD(){let e=await ee.get(`/api/agents`);if(!e.ok)throw Error(e.error.message);return e.data}async function KD(e){let t=await ee.post(`/api/agents`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function qD(e,t){let n=await ee.put(`/api/agents/${encodeURIComponent(e)}`,t);if(!n.ok)throw Error(n.error.message);return n.data}async function JD(e){let t=await ee.delete(`/api/agents/${encodeURIComponent(e)}`);if(!t.ok)throw Error(t.error.message);return t.data}function YD(){return ne({queryKey:[`agents`],queryFn:GD,staleTime:3e4})}function XD(){let e=x();return re({mutationFn:({data:e})=>KD(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),m.success(o(`configSavedApplied`))},onError:e=>{m.error(o(`configSaveFailed`)+`: `+e.message)}})}function ZD(){let e=x();return re({mutationFn:({agentId:e,data:t})=>qD(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),m.success(o(`configSavedApplied`))},onError:e=>{m.error(o(`configSaveFailed`)+`: `+e.message)}})}function QD(){let e=x();return re({mutationFn:({agentId:e})=>JD(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),m.success(o(`configSavedApplied`))},onError:e=>{m.error(o(`configSaveFailed`)+`: `+e.message)}})}function $D(e){return new Date(e.session.updatedAt).getTime()}function eO(e){return[...e].sort((e,t)=>$D(t)-$D(e))}function tO(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-864e5,i=n-7*864e5,a=[],s=[],c=[],l=[];for(let t of e){let{session:e}=t,o=new Date(e.updatedAt).getTime();o>=n?a.push(t):o>=r?s.push(t):o>=i?c.push(t):l.push(t)}let u=[];return a.length>0&&u.push({label:o(`chatSidebarToday`),items:a}),s.length>0&&u.push({label:o(`chatSidebarYesterday`),items:s}),c.length>0&&u.push({label:o(`chatSidebarPrevious7Days`),items:c}),l.length>0&&u.push({label:o(`chatSidebarOlder`),items:l}),u}function nO(e){let t=new Map;for(let n of e){let e=n.session.projectRoot?.trim();if(!e)continue;let r=t.get(e),i=$D(n);if(r){r.items.push(n),r.latestUpdatedAt=Math.max(r.latestUpdatedAt,i);continue}t.set(e,{projectRoot:e,projectName:n.session.projectName?.trim()||tt(e)||e,items:[n],latestUpdatedAt:i})}return[...t.values()].map(e=>({...e,items:eO(e.items)})).sort((e,t)=>t.latestUpdatedAt-e.latestUpdatedAt)}function rO(e){if(e.label&&e.label.trim())return e.label.trim();let t=e.key.split(`:`);return t[t.length-1]||e.key}var iO=[{target:`/cron`,label:()=>o(`chatSidebarScheduledTasks`),icon:Ft},{target:`/skills`,label:()=>o(`chatSidebarSkills`),icon:ct},{target:`/agents`,label:()=>o(`agentsPageTitle`),icon:ht}];function aO(e,t,n){let r=j(e=>e.optimisticReadAtBySessionKey);return(0,k.useEffect)(()=>{(()=>{if(!t)return;let r=e.find(({session:e})=>e.key===t);if(!r)return;let{session:i}=r;n(i.key,i.lastMessageAt,i.readAt)})()},[e,n,t]),r}function oO(){let e=di(),n=at(),[r,i]=(0,k.useState)(!1),a=Z(e=>e.snapshot),s=j(e=>e.snapshot),c=T(),l=YD(),{isLoading:d,items:f}=ci(),{language:p,setLanguage:m}=Vt(),{theme:g,setTheme:_}=Rt(),v=o(ft.find(e=>e.value===g)?.labelKey??`themeWarm`),y=t.find(e=>e.value===p)?.label??p,b=(0,k.useMemo)(()=>new Map((l.data?.agents??[]).map(e=>[e.id,e])),[l.data?.agents]),x=(0,k.useMemo)(()=>eO(f),[f]),S=(0,k.useMemo)(()=>{let e=new Map;for(let t of f){let n=t.session.parentSessionId?.trim();if(!n)continue;let r=e.get(n)??[];r.push(t),e.set(n,r)}for(let t of e.values())t.sort((e,t)=>$D(t)-$D(e));return e},[f]),C=(0,k.useMemo)(()=>tO(x),[x]),w=(0,k.useMemo)(()=>nO(x),[x]),E=a.defaultSessionType||`native`,ee=(0,k.useMemo)(()=>a.sessionTypeOptions.filter(e=>e.value!==E),[E,a.sessionTypeOptions]),te=s.listMode===`project-first`,ne=aO(f,s.selectedSessionKey,e.chatSessionListManager.markSessionRead),{editingSessionKey:re,draftLabel:ie,savingSessionKey:D,setDraftLabel:ae,startEditingSessionLabel:oe,cancelEditingSessionLabel:se,saveSessionLabel:ce}=ei(),O=e=>{p!==e&&(m(e),window.location.reload())},le=({session:t,runStatus:n})=>{let r=s.selectedSessionKey===t.key,i=ne[t.key],o=i&&t.readAt?i.localeCompare(t.readAt)>0?i:t.readAt:i??t.readAt,c=ni({active:r,lastMessageAt:t.lastMessageAt,readAt:o,runStatus:n}),l=zr(t,a.sessionTypeOptions),u=re===t.key,d=D===t.key,f=S.get(t.key)??[];return(0,A.jsx)(qr,{session:t,active:r,showUnreadDot:c,runStatus:n,context:l,title:rO(t),agentId:t.agentId??null,agentLabel:t.agentId?b.get(t.agentId)?.displayName??t.agentId:null,agentAvatarUrl:t.agentId?b.get(t.agentId)?.avatarUrl??null:null,childSessionCount:f.length,isEditing:u,draftLabel:ie,isSaving:d,onSelect:()=>e.chatSessionListManager.selectSession(t.key),onOpenChildSessions:()=>e.chatThreadManager.openChildSessionPanel({parentSessionKey:t.key,activeChildSessionKey:f[0]?.session.key??null}),onStartEditing:()=>oe(t),onDraftLabelChange:ae,onSave:()=>ce(t),onCancel:se},t.key)};return(0,A.jsxs)(`aside`,{className:`w-[280px] shrink-0 flex flex-col h-full bg-secondary border-r border-gray-200/60`,children:[(0,A.jsx)(`div`,{className:`px-5 pt-5 pb-3`,children:(0,A.jsx)(Ht,{className:`flex items-center gap-2.5 min-w-0`,suffix:(0,A.jsx)(Er,{status:c.connectionStatus})})}),(0,A.jsx)(`div`,{className:`px-4 pb-3`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(h,{variant:`primary`,className:u(`min-w-0 rounded-xl`,ee.length>0?`flex-1 rounded-r-md`:`w-full`),onClick:()=>{i(!1),e.chatSessionListManager.createSession(E)},children:[(0,A.jsx)(We,{className:`h-4 w-4 mr-2`}),o(`chatSidebarNewTask`)]}),ee.length>0?(0,A.jsxs)(Et,{open:r,onOpenChange:i,children:[(0,A.jsx)(Ut,{asChild:!0,children:(0,A.jsx)(h,{variant:`primary`,size:`icon`,className:`h-9 w-10 shrink-0 rounded-xl rounded-l-md`,"aria-label":o(`chatSessionTypeLabel`),children:(0,A.jsx)(fe,{className:`h-4 w-4`})})}),(0,A.jsxs)(It,{align:`end`,className:`w-56 rounded-2xl border border-gray-200/80 bg-white p-1.5 shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:[(0,A.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:o(`chatSessionTypeLabel`)}),(0,A.jsx)(`div`,{className:`space-y-1`,children:ee.map(t=>(0,A.jsx)(Jr,{option:t,onSelect:()=>{e.chatSessionListManager.createSession(t.value),i(!1)}},t.value))})]})]}):null]})}),(0,A.jsx)(`div`,{className:`px-4 pb-3`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Ke,{className:`h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400`}),(0,A.jsx)(St,{value:s.query,onChange:t=>e.chatSessionListManager.setQuery(t.target.value),placeholder:o(`chatSidebarSearchPlaceholder`),className:`pl-8 h-9 rounded-lg text-xs`})]})}),(0,A.jsx)(`div`,{className:`px-3 pb-2`,children:(0,A.jsx)(`ul`,{className:`space-y-0.5`,children:iO.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsx)(Ct,{to:e.target,label:e.label(),icon:e.icon,density:`compact`})},e.target))})}),(0,A.jsx)(`div`,{className:`mx-4 border-t border-gray-200/60`}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between px-5 pb-2 pt-3`,children:[(0,A.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-gray-400`,children:o(`chatSidebarTaskRecords`)}),(0,A.jsx)(Yr,{isProjectFirstView:te,onSelectMode:e.chatSessionListManager.setListMode})]}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar px-3 py-2`,children:d?(0,A.jsx)(`div`,{className:`text-xs text-gray-500 p-3`,children:o(`sessionsLoading`)}):te?w.length===0?(0,A.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,A.jsx)(Pn,{className:`h-6 w-6 mx-auto mb-2 text-gray-300`}),(0,A.jsx)(`div`,{className:`text-xs text-gray-500`,children:o(`chatSidebarProjectViewEmpty`)})]}):(0,A.jsx)(Zr,{groups:w,defaultSessionType:E,sessionTypeOptions:a.sessionTypeOptions,renderSessionItem:le,onCreateSession:e.chatSessionListManager.createSession}):C.length===0?(0,A.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,A.jsx)(Pn,{className:`h-6 w-6 mx-auto mb-2 text-gray-300`}),(0,A.jsx)(`div`,{className:`text-xs text-gray-500`,children:o(`sessionsEmpty`)})]}):(0,A.jsx)(`div`,{className:`space-y-3`,children:C.map(e=>(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-medium text-gray-400 uppercase tracking-wider`,children:e.label}),(0,A.jsx)(`div`,{className:`space-y-0.5`,children:e.items.map(le)})]},e.label))})}),(0,A.jsxs)(`div`,{className:`px-3 py-3 border-t border-gray-200/60 space-y-0.5`,children:[(0,A.jsx)(Ct,{to:`/settings`,label:o(`settings`),icon:Tt,density:`compact`}),(0,A.jsx)(Pt,{onClick:()=>n.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:ue,label:o(`docBrowserHelp`),density:`compact`}),(0,A.jsx)(zt,{value:g,onValueChange:e=>_(e),icon:gt,label:o(`theme`),valueLabel:v,density:`compact`,children:ft.map(e=>(0,A.jsx)(Oe,{value:e.value,className:`text-xs`,children:o(e.labelKey)},e.value))}),(0,A.jsx)(zt,{value:p,onValueChange:e=>O(e),icon:_t,label:o(`language`),valueLabel:y,density:`compact`,children:t.map(e=>(0,A.jsx)(Oe,{value:e.value,className:`text-xs`,children:e.label},e.value))})]})]})}function sO(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return t;let n=e.error;if(!n||typeof n!=`object`||Array.isArray(n))return t;let r=n.message;return typeof r==`string`&&r.trim().length>0?r:t}async function cO(e){let t=new FormData;for(let n of e)t.append(`files`,n);let n=await fetch(`${S}/api/ncp/assets`,{method:`POST`,body:t,credentials:`include`}),r=await n.json();if(!n.ok||!r.ok)throw Error(sO(r,`Failed to put assets.`));return r.data.assets.map(e=>({id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes,assetUri:e.assetUri,url:e.url}))}var lO={exactSpec:1200,exactLabel:1150,prefixSpec:1e3,prefixLabel:950,prefixToken:900,containsSpec:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function uO(e){let t=e.modelLabel.trim(),n=e.providerLabel.trim();return n?`${n}/${t}`:t}function dO(e){return(e??``).trim().toLowerCase()}function fO(e,t){if(!e||!t)return!1;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n>=e.length))return!0;return!1}function pO(e,t){let n=dO(t);if(!n)return lO.fallback;let r=dO(e.key),i=dO(e.label||e.key),a=dO(`${e.descriptionZh??``} ${e.description??``}`),o=i.split(/[\s/_-]+/).filter(Boolean);return r===n?lO.exactSpec:i===n?lO.exactLabel:r.startsWith(n)?lO.prefixSpec:i.startsWith(n)?lO.prefixLabel:o.some(e=>e.startsWith(n))?lO.prefixToken:r.includes(n)?lO.containsSpec:i.includes(n)?lO.containsLabel:a.includes(n)?lO.containsDescription:fO(n,i)||fO(n,r)?lO.subsequence:0}function mO(e){return e>=lO.exactLabel?4:e>=lO.prefixToken?3:e>=lO.containsLabel?2:e>0?1:0}function hO(e){return new Map(e.map((e,t)=>[e,t]))}function gO(e,t){let n=hO(t),r=[],i=[];for(let t of e){if(n.has(t.key)){r.push(t);continue}i.push(t)}return r.sort((e,t)=>(n.get(e.key)??1/0)-(n.get(t.key)??1/0)),[...r,...i]}function _O(e,t,n,r=[]){let i=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),a=hO(r);return e.map((e,n)=>({record:e,order:n,score:pO(e,t)})).filter(e=>e.score>0).sort((e,t)=>{let n=mO(e.score),r=mO(t.score);if(r!==n)return r-n;let o=a.get(e.record.key)??1/0,s=a.get(t.record.key)??1/0;if(o!==s)return o-s;if(t.score!==e.score)return t.score-e.score;let c=(e.record.label||e.record.key).trim(),l=(t.record.label||t.record.key).trim(),u=i.compare(c,l);return u===0?e.order-t.order:u}).map(({record:e})=>({key:`skill:${e.key}`,title:e.label||e.key,subtitle:n.slashSkillSubtitle,description:(e.descriptionZh??e.description??``).trim()||n.noSkillDescription,detailLines:[`${n.slashSkillSpecLabel}: ${e.key}`,...e.scopeLabel?[`${n.slashSkillScopeLabel}: ${e.scopeLabel}`]:[]],value:e.key}))}function vO(e){return e.map(e=>({key:e.key,label:e.label,description:e.descriptionZh||e.description||``,badgeLabel:e.badgeLabel}))}function yO(e){let t=gO(e.skillRecords,e.recentSkillValues??[]),n=new Set(e.groupedRecentSkillValues??[]),r=vO(t.filter(e=>n.has(e.key))),i=vO(t.filter(e=>!n.has(e.key)));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:vO(t),groups:r.length>0?[{key:`recent-skills`,label:e.texts.recentSkillsLabel,options:r},{key:`all-skills`,label:e.texts.allSkillsLabel,options:i}].filter(e=>e.options.length>0):void 0,selectedKeys:e.selectedSkills,onSelectedKeysChange:e.onSelectedKeysChange}}function bO(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 xO(e){let t=e.modelOptions.find(t=>t.value===e.selectedModel),n=e.modelOptions[0],r=t??n,i=e.hasModelOptions?r?.value:void 0,a=new Set(e.recentModelValues??[]),o=new Map(e.modelOptions.map(e=>[e.value,e])),s=(e.recentModelValues??[]).map(e=>o.get(e)).filter(e=>!!e),c=e.modelOptions.filter(e=>!a.has(e.value)),l=s.length>0?[{key:`recent-models`,label:e.texts.recentModelsLabel,options:s.map(e=>({value:e.value,label:uO(e)}))},{key:`all-models`,label:e.texts.allModelsLabel,options:c.map(e=>({value:e.value,label:uO(e)}))}].filter(e=>e.options.length>0):void 0;return{key:`model`,value:i,placeholder:e.texts.modelSelectPlaceholder,selectedLabel:r?uO(r):void 0,icon:`sparkles`,options:e.modelOptions.map(e=>({value:e.value,label:uO(e)})),groups:l,disabled:!e.hasModelOptions,loading:e.isModelOptionsLoading,emptyLabel:e.texts.modelNoOptionsLabel,onValueChange:e.onValueChange}}function SO(e){let t=[];for(let n of[`off`,...e])t.includes(n)||t.push(n);return t}function CO(e){if(e.supportedLevels.length===0)return null;let t=SO(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(t=>({value:t,label:e.texts.thinkingLabels[t]})),onValueChange:t=>e.onValueChange(t)}}function wO(e){return e.modelOptions.length>0}function TO(e){return!e.isProviderStateResolved&&!wO(e)}function EO(e){return e.isProviderStateResolved&&!wO(e)}function DO(e){return e.sessionTypeUnavailable}function OO(e){let{hasSendableDraft:t,isRuntimeBlocked:n,snapshot:r}=e;return n||!t||!wO(r)||r.sessionTypeUnavailable}var kO=class{constructor(e){this.options=e}read(){let e=this.getStorage();if(!e)return[];try{return this.normalizeList(JSON.parse(e.getItem(this.options.storageKey)??`[]`))}catch{return[]}}remember(e){let t=this.normalizeValue(e);if(!t)return this.read();let n=[t,...this.read().filter(e=>e!==t)].slice(0,this.options.limit);return this.write(n),n}resolveVisible(e){let t=this.normalizeList(e.availableValues,1/0);if(t.length<=e.minAvailableCount)return[];let n=new Set(t),r=[],i=Math.max(1,e.limit??this.options.limit);for(let e of this.read())if(!(!n.has(e)||r.includes(e))&&(r.push(e),r.length>=i))break;return r}write(e){let t=this.getStorage();if(t)try{t.setItem(this.options.storageKey,JSON.stringify(this.normalizeList(e)))}catch{}}getStorage(){return Object.prototype.hasOwnProperty.call(this.options,`storage`)?this.options.storage??null:typeof window>`u`?null:window.localStorage}normalizeList(e,t=this.options.limit){if(!Array.isArray(e))return[];let n=[];for(let r of e){let e=this.normalizeValue(r);if(!(!e||n.includes(e))&&(n.push(e),n.length>=t))break}return n}normalizeValue(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}},AO=new kO({storageKey:`nextclaw.chat.recent-models`,limit:3}),jO=new kO({storageKey:`nextclaw.chat.recent-skills`,limit:5});function MO(){return{off:o(`chatThinkingLevelOff`),minimal:o(`chatThinkingLevelMinimal`),low:o(`chatThinkingLevelLow`),medium:o(`chatThinkingLevelMedium`),high:o(`chatThinkingLevelHigh`),adaptive:o(`chatThinkingLevelAdaptive`),xhigh:o(`chatThinkingLevelXhigh`)}}function NO(e,t){return e.map(e=>({key:e.ref,label:e.name,scopeLabel:t[e.scope],description:e.description,descriptionZh:e.descriptionZh,badgeLabel:t[e.scope]}))}function PO(e){return e.map(e=>({value:e.value,modelLabel:e.modelLabel,providerLabel:e.providerLabel,thinkingCapability:e.thinkingCapability?{supported:e.thinkingCapability.supported,default:e.thinkingCapability.default??null}:null}))}function FO(){let e=di(),{language:t}=Vt(),n=Z(e=>e.snapshot),r=E(),[i,a]=(0,k.useState)(null),s=(0,k.useRef)(null),c=(0,k.useRef)(null),l=(0,k.useMemo)(()=>({builtin:o(`chatSkillScopeBuiltin`),project:o(`chatSkillScopeProject`),workspace:o(`chatSkillScopeWorkspace`)}),[t]),u=(0,k.useMemo)(()=>({slashSkillSubtitle:o(`chatSlashTypeSkill`),slashSkillSpecLabel:o(`chatSlashSkillSpec`),slashSkillScopeLabel:o(`chatSlashSkillScope`),noSkillDescription:o(`chatSkillsPickerNoDescription`)}),[t]),d=(0,k.useMemo)(()=>NO(n.skillRecords,l),[n.skillRecords,l]),f=(0,k.useMemo)(()=>PO(n.modelOptions),[n.modelOptions]),p=AO.resolveVisible({availableValues:f.map(e=>e.value),minAvailableCount:5}),h=jO.resolveVisible({availableValues:d.map(e=>e.key),minAvailableCount:0}),g=jO.resolveVisible({availableValues:d.map(e=>e.key),minAvailableCount:4}),_=wO(n),v=TO(n),y=EO(n),b=DO(n),x=typeof e.chatInputManager.addAttachments==`function`,S=o(y?`chatModelNoOptions`:`chatInputPlaceholder`),C=o(`chatPickerRecentModels`),w=o(`chatPickerAllModels`),T=o(`chatPickerRecent`),ee=o(`chatPickerAllSkills`),te=(0,k.useMemo)(()=>_O(d,i??``,u,h),[i,d,u,h]),ne=f.find(e=>e.value===n.selectedModel)?.thinkingCapability,re=ne?.supported??[],ie=n.stopDisabledReason===`__preparing__`?o(`chatStopPreparing`):n.stopDisabledReason?.trim()||o(`chatStopUnavailable`),D=(0,k.useCallback)(e=>{if(e===`unsupported-type`){m.error(o(`chatInputAttachmentUnsupported`));return}if(e===`too-large`){m.error(o(`chatInputAttachmentTooLarge`).replace(`{maxMb}`,String(yr/(1024*1024))));return}m.error(o(`chatInputAttachmentReadFailed`))},[]),ae=(0,k.useCallback)(async t=>{if(!x||t.length===0)return;let n=await wr(t,{uploadBatch:cO});if(n.attachments.length>0){let t=e.chatInputManager.addAttachments?.(n.attachments)??[];t.length>0&&s.current?.insertFileTokens(t.map(e=>({tokenKey:e.id,label:e.name})))}n.rejected.length>0&&D(n.rejected[0].reason)},[x,e.chatInputManager,D]),oe=[xO({modelOptions:f,recentModelValues:p,selectedModel:n.selectedModel,isModelOptionsLoading:v,hasModelOptions:_,onValueChange:e.chatInputManager.selectModel,texts:{modelSelectPlaceholder:o(`chatSelectModel`),modelNoOptionsLabel:o(`chatModelNoOptions`),recentModelsLabel:C,allModelsLabel:w}}),CO({supportedLevels:re,selectedThinkingLevel:n.selectedThinkingLevel,defaultThinkingLevel:ne?.default??null,onValueChange:t=>e.chatInputManager.selectThinkingLevel(t),texts:{thinkingLabels:MO()}})].filter(e=>e!==null),se=yO({skillRecords:d,recentSkillValues:h,groupedRecentSkillValues:g,selectedSkills:n.selectedSkills,isLoading:n.isSkillsLoading,onSelectedKeysChange:e.chatInputManager.selectSkills,texts:{title:o(`chatSkillsPickerTitle`),searchPlaceholder:o(`chatSkillsPickerSearchPlaceholder`),emptyLabel:o(`chatSkillsPickerEmpty`),loadingLabel:o(`sessionsLoading`),manageLabel:o(`chatSkillsPickerManage`),recentSkillsLabel:T,allSkillsLabel:ee}}),ce=RD(n.composerNodes).length,O=n.draft.trim().length>0||n.attachments.length>0||ce>0;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Lh,{ref:s,composer:{nodes:n.composerNodes,placeholder:S,disabled:b,onNodesChange:e.chatInputManager.setComposerNodes,...x?{onFilesAdd:ae}:{},onSlashQueryChange:a},slashMenu:{isLoading:n.isSkillsLoading,items:te,onSelectItem:t=>{t.value&&e.chatInputManager.rememberSkillSelection(t.value)},texts:{slashLoadingLabel:o(`chatSlashLoading`),slashSectionLabel:o(`chatSlashSectionSkills`),slashEmptyLabel:o(`chatSlashNoResult`),slashHintLabel:o(`chatSlashHint`),slashSkillHintLabel:o(`chatSlashSkillHint`)}},hint:bO({isModelOptionsLoading:v,isModelOptionsEmpty:y,onGoToProviders:e.chatInputManager.goToProviders,texts:{noModelOptionsLabel:o(`chatModelNoOptions`),configureProviderLabel:o(`chatGoConfigureProvider`)}}),toolbar:{selects:oe,accessories:[{key:`attach`,label:o(`chatInputAttach`),icon:`paperclip`,iconOnly:!0,disabled:!x||b||n.isSending,...x?{onClick:()=>c.current?.click()}:{tooltip:o(`chatInputAttachComingSoon`)}}],skillPicker:se,actions:{sendError:r.isBlocked?null:n.sendError,isSending:n.isSending,canStopGeneration:n.canStopGeneration,sendDisabled:OO({snapshot:n,hasSendableDraft:O,isRuntimeBlocked:r.isBlocked}),stopDisabled:!n.canStopGeneration,stopHint:ie,sendButtonLabel:o(`chatSend`),stopButtonLabel:o(`chatStop`),onSend:e.chatInputManager.send,onStop:e.chatInputManager.stop}}}),x?(0,A.jsx)(`input`,{ref:c,type:`file`,multiple:!0,className:`hidden`,onChange:async e=>{let t=Array.from(e.target.files??[]);e.currentTarget.value=``,await ae(t)}}):null]})}var IO=[`cmd`,`command`,`query`,`q`,`path`,`url`,`to`,`channel`,`agentId`,`sessionKey`];function LO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function RO(e,t=2400){return e.length<=t?e:`${e.slice(0,t)}\n…`}function zO(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:t<=1?`…`:`${n.slice(0,t-1)}…`}function BO(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(e==null)return``;try{return RO(JSON.stringify(e,null,2))}catch{return String(e)}}function VO(e){if(LO(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return null;try{let e=JSON.parse(t);return LO(e)?e:null}catch{return null}}function HO(e){let t=VO(e);if(!t){let t=BO(e).trim();return t?zO(t,120):void 0}let n=[];for(let e of IO){let r=t[e];if(typeof r==`string`&&r.trim()?n.push(`${e}: ${r.trim()}`):(typeof r==`number`||typeof r==`boolean`)&&n.push(`${e}: ${String(r)}`),n.length>=2)break}return n.length>0?zO(n.join(` · `),120):zO(BO(t),140)}var UO=`ui_inline_tokens`,WO=`$`;function GO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function KO(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function qO(e){let t=new Set,n=[];for(let r of e){let e=`${r.kind}:${r.key}:${r.rawText}`;t.has(e)||(t.add(e),n.push(r))}return n}function JO(e){let t=[];for(let n of e)n.type!==`token`||n.tokenKind!==`skill`||t.push({kind:`skill`,key:n.tokenKey,label:n.label,rawText:`${WO}${n.tokenKey}`});return qO(t)}function YO(e){let t=e?.[UO];if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!GO(e))continue;let t=KO(e.kind),r=KO(e.key),i=KO(e.rawText);!t||!r||!i||n.push({kind:t,key:r,rawText:i,label:KO(e.label)??r})}return qO(n)}function XO(e,t){if(e.length===0||t.length===0)return e.length===0?[]:[{type:`text`,text:e}];let n=[...t].sort((e,t)=>t.rawText.length-e.rawText.length),r=[],i=0;for(;i<e.length;){let t=null;for(let r of n)if(e.startsWith(r.rawText,i)){t=r;break}if(!t){let t=i+1;for(;t<e.length&&!n.some(n=>e.startsWith(n.rawText,t));)t+=1;r.push({type:`text`,text:e.slice(i,t)}),i=t;continue}r.push({type:`token`,token:t}),i+=t.rawText.length}return r}var ZO=/\u200B|\u200C|\u200D|\u2060|\uFEFF/g;function QO(e){let t=e.trim();return t&&t.replace(ZO,``).trim()?t:null}function $O(e){return e.replace(ZO,``).trim().length>0}function ek(e,t){let n=XO(e,t);if(n.length===0)return null;let r=[],i=!1;for(let e of n){if(e.type===`token`){i=!0,r.push({type:`token`,token:{kind:e.token.kind,key:e.token.key,label:e.token.label,rawText:e.token.rawText}});continue}e.text.length!==0&&($O(e.text)&&(i=!0),r.push({type:`markdown`,text:e.text}))}return i?r:null}function tk(e,t){let n=ek(e.text,t);if(n&&n.some(e=>e.type===`token`))return{type:`inline-content`,segments:n};let r=QO(e.text);return r?{type:`markdown`,text:r}:null}function nk(e){return QO(e)}function rk(e){return typeof e==`object`&&!!e}function ik(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function ak(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function ok(e){let t=ik(e);return rk(t)?ak(t.agentId):null}function sk(e){return ok(e.parsedArgs)??ok(e.args)??ok(e.result)}var ck=12e3,lk=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function uk(e){let t=e.replace(/\r\n/g,`
50
+ `).replace(/\r/g,`
51
+ `);return t===``?[]:t.split(`
52
+ `)}function dk(e){return typeof e==`number`?e+1:void 0}function fk(e){return{kind:e.kind,text:e.text,...typeof e.oldLineNumber==`number`?{oldLineNumber:e.oldLineNumber}:{},...typeof e.newLineNumber==`number`?{newLineNumber:e.newLineNumber}:{}}}function pk(e){let t=lk.exec(e);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}function mk(e){return uk(e.text).map((t,n)=>e.kind===`add`?fk({kind:`add`,text:t,newLineNumber:e.newStartLine+n}):fk({kind:`context`,text:t,oldLineNumber:e.oldStartLine+n,newLineNumber:e.newStartLine+n}))}function hk(e){let t=e.oldStartLine,n=e.newStartLine;return[...e.beforeLines.map(e=>{let n=fk({kind:`remove`,text:e,oldLineNumber:t});return t=dk(t),n}),...e.afterLines.map(e=>{let t=fk({kind:`add`,text:e,newLineNumber:n});return n=dk(n),t})]}function gk(e){let t=Array.from({length:e.beforeLines.length+1},()=>Array.from({length:e.afterLines.length+1},()=>0));for(let n=e.beforeLines.length-1;n>=0;--n)for(let r=e.afterLines.length-1;r>=0;--r)t[n][r]=e.beforeLines[n]===e.afterLines[r]?(t[n+1][r+1]??0)+1:Math.max(t[n+1][r]??0,t[n][r+1]??0);return t}function _k(e){for(let t=e.beforeIndex;t<e.beforeLines.length;t+=1)e.lines.push(fk({kind:`remove`,text:e.beforeLines[t]??``,oldLineNumber:e.oldLineNumber})),e.oldLineNumber=dk(e.oldLineNumber);for(let t=e.afterIndex;t<e.afterLines.length;t+=1)e.lines.push(fk({kind:`add`,text:e.afterLines[t]??``,newLineNumber:e.newLineNumber})),e.newLineNumber=dk(e.newLineNumber)}function vk(e){let t=uk(e.beforeText),n=uk(e.afterText);if(t.length*n.length>ck)return hk({beforeLines:t,afterLines:n,oldStartLine:e.oldStartLine,newStartLine:e.newStartLine});let r=gk({beforeLines:t,afterLines:n}),i=[],a=0,o=0,s=e.oldStartLine,c=e.newStartLine;for(;a<t.length&&o<n.length;){if(t[a]===n[o]){i.push(fk({kind:`context`,text:t[a]??``,oldLineNumber:s,newLineNumber:c})),a+=1,o+=1,s=dk(s),c=dk(c);continue}if((r[a+1][o]??0)>=(r[a][o+1]??0)){i.push(fk({kind:`remove`,text:t[a]??``,oldLineNumber:s})),a+=1,s=dk(s);continue}i.push(fk({kind:`add`,text:n[o]??``,newLineNumber:c})),o+=1,c=dk(c)}return _k({lines:i,beforeLines:t,afterLines:n,beforeIndex:a,afterIndex:o,oldLineNumber:s,newLineNumber:c}),i}var yk=120;function bk(e){let t=e.lines.filter(e=>e.kind===`add`).length,n=e.lines.filter(e=>e.kind===`remove`).length,r=[],i=e.operation?.trim().toLowerCase()??``;return i&&i!==`update`&&r.push(i),t>0&&r.push(`+${t}`),n>0&&r.push(`-${n}`),r.length>0?r.join(` · `):void 0}function xk(e){let t=e.operation?.trim().toLowerCase()??``;return{oldStartLine:typeof e.oldStartLine==`number`?e.oldStartLine:(t===`delete`||t===`remove`)&&e.beforeText!=null?1:void 0,newStartLine:typeof e.newStartLine==`number`?e.newStartLine:(t===`write`||t===`add`)&&e.afterText!=null?1:void 0}}function Sk(e){return e.length<=yk?{lines:e,truncated:!1}:{lines:e.slice(0,yk),truncated:!0}}function Ck(e){let t=e.text.trim();if(!t)return null;let n=e.operation?.trim().toLowerCase()===`write`?`add`:`context`,r=typeof e.oldStartLine==`number`?e.oldStartLine:1,i=typeof e.newStartLine==`number`?e.newStartLine:1,a=mk({text:t,kind:n,oldStartLine:r,newStartLine:i});return{path:e.path,display:`preview`,caption:bk({operation:e.operation,lines:a}),lines:a,rawText:t,oldStartLine:r,newStartLine:i}}function wk(e){let{oldStartLine:t,newStartLine:n}=xk(e),r=vk({beforeText:e.beforeText??``,afterText:e.afterText??``,oldStartLine:t,newStartLine:n}),i=Sk(r);return i.lines.length===0?null:{path:e.path,display:`diff`,caption:bk({operation:e.operation,lines:r}),lines:i.lines,...i.truncated?{fullLines:r}:{},...e.beforeText==null?{}:{beforeText:e.beforeText},...e.afterText==null?{}:{afterText:e.afterText},...typeof t==`number`?{oldStartLine:t}:{},...typeof n==`number`?{newStartLine:n}:{},truncated:i.truncated}}function Tk(e){let t=Sk(e.lines);return{path:e.path,display:`diff`,caption:bk({operation:e.operation,lines:e.lines}),lines:t.lines,...t.truncated?{fullLines:e.lines}:{},truncated:t.truncated}}function Ek(e){return e.line.startsWith(`*** Update File: `)?(e.flushCurrent(),e.setCurrent(e.line.slice(17).trim(),`update`),!0):e.line.startsWith(`*** Add File: `)?(e.flushCurrent(),e.setCurrent(e.line.slice(14).trim(),`add`),!0):e.line.startsWith(`*** Delete File: `)?(e.flushCurrent(),e.setCurrent(e.line.slice(17).trim(),`delete`),!0):!1}function Dk(e){let{currentLines:t,line:n}=e;return n.startsWith(`+`)?(t.push(fk({kind:`add`,text:n.slice(1),newLineNumber:e.newLineNumber})),{oldLineNumber:e.oldLineNumber,newLineNumber:dk(e.newLineNumber)}):n.startsWith(`-`)?(t.push(fk({kind:`remove`,text:n.slice(1),oldLineNumber:e.oldLineNumber})),{oldLineNumber:dk(e.oldLineNumber),newLineNumber:e.newLineNumber}):n.startsWith(` `)?(t.push(fk({kind:`context`,text:n.slice(1),oldLineNumber:e.oldLineNumber,newLineNumber:e.newLineNumber})),{oldLineNumber:dk(e.oldLineNumber),newLineNumber:dk(e.newLineNumber)}):{oldLineNumber:e.oldLineNumber,newLineNumber:e.newLineNumber}}function Ok(e){let t=[],n=null,r=null,i=[],a,o,s=()=>{if(!n){i=[],r=null,a=void 0,o=void 0;return}t.push(Tk({path:n,operation:r,lines:i})),n=null,r=null,i=[],a=void 0,o=void 0};for(let t of uk(e)){if(Ek({line:t,flushCurrent:s,setCurrent:(e,t)=>{n=e,r=t}})||t.startsWith(`*** Move to: `)||t.startsWith(`*** Begin Patch`)||t.startsWith(`*** End Patch`))continue;if(t.startsWith(`@@`)){let e=pk(t);a=e?.oldLineNumber,o=e?.newLineNumber;continue}if(!n)continue;let e=Dk({currentLines:i,line:t,oldLineNumber:a,newLineNumber:o});a=e.oldLineNumber,o=e.newLineNumber}return s(),t}function kk(e){let t=[],n=null,r=[],i,a,o=()=>{if(!n){r=[],i=void 0,a=void 0;return}t.push(Tk({path:n,operation:`update`,lines:r})),n=null,r=[],i=void 0,a=void 0};for(let t of uk(e)){if(t.startsWith(`+++ `)){o(),n=t.slice(4).trim().replace(/^b\//,``).replace(/^a\//,``);continue}if(t.startsWith(`--- `))continue;if(t.startsWith(`@@`)){let e=pk(t);i=e?.oldLineNumber,a=e?.newLineNumber;continue}if(!n)continue;let e=Dk({currentLines:r,line:t,oldLineNumber:i,newLineNumber:a});i=e.oldLineNumber,a=e.newLineNumber}return o(),t}function Ak(e){return e.includes(`*** Begin Patch`)?Ok(e):e.includes(`--- `)&&e.includes(`+++ `)?kk(e):[]}function jk(e){switch(e){case`"`:case`\\`:case`/`:return e;case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
53
+ `;case`r`:return`\r`;case`t`:return` `;default:return e}}function Mk(e,t){let n=`"${t}"`,r=e.indexOf(n);if(r<0)return null;let i=e.indexOf(`:`,r+n.length);if(i<0)return null;let a=i+1;for(;a<e.length&&/\s/.test(e[a]??``);)a+=1;return e[a]===`"`?a+1:null}function Nk(e,t,n=1/0){let r=``,i=!1;for(let a=t;a<e.length;a+=1){let t=e[a];if(t==null)break;if(i){r+=jk(t),i=!1;continue}if(t===`\\`){i=!0;continue}if(t===`"`)return{value:r,truncated:!1};if(r+=t,r.length>=n)return{value:r,truncated:!0}}return r.length>0?{value:r,truncated:!1}:null}function Pk(e,t,n=1/0){for(let r of t){let t=Mk(e,r);if(t!=null)return Nk(e,t,n)}return null}function Fk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Ik(e){return typeof e==`string`&&e.trim()?e.trim():null}function Lk(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:typeof e==`string`&&/^\d+$/.test(e.trim())?Number(e.trim()):null}function Rk(e){if(Fk(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;try{let e=JSON.parse(t);return Fk(e)?e:null}catch{return null}}function zk(e){if(Fk(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;let n=Pk(t,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`])?.value??null,r=Pk(t,[`content`,`text`,`afterText`,`after_text`])?.value??null,i=Pk(t,[`oldText`,`beforeText`,`before_text`])?.value??null,a=Pk(t,[`newText`,`afterText`,`after_text`])?.value??null,o=Pk(t,[`patch`,`diff`,`unifiedDiff`,`unified_diff`])?.value??null,s={};return n&&(s.path=n),r&&(s.content=r),i&&(s.oldText=i),a&&(s.newText=a),o&&(s.patch=o),Object.keys(s).length>0?s:null}function Bk(e){return Ik(e.path)??Ik(e.filePath)??Ik(e.file_path)??Ik(e.targetPath)??Ik(e.target_path)??Ik(e.filename)??Ik(e.name)}function Vk(e){return Q(e.operation)??Q(e.op)??Q(e.action)??Q(e.kind)??Q(e.type)??Q(e.status)}function Hk(e,t){for(let n of t){let t=Lk(e[n]);if(t!==null)return t}return null}function Uk(e){return Hk(e,[`oldStartLine`,`old_start_line`,`startOldLine`,`start_old_line`,`oldLineStart`,`old_line_start`,`oldLineNumber`,`old_line_number`,`lineStart`,`line_start`,`startLine`,`start_line`,`lineNumber`,`line_number`])}function Wk(e){return Hk(e,[`newStartLine`,`new_start_line`,`startNewLine`,`start_new_line`,`newLineStart`,`new_line_start`,`newLineNumber`,`new_line_number`,`lineStart`,`line_start`,`startLine`,`start_line`,`lineNumber`,`line_number`])}function Gk(e){return Q(e.patch)??Q(e.diff)??Q(e.unifiedDiff)??Q(e.unified_diff)}function Kk(e){return Q(e.beforeText)??Q(e.before_text)??Q(e.oldText)??Q(e.old_text)??Q(e.oldContent)??Q(e.old_content)??Q(e.before)??Q(e.previous)}function qk(e){return Q(e.afterText)??Q(e.after_text)??Q(e.newText)??Q(e.new_text)??Q(e.newContent)??Q(e.new_content)??Q(e.content)??Q(e.text)??Q(e.after)??Q(e.updated)}var Jk=new Set([`file_change`,`read_file`,`write_file`,`edit_file`,`apply_patch`]);function Yk(e){let t=e.map((e,t)=>({key:`${e.path}-${t+1}`,path:e.path,display:e.display,...e.caption?{caption:e.caption}:{},lines:e.lines,...e.fullLines?{fullLines:e.fullLines}:{},...e.rawText?{rawText:e.rawText}:{},...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{},...e.truncated?{truncated:!0}:{}})).filter(e=>e.lines.length>0||!!e.rawText);if(t.length===0)return null;let n=t.map(e=>e.path);return{summary:n.length===1?n[0]:`${n.length} files · ${n.slice(0,2).join(` · `)}${n.length>2?` …`:``}`,fileOperation:{blocks:t}}}function Xk(e,t){let n=Bk(e)??t,r=Vk(e),i=Uk(e),a=Wk(e),o=Gk(e);if(o){let e=Ak(o);if(e.length>0)return e[0]??null}let s=Kk(e),c=qk(e);if(s!=null||c!=null)return wk({path:n,beforeText:s,afterText:c,operation:r,oldStartLine:i,newStartLine:a});let l=Q(e.preview);return l?Ck({path:n,text:l,operation:r,oldStartLine:i,newStartLine:a}):null}function Zk(e){if(!Array.isArray(e))return[];let t=[];return e.forEach((e,n)=>{if(typeof e==`string`){let n=Ak(e);n.length>0&&t.push(...n);return}if(!Fk(e))return;let r=Xk(e,Bk(e)??`file-${n+1}`);if(r){t.push(r);return}let i=Array.isArray(e.changes)?Zk(e.changes):[];i.length>0&&t.push(...i)}),t}function Qk(e){let t=Rk(e.result)??Rk(e.parsedArgs)??Rk(e.args);return t?Yk(Zk(t.changes)):null}function $k(e){let t=Rk(e.parsedArgs)??Rk(e.args)??zk(e.args),n=t&&Bk(t),r=Q(e.result);return!n||!r?null:Yk([Ck({path:n,text:r,operation:`read`})].filter(e=>!!e))}function eA(e){if(e.status===`partial-call`&&typeof e.args==`string`){let t=Pk(e.args,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`]),n=Pk(e.args,[`content`,`text`,`afterText`,`after_text`]);if(t?.value&&n?.value){let e=Ck({path:t.value,text:n.value,operation:`write`});if(e)return Yk([e])}}let t=Rk(e.parsedArgs)??Rk(e.args)??zk(e.args);if(!t)return null;let n=Bk(t),r=Q(t.content);return!n||!r?null:Yk([Ck({path:n,text:r,operation:`write`})].filter(e=>!!e))}function tA(e){let t=Rk(e.result),n=Rk(e.parsedArgs)??Rk(e.args)??zk(e.args);if(!t&&!n)return null;let r=(t?Bk(t):null)??(n?Bk(n):null),i=(t?Kk(t):null)??(n?Kk(n):null),a=(t?qk(t):null)??(n?qk(n):null),o=(t?Uk(t):null)??(n?Uk(n):null),s=(t?Wk(t):null)??(n?Wk(n):null);return!r||i==null&&a==null?null:Yk([wk({path:r,beforeText:i,afterText:a,operation:`edit`,oldStartLine:o,newStartLine:s})].filter(e=>!!e))}function nA(e){let t=Rk(e.parsedArgs),n=Rk(e.args)??zk(e.args),r=Q(e.args)??(t?Q(t.patch):null)??(n?Q(n.patch):null);return r?Yk(Ak(r)):null}function rA(e){return Jk.has(e.toolName)?e.toolName===`file_change`?Qk(e):e.toolName===`read_file`?$k(e):e.toolName===`write_file`?eA(e):e.toolName===`edit_file`?tA(e):e.toolName===`apply_patch`?nA(e):null:null}function iA(e){return typeof e==`object`&&!!e}function $(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function aA(e){return!iA(e)||e.kind!==`nextclaw.session_request`?null:e}function oA(e){return!iA(e)||e.kind!==`nextclaw.session`?null:e}function sA(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function cA(e){return BO(sA(e)).trim()||void 0}function lA(e,t){return[$(e.title)?`title: ${e.title?.trim()}`:null,$(e.sessionId)?`session: ${e.sessionId?.trim()}`:null,$(e.task)?`task: ${e.task?.trim()}`:null].filter(e=>!!e).join(` · `)||HO(t)}function uA(e,t){return[$(e.title)?`title: ${e.title?.trim()}`:null,$(e.sessionId)?`session: ${e.sessionId?.trim()}`:null].filter(e=>!!e).join(` · `)||HO(t)}function dA(e){let t=$(e.requestId),n=$(e.sessionId),r=$(e.title),i=$(e.task),a=$(e.status),o=$(e.notify),s=$(e.lifecycle),c=$(e.parentSessionId),l=$(e.spawnedByRequestId),u=e.message===void 0?``:BO(e.message).trim(),d=e.finalResponseText===void 0?``:BO(e.finalResponseText).trim(),f=e.error===void 0?``:BO(e.error).trim(),p=[t?`Request ID: ${t}`:null,n?`Session ID: ${n}`:null,typeof e.isChildSession==`boolean`?`Target: ${e.isChildSession?`child`:`session`}`:null,a?`Status: ${a}`:null,o?`Notify: ${o}`:null,s?`Lifecycle: ${s}`:null,c?`Parent Session ID: ${c}`:null,l?`Spawned By Request ID: ${l}`:null,r?`Title: ${r}`:null,i?`Task:\n${i}`:null,d?`Final Response:\n${d}`:f?`Error:\n${f}`:u?`Status:\n${u}`:null].filter(e=>!!e);return p.length>0?p.join(`
54
+
55
+ `):void 0}function fA(e){let t=$(e.sessionId),n=$(e.title),r=$(e.sessionType),i=$(e.lifecycle),a=$(e.parentSessionId),o=$(e.createdAt),s=[t?`Session ID: ${t}`:null,typeof e.isChildSession==`boolean`?`Target: ${e.isChildSession?`child`:`session`}`:null,n?`Title: ${n}`:null,r?`Session Type: ${r}`:null,i?`Lifecycle: ${i}`:null,a?`Parent Session ID: ${a}`:null,o?`Created At: ${o}`:null].filter(e=>!!e);return s.length>0?s.join(`
56
+
57
+ `):void 0}function pA(e){let{invocation:t,texts:n}=e,{toolName:r,toolCallId:i,args:a,result:o}=t;if(r!==`spawn`&&r!==`sessions_request`&&r!==`sessions_spawn`)return null;let s=aA(o);if(s){let e=$(s.status)?.toLowerCase(),t=lA(s,a),o=dA(s),c=$(s.sessionId),l=sk({args:a,result:s}),u=c?{kind:`open-session`,sessionId:c,sessionKind:s.isChildSession===!0?`child`:`session`,...l?{agentId:l}:{},...$(s.title)?{label:s.title.trim()}:{},...$(s.parentSessionId)?{parentSessionId:s.parentSessionId.trim()}:{}}:void 0;return e===`failed`?{kind:`result`,name:r,detail:t,input:cA(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`error`,statusLabel:n.toolStatusFailedLabel,...l?{agentId:l}:{},...u?{action:u}:{}}:e===`completed`?{kind:`result`,name:r,detail:t,input:cA(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...l?{agentId:l}:{},...u?{action:u}:{}}:{kind:`result`,name:r,detail:t,input:cA(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`running`,statusLabel:n.toolStatusRunningLabel,...l?{agentId:l}:{},...u?{action:u}:{}}}let c=oA(o);if(!c)return null;let l=uA(c,a),u=fA(c),d=$(c.sessionId),f=sk({args:a,result:c}),p=d?{kind:`open-session`,sessionId:d,sessionKind:c.isChildSession===!0?`child`:`session`,...f?{agentId:f}:{},...$(c.title)?{label:c.title.trim()}:{},...$(c.parentSessionId)?{parentSessionId:c.parentSessionId.trim()}:{}}:void 0;return{kind:`result`,name:r,detail:l,input:cA(a),text:u,callId:i||void 0,hasResult:!!u,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...f?{agentId:f}:{},...p?{action:p}:{}}}function mA(e){return typeof e==`object`&&!!e}function hA(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function gA(e){if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=Number(t);return Number.isFinite(n)&&n>=0?n:null}function _A(e){return mA(e)?`command`in e||`workingDir`in e||`exitCode`in e||`stdout`in e||`stderr`in e||`aggregated_output`in e||`combinedOutput`in e:!1}function vA(e,t){if(!mA(e))return null;let n=mA(e.asset)?e.asset:Array.isArray(e.assets)&&e.assets.length>0&&mA(e.assets[0])?e.assets[0]:null;if(!n)return null;let r=hA(n.url),i=hA(n.mimeType)??`application/octet-stream`,a=gA(n.sizeBytes);return r?{type:`file`,file:{label:hA(n.name)??(i.startsWith(`image/`)?t.imageAttachmentLabel:t.fileAttachmentLabel),mimeType:i,dataUrl:r,...a==null?{}:{sizeBytes:a},isImage:i.startsWith(`image/`)}}:null}function yA(e,t){return{kind:e.kind,toolName:e.name,...`agentId`in e&&e.agentId?{agentId:e.agentId}:{},summary:e.detail,inputLabel:t.toolInputLabel,input:`input`in e&&typeof e.input==`string`?e.input:void 0,output:e.text,outputData:e.outputData,hasResult:!!e.hasResult,statusTone:e.statusTone,statusLabel:e.statusLabel,titleLabel:e.kind===`call`?t.toolCallLabel:t.toolResultLabel,outputLabel:t.toolOutputLabel,emptyLabel:t.toolNoOutputLabel,...`action`in e&&e.action?{action:e.action}:{},...`fileOperation`in e&&e.fileOperation?{fileOperation:e.fileOperation}:{}}}function bA(e){let t=typeof e.status==`string`?e.status.trim().toLowerCase():``,n=typeof e.error==`string`&&e.error.trim().length>0;return e.cancelled===!0||t===`cancelled`?{kind:`result`,hasResult:!0,statusTone:`cancelled`,statusLabel:e.texts.toolStatusCancelledLabel}:n||t===`error`?{kind:`result`,hasResult:!0,statusTone:`error`,statusLabel:e.texts.toolStatusFailedLabel}:t===`result`||e.result!=null?{kind:`result`,hasResult:!0,statusTone:`success`,statusLabel:e.texts.toolStatusCompletedLabel}:{kind:`call`,hasResult:!1,statusTone:`running`,statusLabel:e.texts.toolStatusRunningLabel}}function xA(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function SA(e,t){return BO(t??xA(e)).trim()||void 0}function CA(e,t){let n=nk(e.reasoning);return n?{type:`reasoning`,text:n,label:t.reasoningLabel}:null}function wA(e,t){let n=e.mimeType.startsWith(`image/`),r=gA(e.sizeBytes);return{type:`file`,file:{label:typeof e.name==`string`&&e.name.trim()?e.name.trim():n?t.imageAttachmentLabel:t.fileAttachmentLabel,mimeType:e.mimeType,dataUrl:typeof e.url==`string`&&e.url.trim().length>0?e.url.trim():`data:${e.mimeType};base64,${e.data}`,...r==null?{}:{sizeBytes:r},isImage:n}}}function TA(e,t){let n=e.toolInvocation,r=vA(n.result,t);if(r)return r;let i=pA({invocation:n,texts:{toolStatusRunningLabel:t.toolStatusRunningLabel,toolStatusCompletedLabel:t.toolStatusCompletedLabel,toolStatusFailedLabel:t.toolStatusFailedLabel}});if(i)return{type:`tool-card`,card:yA(i,t)};let a=bA({status:n.status,error:n.error,cancelled:n.cancelled,result:n.result,texts:t}),o=rA({toolName:n.toolName,status:n.status,toolCallId:n.toolCallId,args:n.args,parsedArgs:n.parsedArgs,result:n.result}),s=o?.summary??HO(n.parsedArgs??n.args),c=o?void 0:SA(n.args,n.parsedArgs),l=typeof n.error==`string`&&n.error.trim()?n.error.trim():n.result==null?``:BO(n.result).trim(),u=!n.error&&_A(n.result),d=(!o?.fileOperation||!!n.error)&&!u,f=sk(n);return{type:`tool-card`,card:yA({kind:a.kind,name:n.toolName,...f?{agentId:f}:{},detail:s,...c?{input:c}:{},text:d&&l?l:void 0,outputData:n.result,callId:n.toolCallId||void 0,hasResult:a.hasResult,statusTone:a.statusTone,statusLabel:a.statusLabel,...o?.fileOperation?{fileOperation:o.fileOperation}:{}},t)}}function EA(e,t){return{type:`unknown`,label:t.unknownPartLabel,rawType:typeof e.type==`string`?e.type:`unknown`,text:BO(e)}}function DA(e){return e.type===`text`&&typeof e.text==`string`}function OA(e){return e.type===`reasoning`&&typeof e.reasoning==`string`}function kA(e){return e.type===`file`&&typeof e.mimeType==`string`&&typeof e.data==`string`}function AA(e){return e.type!==`tool-invocation`||!mA(e.toolInvocation)?!1:typeof e.toolInvocation.toolName==`string`}function jA(e){return DA(e.part)?tk(e.part,e.inlineTokens):OA(e.part)?CA(e.part,e.texts):kA(e.part)?wA(e.part,e.texts):AA(e.part)?TA(e.part,e.texts):EA(e.part,e.texts)}function MA(e){let t=e.meta?.timestamp;return t&&Number.isFinite(Date.parse(t))?t:new Date().toISOString()}function NA(e,t){return e===`user`?t.user:e===`assistant`?t.assistant:e===`tool`?t.tool:e===`system`?t.system:t.fallback}function PA(e){return e===`user`||e===`assistant`||e===`tool`||e===`system`?e:`message`}function FA(e,t){return{id:e.id,role:PA(e.role),roleLabel:NA(e.role,t.texts.roleLabels),timestampLabel:t.formatTimestamp(MA(e)),status:e.meta?.status,parts:e.parts.map(n=>jA({part:n,inlineTokens:e.meta?.inlineTokens??[],texts:t.texts})).filter(e=>e!==null)}}var IA={isProviderStateResolved:!1,modelOptions:[],sessionTypeUnavailable:!1,sessionTypeUnavailableMessage:null,sessionTypeLabel:null,sessionTypeIcon:null,sessionKey:null,agentId:null,agentDisplayName:null,agentAvatarUrl:null,availableAgents:[],sessionDisplayName:void 0,sessionProjectRoot:null,sessionProjectName:null,canDeleteSession:!1,isDeletePending:!1,threadRef:null,isHistoryLoading:!1,messages:[],isSending:!1,isAwaitingAssistantOutput:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,childSessionTabs:[],activeChildSessionKey:null,workspaceFileTabs:[],activeWorkspaceFileKey:null},LA=g(e=>({snapshot:IA,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))}));function RA(e,t){return new Map([...t,...e].filter(e=>typeof e.id==`string`&&e.id.trim().length>0).map(e=>[e.id,e]))}function zA(e){let t=e?.trim()??``,n=LA(e=>e.snapshot.availableAgents??[]),r=YD(),i=(0,k.useMemo)(()=>RA(n,r.data?.agents??[]),[r.data?.agents,n]);return(0,k.useMemo)(()=>{if(!t)return null;let e=i.get(t)??null;return{agentId:t,profile:e,displayName:e?.displayName?.trim()||t,avatarUrl:e?.avatarUrl?.trim()||null}},[i,t])}function BA({agentId:e,className:t}){let n=zA(e);return n?(0,A.jsx)(Ar,{agentId:n.agentId,displayName:n.displayName,avatarUrl:n.avatarUrl,className:t}):null}var VA=new WeakMap;function HA(e){return{roleLabels:{user:o(`chatRoleUser`),assistant:o(`chatRoleAssistant`),tool:o(`chatRoleTool`),system:o(`chatRoleSystem`),fallback:o(`chatRoleMessage`)},reasoningLabel:o(`chatReasoning`),toolCallLabel:o(`chatToolCall`),toolResultLabel:o(`chatToolResult`),toolInputLabel:o(`chatToolInput`),toolNoOutputLabel:o(`chatToolNoOutput`),toolOutputLabel:o(`chatToolOutput`),toolStatusPreparingLabel:o(`chatToolStatusPreparing`),toolStatusRunningLabel:o(`chatToolStatusRunning`),toolStatusCompletedLabel:o(`chatToolStatusCompleted`),toolStatusFailedLabel:o(`chatToolStatusFailed`),toolStatusCancelledLabel:o(`chatToolStatusCancelled`),imageAttachmentLabel:o(`chatImageAttachment`),fileAttachmentLabel:o(`chatFileAttachment`),unknownPartLabel:o(`chatUnknownPart`)}}function UA(e){return{copyCodeLabel:o(`chatCodeCopy`),copiedCodeLabel:o(`chatCodeCopied`),copyMessageLabel:o(`chatMessageCopy`),copiedMessageLabel:o(`chatMessageCopied`),typingLabel:o(`chatTyping`),attachmentOpenLabel:o(`chatAttachmentOpen`),attachmentAttachedLabel:o(`chatAttachmentAttached`),attachmentCategoryLabels:{archive:o(`chatAttachmentCategoryArchive`),audio:o(`chatAttachmentCategoryAudio`),code:o(`chatAttachmentCategoryCode`),data:o(`chatAttachmentCategoryData`),document:o(`chatAttachmentCategoryDocument`),generic:o(`chatAttachmentCategoryGeneric`),image:o(`chatAttachmentCategoryImage`),pdf:o(`chatAttachmentCategoryPdf`),sheet:o(`chatAttachmentCategorySheet`),video:o(`chatAttachmentCategoryVideo`)}}}function WA({messages:e,isSending:t,className:n,onToolAction:r,onFileOpen:i}){let{language:a}=Vt(),o=(0,k.useMemo)(()=>HA(a),[a]),s=(0,k.useMemo)(()=>e.map(e=>{let t=VA.get(e);if(t&&t.language===a)return t.viewModel;let n=et(e),r=FA({id:n.id,role:n.role,meta:{timestamp:n.meta?.timestamp,status:n.meta?.status,inlineTokens:YO(e.metadata)},parts:n.parts},{formatTimestamp:e=>c(e,a),texts:o});return VA.set(e,{language:a,viewModel:r}),r}),[a,e,o]);return(0,A.jsx)(jD,{messages:s,isSending:t,hasAssistantDraft:(0,k.useMemo)(()=>s.some(e=>e.role===`assistant`&&(e.status===`streaming`||e.status===`pending`)),[s]),className:n,texts:(0,k.useMemo)(()=>UA(a),[a]),onToolAction:r,onFileOpen:i,renderToolAgent:e=>(0,A.jsx)(BA,{agentId:e,className:`h-4 w-4 shrink-0`})})}var GA=[{icon:Kt,titleKey:`chatWelcomeCapability1Title`,descKey:`chatWelcomeCapability1Desc`},{icon:ct,titleKey:`chatWelcomeCapability2Title`,descKey:`chatWelcomeCapability2Desc`},{icon:Ft,titleKey:`chatWelcomeCapability3Title`,descKey:`chatWelcomeCapability3Desc`}];function KA({onCreateSession:e,agents:t,selectedAgentId:n,onSelectAgent:r}){let i=t.find(e=>e.id===n)??null;return(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsxs)(`div`,{className:`max-w-lg w-full text-center`,children:[(0,A.jsx)(`div`,{className:`mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center`,children:(0,A.jsx)(ht,{className:`h-8 w-8 text-primary`})}),(0,A.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900 mb-2`,children:o(`chatWelcomeTitle`)}),(0,A.jsx)(`p`,{className:`text-sm text-gray-500 mb-8`,children:o(`chatWelcomeSubtitle`)}),(0,A.jsxs)(`div`,{className:`mb-6 flex items-center justify-center gap-2.5`,children:[(0,A.jsx)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:o(`chatDraftAgentTitle`)}),(0,A.jsxs)(Ae,{value:n,onValueChange:r,children:[(0,A.jsxs)(xe,{"aria-label":o(`chatDraftAgentTitle`),className:`h-auto w-auto gap-1 rounded-full border-0 bg-transparent px-1.5 py-1 text-gray-500 shadow-none hover:bg-white/70 hover:text-gray-800 focus:ring-0`,children:[(0,A.jsx)(`span`,{className:`sr-only`,children:o(`chatDraftAgentTitle`)}),(0,A.jsx)(`div`,{className:`flex items-center gap-1.5`,children:i?(0,A.jsx)(Ar,{agentId:i.id,displayName:i.displayName,avatarUrl:i.avatarUrl,className:`h-7 w-7 shrink-0`}):null})]}),(0,A.jsx)(Te,{className:`rounded-xl border-gray-200/80 shadow-lg`,children:t.map(e=>(0,A.jsx)(Oe,{value:e.id,className:`rounded-lg pr-10`,children:(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(Ar,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,A.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-700`,children:e.displayName?.trim()||e.id})]})},e.id))})]})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:GA.map(t=>{let n=t.icon;return(0,A.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:[(0,A.jsx)(`div`,{className:`h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3`,children:(0,A.jsx)(n,{className:`h-4.5 w-4.5 text-primary`})}),(0,A.jsx)(`div`,{className:`text-sm font-semibold text-gray-900 mb-1`,children:o(t.titleKey)}),(0,A.jsx)(`div`,{className:`text-[11px] text-gray-500 leading-relaxed`,children:o(t.descKey)})]},t.titleKey)})})]})})}var qA=`native`;function JA(e){return typeof e==`string`?e.trim().toLowerCase()||`native`:qA}function YA(e,t=qA){return JA(e?.runtime?.trim()||e?.engine?.trim()||t)}function XA(e,t){return e===`native`?o(`chatSessionTypeNative`):t?.trim()||e.trim().split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||e}function ZA(e){let t=new Map;for(let n of e){let e=JA(n.value);t.set(e,{value:e,label:n.label?.trim()||XA(e),icon:n.icon??null,ready:n.ready??!0,reason:n.reason??null,reasonMessage:n.reasonMessage??null,supportedModels:n.supportedModels,recommendedModel:n.recommendedModel??null,cta:n.cta??null})}return t.has(`native`)||t.set(qA,{value:qA,label:XA(qA),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}),Array.from(t.values()).sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function QA(e){let{selectedSession:t,pendingSessionType:n,setPendingSessionType:r,sessionTypesData:i}=e,a=(0,k.useMemo)(()=>ZA(i?.options??[]),[i?.options]),s=(0,k.useMemo)(()=>{let e=[...a],n=JA(t?.sessionType);return e.some(e=>e.value===n)||e.push({value:n,label:XA(n),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}),e.sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))},[a,t?.sessionType]),c=(0,k.useMemo)(()=>JA(i?.defaultType??`native`),[i?.defaultType]),l=(0,k.useRef)(null),u=(0,k.useMemo)(()=>JA(t?.sessionType??n??c),[c,n,t?.sessionType]),d=(0,k.useMemo)(()=>s.find(e=>e.value===u)??null,[u,s]);(0,k.useEffect)(()=>{if(t)return;let e=typeof n==`string`?n.trim():``,i=JA(n);(e.length===0||l.current===i||l.current===null&&i===`native`)&&(l.current=c,i!==c&&r(c))},[c,n,t,r]);let f=!t||!!t.sessionTypeMutable,p=(0,k.useMemo)(()=>new Set(a.map(e=>e.value)),[a]);return{sessionTypeOptions:s,selectedSessionTypeOption:d,defaultSessionType:c,selectedSessionType:u,canEditSessionType:f,sessionTypeUnavailable:(0,k.useMemo)(()=>t&&!p.has(JA(t.sessionType))?!0:d?.ready===!1,[p,t,d?.ready]),sessionTypeUnavailableMessage:(0,k.useMemo)(()=>t&&!p.has(JA(t.sessionType))?`${XA(u)} ${o(`chatSessionTypeUnavailableSuffix`)}`:d?.ready===!1?d.reasonMessage?.trim()||`${d.label} setup required`:null,[p,t,u,d])}}function $A(e,t){return e.label?.trim()?e.label.trim():t?nt(t):e.sessionKey}function ej(e){let t=mt({limit:200}),n=(0,k.useMemo)(()=>t.data?.sessions??[],[t.data?.sessions]),r=(0,k.useMemo)(()=>{let e=Xe(n);return new Map(e.map(e=>[e.key,e]))},[n]),i=(0,k.useMemo)(()=>new Map(n.map(e=>[e.sessionId,e])),[n]);return(0,k.useMemo)(()=>e.map(e=>{let t=r.get(e.sessionKey)??null,n=i.get(e.sessionKey)??null,a=e.agentId?.trim()||t?.agentId||null;return{sessionKey:e.sessionKey,parentSessionKey:e.parentSessionKey,title:$A(e,t),agentId:a,updatedAt:t?.updatedAt??null,lastMessageAt:t?.lastMessageAt??null,readAt:t?.readAt??null,runStatus:n?.status===`running`?`running`:void 0,sessionTypeLabel:t?.sessionType?XA(t.sessionType):null,preferredModel:t?.preferredModel?.trim()||null,projectName:t?.projectName?.trim()||null,projectRoot:t?.projectRoot?.trim()||null}}),[r,i,e])}function tj(e){let t=e.split(/\r?\n/),n=`message`,r=[];for(let e of t){let t=e.trimEnd();if(!(!t||t.startsWith(`:`))){if(t.startsWith(`event:`)){n=t.slice(6).trim()||`message`;continue}t.startsWith(`data:`)&&r.push(t.slice(5).trimStart())}}return r.length===0?null:{event:n,data:r.join(`
58
+ `)}}async function*nj(e){let t=e.getReader(),n=new TextDecoder,r=``;try{for(;;){let{value:e,done:i}=await t.read();if(i)break;r+=n.decode(e,{stream:!0});let{frames:a,rest:o}=rj(r);r=o;for(let e of a)yield e}r+=n.decode();let{frames:e}=rj(r,!0);for(let t of e)yield t}finally{t.releaseLock()}}function rj(e,t=!1){let n=e.split(/\r?\n\r?\n/),r=n.pop()??``,i=[];for(let e of n){let t=tj(e);t&&i.push(t)}if(t&&r.trim()){let e=tj(r);return e&&i.push(e),{frames:i,rest:``}}return{frames:i,rest:r}}var ij=`/ncp/agent`,aj=class extends Error{ncpError;alreadyPublished;constructor(e,t=!1){super(e.message),this.name=`NcpHttpAgentClientError(${e.code})`,this.ncpError=e,this.alreadyPublished=t}};function oj(e){let t=e.trim();if(!t)throw Error(`NcpHttpAgentClient requires a non-empty baseUrl.`);return new URL(t)}function sj(e){if(e)return e;if(typeof globalThis.fetch==`function`)return globalThis.fetch.bind(globalThis);throw Error(`No fetch implementation found. Pass options.fetchImpl explicitly.`)}function cj(e){let t=(e??`/ncp/agent`).trim();if(!t)return ij;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n.slice(0,-1):n}async function lj(e){try{return(await e.text()).trim()}catch{return``}}function uj(e){if(mj(e))return e.ncpError;if(fj(e))return e;let t=e instanceof Error?e.message:String(e??`Unknown error`);return{code:gj(void 0),message:t,...e instanceof Error&&e.stack?{details:{stack:e.stack}}:{}}}function dj(e,t={}){return new aj(e,t.alreadyPublished??!1)}function fj(e){return pj(e)&&typeof e.code==`string`&&typeof e.message==`string`}function pj(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function mj(e){return e instanceof aj}var hj={"config-error":`config-error`,"auth-error":`auth-error`,"runtime-error":`runtime-error`,"timeout-error":`timeout-error`,"abort-error":`abort-error`};function gj(e){if(!e)return`runtime-error`;let t=hj[e];if(t)return t;let n=e.toLowerCase();return n.includes(`timeout`)?`timeout-error`:n.includes(`abort`)||n.includes(`cancel`)?`abort-error`:n.includes(`auth`)?`auth-error`:n.includes(`config`)?`config-error`:`runtime-error`}function _j(e){let t=yj(e);return!t||typeof t.type!=`string`||!t.type.trim()?null:t}function vj(e){let t=yj(e);if(!t)return{code:`runtime-error`,message:e||`Unknown stream error.`};let n=typeof t.code==`string`?t.code:void 0,r=gj(n),i=pj(t.details)?t.details:{};return n&&n!==r&&(i.originalCode=n),{code:r,message:typeof t.message==`string`&&t.message?t.message:`Unknown stream error.`,...Object.keys(i).length>0?{details:i}:{}}}function yj(e){try{let t=JSON.parse(e);return pj(t)?t:null}catch{return null}}var bj=[`text`,`file`,`source`,`step-start`,`reasoning`,`tool-invocation`,`card`,`rich-text`,`action`,`extension`],xj=class{manifest;baseUrl;basePath;fetchImpl;defaultHeaders;subscribers=new Set;activeControllers=new Set;started=!1;constructor(e){this.baseUrl=oj(e.baseUrl),this.basePath=cj(e.basePath),this.fetchImpl=sj(e.fetchImpl),this.defaultHeaders=e.headers??{},this.manifest={endpointKind:`custom`,endpointId:e.endpointId?.trim()||`ncp-http-agent-client`,version:`0.1.0`,supportsStreaming:!0,supportsAbort:!0,supportsProactiveMessages:!1,supportsLiveSessionStream:!0,supportedPartTypes:bj,expectedLatency:`seconds`,metadata:{transport:`http+sse`,scope:`agent`}}}async start(){this.started||(this.started=!0,this.publish({type:Un.EndpointReady}))}async stop(){if(this.started){this.started=!1;for(let e of this.activeControllers)e.abort();this.activeControllers.clear()}}async emit(e){switch(e.type){case`message.request`:await this.send(e.payload);return;case`message.stream-request`:await this.stream(e.payload);return;case`message.abort`:await this.abort(e.payload);return;default:this.publish(e);return}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}async send(e){await this.ensureStarted(),await this.jsonRequest({path:`/send`,method:`POST`,body:e})}async stream(e){await this.ensureStarted();let t=new URLSearchParams({sessionId:e.sessionId});await this.streamRequest({path:`/stream?${t.toString()}`,method:`GET`})}async abort(e){await this.ensureStarted();let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(`/abort`),{method:`POST`,headers:{...this.defaultHeaders,"content-type":`application/json`,accept:`application/json`},body:JSON.stringify(e),signal:t.signal});if(!n.ok)throw Error(`Abort request failed with HTTP ${n.status}: ${await lj(n)}`)}catch(e){if(t.signal.aborted)return;let n=uj(e);throw this.publish({type:Un.EndpointError,payload:n}),dj(n)}finally{this.activeControllers.delete(t)}}async ensureStarted(){this.started||await this.start()}publish(e){for(let t of this.subscribers)t(e)}resolveUrl(e){return new URL(`${this.basePath}${e}`,this.baseUrl)}async jsonRequest(e){let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(e.path),{method:e.method,headers:{...this.defaultHeaders,"content-type":`application/json`,accept:`application/json`},body:e.body===void 0?void 0:JSON.stringify(e.body),signal:t.signal});if(!n.ok)throw Error(`NCP request failed with HTTP ${n.status}: ${await lj(n)}`)}catch(e){if(t.signal.aborted)return;if(mj(e))throw e;let n=uj(e);throw this.publish({type:Un.EndpointError,payload:n}),dj(n)}finally{this.activeControllers.delete(t)}}async streamRequest(e){let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(e.path),{method:e.method,headers:{...this.defaultHeaders,accept:`text/event-stream`,...e.body===void 0?{}:{"content-type":`application/json`}},body:e.body===void 0?void 0:JSON.stringify(e.body),signal:t.signal});if(!n.ok)throw Error(`NCP stream request failed with HTTP ${n.status}: ${await lj(n)}`);if(!n.body)throw Error(`NCP stream response has no body.`);for await(let e of nj(n.body)){if(t.signal.aborted)return;this.handleSseFrame(e)}}catch(e){if(t.signal.aborted)return;if(mj(e))throw e;let n=uj(e);throw this.publish({type:Un.EndpointError,payload:n}),dj(n)}finally{this.activeControllers.delete(t)}}handleSseFrame(e){if(e.event===`ncp-event`){let t=_j(e.data);if(!t){this.publish({type:Un.EndpointError,payload:{code:`runtime-error`,message:`Received malformed ncp-event frame.`}});return}this.publish(t);return}if(e.event===`error`){let t=vj(e.data);throw this.publish({type:Un.EndpointError,payload:t}),dj(t,{alreadyPublished:!0})}}};function Sj(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function Cj(e){if(e instanceof Error){let t=e.name?.trim(),n=e.message?.trim();return t&&n?`${t}: ${n}`:n||t||`Unknown Error`}return String(e??`Unknown error`)}function wj(e,t){let n=Error(e);return t!==void 0&&(n.cause=t),n}function Tj(){return async(e,t)=>{try{return await fetch(e,{credentials:`include`,...t})}catch(n){throw w.reportTransportFailure(Cj(n)),wj(`NCP fetch failed for ${(t?.method||`GET`).toUpperCase()} ${Sj(e)}: ${Cj(n)}`,n)}}}var Ej=300,Dj=`ncp agent unavailable during startup`;function Oj(e){return e instanceof Error?e.message.includes(`ncp session not found:`):!1}function kj(e){return e?.trim().toLowerCase().includes(Dj)??!1}function Aj(){return new xj({baseUrl:S,basePath:`/api/ncp/agent`,fetchImpl:Tj()})}async function jj(e,t,n=Ej){t.throwIfAborted();try{let r=await dt(e,n);return t.throwIfAborted(),{messages:r.messages,status:r.status??`idle`}}catch(e){if(t.throwIfAborted(),!Oj(e))throw e;return{messages:[],status:`idle`}}}function Mj(e,t={}){let[n]=(0,k.useState)(()=>Aj()),r=E(),[i,a]=(0,k.useState)(0),o=(0,k.useRef)(null),s=t.messageLimit??Ej,c=vr({sessionId:e,client:n,loadSeed:(0,k.useCallback)((e,t)=>jj(e,t,s),[i,s])}),l=c.hydrateError?.message??c.snapshot.error?.message??null,u=r.phase===`ready`&&kj(l)?`${e}:${r.lastReadyAt??0}`:null;return(0,k.useEffect)(()=>{if(!u){o.current=null;return}o.current!==u&&(o.current=u,a(e=>e+1))},[u]),c}function Nj(e){return e.label?.trim()||e.path.split(`/`).filter(Boolean).pop()||e.path}function Pj(e){let{activeChildSessionKey:t,activeWorkspaceFileKey:n,childSessionTabs:r,workspaceFileTabs:i}=e;if(n){let e=i.find(e=>e.key===n);if(e)return{kind:`file`,file:e}}if(t){let e=r.find(e=>e.sessionKey===t);if(e)return{kind:`child-session`,tab:e}}return r[0]?{kind:`child-session`,tab:r[0]}:i[0]?{kind:`file`,file:i[0]}:null}function Fj({agentId:e,kind:t}){return t===`file`?(0,A.jsx)(bn,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):e?(0,A.jsx)(BA,{agentId:e,className:`h-3.5 w-3.5 shrink-0`}):(0,A.jsx)(Pn,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`})}function Ij({tab:e}){return(0,A.jsx)(Qt,{delayDuration:250,children:(0,A.jsxs)(en,{children:[(0,A.jsx)(Xt,{asChild:!0,children:(0,A.jsxs)(`div`,{className:u(`group flex max-w-[180px] min-w-0 items-center gap-1.5 border-r border-gray-200/70 border-b-2 px-2.5 py-2 transition-colors`,e.active?`border-b-primary bg-white text-gray-900`:`border-b-transparent bg-gray-50/85 text-gray-500 hover:bg-gray-100`),children:[(0,A.jsxs)(`button`,{type:`button`,onClick:e.onSelect,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,children:[(0,A.jsx)(Fj,{kind:e.kind,agentId:e.agentId}),(0,A.jsx)(`span`,{className:`min-w-0 truncate text-[12px] font-medium`,children:e.title}),e.kind===`file`&&e.viewMode===`diff`?(0,A.jsx)(`span`,{className:`shrink-0 rounded border border-amber-200 bg-amber-50 px-1 py-0 text-[9px] font-medium uppercase tracking-[0.08em] text-amber-700`,children:o(`chatWorkspaceDiff`)}):null,e.showUnreadDot?(0,A.jsx)(`span`,{"aria-label":o(`chatSessionUnread`),className:`h-2 w-2 shrink-0 rounded-full bg-primary`}):null]}),e.onClose?(0,A.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.onClose?.()},className:u(`rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700`,e.active?`opacity-100`:`opacity-0 group-hover:opacity-100`),"aria-label":o(`chatWorkspaceCloseFile`),children:(0,A.jsx)(it,{className:`h-3 w-3`})}):null]})}),(0,A.jsx)(nn,{side:`bottom`,className:`max-w-[320px] text-xs`,children:e.tooltip})]})})}function Lj({tabs:e}){return(0,A.jsx)(`div`,{"data-testid":`workspace-tabs-bar`,className:`workspace-horizontal-scrollbar overflow-x-auto overflow-y-hidden border-b border-gray-200/70 bg-gray-50/85`,children:(0,A.jsx)(`div`,{"data-testid":`workspace-tabs-scroll`,className:`flex min-w-max items-stretch`,children:e.map(e=>(0,A.jsx)(Ij,{tab:e},e.key))})})}function Rj({tone:e=`neutral`,value:t}){return(0,A.jsx)(`span`,{className:u(`inline-flex h-5 items-center rounded-sm border px-1.5 text-[10px] font-medium leading-none`,e===`warning`?`border-amber-200 bg-amber-50 text-amber-700`:`border-gray-200 bg-gray-50 text-gray-500`),children:t})}function zj({breadcrumb:e}){return(0,A.jsx)(`div`,{"data-testid":`workspace-file-breadcrumbs`,title:e.fullPath,className:`workspace-horizontal-scrollbar overflow-x-auto overflow-y-hidden border-b border-gray-200/80 bg-gray-50/55`,children:(0,A.jsxs)(`div`,{"data-testid":`workspace-file-breadcrumb-scroll`,className:`flex min-w-max items-center gap-2.5 px-3 py-1.5`,children:[(0,A.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 pr-1`,children:e.segments.map((t,n)=>(0,A.jsxs)(k.Fragment,{children:[(0,A.jsxs)(`span`,{className:u(`inline-flex h-5 items-center gap-1 rounded-sm px-1 text-[11px] leading-none`,t.kind===`workspace`?`bg-primary/8 text-primary`:t.isCurrent?`bg-gray-200/70 text-gray-900`:`text-gray-500`),children:[t.kind===`workspace`?(0,A.jsx)(kn,{className:`h-3 w-3 shrink-0`}):t.isCurrent?(0,A.jsx)(bn,{className:`h-3 w-3 shrink-0`}):null,(0,A.jsx)(`span`,{children:t.label})]}),n<e.segments.length-1?(0,A.jsx)(mn,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},t.key))}),e.locationLabel||e.truncated?(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[e.locationLabel?(0,A.jsx)(Rj,{value:e.locationLabel}):null,e.truncated?(0,A.jsx)(Rj,{tone:`warning`,value:o(`chatWorkspacePreviewTruncated`)}):null]}):null]})})}async function Bj(e){let t=typeof e?.path==`string`?e.path.trim():``,n=!!e?.includeFiles,r=new URLSearchParams;t&&r.set(`path`,t),n&&r.set(`includeFiles`,`1`);let i=r.toString(),a=await ee.get(i?`/api/server-paths/browse?${i}`:`/api/server-paths/browse`);if(!a.ok)throw Error(a.error.message);return a.data}async function Vj(e){let{path:t}=e,n=typeof e.basePath==`string`?e.basePath.trim():``,r=new URLSearchParams;r.set(`path`,t.trim()),n&&r.set(`basePath`,n);let i=await ee.get(`/api/server-paths/read?${r.toString()}`);if(!i.ok)throw Error(i.error.message);return i.data}function Hj(e){let t=e.path?.trim()??``;return ne({queryKey:[`server-path-read`,t,e.basePath??null],queryFn:()=>Vj({path:t,basePath:e.basePath}),enabled:(e.enabled??!0)&&t.length>0,staleTime:0})}function Uj(e){return/^[A-Za-z]:[\\/]?$/.test(e)||e===`/`?e:e.replace(/[\\/]+$/,``)}function Wj(e){let t=Uj(e.trim().replace(/\\/g,`/`));return/^[A-Za-z]:/.test(t)?`${t.slice(0,1).toLowerCase()}${t.slice(1)}`:t}function Gj(e){let t=e.trim().replace(/\\/g,`/`);return t?/^[A-Za-z]:\//.test(t)?{prefix:t.slice(0,2),segments:t.slice(3).split(`/`).filter(Boolean)}:t.startsWith(`/`)?{prefix:`/`,segments:t.slice(1).split(`/`).filter(Boolean)}:{prefix:null,segments:t.split(`/`).filter(Boolean)}:{prefix:null,segments:[]}}function Kj(e){let t=Wj(e.path),n=Wj(e.sessionProjectRoot);if(!t||!n)return null;if(!t.startsWith(`/`)&&!/^[A-Za-z]:\//.test(t))return t.split(`/`).filter(Boolean);if(t===n)return[];let r=n.endsWith(`/`)?n:`${n}/`;return t.startsWith(r)?t.slice(r.length).split(`/`).filter(Boolean):null}function qj(e){let{labels:t,leading:n=null}=e,r=t.map((e,n)=>({key:`${n}:${e}`,label:e,kind:n===t.length-1?`file`:`directory`,isCurrent:n===t.length-1}));return n?[n,...r]:r}function Jj(e){let{column:t,line:n}=e;return typeof n==`number`?`L${n}${typeof t==`number`?`:${t}`:``}`:null}function Yj(e){let{column:t,line:n,path:r,sessionProjectRoot:i,truncated:a}=e,o=r.trim(),s=i?.trim()&&o?Kj({path:o,sessionProjectRoot:i}):null,c;if(i?.trim()&&s){let e=tt(i)??i.trim();c=qj({labels:s,leading:{key:`workspace:${e}`,label:e,kind:`workspace`,isCurrent:s.length===0}})}else{let{prefix:e,segments:t}=Gj(o);c=qj({labels:t,leading:e?{key:`root:${e}`,label:e,kind:`root`,isCurrent:t.length===0}:null})}return c.length===0&&(c=[{key:`file:unknown`,label:o||`file`,kind:`file`,isCurrent:!0}]),{fullPath:o,locationLabel:Jj({line:n,column:t}),truncated:a,segments:c}}function Xj(e){return e.serverKind?e.serverKind:/\.mdx?$/i.test(e.path)?`markdown`:`text`}function Zj(e){let{line:t,path:n,text:r}=e,i=t??1;return{key:`preview:${n}`,path:n,display:`preview`,lines:mk({text:r,kind:`context`,oldStartLine:i,newStartLine:i}),rawText:r,oldStartLine:i,newStartLine:i}}function Qj(e){if(Array.isArray(e.fullLines)&&e.fullLines.length>0)return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:e.fullLines,fullLines:e.fullLines,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...e.patchText?{patchText:e.patchText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}};if(e.beforeText==null&&e.afterText==null)return null;let t=vk({beforeText:e.beforeText??``,afterText:e.afterText??``,oldStartLine:e.oldStartLine??void 0,newStartLine:e.newStartLine??void 0});return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:t,fullLines:t,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}}}function $j({text:e,tone:t=`muted`}){return(0,A.jsx)(`div`,{className:u(`flex h-full items-center justify-center px-6 text-center text-sm`,t===`error`?`text-rose-600`:`text-gray-500`),children:e})}function eM({diffBlock:e}){return e?(0,A.jsx)(tM,{block:e}):(0,A.jsx)($j,{text:o(`chatWorkspaceDiffEmpty`)})}function tM({block:e}){return(0,A.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar bg-white`,children:(0,A.jsx)(JE,{block:e,layout:`workspace`})})}function nM({onFileOpen:e,previewBlock:t,previewKind:n,previewQuery:r,previewText:i}){return r.isLoading&&!t?(0,A.jsx)($j,{text:o(`chatWorkspaceLoadingFile`)}):r.data?.kind===`binary`?(0,A.jsx)($j,{text:o(`chatWorkspacePreviewUnsupported`)}):r.error&&!t?(0,A.jsx)($j,{tone:`error`,text:r.error instanceof Error?r.error.message:String(r.error)}):n===`markdown`&&i?(0,A.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar px-5 py-4`,children:(0,A.jsx)(RT,{text:i,role:`assistant`,texts:{copyCodeLabel:o(`chatCodeCopy`),copiedCodeLabel:o(`chatCodeCopied`)},onFileOpen:e})}):t?(0,A.jsx)(tM,{block:t}):(0,A.jsx)($j,{text:o(`chatWorkspacePreviewEmpty`)})}function rM({file:e,sessionProjectRoot:t,onFileOpen:n}){let r=e.viewMode===`preview`,i=Hj({path:e.path,basePath:t,enabled:r}),a=(0,k.useMemo)(()=>e.viewMode===`diff`?Qj(e):null,[e]),o=r?i.data?.text??e.rawText??null:null,s=Xj({path:i.data?.resolvedPath??e.path,serverKind:i.data?.kind}),c=(0,k.useMemo)(()=>!r||!o?null:Zj({path:i.data?.resolvedPath??e.path,text:o,line:e.line}),[e.line,e.path,r,i.data?.resolvedPath,o]),l=i.data?.resolvedPath??e.path,u=!!i.data?.truncated;return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[(0,A.jsx)(zj,{breadcrumb:(0,k.useMemo)(()=>Yj({path:l,sessionProjectRoot:t,line:e.line,column:e.column,truncated:u}),[e.column,e.line,u,l,t])}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:e.viewMode===`diff`?(0,A.jsx)(eM,{diffBlock:a}):(0,A.jsx)(nM,{onFileOpen:n,previewBlock:c,previewKind:s,previewQuery:i,previewText:o})})]})}function iM({sessionKey:e,onToolAction:t,onFileOpen:n}){let r=Mj(e),i=r.visibleMessages,a=(0,k.useRef)(null),{onScroll:s}=CE({scrollRef:a,resetKey:e,isLoading:r.isHydrating,hasContent:i.length>0,contentVersion:i[i.length-1]??null,stickyThresholdPx:20});return(0,A.jsx)(`div`,{ref:a,onScroll:s,className:`h-full overflow-y-auto custom-scrollbar`,children:r.isHydrating?(0,A.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-gray-500`,children:[(0,A.jsx)(He,{className:`mr-2 h-4 w-4 animate-spin`}),o(`chatChildSessionLoading`)]}):r.hydrateError?(0,A.jsx)(`div`,{className:`px-4 py-5 text-sm text-rose-600`,children:r.hydrateError.message}):i.length===0&&!r.isRunning?(0,A.jsx)(`div`,{className:`px-4 py-5 text-sm text-gray-500`,children:o(`chatChildSessionEmpty`)}):(0,A.jsx)(`div`,{className:`px-4 py-5`,children:(0,A.jsx)(WA,{messages:i,isSending:r.isRunning,onToolAction:t,onFileOpen:n})})})}function aM({value:e}){return(0,A.jsx)(`span`,{className:`inline-flex max-w-full items-center rounded border border-gray-200 bg-gray-50 px-2 py-0.5 text-[10px] font-medium text-gray-600`,children:(0,A.jsx)(`span`,{className:`truncate`,children:e})})}function oM({tab:e}){let t=[e.sessionTypeLabel,e.preferredModel,e.projectName].filter(e=>!!e?.trim());return t.length===0&&!e.projectRoot?null:(0,A.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[t.length>0?(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,A.jsx)(aM,{value:e},e))}):null,e.projectRoot?(0,A.jsx)(`div`,{title:e.projectRoot,className:`truncate rounded border border-gray-200 bg-gray-50 px-2 py-1.5 font-mono text-[11px] text-gray-500`,children:e.projectRoot}):null]})}function sM({tab:e}){return(0,A.jsxs)(`div`,{className:`border-b border-gray-200/70 px-4 py-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-gray-900`,children:[e.agentId?(0,A.jsx)(BA,{agentId:e.agentId,className:`h-4 w-4 shrink-0`}):(0,A.jsx)(Dn,{className:`h-4 w-4 shrink-0 text-gray-400`}),(0,A.jsx)(`span`,{className:`truncate`,children:e.title})]}),(0,A.jsx)(oM,{tab:e})]})}function cM({childSessionTabs:e,activeChildSessionKey:t,workspaceFileTabs:n,activeWorkspaceFileKey:r,sessionProjectRoot:i,onSelectSession:a,onSelectFile:s,onCloseFile:c,onClose:l,onBackToParent:d,onToolAction:f,onFileOpen:p}){let m=di(),h=ej(e),g=j(e=>e.optimisticReadAtBySessionKey),_=Pj({activeChildSessionKey:t,activeWorkspaceFileKey:r,childSessionTabs:h,workspaceFileTabs:n}),v=h.some(e=>!!e.parentSessionKey);(0,k.useEffect)(()=>{if(_?.kind!==`child-session`)return;let e=_.tab.lastMessageAt?.trim()??null;e&&m.chatSessionListManager.markSessionRead(_.tab.sessionKey,e,_.tab.readAt??null)},[_,m]);let y=(0,k.useMemo)(()=>{let e=h.map(e=>{let t=g[e.sessionKey],n=t&&e.readAt?t.localeCompare(e.readAt)>0?t:e.readAt:t??e.readAt;return{key:`child:${e.sessionKey}`,kind:`child-session`,title:e.title,tooltip:e.title,agentId:e.agentId,active:_?.kind===`child-session`&&_.tab.sessionKey===e.sessionKey,showUnreadDot:ni({active:_?.kind===`child-session`&&_.tab.sessionKey===e.sessionKey,lastMessageAt:e.lastMessageAt,readAt:n,runStatus:e.runStatus}),onSelect:()=>a(e.sessionKey)}}),t=n.map(e=>({key:`file:${e.key}`,kind:`file`,title:Nj(e),tooltip:e.path,viewMode:e.viewMode,active:_?.kind===`file`&&_.file.key===e.key,onSelect:()=>s(e.key),onClose:()=>c(e.key)}));return[...e,...t]},[_,c,s,a,g,h,n]);return _?(0,A.jsx)(`aside`,{className:`hidden shrink-0 border-l border-gray-200/70 bg-white/95 backdrop-blur-sm md:flex md:w-[26rem] lg:w-[30rem] xl:w-[34rem]`,children:(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-gray-200/70 px-4 py-2.5`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:d,className:u(`inline-flex items-center gap-1 text-xs font-medium text-gray-600 transition-colors hover:text-gray-900`,!v&&`pointer-events-none opacity-0`),children:[(0,A.jsx)(le,{className:`h-3.5 w-3.5`}),(0,A.jsx)(`span`,{children:o(`chatBackToParent`)})]}),(0,A.jsx)(`button`,{type:`button`,onClick:l,className:`rounded-full border border-gray-200/80 p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":o(`chatWorkspaceClosePanel`),children:(0,A.jsx)(it,{className:`h-4 w-4`})})]}),(0,A.jsx)(Lj,{tabs:y}),(0,A.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-white`,children:_.kind===`child-session`?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(sM,{tab:_.tab}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,A.jsx)(iM,{sessionKey:_.tab.sessionKey,onToolAction:f,onFileOpen:p})})]}):(0,A.jsx)(rM,{file:_.file,sessionProjectRoot:i,onFileOpen:p})})]})}):null}function lM(){let e=Qr();return async t=>{let n=t.projectRoot?o(`chatSessionProjectUpdated`):o(`chatSessionProjectCleared`);if(!t.persistToServer){Z.getState().setSnapshot({pendingProjectRoot:t.projectRoot,pendingProjectRootSessionKey:t.sessionKey}),m.success(n);return}await e({sessionKey:t.sessionKey,patch:{projectRoot:t.projectRoot},successMessage:n})}}function uM({icon:e,label:t,onClick:n,disabled:r=!1,destructive:i=!1}){return(0,A.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:n,disabled:r,children:[(0,A.jsx)(e,{className:`h-4 w-4 shrink-0`}),(0,A.jsx)(`span`,{children:t})]})}function dM(e){return ne({queryKey:[`server-path-browse`,e.path??null,e.includeFiles??!1],queryFn:()=>Bj({path:e.path,includeFiles:e.includeFiles}),enabled:e.enabled??!0,staleTime:0})}var fM=k.forwardRef(({className:e,children:t,...n},r)=>(0,A.jsx)(`div`,{ref:r,className:u(`overflow-auto`,e),...n,children:t}));fM.displayName=`ScrollArea`;function pM({open:e,currentPath:t,isSaving:n,onOpenChange:r,onConfirm:i,title:a,description:s,pathLabel:c,pathPlaceholder:l,confirmLabel:u,hint:d}){let[f,p]=(0,k.useState)(``),[m,g]=(0,k.useState)(null),[_,v]=(0,k.useState)(``);(0,k.useEffect)(()=>{if(!e)return;let n=t?.trim()||null;p(n??``),g(n),v(``)},[t,e]);let y=dM({path:m,enabled:e});(0,k.useEffect)(()=>{!e||!y.data||f.trim().length===0&&p(y.data.currentPath)},[y.data,f,e]);let b=f.trim(),x=b.length===0||n,S=(0,k.useMemo)(()=>y.error?y.error instanceof Error?y.error.message:String(y.error):null,[y.error]),C=_.trim().toLowerCase(),w=(0,k.useMemo)(()=>{let e=y.data?.entries??[];return C.length===0?e:e.filter(e=>{let t=e.name.toLowerCase(),n=e.path.toLowerCase();return t.includes(C)||n.includes(C)})},[y.data?.entries,C]),T=e=>{g(e),v(``),e&&p(e)};return(0,A.jsx)(ce,{open:e,onOpenChange:e=>{n||r(e)},children:(0,A.jsxs)(ae,{className:`max-h-[85vh] overflow-hidden sm:h-[42rem] sm:max-w-2xl sm:grid-rows-[auto_minmax(0,1fr)]`,children:[(0,A.jsxs)(ie,{children:[(0,A.jsx)(oe,{children:a}),s?(0,A.jsx)(se,{children:s}):null]}),(0,A.jsxs)(`form`,{className:`flex min-h-0 flex-col gap-4`,onSubmit:e=>{e.preventDefault(),!x&&i(b)},children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(jt,{htmlFor:`server-path-picker-input`,children:c}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(St,{id:`server-path-picker-input`,value:f,onChange:e=>p(e.target.value),placeholder:l,autoFocus:!0,disabled:n}),(0,A.jsx)(h,{type:`button`,variant:`outline`,onClick:()=>T(b||null),disabled:n,children:o(`openPath`)})]})]}),(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border border-gray-200 bg-gray-50/70`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-gray-200 px-3 py-2`,children:[(0,A.jsxs)(h,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>T(y.data?.homePath??null),disabled:n||y.isLoading,children:[(0,A.jsx)(Nn,{className:`mr-1 h-4 w-4`}),o(`homeDirectory`)]}),(0,A.jsxs)(h,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>T(y.data?.parentPath??null),disabled:!y.data?.parentPath||n||y.isLoading,children:[(0,A.jsx)(An,{className:`mr-1 h-4 w-4`}),o(`parentDirectory`)]}),(0,A.jsxs)(h,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{y.refetch()},disabled:n||y.isLoading,children:[(0,A.jsx)(Jt,{className:`mr-1 h-4 w-4`}),o(`chatRefresh`)]})]}),(0,A.jsxs)(`div`,{className:`border-b border-gray-200 px-3 py-2`,children:[(0,A.jsx)(`div`,{className:`mb-2 text-xs font-medium text-gray-500`,children:o(`currentDirectory`)}),(0,A.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 text-xs text-gray-600`,children:y.data?.breadcrumbs.map((e,t)=>(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 hover:bg-gray-200`,onClick:()=>T(e.path),disabled:n,children:e.label}),t<y.data.breadcrumbs.length-1?(0,A.jsx)(mn,{className:`h-3 w-3 text-gray-400`}):null]},e.path))})]}),(0,A.jsx)(`div`,{className:`border-b border-gray-200 px-3 py-2`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Ke,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,A.jsx)(St,{value:_,onChange:e=>v(e.target.value),placeholder:o(`pathPickerSearchPlaceholder`),disabled:n||y.isLoading,className:`pl-9`})]})}),(0,A.jsx)(fM,{className:`min-h-0 flex-1 px-2 py-2`,children:y.isLoading?(0,A.jsx)(`div`,{className:`px-2 py-6 text-sm text-gray-500`,children:o(`loading`)}):S?(0,A.jsxs)(`div`,{className:`px-2 py-4 text-sm text-destructive`,children:[o(`pathBrowseFailed`),`: `,S]}):y.data&&w.length>0?(0,A.jsx)(`div`,{className:`space-y-1`,children:w.map(e=>(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm text-gray-700 transition-colors hover:bg-white`,onClick:()=>T(e.path),disabled:n,children:[(0,A.jsx)(Pe,{className:`h-4 w-4 shrink-0 text-emerald-600`}),(0,A.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))}):y.data&&y.data.entries.length>0?(0,A.jsx)(`div`,{className:`px-2 py-6 text-sm text-gray-500`,children:o(`pathPickerSearchEmpty`)}):(0,A.jsx)(`div`,{className:`px-2 py-6 text-sm text-gray-500`,children:o(`emptyDirectory`)})})]}),d?(0,A.jsx)(`p`,{className:`text-xs leading-relaxed text-gray-500`,children:d}):null,(0,A.jsxs)(D,{children:[(0,A.jsx)(h,{type:`button`,variant:`outline`,onClick:()=>r(!1),disabled:n,children:o(`cancel`)}),(0,A.jsx)(h,{type:`submit`,disabled:x,children:n?o(`saving`):u})]})]})]})})}function mM({open:e,currentProjectRoot:t,isSaving:n,onOpenChange:r,onSave:i}){return(0,A.jsx)(pM,{open:e,currentPath:t,isSaving:n,onOpenChange:r,onConfirm:i,title:o(`chatSessionProjectDialogTitle`),description:o(`chatSessionProjectDialogDescription`),pathLabel:o(`chatSessionProjectPathLabel`),pathPlaceholder:o(`chatSessionProjectPathPlaceholder`),confirmLabel:o(`chatSessionSetProject`),hint:o(`chatSessionProjectUpdateHint`)})}function hM({sessionKey:e,canDeleteSession:t,isDeletePending:n,projectRoot:r,childSessionCount:i=0,onOpenChildSessions:a,onDeleteSession:s}){let c=lM(),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(!1),[p,m]=(0,k.useState)(!1),g=n||p,_=async n=>{let r=t;m(!0);try{await c({sessionKey:e,projectRoot:n,persistToServer:r}),f(!1),u(!1)}finally{m(!1)}};return(0,A.jsxs)(A.Fragment,{children:[i>0&&a?(0,A.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`rounded-lg shrink-0 text-gray-400 hover:text-gray-700`,"aria-label":o(`chatSessionOpenChildSessions`),title:o(`chatSessionOpenChildSessions`),onClick:a,disabled:g,children:(0,A.jsx)(lt,{className:`h-4 w-4`})}):null,(0,A.jsxs)(Et,{open:l,onOpenChange:u,children:[(0,A.jsx)(Ut,{asChild:!0,children:(0,A.jsx)(h,{variant:`ghost`,size:`icon`,className:`rounded-lg shrink-0 text-gray-400 hover:text-gray-700`,"aria-label":o(`chatSessionMoreActions`),disabled:g,children:(0,A.jsx)(_n,{className:`h-4 w-4`})})}),(0,A.jsx)(It,{align:`end`,className:`w-56 p-2`,children:(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(uM,{icon:On,label:o(`chatSessionSetProject`),onClick:()=>{u(!1),f(!0)},disabled:g}),(0,A.jsx)(uM,{icon:qe,label:o(`chatDeleteSession`),onClick:()=>{u(!1),s()},disabled:!t||g,destructive:!0})]})})]}),(0,A.jsx)(mM,{open:d,currentProjectRoot:r,isSaving:p,onOpenChange:f,onSave:_})]})}function gM({sessionKey:e,projectName:t,projectRoot:n,persistToServer:r}){let i=lM(),[a,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(!1),[u,d]=(0,k.useState)(!1),f=async t=>{d(!0);try{await i({sessionKey:e,projectRoot:t,persistToServer:r}),l(!1),s(!1)}finally{d(!1)}};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(Et,{open:a,onOpenChange:s,children:[(0,A.jsx)(Ut,{asChild:!0,children:(0,A.jsx)(`button`,{type:`button`,title:n??void 0,className:`min-w-0 max-w-[320px] shrink rounded-full border border-gray-200 bg-gray-100/90 px-2 py-0.5 text-[11px] font-medium text-gray-600 transition-colors hover:border-gray-300 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-60`,"aria-label":o(`chatSessionSetProject`),disabled:u,children:(0,A.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(On,{className:`h-3.5 w-3.5 shrink-0`}),(0,A.jsx)(`span`,{className:`truncate`,children:t}),(0,A.jsx)(fe,{className:`h-3 w-3 shrink-0 opacity-70`})]})})}),(0,A.jsxs)(It,{align:`start`,className:`w-72 p-2`,children:[(0,A.jsxs)(`div`,{className:`px-3 pb-2 pt-1`,children:[(0,A.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-gray-500`,children:t}),n?(0,A.jsx)(`div`,{className:`mt-1 break-all text-xs text-gray-500`,children:n}):null]}),(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(uM,{icon:Ln,label:o(`chatSessionSetProject`),onClick:()=>{s(!1),l(!0)},disabled:u}),(0,A.jsx)(uM,{icon:jn,label:o(`chatSessionClearProject`),onClick:()=>{f(null)},disabled:u})]})]})]}),(0,A.jsx)(mM,{open:c,currentProjectRoot:n,isSaving:u,onOpenChange:l,onSave:f})]})}var _M=[{key:`hero`,alignmentClassName:`justify-start`,bubbleClassName:`max-w-[78%] h-32 rounded-[30px]`},{key:`follow-up`,alignmentClassName:`justify-start`,bubbleClassName:`max-w-[62%] h-24 rounded-[28px]`},{key:`reply`,alignmentClassName:`justify-end`,bubbleClassName:`max-w-[70%] h-24 rounded-[28px]`},{key:`detail`,alignmentClassName:`justify-start`,bubbleClassName:`max-w-[88%] h-36 rounded-[30px]`}];function vM(){return(0,A.jsxs)(`section`,{"data-testid":`chat-conversation-skeleton`,className:`flex-1 min-h-0 flex flex-col overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:[(0,A.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar`,children:(0,A.jsx)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[min(1120px,100%)] flex-col px-6 py-5`,children:(0,A.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8`,children:[(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsx)(cn,{className:`h-6 w-52 rounded-lg bg-gray-200/90`}),(0,A.jsx)(`div`,{className:`space-y-5`,children:_M.map(e=>(0,A.jsx)(`div`,{className:u(`flex w-full`,e.alignmentClassName),children:(0,A.jsx)(cn,{"data-testid":`chat-conversation-skeleton-bubble`,className:u(`w-full bg-gray-200/80`,e.bubbleClassName)})},e.key))})]}),(0,A.jsxs)(`div`,{className:`mt-auto grid gap-4 pb-2 sm:grid-cols-[minmax(0,1fr)_minmax(180px,240px)] sm:items-end`,children:[(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsx)(cn,{className:`h-4 w-40 rounded-full bg-gray-200/70`}),(0,A.jsx)(cn,{className:`h-[112px] w-full rounded-[30px] bg-gray-200/70`})]}),(0,A.jsx)(`div`,{className:`hidden justify-end sm:flex`,children:(0,A.jsx)(cn,{className:`h-10 w-36 rounded-full bg-gray-200/75`})})]})]})})}),(0,A.jsx)(`div`,{className:`border-t border-gray-200/80 bg-white p-4`,children:(0,A.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)]`,children:(0,A.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-card`,children:[(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,A.jsx)(cn,{className:`h-[84px] w-full rounded-[28px] bg-gray-200/80`})}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 pb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(cn,{className:`h-8 w-20 rounded-full bg-gray-200/75`}),(0,A.jsx)(cn,{className:`h-8 w-28 rounded-full bg-gray-200/75`}),(0,A.jsx)(cn,{className:`hidden h-8 w-24 rounded-full bg-gray-200/70 sm:block`})]}),(0,A.jsx)(cn,{className:`h-8 w-8 rounded-full bg-gray-200/85`})]})]})})})]})}function yM({parentSessionLabel:e,onGoToParentSession:t}){if(!e)return null;let n=e.trim();return(0,A.jsx)(`div`,{className:`border-b border-gray-200/60 bg-white/75 px-5 py-2 backdrop-blur-sm`,children:(0,A.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 text-xs font-medium text-gray-600 transition-colors hover:text-gray-900`,children:[(0,A.jsx)(le,{className:`h-3.5 w-3.5`}),(0,A.jsxs)(`span`,{children:[o(`chatBackToParent`),n?` · ${n}`:``]})]})})}function bM({snapshot:e,childSessionCount:t,normalizedAgentId:n,sessionHeaderTitle:r,shouldShowHeaderAgentAvatar:i,shouldShowSessionHeader:a,onOpenChildSessions:o,onDeleteSession:s}){return(0,A.jsxs)(`div`,{className:u(`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`,a?`py-3 opacity-100`:`h-0 py-0 opacity-0 border-b-0`),children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-center gap-2`,children:[i?(0,A.jsx)(`div`,{className:`inline-flex shrink-0 items-center`,children:(0,A.jsx)(Ar,{agentId:n,displayName:e.agentDisplayName,avatarUrl:e.agentAvatarUrl,className:`h-5 w-5`})}):null,(0,A.jsx)(`span`,{className:`text-sm font-medium text-gray-700 truncate`,children:r}),e.sessionTypeLabel?(0,A.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-gray-200 bg-gray-100 px-2 py-0.5 text-[11px] font-medium text-gray-600`,children:[e.sessionTypeIcon?.src?(0,A.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] items-center justify-center`,children:(0,A.jsx)(Ur,{icon:{kind:`runtime-image`,src:e.sessionTypeIcon.src,alt:e.sessionTypeIcon.alt??null,name:e.sessionTypeLabel}})}):null,e.sessionTypeLabel]}):null,e.sessionProjectName?(0,A.jsx)(gM,{sessionKey:e.sessionKey??`draft`,projectName:e.sessionProjectName,projectRoot:e.sessionProjectRoot,persistToServer:e.canDeleteSession}):null]}),e.sessionKey?(0,A.jsx)(hM,{sessionKey:e.sessionKey,canDeleteSession:e.canDeleteSession,isDeletePending:e.isDeletePending,projectRoot:e.sessionProjectRoot,childSessionCount:t,onOpenChildSessions:o,onDeleteSession:s}):null]})}function xM({shouldShowProviderHint:e,sessionTypeUnavailable:t,sessionTypeUnavailableMessage:n,onGoToProviders:r}){return(0,A.jsxs)(A.Fragment,{children:[e?(0,A.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:[(0,A.jsx)(`span`,{className:`text-xs text-amber-800`,children:o(`chatModelNoOptions`)}),(0,A.jsx)(`button`,{type:`button`,onClick:r,className:`text-xs font-semibold text-amber-900 underline-offset-2 hover:underline`,children:o(`chatGoConfigureProvider`)})]}):null,t&&n?.trim()?(0,A.jsx)(`div`,{className:`px-5 py-2.5 border-b border-amber-200/70 bg-amber-50/70 shrink-0`,children:(0,A.jsx)(`span`,{className:`text-xs text-amber-800`,children:n})}):null]})}function SM({snapshot:e,availableAgents:t,hideEmptyHint:n,showWelcome:r,threadRef:i,onScroll:a,onCreateSession:s,onSelectAgent:c,onToolAction:l,onFileOpen:u}){return(0,A.jsx)(`div`,{ref:i,onScroll:a,className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar`,children:r?(0,A.jsx)(KA,{onCreateSession:s,agents:t,selectedAgentId:e.agentId??`main`,onSelectAgent:c}):n?null:e.messages.length===0?(0,A.jsx)(`div`,{className:`px-5 py-5 text-sm text-gray-500`,children:o(`chatNoMessages`)}):(0,A.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-6 py-5`,children:(0,A.jsx)(WA,{messages:e.messages,isSending:e.isSending&&e.isAwaitingAssistantOutput,onToolAction:l,onFileOpen:u},e.sessionKey??`draft`)})})}function CM(e,t,n){return e.workspacePanelParentKey===e.sessionKey?t.length>0||n.length>0:!1}function wM(){let e=di(),t=Z(e=>e.snapshot.defaultSessionType),n=LA(e=>e.snapshot),r=(0,k.useRef)(null),i=n.threadRef??r,a=n.childSessionTabs.filter(e=>e.parentSessionKey===n.sessionKey),s=n.workspaceFileTabs.filter(e=>e.parentSessionKey===n.sessionKey),c=CM(n,a,s),l=!!(n.sessionKey||n.sessionTypeLabel),u=n.sessionDisplayName||(n.canDeleteSession&&n.sessionKey?n.sessionKey:null)||o(`chatSidebarNewTask`),d=n.agentId?.trim()??``,f=d.length>0&&d.toLowerCase()!==`main`,p=!n.canDeleteSession&&n.messages.length===0&&!n.isSending,m=n.modelOptions.length>0,h=n.isProviderStateResolved&&!m,g=n.isHistoryLoading&&n.messages.length===0&&!n.isSending&&!n.isAwaitingAssistantOutput,_=n.availableAgents??[],v=e=>_.find(t=>t.id===e)??null,y=()=>{let r=YA(v(n.agentId??`main`),t);e.chatSessionListManager.createSession(r)},b=n=>{e.chatSessionListManager.setSelectedAgentId(n),e.chatInputManager.setPendingSessionType(YA(v(n),t))},x=t=>{e.chatThreadManager.openFilePreview(t)},S=()=>{n.sessionKey&&e.chatThreadManager.openChildSessionPanel({parentSessionKey:n.sessionKey,activeChildSessionKey:a[0]?.sessionKey??null})},{onScroll:C}=CE({scrollRef:i,resetKey:n.sessionKey,isLoading:n.isHistoryLoading,hasContent:n.messages.length>0,contentVersion:n.messages[n.messages.length-1]??null});return n.isProviderStateResolved?(0,A.jsxs)(`section`,{className:`flex-1 min-h-0 flex overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:[(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,A.jsx)(yM,{parentSessionLabel:n.parentSessionKey?n.parentSessionLabel??null:null,onGoToParentSession:e.chatThreadManager.goToParentSession}),(0,A.jsx)(bM,{snapshot:n,childSessionCount:a.length,normalizedAgentId:d,sessionHeaderTitle:u,shouldShowHeaderAgentAvatar:f,shouldShowSessionHeader:l,onOpenChildSessions:S,onDeleteSession:e.chatThreadManager.deleteSession}),(0,A.jsx)(xM,{shouldShowProviderHint:h,sessionTypeUnavailable:n.sessionTypeUnavailable,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage??null,onGoToProviders:e.chatThreadManager.goToProviders}),(0,A.jsx)(SM,{snapshot:n,availableAgents:_,hideEmptyHint:g,showWelcome:p,threadRef:i,onScroll:C,onCreateSession:y,onSelectAgent:b,onToolAction:e.chatThreadManager.openSessionFromToolAction,onFileOpen:x}),(0,A.jsx)(FO,{})]}),c?(0,A.jsx)(cM,{childSessionTabs:a,activeChildSessionKey:n.activeChildSessionKey??null,workspaceFileTabs:s,activeWorkspaceFileKey:n.activeWorkspaceFileKey??null,sessionProjectRoot:n.sessionProjectRoot??null,onSelectSession:e.chatThreadManager.selectChildSessionDetail,onSelectFile:e.chatThreadManager.selectWorkspaceFile,onCloseFile:e.chatThreadManager.closeWorkspaceFile,onClose:e.chatThreadManager.closeWorkspacePanel,onBackToParent:e.chatThreadManager.goToParentSession,onToolAction:e.chatThreadManager.openSessionFromToolAction,onFileOpen:x}):null]}):(0,A.jsx)(vM,{})}var TM=k.forwardRef(({className:e,...t},n)=>(0,A.jsx)(`textarea`,{className:u(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 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:n,...t}));TM.displayName=`Textarea`;var EM={id:``,displayName:``,description:``,avatar:``,model:``,home:``,runtime:``};function DM(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function OM(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=JA(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:XA(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function kM({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:r,onChange:i}){let a=e.trim()?JA(e):``,s=OM({runtimeOptions:n,currentRuntime:e}),c=s.find(e=>e.value===a)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?o(`agentsRuntimeUnavailableHelp`):``);return(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsxs)(Ae,{value:a||r,onValueChange:e=>i(e===r?``:e),disabled:t,children:[(0,A.jsx)(xe,{"aria-label":o(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,A.jsx)(me,{placeholder:o(`agentsRuntimeSelectPlaceholder`)})}),(0,A.jsx)(Te,{className:`rounded-xl`,children:s.map(e=>(0,A.jsx)(Oe,{value:e.value,disabled:e.ready===!1&&e.value!==a,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,A.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function AM({open:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,A.jsx)(ce,{open:e,onOpenChange:a,children:e||t?(0,A.jsx)(MM,{pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e?`create-open`:`create-closed`):null})}function jM({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,A.jsx)(ce,{open:e!==null,onOpenChange:a,children:e?(0,A.jsx)(NM,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function MM(e){let{pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:s}=e,[c,l]=(0,k.useState)(EM);return(0,A.jsxs)(ae,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,A.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,A.jsxs)(ie,{className:`text-left`,children:[(0,A.jsx)(oe,{children:o(`agentsCreateDialogTitle`)}),(0,A.jsx)(se,{children:o(`agentsCreateDialogDescription`)})]})}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,A.jsx)(St,{value:c.id,onChange:e=>l(t=>({...t,id:e.target.value})),placeholder:o(`agentsFormIdPlaceholder`)}),(0,A.jsx)(St,{value:c.displayName,onChange:e=>l(t=>({...t,displayName:e.target.value})),placeholder:o(`agentsFormNamePlaceholder`)}),(0,A.jsx)(TM,{value:c.description,onChange:e=>l(t=>({...t,description:e.target.value})),placeholder:o(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,A.jsx)(St,{value:c.avatar,onChange:e=>l(t=>({...t,avatar:e.target.value})),placeholder:o(`agentsFormAvatarPlaceholder`)}),(0,A.jsx)(St,{value:c.home,onChange:e=>l(t=>({...t,home:e.target.value})),placeholder:o(`agentsFormHomePlaceholder`)}),(0,A.jsx)(Re,{value:c.model,onChange:e=>l(t=>({...t,model:e})),providerCatalog:n,disabled:t,className:`md:col-span-2`}),(0,A.jsx)(kM,{value:c.runtime,onChange:e=>l(t=>({...t,runtime:e})),runtimeOptions:r,defaultRuntime:i,disabled:t})]}),(0,A.jsx)(Nt,{tone:`warning`,title:o(`agentsCreateDialogHint`),className:`text-xs leading-6`})]})}),(0,A.jsxs)(D,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,A.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>a(!1),disabled:t,children:o(`cancel`)}),(0,A.jsxs)(h,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>void s(c),disabled:t||c.id.trim().length===0,children:[(0,A.jsx)(We,{className:`mr-2 h-4 w-4`}),o(`agentsCreateAction`)]})]})]})}function NM(e){let{agent:t,pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,k.useState)(DM(t));return(0,A.jsxs)(ae,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,A.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,A.jsxs)(ie,{className:`text-left`,children:[(0,A.jsx)(oe,{children:o(`agentsEditDialogTitle`)}),(0,A.jsx)(se,{children:o(`agentsEditDialogDescription`)})]})}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsx)(Nt,{tone:`warning`,title:o(`agentsEditHomeReadonly`),description:o(`agentsEditHomeReadonlyHint`),children:(0,A.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,A.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,A.jsx)(St,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:o(`agentsFormNamePlaceholder`)}),(0,A.jsx)(TM,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:o(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,A.jsx)(St,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:o(`agentsFormAvatarPlaceholder`)}),(0,A.jsx)(Re,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,A.jsx)(kM,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]})]})}),(0,A.jsxs)(D,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,A.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:n,children:o(`cancel`)}),(0,A.jsxs)(h,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:n,children:[(0,A.jsx)(Ln,{className:`mr-2 h-4 w-4`}),o(`agentsEditSaveAction`)]})]})]})}function PM(){return ne({queryKey:[`ncp-session-types`],queryFn:te,staleTime:1e4,retry:!1})}var FM=[{strip:`bg-[#efc37a]`,chip:`border-[#f2d7a7] bg-[#fff8eb] text-[#8d5a18]`},{strip:`bg-[#8fd4c0]`,chip:`border-[#bde6da] bg-[#effbf7] text-[#156653]`},{strip:`bg-[#b7c9fb]`,chip:`border-[#d7e2ff] bg-[#f4f7ff] text-[#2d4d8f]`}];function IM(e,t){return t?{strip:`bg-[#e6b765]`,chip:`border-[#f2d19c] bg-[#fff8ec] text-[#90550d]`}:FM[e%FM.length]}function LM(e){let{agentCount:t,onCreate:n}=e;return(0,A.jsxs)(`section`,{className:`relative overflow-hidden rounded-[28px] border border-[#f0d6aa] bg-[linear-gradient(135deg,#fff7ea_0%,#fff9f1_32%,#f2fbff_100%)] px-5 py-5 sm:px-6`,children:[(0,A.jsx)(`div`,{className:`absolute inset-y-0 right-0 w-[46%] bg-[radial-gradient(circle_at_top_right,rgba(255,215,163,0.52),transparent_54%)]`}),(0,A.jsx)(`div`,{className:`absolute -bottom-10 left-8 h-32 w-32 rounded-full bg-[#ffe6c0]/55 blur-3xl`}),(0,A.jsxs)(`div`,{className:`relative grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px] xl:items-center`,children:[(0,A.jsxs)(`div`,{className:`max-w-3xl space-y-3`,children:[(0,A.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-white/70 bg-white/80 px-3 py-1 text-[11px] font-semibold tracking-[0.16em] text-[#9b6118]`,children:[(0,A.jsx)(Yt,{className:`h-3.5 w-3.5`}),o(`agentsHeroEyebrow`)]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(`h1`,{className:`max-w-2xl text-[30px] font-semibold leading-tight tracking-[-0.05em] text-[#2f2212] sm:text-[38px]`,children:o(`agentsHeroTitle`)}),(0,A.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[#6d5841] sm:text-[15px] sm:leading-7`,children:o(`agentsHeroDescription`)})]}),(0,A.jsx)(`div`,{className:`pt-1`,children:(0,A.jsxs)(`div`,{className:`inline-flex items-center gap-3 rounded-2xl border border-[#f2d5a4] bg-white/82 px-3 py-2 text-[#7a4d12] shadow-[0_14px_30px_rgba(167,117,47,0.07)]`,children:[(0,A.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.14em]`,children:o(`agentsOverviewTotal`)}),(0,A.jsx)(`span`,{className:`text-xl font-semibold tracking-[-0.04em] text-[#1f2937]`,children:t})]})})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3`,children:[(0,A.jsxs)(h,{type:`button`,variant:`primary`,className:`h-10 rounded-2xl px-5 text-sm font-semibold`,onClick:n,children:[(0,A.jsx)(We,{className:`mr-2 h-4 w-4`}),o(`agentsCreateButton`)]}),(0,A.jsx)(Nt,{title:o(`agentsCreateDialogHint`),className:`border-white/70 bg-white/72 text-xs leading-6 shadow-[0_18px_40px_rgba(167,117,47,0.08)]`})]})]})]})}function RM(e){let{agent:t,index:n,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:s,onStartChat:c,onEdit:l,onDelete:d}=e,f=IM(n,!!t.builtIn),p=t.runtime?.trim()||t.engine?.trim()||``,m=p?r.find(e=>e.value===JA(p))?.label??XA(p):i;return(0,A.jsxs)(Wt,{className:`overflow-hidden border border-gray-200 bg-white shadow-sm transition-shadow duration-200 hover:shadow-md`,children:[(0,A.jsx)(`div`,{className:u(`h-1.5 w-full`,f.strip)}),(0,A.jsxs)(Ot,{className:`flex h-full flex-col gap-4 px-4 py-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(Ar,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-11 w-11 shrink-0`}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 pt-0.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`truncate text-lg font-semibold tracking-[-0.03em] text-[#1f2937]`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,A.jsxs)(ln,{tone:`warning`,className:u(`gap-1`,f.chip),children:[(0,A.jsx)(Bn,{className:`h-3 w-3`}),o(`agentsCardBuiltInTag`)]}):null]}),(0,A.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-[#94a3b8]`,children:[`@`,t.id]})]})]}),(0,A.jsx)(`p`,{className:`text-sm leading-6 text-[#64748b]`,children:t.description?.trim()||(t.builtIn?o(`agentsCardBuiltInSummary`):o(`agentsCardCustomSummary`))}),(0,A.jsxs)(`div`,{className:`mt-auto flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,A.jsx)(Yt,{className:`h-3.5 w-3.5`}),o(`agentsCardRuntimeLabel`)]}),(0,A.jsx)(`div`,{className:`mt-1.5 text-sm leading-6 text-[#475569]`,children:m})]}),(0,A.jsxs)(`div`,{className:`border-t border-gray-100 pt-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,A.jsx)(Nn,{className:`h-3.5 w-3.5`}),o(`agentsCardHomeLabel`)]}),(0,A.jsx)(`div`,{className:`mt-1.5 break-all text-sm leading-6 text-[#475569]`,children:t.workspace??`-`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-xl px-4`,onClick:c,children:[(0,A.jsx)(Kt,{className:`mr-2 h-4 w-4`}),o(`agentsCardStartChat`)]}),(0,A.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:l,disabled:a,children:[(0,A.jsx)(Ln,{className:`mr-1.5 h-3.5 w-3.5`}),o(`agentsEditAction`)]}),t.builtIn?null:(0,A.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:d,disabled:s,children:[(0,A.jsx)(qe,{className:`mr-1.5 h-3.5 w-3.5`}),o(`agentsRemoveAction`)]})]})]})]})]})}function zM(){let e=b(),t=YD(),n=At(),r=xt(),i=PM(),a=XD(),s=ZD(),c=QD(),[l,u]=(0,k.useState)(!1),[f,p]=(0,k.useState)(null),m=j(e=>e.setSnapshot),g=(0,k.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),_=(0,k.useMemo)(()=>[...g].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[g]),v=(0,k.useMemo)(()=>Ie({config:n.data,meta:r.data,onlyConfigured:!0}),[r.data,n.data]),y=(0,k.useMemo)(()=>ZA(i.data?.options??[]),[i.data?.options]),x=(0,k.useMemo)(()=>JA(i.data?.defaultType??`native`),[i.data?.defaultType]),S=(0,k.useMemo)(()=>y.find(e=>e.value===x)?.label??XA(x),[x,y]),C=async e=>{await a.mutateAsync({data:{id:e.id,...e.displayName.trim()?{displayName:e.displayName.trim()}:{},...e.description.trim()?{description:e.description.trim()}:{},...e.avatar.trim()?{avatar:e.avatar.trim()}:{},...e.home.trim()?{home:e.home.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{},...e.runtime.trim()?{runtime:e.runtime.trim()}:{}}}),u(!1)},w=e=>{p(e)},T=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),p(null)},E=t=>{m({selectedAgentId:t.id,selectedSessionKey:null}),Z.getState().setSnapshot({pendingSessionType:YA(t,x),pendingProjectRoot:null,pendingProjectRootSessionKey:null}),e(`/chat`)};return(0,A.jsxs)(d,{className:`space-y-5`,children:[(0,A.jsx)(LM,{agentCount:g.length,onCreate:()=>u(!0)}),(0,A.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,A.jsx)(Wt,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,A.jsx)(Ot,{className:`py-14 text-center text-sm text-gray-500`,children:o(`agentsLoading`)})}):_.length===0?(0,A.jsx)(Wt,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,A.jsxs)(Ot,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,A.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,A.jsx)(ht,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,A.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:o(`agentsEmpty`)}),(0,A.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:o(`agentsEmptyDescription`)}),(0,A.jsxs)(h,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>u(!0),children:[(0,A.jsx)(We,{className:`mr-2 h-4 w-4`}),o(`agentsCreateButton`)]})]})}):_.map((e,t)=>(0,A.jsx)(RM,{agent:e,index:t,runtimeOptions:y,defaultRuntimeLabel:S,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>E(e),onEdit:()=>w(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,A.jsx)(AM,{open:l,pending:a.isPending,providerCatalog:v,runtimeOptions:y,defaultRuntime:x,onOpenChange:u,onSubmit:C}),(0,A.jsx)(jM,{agent:f,pending:s.isPending,providerCatalog:v,runtimeOptions:y,defaultRuntime:x,onOpenChange:e=>{!e&&!s.isPending&&p(null)},onSubmit:T})]})}function BM(e){return c(e??void 0)}function VM(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:c(new Date(e))}function HM(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function UM(e){let t=e.schedule;return t.kind===`cron`?t.expr?`cron ${t.expr}`:`cron`:t.kind===`every`?`every ${HM(t.everyMs)}`:t.kind===`at`?`at ${VM(t.atMs)}`:`-`}function WM(e){return e.payload.deliver?`${e.payload.channel??`-`}:${e.payload.to??`-`}`:`-`}function GM(e,t){let 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 KM(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function qM(){let[e,t]=(0,k.useState)(``),[n,r]=(0,k.useState)(`all`),i=wt({all:!0}),a=qt(),s=pt(),c=ot(),{confirm:l,ConfirmDialog:f}=un(),m=(0,k.useMemo)(()=>(i.data?.jobs??[]).filter(t=>GM(t,e)).filter(e=>KM(e,n)),[i.data,e,n]),g=async e=>{await l({title:`${o(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:o(`delete`)})&&a.mutate({id:e.id})},_=async e=>{let t=!e.enabled;await l({title:t?`${o(`cronEnableConfirm`)}?`:`${o(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:t?`default`:`destructive`,confirmLabel:o(t?`cronEnable`:`cronDisable`)})&&s.mutate({id:e.id,enabled:t})},v=async e=>{let t=!e.enabled;await l({title:t?`${o(`cronRunForceConfirm`)}?`:`${o(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:o(`cronRunNow`)})&&c.mutate({id:e.id,force:t})};return(0,A.jsxs)(d,{fullHeight:!0,children:[(0,A.jsx)(p,{title:o(`cronPageTitle`),description:o(`cronPageDescription`),actions:(0,A.jsx)(h,{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:(0,A.jsx)(Ge,{className:u(`h-4 w-4`,i.isFetching&&`animate-spin`)})})}),(0,A.jsx)(`div`,{className:`mb-6`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,A.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,A.jsx)(St,{value:e,onChange:e=>t(e.target.value),placeholder:o(`cronSearchPlaceholder`),className:`pl-9`}),(0,A.jsx)(Ft,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,A.jsx)(`div`,{className:`min-w-[180px]`,children:(0,A.jsxs)(Ae,{value:n,onValueChange:e=>r(e),children:[(0,A.jsx)(xe,{className:`w-full`,children:(0,A.jsx)(me,{placeholder:o(`cronStatusLabel`)})}),(0,A.jsxs)(Te,{children:[(0,A.jsx)(Oe,{value:`all`,children:o(`cronStatusAll`)}),(0,A.jsx)(Oe,{value:`enabled`,children:o(`cronStatusEnabled`)}),(0,A.jsx)(Oe,{value:`disabled`,children:o(`cronStatusDisabled`)})]})]})}),(0,A.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[o(`cronTotalLabel`),`: `,i.data?.total??0,` / `,m.length]})]})}),(0,A.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:i.isLoading?(0,A.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:o(`cronLoading`)}):m.length===0?(0,A.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:o(`cronEmpty`)}):(0,A.jsx)(`div`,{className:`space-y-4`,children:m.map(e=>(0,A.jsx)(Wt,{className:`border border-gray-200`,children:(0,A.jsx)(Ot,{className:`pt-5 pb-5`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,A.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:e.name||e.id}),(0,A.jsx)(`span`,{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500`,children:e.id}),(0,A.jsx)(`span`,{className:u(`text-[10px] font-semibold px-2 py-0.5 rounded-full`,e.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:e.enabled?o(`enabled`):o(`disabled`)}),e.deleteAfterRun&&(0,A.jsx)(`span`,{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full bg-amber-50 text-amber-700`,children:o(`cronOneShot`)})]}),(0,A.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[o(`cronScheduleLabel`),`: `,UM(e)]}),(0,A.jsx)(`div`,{className:`mt-2 text-sm text-gray-700 whitespace-pre-wrap break-words`,children:e.payload.message}),(0,A.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[o(`cronDeliverTo`),`: `,WM(e)]})]}),(0,A.jsxs)(`div`,{className:`min-w-[220px] text-xs text-gray-500 space-y-2`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[o(`cronNextRun`),`:`]}),` `,BM(e.state.nextRunAt)]}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[o(`cronLastRun`),`:`]}),` `,BM(e.state.lastRunAt)]}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[o(`cronLastStatus`),`:`]}),` `,e.state.lastStatus??`-`]}),e.state.lastError&&(0,A.jsx)(`div`,{className:`text-[11px] text-red-500 break-words`,children:e.state.lastError})]}),(0,A.jsxs)(`div`,{className:`flex items-start gap-2 flex-wrap justify-end`,children:[(0,A.jsxs)(h,{variant:`subtle`,size:`sm`,onClick:()=>v(e),className:`gap-1`,children:[(0,A.jsx)(Ue,{className:`h-3.5 w-3.5`}),o(`cronRunNow`)]}),(0,A.jsxs)(h,{variant:e.enabled?`outline`:`primary`,size:`sm`,onClick:()=>_(e),className:`gap-1`,children:[(0,A.jsx)(Rn,{className:`h-3.5 w-3.5`}),e.enabled?o(`cronDisable`):o(`cronEnable`)]}),(0,A.jsxs)(h,{variant:`destructive`,size:`sm`,onClick:()=>g(e),className:`gap-1`,children:[(0,A.jsx)(qe,{className:`h-3.5 w-3.5`}),o(`delete`)]})]})]})})},e.id))})}),(0,A.jsx)(f,{})]})}function JM(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,k.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,k.useEffect)(()=>{a.current=r},[r,a])}function YM({view:e,confirmDialog:t}){return(0,A.jsxs)(`div`,{className:`h-full flex`,children:[(0,A.jsx)(oO,{}),e===`chat`?(0,A.jsx)(wM,{}):(0,A.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,A.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,A.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-6 py-5`,children:(0,A.jsx)(qM,{})})}):e===`agents`?(0,A.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,A.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-6 py-5`,children:(0,A.jsx)(zM,{})})}):(0,A.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,A.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:(0,A.jsx)(an,{forcedType:`skills`})})})}),t]})}var XM=`sid_`;function ZM(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return`${XM}${btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}`}function QM(e){if(!e.startsWith(XM))return null;let t=e.slice(4).replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4==0?``:`=`.repeat(4-t.length%4);try{let e=atob(t+n),r=Uint8Array.from(e,e=>e.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function $M(e){if(!e)return null;let t=QM(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function eN(e){return`/chat/${ZM(e)}`}function tN(e){return e?.trim().toLowerCase()||`native`}function nN(e,t){if(typeof t!=`string`)return!1;let n=t.trim();return n?e.some(e=>e.value===n):!1}function rN(e,t){return typeof t==`string`&&e.includes(t)}function iN(e){return e.length===0?null:e.includes(`off`)?`off`:e[0]??null}function aN(e){let{currentValue:t,selectedSessionPreferredValue:n,fallbackPreferredValue:r,defaultValue:i,isValueSupported:a,firstAvailableValue:o,preferSessionPreferredValue:s=!1,preserveCurrentValueOnSessionChange:c=!1}=e;return a(t)&&(!s||c)?t:a(n)?n:a(r)?r:a(i)?i:o}function oN(e){let{modelOptions:t}=e;return t.length===0?``:aN({currentValue:e.currentSelectedModel,selectedSessionPreferredValue:e.selectedSessionPreferredModel,fallbackPreferredValue:e.fallbackPreferredModel,defaultValue:e.defaultModel,isValueSupported:e=>nN(t,e),firstAvailableValue:t[0]?.value??``,preferSessionPreferredValue:e.preferSessionPreferredModel,preserveCurrentValueOnSessionChange:e.preserveCurrentSelectedModelOnSessionChange})}function sN(e){let{supportedThinkingLevels:t}=e;return t.length===0?null:aN({currentValue:e.currentSelectedThinkingLevel,selectedSessionPreferredValue:e.selectedSessionPreferredThinking,fallbackPreferredValue:e.fallbackPreferredThinking,defaultValue:e.defaultThinkingLevel,isValueSupported:e=>rN(t,e),firstAvailableValue:iN(t)??`off`,preferSessionPreferredValue:e.preferSessionPreferredThinking,preserveCurrentValueOnSessionChange:e.preserveCurrentSelectedThinkingOnSessionChange})}function cN(e){let t=tN(e.sessionType),n,r=-1/0;for(let i of e.sessions){if(i.key===e.selectedSessionKey||tN(i.sessionType)!==t)continue;let a=e.readPreference(i);if(a==null)continue;let o=Date.parse(i.updatedAt),s=Number.isFinite(o)?o:-1/0;(n===void 0||s>r)&&(n=a,r=s)}return n}function lN(e){return cN({sessions:e.sessions,selectedSessionKey:e.selectedSessionKey,sessionType:e.sessionType,readPreference:e=>e.preferredModel?.trim()||void 0})}function uN(e){return cN({sessions:e.sessions,selectedSessionKey:e.selectedSessionKey,sessionType:e.sessionType,readPreference:e=>e.preferredThinking??void 0})}function dN(e){let{isPreferenceAvailable:t,emptyValue:n,selectedSessionKey:r,selectedSessionExists:i=!1,setValue:a,resolveValue:o}=e,s=(0,k.useRef)(void 0),c=(0,k.useRef)(o);(0,k.useEffect)(()=>{c.current=o},[o]),(0,k.useEffect)(()=>{let e=s.current!==r;if(!t){a(n),s.current=r;return}a(t=>c.current({currentValue:t,sessionChanged:e,preserveCurrentValueOnSessionChange:e&&!!r&&!i})),s.current=r},[n,t,i,r,a])}function fN(e){let{modelOptions:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredModel:i,fallbackPreferredModel:a,defaultModel:o,setSelectedModel:s}=e;dN({isPreferenceAvailable:t.length>0,emptyValue:``,selectedSessionKey:n,selectedSessionExists:r,setValue:s,resolveValue:({currentValue:e,sessionChanged:n,preserveCurrentValueOnSessionChange:r})=>oN({currentSelectedModel:e,modelOptions:t,selectedSessionPreferredModel:i,fallbackPreferredModel:a,defaultModel:o,preferSessionPreferredModel:n,preserveCurrentSelectedModelOnSessionChange:r})})}function pN(e){let{supportedThinkingLevels:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredThinking:i,fallbackPreferredThinking:a,defaultThinkingLevel:o,setSelectedThinkingLevel:s}=e;dN({isPreferenceAvailable:t.length>0,emptyValue:null,selectedSessionKey:n,selectedSessionExists:r,setValue:s,resolveValue:({currentValue:e,sessionChanged:n,preserveCurrentValueOnSessionChange:r})=>sN({currentSelectedThinkingLevel:e,supportedThinkingLevels:t,selectedSessionPreferredThinking:i,fallbackPreferredThinking:a,defaultThinkingLevel:o,preferSessionPreferredThinking:n,preserveCurrentSelectedThinkingOnSessionChange:r})})}function mN(e,t){return e.filter(e=>Qe(e,t))}function hN(e){if(!e.supportedModels||e.supportedModels.length===0)return e.modelOptions;let t=new Set(e.supportedModels),n=e.modelOptions.filter(e=>t.has(e.value));return n.length>0?n:e.modelOptions}function gN(e){let t=At(),n=xt(),r=mt({limit:200}),i=PM(),a=st({sessionId:e.sessionKey,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:e.projectRootOverride??null}:{}}),o=(t.isFetched||t.isSuccess)&&(n.isFetched||n.isSuccess),s=(0,k.useMemo)(()=>{let e=Ie({meta:n.data,config:t.data,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=Le(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:Fe(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[n.data,t.data]),c=(0,k.useMemo)(()=>r.data?.sessions??[],[r.data?.sessions]),l=(0,k.useMemo)(()=>Xe(c),[c]),u=(0,k.useMemo)(()=>mN(l,e.query),[l,e.query]),d=(0,k.useMemo)(()=>l.find(t=>t.key===e.sessionKey)??null,[l,e.sessionKey]),f=(0,k.useMemo)(()=>a.data?.records??[],[a.data?.records]),p=QA({selectedSession:d,pendingSessionType:e.pendingSessionType,setPendingSessionType:e.setPendingSessionType,sessionTypesData:i.data}),m=(0,k.useMemo)(()=>hN({modelOptions:s,supportedModels:p.selectedSessionTypeOption?.supportedModels}),[s,p.selectedSessionTypeOption?.supportedModels]),h=(0,k.useMemo)(()=>lN({sessions:l,selectedSessionKey:e.sessionKey,sessionType:p.selectedSessionType}),[l,e.sessionKey,p.selectedSessionType]),g=(0,k.useMemo)(()=>m.find(t=>t.value===e.currentSelectedModel),[m,e.currentSelectedModel]),_=(0,k.useMemo)(()=>g?.thinkingCapability?.supported??[],[g?.thinkingCapability?.supported]),v=(0,k.useMemo)(()=>g?.thinkingCapability?.default??null,[g?.thinkingCapability?.default]),y=(0,k.useMemo)(()=>uN({sessions:l,selectedSessionKey:e.sessionKey,sessionType:p.selectedSessionType}),[l,e.sessionKey,p.selectedSessionType]);return fN({modelOptions:m,selectedSessionKey:e.sessionKey,selectedSessionExists:!!d,selectedSessionPreferredModel:d?.preferredModel,fallbackPreferredModel:p.selectedSessionTypeOption?.recommendedModel??h,defaultModel:p.selectedSessionTypeOption?.recommendedModel??t.data?.agents.defaults.model,setSelectedModel:e.setSelectedModel}),pN({supportedThinkingLevels:_,selectedSessionKey:e.sessionKey,selectedSessionExists:!!d,selectedSessionPreferredThinking:d?.preferredThinking??null,fallbackPreferredThinking:y??null,defaultThinkingLevel:v,setSelectedThinkingLevel:e.setSelectedThinkingLevel}),{configQuery:t,configMetaQuery:n,sessionsQuery:r,sessionTypesQuery:i,sessionSkillsQuery:a,isProviderStateResolved:o,modelOptions:m,sessionSummaries:c,sessions:u,skillRecords:f,selectedSession:d,...p}}var _N=class{constructor(e,t){this.uiManager=e,this.streamActionsManager=t,this.syncDraftThreadState=e=>{LA.getState().setSnapshot({sessionKey:e,sessionDisplayName:void 0,canDeleteSession:!1,isHistoryLoading:!1,messages:[],isSending:!1,isAwaitingAssistantOutput:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,childSessionTabs:[],activeChildSessionKey:null,activeWorkspaceFileKey:null})},this.resolveUpdateValue=(e,t)=>typeof t==`function`?t(e):t,this.shouldPersistReadAt=(e,t,n)=>{let r=j.getState().optimisticReadAtBySessionKey[e],i=r&&n?r.localeCompare(n)>0?r:n:r??n??void 0;return i?t.localeCompare(i)>0:!0},this.setSelectedAgentId=e=>{let t=j.getState().snapshot.selectedAgentId,n=this.resolveUpdateValue(t,e);n!==t&&j.getState().setSnapshot({selectedAgentId:n})},this.setSelectedSessionKey=e=>{let t=j.getState().snapshot.selectedSessionKey,n=this.resolveUpdateValue(t,e);n!==t&&j.getState().setSnapshot({selectedSessionKey:n})},this.setListMode=e=>{let t=j.getState().snapshot.listMode,n=this.resolveUpdateValue(t,e);n!==t&&j.getState().setSnapshot({listMode:n})},this.markSessionRead=(e,t,n)=>{let r=e?.trim(),i=t?.trim();!r||!i||this.shouldPersistReadAt(r,i,n)&&(j.getState().markSessionRead(r,i),vt(r,{uiReadAt:i}).catch(()=>void 0))},this.createSession=(e,t)=>{let{snapshot:n}=Z.getState(),{defaultSessionType:r}=n,i=r||`native`,a=typeof e==`string`&&e.trim().length>0?e.trim():i,o=Ye(t),s=$e();return this.streamActionsManager.resetStreamState(),j.getState().setSnapshot({selectedSessionKey:null,draftSessionKey:s}),this.syncDraftThreadState(s),Z.getState().setSnapshot({pendingSessionType:a,pendingProjectRoot:o,pendingProjectRootSessionKey:o?s:null}),this.uiManager.goToChatRoot(),s},this.ensureDraftSession=e=>{let{snapshot:t}=j.getState();if(t.selectedSessionKey)return t.selectedSessionKey;let n=typeof e==`string`&&e.trim().length>0?e.trim():null;return this.syncDraftThreadState(t.draftSessionKey),n&&Z.getState().setSnapshot({pendingSessionType:n}),t.draftSessionKey},this.promoteRootDraftSessionRoute=e=>{let t=e.trim();if(!t)return;let{snapshot:n}=j.getState(),{sessionKey:r}=LA.getState().snapshot;n.selectedSessionKey!==null||n.draftSessionKey!==t||r!==t||!this.uiManager.isAtChatRoot()||this.uiManager.goToSession(t,{replace:!0})},this.selectSession=e=>{LA.getState().setSnapshot({workspacePanelParentKey:null,activeChildSessionKey:null,activeWorkspaceFileKey:null}),this.uiManager.goToSession(e)},this.setQuery=e=>{let t=j.getState().snapshot.query,n=this.resolveUpdateValue(t,e);n!==t&&j.getState().setSnapshot({query:n})}}},vN=async()=>{},yN=()=>{},bN=class{constructor(){this.actions={sendMessage:vN,stopCurrentRun:vN,resumeRun:vN,resetStreamState:yN,applyHistoryMessages:yN},this.bind=e=>{this.actions={...this.actions,...e}},this.sendMessage=e=>this.actions.sendMessage(e),this.stopCurrentRun=()=>this.actions.stopCurrentRun(),this.resumeRun=e=>this.actions.resumeRun(e),this.resetStreamState=()=>this.actions.resetStreamState(),this.applyHistoryMessages=(e,t)=>this.actions.applyHistoryMessages(e,t)}},xN=async e=>!1,SN=class{constructor(){this.state={pathname:``},this.actions={navigate:null,confirm:xN},this.syncState=e=>{this.state={...this.state,...e}},this.bindActions=e=>{this.actions={...this.actions,...e}},this.confirm=async e=>this.actions.confirm(e),this.navigateTo=(e,t)=>{this.actions.navigate&&(this.state.pathname===e&&!t?.replace||(this.actions.navigate(e,t),this.state.pathname=e))},this.goToProviders=()=>{this.navigateTo(`/providers`)},this.goToChatRoot=e=>{this.navigateTo(`/chat`,e)},this.isAtChatRoot=()=>this.state.pathname===`/chat`,this.goToSession=(e,t)=>{this.navigateTo(eN(e),t)}}};function CN(e){let t=e.trim();return t.length>0?t:null}function wN(e){return e??null}var TN=class{constructor(e){this.updateSession=e,this.inFlight=null,this.queued=null,this.syncSelectedSessionPreferences=()=>{let e=Z.getState().snapshot,t=j.getState().snapshot,n=LA.getState().snapshot,r=t.selectedSessionKey;!r||!n.canDeleteSession||this.enqueue({sessionKey:r,patch:{preferredModel:CN(e.selectedModel),preferredThinking:wN(e.selectedThinkingLevel)}})},this.enqueue=e=>{this.queued=e,!this.inFlight&&this.startFlush()},this.startFlush=()=>{this.inFlight=this.flush().catch(e=>{console.error(`Failed to sync chat session preferences: ${String(e)}`)}).finally(()=>{this.inFlight=null,this.queued&&this.startFlush()})},this.flush=async()=>{for(;this.queued;){let e=this.queued;this.queued=null,await this.updateSession(e.sessionKey,e.patch)}}}},EN=class{constructor(e,t,n){this.uiManager=e,this.streamActionsManager=t,this.sessionListManager=n,this.sessionPreferenceSync=new TN(vt),this.buildAttachmentSignature=e=>[e.assetUri??``,e.url??``,e.name,e.mimeType,String(e.sizeBytes),e.contentBase64??``].join(`:`),this.hasSnapshotChanges=e=>{let t=Z.getState().snapshot;for(let[n,r]of Object.entries(e))if(!Object.is(t[n],r))return!0;return!1},this.resolveUpdateValue=(e,t)=>typeof t==`function`?t(e):t,this.isSameStringArray=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),this.syncComposerSnapshot=e=>{let t=Z.getState().snapshot.attachments,n=HD(e,t);Z.getState().setSnapshot({composerNodes:e,attachments:n,draft:LD(e),selectedSkills:RD(e)})},this.syncComposerSnapshotWithAttachments=(e,t)=>{Z.getState().setSnapshot({composerNodes:e,attachments:t,draft:LD(e),selectedSkills:RD(e)})},this.dedupeAttachments=e=>{let t=new Set,n=[];for(let r of e){let e=this.buildAttachmentSignature(r);t.has(e)||(t.add(e),n.push(r))}return n},this.syncSnapshot=e=>{if(this.hasSnapshotChanges(e)&&(Z.getState().setSnapshot(e),Object.prototype.hasOwnProperty.call(e,`modelOptions`)||Object.prototype.hasOwnProperty.call(e,`selectedModel`)||Object.prototype.hasOwnProperty.call(e,`selectedThinkingLevel`))){let{selectedModel:e}=Z.getState().snapshot;this.reconcileThinkingForModel(e)}},this.setDraft=e=>{let t=Z.getState().snapshot.draft,n=this.resolveUpdateValue(t,e);n!==t&&this.syncComposerSnapshot(ID(n))},this.setComposerNodes=e=>{let t=Z.getState().snapshot.composerNodes,n=this.resolveUpdateValue(t,e);Object.is(n,t)||this.syncComposerSnapshot(n)},this.addAttachments=e=>{if(e.length===0)return[];let{snapshot:t}=Z.getState(),n=new Set(t.attachments.map(this.buildAttachmentSignature)),r=this.dedupeAttachments([...t.attachments,...e]),i=r.filter(e=>!n.has(this.buildAttachmentSignature(e)));if(i.length===0)return[];let a=VD(t.composerNodes,r);return this.syncComposerSnapshotWithAttachments(a,r),i},this.restoreComposerState=(e,t)=>{let n=this.dedupeAttachments(t),r=VD(e,n);this.syncComposerSnapshotWithAttachments(r,n)},this.setPendingSessionType=e=>{let t=Z.getState().snapshot.pendingSessionType,n=this.resolveUpdateValue(t,e);n!==t&&Z.getState().setSnapshot({pendingSessionType:n})},this.send=async()=>{let e=Z.getState().snapshot,t=j.getState().snapshot,n=LA.getState().snapshot,r=e.draft.trim(),{attachments:i}=e,a=UD(e.composerNodes,i);if(OO({snapshot:e,hasSendableDraft:a.some(e=>e.type!==`text`||e.text.trim().length>0),isRuntimeBlocked:w.isChatInteractionBlocked()}))return;let{selectedSkills:o,composerNodes:s}=e,c=n.sessionKey??t.selectedSessionKey??this.sessionListManager.ensureDraftSession(e.selectedSessionType);this.setComposerNodes(FD()),await this.streamActionsManager.sendMessage({message:r,sessionKey:c,agentId:t.selectedAgentId,sessionType:e.selectedSessionType,model:e.selectedModel||void 0,thinkingLevel:e.selectedThinkingLevel??void 0,stopSupported:!0,requestedSkills:o,attachments:i,parts:a,restoreDraftOnError:!0,composerNodes:s}),this.sessionListManager.promoteRootDraftSessionRoute(c)},this.stop=async()=>{await this.streamActionsManager.stopCurrentRun()},this.goToProviders=()=>{this.uiManager.goToProviders()},this.setSelectedModel=e=>{let t=Z.getState().snapshot.selectedModel,n=this.resolveUpdateValue(t,e);n!==t&&(Z.getState().setSnapshot({selectedModel:n}),this.reconcileThinkingForModel(n))},this.setSelectedThinkingLevel=e=>{let t=Z.getState().snapshot.selectedThinkingLevel,n=this.resolveUpdateValue(t,e);n!==t&&Z.getState().setSnapshot({selectedThinkingLevel:n})},this.selectSessionType=e=>{let t=JA(e);Z.getState().setSnapshot({selectedSessionType:t,pendingSessionType:t})},this.setSelectedSkills=e=>{let{snapshot:t}=Z.getState(),{selectedSkills:n}=t,r=this.resolveUpdateValue(n,e);this.isSameStringArray(r,n)||this.syncComposerSnapshot(BD(t.composerNodes,r,t.skillRecords))},this.selectModel=e=>{this.setSelectedModel(e),AO.remember(e),this.sessionPreferenceSync.syncSelectedSessionPreferences()},this.selectThinkingLevel=e=>{this.setSelectedThinkingLevel(e),this.sessionPreferenceSync.syncSelectedSessionPreferences()},this.rememberSkillSelection=e=>{jO.remember(e)},this.selectSkills=e=>{let t=Z.getState().snapshot.selectedSkills;for(let n of e)t.includes(n)||this.rememberSkillSelection(n);this.setSelectedSkills(e)},this.resolveThinkingForModel=(e,t)=>{let n=e?.thinkingCapability;return!n||n.supported.length===0?null:t===`off`?`off`:t&&n.supported.includes(t)?t:n.default&&n.supported.includes(n.default)?n.default:`off`},this.reconcileThinkingForModel=e=>{let{snapshot:t}=Z.getState(),n=t.modelOptions.find(t=>t.value===e),{selectedThinkingLevel:r}=t,i=this.resolveThinkingForModel(n,r);i!==r&&Z.getState().setSnapshot({selectedThinkingLevel:i})}}},DN=class{constructor(e,t,n){this.uiManager=e,this.sessionListManager=t,this.streamActionsManager=n,this.hasSnapshotChanges=e=>{let t=LA.getState().snapshot;for(let[n,r]of Object.entries(e))if(!Object.is(t[n],r))return!0;return!1},this.syncSnapshot=e=>{this.hasSnapshotChanges(e)&&LA.getState().setSnapshot(e)},this.clearDeletedSessionState=e=>{j.getState().snapshot.selectedSessionKey===e&&this.sessionListManager.setSelectedSessionKey(null),LA.getState().setSnapshot({sessionKey:null,sessionTypeLabel:null,agentId:null,agentDisplayName:null,agentAvatarUrl:null,sessionDisplayName:void 0,sessionProjectRoot:null,sessionProjectName:null,canDeleteSession:!1,isHistoryLoading:!1,messages:[],isSending:!1,isAwaitingAssistantOutput:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,childSessionTabs:[],activeChildSessionKey:null,workspaceFileTabs:[],activeWorkspaceFileKey:null})},this.resolveWorkspaceParentSessionKey=()=>LA.getState().snapshot.sessionKey?.trim()||(j.getState().snapshot.selectedSessionKey??null),this.buildWorkspaceFileTab=(e,t)=>{let n=e.path.trim();if(!n)return null;let r=t?.trim()||null;return{key:`${r??`draft`}::${e.viewMode}::${n}`,parentSessionKey:r,path:n,label:e.label?.trim()||null,viewMode:e.viewMode,line:e.line??null,column:e.column??null,rawText:e.rawText??null,beforeText:e.beforeText??null,afterText:e.afterText??null,patchText:e.patchText??null,oldStartLine:e.oldStartLine??null,newStartLine:e.newStartLine??null,fullLines:e.fullLines}},this.upsertWorkspaceFileTab=e=>{let{workspaceFileTabs:t}=LA.getState().snapshot,n=t.findIndex(t=>t.key===e.key);if(n===-1)return[e,...t];let r=[...t];return r.splice(n,1),r.unshift({...t[n],...e}),r},this.ensureWorkspaceParentRoute=e=>{if(!e)return;let{snapshot:{selectedSessionKey:t}}=j.getState();t!==e&&this.uiManager.goToSession(e)},this.deleteSession=()=>{this.deleteCurrentSession()},this.createSession=()=>{this.sessionListManager.createSession()},this.goToProviders=()=>{this.uiManager.goToProviders()},this.openChildSessionPanel=e=>{let t=e.parentSessionKey.trim();if(!t)return;let n=e.activeChildSessionKey?.trim()||null;LA.getState().setSnapshot({workspacePanelParentKey:t,activeChildSessionKey:n,activeWorkspaceFileKey:null}),this.ensureWorkspaceParentRoute(t)},this.openFilePreview=e=>{let t=this.resolveWorkspaceParentSessionKey(),n=this.buildWorkspaceFileTab(e,t);n&&(LA.getState().setSnapshot({workspacePanelParentKey:t,workspaceFileTabs:this.upsertWorkspaceFileTab(n),activeWorkspaceFileKey:n.key,activeChildSessionKey:null}),this.ensureWorkspaceParentRoute(t))},this.openSessionFromToolAction=e=>{if(e.kind===`open-session`){if(e.sessionKind===`child`&&!this.isCompactViewport()){let t=e.parentSessionId?.trim()||j.getState().snapshot.selectedSessionKey||null;if(t){this.openChildSessionPanel({parentSessionKey:t,activeChildSessionKey:e.sessionId});return}}LA.getState().setSnapshot({workspacePanelParentKey:null,activeChildSessionKey:null,activeWorkspaceFileKey:null}),this.uiManager.goToSession(e.sessionId)}},this.selectChildSessionDetail=e=>{let t=e.trim();if(!t)return;let{childSessionTabs:n}=LA.getState().snapshot;n.some(e=>e.sessionKey===t)&&LA.getState().setSnapshot({activeChildSessionKey:t,activeWorkspaceFileKey:null})},this.selectWorkspaceFile=e=>{let t=e.trim();if(!t)return;let{workspaceFileTabs:n}=LA.getState().snapshot;n.some(e=>e.key===t)&&LA.getState().setSnapshot({activeWorkspaceFileKey:t,activeChildSessionKey:null})},this.closeWorkspaceFile=e=>{let t=e.trim();if(!t)return;let{snapshot:n}=LA.getState(),{activeWorkspaceFileKey:r,workspaceFileTabs:i}=n,a={workspaceFileTabs:i.filter(e=>e.key!==t)};r===t&&(a.activeWorkspaceFileKey=null),LA.getState().setSnapshot(a)},this.closeWorkspacePanel=()=>{LA.getState().setSnapshot({workspacePanelParentKey:null,activeChildSessionKey:null,activeWorkspaceFileKey:null})},this.closeChildSessionDetail=()=>{this.closeWorkspacePanel()},this.goToParentSession=()=>{let{parentSessionKey:e,childSessionTabs:t,activeChildSessionKey:n}=LA.getState().snapshot,r=t.find(e=>e.sessionKey===n)?.parentSessionKey??null,i=e??r;i&&(this.closeWorkspacePanel(),this.uiManager.goToSession(i))},this.isCompactViewport=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(max-width: 767px)`).matches,this.deleteCurrentSession=async()=>{let{snapshot:{selectedSessionKey:e}}=j.getState();if(e&&await this.uiManager.confirm({title:o(`chatDeleteSessionConfirm`),variant:`destructive`,confirmLabel:o(`delete`)})){LA.getState().setSnapshot({isDeletePending:!0});try{await yt(e),bt(C,e),C.removeQueries({queryKey:[`ncp-session-messages`,e]}),this.streamActionsManager.resetStreamState(),this.clearDeletedSessionState(e),this.uiManager.goToChatRoot({replace:!0})}finally{LA.getState().setSnapshot({isDeletePending:!1})}}}}},ON=class{constructor(){this.chatUiManager=new SN,this.chatStreamActionsManager=new bN,this.chatSessionListManager=new _N(this.chatUiManager,this.chatStreamActionsManager),this.chatInputManager=new EN(this.chatUiManager,this.chatStreamActionsManager,this.chatSessionListManager),this.chatThreadManager=new DN(this.chatUiManager,this.chatSessionListManager,this.chatStreamActionsManager)}};function kN(e){return e.parentSessionKey?e.sessionSummaries.map(Je).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function AN(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?nt(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,k.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?Je(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??XA(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,k.useMemo)(()=>kN({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function jN(e){(0,k.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?nt(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function MN(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function NN(e){let t={};e.model?.trim()&&(t.model=e.model.trim(),t.preferred_model=e.model.trim()),e.thinkingLevel?.trim()&&(t.thinking=e.thinkingLevel.trim(),t.preferred_thinking=e.thinkingLevel.trim()),e.sessionType?.trim()&&(t.session_type=e.sessionType.trim(),t.runtime=e.sessionType.trim()),e.agentId?.trim()&&(t.agent_id=e.agentId.trim());let n=Ye(e.projectRoot);n&&(t.project_root=n);let r=MN(e.requestedSkills);r.length>0&&(t.requested_skill_refs=r);let i=e.composerNodes?JO(e.composerNodes):[];return i.length>0&&(t[UO]=i),t}function PN(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function FN({view:e}){let[t]=(0,k.useState)(()=>new ON),n=j(e=>e.snapshot.query),r=j(e=>e.snapshot.selectedSessionKey),i=j(e=>e.snapshot.draftSessionKey),a=j(e=>e.snapshot.selectedAgentId),o=Z(e=>e.snapshot.pendingSessionType),s=Z(e=>e.snapshot.pendingProjectRoot),c=Z(e=>e.snapshot.pendingProjectRootSessionKey),l=E(),u=YD(),d=Z(e=>e.snapshot.selectedModel),{confirm:f,ConfirmDialog:p}=un(),m=y(),h=b(),{sessionId:g}=v(),_=(0,k.useRef)(null),x=(0,k.useRef)(r),S=(0,k.useMemo)(()=>$M(g),[g]),C=S??r??i,T=s!==null&&c===C,{sessionSkillsQuery:ee,isProviderStateResolved:te,modelOptions:ne,sessionSummaries:re,skillRecords:ie,selectedSession:D,sessionTypeOptions:ae,defaultSessionType:oe,selectedSessionType:se,canEditSessionType:ce,sessionTypeUnavailable:O,sessionTypeUnavailableMessage:le}=gN({query:n,sessionKey:C,projectRootOverride:T?s:void 0,currentSelectedModel:d,pendingSessionType:o,setPendingSessionType:t.chatInputManager.setPendingSessionType,setSelectedModel:t.chatInputManager.setSelectedModel,setSelectedThinkingLevel:t.chatInputManager.setSelectedThinkingLevel}),ue=Mj(C),de=T?s:D?.projectRoot??null,fe=T?tt(de):D?.projectName??tt(de),pe=D?.parentSessionId??null,me=ue.isSending||ue.isRunning,he=ue.isRunning,ge=ue.isRunning,_e=ue.isRunning?null:`__preparing__`,ve=ue.hydrateError?.message??ue.snapshot.error?.message??null,ye=l.phase===`ready`&&kj(ve)?null:ve,be=l.isBlocked?null:l.phase===`ready`?ye:w.getDisplayMessage(ye);(0,k.useEffect)(()=>{t.chatStreamActionsManager.bind({sendMessage:async e=>{if(e.sessionKey!==C)return;let n=NN({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:e.sessionKey===c?s:D?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),r=Cr({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:n});if(r)try{await ue.send(r)}catch(n){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?t.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):t.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),n}},stopCurrentRun:async()=>{await ue.abort()},resumeRun:async e=>{e.sessionKey===C&&await ue.streamRun()},resetStreamState:()=>{x.current=null},applyHistoryMessages:()=>{}})},[ue,s,c,t,r,D?.projectRoot,C]),(0,k.useEffect)(()=>{!D||!PN({pendingProjectRoot:s,pendingProjectRootSessionKey:c,sessionKey:D.key,selectedSessionProjectRoot:D.projectRoot??null})||Z.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[s,c,D,r]),JM({view:e,routeSessionKey:S,selectedSessionKey:r,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:x,resetStreamState:t.chatStreamActionsManager.resetStreamState}),(0,k.useEffect)(()=>{t.chatUiManager.syncState({pathname:m.pathname}),t.chatUiManager.bindActions({navigate:h,confirm:f})},[f,m.pathname,h,t]);let xe=(u.data?.agents?.length??0)>0?u.data?.agents??[]:[{id:D?.agentId??a}],{currentSessionDisplayName:Se,currentAgentId:Ce,currentAgent:we,parentSession:Te,currentSessionTypeLabel:Ee,currentSessionTypeIcon:De,currentChildSessionTabs:Oe}=AN({sessionKey:C,selectedSession:D,selectedAgentId:a,availableAgents:xe,parentSessionId:pe,sessionSummaries:re,selectedSessionType:se,sessionTypeOptions:ae});return(0,k.useEffect)(()=>{!D?.agentId||a===D.agentId||t.chatSessionListManager.setSelectedAgentId(D.agentId)},[t,a,D?.agentId]),jN({presenter:t,isProviderStateResolved:te,defaultSessionType:oe,canStopCurrentRun:ge,stopDisabledReason:_e,lastSendError:be,isSending:me,modelOptions:ne,sessionTypeOptions:ae,selectedSessionType:se,canEditSessionType:ce,sessionTypeUnavailable:O,skillRecords:ie,isSkillsLoading:ee.isLoading,sessionTypeUnavailableMessage:le,currentSessionTypeLabel:Ee,currentSessionTypeIcon:De,sessionKey:C,currentAgentId:Ce,currentAgent:we,availableAgents:xe,currentSessionDisplayName:Se,effectiveSessionProjectRoot:de,effectiveSessionProjectName:fe,selectedSession:D,threadRef:_,agent:ue,isAwaitingAssistantOutput:he,parentSession:Te,childSessionTabs:Oe}),(0,A.jsx)(ui,{presenter:t,children:(0,A.jsx)(YM,{view:e,confirmDialog:(0,A.jsx)(p,{})})})}function IN({view:e}){return(0,A.jsx)(FN,{view:e})}export{IN as ChatPage};