nextclaw 0.20.3 → 0.20.5

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 (79) hide show
  1. package/dist/cli/app/index.js +1 -0
  2. package/dist/cli/app/index.js.map +1 -1
  3. package/package.json +16 -16
  4. package/resources/USAGE.md +3 -1
  5. package/ui-dist/assets/api-BAyyGaoz.js +15 -0
  6. package/ui-dist/assets/app-presenter-provider-DqHHfC1K.js +3 -0
  7. package/ui-dist/assets/arrow-left-Bn-3Pj3p.js +1 -0
  8. package/ui-dist/assets/{boxes-BvA-I63l.js → boxes-ClVuotcz.js} +1 -1
  9. package/ui-dist/assets/channels-list-page-BnGxv6ma.js +8 -0
  10. package/ui-dist/assets/chat-page-DInyWLb4.js +105 -0
  11. package/ui-dist/assets/config-split-page-CWN2YG9U.js +1 -0
  12. package/ui-dist/assets/confirm-dialog-CVbgKuHp.js +5 -0
  13. package/ui-dist/assets/{createLucideIcon-Br1EFMEr.js → createLucideIcon-CjPUPAAK.js} +1 -1
  14. package/ui-dist/assets/desktop-update-config-abmYzHSy.js +1 -0
  15. package/ui-dist/assets/{dist-rzakR_bu.js → dist-hkrb6Ynt.js} +1 -1
  16. package/ui-dist/assets/doc-browser-BlrpUKVJ.js +1 -0
  17. package/ui-dist/assets/doc-browser-context-Cb1sEUT0.js +1 -0
  18. package/ui-dist/assets/doc-browser-kJ2ClG0H.js +1 -0
  19. package/ui-dist/assets/ellipsis-CdkxFkVZ.js +1 -0
  20. package/ui-dist/assets/{external-link-DHjFdCpy.js → external-link-CT9_qFwN.js} +1 -1
  21. package/ui-dist/assets/index-BGXTR0F_.css +1 -0
  22. package/ui-dist/assets/index-Ccbswzt9.js +101 -0
  23. package/ui-dist/assets/{key-round-D41Oe35x.js → key-round-xJfR4iRe.js} +1 -1
  24. package/ui-dist/assets/{book-open-CRotBOF2.js → loader-circle-BI6HJDg5.js} +1 -1
  25. package/ui-dist/assets/{mcp-marketplace-page-Dvi8mCBd.js → mcp-marketplace-page-CmUKUeno.js} +2 -2
  26. package/ui-dist/assets/mcp-marketplace-page-DH11bSVx.js +1 -0
  27. package/ui-dist/assets/model-config-Dbo3zWDl.js +1 -0
  28. package/ui-dist/assets/notice-card-CFTFtJky.js +1 -0
  29. package/ui-dist/assets/play-DyBWW2j4.js +1 -0
  30. package/ui-dist/assets/plus-BlnBmcKE.js +1 -0
  31. package/ui-dist/assets/popover-DPqa_Mfb.js +1 -0
  32. package/ui-dist/assets/provider-models-CXUgDxGR.js +1 -0
  33. package/ui-dist/assets/provider-scoped-model-input-C6xL7zSJ.js +1 -0
  34. package/ui-dist/assets/providers-list-DOj_7GL8.js +1 -0
  35. package/ui-dist/assets/react-oAHNoVya.js +1 -0
  36. package/ui-dist/assets/refresh-cw-o8NSmIYV.js +1 -0
  37. package/ui-dist/assets/remote-fCE5fLsj.js +1 -0
  38. package/ui-dist/assets/rotate-cw-DA8EqNAH.js +1 -0
  39. package/ui-dist/assets/runtime-config-page-Dg8aEgWx.js +1 -0
  40. package/ui-dist/assets/{save-aYdSdK97.js → save-D4-g0EAq.js} +1 -1
  41. package/ui-dist/assets/search-G2cMn3M5.js +1 -0
  42. package/ui-dist/assets/{search-config-G2O1fcRb.js → search-config-DAibVFGR.js} +1 -1
  43. package/ui-dist/assets/{secrets-config-TenzxYbE.js → secrets-config-CoJzy13_.js} +2 -2
  44. package/ui-dist/assets/{status-dot-BSMG7ZaC.js → status-dot-D8xx5ZR8.js} +1 -1
  45. package/ui-dist/assets/{tabs-D1CjpWNX.js → tabs-DxmND60Q.js} +1 -1
  46. package/ui-dist/assets/{tabs-custom-CRSN1ekg.js → tabs-custom-Cjo0bHw8.js} +1 -1
  47. package/ui-dist/assets/{tag-chip-DEashiw6.js → tag-chip-DnNWFRMu.js} +1 -1
  48. package/ui-dist/assets/{trash-2-DSWTsARW.js → trash-2-C9tc-9sQ.js} +1 -1
  49. package/ui-dist/assets/x-DmLl2yG6.js +1 -0
  50. package/ui-dist/index.html +24 -23
  51. package/ui-dist/logos/mimo.svg +9 -0
  52. package/ui-dist/assets/api-DruAcori.js +0 -15
  53. package/ui-dist/assets/app-presenter-provider-DIcnNB9s.js +0 -3
  54. package/ui-dist/assets/channels-list-page-wK3l7p5R.js +0 -8
  55. package/ui-dist/assets/chat-page-DgehvdJT.js +0 -105
  56. package/ui-dist/assets/config-split-page-BnTO1mAM.js +0 -1
  57. package/ui-dist/assets/confirm-dialog-CGrKHbAW.js +0 -5
  58. package/ui-dist/assets/desktop-update-config-CehWxSSg.js +0 -1
  59. package/ui-dist/assets/dist-CpwDZDtv.js +0 -1
  60. package/ui-dist/assets/doc-browser-BgxmVsTx.js +0 -1
  61. package/ui-dist/assets/doc-browser-CZn5-Qbu.js +0 -1
  62. package/ui-dist/assets/doc-browser-context-B8gk7HMr.js +0 -1
  63. package/ui-dist/assets/index-DORmh0Cy.css +0 -1
  64. package/ui-dist/assets/index-DcFpvnge.js +0 -101
  65. package/ui-dist/assets/mcp-marketplace-page-DBLhJWOJ.js +0 -1
  66. package/ui-dist/assets/model-config-B-EJXGtO.js +0 -1
  67. package/ui-dist/assets/play-C-0vo7hi.js +0 -1
  68. package/ui-dist/assets/plus-Cr_akLp2.js +0 -1
  69. package/ui-dist/assets/popover-YieElO8c.js +0 -1
  70. package/ui-dist/assets/provider-scoped-model-input-BPRNGqYn.js +0 -1
  71. package/ui-dist/assets/providers-list-CtBpL1ZY.js +0 -1
  72. package/ui-dist/assets/react-B2X_ph0a.js +0 -1
  73. package/ui-dist/assets/remote-BGHbHoHf.js +0 -1
  74. package/ui-dist/assets/rotate-cw-jueVCNJQ.js +0 -1
  75. package/ui-dist/assets/runtime-config-page-C1Hv7mad.js +0 -1
  76. package/ui-dist/assets/search-CdhgFNwf.js +0 -1
  77. package/ui-dist/assets/setting-row-BNu0qhOM.js +0 -1
  78. package/ui-dist/assets/x-D1v_vb54.js +0 -1
  79. /package/ui-dist/assets/{config-hints-A7G_jMTU.js → config-hints-TmNgpFHv.js} +0 -0
@@ -0,0 +1,101 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/doc-browser-BlrpUKVJ.js","assets/doc-browser-kJ2ClG0H.js","assets/react-oAHNoVya.js","assets/createLucideIcon-CjPUPAAK.js","assets/arrow-left-Bn-3Pj3p.js","assets/boxes-ClVuotcz.js","assets/external-link-CT9_qFwN.js","assets/plus-BlnBmcKE.js","assets/search-G2cMn3M5.js","assets/x-DmLl2yG6.js","assets/doc-browser-context-Cb1sEUT0.js","assets/model-config-Dbo3zWDl.js","assets/api-BAyyGaoz.js","assets/loader-circle-BI6HJDg5.js","assets/provider-scoped-model-input-C6xL7zSJ.js","assets/provider-models-CXUgDxGR.js","assets/config-hints-TmNgpFHv.js","assets/chat-page-DInyWLb4.js","assets/app-presenter-provider-DqHHfC1K.js","assets/dist-hkrb6Ynt.js","assets/confirm-dialog-CVbgKuHp.js","assets/popover-DPqa_Mfb.js","assets/key-round-xJfR4iRe.js","assets/refresh-cw-o8NSmIYV.js","assets/trash-2-C9tc-9sQ.js","assets/notice-card-CFTFtJky.js","assets/status-dot-D8xx5ZR8.js","assets/tabs-DxmND60Q.js","assets/mcp-marketplace-page-CmUKUeno.js","assets/tag-chip-DnNWFRMu.js","assets/ellipsis-CdkxFkVZ.js","assets/play-DyBWW2j4.js","assets/tabs-custom-Cjo0bHw8.js","assets/search-config-DAibVFGR.js","assets/config-split-page-CWN2YG9U.js","assets/providers-list-DOj_7GL8.js","assets/channels-list-page-BnGxv6ma.js","assets/runtime-config-page-Dg8aEgWx.js","assets/rotate-cw-DA8EqNAH.js","assets/save-D4-g0EAq.js","assets/desktop-update-config-abmYzHSy.js","assets/secrets-config-CoJzy13_.js","assets/remote-fCE5fLsj.js","assets/mcp-marketplace-page-DH11bSVx.js"])))=>i.map(i=>d[i]);
2
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,s as p,t as m,u as h,v as g}from"./react-oAHNoVya.js";import{$ as _,At as v,B as y,Bt as b,Ct as x,Dt as S,Et as C,F as w,Ft as T,G as E,H as D,I as O,It as k,J as A,K as ee,L as j,Lt as te,M,N as ne,Nt as re,Ot as ie,P as ae,Pt as oe,Q as se,Qt as ce,R as le,Rt as ue,Tt as de,U as fe,V as pe,Vt as me,W as he,X as ge,Y as _e,Z as ve,Zt as ye,_ as be,at as xe,bt as Se,cn as Ce,ct as we,d as Te,dt as Ee,et as De,f as Oe,ft as ke,g as Ae,gt as je,h as Me,ht as Ne,kt as Pe,lt as Fe,m as Ie,n as Le,ot as Re,p as ze,q as Be,st as Ve,t as He,tt as Ue,v as We,vt as Ge,xt as Ke,y as qe,yt as Je,z as Ye,zt as N}from"./api-BAyyGaoz.js";import{A as Xe,B as Ze,F as Qe,G as $e,H as et,J as tt,K as nt,L as rt,M as it,P as at,R as ot,U as st,V as ct,W as lt,_ as ut,a as dt,c as ft,d as pt,f as mt,g as ht,h as gt,i as _t,j as vt,l as yt,m as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,t as Et,u as Dt,v as Ot,y as kt,z as At}from"./app-presenter-provider-DqHHfC1K.js";import{C as jt,S as Mt,a as Nt,b as Pt,c as Ft,d as It,f as Lt,g as Rt,h as zt,i as Bt,l as Vt,m as Ht,n as Ut,o as Wt,p as Gt,r as Kt,s as qt,u as Jt,v as Yt,w as Xt,y as Zt}from"./dist-hkrb6Ynt.js";import{a as Qt,i as $t,n as en,o as tn,r as nn,s as rn,t as an}from"./confirm-dialog-CVbgKuHp.js";import{t as P}from"./createLucideIcon-CjPUPAAK.js";import{t as on}from"./arrow-left-Bn-3Pj3p.js";import{n as sn}from"./doc-browser-kJ2ClG0H.js";import{n as cn,t as ln}from"./loader-circle-BI6HJDg5.js";import{t as un}from"./boxes-ClVuotcz.js";import{t as dn}from"./external-link-CT9_qFwN.js";import{t as fn}from"./key-round-xJfR4iRe.js";import{t as pn}from"./plus-BlnBmcKE.js";import{t as mn}from"./refresh-cw-o8NSmIYV.js";import{t as hn}from"./search-G2cMn3M5.js";import{t as gn}from"./trash-2-C9tc-9sQ.js";import{t as _n}from"./x-DmLl2yG6.js";import{a as vn,c as yn,i as bn,n as xn,o as Sn,r as Cn,s as wn,t as Tn}from"./popover-DPqa_Mfb.js";import{c as En,m as Dn,n as On,s as kn,t as An}from"./doc-browser-context-Cb1sEUT0.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var jn=a((e=>{var t=Ce();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),Mn=P(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),Nn=P(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Pn=P(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Fn=P(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),In=P(`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`}]]),Ln=P(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Rn=P(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),zn=P(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Bn=P(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Vn=P(`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`}]]),Hn=P(`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`}]]),Un=P(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Wn=P(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Gn=P(`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`}]]),Kn=P(`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`}]]),qn=P(`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`}]]),Jn=P(`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`}]]),Yn=P(`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`}]]),Xn=P(`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`}]]),Zn=P(`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`}]]),Qn=P(`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`}]]),$n=P(`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`}]]),er=P(`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`}]]),tr=P(`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`}]]),nr=P(`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`}]]),rr=P(`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`}]]),ir=P(`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`}]]),ar=P(`Folder`,[[`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`}]]),or=P(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),sr=P(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),cr=P(`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`}]]),lr=P(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),ur=P(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),dr=P(`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`}]]),fr=P(`MessageSquare`,[[`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`}]]),pr=P(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),mr=P(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),hr=P(`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`}]]),gr=P(`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`}]]),_r=P(`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`}]]),vr=P(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),yr=P(`Shield`,[[`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`}]]),br=P(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),xr=P(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Sr=P(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Cr=P(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),wr=P(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Tr=P(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),Er=jn(),F=g(o(),1);function Dr(){let e=On();(0,F.useEffect)(()=>{let t=t=>{let n=t.target.closest(`a[href]`);if(!n)return;let r=n.getAttribute(`href`)||``;Dn(r)&&(n.hasAttribute(`data-doc-external`)||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),e.open(r)))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[e])}var I=l(),Or=(0,F.createContext)(null);function kr({children:e}){let[t,r]=(0,F.useState)(()=>n());(0,F.useEffect)(()=>h(e=>{r(e)}),[]);let i=(0,F.useCallback)(e=>{c(e),r(d())},[]),a=(0,F.useCallback)(()=>{i(t===`en`?`zh`:`en`)},[t,i]),o=(0,F.useMemo)(()=>({language:t,setLanguage:i,toggleLanguage:a}),[t,i,a]);return(0,I.jsx)(Or.Provider,{value:o,children:e})}function Ar(){let e=(0,F.useContext)(Or);if(!e)throw Error(`useI18n must be used within I18nProvider`);return{...e,t:s}}function jr(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function Mr(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:jr(e),width:e}}var Nr=m(()=>Mr()),Pr=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>Nr.getState(),this.resetForTests=()=>{this.consumerCount=0,this.stop(),Nr.setState(Mr())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;Nr.setState({width:e,mode:jr(e)})}}};function Fr(){return(0,F.useEffect)(()=>Pr.attach(),[]),{isMobile:Nr(e=>e.mode)===`mobile`}}var Ir=m(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Lr=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}Ir.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();Ir.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){Ir.setState({supported:!0,initialized:!0,busyAction:null}),N.error(`${s(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{Ir.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(s(`runtimePresenceLaunchAtLoginUnavailable`));Ir.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return Ir.setState({supported:!0,initialized:!0,snapshot:n}),N.success(s(`runtimePresenceSaved`)),n}catch(e){throw N.error(`${s(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{Ir.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:s(`error`)}},Rr=m(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null}));new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){Rr.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{Rr.setState({supported:!0,initialized:!0,snapshot:e})}),Rr.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();Rr.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){Rr.setState({supported:!0,initialized:!0}),N.error(`${s(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,s(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){N.success(s(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){N.success(s(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??s(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){N.success(s(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&N.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,s(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&N.success(s(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,s(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updatePreferences=async e=>{try{await this.runSnapshotCommand(`saving-preferences`,s(`desktopUpdatesPreferencesFailed`),async t=>await t.updatePreferences(e))}catch{return}},this.updateChannel=async e=>{if(Rr.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,s(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){N.success(s(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}N.success(s(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(s(`desktopUpdatesDesktopOnlyDescription`));Rr.setState({busyAction:e});try{let e=await n(r);return Rr.setState({snapshot:e}),e}catch(e){throw N.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{Rr.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:s(`error`),this.getChannelLabel=e=>s(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function zr(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function Br(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function Vr(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function Hr(e){return[{target:`/chat`,label:e(`chat`),icon:ur},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:rt},{target:`/agents`,label:e(`agentsPageTitle`),icon:Fn},{target:`/settings`,label:e(`settings`),icon:vr}]}function Ur(e){return[{target:`/model`,label:e(`model`),icon:Un},{target:`/providers`,label:e(`providers`),icon:xr},{target:`/channels`,label:e(`channels`),icon:fr},{target:`/search`,label:e(`searchChannels`),icon:hn},{target:`/runtime`,label:e(`runtime`),icon:Un},{target:`/updates`,label:e(`updates`),icon:Wn},{target:`/remote`,label:e(`remote`),icon:Tr},{target:`/security`,label:e(`security`),icon:yr},{target:`/secrets`,label:e(`secrets`),icon:fn},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:vt}]}function Wr(e){return[{target:`/language`,label:e(`language`),icon:lr},...Ur(e)]}function Gr(e){let t=e.toLowerCase();return t===`/settings`?!0:Wr(e=>e).some(e=>zr(t,e.target))}function Kr(e,t){let n=e.toLowerCase(),r=Wr(t);if(Vr(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(zr(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var qr=`nextclaw.ui.theme`,Jr=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],Yr=`warm`,Xr=!1,Zr=new Set;function Qr(e){return e===`warm`||e===`cool`}function $r(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function ei(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(qr);if(Qr(e))return e}catch{}return`warm`}function ti(){return Xr||=(Yr=ei(),$r(Yr),!0),Yr}function ni(){return Xr?Yr:ti()}function ri(e){if(ti(),e!==Yr){if(Yr=e,$r(Yr),typeof window<`u`)try{window.localStorage.setItem(qr,Yr)}catch{}Zr.forEach(e=>e(Yr))}}function ii(e){return Zr.add(e),()=>{Zr.delete(e)}}function ai(){return me({queryKey:[`config`],queryFn:j,staleTime:3e4,refetchOnWindowFocus:!0})}function oi(){return me({queryKey:[`app-meta`],queryFn:O,staleTime:1/0})}function si(){return me({queryKey:[`config-meta`],queryFn:le,staleTime:1/0})}function ci(){return me({queryKey:[`providers`],queryFn:fe,staleTime:3e4,refetchOnWindowFocus:!0})}function li(){return me({queryKey:[`provider-templates`],queryFn:D,staleTime:1/0})}function ui(){return me({queryKey:[`config-schema`],queryFn:Ye,staleTime:1/0})}function di(){let e=ce();return b({mutationFn:ve,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),N.success(s(`configSaved`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function fi(){let e=ce();return b({mutationFn:({data:e})=>De(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function pi(){let e=ce();return b({mutationFn:({provider:e,data:t})=>se(e,t),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),n.silentSuccess||N.success(s(`configSaved`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function mi(){let e=ce();return b({mutationFn:({data:e})=>M(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),N.success(s(`configSaved`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function hi(){let e=ce();return b({mutationFn:({provider:e})=>ae(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),N.success(s(`configSaved`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function gi(){return b({mutationFn:({provider:e,data:t})=>_e(e,t)})}function _i(){return b({mutationFn:({provider:e,data:t})=>A(e,t)})}function vi(){return b({mutationFn:({provider:e,data:t})=>E(e,t)})}function yi(){return b({mutationFn:({provider:e})=>he(e)})}function bi(){let e=ce();return b({mutationFn:({channel:e,data:t})=>ge(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),N.success(s(`configSavedApplying`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function xi(){let e=ce();return b({mutationFn:({data:e})=>_(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function Si(){let e=ce();return b({mutationFn:({data:e})=>Ue(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function Ci(){return b({mutationFn:({actionId:e,data:t})=>w(e,t),onError:e=>{N.error(s(`error`)+`: `+e.message)}})}function wi(e){return me({queryKey:[`ncp-sessions`,e?.limit??null],queryFn:()=>be(e),staleTime:5e3,retry:!1})}function Ti(e){return me({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>Ae(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,staleTime:5e3,retry:!1})}function Ei(e={all:!0}){return me({queryKey:[`cron`,e],queryFn:()=>y(e),staleTime:1e4})}function Di(){let e=ce();return b({mutationFn:({id:e})=>ne(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function Oi(){let e=ce();return b({mutationFn:({id:e,enabled:t})=>Be(e,{enabled:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function ki(){let e=ce();return b({mutationFn:({id:e,force:t})=>ee(e,{force:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}var Ai={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function ji(){let e=Ge(),t=e.actionLabel===s(`runtimeStatusRestartAction`),n=async()=>{if(t)try{let e=await Ke.runRuntimeControlAction(`restart-service`);N.success(e.message)}catch(e){let t=e instanceof Error?e.message:s(`runtimeControlActionFailed`);N.error(`${s(`runtimeControlActionFailed`)}: ${t}`)}};return(0,I.jsxs)(Tn,{children:[(0,I.jsx)(Cn,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,I.jsx)(`span`,{className:r(`h-2.5 w-2.5 rounded-full`,Ai[e.tone])})})}),(0,I.jsxs)(xn,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,I.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,I.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,I.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,I.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:s(`runtimeStatusActionHint`)}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void n(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?s(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function Mi({className:e,density:t=`sidebar`,suffix:n}){let{data:i}=oi(),a=i?.name??`NextClaw`,o=i?.productVersion?.trim(),s=o?`v${o}`:null,c=n??(0,I.jsx)(ji,{}),l=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,u=t===`chrome`;return(0,I.jsxs)(`div`,{className:r(e??`flex min-w-0 items-center gap-2`,l&&`pl-[58px]`),children:[(0,I.jsx)(`div`,{className:r(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,I.jsx)(`img`,{src:`/logo.svg`,alt:a,className:`h-full w-full object-contain`})}),(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,I.jsx)(`span`,{className:r(`shrink-0 font-semibold text-gray-800`,u?`text-[15px]`:`text-[14px]`),children:a}),s?(0,I.jsx)(Ni,{versionLabel:s,density:t}):null]}),(0,I.jsx)(Pi,{}),c?(0,I.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:c}):null]})]})}function Ni({versionLabel:e,density:t}){let[n,i]=(0,F.useState)(!1);return(0,I.jsxs)(`span`,{className:`relative min-w-0 flex-1`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),children:[(0,I.jsx)(`span`,{tabIndex:0,"aria-label":e,className:r(`block min-w-0 truncate font-medium text-gray-500 outline-none`,`text-[12px]`),children:e}),n?(0,I.jsx)(`span`,{className:`pointer-events-none absolute left-0 top-full z-[var(--z-tooltip)] mt-1 w-max max-w-none whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md`,children:e}):null]})}function Pi(){let{supported:e,busyAction:t,snapshot:n}=je();return!e||!n?null:n.status===`downloading`||n.status===`blocked`||n.status===`failed`?(0,I.jsx)(Fi,{snapshot:n}):n.status===`downloaded`?(0,I.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-emerald-50 px-2 text-[11px] font-semibold leading-none text-emerald-700 ring-1 ring-emerald-100 transition-colors hover:bg-emerald-100 disabled:opacity-70`,disabled:t===`applying`,onClick:()=>void Ne.applyDownloadedUpdate(),children:s(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)}):n.status===`update-available`?(0,I.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,disabled:t===`downloading`,onClick:()=>void Ne.downloadUpdate(),children:s(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)}):null}function Fi({snapshot:e}){if(e.status===`blocked`||e.status===`failed`)return(0,I.jsx)(Ii,{snapshot:e});let t=e.status===`downloading`?Li(e):null;return t?(0,I.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,title:s(`updates`),children:t}):null}function Ii({snapshot:e}){let t=e.status===`failed`?s(`desktopUpdatesStatusFailed`):s(`desktopUpdatesStatusBlocked`),n=e.recoveryCommand?.trim()||null,r=e.errorMessage?.trim()||e.blockReason?.trim()||null,i=[t,e.status===`blocked`&&e.blockReason?s(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,r,n].filter(Boolean).join(`
3
+ `);return(0,I.jsx)(`span`,{role:`img`,"aria-label":t,title:i,tabIndex:0,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-50 text-[13px] font-bold leading-none text-amber-700 ring-1 ring-amber-100`,children:`!`})}function Li(e){let t=e.progress?.percent;return t==null?s(`desktopUpdatesInlineDownloading`):s(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var Ri=g(Ce(),1);function zi(e,[t,n]){return Math.min(n,Math.max(t,e))}function Bi(e){let t=e+`CollectionProvider`,[n,r]=Mt(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=F.useRef(null),a=F.useRef(new Map).current;return(0,I.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Rt(s),l=F.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,I.jsx)(c,{ref:jt(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Rt(u),p=F.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=F.useRef(null),s=jt(t,o),c=a(u,n);return F.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,I.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return F.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Vi=F.createContext(void 0);function Hi(e){let t=F.useContext(Vi);return e||t||`ltr`}function Ui(e){let t=F.useRef({value:e,previous:e});return F.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Wi=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Gi=[` `,`Enter`],Ki=`Select`,[qi,Ji,Yi]=Bi(Ki),[Xi,Zi]=Mt(Ki,[Yi,qt]),Qi=qt(),[$i,ea]=Xi(Ki),[ta,na]=Xi(Ki),ra=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Qi(t),[g,_]=F.useState(null),[v,y]=F.useState(null),[b,x]=F.useState(!1),S=Hi(l),[C,w]=Yt({prop:r,defaultProp:i??!1,onChange:a,caller:Ki}),[T,E]=Yt({prop:o,defaultProp:s,onChange:c,caller:Ki}),D=F.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,A]=F.useState(new Set),ee=Array.from(k).map(e=>e.props.value).join(`;`);return(0,I.jsx)(Wt,{...h,children:(0,I.jsxs)($i,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:Zt(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,I.jsx)(qi.Provider,{scope:t,children:(0,I.jsx)(ta,{scope:e.__scopeSelect,onNativeOptionAdd:F.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:F.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,I.jsxs)(Qa,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,I.jsx)(`option`,{value:``}):null,Array.from(k)]},ee):null]})})};ra.displayName=Ki;var ia=`SelectTrigger`,aa=F.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Qi(n),o=ea(ia,n),s=o.disabled||r,c=jt(t,o.onTriggerChange),l=Ji(n),u=F.useRef(`touch`),[d,f,p]=eo(e=>{let t=l().filter(e=>!e.disabled),n=to(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,I.jsx)(Kt,{asChild:!0,...a,children:(0,I.jsx)(zt.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$a(o.value)?``:void 0,...i,ref:c,onClick:Xt(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:Xt(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:Xt(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Wi.includes(e.key)&&(m(),e.preventDefault())})})})});aa.displayName=ia;var oa=`SelectValue`,sa=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=ea(oa,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=jt(t,c.onValueNodeChange);return Pt(()=>{l(u)},[l,u]),(0,I.jsx)(zt.span,{...s,ref:d,style:{pointerEvents:`none`},children:$a(c.value)?(0,I.jsx)(I.Fragment,{children:o}):a})});sa.displayName=oa;var ca=`SelectIcon`,la=F.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(zt.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});la.displayName=ca;var ua=`SelectPortal`,da=e=>(0,I.jsx)(It,{asChild:!0,...e});da.displayName=ua;var fa=`SelectContent`,pa=F.forwardRef((e,t)=>{let n=ea(fa,e.__scopeSelect),[r,i]=F.useState();if(Pt(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Ri.createPortal((0,I.jsx)(ha,{scope:e.__scopeSelect,children:(0,I.jsx)(qi.Slot,{scope:e.__scopeSelect,children:(0,I.jsx)(`div`,{children:e.children})})}),t):null}return(0,I.jsx)(ya,{...e,ref:t})});pa.displayName=fa;var ma=10,[ha,ga]=Xi(fa),_a=`SelectContentImpl`,va=Rt(`SelectContent.RemoveScroll`),ya=F.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=ea(fa,n),[y,b]=F.useState(null),[x,S]=F.useState(null),C=jt(t,e=>b(e)),[w,T]=F.useState(null),[E,D]=F.useState(null),O=Ji(n),[k,A]=F.useState(!1),ee=F.useRef(!1);F.useEffect(()=>{if(y)return Ft(y)},[y]),Jt();let j=F.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),te=F.useCallback(()=>j([w,y]),[j,w,y]);F.useEffect(()=>{k&&te()},[k,te]);let{onOpenChange:M,triggerPointerDownPosRef:ne}=v;F.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ne.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ne.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||M(!1),document.removeEventListener(`pointermove`,t),ne.current=null};return ne.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,M,ne]),F.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[re,ie]=eo(e=>{let t=O().filter(e=>!e.disabled),n=to(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ae=F.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ee.current=!0))},[v.value]),oe=F.useCallback(()=>y?.focus(),[y]),se=F.useCallback((e,t,n)=>{let r=!ee.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ce=r===`popper`?Ca:xa,le=ce===Ca?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,I.jsx)(ha,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ae,selectedItem:w,onItemLeave:oe,itemTextRefCallback:se,focusSelectedItem:te,selectedItemText:E,position:r,isPositioned:k,searchRef:re,children:(0,I.jsx)(Vt,{as:va,allowPinchZoom:!0,children:(0,I.jsx)(Lt,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Xt(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(Gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,I.jsx)(ce,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...le,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:Xt(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ie(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>j(t)),e.preventDefault()}})})})})})})});ya.displayName=_a;var ba=`SelectItemAlignedPosition`,xa=F.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=ea(fa,n),o=ga(fa,n),[s,c]=F.useState(null),[l,u]=F.useState(null),d=jt(t,e=>u(e)),f=Ji(n),p=F.useRef(!1),m=F.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=F.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-ma,d=zi(a,[ma,Math.max(ma,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-ma,d=zi(a,[ma,Math.max(ma,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-ma*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-ma,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,ee=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${ma}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Pt(()=>y(),[y]);let[b,x]=F.useState();return Pt(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,I.jsx)(wa,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:F.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,I.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,I.jsx)(zt.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});xa.displayName=ba;var Sa=`SelectPopperPosition`,Ca=F.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=ma,...a}=e,o=Qi(n);return(0,I.jsx)(Nt,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Ca.displayName=Sa;var[wa,Ta]=Xi(fa,{}),Ea=`SelectViewport`,Da=F.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=ga(Ea,n),o=Ta(Ea,n),s=jt(t,a.onViewportChange),c=F.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(qi.Slot,{scope:n,children:(0,I.jsx)(zt.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:Xt(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-ma*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Da.displayName=Ea;var Oa=`SelectGroup`,[ka,Aa]=Xi(Oa),ja=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Zt();return(0,I.jsx)(ka,{scope:n,id:i,children:(0,I.jsx)(zt.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});ja.displayName=Oa;var Ma=`SelectLabel`,Na=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Aa(Ma,n);return(0,I.jsx)(zt.div,{id:i.id,...r,ref:t})});Na.displayName=Ma;var Pa=`SelectItem`,[Fa,Ia]=Xi(Pa),La=F.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=ea(Pa,n),c=ga(Pa,n),l=s.value===r,[u,d]=F.useState(a??``),[f,p]=F.useState(!1),m=jt(t,e=>c.itemRefCallback?.(e,r,i)),h=Zt(),g=F.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,I.jsx)(Fa,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:F.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(qi.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,I.jsx)(zt.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:Xt(o.onFocus,()=>p(!0)),onBlur:Xt(o.onBlur,()=>p(!1)),onClick:Xt(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:Xt(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:Xt(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:Xt(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Xt(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Xt(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Gi.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});La.displayName=Pa;var Ra=`SelectItemText`,za=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=ea(Ra,n),s=ga(Ra,n),c=Ia(Ra,n),l=na(Ra,n),[u,d]=F.useState(null),f=jt(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=F.useMemo(()=>(0,I.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Pt(()=>(h(m),()=>g(m)),[h,g,m]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(zt.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ri.createPortal(a.children,o.valueNode):null]})});za.displayName=Ra;var Ba=`SelectItemIndicator`,Va=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ia(Ba,n).isSelected?(0,I.jsx)(zt.span,{"aria-hidden":!0,...r,ref:t}):null});Va.displayName=Ba;var Ha=`SelectScrollUpButton`,Ua=F.forwardRef((e,t)=>{let n=ga(Ha,e.__scopeSelect),r=Ta(Ha,e.__scopeSelect),[i,a]=F.useState(!1),o=jt(t,r.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Ka,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ua.displayName=Ha;var Wa=`SelectScrollDownButton`,Ga=F.forwardRef((e,t)=>{let n=ga(Wa,e.__scopeSelect),r=Ta(Wa,e.__scopeSelect),[i,a]=F.useState(!1),o=jt(t,r.onScrollButtonChange);return Pt(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Ka,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ga.displayName=Wa;var Ka=F.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=ga(`SelectScrollButton`,n),o=F.useRef(null),s=Ji(n),c=F.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return F.useEffect(()=>()=>c(),[c]),Pt(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,I.jsx)(zt.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Xt(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Xt(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Xt(i.onPointerLeave,()=>{c()})})}),qa=`SelectSeparator`,Ja=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,I.jsx)(zt.div,{"aria-hidden":!0,...r,ref:t})});Ja.displayName=qa;var Ya=`SelectArrow`,Xa=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Qi(n),a=ea(Ya,n),o=ga(Ya,n);return a.open&&o.position===`popper`?(0,I.jsx)(Bt,{...i,...r,ref:t}):null});Xa.displayName=Ya;var Za=`SelectBubbleInput`,Qa=F.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=F.useRef(null),a=jt(r,i),o=Ui(t);return F.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,I.jsx)(zt.select,{...n,style:{...Ut,...n.style},ref:a,defaultValue:t})});Qa.displayName=Za;function $a(e){return e===``||e===void 0}function eo(e){let t=Ht(e),n=F.useRef(``),r=F.useRef(0),i=F.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=F.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return F.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function to(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=no(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function no(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ro=ra,io=aa,ao=sa,oo=la,so=da,co=pa,lo=Da,uo=ja,fo=Na,po=La,mo=za,ho=Va,go=Ua,_o=Ga,vo=Ja,yo=ro,bo=ao,xo=F.forwardRef(({className:e,children:t,indicator:n,...i},a)=>(0,I.jsxs)(io,{ref:a,className:r(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-gray-200/80 bg-transparent 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 bg-white`,e),...i,children:[t,(0,I.jsx)(oo,{asChild:!0,children:n??(0,I.jsx)(Rn,{className:`h-4 w-4 opacity-50`})})]}));xo.displayName=io.displayName;var So=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(go,{ref:n,className:r(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(Bn,{className:`h-4 w-4`})}));So.displayName=go.displayName;var Co=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(_o,{ref:n,className:r(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(Rn,{className:`h-4 w-4`})}));Co.displayName=_o.displayName;var wo=F.forwardRef(({className:e,children:t,position:n=`popper`,viewportClassName:i,...a},o)=>(0,I.jsx)(so,{children:(0,I.jsxs)(co,{ref:o,className:r(`relative z-[var(--z-popover,50)] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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 bg-white`,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,...a,children:[(0,I.jsx)(So,{}),(0,I.jsx)(lo,{className:r(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,i),children:t}),(0,I.jsx)(Co,{})]})}));wo.displayName=co.displayName;var To=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(fo,{ref:n,className:r(`px-2 py-1.5 text-sm font-semibold`,e),...t}));To.displayName=fo.displayName;var Eo=F.forwardRef(({className:e,children:t,...n},i)=>(0,I.jsxs)(po,{ref:i,className:r(`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 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-gray-100`,e),...n,children:[(0,I.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,I.jsx)(ho,{children:(0,I.jsx)(Ln,{className:`h-4 w-4`})})}),(0,I.jsx)(mo,{children:t})]}));Eo.displayName=po.displayName;var Do=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(vo,{ref:n,className:r(`-mx-1 my-1 h-px bg-muted`,e),...t}));Do.displayName=vo.displayName;var Oo={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function ko(e){return Oo[e]}function Ao({to:e,label:t,icon:n,density:i=`default`,className:a}){let o=ko(i);return(0,I.jsx)(ct,{to:e,className:({isActive:e})=>r(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,a),children:({isActive:e})=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n,{className:r(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function jo({label:e,icon:t,onClick:n,density:i=`default`,className:a,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=ko(i);return(0,I.jsxs)(`button`,{type:`button`,onClick:n,className:r(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,a),"data-testid":l,children:[(0,I.jsx)(t,{className:r(d.icon,`shrink-0 text-gray-400`)}),(0,I.jsx)(`span`,{className:r(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,I.jsx)(`span`,{className:r(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function Mo({label:e,icon:t,value:n,valueLabel:i,onValueChange:a,density:o=`default`,children:s}){let c=ko(o);return(0,I.jsxs)(yo,{value:n,onValueChange:a,children:[(0,I.jsxs)(xo,{className:r(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,I.jsxs)(`div`,{className:r(`flex min-w-0 items-center`,c.gap),children:[(0,I.jsx)(t,{className:r(c.icon,`text-gray-400`)}),(0,I.jsx)(`span`,{className:`text-left`,children:e})]}),(0,I.jsx)(`span`,{className:r(`ml-auto text-gray-500`,c.value),children:i})]}),(0,I.jsx)(wo,{children:s})]})}var No=`nextclaw-pwa-install-banner-dismissed`,Po=`nextclaw-pwa-install-banner-dismissed-until`;function Fo(){let e=Ro();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:zo(e):!1}function Io(){let e=Ro();e?.setItem(No,`1`),e?.removeItem(Po)}function Lo(){let e=Ro();e?.removeItem(No),e?.removeItem(Po)}function Ro(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function zo(e){let t=e.getItem(Po);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(Po),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(No,`1`),!0)}function Bo(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:Fo(),updateAvailable:!1,registrationFailed:!1}}var Vo=m(()=>Bo()),Ho=`nextclaw-pwa-dev-sw-reset`,Uo=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{Vo.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){Vo.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;Vo.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:Vo.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(Ho)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(Ho,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(Ho)}catch{}}}},Wo=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),Vo.setState(Bo())},this.refreshState=()=>{let e=this.resolveInstallability();Vo.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:Fo()})),Uo.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Io(),Vo.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(Lo(),this.refreshState(),N.success(s(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,Lo(),Vo.setState({dismissedInstallPrompt:!0}),N.success(s(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function Go(){let e=Vo(e=>e.installability);return(0,I.jsx)(`span`,{className:r(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:Ko(e)})}function Ko(e){return s(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function qo(e,t,n){return s(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function Jo(){let e=Vo(e=>e.installability),t=Vo(e=>e.installMethod),n=Vo(e=>e.blockedReason);return(0,I.jsxs)(C,{children:[(0,I.jsxs)(Pe,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(v,{children:s(`pwaInstallTitle`)}),(0,I.jsx)(ie,{children:s(`pwaInstallDescription`)})]}),(0,I.jsx)(Go,{})]}),(0,I.jsxs)(S,{className:`space-y-4`,children:[(0,I.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,I.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:qo(e,t,n)})}),e===`available`&&t===`prompt`?(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,I.jsxs)(T,{type:`button`,className:`gap-2`,onClick:()=>{Wo.promptInstall()},children:[(0,I.jsx)(Wn,{className:`h-4 w-4`}),s(`pwaInstallAction`)]}),(0,I.jsx)(`p`,{className:`text-sm text-gray-500`,children:s(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,I.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,I.jsx)(br,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,I.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:s(`pwaInstallManualHint`)})]}):null]})]})}function Yo(){let e=Vo(e=>e.installability),t=Vo(e=>e.installMethod),n=Vo(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,I.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:s(`pwaInstallBannerTitle`)}),(0,I.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:s(`pwaInstallBannerDescription`)})]}),(0,I.jsx)(`button`,{type:`button`,"aria-label":s(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Wo.dismissInstallPrompt()},children:(0,I.jsx)(_n,{className:`h-4 w-4`})})]}),(0,I.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,I.jsxs)(T,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Wo.promptInstall()},children:[(0,I.jsx)(Wn,{className:`h-4 w-4`}),s(`pwaInstallAction`)]}),(0,I.jsx)(T,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Wo.dismissInstallPrompt()},children:s(`pwaInstallDismiss`)})]})]})}function Xo(){let e=Vo(e=>e.updateAvailable),t=Vo(e=>e.installability);return!e||t!==`installed`?null:(0,I.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,I.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:s(`pwaUpdateBannerTitle`)}),(0,I.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:s(`pwaUpdateBannerDescription`)})]})}),(0,I.jsx)(`div`,{className:`mt-4`,children:(0,I.jsxs)(T,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Uo.applyUpdate()},children:[(0,I.jsx)(mn,{className:`h-4 w-4`}),s(`pwaUpdateAction`)]})})]})}var Zo=!1;function Qo(){Zo||typeof window>`u`||(Zo=!0,Wo.start(),Uo.start())}var $o={warm:`#F9F8F5`,cool:`#F8FAFB`},es=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=$o[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},ts=(0,F.createContext)(null);function ns({children:e}){let[t,n]=(0,F.useState)(()=>ti());(0,F.useEffect)(()=>{es.syncTheme(t)},[t]),(0,F.useEffect)(()=>ii(e=>{n(e)}),[]);let r=(0,F.useCallback)(e=>{ri(e),n(ni())},[]),i=(0,F.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,I.jsx)(ts.Provider,{value:i,children:e})}function rs(){let e=(0,F.useContext)(ts);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function is(){let{language:e,setLanguage:n}=Ar();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,F.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}function as(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:n,selectLanguage:i}=is();return(0,I.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,I.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,I.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,I.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,I.jsx)(lr,{className:`h-4 w-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:s(`language`)}),(0,I.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,I.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:n.map(t=>{let n=t.value===e;return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>i(t.value),className:r(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,I.jsx)(Ln,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function os({mode:e}){let t=xt(),n=On(),i=Xe(),{currentLanguage:a,currentLanguageLabel:o,languageOptions:c,selectLanguage:l}=is(),{theme:u,setTheme:d}=rs(),f=e===`settings`,p=s(Jr.find(e=>e.value===u)?.labelKey??`themeWarm`),m=i.data?.account.email?.trim(),h=!!i.data?.account.loggedIn,g=e=>{u!==e&&d(e)},_=[{target:`/chat`,label:s(`chat`),icon:ur},{target:`/chat/cron`,label:s(`cron`),icon:Mn},{target:`/chat/skills`,label:s(`marketplaceFilterSkills`),icon:rt},{target:`/agents`,label:s(`agentsPageTitle`),icon:Fn}],v=Ur(s),y=f?v:_,b=f?`compact`:`default`;return(0,I.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 pb-6`,children:[f?(0,I.jsx)(`div`,{className:`shrink-0 px-2 py-2.5`,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,I.jsxs)(ct,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,I.jsx)(on,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,I.jsx)(`span`,{className:`truncate`,children:s(`backToMain`)})]}),(0,I.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,I.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:s(`settings`)})]})}):(0,I.jsx)(`div`,{className:`shrink-0 px-2 py-2.5`,children:(0,I.jsx)(Mi,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,I.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,I.jsx)(`ul`,{className:r(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:y.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsx)(Ao,{to:e.target,label:e.label,icon:e.icon,density:b})},e.target))})}),(0,I.jsxs)(`div`,{className:r(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,I.jsx)(jo,{onClick:()=>t.accountManager.openAccountPanel(),icon:fn,label:s(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:h?m||s(`remoteAccountEntryConnected`):s(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,I.jsx)(`div`,{className:`mb-2`,children:(0,I.jsx)(Ao,{to:`/settings`,label:s(`settings`),icon:vr})}),(0,I.jsx)(`div`,{className:`mb-2`,children:(0,I.jsx)(Mo,{value:u,onValueChange:e=>g(e),icon:mr,label:s(`theme`),valueLabel:p,density:b,children:Jr.map(e=>(0,I.jsx)(Eo,{value:e.value,className:`text-xs`,children:s(e.labelKey)},e.value))})}),(0,I.jsx)(`div`,{className:`mb-2`,children:(0,I.jsx)(Mo,{value:a,onValueChange:e=>l(e),icon:lr,label:s(`language`),valueLabel:o,density:b,children:c.map(e=>(0,I.jsx)(Eo,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,I.jsx)(jo,{onClick:()=>n.open(void 0,{kind:`docs`,title:s(`docBrowserHelp`)}),icon:cn,label:s(`docBrowserHelp`),density:b})]})]})]})}var ss=[{action:`minimize`,label:`Minimize`,icon:pr},{action:`close`,label:`Close`,icon:_n,variant:`danger`}];function cs(){let e=us()?{action:`toggle-maximize`,label:`Restore`,icon:Hn}:{action:`toggle-maximize`,label:`Maximize`,icon:Sr};return(0,I.jsxs)(`header`,{className:`desktop-window-drag relative flex h-[var(--desktop-titlebar-height)] shrink-0 bg-secondary after:absolute after:bottom-0 after:left-[var(--desktop-sidebar-width)] after:right-0 after:border-b after:border-[#ebe7dc]/80`,"data-testid":`desktop-window-chrome`,children:[(0,I.jsx)(`div`,{className:`desktop-window-no-drag absolute left-0 right-0 top-0 h-1`,"data-testid":`desktop-window-chrome-resize-strip`}),(0,I.jsx)(`div`,{className:`desktop-window-drag relative z-10 flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary pl-4 pr-3 text-secondary-foreground`,"data-testid":`desktop-window-chrome-sidebar`,children:(0,I.jsx)(Mi,{className:`flex min-w-0 shrink-0 items-center gap-2.5`,density:`chrome`})}),(0,I.jsx)(`div`,{className:`desktop-window-no-drag absolute right-0 top-0 z-20 flex h-full w-[var(--desktop-caption-safe-right)] items-start justify-end`,"data-testid":`desktop-window-controls`,children:[ss[0],e,ss[1]].map(e=>(0,I.jsx)(ls,{control:e},e.action))})]})}function ls({control:e}){let t=e.icon;return(0,I.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,className:e.variant===`danger`?`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-red-500 hover:text-white`:`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-black/10`,onClick:()=>{window.nextclawDesktop?.controlWindow?.(e.action)},children:(0,I.jsx)(t,{className:`h-3.5 w-3.5`})})}function us(){let[e,t]=(0,F.useState)(!1);return(0,F.useEffect)(()=>{let e=!0,n=window.nextclawDesktop;n?.getWindowState?.().then(n=>{e&&t(n.isMaximized)});let r=n?.onWindowStateChanged?.(e=>{t(e.isMaximized)});return()=>{e=!1,r?.()}},[]),e}function ds(){return typeof window>`u`?null:ps()??window.nextclawDesktop?.platform??null}function fs(){return ds()===`win32`}function ps(){return null}function ms(e,t){if(t===`/settings`)return Gr(e);let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function hs(){let{pathname:e}=$e(),t=Hr(s);return(0,I.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":s(`settings`),className:`shrink-0 border-t border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.25rem)`},children:(0,I.jsx)(`ul`,{className:`grid grid-cols-4 gap-1 px-2 pt-1`,children:t.map(t=>{let n=ms(e,t.target);return(0,I.jsx)(`li`,{children:(0,I.jsx)(At,{to:t.target,"aria-current":n?`page`:void 0,className:r(`group flex min-h-[2.875rem] items-center justify-center rounded-xl px-1 py-1 text-[10px] font-medium transition-colors`,n?`text-gray-900`:`text-gray-500 hover:text-gray-800`),children:(0,I.jsxs)(`span`,{"data-testid":n?`mobile-nav-active-indicator`:void 0,className:r(`inline-flex max-w-full min-w-14 flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 transition-colors`,n?`bg-gray-100`:`bg-transparent group-hover:bg-gray-50`),children:[(0,I.jsx)(t.icon,{className:r(`h-3.5 w-3.5`,n?`text-gray-900`:`text-gray-400`)}),(0,I.jsx)(`span`,{className:`max-w-full truncate`,children:t.label})]})})},t.target)})})})}function gs({leadingInset:e}){let t=nt(),{pathname:n}=$e(),r=Kr(n,s);return(0,I.jsx)(`header`,{"data-testid":`mobile-topbar`,className:`shrink-0 border-b border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.25rem)`},children:(0,I.jsxs)(`div`,{className:`flex min-h-[2.75rem] items-center gap-2 py-1.5 pl-3 pr-3`,style:{paddingLeft:e?`calc(${e} + 0.75rem)`:void 0},children:[r.backTarget?(0,I.jsx)(`button`,{type:`button`,onClick:()=>t(r.backTarget),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900`,"aria-label":r.backLabel??s(`backToMain`),children:(0,I.jsx)(on,{className:`h-4 w-4`})}):null,(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(`h1`,{className:`truncate text-center text-[15px] font-semibold text-gray-900`,children:r.title})}),r.backTarget?(0,I.jsx)(`div`,{className:`h-8 w-8 shrink-0`,"aria-hidden":`true`}):null]})})}var _s=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{DocBrowser:e}=await import(`./doc-browser-BlrpUKVJ.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))).DocBrowser}));function vs({pathname:e,isDocBrowserOpen:t,docBrowserDockControls:n,docBrowserRenderers:r={},topbarLeadingInset:i,children:a}){let o=Br(e),s=!Vr(e),c=!Vr(e);return(0,I.jsxs)(`div`,{className:`flex h-[100svh] flex-col bg-background font-sans text-foreground supports-[height:100dvh]:h-[100dvh]`,children:[s?(0,I.jsx)(gs,{leadingInset:i}):null,(0,I.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:o?(0,I.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:a}):(0,I.jsx)(`main`,{className:`h-full overflow-auto px-4 py-4 custom-scrollbar`,children:(0,I.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:a})})}),c?(0,I.jsx)(hs,{}):null,t?(0,I.jsx)(F.Suspense,{fallback:null,children:(0,I.jsx)(_s,{customTabRenderers:r,displayMode:`fullscreen`,dockControls:n})}):null]})}function ys(){let e=Wr(s);return(0,I.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,I.jsxs)(ct,{to:e.target,className:({isActive:e})=>r(`flex items-center gap-3 rounded-2xl border border-gray-200/80 bg-white px-4 py-4 shadow-card transition-colors`,e?`border-gray-300 bg-gray-50`:`hover:border-gray-300 hover:bg-gray-50/70`),children:[(0,I.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,I.jsx)(e.icon,{className:`h-4 w-4`})}),(0,I.jsx)(`div`,{className:`min-w-0`,children:(0,I.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.label})})]},e.target))})}function bs({isProjectFirstView:e,onSelectMode:t}){return(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:r(`transition-colors`,e?`text-gray-400 hover:text-gray-600`:`font-medium text-gray-600`),children:s(`chatSidebarViewTime`)}),(0,I.jsx)(`span`,{className:`text-gray-300`,children:`/`}),(0,I.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:r(`transition-colors`,e?`font-medium text-gray-600`:`text-gray-400 hover:text-gray-600`),children:s(`chatSidebarViewProject`)})]})}var xs={telegram:`telegram.svg`,slack:`slack.svg`,discord:`discord.svg`,whatsapp:`whatsapp.svg`,qq:`qq.svg`,feishu:`feishu.svg`,dingtalk:`dingtalk.svg`,wecom:`wecom.svg`,weixin:`weixin.svg`,email:`email.svg`};function Ss(e,t){let n=e[t.toLowerCase()];return n?`/logos/${n}`:null}function Cs(e){return Ss(xs,e)}var ws={wx:`weixin`,lark:`feishu`},Ts={cron:{icon:`cron`}},Es={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function Ds(e){return e?.trim().toLowerCase()??``}function Os(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function ks(e,t){let n=Ds(e);if(!n||n===`native`)return null;let r=t.find(e=>Ds(e.value)===n);return r?.label.trim()?r.label.trim():Os(n)}function As(e,t){let n=Ds(e);return!n||n===`native`?null:t.find(e=>Ds(e.value)===n)??null}function js(e){let t=Ds(e);if(!t)return null;let n=ws[t]??t;return Cs(n)?n:null}function Ms(e,t){let n=js(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=Ts[Ds(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=Ds(e.sessionType),a=As(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 o=Es[i];return o?{icon:null,label:s(o)}:{icon:null,label:a?.label?.trim()||ks(e.sessionType,t)}}var Ns=`app://`;function Ps(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 Fs(e){let t=e.trim();if(!t)return null;if(!t.startsWith(Ns))return t;let n=Ps(t.slice(6));return n?`/${n}`:null}function Is({name:e,src:t,className:n,imgClassName:i,fallback:a}){let[o,s]=(0,F.useState)(!1),c=!!t&&!o;return(0,I.jsx)(`div`,{className:r(`inline-flex shrink-0 items-center justify-center overflow-hidden`,n),children:c?(0,I.jsx)(`img`,{src:t,alt:`${e} logo`,className:r(`block h-6 w-6 object-contain`,i),onError:()=>s(!0),draggable:!1}):a??(0,I.jsx)(`span`,{className:`text-lg font-bold uppercase`,children:e.slice(0,1)})})}function Ls({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,I.jsx)(Rs,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=Fs(e.src);return(0,I.jsx)(Is,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:r(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,I.jsx)(Fn,{className:r(`h-3 w-3 text-gray-500`,t)})})}return(0,I.jsx)(Mn,{className:r(`h-3.5 w-3.5`,t)})}function Rs({channel:e,className:t}){return(0,I.jsx)(Is,{name:e,src:Cs(e),className:r(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,I.jsx)(Fn,{className:`h-3 w-3 text-gray-500`})})}function zs(e){let{option:t,onSelect:n}=e,i=t.ready===!1?t.reasonMessage?.trim()||s(`statusSetup`):null;return(0,I.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,I.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[t.icon?.src?(0,I.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,I.jsx)(Ls,{icon:{kind:`runtime-image`,src:t.icon.src,alt:t.icon.alt??null,name:t.label}})}):(0,I.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-gray-400`,children:(0,I.jsx)(Fn,{className:`h-4 w-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,I.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:t.label}),(0,I.jsxs)(`span`,{className:r(`inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium`,t.ready===!1?`text-amber-700`:`text-emerald-600`),children:[(0,I.jsx)(`span`,{className:r(`h-1.5 w-1.5 rounded-full`,t.ready===!1?`bg-amber-500`:`bg-emerald-500`)}),t.ready===!1?s(`statusSetup`):s(`statusReady`)]})]}),i?(0,I.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:i}):null]})]})})})}function Bs(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function Vs(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,onCreateSession:a}=e,[o,c]=(0,F.useState)(null),l=(0,F.useMemo)(()=>Bs(n,r),[n,r]),u=r.length>1;return(0,I.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>{let t=`${s(`chatSidebarNewTask`)} · ${e.projectName}`;return(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-0.5`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,I.jsx)(`div`,{className:`truncate text-[11px] font-medium uppercase tracking-wider text-gray-500`,title:e.projectRoot,children:e.projectName}),(0,I.jsx)(`span`,{className:`shrink-0 text-[10px] text-gray-400`,children:e.items.length})]}),u?(0,I.jsxs)(Tn,{open:o===e.projectRoot,onOpenChange:t=>{c(t?e.projectRoot:null)},children:[(0,I.jsx)(Cn,{asChild:!0,children:(0,I.jsx)(T,{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,I.jsx)(pn,{className:`h-3.5 w-3.5`})})}),(0,I.jsxs)(xn,{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,I.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:s(`chatSessionTypeLabel`)}),(0,I.jsx)(`div`,{className:`space-y-1`,children:r.map(t=>(0,I.jsx)(zs,{option:t,onSelect:()=>{a(t.value,e.projectRoot),c(null)}},`${e.projectRoot}:${t.value}`))})]})]}):(0,I.jsx)(T,{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,I.jsx)(pn,{className:`h-3.5 w-3.5`})})]}),(0,I.jsx)(`div`,{className:`space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}var Hs=[[`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 Us(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 Ws({agentId:e,displayName:t,avatarUrl:n,className:i}){let a=t?.trim()||e,[o,s]=Hs[Us(e)%Hs.length]??Hs[0];return n?.trim()?(0,I.jsx)(`img`,{src:n,alt:t?.trim()||e,className:r(`rounded-full object-cover`,i)}):(0,I.jsx)(`div`,{className:r(`rounded-full flex items-center justify-center font-semibold`,o,s,i),"aria-label":t?.trim()||e,children:e.trim().toLowerCase()===`main`?(0,I.jsx)(Fn,{className:`h-[55%] w-[55%]`,strokeWidth:2.4}):(a.trim()||`A`).slice(0,1).toUpperCase()})}function Gs({status:e,className:t}){let n=s(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,I.jsxs)(`span`,{className:r(`inline-flex h-3.5 w-3.5 items-center justify-center text-gray-400`,t),title:n,"aria-label":n,children:[(0,I.jsx)(ln,{className:`h-3 w-3 animate-spin`}),(0,I.jsx)(`span`,{className:`sr-only`,children:n})]})}function Ks(e){let t=e.label?.trim();if(t)return t;let n=e.key.split(`:`);return n[n.length-1]||e.key}function qs(e){let t=e.activityPreview;return t?t.state===`failed`||t.state===`running`?t.statusText??t.replyText??null:t.state===`completed`?t.replyText??t.statusText??null:t.statusText??t.replyText??null:null}function Js(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Ys(e,t){return e.getFullYear()===t.getFullYear()}function Xs(e,t){let n=`${e.getMonth()+1}月${e.getDate()}日`;return Ys(e,t)?n:`${e.getFullYear()}年${n}`}function Zs(e,t=d(),n=new Date){if(!e)return`-`;let r=e instanceof Date?e:new Date(e);if(Number.isNaN(r.getTime()))return typeof e==`string`?e:`-`;let i=p(t),a=Js(r),o=Js(n),c=Math.floor((o-a)/864e5);if(c===0)return new Intl.DateTimeFormat(i,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);if(c===1)return s(`chatSidebarYesterday`,t);if(c>1&&c<7)return new Intl.DateTimeFormat(i,{weekday:`long`}).format(r);if(t===`zh`)return Xs(r,n);let l=Ys(r,n)?{month:`numeric`,day:`numeric`}:{year:`numeric`,month:`numeric`,day:`numeric`};return new Intl.DateTimeFormat(i,l).format(r)}function Qs(e){return e.trim().toLowerCase()}function $s(e,t){let n=Qs(t);return n?[e.key,Ks(e),e.projectRoot??``,e.projectName??``].map(Qs).some(e=>e.includes(n)):!0}function ec({session:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(oe,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:s(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-gray-300 bg-white text-xs`,autoFocus:!0,disabled:n}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsx)(`div`,{className:`min-w-0 text-[11px] text-gray-400 truncate`,children:e.key}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(T,{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":s(`save`),children:(0,I.jsx)(Ln,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(T,{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":s(`cancel`),children:(0,I.jsx)(_n,{className:`h-3.5 w-3.5`})})]})]})]})}function tc({session:e,active:t,showUnreadDot:n,runStatus:i,context:a,title:o,agentId:c,agentLabel:l,agentAvatarUrl:u,childSessionCount:d=0,onSelect:f,onOpenChildSessions:p,onStartEditing:m}){let h=d>0&&p?`pr-14`:`pr-6`,g=qs(e),_=`${l?.trim()?`${l} · `:``}${e.messageCount}`;return(0,I.jsxs)(`div`,{className:`group/session relative`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:f,className:`w-full text-left`,children:[(0,I.jsx)(`div`,{className:r(`flex min-w-0 items-start`,h),children:(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[c?.trim()&&c.trim().toLowerCase()!==`main`?(0,I.jsx)(Ws,{agentId:c,displayName:l,avatarUrl:u,className:`h-5 w-5 shrink-0`}):null,(0,I.jsx)(`span`,{className:`truncate font-medium`,children:o}),a.label?(0,I.jsx)(`span`,{className:r(`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:a.label}):null,a.icon?(0,I.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center`,children:(0,I.jsx)(Ls,{icon:a.icon,className:t?`text-gray-700`:`text-gray-500`})}):null]})}),(0,I.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-gray-400`,children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:g??_}),n?(0,I.jsx)(`span`,{"aria-label":s(`chatSessionUnread`),className:`ml-auto h-2 w-2 shrink-0 rounded-full bg-primary`}):(0,I.jsx)(`span`,{className:`ml-auto shrink-0`,children:Zs(e.lastMessageAt??e.createdAt)})]})]}),d>0&&p?(0,I.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),p()},className:r(`absolute right-6 top-0 inline-flex h-5 items-center gap-1 rounded-md 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":s(`chatSessionOpenChildSessions`),title:s(`chatSessionOpenChildSessions`),children:[(0,I.jsx)(or,{className:`h-3.5 w-3.5`}),(0,I.jsx)(`span`,{children:d})]}):null,i?(0,I.jsx)(`span`,{className:`absolute right-0 top-0 inline-flex h-5 w-5 items-center justify-center transition-opacity group-hover/session:opacity-0 group-focus-within/session:opacity-0`,children:(0,I.jsx)(Gs,{status:i})}):null,(0,I.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:r(`absolute right-0 top-0 inline-flex h-5 w-5 items-center justify-center rounded-md text-gray-400 transition-all hover:bg-white hover:text-gray-900`,`opacity-0 group-hover/session:opacity-100 group-focus-within/session:opacity-100`),"aria-label":s(`edit`),children:(0,I.jsx)(gr,{className:`h-3 w-3`})})]})}function nc({session:e,active:t,showUnreadDot:n,runStatus:i,context:a,title:o,agentId:s,agentLabel:c,agentAvatarUrl:l,childSessionCount:u,isEditing:d,draftLabel:f,isSaving:p,onSelect:m,onOpenChildSessions:h,onStartEditing:g,onDraftLabelChange:_,onSave:v,onCancel:y}){return(0,I.jsx)(`div`,{className:r(`w-full rounded-xl px-3 py-2.5 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,I.jsx)(ec,{session:e,draftLabel:f,isSaving:p,onDraftLabelChange:_,onSave:v,onCancel:y}):(0,I.jsx)(tc,{session:e,active:t,showUnreadDot:n,runStatus:i,context:a,title:o,agentId:s,agentLabel:c,agentAvatarUrl:l,onSelect:m,childSessionCount:u,onOpenChildSessions:h,onStartEditing:g})})}var rc=[{icon:ur,titleKey:`chatWelcomeCapability1Title`,descKey:`chatWelcomeCapability1Desc`},{icon:rt,titleKey:`chatWelcomeCapability2Title`,descKey:`chatWelcomeCapability2Desc`},{icon:Mn,titleKey:`chatWelcomeCapability3Title`,descKey:`chatWelcomeCapability3Desc`}];function ic({onCreateSession:e,agents:t,selectedAgentId:n,onSelectAgent:r}){let i=t.find(e=>e.id===n)??null;return(0,I.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,I.jsxs)(`div`,{className:`max-w-lg w-full text-center`,children:[(0,I.jsx)(`div`,{className:`mx-auto mb-6 h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center`,children:(0,I.jsx)(Fn,{className:`h-8 w-8 text-primary`})}),(0,I.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900 mb-2`,children:s(`chatWelcomeTitle`)}),(0,I.jsx)(`p`,{className:`text-sm text-gray-500 mb-8`,children:s(`chatWelcomeSubtitle`)}),(0,I.jsxs)(`div`,{className:`mb-6 flex items-center justify-center gap-2.5`,children:[(0,I.jsx)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:s(`chatDraftAgentTitle`)}),(0,I.jsxs)(yo,{value:n,onValueChange:r,children:[(0,I.jsxs)(xo,{"aria-label":s(`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,I.jsx)(`span`,{className:`sr-only`,children:s(`chatDraftAgentTitle`)}),(0,I.jsx)(`div`,{className:`flex items-center gap-1.5`,children:i?(0,I.jsx)(Ws,{agentId:i.id,displayName:i.displayName,avatarUrl:i.avatarUrl,className:`h-7 w-7 shrink-0`}):null})]}),(0,I.jsx)(wo,{className:`rounded-xl border-gray-200/80 shadow-lg`,children:t.map(e=>(0,I.jsx)(Eo,{value:e.id,className:`rounded-lg pr-10`,children:(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsx)(Ws,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,I.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-700`,children:e.displayName?.trim()||e.id})]})},e.id))})]})]}),(0,I.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:rc.map(t=>{let n=t.icon;return(0,I.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,I.jsx)(`div`,{className:`h-9 w-9 rounded-xl bg-primary/8 flex items-center justify-center mb-3`,children:(0,I.jsx)(n,{className:`h-4.5 w-4.5 text-primary`})}),(0,I.jsx)(`div`,{className:`text-sm font-semibold text-gray-900 mb-1`,children:s(t.titleKey)}),(0,I.jsx)(`div`,{className:`text-[11px] text-gray-500 leading-relaxed`,children:s(t.descKey)})]},t.titleKey)})})]})})}var ac=(0,F.createContext)(null);function oc({presenter:e,children:t}){return(0,I.jsx)(ac.Provider,{value:e,children:t})}function sc(){let e=(0,F.useContext)(ac);if(!e)throw Error(`usePresenter must be used inside ChatPresenterProvider`);return e}var cc=e=>`[data-item-index="${e}"]`;function lc(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??cc;(0,F.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 uc(){let e=(0,F.useRef)(null),[t,n]=(0,F.useState)(null);return(0,F.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 L(...e){return i(f(e))}var dc=F.forwardRef(({className:e,type:t,...n},r)=>(0,I.jsx)(`input`,{type:t,className:L(`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}));dc.displayName=`ChatInput`;var fc=wn,pc=yn,mc=bn,hc=F.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,...r},i)=>(0,I.jsx)(Sn,{children:(0,I.jsx)(vn,{ref:i,sideOffset:t,align:n,className:L(`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})}));hc.displayName=vn.displayName;var gc=ro,_c=uo,vc=ao,yc=F.forwardRef(({className:e,children:t,...n},r)=>(0,I.jsxs)(io,{ref:r,className:L(`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,I.jsx)(oo,{asChild:!0,children:(0,I.jsx)(Rn,{className:`h-4 w-4 opacity-50`})})]}));yc.displayName=io.displayName;var bc=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(go,{ref:n,className:L(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(Bn,{className:`h-4 w-4`})}));bc.displayName=go.displayName;var xc=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(_o,{ref:n,className:L(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(Rn,{className:`h-4 w-4`})}));xc.displayName=_o.displayName;var Sc=F.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,I.jsx)(so,{children:(0,I.jsxs)(co,{ref:i,className:L(`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,I.jsx)(bc,{}),(0,I.jsx)(lo,{className:L(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,I.jsx)(xc,{})]})}));Sc.displayName=co.displayName;var Cc=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(fo,{ref:n,className:L(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-gray-500`,e),...t}));Cc.displayName=fo.displayName;var wc=F.forwardRef(({className:e,children:t,...n},r)=>(0,I.jsxs)(po,{ref:r,className:L(`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,I.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,I.jsx)(ho,{children:(0,I.jsx)(Ln,{className:`h-4 w-4`})})}),(0,I.jsx)(mo,{children:t})]}));wc.displayName=po.displayName;var Tc=F.forwardRef(({className:e,...t},n)=>(0,I.jsx)(vo,{ref:n,className:L(`-mx-1 my-1 h-px bg-gray-100`,e),...t}));Tc.displayName=vo.displayName;var Ec=gt,Dc=ht,Oc=ut,kc=F.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,I.jsx)(bt,{children:(0,I.jsx)(Ct,{ref:r,sideOffset:t,className:L(`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})}));kc.displayName=Ct.displayName;var Ac={Popover:fc,PopoverAnchor:mc,PopoverContent:hc,PopoverTrigger:pc,Input:dc,Select:gc,SelectContent:Sc,SelectGroup:_c,SelectItem:wc,SelectLabel:Cc,SelectSeparator:Tc,SelectTrigger:yc,SelectValue:vc,Tooltip:Dc,TooltipContent:kc,TooltipProvider:Ec,TooltipTrigger:Oc},jc=680,Mc=.82,Nc=560;function Pc(e){let{Popover:t,PopoverAnchor:n,PopoverContent:r}=Ac,{elementRef:i,width:a}=uc(),o=(0,F.useRef)(null),{isOpen:s,isLoading:c,items:l,activeIndex:u,activeItem:d,texts:f,onSelectItem:p,onOpenChange:m,onDetailsPointerDown:h,onSetActiveIndex:g}=e,_=(0,F.useMemo)(()=>{if(a)return Math.min(a>Nc?a*Mc:a,jc)},[a]);return lc({containerRef:o,activeIndex:u,itemCount:l.length,isEnabled:s&&!c,getItemSelector:e=>`[data-slash-index="${e}"]`}),(0,I.jsxs)(t,{open:s,onOpenChange:m,children:[(0,I.jsx)(n,{asChild:!0,children:(0,I.jsx)(`div`,{ref:i,className:`pointer-events-none absolute bottom-full left-3 right-3 h-0`})}),(0,I.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:_?{width:`${_}px`}:void 0,children:(0,I.jsxs)(`div`,{className:`grid min-h-[240px] grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,I.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,I.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:f.slashLoadingLabel}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`mb-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:f.slashSectionLabel}),l.length===0?(0,I.jsx)(`div`,{className:`px-2 text-xs text-gray-400`,children:f.slashEmptyLabel}):(0,I.jsx)(`div`,{className:`space-y-1`,children:l.map((e,t)=>{let n=t===u;return(0,I.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,"data-slash-index":t,onMouseEnter:()=>g(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,I.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.title}),(0,I.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:e.subtitle})]},e.key)})})]})}),(0,I.jsx)(`div`,{className:`min-w-0 p-2.5`,onPointerDown:h,children:d?(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.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,I.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:d.title})]}),(0,I.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:d.description}),(0,I.jsx)(`div`,{className:`space-y-1`,children:d.detailLines.map(e=>(0,I.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,I.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:f.slashSkillHintLabel})]}):(0,I.jsx)(`div`,{className:`text-xs text-gray-500`,children:f.slashHintLabel})})]})})]})}var Fc=k(`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`}}),Ic=F.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,I.jsx)(`button`,{className:L(Fc({variant:t,size:n,className:e})),ref:i,...r}));Ic.displayName=`ChatButton`;var Lc=120;function Rc(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=Lc?t:`${t.slice(0,Lc-1)}…`}function zc(){return(0,I.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 Bc({contextWindow:e}){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=Ac,a=Math.max(0,Math.min(1,e.ratio)),o=Math.round(a*360);return(0,I.jsx)(r,{delayDuration:0,children:(0,I.jsxs)(t,{children:[(0,I.jsx)(i,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700`,"aria-label":e.label,title:e.label,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[7px] rounded-full`,style:{background:`conic-gradient(#9ca3af ${o}deg, #e5e7eb 0deg)`}}),(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[10px] rounded-full bg-white`})]})}),(0,I.jsx)(n,{side:`top`,className:`max-w-[18rem]`,children:(0,I.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-5 font-semibold text-gray-800`,children:[(0,I.jsx)(`span`,{children:e.label}),(0,I.jsx)(`span`,{children:e.percentLabel})]}),e.details.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-5 text-gray-600`,children:[(0,I.jsx)(`span`,{children:e.label}),(0,I.jsx)(`span`,{className:`font-medium text-gray-800`,children:e.value})]},e.label))]})})]})})}function Vc({sendError:e,sendErrorDetailsLabel:t,isSending:n,canStopGeneration:r,sendDisabled:i,stopDisabled:a,stopHint:o,sendButtonLabel:s,stopButtonLabel:c,contextWindow:l,onSend:u,onStop:d}){let{Popover:f,PopoverContent:p,PopoverTrigger:m,Tooltip:h,TooltipContent:g,TooltipProvider:_,TooltipTrigger:v}=Ac,y=e?.trim()??``,b=y?Rc(y):``,x=t?.trim()||`Details`;return(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[y?(0,I.jsxs)(`div`,{className:`flex max-w-[420px] items-start justify-end gap-2 text-right`,children:[(0,I.jsx)(`div`,{className:`min-w-0 flex-1 text-[11px] text-red-600`,children:(0,I.jsx)(`span`,{className:`block truncate`,title:y,children:b})}),(0,I.jsxs)(f,{children:[(0,I.jsx)(m,{asChild:!0,children:(0,I.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:x})}),(0,I.jsxs)(p,{align:`end`,className:`w-[min(32rem,calc(100vw-1.5rem))] border-red-100/80 p-0`,children:[(0,I.jsx)(`div`,{className:`border-b border-red-100 bg-red-50/80 px-4 py-2 text-xs font-semibold text-red-700`,children:x}),(0,I.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:y})]})]})]}):null,(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,I.jsx)(Bc,{contextWindow:l}):null,n?r?(0,I.jsx)(Ic,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,onClick:()=>void d(),disabled:a,children:(0,I.jsx)(zc,{})}):(0,I.jsx)(_,{children:(0,I.jsxs)(h,{children:[(0,I.jsx)(v,{asChild:!0,children:(0,I.jsx)(`span`,{children:(0,I.jsx)(Ic,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":c,disabled:!0,children:(0,I.jsx)(zc,{})})})}),(0,I.jsx)(g,{side:`top`,children:(0,I.jsx)(`p`,{className:`text-xs`,children:o})})]})}):(0,I.jsx)(Ic,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void u(),disabled:i,children:(0,I.jsx)(Pn,{className:`h-5 w-5`})})]})]})}function Hc(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 Uc(e){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i}=Ac,{picker:a}=e,o=(0,F.useRef)(null),s=(0,F.useId)(),[c,l]=(0,F.useState)(``),[u,d]=(0,F.useState)(0),f=(0,F.useMemo)(()=>new Set(a.selectedKeys),[a.selectedKeys]),p=a.selectedKeys.length,m=c.trim().length>0,h=(0,F.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,F.useMemo)(()=>h?h.flatMap(e=>e.options):Hc(a.options,c),[h,a.options,c]);(0,F.useEffect)(()=>{d(0)},[c]),(0,F.useEffect)(()=>{d(e=>g.length===0?0:Math.min(e,g.length-1))},[g.length]),lc({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,I.jsxs)(n,{children:[(0,I.jsx)(i,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-label":a.title,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg px-0 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 sm:w-auto sm:gap-1.5 sm:px-3`,children:[(0,I.jsx)(rt,{className:`h-4 w-4`}),(0,I.jsx)(`span`,{className:`hidden sm:inline`,children:a.title}),p>0?(0,I.jsx)(`span`,{className:`absolute -right-1 -top-1 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-none text-white shadow-sm sm:static sm:ml-0.5 sm:bg-primary/10 sm:text-primary sm:shadow-none`,children:p}):null]})}),(0,I.jsxs)(r,{side:`top`,align:`start`,className:`w-[360px] p-0`,children:[(0,I.jsxs)(`div`,{className:`space-y-2 border-b border-gray-100 px-4 py-3`,children:[(0,I.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:a.title}),(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(hn,{className:`pointer-events-none absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400`}),(0,I.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,I.jsx)(`div`,{ref:o,id:s,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar max-h-[320px] overflow-y-auto`,children:a.isLoading?(0,I.jsx)(`div`,{className:`p-4 text-xs text-gray-500`,children:a.loadingLabel}):g.length===0?(0,I.jsx)(`div`,{className:`p-4 text-center text-xs text-gray-500`,children:a.emptyLabel}):(0,I.jsx)(`div`,{className:`py-1`,children:(()=>{let e=h??[{key:`all-skills`,options:g}],t=0;return e.map(e=>(0,I.jsxs)(`div`,{children:[e.label?(0,I.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,I.jsxs)(`div`,{id:`${s}-option-${n}`,role:`option`,"aria-selected":r,"data-skill-index":n,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,I.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:(0,I.jsx)(_r,{className:`h-4 w-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 select-text`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(`span`,{className:`truncate text-sm text-gray-900`,children:e.label}),e.badgeLabel?(0,I.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,I.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-gray-500`,children:e.description||e.key})]}),(0,I.jsx)(`div`,{className:`ml-3 shrink-0`,children:(0,I.jsx)(`button`,{type:`button`,"aria-label":`${r?`Remove`:`Add`} ${e.label}`,onClick:()=>_(e.key),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,I.jsx)(Ln,{className:`h-3 w-3`}):null})})]},e.key)})]},e.key))})()})}),a.manageHref&&a.manageLabel?(0,I.jsx)(`div`,{className:`border-t border-gray-100 px-4 py-2.5`,children:(0,I.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,I.jsx)(dn,{className:`h-3 w-3`})]})}):null]})]})}function Wc({icon:e}){return e===`sparkles`?(0,I.jsx)(xr,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e===`brain`?(0,I.jsx)(In,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}):null}function Gc({icon:e}){return e===`paperclip`?(0,I.jsx)(hr,{className:`h-4 w-4`}):(0,I.jsx)(Wc,{icon:e})}var Kc={model:`min-w-0 flex-1 sm:min-w-[220px] sm:flex-none`,"session-type":`shrink-0`,thinking:`shrink-0`},qc={model:`w-[min(18rem,calc(100vw-1rem))] sm:w-[320px]`,"session-type":`w-[220px]`,thinking:`w-[180px]`};function Jc(e){return e.key===`model`&&e.selectedLabel&&e.selectedLabel.split(`/`).slice(1).join(`/`).trim()||e.selectedLabel}function Yc({item:e}){let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=Ac,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),d=Jc(e);return(0,I.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,I.jsx)(s,{className:`h-8 w-auto rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-gray-600 shadow-none hover:bg-gray-100 focus:ring-0 sm:px-3 ${Kc[e.key]??``}`,children:e.selectedLabel?(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,I.jsx)(Wc,{icon:e.icon}),(0,I.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-700 sm:hidden`,children:d}),(0,I.jsx)(`span`,{className:`hidden truncate text-xs font-semibold text-gray-700 sm:inline`,children:e.selectedLabel})]}):e.loading?(0,I.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-gray-200`}):(0,I.jsx)(c,{placeholder:e.placeholder})}),(0,I.jsxs)(n,{className:qc[e.key]??``,children:[u?null:e.loading?(0,I.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,I.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-gray-200`}),(0,I.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,I.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-gray-200`})]}):e.emptyLabel?(0,I.jsx)(`div`,{className:`px-3 py-2 text-xs text-gray-500`,children:e.emptyLabel}):null,l.map((e,t)=>(0,I.jsxs)(`div`,{children:[t>0?(0,I.jsx)(o,{}):null,(0,I.jsxs)(r,{children:[e.label?(0,I.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,I.jsx)(i,{value:e.value,className:`py-2`,children:e.description?(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label}),(0,I.jsx)(`span`,{className:`truncate text-[11px] text-gray-500`,children:e.description})]}):(0,I.jsx)(`span`,{className:`truncate text-xs font-semibold text-gray-800`,children:e.label})},e.value))]})]},e.key))]})]})}function Xc({actions:e,accessories:t,selects:n,skillPicker:r}){let{Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=Ac;return(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 pb-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-hidden`,children:[r?(0,I.jsx)(Uc,{picker:r}):null,n.map(e=>(0,I.jsx)(Yc,{item:e},e.key)),t?.map(e=>{let t=(0,I.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,I.jsx)(Gc,{icon:e.icon}),e.iconOnly?null:(0,I.jsx)(`span`,{children:e.label})]});return e.tooltip?(0,I.jsx)(o,{children:(0,I.jsxs)(i,{children:[(0,I.jsx)(s,{asChild:!0,children:e.disabled?(0,I.jsx)(`span`,{className:`inline-flex`,children:t}):t}),(0,I.jsx)(a,{side:`top`,children:(0,I.jsx)(`p`,{className:`text-xs`,children:e.tooltip})})]})},e.key):(0,I.jsx)(`div`,{children:t},e.key)})]}),(0,I.jsx)(Vc,{...e})]})}var Zc=(0,F.createContext)(null);function Qc(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function $c(){let e=(0,F.useContext)(Zc);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 R(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 el(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 tl=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,nl=tl&&`documentMode`in document?document.documentMode:null,rl=tl&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),il=tl&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),al=!(!tl||!(`InputEvent`in window)||nl)&&`getTargetRanges`in new window.InputEvent(`input`),ol=tl&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,sl=tl&&/Android/.test(navigator.userAgent),cl=tl&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!sl,ll=tl&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ul=tl&&sl&&ll,dl=tl&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&rl&&!ll,fl=0,pl=1,ml=2,hl=1,gl=2,_l=3,vl=4,yl=5,bl=6,xl=cl||ol||dl?`\xA0`:`​`,Sl=`
4
+
5
+ `,Cl=il?`\xA0`:xl,wl={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Tl={directionless:1,unmergeable:2},El={center:2,end:6,justify:4,left:1,right:3,start:5},Dl={[gl]:`center`,[bl]:`end`,[vl]:`justify`,[hl]:`left`,[_l]:`right`,[yl]:`start`},Ol={normal:0,segmented:2,token:1},kl={[fl]:`normal`,[ml]:`segmented`,[pl]:`token`},Al=`$config`;function jl(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(U(o)&&jl(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var Ml=!1,Nl=0;function Pl(e){Nl=e.timeStamp}function Fl(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Nm(e,n)!==void 0}function Il(e,t,n){let r=Sh(mh(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&Km(t,o,i,a,!1)}function Ll(e,t,n){if(V(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Sm(t)&&n.isAttached()}function Rl(e,t,n,r){for(let i=e;i&&!Lh(i);i=ch(i)){let e=Nm(i,t);if(e!==void 0){let t=jm(e,n);if(t)return Up(t)||!wh(i)?void 0:[i,t]}else if(i===r)return[r,Rm(n)]}}function zl(e,t,n){Ml=!0;let r=performance.now()-Nl>100;try{Lp(e,()=>{let i=H()||function(e){return e.getEditorState().read(()=>{let e=H();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=Rl(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&B(g)&&Sm(p)&&Ll(i,p,g)&&Il(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=Mm(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!Fl(r,a,e)){if(il){let e=(wh(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];(Fl(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`||Fl(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&zm(i),il&&oh(e)&&i.insertRawText(u))})}finally{Ml=!1}}function Bl(e){let t=e._observer;t!==null&&zl(e,t.takeRecords(),t)}function Vl(e){(function(e){Nl===0&&mh(e).addEventListener(`textInput`,Pl,!0)})(e),e._observer=new MutationObserver((t,n)=>{zl(e,t,n)})}var Hl=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Yl).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Ul(e,t){return new Hl(e,t)}function Wl(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}=zh(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 Gl=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 Jl(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=Jl(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 Kl(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Gl(t,ql(t));return t.__state=n,n}function ql(e){return e.__state?e.__state.sharedNodeState:dm(Ah(),e.getType()).sharedNodeState}function Jl(e){if(e)for(let t in e)return e}function Yl(e){return e}function Xl(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 Zl(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 Ql(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function $l(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&&Xl(n,e,t)||t&&Xl(n,t,e)||e&&Zl(n,e,t)||t&&Zl(n,t,e))}(c,l))}function eu(e,t){let n=e.mergeWithSibling(t),r=wp()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function tu(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&B(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if($l(t,r)){r=eu(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&B(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if($l(r,n)){r=eu(r,n);break}break}n.remove()}}else r.remove()}function nu(e){return ru(e.anchor),ru(e.focus),e}function ru(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),B(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!U(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var iu,au,ou,su,cu,lu,uu,du,fu,pu,mu=``,hu=null,gu=null,_u=!1,vu=!1;function yu(e,t){let n=uu.get(e);if(t!==null){let n=Lu(e);n.parentNode===t&&t.removeChild(n)}if(du.has(e)||au._keyToDOMMap.delete(e),U(n)){let e=ju(n,uu);bu(e,0,e.length-1,null)}n!==void 0&&rh(pu,ou,su,n,`destroyed`)}function bu(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&yu(t,r)}}function xu(e,t){e.setProperty(`text-align`,t)}var Su=`40px`;function Cu(e,t){let n=iu.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(au._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||Su;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function wu(e,t){let n=e.style;t===0?xu(n,``):t===1?xu(n,`left`):t===2?xu(n,`center`):t===3?xu(n,`right`):t===4?xu(n,`justify`):t===5?xu(n,`start`):t===6&&xu(n,`end`)}function Tu(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(Gp(e))return null;let n=e.getParentOrThrow();return Gp(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function Eu(e,t){let n=du.get(e);n===void 0&&R(60);let r=n.createDOM(iu,au);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,au),B(n)?r.setAttribute(`data-lexical-text`,`true`):Up(n)&&r.setAttribute(`data-lexical-decorator`,`true`),U(n)){let e=n.__indent,t=n.__size;if(Tu(r,n),e!==0&&Cu(r,e),t!==0){let e=t-1;Du(ju(n,du),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&wu(r,i),n.isInline()||ku(null,n,r)}else{let t=n.getTextContent();if(Up(n)){let t=n.decorate(au,iu);t!==null&&Nu(e,t),r.contentEditable=`false`}mu+=t}return t!==null&&t.insertChild(r),rh(pu,ou,su,n,`created`),r}function Du(e,t,n,r,i){let a=mu;mu=``;let o=n;for(;o<=r;++o){Eu(e[o],i);let t=du.get(e[o]);t!==null&&B(t)?hu===null&&(hu=t.getFormat(),gu=t.getStyle()):U(t)&&o<r&&!t.isInline()&&(mu+=Sl)}i.element.__lexicalTextContent=mu,mu=a+mu}function Ou(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return hf(e)?`line-break`:Up(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function ku(e,t,n){let r=Ou(e,uu),i=Ou(t,du);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function Au(e,t,n){var r;hu=null,gu=null,function(e,t,n){let r=mu,i=e.__size,a=t.__size;mu=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)Mu(n,o);else{let e=Lu(n),t=Eu(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}yu(n,null)}let i=du.get(r);B(i)&&hu===null&&(hu=i.getFormat(),gu=i.getStyle())}else{let r=ju(e,uu),s=ju(t,du);if(r.length!==i&&R(227),s.length!==a&&R(228),i===0)a!==0&&Du(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;bu(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=Pu(Mu(r,a.element)),d++,f++;else{if(l===void 0&&(l=Fu(n,f)),c===void 0)c=Fu(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=Pu(Lu(e)),yu(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=sh(au,r);e!==u&&a.withBefore(u).insertChild(e),u=Pu(Mu(r,a.element)),d++,f++}else Eu(r,a.withBefore(u)),f++}let i=du.get(r);i!==null&&B(i)?hu===null&&(hu=i.getFormat(),gu=i.getStyle()):U(i)&&f<=s&&!i.isInline()&&(mu+=Sl)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:au.getElementByKey(e);Du(n,0,f,s,a.withBefore(t))}else m&&!p&&bu(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=mu,mu=r+mu}(e,t,t.getDOMSlot(n)),r=t,hu==null||hu===r.__textFormat||vu||r.setTextFormat(hu),function(e){gu==null||gu===e.__textStyle||vu||e.setTextStyle(gu)}(t)}function ju(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&R(101),n.push(r),r=e.__next}return n}function Mu(e,t){let n=uu.get(e),r=du.get(e);n!==void 0&&r!==void 0||R(61);let i=_u||lu.has(e)||cu.has(e),a=sh(au,e);if(n===r&&!i){let e;if(U(n)){let t=a.__lexicalTextContent;typeof t==`string`?e=t:(e=n.getTextContent(),a.__lexicalTextContent=e)}else e=n.getTextContent();return mu+=e,a}if(n!==r&&i&&rh(pu,ou,su,r,`updated`),r.updateDOM(n,a,iu)){let n=Eu(e,null);return t===null&&R(62),t.replaceChild(n,a),yu(e,null),n}if(U(n)){U(r)||R(334,e);let t=r.__indent;(_u||t!==n.__indent)&&Cu(a,t);let o=r.__format;if((_u||o!==n.__format)&&wu(a,o),i)Au(n,r,a),Gp(r)||r.isInline()||ku(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),mu+=t}if((_u||r.__dir!==n.__dir)&&(Tu(a,r),Gp(r)&&!_u))for(let e of r.getChildren())U(e)&&Tu(sh(au,e.getKey()),e)}else{let t=r.getTextContent();if(Up(r)){let t=r.decorate(au,iu);t!==null&&Nu(e,t)}mu+=t}if(!vu&&Gp(r)&&r.__cachedText!==mu){let e=r.getWritable();e.__cachedText=mu,r=e}return a}function Nu(e,t){let n=au._pendingDecorators,r=au._decorators;if(n===null){if(r[e]===t)return;n=Fm(au)}n[e]=t}function Pu(e){let t=e.nextSibling;return t!==null&&t===au._blockCursorElement&&(t=t.nextSibling),t}function Fu(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function Iu(e,t,n,r,i,a){mu=``,_u=r===2,au=n,iu=n._config,ou=n._nodes,su=au._listeners.mutation,cu=i,lu=a,uu=e._nodeMap,du=t._nodeMap,vu=t._readOnly,fu=new Map(n._keyToDOMMap);let o=new Map;return pu=o,Mu(`root`,null),au=void 0,ou=void 0,cu=void 0,lu=void 0,uu=void 0,du=void 0,iu=void 0,fu=void 0,pu=void 0,o}function Lu(e){let t=fu.get(e);return t===void 0&&R(75,e),t}function z(e){return{type:e}}var Ru=z(`SELECTION_CHANGE_COMMAND`),zu=z(`CLICK_COMMAND`),Bu=z(`BEFORE_INPUT_COMMAND`),Vu=z(`INPUT_COMMAND`),Hu=z(`COMPOSITION_START_COMMAND`),Uu=z(`COMPOSITION_END_COMMAND`),Wu=z(`DELETE_CHARACTER_COMMAND`),Gu=z(`INSERT_LINE_BREAK_COMMAND`),Ku=z(`INSERT_PARAGRAPH_COMMAND`),qu=z(`CONTROLLED_TEXT_INSERTION_COMMAND`),Ju=z(`PASTE_COMMAND`),Yu=z(`REMOVE_TEXT_COMMAND`),Xu=z(`DELETE_WORD_COMMAND`),Zu=z(`DELETE_LINE_COMMAND`),Qu=z(`FORMAT_TEXT_COMMAND`),$u=z(`UNDO_COMMAND`),ed=z(`REDO_COMMAND`),td=z(`KEYDOWN_COMMAND`),nd=z(`KEY_ARROW_RIGHT_COMMAND`),rd=z(`MOVE_TO_END`),id=z(`KEY_ARROW_LEFT_COMMAND`),ad=z(`MOVE_TO_START`),od=z(`KEY_ARROW_UP_COMMAND`),sd=z(`KEY_ARROW_DOWN_COMMAND`),cd=z(`KEY_ENTER_COMMAND`),ld=z(`KEY_SPACE_COMMAND`),ud=z(`KEY_BACKSPACE_COMMAND`),dd=z(`KEY_ESCAPE_COMMAND`),fd=z(`KEY_DELETE_COMMAND`),pd=z(`KEY_TAB_COMMAND`),md=z(`DROP_COMMAND`),hd=z(`DRAGSTART_COMMAND`),gd=z(`DRAGOVER_COMMAND`),_d=z(`DRAGEND_COMMAND`),vd=z(`COPY_COMMAND`),yd=z(`CUT_COMMAND`),bd=z(`SELECT_ALL_COMMAND`),xd=z(`FOCUS_COMMAND`),Sd=z(`BLUR_COMMAND`),Cd=z(`KEY_MODIFIER_COMMAND`),wd=Object.freeze({}),Td=[[`keydown`,function(e,t){Ed=e.timeStamp,Dd=e.key,!t.isComposing()&&W(t,td,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;Th(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&Lp(t,()=>{mm(n)||(Nd=!0)})}],[`compositionstart`,function(e,t){W(t,Hu,e)}],[`compositionend`,function(e,t){il?Fd=!0:ol||!cl&&!dl?W(t,Uu,e):(Id=!0,Ld=e.data)}],[`input`,function(e,t){e.stopPropagation(),Lp(t,()=>{t.dispatchCommand(Vu,e)},{event:e}),kd=null}],[`click`,function(e,t){Lp(t,()=>{let n=H(),r=Sh(mh(t)),i=rp();if(r){if(V(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!Gp(a)&&Lm().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=Vh(a,e=>U(e)&&!e.isInline());U(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(wh(n)||Sm(n))&&zm(np(i,r,t,e))}}W(t,zu,e)})}],[`cut`,wd],[`copy`,wd],[`dragstart`,wd],[`dragover`,wd],[`dragend`,wd],[`paste`,wd],[`focus`,wd],[`blur`,wd],[`drop`,wd]];al&&Td.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||il&&oh(t)||n!==`insertCompositionText`&&W(t,Bu,e)}(e,t)]);var Ed=0,Dd=null,Od=0,kd=null,Ad=new WeakMap,jd=new WeakMap,Md=!1,Nd=!1,Pd=!1,Fd=!1,Id=!1,Ld=``,Rd=null,zd=[0,``,0,`root`,0];function Bd(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=wp(),l=Sh(mh(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!B(s)||(!i&&(!al||Od<r+50)||s.isDirty()&&p<2||Vm(n))&&a.offset!==o.offset&&!s.isComposing()||xm(s)||s.isDirty()&&p>1||(i||!al)&&f!==null&&!s.isComposing()&&u!==wm(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=bm(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(B(t)||U(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function Vd(e,t){return Sm(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Hd(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;Md&&(Md=!1,Vd(r,i)&&Vd(a,o)&&!Rd)||Lp(t,()=>{if(!n)return void zm(null);if(!gm(t,r,a))return;let s=H();if(Rd&&V(s)&&s.isCollapsed()){let e=s.anchor,t=Rd.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=Rd.clone(),zm(s))}if(Rd=null,V(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=mh(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=zd,f=Lm(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)Ud(s,o,c);else if(n.type===`text`)B(r)||R(141),Wd(s,r);else if(n.type===`element`&&!p){U(r)||R(259);let e=n.getNode();e.isEmpty()?function(e,t){Ud(e,t.getTextFormat(),t.getTextStyle())}(s,e):Ud(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(B(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}}W(t,Ru,void 0)})}function Ud(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Wd(e,t){Ud(e,t.getFormat(),t.getStyle())}function Gd(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Kd(e){let t=e.inputType,n=Gd(e),r=wp(),i=H();if(t===`deleteContentBackward`){if(i===null){let e=rp();if(!V(e))return!0;zm(e.clone())}if(V(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,Dd===`MediaLast`&&a<Ed+30&&r.isComposing()&&t){if(km(null),Ed=0,setTimeout(()=>{Lp(r,()=>{km(null)})},30),V(i)){let e=i.anchor.getNode();e.markDirty(),B(e)||R(142),Wd(i,e)}}else{km(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=ul&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!Up(ah(i.anchor,!0))),!c){W(r,Wu,!0);let e=H();ul&&V(e)&&e.isCollapsed()&&(Rd=e,setTimeout(()=>Rd=null))}}return!0}}var a;if(!V(i))return!0;let o=e.data;kd!==null&&Gm(!1,r,kd),i.dirty&&kd===null||!i.isCollapsed()||Gp(i.anchor.getNode())||n===null||i.applyDOMRange(n),kd=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
6
+ `)e.preventDefault(),W(r,Gu,!1);else if(o===Sl)e.preventDefault(),W(r,Ku,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&Bd(i,n,o,e.timeStamp,!0)?(e.preventDefault(),W(r,qu,o)):kd=o;return Od=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:W(r,qu,e);break;case`insertFromComposition`:km(null),W(r,qu,e);break;case`insertLineBreak`:km(null),W(r,Gu,!1);break;case`insertParagraph`:km(null),Pd&&!ol?(Pd=!1,W(r,Gu,!1)):W(r,Ku,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:W(r,Ju,e);break;case`deleteByComposition`:(function(e,t){return e!==t||U(e)||U(t)||!bm(e)||!bm(t)})(l,u)&&W(r,Yu,e);break;case`deleteByDrag`:case`deleteByCut`:W(r,Yu,e);break;case`deleteContent`:W(r,Wu,!1);break;case`deleteWordBackward`:W(r,Xu,!0);break;case`deleteWordForward`:W(r,Xu,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:W(r,Zu,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:W(r,Zu,!1);break;case`formatStrikeThrough`:W(r,Qu,`strikethrough`);break;case`formatBold`:W(r,Qu,`bold`);break;case`formatItalic`:W(r,Qu,`italic`);break;case`formatUnderline`:W(r,Qu,`underline`);break;case`historyUndo`:W(r,$u,void 0);break;case`historyRedo`:W(r,ed,void 0)}return!0}function qd(e){if(wh(e.target)&&mm(e.target))return!0;let t=wp(),n=H(),r=e.data,i=Gd(e);if(r!=null&&V(n)&&Bd(n,i,r,e.timeStamp,!1)){Fd&&=(Xd(t,r),!1);let i=n.anchor.getNode(),a=Sh(mh(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;al&&!n.isCollapsed()&&B(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===Wm(a.anchorNode)||W(t,qu,r);let l=r.length;il&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),ul&&t.isComposing()&&(Ed=0,km(null))}else Gm(!1,t,r===null?void 0:r),Fd&&=(Xd(t,r||void 0),!1);return function(){xp(),Bl(wp())}(),!0}function Jd(e){let t=wp(),n=H();if(V(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();km(r.key),uh(uf),(e.timeStamp<Ed+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||B(i)&&i.getStyle()!==n.style)&&W(t,qu,Cl)}return!0}function Yd(e){return Xd(wp(),e.data),uh(df),!0}function Xd(e,t){let n=e._compositionKey;if(km(null),n!==null&&t!=null){if(t===``){let t=jm(n),r=wm(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&B(t)){let n=Sh(mh(e)),i=null,a=null;n!==null&&n.anchorNode===r&&(i=n.anchorOffset,a=n.focusOffset),Km(t,r.nodeValue,i,a,!0)}return}if(t[t.length-1]===`
7
+ `){let t=H();if(V(t)||Uf(t)){if(V(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}W(e,cd,null);return}}}Gm(!0,e,t)}function Zd(e){let t=wp();if(e.key==null)return!0;if(Id){if($m(e))return Lp(t,()=>{Xd(t,Ld)}),Id=!1,Ld=``,!0;Id=!1,Ld=``}if(function(e){return Xm(e,`ArrowRight`,{shiftKey:`any`})}(e))W(t,nd,e);else if(function(e){return Xm(e,`ArrowRight`,Zm)}(e))W(t,rd,e);else if(function(e){return Xm(e,`ArrowLeft`,{shiftKey:`any`})}(e))W(t,id,e);else if(function(e){return Xm(e,`ArrowLeft`,Zm)}(e))W(t,ad,e);else if(function(e){return Xm(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))W(t,od,e);else if(function(e){return Xm(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))W(t,sd,e);else if(function(e){return Xm(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))Pd=!0,W(t,cd,e);else if(function(e){return e.key===` `}(e))W(t,ld,e);else if(function(e){return rl&&Xm(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),Pd=!0,W(t,Gu,!0);else if(function(e){return Xm(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))Pd=!1,W(t,cd,e);else if(function(e){return Xm(e,`Backspace`,{shiftKey:`any`})||rl&&Xm(e,`h`,{ctrlKey:!0})}(e))$m(e)?W(t,ud,e):(e.preventDefault(),W(t,Wu,!0));else if(function(e){return e.key===`Escape`}(e))W(t,dd,e);else if(function(e){return Xm(e,`Delete`,{})||rl&&Xm(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?W(t,fd,e):(e.preventDefault(),W(t,Wu,!1));else if(function(e){return Xm(e,`Backspace`,Qm)}(e))e.preventDefault(),W(t,Xu,!0);else if(function(e){return Xm(e,`Delete`,Qm)}(e))e.preventDefault(),W(t,Xu,!1);else if(function(e){return rl&&Xm(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),W(t,Zu,!0);else if(function(e){return rl&&(Xm(e,`Delete`,{metaKey:!0})||Xm(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),W(t,Zu,!1);else if(function(e){return Xm(e,`b`,Zm)}(e))e.preventDefault(),W(t,Qu,`bold`);else if(function(e){return Xm(e,`u`,Zm)}(e))e.preventDefault(),W(t,Qu,`underline`);else if(function(e){return Xm(e,`i`,Zm)}(e))e.preventDefault(),W(t,Qu,`italic`);else if(function(e){return Xm(e,`Tab`,{shiftKey:`any`})}(e))W(t,pd,e);else if(function(e){return Xm(e,`z`,Zm)}(e))e.preventDefault(),W(t,$u,void 0);else if(function(e){return rl?Xm(e,`z`,{metaKey:!0,shiftKey:!0}):Xm(e,`y`,{ctrlKey:!0})||Xm(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),W(t,ed,void 0);else{let n=t._editorState._selection;n===null||V(n)?eh(e)&&(e.preventDefault(),W(t,bd,e)):function(e){return Xm(e,`c`,Zm)}(e)?(e.preventDefault(),W(t,vd,e)):function(e){return Xm(e,`x`,Zm)}(e)?(e.preventDefault(),W(t,yd,e)):eh(e)&&(e.preventDefault(),W(t,bd,e))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Cd,e),!0}function Qd(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var $d=new Map;function ef(e){let t=Ch(e.target);if(t===null)return;let n=vm(t.anchorNode);if(n===null)return;Nd&&(Nd=!1,Lp(n,()=>{let r=rp(),i=t.anchorNode;(wh(i)||Sm(i))&&zm(np(r,t,n,e))}));let r=Hm(n),i=r[r.length-1],a=i._key,o=$d.get(a),s=o||i;s!==n&&Hd(t,s,!1),Hd(t,n,!0),n===i?o&&$d.delete(a):$d.set(a,n)}function tf(e){e._lexicalHandled=!0}function nf(e){return!0===e._lexicalHandled}function rf(e){let t=Ad.get(e);if(t===void 0)return;let n=jd.get(t);if(n===void 0)return;let r=n-1;r>=0||R(164),Ad.delete(e),jd.set(t,r),r===0&&t.removeEventListener(`selectionchange`,ef);let i=ym(e);_m(i)?(function(e){if(e._parentEditor!==null){let t=Hm(e),n=t[t.length-1]._key;$d.get(n)===e&&$d.delete(n)}else $d.delete(e._key)}(i),e.__lexicalEditor=null):i&&R(198);let a=Qd(e);for(let e=0;e<a.length;e++)a[e]();e.__lexicalEventHandles=[]}function af(e,t,n){xp();let r=e.__key,i=e.getParent();if(i===null)return;let a=function(e){let t=H();if(!V(t)||!U(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return fh(i,e)&&n.set(e.__key,0,`element`),fh(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(V(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(op(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(op(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else Uf(a)&&t&&e.isSelected()&&e.selectPrevious();if(V(a)&&t&&!o){let t=e.getIndexWithinParent();Dm(e),ip(a,i,t,-1)}else Dm(e);n||gh(i)||i.canBeEmpty()||!i.isEmpty()||af(i,t),t&&a&&Gp(i)&&i.isEmpty()&&i.selectEnd()}var of=Symbol.for(`ephemeral`);function sf(e){return e[of]||!1}var cf=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:e}=zh(this);return e===void 0&&R(64,this.name),e}static clone(e){R(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}),Em(this,e)}getType(){return this.__type}isInline(){R(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=jm(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){let t=e||H();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(B(this))return n;if(V(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(Up(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:jm(e)}getParentOrThrow(){let e=this.getParent();return e===null&&R(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(gh(t))return U(e)||e===this&&Up(e)||R(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&R(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:jm(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:jm(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=U(this)?this:this.getParent(),n=U(e)?e:e.getParent(),r=t&&n?yg(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=yg(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?gg(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&R(279),!1)))}isParentOf(e){let t=yg(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=U(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&&R(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=wp()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(sf(this))return this;let e=jm(this.__key);return e===null&&R(113),e}getWritable(){if(sf(this))return this;xp();let e=Cp(),t=wp(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=H();if(o!==null&&o.setCachedNodes(null),a.has(r))return Om(i),i;let s=Ph(i);return a.add(r),Om(s),n.set(r,s),s}getTextContent(){return``}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){R(70)}updateDOM(e,t,n){R(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){R(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of ql(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&Kl(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){af(this,!0,e)}replace(e,t){xp();let n=H();n!==null&&(n=n.clone()),vh(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size;Dm(o);let l=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,f=r.__next,p=r.__parent;if(af(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&&(U(this)&&U(o)||R(139),this.getChildren().forEach(e=>{o.append(e)})),V(n)){zm(n);let e=n.anchor,t=n.focus;e.key===i&&Bf(e,o),t.key===i&&Bf(t,o)}return Am()===i&&km(a),o}insertAfter(e,t=!0){xp(),vh(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),a=H(),o=!1,s=!1;if(i!==null){let t=e.getIndexWithinParent();if(Dm(r),V(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&&V(a)){let e=this.getIndexWithinParent();ip(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){xp(),vh(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key;Dm(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=H();return t&&V(l)&&ip(l,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return em()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){xp();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(U(n))return n.select();if(!B(n)){let e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){xp();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(U(n))return n.select(0,0);if(!B(n)){let e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}},lf=`history-merge`,uf=`composition-start`,df=`composition-end`,ff=class e extends cf{static getType(){return`linebreak`}static clone(t){return new e(t.__key)}constructor(e){super(e)}getTextContent(){return`
8
+ `}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&&Oh(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&gf(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&gf(n))return!0}}return!1}(e)||function(e){let t=e.parentElement;if(t!==null&&Oh(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&gf(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&gf(r))return!0}return!1}(e)?null:{conversion:pf,priority:0}}}static importJSON(e){return mf().updateFromJSON(e)}};function pf(e){return{node:mf()}}function mf(){return _h(new ff)}function hf(e){return e instanceof ff}function gf(e){return Sm(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}function _f(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function vf(e,t){return 1&t?`strong`:2&t?`em`:`span`}function yf(e,t,n,r,i){let a=r.classList,o=nh(i,`base`);o!==void 0&&a.add(...o),o=nh(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 wl){let r=wl[e];if(o=nh(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 bf(e,t,n){let r=t.firstChild,i=n.isComposing(),a=e+(i?xl:``);if(r==null)t.textContent=a;else{let e=r.nodeValue;if(e!==a)if(i||il){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 xf(e,t,n,r,i,a){bf(i,e,t);let o=a.theme.text;o!==void 0&&yf(0,0,r,e,o)}function Sf(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Cf=class e extends cf{__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 kl[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Am()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=wl[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Tm(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=_f(0,n),i=vf(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)),xf(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=_f(0,i),s=_f(0,a),c=vf(0,i),l=vf(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??R(48);let i=document.createElement(l);return xf(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??R(49)),bf(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&yf(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:Of,priority:0}),b:()=>({conversion:Tf,priority:0}),code:()=>({conversion:jf,priority:0}),em:()=>({conversion:jf,priority:0}),i:()=>({conversion:jf,priority:0}),mark:()=>({conversion:jf,priority:0}),s:()=>({conversion:jf,priority:0}),span:()=>({conversion:wf,priority:0}),strong:()=>({conversion:jf,priority:0}),sub:()=>({conversion:jf,priority:0}),sup:()=>({conversion:jf,priority:0}),u:()=>({conversion:jf,priority:0})}}static importJSON(e){return Mf().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 wh(t)||R(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=Sf(t,`b`)),this.hasFormat(`italic`)&&(t=Sf(t,`i`)),this.hasFormat(`strikethrough`)&&(t=Sf(t,`s`)),this.hasFormat(`underline`)&&(t=Sf(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`?wl[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Tl[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=Tm(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=Ol[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){xp();let n=e,r=t,i=H(),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(!V(i))return $f(o,n,o,r,`text`,`text`);{let e=Am();e!==i.anchor.key&&e!==i.focus.key||km(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=H();if(r&&V(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){xp();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Am(),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=H();if(V(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=Mf(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=Ql(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=Mf(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=Ql(t,n);let a=n.__key;i===r&&km(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&&Om(t),n!==null&&Om(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),V(v)&&ip(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||R(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Am()===r&&km(n);let o=H();if(V(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&sp(i,t,n,e,a),s!==null&&s.key===r&&sp(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 wf(e){return{forChild:Nf(e.style),node:null}}function Tf(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Nf(t.style,n?void 0:`bold`),node:null}}var Ef=new WeakMap;function Df(e){if(!wh(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function Of(e){let t=e;e.parentElement===null&&R(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=Ef.get(n))===void 0&&!Df(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)Ef.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===`
9
+ `||r===`\r
10
+ `?t.push(mf()):r===` `?t.push(Ff()):r!==``&&t.push(Mf(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=kf(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=kf(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:Mf(n)}}function kf(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,wh(n)){let e=n.style.display;if(e===``&&!Dh(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Sm(n))return n;if(n.nodeName===`BR`)return null}}var Af={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function jf(e){let t=Af[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Nf(e.style,t),node:null}}function Mf(e=``){return _h(new Cf(e))}function B(e){return e instanceof Cf}function Nf(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=>B(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 Pf=class e extends Cf{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=nh(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}static importJSON(e){return Ff().updateFromJSON(e)}setTextContent(e){return e!==` `&&e!==``&&el(126),super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||R(286),this}setDetail(e){return e!==2&&R(127),this}setMode(e){return e!==`normal`&&R(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Ff(){return _h(new Pf)}function If(e){return e instanceof Pf}var Lf=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:hg(kg(bg(this,`next`)),kg(bg(e,`next`)))<0}getNode(){let e=jm(this.key);return e===null&&R(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,bp()||(Am()===a&&km(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function Rf(e,t,n){return new Lf(e,t,n)}function zf(e,t){let n=t.__key,r=e.offset,i=`element`;if(B(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!U(t)){let e=t.getNextSibling();if(B(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 Bf(e,t){if(U(t)){let n=t.getLastDescendant();U(n)||B(n)?zf(e,n):zf(e,t)}else zf(e,t)}var Vf=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(!Uf(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(B(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=jm(e);t!==null&&n.push(t)}return bp()||(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((H()||rp())===this&&e[0]){let t=ng(e[0],`next`);Sg(pg(t,t))}for(let t of e)t.remove()}};function V(e){return e instanceof Hf}var Hf=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!!V(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(Qh(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;U(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Zh(e.focus)&&U(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=og(e.focus.origin,`previous`);Qh(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=cg(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!U(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=kg(e.anchor),r=kg(e.anchor.getFlipped()),i=e=>Xh(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(Mg(wg(this),`next`));return bp()||(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]=Gf(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(U(d)&&!d.isInline())l||(c+=`
11
+ `),l=!d.isEmpty();else if(l=!1,B(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 !Up(d)&&!hf(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=wp(),n=t.getEditorState()._selection,r=Qf(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),nu(this)}clone(){let t=this.anchor,n=this.focus;return new e(Rf(t.key,t.offset,t.type),Rf(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=Tm(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=wl[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===`
12
+ `||r===`\r
13
+ `?n.push(mf()):r===` `?n.push(Ff()):n.push(Mf(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=Mf();if(o.setFormat(n),o.setStyle(r),tm(a))a.splice(0,0,[o]);else{let e=Gp(i)?em().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`&&xg(o,kg(bg(o,`next`)));let s=a.offset,c=o.offset,l=this.getNodes(),u=l.length,d=l[0];B(d)||R(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&&(xm(d)||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let t=d.getNextSibling();if(B(t)&&t.canInsertTextBefore()&&!xm(t)||(t=Mf(),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&&(xm(d)||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let t=d.getPreviousSibling();if(B(t)&&!xm(t)||(t=Mf(),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=Mf(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&e!==``){let t=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||U(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(``),Zf(this.anchor,this.focus),void this.insertText(e)}if(u===1){if(bm(d)){let t=Mf(e);t.select(),d.replace(t);return}let t=d.getFormat(),n=d.getStyle();if(s!==c||t===r&&n===i){if(If(d)){let t=Mf(e);t.setFormat(r),t.setStyle(i),t.select(),d.replace(t);return}}else{if(d.getTextContent()!==``){let t=Mf(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=U(d)?d:d.getParentOrThrow(),r=U(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(B(m)&&!bm(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let e=Mf(m.getTextContent());m.replace(e),m=e}Gp(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)||U(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(bm(d))if(s===f)d.select();else{let t=Mf(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=H()===this;Cg(this,Og(wg(this))),e&&H()!==this&&zm(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void km(null);let n=this.getNodes(),r=[];for(let e of n)B(e)&&r.push(e);let i=t=>{n.forEach(n=>{if(U(n)){let r=n.getFormatFlags(e,t);n.setTextFormat(r)}})},a=r.length;if(a===0)return this.toggleFormat(e),km(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(xm(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||xm(f)||([,f]=f.splitText(p),p=0),f.setFormat(m);let v=g.getFormatFlags(e,m);_>0&&(_===g.getTextContentSize()||xm(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=H();return V(t)||R(134),t.insertNodes(e)}let t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Vh(t,kh),r=e[e.length-1];if(U(n)&&`__language`in n){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=dp(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some(e=>(U(e)||Up(e))&&!e.isInline())){U(n)||R(211,t.constructor.name,t.getType());let i=dp(this);n.splice(i,0,e),r.selectEnd();return}let i=function(e){let t=em(),n=null;for(let r=0;r<e.length;r++){let i=e[r],a=hf(i);if(a||Up(i)&&i.isInline()||U(i)&&i.isInline()||B(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=!U(n)||!n.isEmpty()?this.insertParagraph():null,c=o[o.length-1],l=o[0];var u;U(u=l)&&kh(u)&&!u.isEmpty()&&U(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(U(n)||R(211,t.constructor.name,t.getType()),n.append(...l.getChildren()),l=o[1]),l&&(n===null&&R(212,t.constructor.name,t.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||R(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(n,l));let d=Vh(a,kh);s&&U(d)&&(s.canMergeWhenEmpty()||kh(c))&&(d.append(...s.getChildren()),s.remove()),U(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let f=U(n)?n.getLastChild():null;hf(f)&&d!==n&&f.remove()}insertParagraph(){if(this.anchor.key===`root`){let e=em();return Lm().splice(this.anchor.offset,0,[e]),e.select(),e}let e=dp(this),t=Vh(this.anchor.getNode(),kh);U(t)||R(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=mf();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]=Gf(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(B(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(B(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),B(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(pp(this,e,t,n))return;let r=e===`move`,i=wp(),a=Sh(mh(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();if(s===null||o===null||!U(c)||c.isInline()||c.canBeEmpty()||xh(o,i,s),this.dirty){let e=sh(i,this.anchor.key),t=sh(i,this.focus.key);this.anchor.type===`text`&&(e=wm(e)),this.focus.type===`text`&&(t=wm(t)),e&&t&&cp(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=Gp(n)?n:hh(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];fh(t,i)?r.push(t):o=!0}if(o&&r.length>0)if(t){let e=r[0];U(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{let e=r[r.length-1];U(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`&&pp(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&U(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(U(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=dg(bg(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(Qh(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(U(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=kg(t);Cg(this,pg(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(Zh(t)){if(U(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(Up(t.origin)){if(!t.origin.isIsolated())if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&U(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=tp();e.add(t.origin.getKey()),zm(e)}else t.origin.remove();return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return Cg(this,pg(!t.origin.isEmpty()&&n.isEmpty()?Tg(ng(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&&Kf(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 Jf(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 Jf(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!(Vm(e)||qf(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()&&Gp(e.getParent())&&e.getPreviousSibling()===null&&Kf(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 Uf(e){return e instanceof Vf}function Wf(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Gf(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]:[Wf(n),Wf(r)]}function Kf(e,t){for(let n=t;n;n=n.getParent()){if(U(n)){if(n.collapseAtStart(e))return!0;if(gh(n))break}if(n.getPreviousSibling())break}return!1}var qf=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function Jf(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 Yf(e,t,n,r){let i,a=t;if(wh(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=Bm(u),B(i))a=ig(i,o?`next`:`previous`);else{let s=Bm(e);if(s===null)return null;if(U(s)){let c=r.getElementByKey(s.getKey());c===null&&R(214);let l=s.getDOMSlot(c);[s,a]=l.resolveChildIndex(s,c,e,t),U(s)||R(215),o&&a>=s.getChildrenSize()&&(a=Math.max(0,s.getChildrenSize()-1));let u=s.getChildAtIndex(a);if(U(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=U(u)?u:u.getParentOrThrow()),a=0}B(u)?(i=u,s=null,a=ig(u,o?`next`:`previous`)):u!==s&&o&&!d&&(U(s)||R(216),a=Math.min(s.getChildrenSize(),a+1))}else{let n=s.getIndexWithinParent();a=t===0&&Up(s)&&Bm(e)===s?n:n+1,s=s.getParentOrThrow()}if(U(s))return Rf(s.__key,a,`element`)}}else i=Bm(e);return B(i)?Rf(i.__key,ig(i,a,`clamp`),`text`):null}function Xf(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&&U(a)&&a.isInline()){let t=a.getPreviousSibling();B(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else U(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):B(r)&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&U(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&U(a)&&a.isInline()&&!a.canInsertTextAfter()){let t=a.getNextSibling();B(t)&&e.set(t.__key,0,`text`)}}}function Zf(e,t,n){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);Xf(e,n,r),Xf(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function Qf(e,t,n,r,i,a){if(e===null||n===null||!gm(i,e,n))return null;let o=Yf(e,t,V(a)?a.anchor:null,i);if(o===null)return null;let s=Yf(n,r,V(a)?a.focus:null,i);if(s===null)return null;if(o.type===`element`&&s.type===`element`){let t=Bm(e),r=Bm(n);if(Up(t)&&Up(r))return null}return Zf(o,s),[o,s]}function $f(e,t,n,r,i,a){let o=Cp(),s=new Hf(Rf(e,t,i),Rf(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function ep(){return new Hf(Rf(`root`,0,`element`),Rf(`root`,0,`element`),0,``)}function tp(){return new Vf(new Set)}function np(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=!Ml&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(V(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)&&V(e)&&!gm(n,l,u))return e.clone();let p=Qf(l,d,u,f,n,e);if(p===null)return null;let[m,h]=p,g=0,_=``;if(V(e)){let t=e.anchor;if(m.key===t.key)g=e.format,_=e.style;else{let e=m.getNode();B(e)?(g=e.getFormat(),_=e.getStyle()):U(e)&&(g=e.getTextFormat(),_=e.getTextStyle())}}return new Hf(m,h,g,_)}function H(){return Cp()._selection}function rp(){return wp()._editorState._selection}function ip(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`),ap(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`)}}ap(e)}function ap(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!U(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(B(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}return}if(U(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(B(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(U(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(B(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}function op(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,B(i)?s=`text`:U(i)&&(s=`element`)):(a=r.__key,B(r)?(o=r.getTextContentSize(),s=`text`):U(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 sp(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 cp(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function lp(e,t,n){let r=sh(e,t.getKey());if(U(t)){let e=t.getDOMSlot(r);return[e.element,n+e.getFirstChildOffset()]}return[r,n]}function up(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&&hm(d))return;if(!V(t))return void(e!==null&&gm(n,s,c)&&r.removeAllRanges());let f=t.anchor,p=t.focus,m=f.getNode(),h=p.getNode(),[g,_]=lp(n,m,f.offset),[v,y]=lp(n,h,p.offset),b=t.format,x=t.style,S=t.isCollapsed(),C=g,w=v,T=!1;var E,D,O,k,A;if((f.type===`text`?(C=wm(g),T=m.getFormat()!==b||m.getStyle()!==x):V(e)&&e.anchor.type===`text`&&(T=!0),p.type===`text`&&(w=wm(v)),C!==null&&w!==null)&&(S&&(e===null||T||V(e)&&(e.format!==b||e.style!==x))&&(E=b,D=x,O=_,k=f.key,A=performance.now(),zd=[E,D,O,k,A]),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(cp(r,C,_,w,y),!il||!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=V(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=lh(n),i=ph(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=mh(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=ch(l)}})(n,t,a)}}Md=!0}}function dp(e){let t=e;e.isCollapsed()||t.removeText();let n=H();V(n)&&(t=n),V(t)||R(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!kh(i);){let e=i;if([i,a]=fp(i,a),e.is(i))break}return a}function fp(e,t){let n=e.getParent();if(!n){let e=em();return Lm().append(e),e.select(),[Lm(),0]}if(B(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(!U(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new Hf(Rf(e.__key,t,`element`),Rf(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function pp(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=bg(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!Ag(c)){for(let e of c){l=!1;let{origin:t}=e;if(!Up(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of dg(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(Qh(e))e.origin.isInline()||(c=e);else{if(U(e.origin))continue;Up(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&Up(c.origin)&&c.origin.isKeyboardSelectable()){let e=tp();return e.add(c.origin.getKey()),zm(e),!0}return c=kg(c),s&&xg(e.anchor,c),xg(e.focus,c),l||!o}var mp=null,hp=null,gp=!1,_p=!1,vp=0,yp={characterData:!0,childList:!0,subtree:!0};function bp(){return gp||mp!==null&&mp._readOnly}function xp(){gp&&R(13)}function Sp(){vp>99&&R(14)}function Cp(){return mp===null&&R(195,Tp()),mp}function wp(){return hp===null&&R(196,Tp()),hp}function Tp(){let e=0,t=new Set,n=sm.version;if(typeof window<`u`)for(let r of document.querySelectorAll(`[contenteditable]`)){let i=ym(r);if(_m(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 Ep(){return hp}function Dp(e,t,n){let r=t.__type,i=dm(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 Op(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function kp(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 Ap(e,t){let n=e.type,r=t.get(n);r===void 0&&R(17,n);let i=r.klass;e.type!==i.getType()&&R(18,i.name);let a=i.importJSON(e),o=e.children;if(U(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=Ap(o[e],t);a.append(n)}return a}function jp(e,t,n){let r=mp,i=gp,a=hp;mp=t,gp=!0,hp=e;try{return n()}finally{mp=r,gp=i,hp=a}}function Mp(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=mp,u=gp,d=hp,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){hp=e,mp=n,gp=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=Iu(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),_p)throw t;nm(e,null,r,n),Vl(e),e._dirtyType=2,_p=!0,Mp(e,a),_p=!1;return}finally{p.observe(r,yp),e._updating=f,mp=l,gp=u,hp=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=Fm(e)),delete r[a])}(e,n);let b=i?null:Sh(mh(e));if(e._editable&&b!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){hp=e,mp=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&xh(t,e,r),up(o,s,e,b,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(V(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())bh(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&bh(t)){let n=t.getPreviousSibling();(n===null||bh(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=Lg(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&&xh(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,yp),hp=d,mp=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),V(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(Ru,void 0);let x=e._pendingDecorators;x!==null&&(e._decorators=x,e._pendingDecorators=null,Np(`decorator`,e,!0,x)),function(e,t,n){let r=Im(t),i=Im(n);r!==i&&Np(`textcontent`,e,!0,i)}(e,t||a,n),Np(`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;Ip(e,t,r)}}}(e)}function Np(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 Pp(e,t,n,r){let i=Hm(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(Lp(s,()=>{for(let t=0;t<i;t++)if(e[t](n,r))return void(a=!0)}),a)return a}}}return a&&a.update(()=>{Pp(a,t,n,r)}),!1}function Fp(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&&R(191),a._flushSync=!0),o&&e._deferred.push(o),kp(e,i.tag)),a==null?Ip(e,n,i):n()}}return r}function Ip(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,kp(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=Kp(c||s),l=!0),c._flushSync=o;let u=mp,d=gp,f=hp,p=e._updating;mp=c,gp=!1,e._updating=!0,hp=e;let m=e._headless||e.getRootElement()===null;lm(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=Sh(mh(e));return V(n)||n==null?np(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=Fp(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(V(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);B(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&tu(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Am(),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);B(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&tu(r),r!==void 0&&Op(r,a)&&Dp(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){vp++;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&&Op(c,a)&&Dp(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,vp++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),Fp(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()||(U(t)&&jl(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(V(i)){let e=c._nodeMap,t=i.anchor.key,n=i.focus.key;e.get(t)!==void 0&&e.get(n)!==void 0||R(19)}else Uf(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(),Mp(e);return}finally{mp=u,gp=d,hp=f,e._updating=p,vp=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,Mp(e)):l&&pm(()=>{Mp(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Lp(e,t,n){hp===e&&n===void 0?t():Ip(e,t,n)}var Rp=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&&R(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&R(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&R(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`&&(dl||ol||cl);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=zp(t,n);i.push(r);let a=zp(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 zp(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&&R(225),n.reverse()}var Bp=class extends cf{__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 Dl[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=wp()._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(B(t)&&e.push(t),U(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;U(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;U(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 U(e)&&e.getLastDescendant()||e||null}let r=t[e];return U(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:jm(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&R(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:jm(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&R(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(),U(i)&&r!==n-1&&!i.isInline()&&(e+=Sl)}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(),U(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=El[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=wl[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return Tm(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){xp();let n=H(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(B(e)||U(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(B(e)||U(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return V(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):$f(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:El[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){sf(this)&&R(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||R(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&&R(100);let t=e.getNextSibling(),n=e.__key;Dm(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--,Dm(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&&R(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=H();if(V(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;Vp(r,t,n)&&op(r,r.getNode(),this,l,c),Vp(i,t,n)&&op(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||gh(this)||this.remove()}}return i}getDOMSlot(e){return new Rp(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(wh(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===``||gh(this)||this.getChildren().some(B)||(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 U(e){return e instanceof Bp}function Vp(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 Hp=class extends cf{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Up(e){return e instanceof Hp}var Wp=class e extends Bp{__cachedText;static getType(){return`root`}static clone(){return new e}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){R(51)}getTextContent(){let e=this.__cachedText;return!bp()&&wp()._dirtyType!==0||e===null?super.getTextContent():e}remove(){R(52)}replace(e){R(53)}insertBefore(e){R(54)}insertAfter(e){R(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)U(e)||Up(e)||R(282);return super.splice(e,t,n)}static importJSON(e){return Lm().updateFromJSON(e)}collapseAtStart(){return!0}};function Gp(e){return e instanceof Wp}function Kp(e){return new Xp(new Map(e._nodeMap))}function qp(){return new Xp(new Map([[`root`,new Wp]]))}function Jp(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&R(130,n.name),U(e)){let r=t.children;Array.isArray(r)||R(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=Jp(i[e]);r.push(t)}}return t}function Yp(e){return e instanceof Xp}var Xp=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 jp(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 jp(null,this,()=>({root:Jp(Lm())}))}},Zp=class extends Bp{static getType(){return`artificial`}createDOM(e){return document.createElement(`div`)}},Qp=class e extends Bp{static getType(){return`paragraph`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`p`),n=nh(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:$p,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(wh(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return em().updateFromJSON(e)}exportJSON(){let e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){let t=this.getChildren().find(B);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=em();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||B(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 $p(e){let t=em();if(e.style&&(t.setFormat(e.style.textAlign),Ih(e,t)),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in El&&t.setFormat(n)}return{node:t}}function em(){return _h(new Qp)}function tm(e){return e instanceof Qp}function nm(e,t,n,r){let i=e._keyToDOMMap;i.clear(),e._editorState=qp(),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 rm(e){let t=new Set,n=new Set,r=e;for(;r;){let{ownNodeConfig:e}=zh(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 cf&&e!==cf?e:void 0}}return t}function im(e){let t=e||{},n=Ep(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=qp(),s=t.namespace||(i===null?Um():i._config.namespace),c=t.editorState,l=[Wp,Cf,ff,Pf,Qp,Zp,...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}zh(t);let i=t.getType(),a=rm(t);p.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:Wl(l[e]),transforms:a})}}let m=new sm(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(Bu,Kd,0),e.registerCommand(Vu,qd,0),e.registerCommand(Hu,Jd,0),e.registerCommand(Uu,Yd,0),e.registerCommand(td,Zd,0)}(m),m}function am(e,t){let n=e.get(t);e.delete(t),n&&n()}function om(e,t,n){return e.set(t,n),am.bind(null,e,t)}var sm=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=Um(),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 om(this._listeners.update,e)}registerEditableListener(e){return om(this._listeners.editable,e)}registerDecoratorListener(e){return om(this._listeners.decorator,e)}registerTextContentListener(e){return om(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return zg(om(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&&R(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&&R(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&&R(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=Nh(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=Nh(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=jm(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:lf}: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 W(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=nh(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,nm(this,t,e,r),t!==null&&(this._config.disableEvents||rf(t),n!=null&&t.classList.remove(...n)),e!==null){let t=ph(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,Vl(this),this._updateTags.add(lf),Mp(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;Ad.set(e,n);let r=jd.get(n)??0;r<1&&n.addEventListener(`selectionchange`,ef),jd.set(n,r+1),e.__lexicalEditor=t;let i=Qd(e);for(let n=0;n<Td.length;n++){let[r,a]=Td[n],o=typeof a==`function`?e=>{nf(e)||(tf(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(nf(e))return;tf(e);let n=t.isEditable();switch(r){case`cut`:return n&&W(t,yd,e);case`copy`:return W(t,vd,e);case`paste`:return n&&W(t,Ju,e);case`dragstart`:return n&&W(t,hd,e);case`dragover`:return n&&W(t,gd,e);case`dragend`:return n&&W(t,_d,e);case`focus`:return n&&W(t,xd,e);case`blur`:return n&&W(t,Sd,e);case`drop`:return n&&W(t,md,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(lf),Mp(this);Np(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&R(38);let n=e;n._readOnly&&(n=Kp(e),n._selection=e._selection?e._selection.clone():null),Bl(this);let r=this._pendingEditorState,i=this._updateTags,a=t===void 0?null:t.tag;r===null||r.isEmpty()||(a!=null&&i.add(a),Mp(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||Mp(this)}parseEditorState(e,t){return function(e,t,n){let r=qp(),i=mp,a=gp,o=hp,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,mp=r,gp=!1,hp=t,lm(null);try{let i=t._nodes;Ap(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,mp=i,gp=a,hp=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(e){return Mp(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):Ip(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),Lp(this,()=>{let r=H(),i=Lm();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||zm(r.clone()),uh(`focus`),dh(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Sh(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Np(`editable`,this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};sm.version=`0.43.0+prod.esm`;var cm=null;function lm(e){cm=e}var um=1;function dm(e,t){let n=fm(e,t);return n===void 0&&R(30,t),n}function fm(e,t){return e._nodes.get(t)}var pm=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function mm(e){return Up(Pm(e))}function hm(e){let t=document.activeElement;if(!wh(t))return!1;let n=t.nodeName;return Up(Pm(e))&&(n===`INPUT`||n===`TEXTAREA`||t.contentEditable===`true`&&ym(t)==null)}function gm(e,t,n){let r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!hm(t)&&vm(t)===e}catch{return!1}}function _m(e){return e instanceof sm}function vm(e){let t=e;for(;t!=null;){let e=ym(t);if(_m(e))return e;t=ch(t)}return null}function ym(e){return e?e.__lexicalEditor:null}function bm(e){return If(e)||e.isToken()}function xm(e){return bm(e)||e.isSegmented()}function Sm(e){return Th(e)&&e.nodeType===3}function Cm(e){return Th(e)&&e.nodeType===9}function wm(e){let t=e;for(;t!=null;){if(Sm(t))return t;t=t.firstChild}return null}function Tm(e,t,n){let r=wl[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~wl.superscript:t===`superscript`?i&=~wl.subscript:t===`lowercase`?(i&=~wl.uppercase,i&=~wl.capitalize):t===`uppercase`?(i&=~wl.lowercase,i&=~wl.capitalize):t===`capitalize`&&(i&=~wl.lowercase,i&=~wl.uppercase),i}function Em(e,t){let n=function(){let e=cm;return cm=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);xp(),Sp();let r=wp(),i=Cp(),a=``+ um++;i._nodeMap.set(a,e),U(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType=1,e.__key=a}function Dm(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 Om(e){Sp(),sf(e)&&R(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,r=Cp(),i=wp(),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,U(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function km(e){xp();let t=wp(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=jm(n);e!==null&&e.getWritable()}if(e!==null){let t=jm(e);t!==null&&t.getWritable()}}}function Am(){return bp()?null:wp()._compositionKey}function jm(e,t){let n=(t||Cp())._nodeMap.get(e);return n===void 0?null:n}function Mm(e,t){let n=Nm(e,wp());return n===void 0?null:jm(n,t)}function Nm(e,t){return e[`__lexicalKey_${t._key}`]}function Pm(e,t){let n=e;for(;n!=null;){let e=Mm(n,t);if(e!==null)return e;n=ch(n)}return null}function Fm(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Im(e){return e.read(()=>Lm().getTextContent())}function Lm(){return Rm(Cp())}function Rm(e){return e._nodeMap.get(`root`)}function zm(e){xp();let t=Cp();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Bm(e){let t=wp(),n=function(e,t){let n=e;for(;n!=null;){let e=Nm(n,t);if(e!==void 0)return e;n=ch(n)}return null}(e,t);return n===null?e===t.getRootElement()?jm(`root`):null:jm(n)}function Vm(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Hm(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function Um(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function Wm(e){return Sm(e)?e.nodeValue:null}function Gm(e,t,n){let r=Sh(mh(t));if(r===null)return;let i=r.anchorNode,{anchorOffset:a,focusOffset:o}=r;if(i!==null){let t=Wm(i),r=Pm(i);if(t!==null&&B(r)){if((t===xl||t===Cl)&&n){let e=n.length;t=n,a=e,o=e}t!==null&&Km(r,t,a,o,e)}}}function Km(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(xl)&&(s=t.slice(0,-xl.length)),i)){let e=Cl,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(km(null),cl||ol||dl)a.remove();else{let e=wp();setTimeout(()=>{e.update(()=>{a.isAttached()&&a.remove()})},20)}return}let t=a.getParent(),i=rp(),c=a.getTextContentSize(),l=Am(),u=a.getKey();if(a.isToken()||l!==null&&u===l&&!o||V(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=H();if(!V(d)||n===null||r===null)return void qm(a,s,d);if(d.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=Mf(a.getTextContent());a.replace(e),a=e}qm(a,s,d)}}}function qm(e,t,n){if(e.setTextContent(t),V(n)){let t=e.getKey();for(let r of[`anchor`,`focus`]){let i=n[r];i.type===`text`&&i.key===t&&(i.offset=ig(e,i.offset,`clamp`))}}}function Jm(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function Ym(e,t){return Jm(e,t,`altKey`)&&Jm(e,t,`ctrlKey`)&&Jm(e,t,`shiftKey`)&&Jm(e,t,`metaKey`)}function Xm(e,t,n){if(!Ym(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 Zm={ctrlKey:!rl,metaKey:rl},Qm={altKey:rl,ctrlKey:!rl};function $m(e){return e.key===`Backspace`}function eh(e){return Xm(e,`a`,Zm)}function th(e){let t=Lm();if(V(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`),nu(e),e}{let e=t.select(0,t.getChildrenSize());return zm(nu(e)),e}}function nh(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=Lg(i);return n[t]=e,e}return i}function rh(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&R(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 ih(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 ah(e,t){let n=e.offset;if(e.type===`element`)return ih(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?ih(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function oh(e){let t=mh(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function W(e,t,n){return Pp(e,t,n,e)}function sh(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&R(75,t),n}function ch(e){let t=e.assignedSlot||e.parentElement;return Eh(t)?t.host:t}function lh(e){return Cm(e)?e:wh(e)?e.ownerDocument:null}function uh(e){xp(),wp()._updateTags.add(e)}function dh(e){xp(),wp()._deferred.push(e)}function fh(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function ph(e){let t=lh(e);return t?t.defaultView:null}function mh(e){let t=e._window;return t===null&&R(78),t}function hh(e){let t=e.getParentOrThrow();for(;t!==null;){if(gh(t))return t;t=t.getParentOrThrow()}return t}function gh(e){return Gp(e)||U(e)&&e.isShadowRoot()}function _h(e){let t=wp(),n=e.getType(),r=fm(t,n);r===void 0&&R(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||R(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||R(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&R(203,e.constructor.name,n,r.name,r.getType()),t}return e}function vh(e,t){!Gp(e.getParent())||U(t)||Up(t)||R(99)}function yh(e){let t=jm(e);return t===null&&R(63,e),t}function bh(e){return(Up(e)||U(e)&&!e.canBeEmpty())&&!e.isInline()}function xh(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Sh(e){return tl?(e||window).getSelection():null}function Ch(e){let t=ph(e);return t?t.getSelection():null}function wh(e){return Th(e)&&e.nodeType===1}function Th(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Eh(e){return Th(e)&&e.nodeType===11}function Dh(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 Oh(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 kh(e){if(Up(e)&&!e.isInline())return!0;if(!U(e)||gh(e))return!1;let t=e.getFirstChild(),n=t===null||hf(t)||B(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Ah(){return wp()}var jh=new WeakMap,Mh=new Map;function Nh(e){if(!e._readOnly&&e.isEmpty())return Mh;e._readOnly||R(192);let t=jh.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),jh.set(e,t)),t}function Ph(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Fh(e){return(t=Ph(e))[of]=!0,t;var t}function Ih(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function Lh(e){return!0===e.__lexicalUnmanaged}function Rh(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==cf[t]}function zh(e){let t=Al in e.prototype?e.prototype[Al]():void 0,n=function(e){if(!(e===cf||e.prototype instanceof cf)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{sm.version&&(n=JSON.parse(sm.version))}catch{}R(290,e.name,t,n)}return e===Hp||e===Bp||e===cf}(e),r=!n&&Rh(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&&(Rh(e,`getType`)||(e.getType=()=>a),Rh(e,`clone`)||(e.clone=t=>(lm(t),new e)),Rh(e,`importJSON`)||(e.importJSON=i&&i.$importJSON||(t=>new e().updateFromJSON(t))),!Rh(e,`importDOM`)&&i)){let{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:a}}function Bh(e){let t=Ah();return xp(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Vh=(e,t)=>{let n=e;for(;n!=null&&!Gp(n);){if(t(n))return n;n=n.getParent()}return null},Hh={next:`previous`,previous:`next`},Uh=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return mg({hasNext:Zh,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return ng(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return ng(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&&R(263,Array.from(o).join(` `))}else i.insert(e);i=ng(e,this.direction)}for(let e of o.values())e.remove();return this}},Wh=class e extends Uh{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:og(e,this.direction)}getParentCaret(e=`root`){return ng(qh(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=Kh(this.direction);return ng(this.getNodeAtCaret(),e)||og(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)}},Gh={root:Gp,shadowRoot:gh};function Kh(e){return Hh[e]}function qh(e,t=`root`){return Gh[t](e)?null:e}var Jh=class e extends Uh{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:ng(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return U(this.origin)?og(this.origin,this.direction):null}getParentCaret(e=`root`){return ng(qh(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=Kh(this.direction);return ng(this.getNodeAtCaret(),e)||og(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 Yh)&&this.direction===t.direction&&this.origin.is(t.origin)}},Yh=class e extends Uh{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:rg(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return ng(qh(this.getParentAtCaret(),e),this.direction)}getFlipped(){return rg(this.origin,Kh(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 Jh||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return ng(this.origin,this.direction)}};function Xh(e){return e instanceof Yh}function Zh(e){return e instanceof Jh}function Qh(e){return e instanceof Wh}var $h={next:class extends Yh{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Yh{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},eg={next:class extends Jh{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Jh{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},tg={next:class extends Wh{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Wh{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function ng(e,t){return e?new eg[t](e):null}function rg(e,t,n){return e?new $h[t](e,ig(e,n)):null}function ig(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&el(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function ag(e,t){return new ug(e,t)}function og(e,t){return U(e)?new tg[t](e):null}function sg(e){return e&&e.getChildCaret()||e}function cg(e){return e&&sg(e.getAdjacentCaret())}var lg=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 Xh(t)?function(e,t){let{direction:n,origin:r}=e;return ag(e,ig(r,t===`focus`?Kh(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[ag(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=Xh(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Xh(n),i=t=>t.isSameNodeCaret(n)?null:cg(t)||t.getParentCaret(e);return mg({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`)}},ug=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 rg(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function dg(e){return pg(e,ng(Lm(),e.direction))}function fg(e){return pg(e,e)}function pg(e,t){return e.direction!==t.direction&&R(265),new lg(e,t,e.direction)}function mg(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 hg(e,t){let n=yg(e.origin,t.origin);switch(n===null&&R(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 gg(n)}}function gg(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 _g(e,t){return t.is(e)}function vg(e){return U(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function yg(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=vg(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=vg(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(_g(e,r)||R(276),{commonAncestor:r,type:`ancestor`}):i===null?(_g(t,r)||R(277),{commonAncestor:r,type:`descendant`}):((U(a)||_g(e,a))&&(U(i)||_g(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||R(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function bg(e,t){let{type:n,key:r,offset:i}=e,a=yh(e.key);return n===`text`?(B(a)||R(266,a.getType(),r),rg(a,t,i)):(U(a)||R(267,a.getType(),r),Ng(a,e.offset,t))}function xg(e,t){let{origin:n,direction:r}=t,i=r===`next`;Xh(t)?e.set(n.getKey(),t.offset,`text`):Zh(t)?B(n)?e.set(n.getKey(),ig(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),`element`):(Qh(t)&&U(n)||R(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function Sg(e){let t=H(),n=V(t)?t:ep();return Cg(n,e),zm(n),n}function Cg(e,t){xg(e.anchor,t.anchor),xg(e.focus,t.focus)}function wg(e){let{anchor:t,focus:n}=e,r=bg(t,`next`),i=bg(n,`next`),a=hg(r,i)<=0?`next`:`previous`;return pg(jg(r,a),jg(i,a))}function Tg(e){let{direction:t,origin:n}=e,r=ng(n,Kh(t)).getNodeAtCaret();return r?ng(r,t):og(n.getParentOrThrow(),t)}function Eg(e,t=`root`){let n=[e];for(let r=Qh(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(Tg(r));return n}function Dg(e){return!!e&&e.origin.isAttached()}function Og(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=Mg(e,r),o=Eg(a.anchor,n),s=Eg(a.focus.getFlipped(),n),c=new Set,l=[];for(let e of a.iterNodeCarets(n))if(Qh(e))c.add(e.origin.getKey());else if(Zh(e)){let{origin:t}=e;U(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=Tg(ng(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=Mf(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=rg(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(Dg(e)){u=kg(e);break}for(let e of s)if(Dg(e)){d=kg(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(gh(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,kh),d=u&&l(o,e=>n.has(e.getKey())&&kh(e));return u&&d?[u,d]:null}(u,d,c);if(f){let[e,t]=f;og(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(Dg);if(p)return fg(jg(kg(p),e.direction));R(269,JSON.stringify(o.map(e=>e.origin.__key)))}function kg(e){let t=function(e){let t=e;for(;Qh(t);){let e=cg(t);if(!Qh(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(B(t.origin))return Xh(t)?t:rg(t.origin,n,n);let r=t.getAdjacentCaret();return Zh(r)&&B(r.origin)?rg(r.origin,n,Kh(n)):t}function Ag(e){return Xh(e)&&e.offset!==ig(e.origin,e.direction)}function jg(e,t){return e.direction===t?e:e.getFlipped()}function Mg(e,t){return e.direction===t?e:pg(jg(e.focus,t),jg(e.anchor,t))}function Ng(e,t,n){let r=og(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return jg(r,n)}function Pg(e){return e}function Fg(e){return e}function Ig(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Lg(...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 Rg(e,...t){let n=Lg(...t);n.length>0&&e.classList.add(...n)}function zg(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Bg(){return Lm().getTextContent()}function Vg(e,t=!0){if(e)return!1;let n=Bg();return t&&(n=n.trim()),n===``}function Hg(e){if(!Vg(e,!1))return!1;let t=Lm().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(Up(n))return!1;if(U(n)){if(!tm(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(!B(n))return!1}}}return!0}function Ug(e){return()=>Hg(e)}function Wg(e){let t=Ah().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function Gg(e){return Wg(Gp(e)?e:e.getParentOrThrow())}function Kg(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!xm(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]=Gf(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=Fh(t)),t.__text=p)}}return t}function qg(e){let t=Jg(e);return t!==null&&t.writingMode===`vertical-rl`}function Jg(e){let t=e.anchor.getNode();return U(t)?Wg(t):Gg(t)}function Yg(e,t){let n=qg(e)?!t:t;Zg(e)&&(n=!n);let r=bg(e.focus,n?`previous`:`next`);if(Ag(r))return!1;for(let e of dg(r)){if(Qh(e))return!e.origin.isInline();if(!U(e.origin)){if(Up(e.origin))return!0;break}}return!1}function Xg(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function Zg(e){let t=Jg(e);return t!==null&&t.direction===`rtl`}function Qg(e,t,n){let r=Zg(e),i;i=qg(e)||r?!n:n,Xg(e,t,i,`character`)}var $g=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,e_=$g&&`documentMode`in document?document.documentMode:null;$g&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),$g&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),!(!$g||!(`InputEvent`in window)||e_)&&`getTargetRanges`in new window.InputEvent(`input`),$g&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&window.MSStream,$g&&/Android/.test(navigator.userAgent),$g&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),$g&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$g&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent);function t_(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}var n_=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function r_({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,F.useState)(e.isEditable()),T=(0,F.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,F.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 n_(()=>(w(e.isEditable()),e.registerEditableListener(e=>{w(e)})),[e]),(0,I.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 i_=(0,F.forwardRef)(r_);function a_(e){return e.getEditorState().read(Ug(e.isComposing()))}var o_=(0,F.forwardRef)(s_);function s_(e,t){let{placeholder:n,...r}=e,[i]=$c();return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i_,{editor:i,...r,ref:t}),n!=null&&(0,I.jsx)(c_,{editor:i,content:n})]})}function c_({content:e,editor:t}){let n=function(e){let[t,n]=(0,F.useState)(()=>a_(e));return n_(()=>{function t(){n(a_(e))}return t(),zg(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,F.useState)(t.isEditable());if((0,F.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,I.jsx)(`div`,{"aria-hidden":!0,children:a})}var l_=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,u_=l_?F.useLayoutEffect:F.useEffect,d_={tag:lf};function f_({initialConfig:e,children:t}){let n=(0,F.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,editorState:a,html:o}=e,s=Qc(null,t),c=im({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=Lm();if(t.isEmpty()){let n=em();t.append(n);let r=l_?document.activeElement:null;(H()!==null||r!==null&&r===e.getRootElement())&&n.select()}},d_);else if(t!==null)switch(typeof t){case`string`:{let n=e.parseEditorState(t);e.setEditorState(n,d_);break}case`object`:e.setEditorState(t,d_);break;case`function`:e.update(()=>{Lm().isEmpty()&&t(e)},d_)}}}(c,a),[c,s]},[]);return u_(()=>{let t=e.editable,[r]=n;r.setEditable(t===void 0||t)},[]),(0,I.jsx)(Zc.Provider,{value:n,children:t})}function p_({editorRef:e}){let[t]=$c();return F.useEffect(()=>{typeof e==`function`?e(t):typeof e==`object`&&(e.current=t)},[t]),null}var m_=(0,F.createContext)(null),h_={didCatch:!1,error:null},g_=class extends F.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=h_}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(h_))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&__(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(h_))}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,F.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,F.createElement)(m_.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function __(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function v_({children:e,onError:t}){return(0,I.jsx)(g_,{fallback:(0,I.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}),onError:t,children:e})}var y_=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function b_(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function x_(){return function(e){let[t]=$c(),n=(0,F.useMemo)(()=>e(t),[t,e]),[r,i]=(0,F.useState)(()=>n.initialValueFn()),a=(0,F.useRef)(r);return y_(()=>{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}(b_)}var S_=Symbol.for(`preact-signals`);function C_(){if(D_>1)return void D_--;let e,t=!1;for(function(){let e=E_;for(E_=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();w_!==void 0;){let n=w_;for(w_=void 0,O_++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&N_(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(O_=0,D_--,t)throw e}var G,w_;function T_(e){let t=G;G=void 0;try{return e()}finally{G=t}}var E_,D_=0,O_=0,k_=0,A_=0;function j_(e){if(G===void 0)return;let t=e.n;return t===void 0||t.t!==G?(t={i:0,S:e,p:G.s,n:void 0,t:G,e:void 0,x:void 0,r:t},G.s!==void 0&&(G.s.n=t),G.s=t,e.n=t,32&G.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=G.s,t.n=void 0,G.s.n=t,G.s=t),t):void 0}function M_(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 N_(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 P_(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 F_(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 I_(e,t){M_.call(this,void 0),this.x=e,this.s=void 0,this.g=A_-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function L_(e){let t=e.m;if(e.m=void 0,typeof t==`function`){D_++;let n=G;G=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,R_(e),t}finally{G=n,C_()}}}function R_(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,L_(e)}function z_(e){if(G!==this)throw Error(`Out-of-order effect`);F_(this),G=e,this.f&=-2,8&this.f&&R_(this),C_()}function B_(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 V_(e,t){let n=new B_(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}M_.prototype.brand=S_,M_.prototype.h=function(){return!0},M_.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?T_(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},M_.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&&T_(()=>{var e;(e=this.Z)==null||e.call(this)}))}},M_.prototype.subscribe=function(e){return V_(()=>{let t=this.value,n=G;G=void 0;try{e(t)}finally{G=n}},{name:`sub`})},M_.prototype.valueOf=function(){return this.value},M_.prototype.toString=function(){return this.value+``},M_.prototype.toJSON=function(){return this.value},M_.prototype.peek=function(){let e=G;G=void 0;try{return this.value}finally{G=e}},Object.defineProperty(M_.prototype,`value`,{get(){let e=j_(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(O_>100)throw Error(`Cycle detected`);(function(e){D_!==0&&O_===0&&e.l!==k_&&(e.l=k_,E_={S:e,v:e.v,i:e.i,o:E_})})(this),this.v=e,this.i++,A_++,D_++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{C_()}}}}),I_.prototype=new M_,I_.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===A_))return!0;if(this.g=A_,this.f|=1,this.i>0&&!N_(this))return this.f&=-2,!0;let e=G;try{P_(this),G=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 G=e,F_(this),this.f&=-2,!0},I_.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)}M_.prototype.S.call(this,e)},I_.prototype.U=function(e){if(this.t!==void 0&&(M_.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)}},I_.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(I_.prototype,`value`,{get(){if(1&this.f)throw Error(`Cycle detected`);let e=j_(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),B_.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()}},B_.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,L_(this),P_(this),D_++;let e=G;return G=this,z_.bind(this,e)},B_.prototype.N=function(){2&this.f||(this.f|=2,this.u=w_,w_=this)},B_.prototype.d=function(){this.f|=8,1&this.f||R_(this)},B_.prototype.dispose=function(){this.d()};function H_(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}Ul(`format`,{parse:e=>typeof e==`number`?e:0});function U_(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 W_(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]=W_(n[e],r[e]);return e}return t}var G_=0,K_=1,q_=2,J_=3,Y_=4,X_=5,Z_=6,Q_=7;function $_(e){return e.id===G_}function ev(e){return e.id===q_}function tv(e){return function(e){return e.id===K_}(e)||U_(305,String(e.id),String(K_)),Object.assign(e,{id:q_})}var nv=new Set,rv=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:G_}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Ig;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;ev(t)||U_(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:J_,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:Y_,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==Y_&&U_(307,String(t.id),String(X_)),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:X_,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==X_&&U_(308,String(n.id),String(X_));let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:Z_})}(n),()=>{let e=this.state;e.id!==Q_&&U_(309,String(n.id),String(Q_)),this.state=function(e){return Object.assign(e,{id:X_})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==Z_&&U_(310,String(t.id),String(Z_)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:Q_})}(t),n}getSignal(){return this._signal===void 0&&U_(311),this._signal}getInitResult(){this.extension.init===void 0&&U_(312,this.extension.name);let e=this.state;return function(e){return e.id>=Y_}(e)||U_(313,String(e.id),String(Y_)),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>=J_}(e)||U_(314,String(e.id),String(J_)),{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&&U_(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&U_(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=Q_}(e)||U_(316,String(e.id),String(Q_)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||nv}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>=X_})(e)||U_(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}},iv={tag:lf};function av(){let e=Lm();e.isEmpty()&&e.append(em())}var ov=Pg({config:Fg({setOptions:iv,updateOptions:iv}),init:({$initialEditorState:e=av})=>({$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(Yp(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:[Wp,Cf,ff,Pf,Qp]}),sv=Symbol.for(`@lexical/extension/LexicalBuilder`);function cv(){}function lv(e){throw e}function uv(e){return Array.isArray(e)?e:[e]}var dv=`0.43.0+prod.esm`,fv=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=dv,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[uv(ov)];for(let e of t)n.push(uv(e));return new e(n)}static maybeFromEditor(t){let n=t[sv];return n&&(n.PACKAGE_VERSION!==dv&&U_(292,n.PACKAGE_VERSION,dv),n instanceof e||U_(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&U_(294),n}constructEditor(){let{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(im({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[sv]:this});for(let e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=cv;function t(){try{e()}finally{e=cv}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=zg(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&&U_(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&&U_(296);let[t]=uv(e);typeof t.name!=`string`&&U_(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&U_(298,t.name),!n){n=new rv(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&U_(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&U_(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=uv(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(ev(i))return;let a=n.extension.name;var o;$_(i)||U_(300,a,r||`[unknown]`),$_(o=i)||U_(304,String(o.id),String(G_)),i=Object.assign(o,{id:K_}),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=tv(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())$_(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&&U_(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 zg(...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 H_(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&U_(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&&W_(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||=lv,e}},pv=class e extends Hp{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return hv().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:mv,priority:0})}}exportDOM(){return{element:document.createElement(`hr`)}}createDOM(e){let t=document.createElement(`hr`);return Rg(t,e.theme.hr),t}getTextContent(){return`
14
+ `}isInline(){return!1}updateDOM(){return!1}};function mv(){return{node:hv()}}function hv(){return Bh(pv)}var gv=Pg({name:`@lexical/react/ReactProvider`});function _v(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=H();if(V(e)){let t=e.anchor,c=t.getNode(),l=0,u=0;if(B(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()),B(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 vv(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=Lm().getChildren();for(let i=0;i<r.length;i++)yv(e,r[i],n,t);return n.innerHTML}function yv(e,t,n,r=null){let i=r===null||t.isSelected(r),a=U(t)&&t.excludeFromCopy(`html`),o=t;r!==null&&B(t)&&(o=Kg(r,t,`clone`));let s=U(o)?o.getChildren():[],c=fm(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=yv(e,a,f,r);!i&&U(t)&&o&&t.extractWithChild(a,r,`html`)&&(i=!0)}if(i&&!a){if((wh(u)||Eh(u))&&u.append(f),n.append(u),d){let e=d.call(o,u);e&&(Eh(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(f);return i}function bv(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 xv(e,t=H()){return t??bv(166),V(t)&&t.isCollapsed()||t.getNodes().length===0?``:vv(e,t)}function Sv(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}var Cv=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,wv=Cv&&`documentMode`in document?document.documentMode:null,Tv=Cv&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ev=!(!Cv||!(`InputEvent`in window)||wv)&&`getTargetRanges`in new window.InputEvent(`input`),Dv=Cv&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ov=Cv&&/Android/.test(navigator.userAgent),kv=Cv&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Ov,Av=Cv&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jv=Cv&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Tv&&!Av;function Mv(e,t){t.update(()=>{if(e!==null){let n=t_(e,KeyboardEvent)?null:e.clipboardData,r=H();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=xv(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Nv(e){return zg(e.registerCommand(Wu,e=>{let t=H();return!!V(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(Xu,e=>{let t=H();return!!V(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(Zu,e=>{let t=H();return!!V(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(qu,e=>{let t=H();if(!V(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)Sv(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(Yu,()=>{let e=H();return!!V(e)&&(e.removeText(),!0)},0),e.registerCommand(Gu,e=>{let t=H();return!!V(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(Ku,()=>{let e=H();return!!V(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(id,e=>{let t=H();if(!V(t))return!1;let n=e,r=n.shiftKey;return!!Yg(t,!0)&&(n.preventDefault(),Qg(t,r,!0),!0)},0),e.registerCommand(nd,e=>{let t=H();if(!V(t))return!1;let n=e,r=n.shiftKey;return!!Yg(t,!1)&&(n.preventDefault(),Qg(t,r,!1),!0)},0),e.registerCommand(ud,t=>!!V(H())&&(!Dv||navigator.language!==`ko-KR`)&&(t.preventDefault(),e.dispatchCommand(Wu,!0)),0),e.registerCommand(fd,t=>!!V(H())&&(t.preventDefault(),e.dispatchCommand(Wu,!1)),0),e.registerCommand(cd,t=>{if(!V(H()))return!1;if(t!==null){if((Dv||kv||jv)&&Ev)return!1;t.preventDefault()}return e.dispatchCommand(Gu,!1)},0),e.registerCommand(bd,()=>(th(),!0),0),e.registerCommand(vd,t=>!!V(H())&&(Mv(t,e),!0),0),e.registerCommand(yd,t=>!!V(H())&&(function(e,t){Mv(e,t),t.update(()=>{let e=H();V(e)&&e.removeText()})}(t,e),!0),0),e.registerCommand(Ju,t=>!!V(H())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=H(),n=t_(e,ClipboardEvent)?e.clipboardData:null;n!=null&&V(t)&&Sv(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(md,e=>!!V(H())&&(e.preventDefault(),!0),0),e.registerCommand(hd,e=>!!V(H())&&(e.preventDefault(),!0),0))}function Pv(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 Fv=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function Iv({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,F.useState)(()=>e.getDecorators());return Fv(()=>e.registerDecoratorListener(e=>{(0,Ri.flushSync)(()=>{r(e)})}),[e]),(0,F.useEffect)(()=>{r(e.getDecorators())},[e]),(0,F.useMemo)(()=>{let r=[],i=Object.keys(n);for(let a=0;a<i.length;a++){let o=i[a],s=(0,I.jsx)(t,{onError:t=>e._onError(t),children:(0,I.jsx)(F.Suspense,{fallback:null,children:n[o]})}),c=e.getElementByKey(o);c!==null&&r.push((0,Ri.createPortal)(s,c,o))}return r},[t,n,e])}(e,t)}function Lv({editor:e,ErrorBoundary:t}){return function(e){let t=fv.maybeFromEditor(e);if(t&&t.hasExtensionByName(gv.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&Pv(320,e);return!0}return!1}(e)?null:(0,I.jsx)(Iv,{editor:e,ErrorBoundary:t})}function Rv(e){return e.getEditorState().read(Ug(e.isComposing()))}function zv({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=$c();return function(e){Fv(()=>zg(Nv(e),_v(e)),[e])}(r),(0,I.jsxs)(I.Fragment,{children:[e,(0,I.jsx)(Bv,{content:t}),(0,I.jsx)(Lv,{editor:r,ErrorBoundary:n})]})}function Bv({content:e}){let[t]=$c(),n=function(e){let[t,n]=(0,F.useState)(()=>Rv(e));return Fv(()=>{function t(){n(Rv(e))}return t(),zg(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=x_();return n?typeof e==`function`?e(r):e:null}function Vv(){return`composer-${Math.random().toString(36).slice(2,10)}`}function Hv(e=``){return{id:Vv(),type:`text`,text:e}}function Uv(e){return{id:Vv(),type:`token`,tokenKind:e.tokenKind,tokenKey:e.tokenKey,label:e.label}}function Wv(e){return e.type===`text`?e.text.length:1}function Gv(){return[Hv(``)]}function Kv(e){return[Hv(e)]}function qv(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?Gv():t}function Jv(e){return e.map(e=>e.type===`text`?e.text:``).join(``)}function Yv(e){return e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Xv(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 Zv(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 Qv(e,t,n,r){return t<=n||e>=r}function $v(e,t,n,r,i){return!n&&r>=i?(e.push(...t),!0):n}function ey(e,t,n,r,i,a,o){let s=Zv(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 ty(e,t,n,r,i,a){return!r&&i<=a?(e.push(...n),!0):(e.push(t),r)}function ny(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=Wv(t),n=s,l=s+e;if(Qv(n,l,i,a)){c=$v(o,r,c,n,a),o.push(t),s=l;continue}c=t.type===`text`?ey(o,t,n,i,a,r,c):ty(o,t,r,c,i,n),s=l}return c||o.push(...r),qv(o)}function ry(e,t){return qv(e.filter(e=>e.type!==`token`||!t(e)))}function iy(e,t){if(!t||t.start!==t.end)return null;let n=Jv(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 ay(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 oy(e){return(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.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,I.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,I.jsx)(`path`,{d:`m4.75 10 2.25-2.5 1.75 1.75 1.25-1.25 2 2`}),(0,I.jsx)(`path`,{d:`M9.75 6.25h.01`})]}):(0,I.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,I.jsx)(`path`,{d:`M8.5 2.75 2.75 6l5.75 3.25L14.25 6 8.5 2.75Z`}),(0,I.jsx)(`path`,{d:`M2.75 10 8.5 13.25 14.25 10`}),(0,I.jsx)(`path`,{d:`M2.75 6v4l5.75 3.25V9.25L2.75 6Z`}),(0,I.jsx)(`path`,{d:`M14.25 6v4L8.5 13.25V9.25L14.25 6Z`})]})}),(0,I.jsx)(`span`,{className:e.tokenKind===`file`?`min-w-0 flex-1 truncate text-[12px] font-medium text-slate-700`:`truncate`,children:e.label})]})}var sy=class e extends Hp{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 cy({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=ay(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,I.jsx)(oy,{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 cy(e){let{composerId:t,label:n,tokenKey:r,tokenKind:i}=e;return _h(new sy(t,i,r,n))}function ly(e){return e instanceof sy}function uy(){let e=Lm(),t=e.getFirstChild();if(!U(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(B(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(ly(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 dy(e){let{descriptors:t,paragraphKey:n,paragraphSize:r,totalLength:i}=uy(),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 fy(e){let{descriptors:t,paragraphKey:n,totalLength:r}=uy();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 py(e){if(e.type===`element`)return fy(e);let{descriptors:t,totalLength:n}=uy(),r=t.find(t=>t.key===e.key);return r?r.start+Math.min(e.offset,r.length):n}function my(){let{descriptors:e}=uy(),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+=`
15
+ `;continue}i();let e=a.node;t.push({id:e.getComposerId(),label:e.getLabel(),tokenKey:e.getTokenKey(),tokenKind:e.getTokenKind(),type:`token`})}return i(),qv(t)}function hy(e){return e.read(()=>{let e=H(),t=my();return V(e)?{nodes:t,selection:{start:Math.min(py(e.anchor),py(e.focus)),end:Math.max(py(e.anchor),py(e.focus))}}:{nodes:t,selection:null}})}function gy(e,t){let n=Lm();n.clear();let r=em();n.append(r);for(let t of qv(e)){if(t.type===`token`){r.append(cy({composerId:t.id,label:t.label,tokenKey:t.tokenKey,tokenKind:t.tokenKind}));continue}let e=t.text.split(`
16
+ `);for(let[t,n]of e.entries())n.length>0&&r.append(Mf(n)),t<e.length-1&&r.append(mf())}if(ly(r.getLastChild())&&r.append(Mf(``)),!t)return;let i=ep(),a=dy(t.start),o=dy(t.end);i.anchor.set(a.key,a.offset,a.type),i.focus.set(o.key,o.offset,o.type),zm(i)}function _y(e,t,n){e.update(()=>{gy(t,n)})}function vy(e,t){e.update(()=>{let e=ep(),n=dy(t.start),r=dy(t.end);e.anchor.set(n.key,n.offset,n.type),e.focus.set(r.key,r.offset,r.type),zm(e)})}function yy(e){return e.reduce((e,t)=>e+Wv(t),0)}function by(e){let{label:t,nodes:n,selection:r,tokenKey:i,tokenKind:a,trigger:o}=e,s=yy(n),[c,l]=r?[Math.min(r.start,r.end),Math.max(r.start,r.end)]:[s,s],u=o?.start??c;return{nodes:ny(n,u,o?.end??l,[Uv({label:t,tokenKey:i,tokenKind:a})]),selection:{start:u+1,end:u+1}}}function xy(e){return e.map(e=>e.type===`text`?`text:${e.id}:${e.text}`:`token:${e.id}:${e.tokenKind}:${e.tokenKey}:${e.label}`).join(``)}function Sy(e){let{nodes:t,selection:n,text:r}=e,i=yy(t),[a,o]=n?[Math.min(n.start,n.end),Math.max(n.start,n.end)]:[i,i],s=a+r.length;return{nodes:ny(t,a,o,[Hv(r)]),selection:{start:s,end:s}}}function Cy(e){let{label:t,nodes:n,selection:r,tokenKey:i}=e;return by({label:t,nodes:n,selection:r,tokenKey:i,tokenKind:`file`})}function wy(e){let{label:t,nodes:n,selection:r,tokenKey:i}=e;return Xv(n,`skill`).includes(i)?{nodes:qv(n),selection:r}:by({label:t,nodes:n,selection:r,tokenKey:i,tokenKind:`skill`,trigger:iy(n,r)})}function Ty(e){let{nextKeys:t,nodes:n,options:r,selection:i}=e,a=Xv(n,`skill`),o=new Map(r.map(e=>[e.key,e])),s=t.find(e=>!a.includes(e));if(s)return wy({label:o.get(s)?.label??s,nodes:n,selection:i,tokenKey:s});let c=a.find(e=>!t.includes(e));return c?{nodes:ry(n,e=>e.tokenKind===`skill`&&e.tokenKey===c),selection:i}:{nodes:qv(n),selection:i}}function Ey(e){let{direction:t,nodes:n,selection:r}=e,i=yy(n),[a,o]=r?[Math.min(r.start,r.end),Math.max(r.start,r.end)]:[i,i],s=a,c=o;if(s===c)if(t===`backward`&&s>0)--s;else if(t===`forward`&&c<i)c+=1;else return{nodes:qv(n),selection:{start:s,end:c}};return{nodes:ny(n,s,c,[]),selection:{start:s,end:s}}}function Dy(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 Oy=class{constructor(e){this.params=e,this.insertSlashItem=e=>{e.value&&(this.params.onSlashItemSelect?.(e),this.params.publishSnapshot(wy({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(Cy({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=Cy({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.focusComposerAtEnd=()=>{this.params.focusComposerAtEnd()},this.syncSelectedSkills=(e,t)=>{this.params.publishSnapshot(Ty({nextKeys:e,nodes:this.params.optionsReader().nodes,options:t,selection:this.params.optionsReader().selection}),{focusAfterSync:!0})}}};function ky(e){return new Oy(e)}function Ay(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 jy(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(Sy({nodes:a().nodes,selection:a().selection,text:o.data})))}function My(e){let{data:t,fallbackSnapshot:n,publishSnapshot:r,snapshotReader:i}=e,a=i(),o=n();r(Ay(o.nodes)===Ay(a.nodes)&&t.length>0?Sy({nodes:a.nodes,selection:a.selection,text:t}):o,{forcePublish:!0})}function Ny(e){let{actions:t,activeSlashIndex:n,nativeEvent:r,onSlashActiveIndexChange:i,onSlashItemSelect:a,onSlashOpenChange:o,onSlashQueryChange:s,publishSnapshot:c,slashItems:l,snapshot:u}=e,d=Dy({activeSlashIndex:n,canStopGeneration:t.canStopGeneration,isComposing:r.isComposing,isSending:t.isSending,isSlashMenuOpen:iy(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(wy({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(Sy({nodes:u.nodes,selection:u.selection,text:`
17
+ `})),!0;case`send-message`:return t.onSend(),!0;case`delete-content`:return c(Ey({direction:d.direction,nodes:u.nodes,selection:u.selection})),!0;case`noop`:return!1}}function Py(e){let[t]=$c();return(0,F.useLayoutEffect)(()=>(e.editorRef.current=t,()=>{e.editorRef.current===t&&(e.editorRef.current=null)}),[t,e.editorRef]),(0,F.useLayoutEffect)(()=>{t.setEditable(!e.disabled)},[t,e.disabled]),(0,F.useLayoutEffect)(()=>{let n=xy(e.nodes),r=e.pendingSelectionRef.current,i=n!==e.editorSignatureRef.current;if(!(!i&&!r)){if(e.isApplyingExternalUpdateRef.current=!0,i?(_y(t,e.nodes,r),e.editorSignatureRef.current=n,e.lastPublishedSignatureRef.current=n):r&&vy(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&&vy(t,n)})}requestAnimationFrame(()=>{e.isApplyingExternalUpdateRef.current=!1})}},[t,e.editorSignatureRef,e.isApplyingExternalUpdateRef,e.lastPublishedSignatureRef,e.nodes,e.pendingSelectionRef,e.selectionRef,e.shouldFocusAfterSyncRef]),(0,F.useEffect)(()=>zg(t.registerUpdateListener(({editorState:t})=>{let n=hy(t),r=xy(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(Ru,()=>{let n=hy(t.getEditorState());return e.selectionRef.current=n.selection,e.isComposingRef.current||e.syncSlashState(n.nodes,n.selection),!1},0),t.registerCommand(Sd,()=>(e.onBlur(),!1),0),t.registerCommand(td,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 Fy=(0,F.forwardRef)(function(e,t){let n=(0,F.useRef)(null),r=(0,F.useRef)(null),i=(0,F.useRef)(null),a=(0,F.useRef)(!1),o=(0,F.useRef)(!1),s=(0,F.useRef)(!1),c=(0,F.useRef)(``),l=(0,F.useRef)(``),u=(t,n)=>{let r=iy(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=hy(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=xy(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;e.getRootElement()?.focus({preventScroll:!0});let t=r.current;t&&vy(e,t),e.focus()},h=()=>{let e=n.current;if(!e)return;let t=hy(e.getEditorState()).nodes.reduce((e,t)=>e+(t.type===`text`?t.text.length:1),0),i={start:t,end:t};r.current=i,e.getRootElement()?.focus({preventScroll:!0}),vy(e,i),e.focus()},g=()=>({nodes:d(),selection:f()});return(0,F.useImperativeHandle)(t,()=>ky({focusComposer:m,focusComposerAtEnd:h,onSlashItemSelect:e.onSlashItemSelect,optionsReader:g,publishSnapshot:p}),[e.onSlashItemSelect]),(0,I.jsxs)(f_,{initialConfig:(0,F.useMemo)(()=>({editable:!e.disabled,editorState:()=>{gy(e.nodes,null)},namespace:`NextClawChatComposerLexical`,nodes:[sy],onError:e=>{throw e},theme:{}}),[e.disabled,e.nodes]),children:[(0,I.jsx)(`div`,{className:`px-3 py-2 sm:px-4 sm:py-2.5`,children:(0,I.jsx)(`div`,{className:`min-h-11 sm:min-h-[60px]`,children:(0,I.jsx)(zv,{contentEditable:(0,I.jsx)(o_,{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=>{jy({disabled:e.disabled,event:t,isComposing:o.current,publishSnapshot:p,snapshotReader:g})},onCompositionEnd:e=>{o.current=!1;let t=e.nativeEvent;My({data:typeof t.data==`string`?t.data:``,fallbackSnapshot:()=>{let e=n.current;return e?hy(e.getEditorState()):g()},publishSnapshot:p,snapshotReader:g})},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,I.jsx)(`div`,{className:`pointer-events-none absolute left-3 top-2 select-none text-sm leading-6 text-gray-400 sm:left-4 sm:top-2.5`,children:e.placeholder}),ErrorBoundary:v_})})}),(0,I.jsx)(p_,{editorRef:n}),(0,I.jsx)(Py,{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=hy(i.getEditorState());return r.current=a.selection,Ny({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})]})});Fy.displayName=`LexicalChatInputBarTokenizedComposer`;function Iy({hint:e}){return e?e.loading?(0,I.jsx)(`div`,{className:`px-4 pb-2`,children:(0,I.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`h-3 w-28 animate-pulse rounded bg-gray-200`}),(0,I.jsx)(`span`,{className:`h-3 w-16 animate-pulse rounded bg-gray-200`})]})}):(0,I.jsx)(`div`,{className:`px-4 pb-2`,children:(0,I.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,I.jsx)(`span`,{children:e.text}):null,e.actionLabel&&e.onAction?(0,I.jsx)(`button`,{type:`button`,onClick:e.onAction,className:`font-semibold underline-offset-2 hover:underline`,children:e.actionLabel}):null]})}):null}var Ly=(0,F.forwardRef)(function(e,t){let n=(0,F.useRef)(null),r=(0,F.useRef)(!1),[i,a]=(0,F.useState)(0),[o,s]=(0,F.useState)(null),[c,l]=(0,F.useState)(null),u=o!==null&&c!==o,d=e.slashMenu.items[i]??null,f=()=>o!==null&&!r.current?l(o):void 0;(0,F.useEffect)(()=>{a(t=>e.slashMenu.items.length===0?0:Math.min(t,e.slashMenu.items.length-1))},[e.slashMenu.items.length]),(0,F.useEffect)(()=>{o===null&&c!==null&&l(null)},[o,c]);let p=(0,F.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,F.useImperativeHandle)(t,()=>({insertFileToken:(e,t)=>n.current?.insertFileToken(e,t),insertFileTokens:e=>n.current?.insertFileTokens(e),focusComposer:()=>n.current?.focusComposer(),focusComposerAtEnd:()=>n.current?.focusComposerAtEnd()}),[]),(0,I.jsx)(`div`,{className:`border-t border-gray-200/80 bg-white p-4`,children:(0,I.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)]`,children:(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-card`,children:[(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(Fy,{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:i,onNodesChange:e.composer.onNodesChange,onFilesAdd:e.composer.onFilesAdd,onSlashQueryChange:t=>{t===null&&r.current||(t!==null&&a(0),e.composer.onSlashQueryChange?.(t))},onSlashTriggerChange:e=>{s(e?.start??null)},onSlashOpenChange:e=>{e||f()},onSlashActiveIndexChange:a}),(0,I.jsx)(Pc,{isOpen:u,isLoading:e.slashMenu.isLoading,items:e.slashMenu.items,activeIndex:i,activeItem:d,texts:e.slashMenu.texts,onSelectItem:e=>{l(null),n.current?.insertSlashItem(e)},onOpenChange:e=>{e||f()},onDetailsPointerDown:()=>{r.current=!0,requestAnimationFrame(()=>{r.current=!1})},onSetActiveIndex:a})]}),(0,I.jsx)(Iy,{hint:e.hint}),(0,I.jsx)(Xc,{...p})]})})})});Ly.displayName=`ChatInputBar`;function Ry({role:e}){return e===`user`?(0,I.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,I.jsx)(wr,{className:`h-4 w-4`})}):e===`tool`?(0,I.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,I.jsx)(vt,{className:`h-4 w-4`})}):(0,I.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,I.jsx)(Fn,{className:`h-[18px] w-[18px] text-white/95`,strokeWidth:2.5})})}function zy(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var By=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vy=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hy={};function Uy(e,t){return((t||Hy).jsx?Vy:By).test(e)}var Wy=/[ \t\n\f\r]/g;function Gy(e){return typeof e==`object`?e.type===`text`?Ky(e.value):!1:Ky(e)}function Ky(e){return e.replace(Wy,``)===``}var qy=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};qy.prototype.normal={},qy.prototype.property={},qy.prototype.space=void 0;function Jy(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new qy(n,r,t)}function Yy(e){return e.toLowerCase()}var Xy=class{constructor(e,t){this.attribute=t,this.property=e}};Xy.prototype.attribute=``,Xy.prototype.booleanish=!1,Xy.prototype.boolean=!1,Xy.prototype.commaOrSpaceSeparated=!1,Xy.prototype.commaSeparated=!1,Xy.prototype.defined=!1,Xy.prototype.mustUseProperty=!1,Xy.prototype.number=!1,Xy.prototype.overloadedBoolean=!1,Xy.prototype.property=``,Xy.prototype.spaceSeparated=!1,Xy.prototype.space=void 0;var Zy=e({boolean:()=>K,booleanish:()=>$y,commaOrSpaceSeparated:()=>rb,commaSeparated:()=>nb,number:()=>q,overloadedBoolean:()=>eb,spaceSeparated:()=>tb}),Qy=0,K=ib(),$y=ib(),eb=ib(),q=ib(),tb=ib(),nb=ib(),rb=ib();function ib(){return 2**++Qy}var ab=Object.keys(Zy),ob=class extends Xy{constructor(e,t,n,r){let i=-1;if(super(e,t),sb(this,`space`,r),typeof n==`number`)for(;++i<ab.length;){let e=ab[i];sb(this,ab[i],(n&Zy[e])===Zy[e])}}};ob.prototype.defined=!0;function sb(e,t,n){n&&(e[t]=n)}function cb(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ob(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Yy(r)]=r,n[Yy(a.attribute)]=r}return new qy(t,n,e.space)}var lb=cb({properties:{ariaActiveDescendant:null,ariaAtomic:$y,ariaAutoComplete:null,ariaBusy:$y,ariaChecked:$y,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:tb,ariaCurrent:null,ariaDescribedBy:tb,ariaDetails:null,ariaDisabled:$y,ariaDropEffect:tb,ariaErrorMessage:null,ariaExpanded:$y,ariaFlowTo:tb,ariaGrabbed:$y,ariaHasPopup:null,ariaHidden:$y,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tb,ariaLevel:q,ariaLive:null,ariaModal:$y,ariaMultiLine:$y,ariaMultiSelectable:$y,ariaOrientation:null,ariaOwns:tb,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:$y,ariaReadOnly:$y,ariaRelevant:null,ariaRequired:$y,ariaRoleDescription:tb,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:$y,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ub(e,t){return t in e?e[t]:t}function db(e,t){return ub(e,t.toLowerCase())}var fb=cb({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:nb,acceptCharset:tb,accessKey:tb,action:null,allow:null,allowFullScreen:K,allowPaymentRequest:K,allowUserMedia:K,alt:null,as:null,async:K,autoCapitalize:null,autoComplete:tb,autoFocus:K,autoPlay:K,blocking:tb,capture:null,charSet:null,checked:K,cite:null,className:tb,cols:q,colSpan:null,content:null,contentEditable:$y,controls:K,controlsList:tb,coords:q|nb,crossOrigin:null,data:null,dateTime:null,decoding:null,default:K,defer:K,dir:null,dirName:null,disabled:K,download:eb,draggable:$y,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:K,formTarget:null,headers:tb,height:q,hidden:eb,high:q,href:null,hrefLang:null,htmlFor:tb,httpEquiv:tb,id:null,imageSizes:null,imageSrcSet:null,inert:K,inputMode:null,integrity:null,is:null,isMap:K,itemId:null,itemProp:tb,itemRef:tb,itemScope:K,itemType:tb,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:K,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:K,muted:K,name:null,nonce:null,noModule:K,noValidate:K,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:K,optimum:q,pattern:null,ping:tb,placeholder:null,playsInline:K,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:K,referrerPolicy:null,rel:tb,required:K,reversed:K,rows:q,rowSpan:q,sandbox:tb,scope:null,scoped:K,seamless:K,selected:K,shadowRootClonable:K,shadowRootDelegatesFocus:K,shadowRootMode:null,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:$y,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:K,useMap:null,value:$y,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tb,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:K,declare:K,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:K,noHref:K,noShade:K,noWrap:K,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:$y,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:K,disableRemotePlayback:K,prefix:null,property:null,results:q,security:null,unselectable:null},space:`html`,transform:db}),pb=cb({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:rb,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:tb,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:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:K,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,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:nb,g2:nb,glyphName:nb,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:rb,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,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:q,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:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tb,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rb,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rb,rev:rb,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rb,requiredFeatures:rb,requiredFonts:rb,requiredFormats:rb,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:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:rb,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rb,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rb,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ub}),mb=cb({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()}}),hb=cb({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:db}),gb=cb({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),_b={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`},vb=/[A-Z]/g,yb=/-[a-z]/g,bb=/^data[-\w.:]+$/i;function xb(e,t){let n=Yy(t),r=t,i=Xy;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&bb.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(yb,Cb);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!yb.test(e)){let n=e.replace(vb,Sb);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ob}return new i(r,t)}function Sb(e){return`-`+e.toLowerCase()}function Cb(e){return e.charAt(1).toUpperCase()}var wb=Jy([lb,fb,mb,hb,gb],`html`),Tb=Jy([lb,pb,mb,hb,gb],`svg`);function Eb(e){return e.join(` `).trim()}var Db=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=`
18
+ `,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 D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Ob=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(Db());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}})),kb=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))}})),Ab=a(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Ob()),r=kb();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})),jb=Nb(`end`),Mb=Nb(`start`);function Nb(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 Pb(e){let t=Mb(e),n=jb(e);if(t&&n)return{start:t,end:n}}function Fb(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Lb(e.position):`start`in e||`end`in e?Lb(e):`line`in e||`column`in e?Ib(e):``}function Ib(e){return Rb(e&&e.line)+`:`+Rb(e&&e.column)}function Lb(e){return Ib(e&&e.start)+`-`+Ib(e&&e.end)}function Rb(e){return e&&typeof e==`number`?e:1}var zb=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=Fb(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}};zb.prototype.file=``,zb.prototype.name=``,zb.prototype.reason=``,zb.prototype.message=``,zb.prototype.stack=``,zb.prototype.column=void 0,zb.prototype.line=void 0,zb.prototype.ancestors=void 0,zb.prototype.cause=void 0,zb.prototype.fatal=void 0,zb.prototype.place=void 0,zb.prototype.ruleId=void 0,zb.prototype.source=void 0;var Bb=g(Ab(),1),Vb={}.hasOwnProperty,Hb=new Map,Ub=/[A-Z]/g,Wb=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Gb=new Set([`td`,`th`]),Kb=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function qb(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=ix(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=rx(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`?Tb:wb,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Jb(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Jb(e,t,n){if(t.type===`element`)return Yb(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Xb(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Qb(e,t,n);if(t.type===`mdxjsEsm`)return Zb(e,t);if(t.type===`root`)return $b(e,t,n);if(t.type===`text`)return ex(e,t)}function Yb(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Tb,e.schema=i),e.ancestors.push(t);let a=ux(e,t.tagName,!1),o=ax(e,t),s=sx(e,t);return Wb.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Gy(e):!0})),tx(e,o,a,t),nx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Xb(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)}dx(e,t.position)}function Zb(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);dx(e,t.position)}function Qb(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Tb,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:ux(e,t.name,!0),o=ox(e,t),s=sx(e,t);return tx(e,o,a,t),nx(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function $b(e,t,n){let r={};return nx(r,sx(e,t)),e.create(t,e.Fragment,r,n)}function ex(e,t){return t.value}function tx(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nx(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function rx(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 ix(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Mb(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 ax(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Vb.call(t.properties,i)){let a=cx(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Gb.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 ox(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 dx(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 dx(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function sx(e,t){let n=[],r=-1,i=e.passKeys?new Map:Hb;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=Jb(e,a,o);s!==void 0&&n.push(s)}return n}function cx(e,t,n){let r=xb(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?zy(n):Eb(n)),r.property===`style`){let t=typeof n==`object`?n:lx(e,String(n));return e.stylePropertyNameCase===`css`&&(t=fx(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?_b[r.property]||r.property:r.attribute,n]}}function lx(e,t){try{return(0,Bb.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new zb("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=Kb+`#cannot-parse-style-attribute`,r}}function ux(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=Uy(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=Uy(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Vb.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);dx(e)}function dx(e,t){let n=new zb("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=Kb+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function fx(e){let t={},n;for(n in e)Vb.call(e,n)&&(t[px(n)]=e[n]);return t}function px(e){let t=e.replace(Ub,mx);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function mx(e){return`-`+e.toLowerCase()}var hx={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`]},gx={};function _x(e,t){let n=t||gx;return vx(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function vx(e,t,n){if(bx(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 yx(e.children,t,n)}return Array.isArray(e)?yx(e,t,n):``}function yx(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=vx(e[i],t,n);return r.join(``)}function bx(e){return!!(e&&typeof e==`object`)}var xx=document.createElement(`i`);function Sx(e){let t=`&`+e+`;`;xx.innerHTML=t;let n=xx.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Cx(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 wx(e,t){return e.length>0?(Cx(e,e.length,0,t),e):t}var Tx={}.hasOwnProperty;function Ex(e){let t={},n=-1;for(;++n<e.length;)Dx(t,e[n]);return t}function Dx(e,t){let n;for(n in t){let r=(Tx.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Tx.call(r,a)||(r[a]=[]);let e=i[a];Ox(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ox(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Cx(e,0,0,r)}function kx(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 Ax(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var jx=Vx(/[A-Za-z]/),Mx=Vx(/[\dA-Za-z]/),Nx=Vx(/[#-'*+\--9=?A-Z^-~]/);function Px(e){return e!==null&&(e<32||e===127)}var Fx=Vx(/\d/),Ix=Vx(/[\dA-Fa-f]/),Lx=Vx(/[!-/:-@[-`{-~]/);function J(e){return e!==null&&e<-2}function Rx(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var zx=Vx(/\p{P}|\p{S}/u),Bx=Vx(/\s/);function Vx(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Hx(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Mx(e.charCodeAt(n+1))&&Mx(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 Ux={tokenize:Wx};function Wx(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 J(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Gx={tokenize:qx},Kx={tokenize:Jx};function qx(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 Cx(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(Kx,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(Kx,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 J(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++;Cx(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 Jx(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 Yx(e){if(e===null||Rx(e)||Bx(e))return 1;if(zx(e))return 2}function Xx(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 Zx={name:`attention`,resolveAll:Qx,tokenize:$x};function Qx(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};eS(d,-c),eS(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=wx(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=wx(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=wx(l,Xx(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=wx(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=wx(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Cx(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 $x(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Yx(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=Yx(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 eS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var tS={name:`autolink`,tokenize:nS};function nS(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 jx(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Mx(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||Mx(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||Px(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Nx(t)?(e.consume(t),l):n(t)}function u(e){return Mx(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||Mx(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var rS={partial:!0,tokenize:iS};function iS(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||J(e)?t(e):n(e)}}var aS={continuation:{tokenize:sS},exit:cS,name:`blockQuote`,tokenize:oS};function oS(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 sS(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(aS,t,n)(r)}}function cS(e){e.exit(`blockQuote`)}var lS={name:`characterEscape`,tokenize:uS};function uS(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 Lx(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var dS={name:`characterReference`,tokenize:fS};function fS(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=Mx,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=Ix,u):(e.enter(`characterReferenceValue`),a=7,o=Fx,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Mx&&!Sx(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 pS={partial:!0,tokenize:gS},mS={concrete:!0,name:`codeFenced`,tokenize:hS};function hS(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||J(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(pS,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||J(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||J(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||J(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||J(t)?e.check(pS,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||J(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||J(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function gS(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 _S={name:`codeIndented`,tokenize:yS},vS={partial:!0,tokenize:bS};function yS(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):J(t)?e.attempt(vS,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||J(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function bS(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):J(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):J(e)?i(e):n(e)}}var xS={name:`codeText`,previous:CS,resolve:SS,tokenize:wS};function SS(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 CS(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function wS(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)):J(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||J(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 TS=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&&ES(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),ES(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ES(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);ES(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);ES(this.left,t.reverse())}}};function ES(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 DS(e){let t={},n=-1,r,i,a,o,s,c,l,u=new TS(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,OS(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 Cx(e,0,1/0,u.slice(0)),!l}function OS(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 kS={resolve:jS,tokenize:MS},AS={partial:!0,tokenize:NS};function jS(e){return DS(e),e}function MS(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):J(t)?e.check(AS,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 NS(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||J(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 PS(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||Px(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||J(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||Rx(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||Px(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 FS(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):J(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||J(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 IS(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):J(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||J(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 LS(e,t){let n;return r;function r(i){return J(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 RS={name:`definition`,tokenize:BS},zS={partial:!0,tokenize:VS};function BS(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return FS.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Ax(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 Rx(t)?LS(e,l)(t):l(t)}function l(t){return PS(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(zS,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||J(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function VS(e,t,n){return r;function r(t){return Rx(t)?LS(e,i)(t):n(t)}function i(t){return IS(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||J(e)?t(e):n(e)}}var HS={name:`hardBreakEscape`,tokenize:US};function US(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return J(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var WS={name:`headingAtx`,resolve:GS,tokenize:KS};function GS(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`},Cx(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function KS(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||Rx(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||J(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||Rx(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var qS=`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(`.`),JS=[`pre`,`script`,`style`,`textarea`],YS={concrete:!0,name:`htmlFlow`,resolveTo:QS,tokenize:$S},XS={partial:!0,tokenize:tC},ZS={partial:!0,tokenize:eC};function QS(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 $S(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:re):jx(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):jx(a)?(e.consume(a),i=4,r.interrupt?t:re):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:re):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return jx(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Rx(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&JS.includes(l)?(i=1,r.interrupt?t(s):O(s)):qS.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Mx(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):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||jx(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||Mx(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||J(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||Rx(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),D):n(t)}function D(t){return t===null||J(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),te):t===62&&i===4?(e.consume(t),ie):t===63&&i===3?(e.consume(t),re):t===93&&i===5?(e.consume(t),ne):J(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(XS,ae,k)(t)):t===null||J(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(ZS,A,ae)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return t===null||J(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),re):O(t)}function te(t){return t===47?(e.consume(t),o=``,M):O(t)}function M(t){if(t===62){let n=o.toLowerCase();return JS.includes(n)?(e.consume(t),ie):O(t)}return jx(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),M):O(t)}function ne(t){return t===93?(e.consume(t),re):O(t)}function re(t){return t===62?(e.consume(t),ie):t===45&&i===2?(e.consume(t),re):O(t)}function ie(t){return t===null||J(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),ie)}function ae(n){return e.exit(`htmlFlow`),t(n)}}function eC(e,t,n){let r=this;return i;function i(t){return J(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 tC(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(rS,t,n)}}var nC={name:`htmlText`,tokenize:rC};function rC(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):jx(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):jx(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):J(t)?(o=d,te(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(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):J(t)?(o=h,te(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):J(t)?(o=v,te(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):J(t)?(o=y,te(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return jx(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Mx(t)?(e.consume(t),S):C(t)}function C(t){return J(t)?(o=C,te(t)):Y(t)?(e.consume(t),C):j(t)}function w(t){return t===45||Mx(t)?(e.consume(t),w):t===47||t===62||Rx(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||jx(t)?(e.consume(t),E):J(t)?(o=T,te(t)):Y(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||Mx(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):J(t)?(o=D,te(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):J(t)?(o=O,te(t)):Y(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,ee):t===null?n(t):J(t)?(o=k,te(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Rx(t)?T(t):(e.consume(t),A)}function ee(e){return e===47||e===62||Rx(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function te(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),M}function M(t){return Y(t)?X(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var iC={name:`labelEnd`,resolveAll:cC,resolveTo:lC,tokenize:uC},aC={tokenize:dC},oC={tokenize:fC},sC={tokenize:pC};function cC(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&&Cx(e,0,e.length,n),e}function lC(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=wx(s,e.slice(a+1,a+r+3)),s=wx(s,[[`enter`,u,t]]),s=wx(s,Xx(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=wx(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=wx(s,e.slice(o+1)),s=wx(s,[[`exit`,c,t]]),Cx(e,a,e.length,s),e}function uC(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(Ax(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(aC,u,o?u:d)(t):t===91?e.attempt(oC,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(sC,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function dC(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 Rx(t)?LS(e,a)(t):a(t)}function a(t){return t===41?u(t):PS(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Rx(t)?LS(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?IS(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Rx(t)?LS(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 fC(e,t,n){let r=this;return i;function i(t){return FS.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Ax(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function pC(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 mC={name:`labelStartImage`,resolveAll:iC.resolveAll,tokenize:hC};function hC(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 gC={name:`labelStartLink`,resolveAll:iC.resolveAll,tokenize:_C};function _C(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 vC={name:`lineEnding`,tokenize:yC};function yC(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var bC={name:`thematicBreak`,tokenize:xC};function xC(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||J(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 SC={continuation:{tokenize:EC},exit:OC,name:`list`,tokenize:TC},CC={partial:!0,tokenize:kC},wC={partial:!0,tokenize:DC};function TC(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:Fx(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(bC,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 Fx(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(rS,r.interrupt?n:u,e.attempt(CC,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 EC(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(rS,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(wC,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(SC,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function DC(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 OC(e){e.exit(this.containerState.type)}function kC(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 AC={name:`setextUnderline`,resolveTo:jC,tokenize:MC};function jC(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 MC(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||J(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var NC={tokenize:PC};function PC(e){let t=this,n=e.attempt(rS,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(kS,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 FC={resolveAll:zC()},IC=RC(`string`),LC=RC(`text`);function RC(e){return{resolveAll:zC(e===`text`?BC: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 zC(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 BC(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 VC=e({attentionMarkers:()=>YC,contentInitial:()=>UC,disable:()=>XC,document:()=>HC,flow:()=>GC,flowInitial:()=>WC,insideSpan:()=>JC,string:()=>KC,text:()=>qC}),HC={42:SC,43:SC,45:SC,48:SC,49:SC,50:SC,51:SC,52:SC,53:SC,54:SC,55:SC,56:SC,57:SC,62:aS},UC={91:RS},WC={[-2]:_S,[-1]:_S,32:_S},GC={35:WS,42:bC,45:[AC,bC],60:YS,61:AC,95:bC,96:mS,126:mS},KC={38:dS,92:lS},qC={[-5]:vC,[-4]:vC,[-3]:vC,33:mC,38:dS,42:Zx,60:[tS,nC],91:gC,92:[HS,lS],93:iC,95:Zx,96:xS},JC={null:[Zx,FC]},YC={null:[42,95]},XC={null:[]};function ZC(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=wx(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Xx(a,l.events,l),l.events):[]}function f(e,t){return $C(p(e),t)}function p(e){return QC(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){J(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&&Cx(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 QC(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 $C(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=`
19
+ `;break;case-3:o=`\r
20
+ `;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 ew(e){let t={constructs:Ex([VC,...(e||{}).extensions||[]]),content:n(Ux),defined:[],document:n(Gx),flow:n(NC),lazy:{},string:n(IC),text:n(LC)};return t;function n(e){return n;function n(n){return ZC(t,e,n)}}}function tw(e){for(;!DS(e););return e}var nw=/[\0\t\n\r]/g;function rw(){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(nw.lastIndex=u,c=nw.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 iw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function aw(e){return e.replace(iw,ow)}function ow(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return kx(n.slice(t?2:1),t?16:10)}return Sx(n)||e}var sw={}.hasOwnProperty;function cw(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),lw(n)(tw(ew(n).document().write(rw()(e,t,!0))))}function lw(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Se),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ve),blockQuote:a(pe),characterEscape:T,characterReference:T,codeFenced:a(me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(me,o),codeText:a(he,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(be,o),htmlFlowData:T,htmlText:a(be,o),htmlTextData:T,image:a(xe),label:o,link:a(Se),listItem:a(we),listItemValue:f,listOrdered:a(Ce,d),listUnordered:a(Ce),paragraph:a(Te),reference:oe,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ve),strong:a(Ee),thematicBreak:a(Oe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ue,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(ee),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(te),label:ne,labelText:M,lineEnding:D,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:re,resourceTitleString:ie,resource:ae,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};dw(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]];sw.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]||pw).call(a,void 0,e[0])}for(r.position={start:uw(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:uw(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:uw(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]||pw).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Fb({start:e.start,end:e.end})+`): it’s not open`);n.position.end=uw(e.end)}function u(){return _x(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=Ax(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=De(),n.position={start:uw(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=uw(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=uw(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 O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){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 te(){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 M(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=aw(t),n.identifier=Ax(t).toLowerCase()}function ne(){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 re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Ax(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=kx(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Sx(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=uw(e.end)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[]}}function me(){return{type:`code`,lang:null,meta:null,value:``}}function he(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function ve(){return{type:`heading`,depth:0,children:[]}}function ye(){return{type:`break`}}function be(){return{type:`html`,value:``}}function xe(){return{type:`image`,title:null,url:``,alt:null}}function Se(){return{type:`link`,title:null,url:``,children:[]}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Te(){return{type:`paragraph`,children:[]}}function Ee(){return{type:`strong`,children:[]}}function De(){return{type:`text`,value:``}}function Oe(){return{type:`thematicBreak`}}}function uw(e){return{line:e.line,column:e.column,offset:e.offset}}function dw(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?dw(e,r):fw(e,r)}}function fw(e,t){let n;for(n in t)if(sw.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 pw(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Fb({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fb({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Fb({start:t.start,end:t.end})+`) is still open`)}function mw(e){let t=this;t.parser=n;function n(n){return cw(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function hw(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 gw(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
21
+ `}]}function _w(e,t){let n=t.value?t.value+`
22
+ `:``,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 vw(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yw(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bw(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Hx(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 xw(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 Sw(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Cw(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 ww(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cw(e,t);let i={src:Hx(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 Tw(e,t){let n={src:Hx(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 Ew(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 Dw(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cw(e,t);let i={href:Hx(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 Ow(e,t){let n={href:Hx(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 kw(e,t,n){let r=e.all(t),i=n?Aw(n):jw(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:`
23
+ `}),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:`
24
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Aw(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=jw(n[r])}return t}function jw(e){return e.spread??e.children.length>1}function Mw(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 Nw(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Pw(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Fw(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Iw(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=Mb(t.children[1]),o=jb(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 Lw(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 Rw(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var zw=9,Bw=32;function Vw(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Hw(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Hw(t.slice(i),i>0,!1)),a.join(``)}function Hw(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===zw||t===Bw;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===zw||t===Bw;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Uw(e,t){let n={type:`text`,value:Vw(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Ww(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Gw={blockquote:hw,break:gw,code:_w,delete:vw,emphasis:yw,footnoteReference:bw,heading:xw,html:Sw,imageReference:ww,image:Tw,inlineCode:Ew,linkReference:Dw,link:Ow,listItem:kw,list:Mw,paragraph:Nw,root:Pw,strong:Fw,table:Iw,tableCell:Rw,tableRow:Lw,text:Uw,thematicBreak:Ww,toml:Kw,yaml:Kw,definition:Kw,footnoteDefinition:Kw};function Kw(){}var qw=typeof self==`object`?self:globalThis,Jw=(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 qw[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 qw[a](o),i)};return r},Yw=e=>Jw(new Map,e)(0),Xw=``,{toString:Zw}={},{keys:Qw}=Object,$w=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Zw.call(e).slice(8,-1);switch(n){case`Array`:return[1,Xw];case`Object`:return[2,Xw];case`Date`:return[3,Xw];case`RegExp`:return[4,Xw];case`Map`:return[5,Xw];case`Set`:return[6,Xw];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},eT=([e,t])=>e===0&&(t===`function`||t===`symbol`),tT=(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]=$w(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 Qw(r))(e||!eT($w(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||!(eT($w(n))||eT($w(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!eT($w(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},nT=(e,{json:t,lossy:n}={})=>{let r=[];return tT(!(t||n),!!t,new Map,r)(e),r},rT=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Yw(nT(e,t)):structuredClone(e):(e,t)=>Yw(nT(e,t));function iT(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 aT(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function oT(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||iT,r=e.options.footnoteBackLabel||aT,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=Hx(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:{...rT(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
25
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
26
+ `}]}}var sT=(function(e){if(e==null)return fT;if(typeof e==`function`)return dT(e);if(typeof e==`object`)return Array.isArray(e)?cT(e):lT(e);if(typeof e==`string`)return uT(e);throw Error(`Expected function, string, or object as test`)});function cT(e){let t=[],n=-1;for(;++n<e.length;)t[n]=sT(e[n]);return dT(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function lT(e){let t=e;return dT(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function uT(e){return dT(t);function t(t){return t&&t.type===e}}function dT(e){return t;function t(t,n,r){return!!(pT(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function fT(){return!0}function pT(e){return typeof e==`object`&&!!e&&`type`in e}function mT(e){return e}var hT=[];function gT(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=sT(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 (`+mT(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=hT,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=_T(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 _T(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?hT:[e]}function vT(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),gT(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 yT={}.hasOwnProperty,bT={};function xT(e,t){let n=t||bT,r=new Map,i=new Map,a={all:s,applyData:CT,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Gw,...n.handlers},one:o,options:n,patch:ST,wrap:TT};return vT(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(yT.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=rT(n);return r.children=a.all(e),r}return rT(e)}return(a.options.unknownHandler||wT)(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=ET(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=ET(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function ST(e,t){e.position&&(t.position=Pb(e))}function CT(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,rT(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function wT(e,t){let n=t.data||{},r=`value`in t&&!(yT.call(n,`hProperties`)||yT.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 TT(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
27
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
28
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
29
+ `}),n}function ET(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function DT(e,t){let n=xT(e,t),r=n.one(e,void 0),i=oT(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
30
+ `},i)),a}function OT(e,t){return e&&`run`in e?async function(n,r){let i=DT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return DT(n,{file:r,...e||t})}}function kT(e){if(e)throw e}var AT=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 jT(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 MT(){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?NT(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 NT(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 PT={basename:FT,dirname:IT,extname:LT,join:RT,sep:`/`};function FT(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);VT(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 IT(e){if(VT(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 LT(e){VT(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 RT(...e){let t=-1,n;for(;++t<e.length;)VT(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:zT(n)}function zT(e){VT(e);let t=e.codePointAt(0)===47,n=BT(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function BT(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 VT(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var HT={cwd:UT};function UT(){return`/`}function WT(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function GT(e){if(typeof e==`string`)e=new URL(e);else if(!WT(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 KT(e)}function KT(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 qT=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],JT=class{constructor(e){let t;t=e?WT(e)?{path:e}:typeof e==`string`||QT(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:HT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<qT.length;){let e=qT[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)qT.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?PT.basename(this.path):void 0}set basename(e){XT(e,`basename`),YT(e,`basename`),this.path=PT.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?PT.dirname(this.path):void 0}set dirname(e){ZT(this.basename,`dirname`),this.path=PT.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?PT.extname(this.path):void 0}set extname(e){if(YT(e,`extname`),ZT(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=PT.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){WT(e)&&(e=GT(e)),XT(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?PT.basename(this.path,this.extname):void 0}set stem(e){XT(e,`stem`),YT(e,`stem`),this.path=PT.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 zb(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 YT(e,t){if(e&&e.includes(PT.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+PT.sep+"`")}function XT(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function ZT(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function QT(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var $T=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),eE=g(AT(),1),tE={}.hasOwnProperty,nE=new class e extends $T{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=MT()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,eE.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(aE(`data`,this.frozen),this.namespace[e]=t,this):tE.call(this.namespace,e)&&this.namespace[e]||void 0:e?(aE(`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=cE(e),n=this.parser||this.Parser;return rE(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),rE(`process`,this.parser||this.Parser),iE(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=cE(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);uE(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(),rE(`processSync`,this.parser||this.Parser),iE(`processSync`,this.compiler||this.Compiler),this.process(e,r),sE(`processSync`,`process`,t),n;function r(e,r){t=!0,kT(e),n=r}}run(e,t,n){oE(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=cE(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),sE(`runSync`,`run`,n),r;function i(e,t){kT(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=cE(t),r=this.compiler||this.Compiler;return iE(`stringify`,r),oE(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(aE(`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,eE.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];jT(o)&&jT(r)&&(r=(0,eE.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function rE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function iE(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function aE(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 oE(e){if(!jT(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function sE(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function cE(e){return lE(e)?e:new JT(e)}function lE(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function uE(e){return typeof e==`string`||dE(e)}function dE(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var fE=[],pE={allowDangerousHtml:!0},mE=/^(https?|ircs?|mailto|xmpp)$/i,hE=[{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 gE(e){let t=_E(e),n=vE(e);return yE(t.runSync(t.parse(n),n),e)}function _E(e){let t=e.rehypePlugins||fE,n=e.remarkPlugins||fE,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pE}:pE;return nE().use(mw).use(n).use(OT,r).use(t)}function vE(e){let t=e.children||``,n=new JT;return typeof t==`string`?n.value=t:``+t,n}function yE(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||bE;for(let e of hE)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return vT(e,l),qb(e,{Fragment:I.Fragment,components:i,ignoreInvalidStyle:!0,jsx:I.jsx,jsxs:I.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 hx)if(Object.hasOwn(hx,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=hx[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 bE(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||mE.test(e.slice(0,t))?e:``}function xE(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 SE(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function CE(e,t,n){let r=sT((n||{}).ignore||[]),i=wE(t),a=-1;for(;++a<i.length;)gT(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 wE(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([TE(e[0]),EE(e[1])])}return t}function TE(e){return typeof e==`string`?new RegExp(SE(e),`g`):e}function EE(e){return typeof e==`function`?e:function(){return e}}var DE=`phrasing`,OE=[`autolink`,`link`,`image`,`label`];function kE(){return{transforms:[LE],enter:{literalAutolink:jE,literalAutolinkEmail:ME,literalAutolinkHttp:ME,literalAutolinkWww:ME},exit:{literalAutolink:IE,literalAutolinkEmail:FE,literalAutolinkHttp:NE,literalAutolinkWww:PE}}}function AE(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:DE,notInConstruct:OE},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:DE,notInConstruct:OE},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:DE,notInConstruct:OE}]}}function jE(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function ME(e){this.config.enter.autolinkProtocol.call(this,e)}function NE(e){this.config.exit.autolinkProtocol.call(this,e)}function PE(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 FE(e){this.config.exit.autolinkEmail.call(this,e)}function IE(e){this.exit(e)}function LE(e){CE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,RE],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,zE]],{ignore:[`link`,`linkReference`]})}function RE(e,t,n,r,i){let a=``;if(!HE(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!BE(n)))return!1;let o=VE(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 zE(e,t,n,r){return!HE(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function BE(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 VE(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=xE(e,`(`),a=xE(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 HE(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Bx(n)||zx(n))&&(!t||n!==47)}QE.peek=ZE;function UE(){this.buffer()}function WE(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function GE(){this.buffer()}function KE(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function qE(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ax(this.sliceSerialize(e)).toLowerCase(),n.label=t}function JE(e){this.exit(e)}function YE(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ax(this.sliceSerialize(e)).toLowerCase(),n.label=t}function XE(e){this.exit(e)}function ZE(){return`[`}function QE(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 $E(){return{enter:{gfmFootnoteCallString:UE,gfmFootnoteCall:WE,gfmFootnoteDefinitionLabelString:GE,gfmFootnoteDefinition:KE},exit:{gfmFootnoteCallString:qE,gfmFootnoteCall:JE,gfmFootnoteDefinitionLabelString:YE,gfmFootnoteDefinition:XE}}}function eD(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:QE},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?`
31
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?nD:tD))),s(),o}}function tD(e,t,n){return t===0?e:nD(e,t,n)}function nD(e,t,n){return(n?``:` `)+e}var rD=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];cD.peek=lD;function iD(){return{canContainEols:[`delete`],enter:{strikethrough:oD},exit:{strikethrough:sD}}}function aD(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:rD}],handlers:{delete:cD}}}function oD(e){this.enter({type:`delete`,children:[]},e)}function sD(e){this.exit(e)}function cD(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 lD(){return`~`}function uD(e){return e.length}function dD(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||uD,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=fD(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]=pD(r[d]);else{let e=pD(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(`
32
+ `)}function fD(e){return e==null?``:String(e)}function pD(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 mD(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()),hD);return i(),o}function hD(e,t,n){return`>`+(n?``:` `)+e}function gD(e,t){return _D(e,t.inConstruct,!0)&&!_D(e,t.notInConstruct,!1)}function _D(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 vD(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
33
+ `&&gD(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
34
+ `}function yD(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 bD(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 xD(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function SD(e,t,n,r){let i=xD(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(bD(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,CD);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(yD(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:`
35
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
36
+ `),a&&(u+=s.move(a+`
37
+ `)),u+=s.move(c),l(),u}function CD(e,t,n){return(n?``:` `)+e}function wD(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function TD(e,t,n,r){let i=wD(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?` `:`
38
+ `,...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 ED(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function DD(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function OD(e,t,n){let r=Yx(e),i=Yx(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}}kD.peek=AD;function kD(e,t,n,r){let i=ED(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=OD(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=DD(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=OD(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+DD(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function AD(e,t,n){return n.options.emphasis||`*`}function jD(e,t){let n=!1;return vT(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)&&_x(e)&&(t.options.setext||n))}function MD(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(jD(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
39
+ `,after:`
40
+ `});return r(),t(),o+`
41
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
42
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
43
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=DD(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}ND.peek=PD;function ND(e){return e.value||``}function PD(){return`<`}FD.peek=ID;function FD(e,t,n,r){let i=wD(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 ID(){return`!`}LD.peek=RD;function LD(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 RD(){return`!`}zD.peek=BD;function zD(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 BD(){return"`"}function VD(e,t){let n=_x(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))}HD.peek=UD;function HD(e,t,n,r){let i=wD(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(VD(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 UD(e,t,n){return VD(e,n)?`<`:`[`}WD.peek=GD;function WD(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 GD(){return`[`}function KD(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 qD(e){let t=KD(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 JD(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function YD(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 XD(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?JD(n):KD(n),s=e.ordered?o===`.`?`)`:`.`:qD(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),YD(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 ZD(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 QD(e,t,n,r){let i=ZD(n),a=n.bulletCurrent||KD(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 $D(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var eO=sT([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function tO(e,t,n,r){return(e.children.some(function(e){return eO(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function nO(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}rO.peek=iO;function rO(e,t,n,r){let i=nO(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=OD(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=DD(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=OD(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+DD(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function iO(e,t,n){return n.options.strong||`*`}function aO(e,t,n,r){return n.safe(e.value,r)}function oO(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 sO(e,t,n){let r=(YD(n)+(n.options.ruleSpaces?` `:``)).repeat(oO(n));return n.options.ruleSpaces?r.slice(0,-1):r}var cO={blockquote:mD,break:vD,code:SD,definition:TD,emphasis:kD,hardBreak:vD,heading:MD,html:ND,image:FD,imageReference:LD,inlineCode:zD,link:HD,linkReference:WD,list:XD,listItem:QD,paragraph:$D,root:tO,strong:rO,text:aO,thematicBreak:sO};function lO(){return{enter:{table:uO,tableData:mO,tableHeader:mO,tableRow:fO},exit:{codeText:hO,table:dO,tableData:pO,tableHeader:pO,tableRow:pO}}}function uO(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 dO(e){this.exit(e),this.data.inTable=void 0}function fO(e){this.enter({type:`tableRow`,children:[]},e)}function pO(e){this.exit(e)}function mO(e){this.enter({type:`tableCell`,children:[]},e)}function hO(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,gO));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function gO(e,t){return t===`|`?t:e}function _O(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
44
+ `,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(`
45
+ `))}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 dD(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=cO.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function vO(){return{exit:{taskListCheckValueChecked:bO,taskListCheckValueUnchecked:bO,paragraph:xO}}}function yO(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:SO}}}function bO(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function xO(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 SO(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=cO.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 CO(){return[kE(),$E(),iD(),lO(),vO()]}function wO(e){return{extensions:[AE(),eD(e),aD(),_O(e),yO()]}}var TO={tokenize:zO,partial:!0},EO={tokenize:BO,partial:!0},DO={tokenize:VO,partial:!0},OO={tokenize:HO,partial:!0},kO={tokenize:UO,partial:!0},AO={name:`wwwAutolink`,tokenize:LO,previous:WO},jO={name:`protocolAutolink`,tokenize:RO,previous:GO},MO={name:`emailAutolink`,tokenize:IO,previous:KO},NO={};function PO(){return{text:NO}}for(var FO=48;FO<123;)NO[FO]=MO,FO++,FO===58?FO=65:FO===91&&(FO=97);NO[43]=MO,NO[45]=MO,NO[46]=MO,NO[95]=MO,NO[72]=[MO,jO],NO[104]=[MO,jO],NO[87]=[MO,AO],NO[119]=[MO,AO];function IO(e,t,n){let r=this,i,a;return o;function o(t){return!qO(t)||!KO.call(r,r.previous)||JO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return qO(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(kO,u,l)(t):t===45||t===95||Mx(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&&jx(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function LO(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!WO.call(r,r.previous)||JO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(TO,e.attempt(EO,e.attempt(DO,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function RO(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&GO.call(r,r.previous)&&!JO(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(jx(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||Px(t)||Rx(t)||Bx(t)||zx(t)?n(t):e.attempt(EO,e.attempt(DO,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function zO(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 BO(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(OO,c,s)(t):t===null||Rx(t)||Bx(t)||t!==45&&zx(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 VO(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(OO,t,a)(o):o===null||Rx(o)||Bx(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function HO(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||Rx(o)||Bx(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Rx(e)||Bx(e)?t(e):r(e)}function a(e){return jx(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):jx(t)?(e.consume(t),o):n(t)}}function UO(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Mx(e)?n(e):t(e)}}function WO(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Rx(e)}function GO(e){return!jx(e)}function KO(e){return!(e===47||qO(e))}function qO(e){return e===43||e===45||e===46||e===95||Mx(e)}function JO(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 YO={tokenize:rk,partial:!0};function XO(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:ek,continuation:{tokenize:tk},exit:nk}},text:{91:{name:`gfmFootnoteCall`,tokenize:$O},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:ZO,resolveTo:QO}}}}function ZO(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=Ax(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 QO(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 $O(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||Rx(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Ax(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Rx(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 ek(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||Rx(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Ax(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Rx(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 tk(e,t,n){return e.check(rS,t,e.attempt(YO,t,n))}function nk(e){e.exit(`gfmFootnoteDefinition`)}function rk(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 ik(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&&Cx(o,o.length,0,Xx(s,e.slice(r+1,n),t)),Cx(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Cx(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=Yx(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=Yx(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var ak=class{constructor(){this.map=[]}add(e,t,n){ok(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 ok(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 sk(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 ck(){return{flow:{null:{name:`table`,tokenize:lk,resolveAll:uk}}}}function lk(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):J(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||Rx(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||J(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||J(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||J(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||Rx(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 uk(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 ak;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(fk(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=dk(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=dk(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=dk(f,t,o,i,n,d)):(o[0]=o[1],d=dk(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&fk(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=sk(t.events,n))}return e}function dk(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},pk(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=pk(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=pk(t.events,n[2]),a=pk(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({},pk(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function fk(e,t,n,r,i){let a=[],o=pk(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 pk(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var mk={name:`tasklistCheck`,tokenize:gk};function hk(){return{text:{91:mk}}}function gk(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 Rx(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 J(r)?t(r):Y(r)?e.check({tokenize:_k},t,n)(r):n(r)}}function _k(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function vk(e){return Ex([PO(),XO(),ik(e),ck(),hk()])}var yk={};function bk(e){let t=this,n=e||yk,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(vk(n)),a.push(CO()),o.push(wO(n))}function xk(){return typeof navigator<`u`&&typeof navigator.clipboard?.writeText==`function`}function Sk(e){if(typeof document>`u`)return;let t=document.getSelection();t&&(t.removeAllRanges(),e.forEach(e=>t.addRange(e)))}function Ck(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):Sk(a),s}async function wk(e){if(!e)return!1;if(xk())try{return await navigator.clipboard.writeText(e),!0}catch{return Ck(e)}return Ck(e)}var Tk=1300;function Ek(e){let[t,n]=(0,F.useState)(!1),r=(0,F.useCallback)(async()=>{e.text&&(await wk(e.text)?n(!0):n(!1))},[e.text]);return(0,F.useEffect)(()=>{if(!t||typeof window>`u`)return;let r=window.setTimeout(()=>n(!1),e.resetDelayMs??Tk);return()=>window.clearTimeout(r)},[t,e.resetDelayMs]),{copied:t,copy:r}}var Dk=g(a(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,ee=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},j={begin:`\\\\[\\s\\S]`,relevance:0},te={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[j]},M={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[j]},ne={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},re=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},ie=re(`//`,`$`),ae=re(`/\\*`,`\\*/`),oe=re(`#`,`$`),se={scope:`number`,begin:D,relevance:0},ce={scope:`number`,begin:O,relevance:0},le={scope:`number`,begin:k,relevance:0},ue={scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[j,{begin:/\[/,end:/\]/,relevance:0,contains:[j]}]},de={scope:`title`,begin:T,relevance:0},fe={scope:`title`,begin:E,relevance:0},pe={begin:`\\.\\s*`+E,relevance:0},me=Object.freeze({__proto__:null,APOS_STRING_MODE:te,BACKSLASH_ESCAPE:j,BINARY_NUMBER_MODE:le,BINARY_NUMBER_RE:k,COMMENT:re,C_BLOCK_COMMENT_MODE:ae,C_LINE_COMMENT_MODE:ie,C_NUMBER_MODE:ce,C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:oe,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:pe,NUMBER_MODE:se,NUMBER_RE:D,PHRASAL_WORDS_MODE:ne,QUOTE_STRING_MODE:M,REGEXP_MODE:ue,RE_STARTERS_RE:A,SHEBANG:ee,TITLE_MODE:de,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:fe});function he(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function ge(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function _e(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=he,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function ve(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function ye(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function be(e,t){e.relevance===void 0&&(e.relevance=1)}var xe=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Se=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],Ce=`keyword`;function we(e,t,n=Ce){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,we(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,Te(n[0],n[1])]})}}function Te(e,t){return t?Number(t):Ee(e)?0:1}function Ee(e){return Se.includes(e.toLowerCase())}var De={},Oe=e=>{console.error(e)},ke=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ae=(e,t)=>{De[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),De[`${e}/${t}`]=!0)},je=Error();function Me(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function Ne(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Oe(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),je;if(typeof e.beginScope!=`object`||e.beginScope===null)throw Oe(`beginScope must be object`),je;Me(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function Pe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Oe(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),je;if(typeof e.endScope!=`object`||e.endScope===null)throw Oe(`endScope must be object`),je;Me(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function Fe(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Ie(e){Fe(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),Ne(e),Pe(e)}function Le(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null),this.matcherRe=t(C(this.regexes.map(e=>e[1]),{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[ge,ye,Ie,xe].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[_e,ve,be].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=we(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return ze(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Re(e){return e?e.endsWithParent||Re(e.starts):!1}function ze(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Re(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Be=`11.11.1`,Ve=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},He=i,Ue=a,We=Symbol(`nomatch`),Ge=7,Ke=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=te(n[1]);return t||(ke(s.replace(`{}`,n[1])),ke(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||te(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(Ae(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),Ae(`10.7.0`,`Please use highlight(code, options) instead.
46
+ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};oe(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,oe(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){j.addText(M);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(M),n=``;for(;t;){n+=M.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(j.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Ge&&(ne+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(M)}n+=M.substring(e),j.addText(n)}function f(){if(M===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){j.addText(M);return}e=v(A.subLanguage,M,!0,ee[A.subLanguage]),ee[A.subLanguage]=e._top}else e=S(M,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(ne+=e.relevance),j.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),M=``}function m(e,t){e!==``&&(j.startScope(t),j.addText(e),j.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(M=i,d(),M=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&j.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(M,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),M=``):e.beginScope._multi&&(h(e.beginScope,t),M=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(M+=e[0],1):(ae=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?M+=t:(n.excludeBegin&&(M+=t),p(),!n.returnBegin&&!n.excludeBegin&&(M=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return We;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?M+=t:(a.returnEnd||a.excludeEnd||(M+=t),p(),a.excludeEnd&&(M=t));do A.scope&&j.closeNode(),!A.skip&&!A.subLanguage&&(ne+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>j.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(M+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(M+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==We)return e}if(r.type===`illegal`&&a===``)return M+=`
47
+ `,1;if(ie>1e5&&ie>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return M+=a,a.length}let D=te(e);if(!D)throw Oe(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Le(D),k=``,A=a||O,ee={},j=new l.__emitter(l);w();let M=``,ne=0,re=0,ie=0,ae=!1;try{if(D.__emitTokens)D.__emitTokens(n,j);else{for(A.matcher.considerAll();;){ie++,ae?ae=!1:A.matcher.considerAll(),A.matcher.lastIndex=re;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(re,e.index),e);re=e.index+t}E(n.substring(re))}return j.finalize(),k=j.toHTML(),{language:e,value:k,relevance:ne,illegal:!1,_emitter:j,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:He(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:re,context:n.slice(re-100,re+100),mode:t.mode,resultSoFar:k},_emitter:j};if(o)return{language:e,value:He(n),illegal:!1,relevance:0,errorRaised:t,_emitter:j,_top:A};throw t}}function b(e){let t={value:He(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(te).filter(ne).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(te(e.language).supersetOf===t.language)return 1;if(te(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(oe(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new Ve(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),oe(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=Ue(l,e)}let E=()=>{k(),Ae(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),Ae(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(Oe(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)Oe(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&M(i.aliases,{languageName:n})}function ee(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function j(){return Object.keys(t)}function te(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function M(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function ne(e){let t=te(e);return t&&!t.disableAutodetect}function re(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function ie(e){re(e),a.push(e)}function ae(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function oe(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function se(e){return Ae(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),Ae(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:se,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:ee,listLanguages:j,getLanguage:te,registerAliases:M,autoDetection:ne,inherit:Ue,addPlugin:ie,removePlugin:ae}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Be,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in me)typeof me[e]==`object`&&n(me[e]);return Object.assign(e,me),e},qe=Ke({});qe.newInstance=()=>Ke({}),t.exports=qe,qe.HighlightJS=qe,qe.default=qe}))()).default;function Ok(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}var kk=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Ak=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),jk=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),Mk=[...Ak,...jk],Nk=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),Pk=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Fk=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),Ik=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function Lk(e){let t=e.regex,n=kk(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+Pk.join(`|`)+`)`},{begin:`:(:)?(`+Fk.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+Ik.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:Nk.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+Mk.join(`|`)+`)\\b`}]}}function Rk(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}var zk=`[A-Za-z$_][0-9A-Za-z$_]*`,Bk=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Vk=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Hk=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Uk=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Wk=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],Gk=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],Kk=[].concat(Wk,Hk,Uk);function qk(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=zk,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:zk,keyword:Bk,literal:Vk,built_in:Kk,"variable.language":Gk},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Hk,...Uk]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...Wk,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},ee=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(ee)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},j,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:ee,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function Jk(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}function Yk(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Xk(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function Zk(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function Qk(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}var $k=`[A-Za-z$_][0-9A-Za-z$_]*`,eA=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),tA=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],nA=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),rA=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],iA=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],aA=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],oA=[].concat(iA,nA,rA);function sA(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=$k,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:$k,keyword:eA,literal:tA,built_in:oA,"variable.language":aA},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...nA,...rA]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...iA,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},ee=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(ee)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},j,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:ee,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function cA(e){let t=e.regex,n=sA(e),r=$k,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:$k,keyword:eA.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:tA,built_in:oA.concat(i),"variable.language":aA},l={className:`meta`,begin:`@`+r},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function lA(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function uA(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}var dA=new Set([`text`,`txt`,`plain`,`plaintext`,`none`,`output`]),fA=[`typescript`,`javascript`,`json`,`bash`,`shell`,`python`,`css`,`xml`,`markdown`,`yaml`,`sql`,`diff`],pA=4,mA=[{name:`typescript`,language:cA,aliases:[`ts`,`tsx`]},{name:`javascript`,language:qk,aliases:[`js`,`jsx`,`mjs`,`cjs`]},{name:`json`,language:Jk,aliases:[`jsonc`]},{name:`bash`,language:Ok,aliases:[`sh`,`zsh`]},{name:`shell`,language:Zk,aliases:[`console`,`terminal`]},{name:`python`,language:Xk,aliases:[`py`]},{name:`css`,language:Lk},{name:`xml`,language:lA,aliases:[`html`,`svg`]},{name:`markdown`,language:Yk,aliases:[`md`,`mdx`]},{name:`yaml`,language:uA,aliases:[`yml`]},{name:`sql`,language:Qk},{name:`diff`,language:Rk,aliases:[`patch`]}];function hA(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function gA(e){return e.trim().toLowerCase()}var _A=new class{constructor(){this.highlight=(e,t)=>{let n=gA(t);if(!e||dA.has(n))return this.createPlainTextResult(e,n||`text`);if(this.engine.getLanguage(n)){let t=this.engine.highlight(e,{language:n,ignoreIllegals:!0});return{html:t.value,language:t.language??n,highlighted:!0}}let r=this.engine.highlightAuto(e,fA);return r.language&&r.relevance>=pA?{html:r.value,language:r.language,highlighted:!0}:this.createPlainTextResult(e,n||`text`)},this.createPlainTextResult=(e,t)=>({html:hA(e),language:t,highlighted:!1}),this.engine=Dk.newInstance(),mA.forEach(e=>{this.engine.registerLanguage(e.name,e.language),e.aliases&&this.engine.registerAliases(e.aliases,{languageName:e.name})})}},vA=/language-([a-z0-9-]+)/i;function yA(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(yA).join(``):``}function bA(e){let t=yA(e);return t.endsWith(`
48
+ `)?t.slice(0,-1):t}function xA(e){return(e?vA.exec(e):null)?.[1]?.toLowerCase()||`text`}function SA({className:e,children:t,texts:n}){let r=(0,F.useMemo)(()=>xA(e),[e]),i=(0,F.useMemo)(()=>bA(t),[t]),a=(0,F.useMemo)(()=>_A.highlight(i,r),[i,r]),o=(0,F.useMemo)(()=>{let t=`language-${a.language}`;return L(`hljs`,e,e?.includes(`language-`)?void 0:t)},[e,a.language]),{copied:s,copy:c}=Ek({text:i});return(0,I.jsxs)(`div`,{className:`chat-codeblock`,children:[(0,I.jsxs)(`div`,{className:`chat-codeblock-toolbar`,children:[(0,I.jsx)(`span`,{className:`chat-codeblock-language`,children:r}),(0,I.jsxs)(`button`,{type:`button`,className:`chat-codeblock-copy`,onClick:()=>void c(),"aria-label":s?n.copiedCodeLabel:n.copyCodeLabel,children:[s?(0,I.jsx)(Ln,{className:`h-3.5 w-3.5`}):(0,I.jsx)(Hn,{className:`h-3.5 w-3.5`}),(0,I.jsx)(`span`,{children:s?n.copiedCodeLabel:n.copyCodeLabel})]})]}),(0,I.jsx)(`pre`,{children:(0,I.jsx)(`code`,{className:o,"data-highlighted":a.highlighted?`true`:`false`,dangerouslySetInnerHTML:{__html:a.html}})})]})}var CA=14e4,wA=new Set([`http:`,`https:`,`mailto:`,`tel:`]);function TA(e){return e.length<=CA?e:`${e.slice(0,CA)}\n\n...`}function EA(e){if(!e)return null;if(e.startsWith(`#`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))return e;try{let t=new URL(e);return wA.has(t.protocol)?e:null}catch{return null}}function DA(e){return/^https?:\/\//i.test(e)}function OA(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 kA(e){let t=e.split(`#`)[0]?.split(`?`)[0]??e,n=decodeURIComponent(t);if(!OA(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 AA({text:e,role:t,texts:n,inline:r=!1,onFileOpen:i}){let a=t===`user`,o=(0,F.useMemo)(()=>({p:({children:e})=>r?(0,I.jsx)(I.Fragment,{children:e}):(0,I.jsx)(`p`,{children:e}),a:({href:e,children:t,...n})=>{let r=EA(e);if(!r)return(0,I.jsx)(`span`,{className:`chat-link-invalid`,children:t});let a=DA(r),o=a?null:kA(r),s=e=>{!i||!o||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),i(o))};return(0,I.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,I.jsx)(`div`,{className:`chat-table-wrap`,children:(0,I.jsx)(`table`,{...t,children:e})}),input:({type:e,checked:t,...n})=>e===`checkbox`?(0,I.jsx)(`input`,{...n,type:`checkbox`,checked:t,readOnly:!0,disabled:!0,className:`chat-task-checkbox`}):(0,I.jsx)(`input`,{...n,type:e}),img:({src:e,alt:t,...n})=>{let r=EA(e);return r?(0,I.jsx)(`img`,{...n,src:r,alt:t||``,loading:`lazy`,decoding:`async`}):null},code:({className:e,children:t,...r})=>!e&&!String(t??``).includes(`
49
+ `)?(0,I.jsx)(`code`,{...r,className:L(`chat-inline-code`,e),children:t}):(0,I.jsx)(SA,{className:e,texts:n,children:t})}),[r,i,n]);return(0,I.jsx)(r?`span`:`div`,{className:L(`chat-markdown`,a?`chat-markdown-user`:`chat-markdown-assistant`),children:(0,I.jsx)(gE,{skipHtml:!0,remarkPlugins:[bk],components:o,children:TA(e)})})}function jA(e){return e.split(`​`).join(``).split(`‌`).join(``).split(`‍`).join(``).split(`⁠`).join(``).split(``).join(``).length>0}function MA(){return(0,I.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,I.jsx)(`path`,{d:`M8.5 2.75 2.75 6l5.75 3.25L14.25 6 8.5 2.75Z`}),(0,I.jsx)(`path`,{d:`M2.75 10 8.5 13.25 14.25 10`}),(0,I.jsx)(`path`,{d:`M2.75 6v4l5.75 3.25V9.25L2.75 6Z`}),(0,I.jsx)(`path`,{d:`M14.25 6v4L8.5 13.25V9.25L14.25 6Z`})]})}function NA({kind:e,label:t,isUser:n}){let r=e===`skill`;return(0,I.jsxs)(`span`,{className:L(`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,I.jsx)(`span`,{className:L(`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,I.jsx)(MA,{})}),(0,I.jsx)(`span`,{className:`truncate`,children:t})]})}function PA({segments:e,role:t,texts:n,onFileOpen:r}){let i=t===`user`;return(0,I.jsx)(`div`,{className:`whitespace-pre-wrap break-words leading-6`,children:e.map((e,a)=>e.type===`token`?(0,I.jsx)(NA,{kind:e.token.kind,label:e.token.label,isUser:i},`token-${a}-${e.token.kind}-${e.token.key}`):jA(e.text)?(0,I.jsx)(AA,{text:e.text,role:t,texts:n,inline:!0,onFileOpen:r},`markdown-${a}`):(0,I.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e.text},`space-${a}`))})}var FA={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`},IA=new Set([`c`,`cpp`,`css`,`go`,`html`,`java`,`js`,`jsx`,`md`,`php`,`py`,`rb`,`rs`,`sh`,`sql`,`svg`,`ts`,`tsx`]),LA=new Set([`graphql`,`json`,`toml`,`xml`,`yaml`,`yml`]),RA=new Set([`avif`,`bmp`,`gif`,`heic`,`heif`,`ico`,`jpeg`,`jpg`,`png`,`svg`,`tif`,`tiff`,`webp`]),zA=new Set([`aac`,`flac`,`m4a`,`mp3`,`ogg`,`opus`,`wav`,`weba`]),BA=new Set([`avi`,`m4v`,`mov`,`mp4`,`mkv`,`webm`,`wmv`]),VA=new Set([`doc`,`docx`,`odt`,`pages`,`rtf`,`txt`]),HA=new Set([`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]),UA=new Set([`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`zip`]);function WA(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 GA(e,t){let n=KA(e);if(n)return n.toUpperCase();let r=(t.split(`/`)[1]??``).split(/[+.;-]/)[0]?.trim();return r?r.slice(0,6).toUpperCase():`FILE`}function KA(e){return/\.([a-z0-9]{1,12})$/i.exec(e.trim())?.[1]?.toLowerCase()??``}function qA(e){return typeof e==`string`&&/^data:image\//i.test(e.trim())}function JA(e){return RA.has(e)?e===`jpg`||e===`jpeg`?`image/jpeg`:e===`svg`?`image/svg+xml`:`image/${e}`:zA.has(e)?e===`mp3`?`audio/mpeg`:e===`m4a`?`audio/mp4`:e===`weba`?`audio/webm`:`audio/${e}`:BA.has(e)?e===`mov`?`video/quicktime`:e===`m4v`?`video/mp4`:`video/${e}`:e===`pdf`?`application/pdf`:null}function YA(e){let t=KA(e);return t?JA(t):null}function XA(e){let t=e.mimeType.trim().toLowerCase();return t.length>0&&t!==`application/octet-stream`?t:YA(e.label)}function ZA(e){let t=e.mimeType.trim().toLowerCase(),n=KA(e.label);return e.isImage||t.startsWith(`image/`)||RA.has(n)||qA(e.dataUrl)}function QA(e,t){let n=KA(e),r=t.toLowerCase();return r.startsWith(`image/`)||RA.has(n)?`image`:r.startsWith(`audio/`)||zA.has(n)?`audio`:r.startsWith(`video/`)||BA.has(n)?`video`:r.includes(`pdf`)||n===`pdf`?`pdf`:UA.has(n)||/(zip|tar|gzip|rar|compressed|archive)/.test(r)?`archive`:HA.has(n)||/(spreadsheet|sheet|excel|csv)/.test(r)?`sheet`:LA.has(n)||/(json|xml|yaml|toml)/.test(r)?`data`:IA.has(n)||/(javascript|typescript|jsx|tsx|css|html)/.test(r)?`code`:VA.has(n)||/(msword|document|opendocument|rtf|text\/)/.test(r)?`document`:`generic`}function $A(e){let t=QA(e.label,e.mimeType),n=WA(e.sizeBytes);return{category:t,extension:GA(e.label,e.mimeType),sizeLabel:n}}var ej={archive:`Archive`,audio:`Audio`,code:`Code file`,data:`Data file`,document:`Document`,generic:`File`,image:`Image`,pdf:`PDF document`,sheet:`Spreadsheet`,video:`Video`},tj={archive:Gn,audio:Kn,code:qn,data:Yn,document:Zn,generic:$n,image:Jn,pdf:Zn,sheet:Xn,video:Qn};function nj(e,t){return t?.attachmentCategoryLabels?.[e]??ej[e]}function rj(e,t,n){return(0,I.jsx)(`div`,{className:L(`mt-1 text-xs leading-5`,n?`text-white/70`:`text-slate-500`),children:t?`${e} · ${t}`:e})}function ij(e,t,n){return(0,I.jsx)(`span`,{className:L(`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 aj(e,t,n){return(0,I.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:L(`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 oj({category:e,isUser:t}){let n=tj[e];return(0,I.jsx)(`div`,{className:L(`flex h-14 w-14 shrink-0 items-center justify-center rounded-[1rem] border`,t?`border-white/12 bg-white/10 text-white`:FA[e]),children:(0,I.jsx)(n,{className:L(`h-7 w-7`,t?`text-white/92`:`text-current`),strokeWidth:2.2})})}function sj(e){let{file:t,categoryLabel:n,sizeLabel:r,isUser:i}=e;return t.dataUrl?(0,I.jsx)(`a`,{href:t.dataUrl,target:`_blank`,rel:`noreferrer`,className:`group block`,children:(0,I.jsxs)(`div`,{className:L(`relative overflow-hidden rounded-[1rem]`,i?`ring-1 ring-white/10`:`bg-slate-100/80 ring-1 ring-slate-200/80`),children:[(0,I.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,I.jsxs)(`div`,{className:`pointer-events-none absolute right-3 top-3 flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:L(`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,I.jsx)(`span`,{className:L(`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 cj(e){let{category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,action:o}=e;return(0,I.jsxs)(`div`,{className:`flex items-center gap-3 p-3.5`,children:[(0,I.jsx)(oj,{category:t,isUser:a}),(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`truncate text-[15px] font-semibold leading-5`,children:n.label}),rj(r,i,a)]}),o]})})]})}function lj(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=XA(n);return(0,I.jsxs)(`div`,{className:o,children:[cj({category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,action:aj(s,n.dataUrl,a)}),(0,I.jsx)(`div`,{className:`px-3.5 pb-3.5`,children:t===`audio`?(0,I.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":n.label,className:`block w-full`,children:(0,I.jsx)(`source`,{src:n.dataUrl,...c?{type:c}:{}})}):(0,I.jsx)(`div`,{className:L(`overflow-hidden rounded-[1rem] border`,a?`border-white/10 bg-slate-950/26`:`border-slate-200/80 bg-slate-100/80`),children:(0,I.jsx)(`video`,{controls:!0,preload:`metadata`,playsInline:!0,"aria-label":n.label,className:`block max-h-[28rem] w-full bg-black`,children:(0,I.jsx)(`source`,{src:n.dataUrl,...c?{type:c}:{}})})})})]})}function uj({file:e,isUser:t=!1,texts:n}){let{category:r,sizeLabel:i}=$A(e),a=ZA(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=nj(r,n),d=L(`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 sj({file:e,categoryLabel:u,sizeLabel:i,isUser:t});if(o||s)return lj({category:r,file:e,categoryLabel:u,sizeLabel:i,isUser:t,shellClasses:d,actionLabel:l});let f=cj({category:r,file:e,categoryLabel:u,sizeLabel:i,isUser:t,action:ij(l,t,c)});return!c||!e.dataUrl?(0,I.jsx)(`div`,{className:d,children:f}):(0,I.jsx)(`a`,{href:e.dataUrl,target:`_blank`,rel:`noreferrer`,className:L(d,`group`),children:f})}function dj(e){let{isInProgress:t}=e,[n,r]=(0,F.useState)(t),[i,a]=(0,F.useState)(!1),o=(0,F.useRef)(t);(0,F.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 fj=10;function pj(e){e.scrollTop=e.scrollHeight}function mj(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,pj(t))}))}function hj(e){let t=(0,F.useRef)(!0),n=(0,F.useRef)(!1),r=(0,F.useRef)(null),i=(0,F.useRef)(!1),a=(0,F.useRef)(null);return(0,F.useEffect)(()=>{r.current!==e.resetKey&&(r.current=e.resetKey,t.current=!0,i.current=!0)},[e.resetKey]),(0,F.useEffect)(()=>{let e=a.current;return()=>{e!==null&&cancelAnimationFrame(e)}},[]),(0,F.useLayoutEffect)(()=>{!i.current||e.isLoading||!e.hasContent||e.scrollRef.current&&(i.current=!1,mj({scrollRef:e.scrollRef,scheduledScrollFrameRef:a,isProgrammaticScrollRef:n}))},[e.hasContent,e.isLoading,e.scrollRef]),(0,F.useLayoutEffect)(()=>{!t.current||!e.hasContent||e.scrollRef.current&&mj({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??fj))}}}function gj(e){let t=e.trim().toLowerCase();return t===`reasoning`||t===`thinking`||t===`推理`||t===`推理过程`||t===`思考过程`||t===`思考`?`思考`:e}function _j({label:e,text:t,isUser:n,isInProgress:r}){let{isOpen:i,onSummaryClick:a}=dj({isInProgress:r}),o=(0,F.useRef)(null),s=gj(e),{onScroll:c}=hj({scrollRef:o,resetKey:`${s}:${r?`streaming`:`idle`}`,isLoading:!1,hasContent:t.length>0,contentVersion:t,stickyThresholdPx:20});return(0,I.jsxs)(`details`,{className:`mt-2`,open:i,children:[(0,I.jsx)(`summary`,{className:L(`cursor-pointer text-xs`,n?`text-primary-100`:`text-gray-500`),onClick:a,children:s}),(0,I.jsx)(`div`,{ref:o,onScroll:c,"data-reasoning-scroll":`true`,className:L(`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,I.jsx)(`pre`,{className:`min-w-0 whitespace-pre-wrap break-all p-2 text-[11px]`,children:t})})]})}function vj({children:e,className:t}){return(0,I.jsx)(`div`,{className:L(`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 yj({children:e,className:t}){return(0,I.jsx)(`div`,{className:L(`border-t border-amber-200/15 bg-amber-50/50 px-3 pt-1 pb-2 w-full overflow-hidden`,t),children:e})}var bj={running:{text:`text-amber-500/80`,icon:ln,spin:!0},success:{text:`text-amber-500/80`,icon:Ln,spin:!1},error:{text:`text-amber-500/80`,icon:it,spin:!1},cancelled:{text:`text-amber-500/80`,icon:pr,spin:!1}};function xj({card:e}){let t=bj[e.statusTone]||bj.cancelled,n=t.icon;return(0,I.jsxs)(`span`,{className:L(`inline-flex items-center gap-1.5 text-[11px] font-medium leading-none shrink-0`,t.text),children:[(0,I.jsx)(n,{className:L(`h-3.5 w-3.5`,t.spin&&`animate-spin`),strokeWidth:3}),e.statusTone===`running`?e.statusLabel:null]})}function Sj({action:e,onAction:t}){let n=e.sessionKind===`child`?`Open child session`:`Open session`;return(0,I.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),t(e)},className:L(`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,I.jsx)(Nn,{className:`h-3 w-3`,strokeWidth:2.5})})}function Cj({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,I.jsxs)(`div`,{className:L(`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,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 overflow-hidden font-mono text-amber-950/80`,children:[(0,I.jsx)(t,{className:`h-4 w-4 text-amber-600/80 shrink-0`,strokeWidth:3}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden`,children:[(0,I.jsx)(`span`,{className:`font-bold shrink-0 tracking-tight`,children:e.toolName}),s&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`text-amber-300 font-bold select-none shrink-0`,children:`›`}),(0,I.jsx)(`span`,{className:`block min-w-0 flex-1 truncate font-normal`,title:s,children:s})]})]})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[a,(0,I.jsx)(xj,{card:e}),r&&(n?(0,I.jsx)(Rn,{className:`h-4 w-4 text-amber-400/80`,strokeWidth:3}):(0,I.jsx)(zn,{className:`h-4 w-4 text-amber-400/80`,strokeWidth:3}))]})]})}function wj({action:e,onAction:t}){return(0,I.jsx)(Sj,{action:e,onAction:t})}var Tj=`font-mono text-[11px] leading-5`,Ej=`flex h-5 w-full ${Tj}`,Dj=`flex h-5 items-center justify-center px-2.5 tabular-nums select-none`;function Oj(e){let t=e.newLineNumber??e.oldLineNumber;return typeof t==`number`?String(t):``}function kj(e,t,n){return`${e}-${n}-${t.oldLineNumber??`x`}-${t.newLineNumber??`x`}`}function Aj(e){return typeof e.newLineNumber==`number`||typeof e.oldLineNumber==`number`}function jj(e){return e.lines.some(Aj)}function Mj(e){let t=e.lines.reduce((e,t)=>Aj(t)?Math.max(e,Oj(t).length):e,0);return`${Math.max(6.5,Math.min(8,t+3.5))}ch`}function Nj(e){return`calc(${e.lines.reduce((e,t)=>Math.max(e,Math.max(1,t.text.length)),1)}ch + 1.25rem)`}function Pj(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 Fj(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 Ij({layout:e,line:t,lineNumberColumnWidth:n}){return(0,I.jsx)(`span`,{"data-file-line-number-cell":`true`,style:e===`compact`?{width:n,minWidth:n}:void 0,className:L(Dj,e===`compact`?`sticky left-0 z-[1]`:`w-full shrink-0`,Pj(t)),children:Oj(t)})}function Lj({line:e}){return(0,I.jsx)(`span`,{"data-file-code-row":`true`,className:L(`block min-w-0 flex-1 whitespace-pre px-2.5`,Fj(e)),children:e.text||` `})}function Rj({line:e,showLineNumbers:t,lineNumberColumnWidth:n}){return(0,I.jsxs)(`div`,{"data-file-line-row":`true`,className:Ej,children:[t?(0,I.jsx)(Ij,{layout:`compact`,line:e,lineNumberColumnWidth:n}):null,(0,I.jsx)(Lj,{line:e})]})}function zj({block:e}){let t=jj(e),n=Mj(e),r=Nj(e);return(0,I.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,I.jsxs)(`div`,{"data-file-code-gutter":`true`,style:{width:n,minWidth:n},className:L(`flex h-full min-h-full shrink-0 flex-col`,Tj),children:[e.lines.map((e,t)=>(0,I.jsx)(Ij,{layout:`workspace`,line:e,lineNumberColumnWidth:n},kj(`gutter`,e,t))),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 border-r border-stone-200 bg-stone-100`})]}):null,(0,I.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,I.jsx)(`div`,{"data-file-code-stack":`true`,className:`min-w-full`,style:{minWidth:r},children:e.lines.map((e,t)=>(0,I.jsx)(`div`,{"data-file-code-canvas-row":`true`,className:Ej,children:(0,I.jsx)(Lj,{line:e})},kj(`code`,e,t)))}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 bg-white`})]})]})}function Bj({block:e,layout:t=`compact`}){if(t===`workspace`)return(0,I.jsx)(zj,{block:e});let n=jj(e),r=Mj(e),i=Nj(e),a=n?`calc(${r} + ${i})`:i;return(0,I.jsx)(`div`,{"data-file-code-surface":`true`,"data-file-code-surface-layout":`compact`,className:`overflow-x-auto custom-scrollbar-amber bg-white`,children:(0,I.jsx)(`div`,{"data-file-code-stack":`true`,className:`min-w-full`,style:{minWidth:a},children:e.lines.map((e,t)=>(0,I.jsx)(Rj,{line:e,showLineNumbers:n,lineNumberColumnWidth:r},kj(`row`,e,t)))})})}function Vj({block:e}){return(0,I.jsx)(Bj,{block:e,layout:`compact`})}function Hj(e){return e.display===`preview`}function Uj(e){return e.rawText?e.rawText:e.lines.map(e=>[e.kind,e.oldLineNumber??``,e.newLineNumber??``,e.text].join(`:`)).join(`
50
+ `)}function Wj(e){return/^\+\d+$/.test(e)?`text-emerald-700`:/^-\d+$/.test(e)?`text-rose-700`:`text-stone-500`}function Gj(e){let t=e.split(`·`).map(e=>e.trim()).filter(e=>/^\+\d+$/.test(e)||/^-\d+$/.test(e));return t.length===0?null:(0,I.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,I.jsxs)(F.Fragment,{children:[t>0?(0,I.jsx)(`span`,{className:`text-stone-300`,children:`·`}):null,(0,I.jsx)(`span`,{className:L(Wj(e)),children:e})]},`${e}-${t}`))})}function Kj(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 qj({children:e,contentVersion:t,resetKey:n,className:r,scrollKind:i}){let a=(0,F.useRef)(null),{onScroll:o}=hj({scrollRef:a,resetKey:n,isLoading:!1,hasContent:!0,contentVersion:t,stickyThresholdPx:20});return(0,I.jsx)(`div`,{ref:a,onScroll:o,"data-file-scroll-kind":i,className:L(`overflow-y-auto bg-white custom-scrollbar-amber`,r),children:e})}function Jj({block:e,showPathRow:t,isFirst:n,onFileOpen:r}){let{Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=Ac,c=Hj(e),l=t||!!e.caption;return(0,I.jsxs)(`section`,{className:L(`overflow-hidden bg-white`,!n&&`border-t border-stone-200/80`),children:[l?(0,I.jsxs)(`div`,{className:L(`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,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:t?(0,I.jsx)(o,{delayDuration:250,children:(0,I.jsxs)(i,{children:[(0,I.jsx)(s,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,onClick:()=>{r&&r(Kj(e))},className:L(`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,I.jsx)(a,{side:`top`,className:`max-w-[420px] text-xs font-mono break-all`,children:e.path})]})}):null}),e.caption?Gj(e.caption):null]}):null,e.lines.length>0?(0,I.jsx)(qj,{resetKey:`block:${e.key}`,contentVersion:Uj(e),className:`max-h-72`,scrollKind:`block`,children:(0,I.jsx)(Vj,{block:e})}):e.rawText?(0,I.jsx)(qj,{resetKey:`raw:${e.key}`,contentVersion:e.rawText,className:`max-h-72`,scrollKind:`raw`,children:(0,I.jsx)(`div`,{className:`overflow-x-auto custom-scrollbar-amber`,children:(0,I.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,I.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 Yj({card:e,className:t,onFileOpen:n}){let r=e.fileOperation?.blocks??[],i=e.output?.trim()??``;return r.length===0&&!i?null:(0,I.jsxs)(`div`,{className:L(`overflow-hidden bg-white`,t),children:[r.map((e,t)=>(0,I.jsx)(Jj,{block:e,showPathRow:!0,isFirst:t===0,onFileOpen:n},e.key)),i?(0,I.jsx)(qj,{resetKey:`output:${e.toolName}:${e.summary??`none`}`,contentVersion:i,className:L(`max-h-56`,r.length>0&&`border-t border-stone-200/80`),scrollKind:`output`,children:(0,I.jsx)(`div`,{className:`overflow-x-auto custom-scrollbar-amber`,children:(0,I.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 Xj=200,Zj=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`g`);function Qj(e){return typeof e==`string`&&e.length>0?e:null}function $j(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eM(e){return e.replace(Zj,``)}function tM(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 nM(e){let t=Qj(e.aggregated_output)??Qj(e.combinedOutput)??Qj(e.output);if(t)return t;let n=Qj(e.stdout),r=Qj(e.stderr);return!n&&!r?null:[n,r].filter(e=>!!e).join(`
51
+ `)}function rM(e,t){if($j(t)){let e=nM(t);if(e)return eM(e);if(tM(t))return``}if(!e)return``;let n=e.trim();if(!n.startsWith(`{`))return eM(e);try{let t=JSON.parse(n);if(!$j(t))return eM(e);let r=nM(t);return r?eM(r):tM(t)?``:eM(e)}catch{return eM(e)}}function iM(e){return e===`write_file`||e===`edit_file`}function aM({canExpand:e,isRunning:t,autoExpandWhileRunning:n=!0,expandOnError:r=!1,statusTone:i}){let[a,o]=(0,F.useState)(!1),[s,c]=(0,F.useState)(!1),l=(0,F.useRef)(null),u=(0,F.useRef)(t),d=(0,F.useRef)(!0);return(0,F.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]),(0,F.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},Xj)),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 oM({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,I.jsxs)(`section`,{className:L(`overflow-hidden rounded-md border shadow-[inset_0_1px_0_rgba(255,255,255,0.45)]`,r.shell),children:[(0,I.jsxs)(`div`,{className:L(`flex items-center gap-2 border-b px-3 py-2 text-[10px] font-semibold uppercase tracking-[0.16em]`,r.header),children:[(0,I.jsx)(`span`,{className:L(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,I.jsx)(`span`,{children:e})]}),(0,I.jsx)(`div`,{className:`w-full overflow-hidden`,children:(0,I.jsx)(`pre`,{className:L(`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 sM({card:e}){let t=rM(e.output,e.outputData),n=e.statusTone===`running`,r=!!(e.summary?.trim()||t.trim().length>0),{expanded:i,onToggle:a}=aM({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,I.jsxs)(vj,{children:[(0,I.jsx)(Cj,{card:e,icon:Cr,expanded:i,canExpand:t.trim().length>0||n,onToggle:a}),i&&(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsxs)(`div`,{className:`flex items-start gap-2 leading-relaxed`,children:[(0,I.jsx)(`span`,{className:`text-amber-500/50 font-medium shrink-0 select-none mt-[1px]`,children:`$`}),(0,I.jsx)(`div`,{className:`flex-1 min-w-0`,children:o?(0,I.jsxs)(`div`,{className:`text-amber-950/80 break-words whitespace-pre-wrap tracking-tight font-medium inline-block`,children:[o,n&&!t&&(0,I.jsx)(`span`,{className:`inline-block w-1.5 h-3 ml-1 bg-amber-500/60 animate-pulse align-middle`})]}):(0,I.jsx)(`div`,{className:`h-3 w-32 bg-amber-200/30 rounded animate-pulse mt-2`})})]})}),t&&(0,I.jsx)(yj,{children:(0,I.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,I.jsx)(`span`,{className:`inline-block w-1.5 h-3 ml-1 bg-amber-500/60 animate-pulse align-middle`})]})})]})]})}function cM({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=iM(e.toolName)&&!(r&&e.toolName===`write_file`&&(s>24||c>1200)),{expanded:u,onToggle:d}=aM({canExpand:a||r,isRunning:r,autoExpandWhileRunning:l,expandOnError:a,statusTone:e.statusTone});return(0,I.jsxs)(vj,{children:[(0,I.jsx)(Cj,{card:e,icon:e.toolName===`edit_file`||e.toolName===`write_file`||e.toolName===`apply_patch`||e.toolName===`file_change`?Vn:Zn,expanded:u,canExpand:a||r,hideSummary:u&&i,onToggle:d}),u&&a&&(0,I.jsx)(yj,{className:`border-t border-amber-200/20 bg-transparent px-0 pt-0 pb-0`,children:(0,I.jsx)(Yj,{card:e,onFileOpen:t})})]})}function lM({card:e}){let t=e.statusTone===`running`,n=e.output?.trim()??``,{expanded:r,onToggle:i}=aM({canExpand:!!n||t,isRunning:t,autoExpandWhileRunning:!1,statusTone:e.statusTone});return(0,I.jsxs)(vj,{children:[(0,I.jsx)(Cj,{card:e,icon:hn,expanded:r,canExpand:!!n||t,onToggle:i}),r&&n&&(0,I.jsx)(yj,{children:(0,I.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 uM({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}=aM({canExpand:c||a,isRunning:a,autoExpandWhileRunning:!1,statusTone:e.statusTone});return(0,I.jsxs)(vj,{children:[(0,I.jsx)(Cj,{card:e,icon:sr,expanded:d,canExpand:c||a,actionSlot:e.agentId||e.action&&t?(0,I.jsxs)(I.Fragment,{children:[e.agentId&&n?n(e.agentId):null,e.action&&t?(0,I.jsx)(wj,{action:e.action,onAction:t}):null]}):void 0,onToggle:f}),d&&c&&(0,I.jsxs)(yj,{className:`bg-transparent px-2.5 py-2.5`,children:[o&&(0,I.jsx)(oM,{label:l,tone:`input`,children:r}),o&&s&&(0,I.jsx)(`div`,{className:`h-2`}),s&&(0,I.jsx)(oM,{label:u,tone:e.statusTone===`error`?`error`:`output`,children:i})]})]})}function dM(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 fM(e){let t=e.toLowerCase();return t===`read_file`||t===`write_file`||t===`edit_file`||t===`apply_patch`||t===`file_change`}function pM(e){let t=e.toLowerCase();return t===`grep_search`||t===`find_files`||t.includes(`search`)}function mM({card:e,onToolAction:t,onFileOpen:n,renderToolAgent:r}){return dM(e.toolName)?(0,I.jsx)(sM,{card:e}):fM(e.toolName)?(0,I.jsx)(cM,{card:e,onFileOpen:n}):pM(e.toolName)?(0,I.jsx)(lM,{card:e}):(0,I.jsx)(uM,{card:e,onToolAction:t,renderToolAgent:r})}function hM(e){return(0,I.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-gray-50 px-2.5 py-2 text-xs text-gray-600`,children:[(0,I.jsxs)(`div`,{className:`font-semibold text-gray-700`,children:[e.label,`: `,e.rawType]}),e.text?(0,I.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-gray-500`,children:e.text}):null]})}var gM=(0,F.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,I.jsx)(`div`,{className:L(`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,I.jsx)(`div`,{className:`space-y-2`,children:t.parts.map((e,l)=>{let{type:u}=e;return u===`markdown`?(0,I.jsx)(AA,{text:e.text,role:o,texts:n,onFileOpen:i},`markdown-${l}`):u===`inline-content`?(0,I.jsx)(PA,{segments:e.segments,role:o,texts:n,onFileOpen:i},`inline-content-${l}`):u===`reasoning`?(0,I.jsx)(_j,{label:e.label,text:e.text,isUser:s,isInProgress:c&&l===t.parts.length-1},`reasoning-${l}`):u===`tool-card`?(0,I.jsx)(`div`,{className:`mt-0.5`,children:(0,I.jsx)(mM,{card:e.card,onToolAction:r,onFileOpen:i,renderToolAgent:a})},`tool-${l}`):u===`file`?(0,I.jsx)(uj,{file:e.file,isUser:s,texts:n},`file-${l}`):u===`unknown`?(0,I.jsx)(hM,{label:e.label,rawType:e.rawType,text:e.text},`unknown-${l}`):null})})})});function _M(e){return(0,I.jsxs)(`div`,{className:L(`px-1 text-[11px] leading-4 text-gray-400`,e.isUser?`text-right`:`text-left`),children:[e.roleLabel,` · `,e.timestampLabel]})}function vM({message:e,texts:t}){let n=(0,F.useMemo)(()=>e.parts.map(e=>e.type===`markdown`||e.type===`unknown`?e.text:``).filter(e=>!!e&&e.trim().length>0).join(`
52
+
53
+ `),[e.parts]),{copied:r,copy:i}=Ek({text:n});return n?(0,I.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,I.jsx)(Ln,{className:`h-3.5 w-3.5`}):(0,I.jsx)(Hn,{className:`h-3.5 w-3.5`})}):null}var yM=/\u200B|\u200C|\u200D|\u2060|\uFEFF/g,bM=`
54
+ @keyframes nextclaw-chat-typing-text-sheen {
55
+ 0% {
56
+ background-position: 160% 0;
57
+ }
58
+ 100% {
59
+ background-position: -60% 0;
60
+ }
61
+ }
62
+
63
+ .nextclaw-chat-typing-indicator__text {
64
+ background-image: linear-gradient(
65
+ 100deg,
66
+ #6b7280 0%,
67
+ #6b7280 34%,
68
+ #a6adba 43%,
69
+ #f8fafc 50%,
70
+ #a6adba 57%,
71
+ #6b7280 66%,
72
+ #6b7280 100%
73
+ );
74
+ background-size: 240% 100%;
75
+ background-position: 160% 0;
76
+ -webkit-background-clip: text;
77
+ background-clip: text;
78
+ color: transparent;
79
+ -webkit-text-fill-color: transparent;
80
+ animation: nextclaw-chat-typing-text-sheen 2.5s linear infinite;
81
+ }
82
+
83
+ @media (prefers-reduced-motion: reduce) {
84
+ .nextclaw-chat-typing-indicator__text {
85
+ animation: none;
86
+ background-image: none;
87
+ color: #6b7280;
88
+ -webkit-text-fill-color: currentColor;
89
+ }
90
+ }
91
+ `;function xM(e){let t=e.trim();return t?t.replace(yM,``).trim().length>0:!1}function SM(e){return e.parts.some(e=>e.type===`markdown`||e.type===`reasoning`?xM(e.text):!0)}function CM(){return(0,I.jsx)(`div`,{className:`flex items-center gap-2 px-1 py-0.5 text-[11px] text-gray-400`,children:(0,I.jsxs)(`div`,{className:`flex space-x-1 items-center h-full`,children:[(0,I.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-gray-400 animate-pulse`}),(0,I.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-gray-400 animate-pulse [animation-delay:200ms]`}),(0,I.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-gray-400 animate-pulse [animation-delay:400ms]`})]})})}function wM({label:e}){return(0,I.jsxs)(`div`,{className:`rounded-2xl border border-gray-200 bg-white px-4 py-3 text-sm text-gray-500 shadow-sm`,children:[(0,I.jsx)(`style`,{children:bM}),(0,I.jsx)(`span`,{className:`nextclaw-chat-typing-indicator__text`,children:e})]})}function TM(e){let t=e.messages.filter(SM),n=t.some(e=>e.role===`assistant`&&(e.status===`streaming`||e.status===`pending`));return(0,I.jsxs)(`div`,{className:L(`space-y-5`,e.className),children:[t.map(t=>{let n=t.role===`user`,r=!n&&(t.status===`streaming`||t.status===`pending`);return(0,I.jsxs)(`div`,{className:L(`flex gap-3`,n?`justify-end`:`justify-start`),children:[n?null:(0,I.jsx)(Ry,{role:t.role}),(0,I.jsxs)(`div`,{className:L(`w-fit max-w-[92%] space-y-2`,n&&`flex flex-col items-end`),children:[(0,I.jsx)(gM,{message:t,texts:e.texts,onToolAction:e.onToolAction,onFileOpen:e.onFileOpen,renderToolAgent:e.renderToolAgent}),(0,I.jsx)(`div`,{className:L(`flex items-center gap-2`,n&&`justify-end`),children:r?(0,I.jsx)(CM,{}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(_M,{roleLabel:t.roleLabel,timestampLabel:t.timestampLabel,isUser:n}),n?null:(0,I.jsx)(vM,{message:t,texts:e.texts})]})})]}),n?(0,I.jsx)(Ry,{role:t.role}):null]},t.id)}),e.isSending&&!n?(0,I.jsxs)(`div`,{className:`flex justify-start gap-3`,children:[(0,I.jsx)(Ry,{role:`assistant`}),(0,I.jsx)(wM,{label:e.texts.typingLabel})]}):null]})}var EM=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.ContextWindowUpdated=`context-window.updated`,e.TypingStart=`typing.start`,e.TypingEnd=`typing.end`,e.PresenceUpdated=`presence.updated`,e}({}),DM=/\[\[\s*reply_to_current\s*\]\]/gi,OM=/\[\[\s*reply_to\s*:\s*([^\]]+?)\s*\]\]/i;function kM(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function AM(e,t){let n=e,r;DM.test(n)&&(r=kM(t),n=n.replace(DM,``).trim());let i=n.match(OM)?.[1];return i&&(r=kM(i),n=n.replace(OM,``).trim()),r?{content:n,replyTo:r}:{content:n}}function jM(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=kM(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}=AM(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 MM(e){return{...e,parts:[...e.parts],metadata:e.metadata?{...e.metadata}:void 0}}function NM(e){return MM(jM(e))}var PM=`__nextclaw_aborted_tool_call__`;function FM(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 IM(e,t){return t.trim()?e.id.startsWith(`tool-`)?!0:e.parts.some(e=>e.type===`tool-invocation`):!1}function LM(e,t,n){for(let[r,i]of e)i===t&&e.set(r,n)}function RM(e,t,n){for(let[r,i]of e)i===n&&(e.delete(r),t.delete(r))}function zM(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 BM(e,t){return zM(e,t)?.toolName??null}function VM(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 HM(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 UM=`assistant`,WM=class{messages=[];streamingMessage=null;error=null;activeRun=null;contextWindow=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,contextWindow:this.contextWindow?{...this.contextWindow}: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.contextWindow&&this.toolCallMessageIdByCallId.size===0&&this.toolCallArgsRawByCallId.size===0||(this.messages=[],this.streamingMessage=null,this.error=null,this.activeRun=null,this.contextWindow=null,this.toolCallMessageIdByCallId.clear(),this.toolCallArgsRawByCallId.clear(),this.lastSettledRunId=null,this.stateVersion+=1,this.notifyListeners())};hydrate=e=>{this.messages=e.messages.map(e=>NM(e)),this.streamingMessage=null,this.error=null,this.contextWindow=e.contextWindow?{...e.contextWindow}: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 EM.MessageSent:this.handleMessageSent(e.payload);break;case EM.MessageAbort:this.handleMessageAbort(e.payload);break;case EM.MessageTextStart:this.handleMessageTextStart(e.payload);break;case EM.MessageTextDelta:this.handleMessageTextDelta(e.payload);break;case EM.MessageTextEnd:this.handleMessageTextEnd(e.payload);break;case EM.MessageReasoningStart:this.handleMessageReasoningStart(e.payload);break;case EM.MessageReasoningDelta:this.handleMessageReasoningDelta(e.payload);break;case EM.MessageReasoningEnd:this.handleMessageReasoningEnd(e.payload);break;case EM.MessageToolCallStart:this.handleMessageToolCallStart(e.payload);break;case EM.MessageToolCallArgs:this.handleMessageToolCallArgs(e.payload);break;case EM.MessageToolCallArgsDelta:this.handleMessageToolCallArgsDelta(e.payload);break;case EM.MessageToolCallEnd:this.handleMessageToolCallEnd(e.payload);break;case EM.MessageToolCallResult:this.handleMessageToolCallResult(e.payload);break;case EM.RunStarted:this.handleRunStarted(e.payload);break;case EM.RunFinished:this.handleRunFinished(e.payload);break;case EM.RunError:this.handleRunError(e.payload);break;case EM.RunMetadata:this.handleRunMetadata(e.payload);break;case EM.ContextWindowUpdated:this.handleContextWindowUpdated(e.payload);break;case EM.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}=HM(this.streamingMessage.parts);this.upsertMessage({...this.streamingMessage,status:`final`,parts:n}),this.replaceStreamingMessage(null),t?RM(this.toolCallMessageIdByCallId,this.toolCallArgsRawByCallId,t):RM(this.toolCallMessageIdByCallId,this.toolCallArgsRawByCallId,e),r.forEach(e=>this.toolCallArgsRawByCallId.set(e,PM))}};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=VM(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=VM(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:BM(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,resultContentItems:e.contentItems};return VM(t.parts,r)})){let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId),n=VM(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:`unknown`,state:`result`,result:e.content,resultContentItems:e.contentItems});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(FM(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())};handleContextWindowUpdated=e=>{this.contextWindow={...e.contextWindow},this.stateVersion+=1};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=BM(i.parts,t)??`unknown`,o=VM(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=MM(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&&IM(i,t)){let r={...i,id:t,sessionId:e,status:n};return LM(this.toolCallMessageIdByCallId,i.id,t),this.replaceStreamingMessage(r),r}let a={id:t,sessionId:e,role:UM,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=zM(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=zM(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=NM(e);this.streamingMessage?.id===t.id&&(this.streamingMessage=null);let 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?NM(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),RM(this.toolCallMessageIdByCallId,this.toolCallArgsRawByCallId,t.id)};notifyListeners=()=>{let e=this.getSnapshot();for(let t of this.listeners)t(e)}},GM=16,KM=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()},GM))},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 qM(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 JM(e,t){if(!t)return!0;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 YM(e){return e.parts.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function XM(e,t){if(typeof e==`string`){let n=e.trim();return n?{...t?{sessionId:t}:{},message:{id:`user-${Date.now().toString(36)}`,...t?{sessionId:t}:{},role:`user`,status:`final`,parts:[{type:`text`,text:n}],timestamp:new Date().toISOString()}}:null}if(!YM(e.message))return null;let n=e.sessionId||e.message.sessionId||t;return{...e,...n?{sessionId:n}:{},message:{...e.message,...n?{sessionId:n}:{}}}}function ZM(e){let t=(0,F.useRef)();return t.current?e&&t.current.sessionId===null?t.current.sessionId=e:t.current.sessionId!==(e??null)&&(t.current={sessionId:e??null,manager:new WM}):t.current={sessionId:e??null,manager:new WM},t.current.manager}function QM({sessionId:e,client:t,manager:n}){let r=(0,F.useRef)(e),i=(0,F.useSyncExternalStore)(e=>n.subscribe(()=>e()),()=>n.getSnapshot(),()=>n.getSnapshot()),[a,o]=(0,F.useState)(!1);(0,F.useEffect)(()=>{r.current=e},[e]),(0,F.useEffect)(()=>{o(!1)},[e]),(0,F.useEffect)(()=>{let e=new KM(e=>qM(n,e)),i=t.subscribe(t=>{JM(t,r.current)&&e.enqueue(t)});return()=>{i(),e.dispose(),t.stop()}},[t,n]);let s=i.streamingMessage?[...i.messages,i.streamingMessage]:i.messages,c=i.activeRun?.runId??null,l=!!i.activeRun;return{snapshot:i,visibleMessages:s,activeRunId:c,isRunning:l,isSending:a,send:async r=>{if(a||l)return null;let i=XM(r,e);if(!i)return null;o(!0),e&&await n.dispatch({type:EM.MessageSent,payload:{sessionId:e,message:{...i.message,sessionId:e},metadata:i.metadata}});try{return await t.send(i)}finally{o(!1)}},abort:async()=>{e&&await t.abort({sessionId:e})},streamRun:async()=>{e&&(await t.stop(),await t.stream({sessionId:e}))}}}function $M(e){return e instanceof Error?e:Error(String(e))}function eN(e){let{hydratedSessionId:t,isHydrating:n,sessionId:r}=e;return r?n||t!==r:!1}function tN(e,t){let n=e.getSnapshot();return n.activeRun?.sessionId===t||n.streamingMessage?.sessionId===t||n.messages.some(e=>e.sessionId===t)}function nN(e,t){return e.status===`running`?{runId:null,sessionId:t,abortDisabledReason:null}:null}function rN(e,t,n){return n.signal.aborted||e.requestId!==t}function iN({sessionId:e,client:t,loadSeed:n}){let r=ZM(e),i=QM({sessionId:e,client:t,manager:r}),[a,o]=(0,F.useState)(!0),[s,c]=(0,F.useState)(null),[l,u]=(0,F.useState)(null),d=(0,F.useRef)({requestId:0,controller:null}),f=(0,F.useCallback)(async()=>{await t.stop(),r.reset(),c(null),u(null),o(!1),d.current={requestId:d.current.requestId+1,controller:null}},[t,r]),p=(0,F.useCallback)(e=>{c(null),u(e),o(!1)},[]),m=(0,F.useCallback)(async()=>{if(d.current.controller?.abort(),!e){await f();return}let i=new AbortController,a=d.current.requestId+1;if(d.current={requestId:a,controller:i},tN(r,e)){p(e),d.current.controller===i&&(d.current.controller=null);return}await t.stop(),r.reset(),c(null),o(!0);try{let o=await n(e,i.signal);if(rN(d.current,a,i))return;r.hydrate({sessionId:e,messages:o.messages,activeRun:nN(o,e)}),p(e),t.stream({sessionId:e}).catch(e=>{d.current.requestId===a&&c($M(e))})}catch(t){if(rN(d.current,a,i))return;c($M(t)),u(e),o(!1)}finally{d.current.controller===i&&(d.current.controller=null)}},[t,n,r,p,f,e]);return(0,F.useEffect)(()=>(m(),()=>{d.current.controller?.abort(),d.current.controller=null}),[m]),{...i,isHydrating:eN({sessionId:e,hydratedSessionId:l,isHydrating:a}),hydrateError:s}}var aN=200*1024*1024,oN=`application/octet-stream`;function sN(e){let t=e.type.trim().toLowerCase();return t.length>0?t:oN}function cN(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=sN(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 lN(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{...e.sessionId?{sessionId:e.sessionId}:{},message:{id:r,...e.sessionId?{sessionId:e.sessionId}:{},role:`user`,status:`final`,parts:t,timestamp:n,...e.metadata?{metadata:e.metadata}:{}},...e.metadata?{metadata:e.metadata}:{}}}async function uN(e,t){let n=[],r=[];for(let i of e){let e=cN(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:sN(e),sizeBytes:e.size,reason:`read-failed`}))),{attachments:[],rejected:r}}}function dN(e){let t=e.modelLabel.trim(),n=e.providerLabel.trim();return n?`${n}/${t}`:t}function fN(e){let t=[];for(let n of[`off`,...e])t.includes(n)||t.push(n);return t}function pN(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 mN({modelOptions:e,recentModelValues:t,selectedModel:n,isModelOptionsLoading:r,hasModelOptions:i,onValueChange:a,texts:o}){let s=e.find(e=>e.value===n)??e[0],c=i?s?.value:void 0,l=new Set(t??[]),u=new Map(e.map(e=>[e.value,e])),d=(t??[]).map(e=>u.get(e)).filter(e=>!!e),f=e.filter(e=>!l.has(e.value)),p=d.length>0?[{key:`recent-models`,label:o.recentModelsLabel,options:d.map(e=>({value:e.value,label:dN(e)}))},{key:`all-models`,label:o.allModelsLabel,options:f.map(e=>({value:e.value,label:dN(e)}))}].filter(e=>e.options.length>0):void 0;return{key:`model`,value:c,placeholder:o.modelSelectPlaceholder,selectedLabel:s?dN(s):void 0,icon:`sparkles`,options:e.map(e=>({value:e.value,label:dN(e)})),groups:p,disabled:!i,loading:r,emptyLabel:o.modelNoOptionsLabel,onValueChange:a}}function hN(e){if(e.supportedLevels.length===0)return null;let t=fN(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)}}var gN={exactSpec:1200,exactLabel:1150,prefixSpec:1e3,prefixLabel:950,prefixToken:900,containsSpec:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function _N(e){return(e??``).trim().toLowerCase()}function vN(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 yN(e,t){let n=_N(t);if(!n)return gN.fallback;let r=_N(e.key),i=_N(e.label||e.key),a=_N(`${e.descriptionZh??``} ${e.description??``}`),o=i.split(/[\s/_-]+/).filter(Boolean);return r===n?gN.exactSpec:i===n?gN.exactLabel:r.startsWith(n)?gN.prefixSpec:i.startsWith(n)?gN.prefixLabel:o.some(e=>e.startsWith(n))?gN.prefixToken:r.includes(n)?gN.containsSpec:i.includes(n)?gN.containsLabel:a.includes(n)?gN.containsDescription:vN(n,i)||vN(n,r)?gN.subsequence:0}function bN(e){return e>=gN.exactLabel?4:e>=gN.prefixToken?3:e>=gN.containsLabel?2:e>0?1:0}function xN(e){return new Map(e.map((e,t)=>[e,t]))}function SN(e,t){let n=xN(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 CN(e,t,n,r=[]){let i=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),a=xN(r);return e.map((e,n)=>({record:e,order:n,score:yN(e,t)})).filter(e=>e.score>0).sort((e,t)=>{let n=bN(e.score),r=bN(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 wN(e){return e.map(e=>({key:e.key,label:e.label,description:e.descriptionZh||e.description||``,badgeLabel:e.badgeLabel}))}function TN(e){let t=SN(e.skillRecords,e.recentSkillValues??[]),n=new Set(e.groupedRecentSkillValues??[]),r=wN(t.filter(e=>n.has(e.key))),i=wN(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:wN(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}}var EN=`$`;function DN(e,t){if(t.length===0)return e;let n=e[e.length-1];return n?.type===`text`?[...e.slice(0,-1),{...n,text:n.text+t}]:[...e,{type:`text`,text:t}]}function ON(){return Gv()}function kN(e){return Kv(e)}function AN(e){return Yv(e)}function jN(e){return Xv(e,`skill`)}function MN(e){return Xv(e,`file`)}function NN(e,t,n){let r=new Set(t),i=ry(e,e=>e.tokenKind===`skill`&&!r.has(e.tokenKey)),a=Xv(i,`skill`),o=new Map(n.map(e=>[e.ref,e])),s=t.filter(e=>!a.includes(e)).map(e=>Uv({tokenKind:`skill`,tokenKey:e,label:o.get(e)?.name||e}));return s.length===0?i:qv([...i,...s])}function PN(e,t){let n=new Set(t.map(e=>e.id));return ry(e,e=>e.tokenKind===`file`&&!n.has(e.tokenKey))}function FN(e,t){let n=new Set(MN(e));return t.filter(e=>n.has(e.id))}function IN(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){if(t.type===`text`){r=DN(r,t.text);continue}if(t.tokenKind===`skill`){r=DN(r,`${EN}${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 LN={isProviderStateResolved:!1,composerNodes:ON(),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:[],composerFocusRequest:null},Z=m(e=>({snapshot:LN,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))})),RN=class{constructor(e){this.options=e,this.read=()=>{let e=this.getStorage();if(!e)return[];try{return this.normalizeList(JSON.parse(e.getItem(this.options.storageKey)??`[]`))}catch{return[]}},this.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},this.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},this.write=e=>{let t=this.getStorage();if(t)try{t.setItem(this.options.storageKey,JSON.stringify(this.normalizeList(e)))}catch{}},this.getStorage=()=>Object.prototype.hasOwnProperty.call(this.options,`storage`)?this.options.storage??null:typeof window>`u`?null:window.localStorage,this.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},this.normalizeValue=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}}},zN=new RN({storageKey:`nextclaw.chat.recent-models`,limit:3}),BN=new RN({storageKey:`nextclaw.chat.recent-skills`,limit:5});function VN(e){return e.modelOptions.length>0}function HN(e){return!e.isProviderStateResolved&&!VN(e)}function UN(e){return e.isProviderStateResolved&&!VN(e)}function WN(e){return!1}function GN(e){let{hasSendableDraft:t,isRuntimeBlocked:n}=e;return n||!t}var KN=`nextclaw.chat.session-list.mode`,qN=`time-first`;function JN(e){return e===`time-first`||e===`project-first`}function YN(e){if(!e||typeof e!=`object`)return null;let{snapshot:t}=e;return!t||typeof t!=`object`?null:JN(t.listMode)?t.listMode:null}function XN(e,t){let n=e?.trim();if(!n)return!1;let r=t?.trim();return r?n.localeCompare(r)>0:!1}function ZN(e){let{active:t,readAt:n,runStatus:r,lastMessageAt:i}=e;return t||r===`running`?!1:XN(i,n)}var QN={selectedSessionKey:null,selectedAgentId:`main`,query:``,listMode:qN};function $N(e){return t=>e(e=>({snapshot:{...e.snapshot,...t}}))}function eP(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 tP=m()(En(e=>({snapshot:QN,optimisticReadAtBySessionKey:{},setSnapshot:$N(e),markSessionRead:eP(e)}),{name:KN,storage:kn(()=>window.localStorage),partialize:e=>({snapshot:{listMode:e.snapshot.listMode}}),merge:(e,t)=>{let n=YN(e);return n?{...t,snapshot:{...t.snapshot,listMode:n}}:t}})),nP={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,hasSubmittedDraftMessage:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,workspaceFileTabs:[],activeWorkspaceFileKey:null,contextWindow:null},Q=m(e=>({snapshot:nP,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))}));function rP(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function iP(e){if(!e||e.totalContextTokens<=0)return null;let t=e.usedContextTokens/e.totalContextTokens,n=Math.max(0,Math.min(1,t)),r=`${Math.round(n*100)}%`,i=n>=.9?`danger`:n>=.75?`warning`:`neutral`,a=[{label:s(`chatContextWindowUsed`),value:rP(e.usedContextTokens)},{label:s(`chatContextWindowTotal`),value:rP(e.totalContextTokens)},{label:s(`chatContextWindowAvailable`),value:rP(e.availableContextTokens)}];return e.prunedUsedContextTokens!==e.usedContextTokens&&a.push({label:s(`chatContextWindowPruned`),value:rP(e.prunedUsedContextTokens)}),e.droppedHistoryCount>0&&a.push({label:s(`chatContextWindowDroppedHistory`),value:String(e.droppedHistoryCount)}),e.truncatedToolResultCount>0&&a.push({label:s(`chatContextWindowTruncatedTools`),value:String(e.truncatedToolResultCount)}),{label:s(`chatContextWindow`),percentLabel:r,ratio:n,tone:i,details:a}}function aP(){let e=tP(e=>e.snapshot.selectedSessionKey),t=Q(e=>e.snapshot.sessionKey),n=Q(e=>e.snapshot.contextWindow);return(0,F.useMemo)(()=>e&&t===e&&n?iP(n):null,[n,t,e])}function oP(e){return e.bootstrapStatus?.ncpAgent.state!==`ready`}function sP(e){return e.activeSystemAction?.message?.trim()||(e.lifecyclePhase===`cold-starting`?s(`chatRuntimeInitializing`):e.lifecyclePhase===`startup-failed`?e.bootstrapStatus?.ncpAgent.error?.trim()||e.bootstrapStatus?.lastError?.trim()||e.lastError?.trim()||s(`chatRuntimeInitializationFailed`):null)}function cP(e){let{message:t,status:n}=e,r=t?.trim();if(!r)return sP(n);let i=n.activeSystemAction?.message?.trim();if(n.phase===`service-transitioning`&&i)return i;let a=Fe(r);return n.phase===`recovering`&&a?s(`runtimeControlRecoveringHelp`):n.phase===`stalled`&&a?null:r}function lP(){return{off:s(`chatThinkingLevelOff`),minimal:s(`chatThinkingLevelMinimal`),low:s(`chatThinkingLevelLow`),medium:s(`chatThinkingLevelMedium`),high:s(`chatThinkingLevelHigh`),adaptive:s(`chatThinkingLevelAdaptive`),xhigh:s(`chatThinkingLevelXhigh`)}}function uP(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 dP(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 fP(e){return{skillScopeLabels:(0,F.useMemo)(()=>({builtin:s(`chatSkillScopeBuiltin`),project:s(`chatSkillScopeProject`),workspace:s(`chatSkillScopeWorkspace`)}),[e]),slashTexts:(0,F.useMemo)(()=>({slashSkillSubtitle:s(`chatSlashTypeSkill`),slashSkillSpecLabel:s(`chatSlashSkillSpec`),slashSkillScopeLabel:s(`chatSlashSkillScope`),noSkillDescription:s(`chatSkillsPickerNoDescription`)}),[e]),recentModelsLabel:s(`chatPickerRecentModels`),allModelsLabel:s(`chatPickerAllModels`),recentSkillsLabel:s(`chatPickerRecent`),allSkillsLabel:s(`chatPickerAllSkills`)}}function pP(e,t){let n=(0,F.useMemo)(()=>uP(e.skillRecords,t),[e.skillRecords,t]),r=(0,F.useMemo)(()=>dP(e.modelOptions),[e.modelOptions]);return{skillRecords:n,modelRecords:r,recentModelValues:zN.resolveVisible({availableValues:r.map(e=>e.value),minAvailableCount:5}),recentSkillValues:BN.resolveVisible({availableValues:n.map(e=>e.key),minAvailableCount:0}),recentSkillGroupValues:BN.resolveVisible({availableValues:n.map(e=>e.key),minAvailableCount:4})}}function mP(e){let{attachmentSupported:t,inputBarRef:n,presenter:r}=e,i=(0,F.useCallback)(e=>{if(e===`unsupported-type`){N.error(s(`chatInputAttachmentUnsupported`));return}if(e===`too-large`){N.error(s(`chatInputAttachmentTooLarge`).replace(`{maxMb}`,String(aN/(1024*1024))));return}N.error(s(`chatInputAttachmentReadFailed`))},[]),a=(0,F.useCallback)(async e=>{if(!t||e.length===0)return;let a=await uN(e,{uploadBatch:qe});if(a.attachments.length>0){let e=r.chatInputManager.addAttachments?.(a.attachments)??[];e.length>0&&n.current?.insertFileTokens(e.map(e=>({tokenKey:e.id,label:e.name})))}a.rejected.length>0&&i(a.rejected[0].reason)},[t,n,r.chatInputManager,i]);return{handleFilesAdd:a,handleFileInputChange:(0,F.useCallback)(async e=>{let t=Array.from(e.target.files??[]);e.currentTarget.value=``,await a(t)},[a])}}function hP(e){let{allModelsLabel:t,hasModelOptions:n,isModelOptionsLoading:r,modelRecords:i,presenter:a,recentModelValues:o,recentModelsLabel:c,selectedModel:l,selectedThinkingLevel:u,thinkingSupportedLevels:d,thinkingDefaultLevel:f}=e;return[mN({modelOptions:i,recentModelValues:o,selectedModel:l,isModelOptionsLoading:r,hasModelOptions:n,onValueChange:a.chatInputManager.selectModel,texts:{modelSelectPlaceholder:s(`chatSelectModel`),modelNoOptionsLabel:s(`chatModelNoOptions`),recentModelsLabel:c,allModelsLabel:t}}),hN({supportedLevels:d,selectedThinkingLevel:u,defaultThinkingLevel:f,onValueChange:e=>a.chatInputManager.selectThinkingLevel(e),texts:{thinkingLabels:lP()}})].filter(e=>e!==null)}function gP(e){let{allSkillsLabel:t,presenter:n,recentSkillGroupValues:r,recentSkillValues:i,recentSkillsLabel:a,skillRecords:o,snapshot:c}=e;return TN({skillRecords:o,recentSkillValues:i,groupedRecentSkillValues:r,selectedSkills:c.selectedSkills,isLoading:c.isSkillsLoading,onSelectedKeysChange:n.chatInputManager.selectSkills,texts:{title:s(`chatSkillsPickerTitle`),searchPlaceholder:s(`chatSkillsPickerSearchPlaceholder`),emptyLabel:s(`chatSkillsPickerEmpty`),loadingLabel:s(`sessionsLoading`),manageLabel:s(`chatSkillsPickerManage`),recentSkillsLabel:a,allSkillsLabel:t}})}function _P(){let e=sc(),{language:t}=Ar(),{isMobile:n}=Fr(),r=Z(e=>e.snapshot),i=oP(Je()),[a,o]=(0,F.useState)(null),c=(0,F.useRef)(null),l=(0,F.useRef)(null),u=fP(t),{skillRecords:d,modelRecords:f,recentModelValues:p,recentSkillValues:m,recentSkillGroupValues:h}=pP(r,u.skillScopeLabels),g=VN(r),_=HN(r),v=UN(r),y=WN(r),b=typeof e.chatInputManager.addAttachments==`function`,x=s(v?`chatModelNoOptions`:n?`chatInputPlaceholderCompact`:`chatInputPlaceholder`),S=(0,F.useMemo)(()=>CN(d,a??``,u.slashTexts,m),[u.slashTexts,m,d,a]),C=aP(),w=f.find(e=>e.value===r.selectedModel),T=w?.thinkingCapability?.supported??[],E=r.stopDisabledReason===`__preparing__`?s(`chatStopPreparing`):r.stopDisabledReason?.trim()||s(`chatStopUnavailable`),{handleFilesAdd:D,handleFileInputChange:O}=mP({attachmentSupported:b,inputBarRef:c,presenter:e});(0,F.useEffect)(()=>{let t=r.composerFocusRequest;t&&(t.placement===`end`&&c.current?.focusComposerAtEnd(),e.chatInputManager.consumeComposerFocusRequest(t.id))},[e.chatInputManager,r.composerFocusRequest]);let k=hP({allModelsLabel:u.allModelsLabel,hasModelOptions:g,isModelOptionsLoading:_,modelRecords:f,presenter:e,recentModelValues:p,recentModelsLabel:u.recentModelsLabel,selectedModel:r.selectedModel,selectedThinkingLevel:r.selectedThinkingLevel,thinkingSupportedLevels:T,thinkingDefaultLevel:w?.thinkingCapability?.default??null}),A=gP({allSkillsLabel:u.allSkillsLabel,presenter:e,recentSkillGroupValues:h,recentSkillValues:m,recentSkillsLabel:u.recentSkillsLabel,skillRecords:d,snapshot:r}),ee=r.draft.trim().length>0||r.attachments.length>0||jN(r.composerNodes).length>0;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Ly,{ref:c,composer:{nodes:r.composerNodes,placeholder:x,disabled:y,onNodesChange:e.chatInputManager.setComposerNodes,...b?{onFilesAdd:D}:{},onSlashQueryChange:o},slashMenu:{isLoading:r.isSkillsLoading,items:S,onSelectItem:t=>{t.value&&e.chatInputManager.rememberSkillSelection(t.value)},texts:{slashLoadingLabel:s(`chatSlashLoading`),slashSectionLabel:s(`chatSlashSectionSkills`),slashEmptyLabel:s(`chatSlashNoResult`),slashHintLabel:s(`chatSlashHint`),slashSkillHintLabel:s(`chatSlashSkillHint`)}},hint:pN({isModelOptionsLoading:_,isModelOptionsEmpty:v,onGoToProviders:e.chatInputManager.goToProviders,texts:{noModelOptionsLabel:s(`chatModelNoOptions`),configureProviderLabel:s(`chatGoConfigureProvider`)}}),toolbar:{selects:k,accessories:[{key:`attach`,label:s(`chatInputAttach`),icon:`paperclip`,iconOnly:!0,disabled:!b||y||r.isSending,...b?{onClick:()=>l.current?.click()}:{tooltip:s(`chatInputAttachComingSoon`)}}],skillPicker:A,actions:{sendError:i?null:r.sendError,isSending:r.isSending,canStopGeneration:r.canStopGeneration,sendDisabled:GN({snapshot:r,hasSendableDraft:ee,isRuntimeBlocked:i}),stopDisabled:!r.canStopGeneration,stopHint:E,sendButtonLabel:s(`chatSend`),stopButtonLabel:s(`chatStop`),contextWindow:C,onSend:e.chatInputManager.send,onStop:e.chatInputManager.stop}}}),b?(0,I.jsx)(`input`,{ref:l,type:`file`,multiple:!0,className:`hidden`,onChange:O}):null]})}var vP=[`cmd`,`command`,`query`,`q`,`path`,`url`,`to`,`channel`,`agentId`,`sessionKey`];function yP(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bP(e,t=2400){return e.length<=t?e:`${e.slice(0,t)}\n…`}function xP(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:t<=1?`…`:`${n.slice(0,t-1)}…`}function SP(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(e==null)return``;try{return bP(JSON.stringify(e,null,2))}catch{return String(e)}}function CP(e){if(yP(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 yP(e)?e:null}catch{return null}}function wP(e){let t=CP(e);if(!t){let t=SP(e).trim();return t?xP(t,120):void 0}let n=[];for(let e of vP){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?xP(n.join(` · `),120):xP(SP(t),140)}var TP=`ui_inline_tokens`,EP=`$`;function DP(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function OP(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function kP(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 AP(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:`${EP}${n.tokenKey}`});return kP(t)}function jP(e){let t=e?.[TP];if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!DP(e))continue;let t=OP(e.kind),r=OP(e.key),i=OP(e.rawText);!t||!r||!i||n.push({kind:t,key:r,rawText:i,label:OP(e.label)??r})}return kP(n)}function MP(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 NP=/\u200B|\u200C|\u200D|\u2060|\uFEFF/g;function PP(e){let t=e.trim();return t&&t.replace(NP,``).trim()?t:null}function FP(e){return e.replace(NP,``).trim().length>0}function IP(e,t){let n=MP(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&&(FP(e.text)&&(i=!0),r.push({type:`markdown`,text:e.text}))}return i?r:null}function LP(e,t){let n=IP(e.text,t);if(n&&n.some(e=>e.type===`token`))return{type:`inline-content`,segments:n};let r=PP(e.text);return r?{type:`markdown`,text:r}:null}function RP(e){return PP(e)}function zP(e){return typeof e==`object`&&!!e}function BP(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function VP(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 HP(e){return zP(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 UP(e,t){if(!zP(e))return null;let n=zP(e.asset)?e.asset:Array.isArray(e.assets)&&e.assets.length>0&&zP(e.assets[0])?e.assets[0]:null;if(!n)return null;let r=BP(n.url),i=BP(n.mimeType)??`application/octet-stream`,a=VP(n.sizeBytes);return r?{type:`file`,file:{label:BP(n.name)??(i.startsWith(`image/`)?t.imageAttachmentLabel:t.fileAttachmentLabel),mimeType:i,dataUrl:r,...a==null?{}:{sizeBytes:a},isImage:i.startsWith(`image/`)}}:null}function WP(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 GP(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 KP(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 qP(e,t){return SP(t??KP(e)).trim()||void 0}function JP(e){return typeof e==`object`&&!!e}function YP(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 XP(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function ZP(e){let t=YP(e);return JP(t)?XP(t.agentId):null}function QP(e){return ZP(e.parsedArgs)??ZP(e.args)??ZP(e.result)}var $P=12e3,eF=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function tF(e){let t=e.replace(/\r\n/g,`
92
+ `).replace(/\r/g,`
93
+ `);return t===``?[]:t.split(`
94
+ `)}function nF(e){return typeof e==`number`?e+1:void 0}function rF(e){return{kind:e.kind,text:e.text,...typeof e.oldLineNumber==`number`?{oldLineNumber:e.oldLineNumber}:{},...typeof e.newLineNumber==`number`?{newLineNumber:e.newLineNumber}:{}}}function iF(e){let t=eF.exec(e);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}function aF(e){return tF(e.text).map((t,n)=>e.kind===`add`?rF({kind:`add`,text:t,newLineNumber:e.newStartLine+n}):rF({kind:`context`,text:t,oldLineNumber:e.oldStartLine+n,newLineNumber:e.newStartLine+n}))}function oF(e){let t=e.oldStartLine,n=e.newStartLine;return[...e.beforeLines.map(e=>{let n=rF({kind:`remove`,text:e,oldLineNumber:t});return t=nF(t),n}),...e.afterLines.map(e=>{let t=rF({kind:`add`,text:e,newLineNumber:n});return n=nF(n),t})]}function sF(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 cF(e){for(let t=e.beforeIndex;t<e.beforeLines.length;t+=1)e.lines.push(rF({kind:`remove`,text:e.beforeLines[t]??``,oldLineNumber:e.oldLineNumber})),e.oldLineNumber=nF(e.oldLineNumber);for(let t=e.afterIndex;t<e.afterLines.length;t+=1)e.lines.push(rF({kind:`add`,text:e.afterLines[t]??``,newLineNumber:e.newLineNumber})),e.newLineNumber=nF(e.newLineNumber)}function lF(e){let t=tF(e.beforeText),n=tF(e.afterText);if(t.length*n.length>$P)return oF({beforeLines:t,afterLines:n,oldStartLine:e.oldStartLine,newStartLine:e.newStartLine});let r=sF({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(rF({kind:`context`,text:t[a]??``,oldLineNumber:s,newLineNumber:c})),a+=1,o+=1,s=nF(s),c=nF(c);continue}if((r[a+1][o]??0)>=(r[a][o+1]??0)){i.push(rF({kind:`remove`,text:t[a]??``,oldLineNumber:s})),a+=1,s=nF(s);continue}i.push(rF({kind:`add`,text:n[o]??``,newLineNumber:c})),o+=1,c=nF(c)}return cF({lines:i,beforeLines:t,afterLines:n,beforeIndex:a,afterIndex:o,oldLineNumber:s,newLineNumber:c}),i}var uF=120;function dF(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 fF(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 pF(e){return e.length<=uF?{lines:e,truncated:!1}:{lines:e.slice(0,uF),truncated:!0}}function mF(e){let t=pF(e.lines);return{path:e.path,display:`diff`,caption:dF({operation:e.operation,lines:e.lines}),lines:t.lines,...t.truncated?{fullLines:e.lines}:{},truncated:t.truncated}}function hF(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=aF({text:t,kind:n,oldStartLine:r,newStartLine:i});return{path:e.path,display:`preview`,caption:dF({operation:e.operation,lines:a}),lines:a,rawText:t,oldStartLine:r,newStartLine:i}}function gF(e){let{oldStartLine:t,newStartLine:n}=fF(e),r=lF({beforeText:e.beforeText??``,afterText:e.afterText??``,oldStartLine:t,newStartLine:n}),i=pF(r);return i.lines.length===0?null:{path:e.path,display:`diff`,caption:dF({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 _F(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 vF(e){let{currentLines:t,line:n}=e;return n.startsWith(`+`)?(t.push(rF({kind:`add`,text:n.slice(1),newLineNumber:e.newLineNumber})),{oldLineNumber:e.oldLineNumber,newLineNumber:nF(e.newLineNumber)}):n.startsWith(`-`)?(t.push(rF({kind:`remove`,text:n.slice(1),oldLineNumber:e.oldLineNumber})),{oldLineNumber:nF(e.oldLineNumber),newLineNumber:e.newLineNumber}):n.startsWith(` `)?(t.push(rF({kind:`context`,text:n.slice(1),oldLineNumber:e.oldLineNumber,newLineNumber:e.newLineNumber})),{oldLineNumber:nF(e.oldLineNumber),newLineNumber:nF(e.newLineNumber)}):{oldLineNumber:e.oldLineNumber,newLineNumber:e.newLineNumber}}function yF(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(mF({path:n,operation:r,lines:i})),n=null,r=null,i=[],a=void 0,o=void 0};for(let t of tF(e)){if(_F({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=iF(t);a=e?.oldLineNumber,o=e?.newLineNumber;continue}if(!n)continue;let e=vF({currentLines:i,line:t,oldLineNumber:a,newLineNumber:o});a=e.oldLineNumber,o=e.newLineNumber}return s(),t}function bF(e){let t=[],n=null,r=[],i,a,o=()=>{if(!n){r=[],i=void 0,a=void 0;return}t.push(mF({path:n,operation:`update`,lines:r})),n=null,r=[],i=void 0,a=void 0};for(let t of tF(e)){if(t.startsWith(`+++ `)){o(),n=t.slice(4).trim().replace(/^b\//,``).replace(/^a\//,``);continue}if(t.startsWith(`--- `))continue;if(t.startsWith(`@@`)){let e=iF(t);i=e?.oldLineNumber,a=e?.newLineNumber;continue}if(!n)continue;let e=vF({currentLines:r,line:t,oldLineNumber:i,newLineNumber:a});i=e.oldLineNumber,a=e.newLineNumber}return o(),t}function xF(e){return e.includes(`*** Begin Patch`)?yF(e):e.includes(`--- `)&&e.includes(`+++ `)?bF(e):[]}function SF(e){switch(e){case`"`:case`\\`:case`/`:return e;case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
95
+ `;case`r`:return`\r`;case`t`:return` `;default:return e}}function CF(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 wF(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+=SF(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 TF(e,t,n=1/0){for(let r of t){let t=CF(e,r);if(t!=null)return wF(e,t,n)}return null}function EF(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function DF(e){return typeof e==`string`&&e.trim()?e.trim():null}function OF(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:typeof e==`string`&&/^\d+$/.test(e.trim())?Number(e.trim()):null}function kF(e){if(EF(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 EF(e)?e:null}catch{return null}}function AF(e){if(EF(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;let n=TF(t,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`])?.value??null,r=TF(t,[`content`,`text`,`afterText`,`after_text`])?.value??null,i=TF(t,[`oldText`,`beforeText`,`before_text`])?.value??null,a=TF(t,[`newText`,`afterText`,`after_text`])?.value??null,o=TF(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 jF(e){return DF(e.path)??DF(e.filePath)??DF(e.file_path)??DF(e.targetPath)??DF(e.target_path)??DF(e.filename)??DF(e.name)}function MF(e){return $(e.operation)??$(e.op)??$(e.action)??$(e.kind)??$(e.type)??$(e.status)}function NF(e,t){for(let n of t){let t=OF(e[n]);if(t!==null)return t}return null}function PF(e){return NF(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 FF(e){return NF(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 IF(e){return $(e.patch)??$(e.diff)??$(e.unifiedDiff)??$(e.unified_diff)}function LF(e){return $(e.beforeText)??$(e.before_text)??$(e.oldText)??$(e.old_text)??$(e.oldContent)??$(e.old_content)??$(e.before)??$(e.previous)}function RF(e){return $(e.afterText)??$(e.after_text)??$(e.newText)??$(e.new_text)??$(e.newContent)??$(e.new_content)??$(e.content)??$(e.text)??$(e.after)??$(e.updated)}var zF=new Set([`file_change`,`read_file`,`write_file`,`edit_file`,`apply_patch`]);function BF(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 VF(e,t){let n=jF(e)??t,r=MF(e),i=PF(e),a=FF(e),o=IF(e);if(o){let e=xF(o);if(e.length>0)return e[0]??null}let s=LF(e),c=RF(e);if(s!=null||c!=null)return gF({path:n,beforeText:s,afterText:c,operation:r,oldStartLine:i,newStartLine:a});let l=$(e.preview);return l?hF({path:n,text:l,operation:r,oldStartLine:i,newStartLine:a}):null}function HF(e){if(!Array.isArray(e))return[];let t=[];return e.forEach((e,n)=>{if(typeof e==`string`){let n=xF(e);n.length>0&&t.push(...n);return}if(!EF(e))return;let r=VF(e,jF(e)??`file-${n+1}`);if(r){t.push(r);return}let i=Array.isArray(e.changes)?HF(e.changes):[];i.length>0&&t.push(...i)}),t}function UF(e){let t=kF(e.result)??kF(e.parsedArgs)??kF(e.args);return t?BF(HF(t.changes)):null}function WF(e){let t=kF(e.parsedArgs)??kF(e.args)??AF(e.args),n=t&&jF(t),r=$(e.result);return!n||!r?null:BF([hF({path:n,text:r,operation:`read`})].filter(e=>!!e))}function GF(e){if(e.status===`partial-call`&&typeof e.args==`string`){let t=TF(e.args,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`]),n=TF(e.args,[`content`,`text`,`afterText`,`after_text`]);if(t?.value&&n?.value){let e=hF({path:t.value,text:n.value,operation:`write`});if(e)return BF([e])}}let t=kF(e.parsedArgs)??kF(e.args)??AF(e.args);if(!t)return null;let n=jF(t),r=$(t.content);return!n||!r?null:BF([hF({path:n,text:r,operation:`write`})].filter(e=>!!e))}function KF(e){let t=kF(e.result),n=kF(e.parsedArgs)??kF(e.args)??AF(e.args);if(!t&&!n)return null;let r=(t?jF(t):null)??(n?jF(n):null),i=(t?LF(t):null)??(n?LF(n):null),a=(t?RF(t):null)??(n?RF(n):null),o=(t?PF(t):null)??(n?PF(n):null),s=(t?FF(t):null)??(n?FF(n):null);return!r||i==null&&a==null?null:BF([gF({path:r,beforeText:i,afterText:a,operation:`edit`,oldStartLine:o,newStartLine:s})].filter(e=>!!e))}function qF(e){let t=kF(e.parsedArgs),n=kF(e.args)??AF(e.args),r=$(e.args)??(t?$(t.patch):null)??(n?$(n.patch):null);return r?BF(xF(r)):null}function JF(e){return zF.has(e.toolName)?e.toolName===`file_change`?UF(e):e.toolName===`read_file`?WF(e):e.toolName===`write_file`?GF(e):e.toolName===`edit_file`?KF(e):e.toolName===`apply_patch`?qF(e):null:null}function YF(e){return typeof e==`object`&&!!e}function XF(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function ZF(e){return!YF(e)||e.kind!==`nextclaw.session_request`?null:e}function QF(e){return!YF(e)||e.kind!==`nextclaw.session`?null:e}function $F(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 eI(e){return SP($F(e)).trim()||void 0}function tI(e,t){return[XF(e.title)?`title: ${e.title?.trim()}`:null,XF(e.sessionId)?`session: ${e.sessionId?.trim()}`:null,XF(e.task)?`task: ${e.task?.trim()}`:null].filter(e=>!!e).join(` · `)||wP(t)}function nI(e,t){return[XF(e.title)?`title: ${e.title?.trim()}`:null,XF(e.sessionId)?`session: ${e.sessionId?.trim()}`:null].filter(e=>!!e).join(` · `)||wP(t)}function rI(e){let t=XF(e.requestId),n=XF(e.sessionId),r=XF(e.title),i=XF(e.task),a=XF(e.status),o=XF(e.notify),s=XF(e.lifecycle),c=XF(e.parentSessionId),l=XF(e.spawnedByRequestId),u=e.message===void 0?``:SP(e.message).trim(),d=e.finalResponseText===void 0?``:SP(e.finalResponseText).trim(),f=e.error===void 0?``:SP(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(`
96
+
97
+ `):void 0}function iI(e){let t=XF(e.sessionId),n=XF(e.title),r=XF(e.sessionType),i=XF(e.lifecycle),a=XF(e.parentSessionId),o=XF(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(`
98
+
99
+ `):void 0}function aI(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=ZF(o);if(s){let e=XF(s.status)?.toLowerCase(),t=tI(s,a),o=rI(s),c=XF(s.sessionId),l=QP({args:a,result:s}),u=c?{kind:`open-session`,sessionId:c,sessionKind:s.isChildSession===!0?`child`:`session`,...l?{agentId:l}:{},...XF(s.title)?{label:s.title.trim()}:{},...XF(s.parentSessionId)?{parentSessionId:s.parentSessionId.trim()}:{}}:void 0;return e===`failed`?{kind:`result`,name:r,detail:t,input:eI(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:eI(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:eI(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`running`,statusLabel:n.toolStatusRunningLabel,...l?{agentId:l}:{},...u?{action:u}:{}}}let c=QF(o);if(!c)return null;let l=nI(c,a),u=iI(c),d=XF(c.sessionId),f=QP({args:a,result:c}),p=d?{kind:`open-session`,sessionId:d,sessionKind:c.isChildSession===!0?`child`:`session`,...f?{agentId:f}:{},...XF(c.title)?{label:c.title.trim()}:{},...XF(c.parentSessionId)?{parentSessionId:c.parentSessionId.trim()}:{}}:void 0;return{kind:`result`,name:r,detail:l,input:eI(a),text:u,callId:i||void 0,hasResult:!!u,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...f?{agentId:f}:{},...p?{action:p}:{}}}function oI(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e.error:null;return typeof t==`object`&&t&&!Array.isArray(t)&&t.code===`invalid_tool_arguments`?t:null}function sI(e,t){let n=RP(e.reasoning);return n?{type:`reasoning`,text:n,label:t.reasoningLabel}:null}function cI(e,t){let n=e.mimeType.startsWith(`image/`),r=VP(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 lI(e,t){let n=e.toolInvocation,r=UP(n.result,t);if(r)return r;let i=aI({invocation:n,texts:{toolStatusRunningLabel:t.toolStatusRunningLabel,toolStatusCompletedLabel:t.toolStatusCompletedLabel,toolStatusFailedLabel:t.toolStatusFailedLabel}});if(i)return{type:`tool-card`,card:WP(i,t)};let a=GP({status:n.status,error:n.error,cancelled:n.cancelled,result:n.result,texts:t}),o=oI(n.result),s=Array.isArray(o?.issues)?o.issues.find(e=>typeof e==`string`&&e.trim().length>0):void 0,c=JF({toolName:n.toolName,status:n.status,toolCallId:n.toolCallId,args:n.args,parsedArgs:n.parsedArgs,result:n.result}),l=s?`Invalid arguments: ${s}`:c?.summary??wP(n.parsedArgs??n.args),u=c?void 0:qP(n.args,n.parsedArgs),d=s||(typeof n.error==`string`&&n.error.trim()?n.error.trim():n.result==null?``:SP(n.result).trim()),f=!n.error&&HP(n.result),p=(!c?.fileOperation||!!n.error)&&!f,m=QP(n);return{type:`tool-card`,card:WP({kind:a.kind,name:n.toolName,...m?{agentId:m}:{},detail:l,...u?{input:u}:{},text:p&&d?d:void 0,outputData:n.result,callId:n.toolCallId||void 0,hasResult:a.hasResult,statusTone:o?`error`:a.statusTone,statusLabel:o?t.toolStatusFailedLabel:a.statusLabel,...c?.fileOperation?{fileOperation:c.fileOperation}:{}},t)}}function uI(e,t){return{type:`unknown`,label:t.unknownPartLabel,rawType:typeof e.type==`string`?e.type:`unknown`,text:SP(e)}}function dI(e){return e.type===`text`&&typeof e.text==`string`}function fI(e){return e.type===`reasoning`&&typeof e.reasoning==`string`}function pI(e){return e.type===`file`&&typeof e.mimeType==`string`&&typeof e.data==`string`}function mI(e){return e.type!==`tool-invocation`||typeof e.toolInvocation!=`object`||e.toolInvocation===null||Array.isArray(e.toolInvocation)?!1:`toolName`in e.toolInvocation&&typeof e.toolInvocation.toolName==`string`}function hI(e){let{inlineTokens:t,part:n,texts:r}=e;return dI(n)?LP(n,t):fI(n)?sI(n,r):pI(n)?cI(n,r):mI(n)?lI(n,r):uI(n,r)}function gI(e){let t=e.meta?.timestamp;return t&&Number.isFinite(Date.parse(t))?t:new Date().toISOString()}function _I(e,t){return e===`user`?t.user:e===`assistant`?t.assistant:e===`tool`?t.tool:e===`system`?t.system:t.fallback}function vI(e){return e===`user`||e===`assistant`||e===`tool`||e===`system`?e:`message`}function yI(e,t){return{id:e.id,role:vI(e.role),roleLabel:_I(e.role,t.texts.roleLabels),timestampLabel:t.formatTimestamp(gI(e)),status:e.meta?.status,parts:e.parts.map(n=>hI({part:n,inlineTokens:e.meta?.inlineTokens??[],texts:t.texts})).filter(e=>e!==null)}}var bI=function(e){return e.CALL=`call`,e.RESULT=`result`,e.PARTIAL_CALL=`partial-call`,e.ERROR=`error`,e.CANCELLED=`cancelled`,e}({});function xI(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function SI(e){return xI(e)}function CI(e){let t=xI(e);if(!t)return null;let n=t.replace(/[\\/]+$/,``);if(!n)return t;let r=n.split(/[\\/]/).filter(Boolean);return r[r.length-1]??n}function wI(e){return/^[A-Za-z]:[\\/]?$/.test(e)||e===`/`?e:e.replace(/[\\/]+$/,``)}function TI(e){let t=wI(e.trim().replace(/\\/g,`/`));return/^[A-Za-z]:/.test(t)?`${t.slice(0,1).toLowerCase()}${t.slice(1)}`:t}function EI(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 DI(e){let t=TI(e.path),n=TI(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 OI(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 kI(e){let{column:t,line:n}=e;return typeof n==`number`?`L${n}${typeof t==`number`?`:${t}`:``}`:null}function AI(e){let{column:t,line:n,path:r,sessionProjectRoot:i,truncated:a}=e,o=r.trim(),s=i?.trim()&&o?DI({path:o,sessionProjectRoot:i}):null,c;if(i?.trim()&&s){let e=CI(i)??i.trim();c=OI({labels:s,leading:{key:`workspace:${e}`,label:e,kind:`workspace`,isCurrent:s.length===0}})}else{let{prefix:e,segments:t}=EI(o);c=OI({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:kI({line:n,column:t}),truncated:a,segments:c}}var jI=new Set([`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`]),MI=new Set([`running`,`completed`,`failed`,`idle`]);function NI(e){if(typeof e==`string`)return e;try{return JSON.stringify(e??{})}catch{return String(e??``)}}function PI(e){return`${x}/api/ncp/assets/content?${new URLSearchParams({uri:e}).toString()}`}function FI(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function II(e){let{metadata:t}=e;return!t||typeof t!=`object`||Array.isArray(t)?null:t}function LI(e){let t=II(e)?.last_activity_preview;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,{state:r}=n,i=FI(n.timestamp);if(!MI.has(r)||!i)return null;let a=FI(n.statusText),o=FI(n.replyText);return{state:r,timestamp:i,...a?{statusText:a}:{},...o?{replyText:o}:{}}}function RI(e){let t=II(e);return t?FI(t.preferred_model)??FI(t.preferredModel)??FI(t.model):null}function zI(e){let t=II(e);if(!t)return null;let n=FI(t.preferred_thinking)??FI(t.thinking)??FI(t.thinking_level)??FI(t.thinkingLevel);if(!n)return null;let r=n.toLowerCase();return jI.has(r)?r:null}function BI(e){let t=II(e);return t?FI(t.label):null}function VI(e){let t=II(e);return t?SI(t.project_root??t.projectRoot):null}function HI(e){let t=II(e);return t?FI(t.ui_last_read_at):null}function UI(e){let t=II(e);return t?FI(t.runtime)??FI(t.session_type)??FI(t.sessionType)??`native`:`native`}function WI(e){let t=II(e);return t?FI(t.parent_session_id)??FI(t.parentSessionId):null}function GI(e){let t=II(e);return t?FI(t.spawned_by_request_id)??FI(t.spawnedByRequestId):null}function KI(e){let t=II(e);return t?t.child_session_promoted===!0:!1}function qI(e){if(e.startsWith(`cron:`))return{type:`cron`};if(e.startsWith(`agent:`)){let t=e.split(`:`);if(t.length>=3){let e=t[2];if(e&&e!==`main`&&e!==`direct`)return{channel:e}}}return{}}function JI(e){return e.state===`cancelled`?bI.CANCELLED:e.state===`result`?bI.RESULT:e.state===`partial-call`?bI.PARTIAL_CALL:bI.CALL}function YI(e){let t=[];for(let n of e){if(n.type===`text`){t.push({type:`text`,text:n.text});continue}if(n.type===`rich-text`){t.push({type:`text`,text:n.text});continue}if(n.type===`reasoning`){t.push({type:`reasoning`,reasoning:n.text,details:[]});continue}if(n.type===`source`){t.push({type:`source`,source:{sourceType:`url`,id:n.url??n.title??Math.random().toString(36).slice(2,8),url:n.url??``,...n.title?{title:n.title}:{}}});continue}if(n.type===`file`&&n.contentBase64){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:n.contentBase64,...n.url?{url:n.url}:{},...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`file`&&n.url){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:``,url:n.url,...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`file`&&n.assetUri){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:``,url:PI(n.assetUri),...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`step-start`){t.push({type:`step-start`});continue}n.type===`tool-invocation`&&t.push({type:`tool-invocation`,toolInvocation:{status:JI(n),toolCallId:n.toolCallId??`${n.toolName}-${Math.random().toString(36).slice(2,8)}`,toolName:n.toolName,args:NI(n.args),result:n.result}})}return t}function XI(e){return e===`service`?`system`:e===`tool`?`assistant`:e}function ZI(e){return{id:e.id,role:XI(e.role),parts:YI(e.parts),meta:{source:`stream`,status:e.status,sessionKey:e.sessionId,timestamp:e.timestamp}}}function QI(e){let t=BI(e),n=RI(e),r=zI(e),i=VI(e),a=HI(e),o=FI(e.lastMessageAt),s=CI(i),c=qI(e.sessionId),l=WI(e),u=GI(e),d=KI(e),f=LI(e);return{key:e.sessionId,createdAt:e.createdAt??e.updatedAt,updatedAt:e.updatedAt,...o?{lastMessageAt:o}:{},...a?{readAt:a}:{},...typeof e.agentId==`string`&&e.agentId.trim().length>0?{agentId:e.agentId.trim()}:{},...t?{label:t}:{},...c,...n?{preferredModel:n}:{},...r?{preferredThinking:r}:{},...i?{projectRoot:i}:{},...s?{projectName:s}:{},sessionType:UI(e),sessionTypeMutable:!1,status:e.status??`idle`,isChildSession:!!l,...d?{isPromotedChildSession:d}:{},...l?{parentSessionId:l}:{},...u?{spawnedByRequestId:u}:{},...f?{activityPreview:f}:{},messageCount:e.messageCount}}function $I(e){return e.map(QI)}function eL(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function tL(e){if(typeof e!=`number`||!Number.isFinite(e))return null;let t=Math.trunc(e);return t>=0?t:null}function nL(e){return e===!0}function rL(e){let t=e;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,r=tL(n.usedContextTokens),i=tL(n.totalContextTokens),a=tL(n.prunedUsedContextTokens),o=eL(n.updatedAt);if(r===null||i===null||a===null||!o)return null;let s=tL(n.compactedUsedContextTokens);return{usedContextTokens:r,totalContextTokens:i,prunedUsedContextTokens:a,availableContextTokens:tL(n.availableContextTokens)??Math.max(0,i-r),droppedHistoryCount:tL(n.droppedHistoryCount)??0,truncatedToolResultCount:tL(n.truncatedToolResultCount)??0,truncatedSystemPrompt:nL(n.truncatedSystemPrompt),truncatedUserMessage:nL(n.truncatedUserMessage),compacted:nL(n.compacted),...eL(n.checkpointId)?{checkpointId:eL(n.checkpointId)??void 0}:{},compactedMessageCount:tL(n.compactedMessageCount)??0,...s===null?{}:{compactedUsedContextTokens:s},updatedAt:o}}function iL(e){let{metadata:t}=e;if(!t||t.nextclaw_timeline_kind!==`context_compaction`)return null;let n=t.checkpoint&&typeof t.checkpoint==`object`&&!Array.isArray(t.checkpoint)?t.checkpoint:null;if(!n)return null;let r=eL(n.id),i=n.status===`compressing`?`compressing`:n.status===`compressed`?`compressed`:null,a=eL(n.summary),o=tL(n.coveredMessageCount),s=tL(n.coveredSessionMessageCount),c=tL(n.originalEstimatedTokens),l=tL(n.projectedEstimatedTokens),u=eL(n.createdAt),d=eL(n.updatedAt);return!r||!i||!a||o===null||s===null||c===null||l===null||!u||!d?null:{id:r,status:i,summary:a,coveredMessageCount:o,coveredSessionMessageCount:s,originalEstimatedTokens:c,projectedEstimatedTokens:l,createdAt:u,updatedAt:d}}function aL(){return me({queryKey:[`agents`],queryFn:Re,staleTime:3e4})}function oL(){let e=ce();return b({mutationFn:({agentId:e,data:t})=>Ve(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function sL(){let e=ce();return b({mutationFn:({agentId:e})=>xe(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),N.success(s(`configSavedApplied`))},onError:e=>{N.error(s(`configSaveFailed`)+`: `+e.message)}})}function cL(e,t){return new Map([...t,...e].filter(e=>typeof e.id==`string`&&e.id.trim().length>0).map(e=>[e.id,e]))}function lL(e){let t=e?.trim()??``,n=Q(e=>e.snapshot.availableAgents??[]),r=aL(),i=(0,F.useMemo)(()=>cL(n,r.data?.agents??[]),[r.data?.agents,n]);return(0,F.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 uL({agentId:e,className:t}){let n=lL(e);return n?(0,I.jsx)(Ws,{agentId:n.agentId,displayName:n.displayName,avatarUrl:n.avatarUrl,className:t}):null}var dL=new WeakMap;function fL(e){return{roleLabels:{user:s(`chatRoleUser`),assistant:s(`chatRoleAssistant`),tool:s(`chatRoleTool`),system:s(`chatRoleSystem`),fallback:s(`chatRoleMessage`)},reasoningLabel:s(`chatReasoning`),toolCallLabel:s(`chatToolCall`),toolResultLabel:s(`chatToolResult`),toolInputLabel:s(`chatToolInput`),toolNoOutputLabel:s(`chatToolNoOutput`),toolOutputLabel:s(`chatToolOutput`),toolStatusPreparingLabel:s(`chatToolStatusPreparing`),toolStatusRunningLabel:s(`chatToolStatusRunning`),toolStatusCompletedLabel:s(`chatToolStatusCompleted`),toolStatusFailedLabel:s(`chatToolStatusFailed`),toolStatusCancelledLabel:s(`chatToolStatusCancelled`),imageAttachmentLabel:s(`chatImageAttachment`),fileAttachmentLabel:s(`chatFileAttachment`),unknownPartLabel:s(`chatUnknownPart`)}}function pL(e){return{copyCodeLabel:s(`chatCodeCopy`),copiedCodeLabel:s(`chatCodeCopied`),copyMessageLabel:s(`chatMessageCopy`),copiedMessageLabel:s(`chatMessageCopied`),typingLabel:s(`chatTyping`),attachmentOpenLabel:s(`chatAttachmentOpen`),attachmentAttachedLabel:s(`chatAttachmentAttached`),attachmentCategoryLabels:{archive:s(`chatAttachmentCategoryArchive`),audio:s(`chatAttachmentCategoryAudio`),code:s(`chatAttachmentCategoryCode`),data:s(`chatAttachmentCategoryData`),document:s(`chatAttachmentCategoryDocument`),generic:s(`chatAttachmentCategoryGeneric`),image:s(`chatAttachmentCategoryImage`),pdf:s(`chatAttachmentCategoryPdf`),sheet:s(`chatAttachmentCategorySheet`),video:s(`chatAttachmentCategoryVideo`)}}}function mL({checkpoint:e}){return(0,I.jsxs)(`div`,{className:`my-4 flex items-center gap-3 text-[11px] text-gray-500`,title:[`${s(`chatContextCompactionCoveredMessages`)}: ${e.coveredSessionMessageCount}`,`${s(`chatContextCompactionOriginalTokens`)}: ${e.originalEstimatedTokens}`,`${s(`chatContextCompactionProjectedTokens`)}: ${e.projectedEstimatedTokens}`].join(`
100
+ `),children:[(0,I.jsx)(`div`,{className:`h-px flex-1 bg-gray-200`}),(0,I.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-200 bg-gray-50 px-3 py-1`,children:[e.status===`compressing`?(0,I.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-gray-400 animate-pulse`}):(0,I.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-gray-300`}),(0,I.jsx)(`span`,{children:e.status===`compressing`?s(`chatContextCompactionCompressing`):s(`chatContextCompactionCompressed`)})]}),(0,I.jsx)(`div`,{className:`h-px flex-1 bg-gray-200`})]})}function hL(e){let{normalRawMessages:t,rawMessageId:n,rawMessages:r}=e,i=r.findIndex(e=>e.id===n);return i<0?t.length-1:r.slice(0,i).filter(e=>!iL(e)).length-1}function gL(e){let t=e.rawMessages.filter(e=>!iL(e)),n=e.rawMessages.map(e=>({rawMessageId:e.id,checkpoint:iL(e)})).filter(e=>!!e.checkpoint).map(n=>({key:n.rawMessageId,checkpoint:n.checkpoint,boundaryIndex:hL({rawMessages:e.rawMessages,normalRawMessages:t,rawMessageId:n.rawMessageId})})).sort((e,t)=>e.boundaryIndex-t.boundaryIndex),r=[],i=[],a=0,o=e=>{i.length!==0&&(r.push({kind:`messages`,key:e,messages:i}),i=[])};for(t.forEach((t,s)=>{let c=e.messages[s];for(c&&i.push(c);a<n.length&&n[a]?.boundaryIndex<=s;){let e=n[a];o(`messages-before-${e.key}`),r.push({kind:`compaction`,key:e.key,checkpoint:e.checkpoint}),a+=1}});a<n.length;){let e=n[a];o(`messages-before-${e.key}`),r.push({kind:`compaction`,key:e.key,checkpoint:e.checkpoint}),a+=1}return o(`messages-final`),r.length===0&&r.push({kind:`messages`,key:`messages-empty`,messages:[]}),r}function _L({messages:e,isSending:t,className:n,onToolAction:r,onFileOpen:i}){let{language:a}=Ar(),o=(0,F.useMemo)(()=>fL(a),[a]),s=(0,F.useMemo)(()=>e.flatMap(e=>{if(iL(e))return[];let t=dL.get(e);if(t&&t.language===a)return[t.viewModel];let n=ZI(e),r=yI({id:n.id,role:n.role,meta:{timestamp:n.meta?.timestamp,status:n.meta?.status,inlineTokens:jP(e.metadata)},parts:n.parts},{formatTimestamp:e=>u(e,a),texts:o});return dL.set(e,{language:a,viewModel:r}),[r]}),[a,e,o]),c=(0,F.useMemo)(()=>s.some(e=>e.role===`assistant`&&(e.status===`streaming`||e.status===`pending`)),[s]),l=(0,F.useMemo)(()=>pL(a),[a]),d=(0,F.useMemo)(()=>gL({rawMessages:e,messages:s}),[s,e]);return(0,I.jsx)(`div`,{className:n,children:d.map((e,n)=>e.kind===`compaction`?(0,I.jsx)(mL,{checkpoint:e.checkpoint},e.key):(0,I.jsx)(TM,{messages:e.messages,isSending:n===d.length-1?t:!1,hasAssistantDraft:c,texts:l,onToolAction:r,onFileOpen:i,renderToolAgent:e=>(0,I.jsx)(uL,{agentId:e,className:`h-4 w-4 shrink-0`})},e.key))})}function vL(){let e=ce();return async t=>{let{sessionKey:n,patch:r,successMessage:i}=t;try{ze(e,await We(n,r)),await e.invalidateQueries({queryKey:[`ncp-session-skills`,n]}),N.success(i??s(`configSavedApplied`))}catch(e){throw N.error(s(`configSaveFailed`)+`: `+(e instanceof Error?e.message:String(e))),e}}}function yL(){let e=vL();return async t=>{let{persistToServer:n,projectRoot:r,sessionKey:i}=t,a=s(r?`chatSessionProjectUpdated`:`chatSessionProjectCleared`);if(!n){Z.getState().setSnapshot({pendingProjectRoot:r,pendingProjectRootSessionKey:i}),N.success(a);return}await e({sessionKey:i,patch:{projectRoot:r},successMessage:a})}}function bL({icon:e,label:t,onClick:n,disabled:i=!1,destructive:a=!1}){return(0,I.jsxs)(`button`,{type:`button`,className:r(`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`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:n,disabled:i,children:[(0,I.jsx)(e,{className:`h-4 w-4 shrink-0`}),(0,I.jsx)(`span`,{children:t})]})}function xL(e){return me({queryKey:[`server-path-browse`,e.path??null,e.includeFiles??!1],queryFn:()=>He({path:e.path,includeFiles:e.includeFiles}),enabled:e.enabled??!0,staleTime:0})}var SL=F.forwardRef(({className:e,children:t,...n},i)=>(0,I.jsx)(`div`,{ref:i,className:r(`overflow-auto`,e),...n,children:t}));SL.displayName=`ScrollArea`;function CL({open:e,currentPath:t,isSaving:n,onOpenChange:r,onConfirm:i,title:a,description:o,pathLabel:c,pathPlaceholder:l,confirmLabel:u,hint:d}){let[f,p]=(0,F.useState)(``),[m,h]=(0,F.useState)(null),[g,_]=(0,F.useState)(``);(0,F.useEffect)(()=>{if(!e)return;let n=t?.trim()||null;p(n??``),h(n),_(``)},[t,e]);let v=xL({path:m,enabled:e});(0,F.useEffect)(()=>{!e||!v.data||f.trim().length===0&&p(v.data.currentPath)},[v.data,f,e]);let y=f.trim(),b=y.length===0||n,x=(0,F.useMemo)(()=>v.error?v.error instanceof Error?v.error.message:String(v.error):null,[v.error]),S=g.trim().toLowerCase(),C=(0,F.useMemo)(()=>{let e=v.data?.entries??[];return S.length===0?e:e.filter(e=>{let t=e.name.toLowerCase(),n=e.path.toLowerCase();return t.includes(S)||n.includes(S)})},[v.data?.entries,S]),w=e=>{h(e),_(``),e&&p(e)};return(0,I.jsx)(en,{open:e,onOpenChange:e=>{n||r(e)},children:(0,I.jsxs)(nn,{className:`max-h-[85vh] overflow-hidden sm:h-[42rem] sm:max-w-2xl sm:grid-rows-[auto_minmax(0,1fr)]`,children:[(0,I.jsxs)(tn,{children:[(0,I.jsx)(rn,{children:a}),o?(0,I.jsx)($t,{children:o}):null]}),(0,I.jsxs)(`form`,{className:`flex min-h-0 flex-col gap-4`,onSubmit:e=>{e.preventDefault(),!b&&i(y)},children:[(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(re,{htmlFor:`server-path-picker-input`,children:c}),(0,I.jsxs)(`div`,{className:`flex gap-2`,children:[(0,I.jsx)(oe,{id:`server-path-picker-input`,value:f,onChange:e=>p(e.target.value),placeholder:l,autoFocus:!0,disabled:n}),(0,I.jsx)(T,{type:`button`,variant:`outline`,onClick:()=>w(y||null),disabled:n,children:s(`openPath`)})]})]}),(0,I.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,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-gray-200 px-3 py-2`,children:[(0,I.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>w(v.data?.homePath??null),disabled:n||v.isLoading,children:[(0,I.jsx)(cr,{className:`mr-1 h-4 w-4`}),s(`homeDirectory`)]}),(0,I.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>w(v.data?.parentPath??null),disabled:!v.data?.parentPath||n||v.isLoading,children:[(0,I.jsx)(rr,{className:`mr-1 h-4 w-4`}),s(`parentDirectory`)]}),(0,I.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{v.refetch()},disabled:n||v.isLoading,children:[(0,I.jsx)(at,{className:`mr-1 h-4 w-4`}),s(`chatRefresh`)]})]}),(0,I.jsxs)(`div`,{className:`border-b border-gray-200 px-3 py-2`,children:[(0,I.jsx)(`div`,{className:`mb-2 text-xs font-medium text-gray-500`,children:s(`currentDirectory`)}),(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 text-xs text-gray-600`,children:v.data?.breadcrumbs.map((e,t)=>(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 hover:bg-gray-200`,onClick:()=>w(e.path),disabled:n,children:e.label}),t<v.data.breadcrumbs.length-1?(0,I.jsx)(zn,{className:`h-3 w-3 text-gray-400`}):null]},e.path))})]}),(0,I.jsx)(`div`,{className:`border-b border-gray-200 px-3 py-2`,children:(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(hn,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,I.jsx)(oe,{value:g,onChange:e=>_(e.target.value),placeholder:s(`pathPickerSearchPlaceholder`),disabled:n||v.isLoading,className:`pl-9`})]})}),(0,I.jsx)(SL,{className:`min-h-0 flex-1 px-2 py-2`,children:v.isLoading?(0,I.jsx)(`div`,{className:`px-2 py-6 text-sm text-gray-500`,children:s(`loading`)}):x?(0,I.jsxs)(`div`,{className:`px-2 py-4 text-sm text-destructive`,children:[s(`pathBrowseFailed`),`: `,x]}):v.data&&C.length>0?(0,I.jsx)(`div`,{className:`space-y-1`,children:C.map(e=>(0,I.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:()=>w(e.path),disabled:n,children:[(0,I.jsx)(ar,{className:`h-4 w-4 shrink-0 text-emerald-600`}),(0,I.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))}):v.data&&v.data.entries.length>0?(0,I.jsx)(`div`,{className:`px-2 py-6 text-sm text-gray-500`,children:s(`pathPickerSearchEmpty`)}):(0,I.jsx)(`div`,{className:`px-2 py-6 text-sm text-gray-500`,children:s(`emptyDirectory`)})})]}),d?(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-gray-500`,children:d}):null,(0,I.jsxs)(Qt,{children:[(0,I.jsx)(T,{type:`button`,variant:`outline`,onClick:()=>r(!1),disabled:n,children:s(`cancel`)}),(0,I.jsx)(T,{type:`submit`,disabled:b,children:n?s(`saving`):u})]})]})]})})}function wL({open:e,currentProjectRoot:t,isSaving:n,onOpenChange:r,onSave:i}){return(0,I.jsx)(CL,{open:e,currentPath:t,isSaving:n,onOpenChange:r,onConfirm:i,title:s(`chatSessionProjectDialogTitle`),description:s(`chatSessionProjectDialogDescription`),pathLabel:s(`chatSessionProjectPathLabel`),pathPlaceholder:s(`chatSessionProjectPathPlaceholder`),confirmLabel:s(`chatSessionSetProject`),hint:s(`chatSessionProjectUpdateHint`)})}var TL=`flex shrink-0 items-center gap-1.5`,EL=`h-7 w-7 rounded-lg shrink-0 text-gray-400 hover:text-gray-700`;function DL({sessionKey:e,canDeleteSession:t,isDeletePending:n,projectRoot:r,childSessionCount:i=0,sessionCronJobCount:a=0,onOpenChildSessions:o,onOpenSessionCronJobs:c,onDeleteSession:l}){let u=yL(),[d,f]=(0,F.useState)(!1),[p,m]=(0,F.useState)(!1),[h,g]=(0,F.useState)(!1),_=n||h,v=async n=>{let r=t;g(!0);try{await u({sessionKey:e,projectRoot:n,persistToServer:r}),m(!1),f(!1)}finally{g(!1)}};return(0,I.jsxs)(`div`,{className:TL,children:[i>0&&o?(0,I.jsx)(T,{type:`button`,variant:`ghost`,size:`icon`,className:EL,"aria-label":s(`chatSessionOpenChildSessions`),title:s(`chatSessionOpenChildSessions`),onClick:o,disabled:_,children:(0,I.jsx)(or,{className:`h-4 w-4`})}):null,a>0&&c?(0,I.jsx)(T,{type:`button`,variant:`ghost`,size:`icon`,className:EL,"aria-label":s(`chatSessionOpenCronJobs`),title:s(`chatSessionOpenCronJobs`),onClick:c,disabled:_,children:(0,I.jsx)(Mn,{className:`h-4 w-4`})}):null,(0,I.jsxs)(Tn,{open:d,onOpenChange:f,children:[(0,I.jsx)(Cn,{asChild:!0,children:(0,I.jsx)(T,{variant:`ghost`,size:`icon`,className:EL,"aria-label":s(`chatSessionMoreActions`),disabled:_,children:(0,I.jsx)(Qe,{className:`h-4 w-4`})})}),(0,I.jsx)(xn,{align:`end`,className:`w-56 p-2`,children:(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(bL,{icon:tr,label:s(`chatSessionSetProject`),onClick:()=>{f(!1),m(!0)},disabled:_}),(0,I.jsx)(bL,{icon:gn,label:s(`chatDeleteSession`),onClick:()=>{f(!1),l()},disabled:!t||_,destructive:!0})]})})]}),(0,I.jsx)(wL,{open:p,currentProjectRoot:r,isSaving:h,onOpenChange:m,onSave:v})]})}function OL({sessionKey:e,projectName:t,projectRoot:n,persistToServer:r}){let i=yL(),[a,o]=(0,F.useState)(!1),[c,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)(!1),f=async t=>{d(!0);try{await i({sessionKey:e,projectRoot:t,persistToServer:r}),l(!1),o(!1)}finally{d(!1)}};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(Tn,{open:a,onOpenChange:o,children:[(0,I.jsx)(Cn,{asChild:!0,children:(0,I.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":s(`chatSessionSetProject`),disabled:u,children:(0,I.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,I.jsx)(tr,{className:`h-3.5 w-3.5 shrink-0`}),(0,I.jsx)(`span`,{className:`truncate`,children:t}),(0,I.jsx)(Rn,{className:`h-3 w-3 shrink-0 opacity-70`})]})})}),(0,I.jsxs)(xn,{align:`start`,className:`w-72 p-2`,children:[(0,I.jsxs)(`div`,{className:`px-3 pb-2 pt-1`,children:[(0,I.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-gray-500`,children:t}),n?(0,I.jsx)(`div`,{className:`mt-1 break-all text-xs text-gray-500`,children:n}):null]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(bL,{icon:gr,label:s(`chatSessionSetProject`),onClick:()=>{o(!1),l(!0)},disabled:u}),(0,I.jsx)(bL,{icon:ir,label:s(`chatSessionClearProject`),onClick:()=>{f(null)},disabled:u})]})]})]}),(0,I.jsx)(wL,{open:c,currentProjectRoot:n,isSaving:u,onOpenChange:l,onSave:f})]})}function kL({parentSessionLabel:e,onGoToParentSession:t}){if(!e)return null;let n=e.trim();return(0,I.jsx)(`div`,{className:`border-b border-gray-200/60 bg-white/75 px-4 py-2 backdrop-blur-sm sm:px-5`,children:(0,I.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,I.jsx)(on,{className:`h-3.5 w-3.5`}),(0,I.jsxs)(`span`,{children:[s(`chatBackToParent`),n?` · ${n}`:``]})]})})}function AL({snapshot:e,childSessionCount:t,sessionCronJobCount:n,layoutMode:i,normalizedAgentId:a,sessionHeaderTitle:o,shouldShowHeaderAgentAvatar:c,shouldShowSessionHeader:l,onBackToList:u,onOpenChildSessions:d,onOpenSessionCronJobs:f,onDeleteSession:p}){let m=i===`mobile`;return(0,I.jsxs)(`div`,{className:r(`border-b border-gray-200/60 bg-white/80 backdrop-blur-sm flex items-center justify-between shrink-0 overflow-hidden transition-colors duration-200`,m?`px-3 sm:px-3`:`px-4 sm:px-5`,l?`opacity-100`:`h-0 py-0 opacity-0 border-b-0`,l&&(m?`min-h-12 pb-2 pt-2`:`h-[52px]`)),style:m&&l?{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.5rem)`}:void 0,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-center gap-2`,children:[m&&u?(0,I.jsx)(`button`,{type:`button`,onClick:u,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":s(`chat`),children:(0,I.jsx)(on,{className:`h-4 w-4`})}):null,c?(0,I.jsx)(`div`,{className:`inline-flex shrink-0 items-center`,children:(0,I.jsx)(Ws,{agentId:a,displayName:e.agentDisplayName,avatarUrl:e.agentAvatarUrl,className:`h-5 w-5`})}):null,(0,I.jsx)(`span`,{className:`text-sm font-medium text-gray-700 truncate`,children:o}),e.sessionTypeLabel?(0,I.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,I.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] items-center justify-center`,children:(0,I.jsx)(Ls,{icon:{kind:`runtime-image`,src:e.sessionTypeIcon.src,alt:e.sessionTypeIcon.alt??null,name:e.sessionTypeLabel}})}):null,e.sessionTypeLabel]}):null,e.sessionProjectName?(0,I.jsx)(OL,{sessionKey:e.sessionKey??`draft`,projectName:e.sessionProjectName,projectRoot:e.sessionProjectRoot,persistToServer:e.canDeleteSession}):null]}),e.sessionKey?(0,I.jsx)(DL,{sessionKey:e.sessionKey,canDeleteSession:e.canDeleteSession,isDeletePending:e.isDeletePending,projectRoot:e.sessionProjectRoot,childSessionCount:t,sessionCronJobCount:n,onOpenChildSessions:d,onOpenSessionCronJobs:f,onDeleteSession:p}):null]})}var jL=`native`;function ML(e){return typeof e==`string`?e.trim().toLowerCase()||`native`:jL}function NL(e,t=jL){return ML(e?.runtime?.trim()||e?.engine?.trim()||t)}function PL(e,t){return e===`native`?s(`chatSessionTypeNative`):t?.trim()||e.trim().split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||e}function FL(e){let t=new Map;for(let n of e){let e=ML(n.value);t.set(e,{value:e,label:n.label?.trim()||PL(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(jL,{value:jL,label:PL(jL),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 IL(e){let{selectedSession:t,pendingSessionType:n,setPendingSessionType:r,sessionTypesData:i}=e,a=(0,F.useMemo)(()=>FL(i?.options??[]),[i?.options]),o=(0,F.useMemo)(()=>{let e=[...a],n=ML(t?.sessionType);return e.some(e=>e.value===n)||e.push({value:n,label:PL(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,F.useMemo)(()=>ML(i?.defaultType??`native`),[i?.defaultType]),l=(0,F.useRef)(null),u=(0,F.useMemo)(()=>ML(t?.sessionType??n??c),[c,n,t?.sessionType]),d=(0,F.useMemo)(()=>o.find(e=>e.value===u)??null,[u,o]);(0,F.useEffect)(()=>{if(t)return;let e=typeof n==`string`?n.trim():``,i=ML(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,F.useMemo)(()=>new Set(a.map(e=>e.value)),[a]);return{sessionTypeOptions:o,selectedSessionTypeOption:d,defaultSessionType:c,selectedSessionType:u,canEditSessionType:f,sessionTypeUnavailable:(0,F.useMemo)(()=>t&&!p.has(ML(t.sessionType))?!0:d?.ready===!1,[p,t,d?.ready]),sessionTypeUnavailableMessage:(0,F.useMemo)(()=>t&&!p.has(ML(t.sessionType))?`${PL(u)} ${s(`chatSessionTypeUnavailableSuffix`)}`:d?.ready===!1?d.reasonMessage?.trim()||`${d.label} setup required`:null,[p,t,u,d])}}function LL(e,t){return e.label?.trim()?e.label.trim():t?Ks(t):e.sessionKey}function RL(e){let t=wi({limit:200}),n=(0,F.useMemo)(()=>t.data?.sessions??[],[t.data?.sessions]),r=(0,F.useMemo)(()=>{let e=$I(n);return new Map(e.map(e=>[e.key,e]))},[n]);return(0,F.useMemo)(()=>e.map(e=>{let t=r.get(e.sessionKey)??null,n=e.agentId?.trim()||t?.agentId||null;return{sessionKey:e.sessionKey,parentSessionKey:e.parentSessionKey,title:LL(e,t),agentId:n,updatedAt:t?.updatedAt??null,lastMessageAt:t?.lastMessageAt??null,readAt:t?.readAt??null,runStatus:t?.status===`running`?`running`:void 0,sessionTypeLabel:t?.sessionType?PL(t.sessionType):null,preferredModel:t?.preferredModel?.trim()||null,projectName:t?.projectName?.trim()||null,projectRoot:t?.projectRoot?.trim()||null}}),[r,e])}function zL(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(`
101
+ `)}}async function*BL(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}=VL(r);r=o;for(let e of a)yield e}r+=n.decode();let{frames:e}=VL(r,!0);for(let t of e)yield t}finally{t.releaseLock()}}function VL(e,t=!1){let n=e.split(/\r?\n\r?\n/),r=n.pop()??``,i=[];for(let e of n){let t=zL(e);t&&i.push(t)}if(t&&r.trim()){let e=zL(r);return e&&i.push(e),{frames:i,rest:``}}return{frames:i,rest:r}}var HL=`/ncp/agent`,UL=class extends Error{ncpError;alreadyPublished;constructor(e,t=!1){super(e.message),this.name=`NcpHttpAgentClientError(${e.code})`,this.ncpError=e,this.alreadyPublished=t}};function WL(e){let t=e.trim();if(!t)throw Error(`NcpHttpAgentClient requires a non-empty baseUrl.`);return new URL(t)}function GL(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 KL(e){let t=(e??`/ncp/agent`).trim();if(!t)return HL;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n.slice(0,-1):n}async function qL(e){try{return(await e.text()).trim()}catch{return``}}function JL(e){if(QL(e))return e.ncpError;if(XL(e))return e;let t=e instanceof Error?e.message:String(e??`Unknown error`);return{code:eR(void 0),message:t,...e instanceof Error&&e.stack?{details:{stack:e.stack}}:{}}}function YL(e,t={}){return new UL(e,t.alreadyPublished??!1)}function XL(e){return ZL(e)&&typeof e.code==`string`&&typeof e.message==`string`}function ZL(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function QL(e){return e instanceof UL}var $L={"config-error":`config-error`,"auth-error":`auth-error`,"runtime-error":`runtime-error`,"timeout-error":`timeout-error`,"abort-error":`abort-error`};function eR(e){if(!e)return`runtime-error`;let t=$L[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 tR(e){let t=rR(e);return!t||typeof t.type!=`string`||!t.type.trim()?null:t}function nR(e){let t=rR(e);if(!t)return{code:`runtime-error`,message:e||`Unknown stream error.`};let n=typeof t.code==`string`?t.code:void 0,r=eR(n),i=ZL(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 rR(e){try{let t=JSON.parse(e);return ZL(t)?t:null}catch{return null}}var iR=[`text`,`file`,`source`,`step-start`,`reasoning`,`tool-invocation`,`card`,`rich-text`,`action`,`extension`],aR=class{manifest;baseUrl;basePath;fetchImpl;defaultHeaders;subscribers=new Set;activeControllers=new Set;started=!1;constructor(e){this.baseUrl=WL(e.baseUrl),this.basePath=KL(e.basePath),this.fetchImpl=GL(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:iR,expectedLatency:`seconds`,metadata:{transport:`http+sse`,scope:`agent`}}}async start(){this.started||(this.started=!0,this.publish({type:EM.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();let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(`/send`),{method:`POST`,headers:{...this.defaultHeaders,accept:`application/json`,"content-type":`application/json`},body:JSON.stringify(e),signal:t.signal});if(!n.ok)throw Error(`NCP send command failed with HTTP ${n.status}: ${await qL(n)}`);let r=await n.json();if(!r.ok||!r.data)throw Error(r.error?.message??`NCP send command returned an invalid handle.`);return r.data}catch(e){if(t.signal.aborted)throw Error(`NCP send command was cancelled.`);if(QL(e))throw e;let n=JL(e);throw this.publish({type:EM.EndpointError,payload:n}),YL(n)}finally{this.activeControllers.delete(t)}}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 qL(n)}`)}catch(e){if(t.signal.aborted)return;let n=JL(e);throw this.publish({type:EM.EndpointError,payload:n}),YL(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 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 qL(n)}`);if(!n.body)throw Error(`NCP stream response has no body.`);for await(let e of BL(n.body)){if(t.signal.aborted)return;this.handleSseFrame(e)}}catch(e){if(t.signal.aborted)return;if(QL(e))throw e;let n=JL(e);throw this.publish({type:EM.EndpointError,payload:n}),YL(n)}finally{this.activeControllers.delete(t)}}handleSseFrame(e){if(e.event===`ncp-event`){let t=tR(e.data);if(!t){this.publish({type:EM.EndpointError,payload:{code:`runtime-error`,message:`Received malformed ncp-event frame.`}});return}this.publish(t);return}if(e.event===`error`){let t=nR(e.data);throw this.publish({type:EM.EndpointError,payload:t}),YL(t,{alreadyPublished:!0})}}};function oR(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function sR(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 cR(e,t){let n=Error(e);return t!==void 0&&(n.cause=t),n}function lR(){return async(e,t)=>{try{return await fetch(e,{credentials:`include`,...t})}catch(n){throw Ke.reportTransportFailure(sR(n)),cR(`NCP fetch failed for ${(t?.method||`GET`).toUpperCase()} ${oR(e)}: ${sR(n)}`,n)}}}var uR=300,dR=`ncp agent unavailable during startup`;function fR(e){return e instanceof Error?e.message.includes(`ncp session not found:`):!1}function pR(e){return e?.trim().toLowerCase().includes(dR)??!1}function mR(){return new aR({baseUrl:x,basePath:`/api/ncp/agent`,fetchImpl:lR()})}async function hR(e,t,n=uR){t.throwIfAborted();try{let r=await Me(e,n);return t.throwIfAborted(),{messages:r.messages,status:r.status??`idle`,contextWindow:r.contextWindow??null}}catch(e){if(t.throwIfAborted(),!fR(e))throw e;return{messages:[],status:`idle`}}}function gR(e,t){let n=(0,F.useRef)(null),r=(0,F.useCallback)(e=>{if(!e){n.current=null;return}n.current!==e&&(n.current=e,t())},[t]);(0,F.useEffect)(()=>{r(e)},[e,r])}function _R(e,t={}){let[n]=(0,F.useState)(()=>mR()),r=Je(),[i,a]=(0,F.useState)(0),[o,s]=(0,F.useState)(null),c=t.messageLimit??uR;(0,F.useEffect)(()=>{s(null)},[e]);let l=iN({sessionId:e,client:n,loadSeed:(0,F.useCallback)(async(e,t)=>{let n=await hR(e,t,c);return t.aborted||s(n.contextWindow??null),{messages:n.messages,status:n.status}},[i,c])}),u=l.hydrateError?.message??l.snapshot.error?.message??null;return gR(e&&r.phase===`ready`&&pR(u)?`${e}:${r.lastReadyAt??0}`:null,()=>{a(e=>e+1)}),(0,F.useMemo)(()=>({...l,snapshot:{...l.snapshot,contextWindow:l.snapshot.contextWindow??o}}),[l,o])}function vR(e){return e.label?.trim()||e.path.split(`/`).filter(Boolean).pop()||e.path}function yR(e){let{activePanelKind:t,activeChildSessionKey:n,activeWorkspaceFileKey:r,childSessionTabs:i,workspaceFileTabs:a,sessionCronJobCount:o}=e;if(t===`cron`&&o>0)return{kind:`cron`};if(t!==`child-session`&&r){let e=a.find(e=>e.key===r);if(e)return{kind:`file`,file:e}}if(t!==`file`&&n){let e=i.find(e=>e.sessionKey===n);if(e)return{kind:`child-session`,tab:e}}return i[0]?{kind:`child-session`,tab:i[0]}:a[0]?{kind:`file`,file:a[0]}:o>0?{kind:`cron`}:null}function bR({agentId:e,kind:t}){return t===`cron`?(0,I.jsx)(Mn,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):t===`file`?(0,I.jsx)(qn,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):e?(0,I.jsx)(uL,{agentId:e,className:`h-3.5 w-3.5 shrink-0`}):(0,I.jsx)(dr,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`})}function xR({tab:e}){return(0,I.jsx)(pt,{delayDuration:250,children:(0,I.jsxs)(yt,{children:[(0,I.jsx)(mt,{asChild:!0,children:(0,I.jsxs)(`div`,{className:r(`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,I.jsxs)(`button`,{type:`button`,onClick:e.onSelect,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,children:[(0,I.jsx)(bR,{kind:e.kind,agentId:e.agentId}),(0,I.jsx)(`span`,{className:`min-w-0 truncate text-[12px] font-medium`,children:e.title}),e.kind===`file`&&e.viewMode===`diff`?(0,I.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:s(`chatWorkspaceDiff`)}):null,e.showUnreadDot?(0,I.jsx)(`span`,{"aria-label":s(`chatSessionUnread`),className:`h-2 w-2 shrink-0 rounded-full bg-primary`}):null]}),e.onClose?(0,I.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e.onClose?.()},className:r(`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":s(`chatWorkspaceCloseFile`),children:(0,I.jsx)(_n,{className:`h-3 w-3`})}):null]})}),(0,I.jsx)(Dt,{side:`bottom`,className:`max-w-[320px] text-xs`,children:e.tooltip})]})})}function SR({tabs:e}){return(0,I.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,I.jsx)(`div`,{"data-testid":`workspace-tabs-scroll`,className:`flex min-w-max items-stretch`,children:e.map(e=>(0,I.jsx)(xR,{tab:e},e.key))})})}function CR({tone:e=`neutral`,value:t}){return(0,I.jsx)(`span`,{className:r(`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 wR({breadcrumb:e}){return(0,I.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,I.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,I.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 pr-1`,children:e.segments.map((t,n)=>(0,I.jsxs)(F.Fragment,{children:[(0,I.jsxs)(`span`,{className:r(`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,I.jsx)(nr,{className:`h-3 w-3 shrink-0`}):t.isCurrent?(0,I.jsx)(qn,{className:`h-3 w-3 shrink-0`}):null,(0,I.jsx)(`span`,{children:t.label})]}),n<e.segments.length-1?(0,I.jsx)(zn,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},t.key))}),e.locationLabel||e.truncated?(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[e.locationLabel?(0,I.jsx)(CR,{value:e.locationLabel}):null,e.truncated?(0,I.jsx)(CR,{tone:`warning`,value:s(`chatWorkspacePreviewTruncated`)}):null]}):null]})})}function TR(e){let t=e.path?.trim()??``;return me({queryKey:[`server-path-read`,t,e.basePath??null],queryFn:()=>Le({path:t,basePath:e.basePath}),enabled:(e.enabled??!0)&&t.length>0,staleTime:0})}function ER(e){return e.serverKind?e.serverKind:/\.mdx?$/i.test(e.path)?`markdown`:`text`}function DR(e){let{line:t,path:n,text:r}=e,i=t??1;return{key:`preview:${n}`,path:n,display:`preview`,lines:aF({text:r,kind:`context`,oldStartLine:i,newStartLine:i}),rawText:r,oldStartLine:i,newStartLine:i}}function OR(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=lF({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 kR({text:e,tone:t=`muted`}){return(0,I.jsx)(`div`,{className:r(`flex h-full items-center justify-center px-6 text-center text-sm`,t===`error`?`text-rose-600`:`text-gray-500`),children:e})}function AR({diffBlock:e}){return e?(0,I.jsx)(jR,{block:e}):(0,I.jsx)(kR,{text:s(`chatWorkspaceDiffEmpty`)})}function jR({block:e}){return(0,I.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar bg-white`,children:(0,I.jsx)(Bj,{block:e,layout:`workspace`})})}function MR({onFileOpen:e,previewBlock:t,previewKind:n,previewQuery:r,previewText:i}){return r.isLoading&&!t?(0,I.jsx)(kR,{text:s(`chatWorkspaceLoadingFile`)}):r.data?.kind===`binary`?(0,I.jsx)(kR,{text:s(`chatWorkspacePreviewUnsupported`)}):r.error&&!t?(0,I.jsx)(kR,{tone:`error`,text:r.error instanceof Error?r.error.message:String(r.error)}):n===`markdown`&&i?(0,I.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar px-5 py-4`,children:(0,I.jsx)(AA,{text:i,role:`assistant`,texts:{copyCodeLabel:s(`chatCodeCopy`),copiedCodeLabel:s(`chatCodeCopied`)},onFileOpen:e})}):t?(0,I.jsx)(jR,{block:t}):(0,I.jsx)(kR,{text:s(`chatWorkspacePreviewEmpty`)})}function NR({file:e,sessionProjectRoot:t,onFileOpen:n}){let r=e.viewMode===`preview`,i=TR({path:e.path,basePath:t,enabled:r}),a=(0,F.useMemo)(()=>e.viewMode===`diff`?OR(e):null,[e]),o=r?i.data?.text??e.rawText??null:null,s=ER({path:i.data?.resolvedPath??e.path,serverKind:i.data?.kind}),c=(0,F.useMemo)(()=>!r||!o?null:DR({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,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[(0,I.jsx)(wR,{breadcrumb:(0,F.useMemo)(()=>AI({path:l,sessionProjectRoot:t,line:e.line,column:e.column,truncated:u}),[e.column,e.line,u,l,t])}),(0,I.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:e.viewMode===`diff`?(0,I.jsx)(AR,{diffBlock:a}):(0,I.jsx)(MR,{onFileOpen:n,previewBlock:c,previewKind:s,previewQuery:i,previewText:o})})]})}var PR={open:!1,title:``,description:``,confirmLabel:s(`confirm`),cancelLabel:s(`cancel`),variant:`default`,resolve:null};function FR(){let[e,t]=(0,F.useState)(PR),n=(0,F.useCallback)(e=>new Promise(n=>{t({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??s(`confirm`),cancelLabel:e.cancelLabel??s(`cancel`),variant:e.variant??`default`,resolve:e=>{n(e),t(e=>({...e,open:!1,resolve:null}))}})}),[]),r=(0,F.useCallback)(e=>{t(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:n,ConfirmDialog:(0,F.useCallback)(()=>(0,I.jsx)(an,{open:e.open,onOpenChange:r,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,r])}}function IR(e){return u(e??void 0)}function LR(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:u(new Date(e))}function RR(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 zR(e){let{schedule:t}=e;return t.kind===`cron`?t.expr?`cron ${t.expr}`:`cron`:t.kind===`every`?`every ${RR(t.everyMs)}`:t.kind===`at`?`at ${LR(t.atMs)}`:`-`}function BR(e){return e.payload.deliver?`${e.payload.channel??`-`}:${e.payload.to??`-`}`:`-`}function VR(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function HR(e,t){let n=t?.trim();return!!(n&&e.payload.sessionId?.trim()===n)}function UR({jobs:e}){let t=Di(),{confirm:n,ConfirmDialog:r}=FR(),i=async e=>{await n({title:`${s(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:s(`delete`)})&&t.mutate({id:e.id})};return(0,I.jsxs)(`div`,{className:`h-full overflow-y-auto custom-scrollbar px-4 py-4`,children:[(0,I.jsxs)(`div`,{className:`mb-4`,children:[(0,I.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:s(`chatWorkspaceSessionCronJobs`)}),(0,I.jsxs)(`div`,{className:`mt-1 text-xs text-gray-500`,children:[s(`cronTotalLabel`),`: `,e.length]})]}),e.length===0?(0,I.jsx)(`div`,{className:`py-8 text-center text-sm text-gray-500`,children:s(`chatWorkspaceCronJobEmpty`)}):(0,I.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,I.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-white px-3 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.name||e.id}),(0,I.jsx)(`div`,{className:`mt-1 text-[11px] text-gray-400`,children:e.id})]}),(0,I.jsxs)(T,{type:`button`,variant:`subtle`,size:`sm`,className:`h-7 gap-1 rounded-lg px-2`,onClick:()=>void i(e),disabled:t.isPending,children:[(0,I.jsx)(gn,{className:`h-3.5 w-3.5`}),s(`delete`)]})]}),(0,I.jsxs)(`div`,{className:`mt-3 space-y-1.5 text-xs text-gray-500`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[s(`cronScheduleLabel`),`:`]}),` `,zR(e)]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[s(`cronNextRun`),`:`]}),` `,IR(e.state.nextRunAt)]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[s(`cronLastRun`),`:`]}),` `,IR(e.state.lastRunAt)]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[s(`cronLastStatus`),`:`]}),` `,e.state.lastStatus??`-`]}),(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[s(`cronDeliverTo`),`:`]}),` `,BR(e)]})]}),(0,I.jsx)(`div`,{className:`mt-3 whitespace-pre-wrap break-words text-sm text-gray-700`,children:e.payload.message})]},e.id))}),(0,I.jsx)(r,{})]})}function WR({sessionKey:e,onToolAction:t,onFileOpen:n}){let r=_R(e),i=r.visibleMessages,a=(0,F.useRef)(null),{onScroll:o}=hj({scrollRef:a,resetKey:e,isLoading:r.isHydrating,hasContent:i.length>0,contentVersion:i[i.length-1]??null,stickyThresholdPx:20});return(0,I.jsx)(`div`,{ref:a,onScroll:o,className:`h-full overflow-y-auto custom-scrollbar`,children:r.isHydrating?(0,I.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-gray-500`,children:[(0,I.jsx)(ln,{className:`mr-2 h-4 w-4 animate-spin`}),s(`chatChildSessionLoading`)]}):r.hydrateError?(0,I.jsx)(`div`,{className:`px-4 py-5 text-sm text-rose-600`,children:r.hydrateError.message}):i.length===0&&!r.isRunning?(0,I.jsx)(`div`,{className:`px-4 py-5 text-sm text-gray-500`,children:s(`chatChildSessionEmpty`)}):(0,I.jsx)(`div`,{className:`px-4 py-5`,children:(0,I.jsx)(_L,{messages:i,isSending:r.isRunning,onToolAction:t,onFileOpen:n})})})}function GR({value:e}){return(0,I.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,I.jsx)(`span`,{className:`truncate`,children:e})})}function KR({tab:e}){let t=[e.sessionTypeLabel,e.preferredModel,e.projectName].filter(e=>!!e?.trim());return t.length===0&&!e.projectRoot?null:(0,I.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[t.length>0?(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,I.jsx)(GR,{value:e},e))}):null,e.projectRoot?(0,I.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 qR({tab:e}){return(0,I.jsxs)(`div`,{className:`border-b border-gray-200/70 px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-gray-900`,children:[e.agentId?(0,I.jsx)(uL,{agentId:e.agentId,className:`h-4 w-4 shrink-0`}):(0,I.jsx)(er,{className:`h-4 w-4 shrink-0 text-gray-400`}),(0,I.jsx)(`span`,{className:`truncate`,children:e.title})]}),(0,I.jsx)(KR,{tab:e})]})}function JR(e){let{resolvedChildTabs:t,workspaceFileTabs:n,sessionCronJobCount:r,activeSelection:i,optimisticReadAtBySessionKey:a,onSelectSession:o,onSelectFile:c,onCloseFile:l,onSelectCronJobs:u}=e,d=t.map(e=>{let t=a[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:i?.kind===`child-session`&&i.tab.sessionKey===e.sessionKey,showUnreadDot:ZN({active:i?.kind===`child-session`&&i.tab.sessionKey===e.sessionKey,lastMessageAt:e.lastMessageAt,readAt:n,runStatus:e.runStatus}),onSelect:()=>o(e.sessionKey)}}),f=n.map(e=>({key:`file:${e.key}`,kind:`file`,title:vR(e),tooltip:e.path,viewMode:e.viewMode,active:i?.kind===`file`&&i.file.key===e.key,onSelect:()=>c(e.key),onClose:()=>l(e.key)})),p=r>0?[{key:`cron:session`,kind:`cron`,title:s(`chatWorkspaceSessionCronJobs`),tooltip:s(`chatWorkspaceSessionCronJobs`),active:i?.kind===`cron`,onSelect:u}]:[];return[...d,...f,...p]}function YR({sessionKey:e,childSessionTabs:t,activeChildSessionKey:n,workspaceFileTabs:i,activeWorkspaceFileKey:a,activePanelKind:o,sessionCronJobs:c=[],sessionProjectRoot:l,displayMode:u=`docked`}){let d=sc(),f=RL(t),p=tP(e=>e.optimisticReadAtBySessionKey),m=yR({activeChildSessionKey:n,activeWorkspaceFileKey:a,activePanelKind:o,childSessionTabs:f,workspaceFileTabs:i,sessionCronJobCount:c.length}),h=f.some(e=>!!e.parentSessionKey);(0,F.useEffect)(()=>{if(m?.kind!==`child-session`||m.tab.runStatus===`running`)return;let e=m.tab.lastMessageAt?.trim()??null;e&&d.chatSessionListManager.markSessionRead(m.tab.sessionKey,e,m.tab.readAt??null)},[m,d]);let g=(0,F.useMemo)(()=>JR({resolvedChildTabs:f,workspaceFileTabs:i,sessionCronJobCount:c.length,activeSelection:m,optimisticReadAtBySessionKey:p,onSelectSession:d.chatThreadManager.selectChildSessionDetail,onSelectFile:d.chatThreadManager.selectWorkspaceFile,onCloseFile:d.chatThreadManager.closeWorkspaceFile,onSelectCronJobs:()=>{e&&d.chatThreadManager.openSessionCronPanel(e)}}),[m,p,d.chatThreadManager,f,e,i,c.length]);return m?(0,I.jsxs)(sn,{className:r(u===`overlay`?`bg-white`:`hidden border-gray-200/70 bg-white/95 backdrop-blur-sm md:flex`),defaultWidth:480,minWidth:360,maxWidth:860,overlay:u===`overlay`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-gray-200/70 px-4 py-2.5`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:d.chatThreadManager.goToParentSession,className:r(`inline-flex items-center gap-1 text-xs font-medium text-gray-600 transition-colors hover:text-gray-900`,!h&&`pointer-events-none opacity-0`),children:[(0,I.jsx)(on,{className:`h-3.5 w-3.5`}),(0,I.jsx)(`span`,{children:s(`chatBackToParent`)})]}),(0,I.jsx)(`button`,{type:`button`,onClick:d.chatThreadManager.closeWorkspacePanel,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":s(`chatWorkspaceClosePanel`),children:(0,I.jsx)(_n,{className:`h-4 w-4`})})]}),(0,I.jsx)(SR,{tabs:g}),(0,I.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-white`,children:m.kind===`child-session`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(qR,{tab:m.tab}),(0,I.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,I.jsx)(WR,{sessionKey:m.tab.sessionKey,onToolAction:d.chatThreadManager.openSessionFromToolAction,onFileOpen:d.chatThreadManager.openFilePreview})})]}):m.kind===`file`?(0,I.jsx)(NR,{file:m.file,sessionProjectRoot:l,onFileOpen:d.chatThreadManager.openFilePreview}):(0,I.jsx)(UR,{jobs:c})})]}):null}function XR({className:e,...t}){return(0,I.jsx)(`div`,{className:r(`animate-pulse rounded-md bg-slate-200`,e),...t})}var ZR=[{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 QR(){return(0,I.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,I.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar`,children:(0,I.jsx)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[min(1120px,100%)] flex-col px-6 py-5`,children:(0,I.jsxs)(`div`,{className:`flex flex-1 flex-col gap-8`,children:[(0,I.jsxs)(`div`,{className:`space-y-6`,children:[(0,I.jsx)(XR,{className:`h-6 w-52 rounded-lg bg-gray-200/90`}),(0,I.jsx)(`div`,{className:`space-y-5`,children:ZR.map(e=>(0,I.jsx)(`div`,{className:r(`flex w-full`,e.alignmentClassName),children:(0,I.jsx)(XR,{"data-testid":`chat-conversation-skeleton-bubble`,className:r(`w-full bg-gray-200/80`,e.bubbleClassName)})},e.key))})]}),(0,I.jsxs)(`div`,{className:`mt-auto grid gap-4 pb-2 sm:grid-cols-[minmax(0,1fr)_minmax(180px,240px)] sm:items-end`,children:[(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsx)(XR,{className:`h-4 w-40 rounded-full bg-gray-200/70`}),(0,I.jsx)(XR,{className:`h-[112px] w-full rounded-[30px] bg-gray-200/70`})]}),(0,I.jsx)(`div`,{className:`hidden justify-end sm:flex`,children:(0,I.jsx)(XR,{className:`h-10 w-36 rounded-full bg-gray-200/75`})})]})]})})}),(0,I.jsx)(`div`,{className:`border-t border-gray-200/80 bg-white p-4`,children:(0,I.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)]`,children:(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-card`,children:[(0,I.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,I.jsx)(XR,{className:`h-[84px] w-full rounded-[28px] bg-gray-200/80`})}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 pb-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(XR,{className:`h-8 w-20 rounded-full bg-gray-200/75`}),(0,I.jsx)(XR,{className:`h-8 w-28 rounded-full bg-gray-200/75`}),(0,I.jsx)(XR,{className:`hidden h-8 w-24 rounded-full bg-gray-200/70 sm:block`})]}),(0,I.jsx)(XR,{className:`h-8 w-8 rounded-full bg-gray-200/85`})]})]})})})]})}function $R(){let e=sc(),t=Q(e=>e.snapshot);return(0,I.jsxs)(I.Fragment,{children:[t.isProviderStateResolved&&t.modelOptions.length===0?(0,I.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-amber-200/70 bg-amber-50/70 flex items-center justify-between gap-3 shrink-0 sm:px-5`,children:[(0,I.jsx)(`span`,{className:`text-xs text-amber-800`,children:s(`chatModelNoOptions`)}),(0,I.jsx)(`button`,{type:`button`,onClick:e.chatThreadManager.goToProviders,className:`text-xs font-semibold text-amber-900 underline-offset-2 hover:underline`,children:s(`chatGoConfigureProvider`)})]}):null,t.sessionTypeUnavailable&&t.sessionTypeUnavailableMessage?.trim()?(0,I.jsx)(`div`,{className:`px-4 py-2.5 border-b border-amber-200/70 bg-amber-50/70 shrink-0 sm:px-5`,children:(0,I.jsx)(`span`,{className:`text-xs text-amber-800`,children:t.sessionTypeUnavailableMessage})}):null]})}function ez(){let e=sc(),t=Z(e=>e.snapshot.defaultSessionType),n=Q(e=>e.snapshot),r=(0,F.useRef)(null),i=n.threadRef??r,a=n.availableAgents??[],o=!n.canDeleteSession&&!n.hasSubmittedDraftMessage&&n.messages.length===0&&!n.isSending,s=n.isHistoryLoading&&n.messages.length===0&&!n.isSending&&!n.isAwaitingAssistantOutput,c=e=>a.find(t=>t.id===e)??null,l=()=>{let r=NL(c(n.agentId??`main`),t);e.chatSessionListManager.createSession(r)},u=n=>{e.chatSessionListManager.setSelectedAgentId(n),e.chatInputManager.setPendingSessionType(NL(c(n),t))},{onScroll:d}=hj({scrollRef:i,resetKey:n.sessionKey,isLoading:n.isHistoryLoading,hasContent:n.messages.length>0,contentVersion:n.messages[n.messages.length-1]??null}),f=n.messages.length>0,p=f&&n.isSending&&n.isAwaitingAssistantOutput;return(0,I.jsx)(`div`,{ref:i,onScroll:d,className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar`,children:o?(0,I.jsx)(ic,{onCreateSession:l,agents:a,selectedAgentId:n.agentId??`main`,onSelectAgent:u}):s||!f?null:(0,I.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,I.jsx)(_L,{messages:n.messages,isSending:p,onToolAction:e.chatThreadManager.openSessionFromToolAction,onFileOpen:e.chatThreadManager.openFilePreview})})})}function tz(e,t,n,r){return e.workspacePanelParentKey===e.sessionKey?t.length>0||n.length>0||r>0:!1}function nz(e){let t=(0,F.useMemo)(()=>e.childSessionTabs.filter(t=>t.parentSessionKey===e.sessionKey),[e.childSessionTabs,e.sessionKey]),n=(0,F.useMemo)(()=>e.workspaceFileTabs.filter(t=>t.parentSessionKey===e.sessionKey),[e.sessionKey,e.workspaceFileTabs]),r=Ei({all:!0}),i=(0,F.useMemo)(()=>(r.data?.jobs??[]).filter(t=>HR(t,e.sessionKey)),[r.data?.jobs,e.sessionKey]);return{childSessionTabs:t,workspaceFileTabs:n,sessionCronJobs:i,showWorkspacePanel:tz(e,t,n,i.length)}}function rz(){let e=sc(),t=Q(e=>e.snapshot);return(0,I.jsx)(kL,{parentSessionLabel:t.parentSessionKey?t.parentSessionLabel??null:null,onGoToParentSession:e.chatThreadManager.goToParentSession})}function iz({layoutMode:e,onBackToList:t}){let n=sc(),r=Q(e=>e.snapshot),{childSessionTabs:i,sessionCronJobs:a}=nz(r),o=!!(r.sessionKey||r.sessionTypeLabel),c=r.sessionDisplayName||(r.canDeleteSession&&r.sessionKey?r.sessionKey:null)||s(`chatSidebarNewTask`),l=r.agentId?.trim()??``,u=l.length>0&&l.toLowerCase()!==`main`;return(0,I.jsx)(AL,{snapshot:r,childSessionCount:i.length,sessionCronJobCount:a.length,layoutMode:e,normalizedAgentId:l,sessionHeaderTitle:c,shouldShowHeaderAgentAvatar:u,shouldShowSessionHeader:o,onBackToList:t,onOpenChildSessions:()=>{r.sessionKey&&n.chatThreadManager.openChildSessionPanel({parentSessionKey:r.sessionKey,activeChildSessionKey:i[0]?.sessionKey??null})},onOpenSessionCronJobs:()=>{!r.sessionKey||a.length===0||n.chatThreadManager.openSessionCronPanel(r.sessionKey)},onDeleteSession:n.chatThreadManager.deleteSession})}function az({layoutMode:e}){let t=Q(e=>e.snapshot),{childSessionTabs:n,workspaceFileTabs:r,sessionCronJobs:i,showWorkspacePanel:a}=nz(t);return a?(0,I.jsx)(YR,{sessionKey:t.sessionKey,childSessionTabs:n,activeChildSessionKey:t.activeChildSessionKey??null,workspaceFileTabs:r,activeWorkspaceFileKey:t.activeWorkspaceFileKey??null,activePanelKind:t.activeWorkspacePanelKind??null,sessionCronJobs:i,sessionProjectRoot:t.sessionProjectRoot??null,displayMode:e===`mobile`?`overlay`:`docked`}):null}function oz({layoutMode:e=`desktop`,onBackToList:t}){return Q(e=>e.snapshot).isProviderStateResolved?(0,I.jsxs)(`section`,{className:`flex-1 min-h-0 flex overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,I.jsx)(rz,{}),(0,I.jsx)(iz,{layoutMode:e,onBackToList:t}),(0,I.jsx)($R,{}),(0,I.jsx)(ez,{}),(0,I.jsx)(_P,{})]}),(0,I.jsx)(az,{layoutMode:e})]}):(0,I.jsx)(QR,{})}var sz={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 cz({status:e,className:t}){let n=sz[e],i=s(e===`connected`?`connected`:e===`disconnected`?`disconnected`:`connecting`);return(0,I.jsx)(pt,{delayDuration:250,children:(0,I.jsxs)(yt,{children:[(0,I.jsx)(mt,{asChild:!0,children:(0,I.jsx)(`span`,{role:`status`,"aria-label":i,className:r(`inline-flex h-5 w-5 items-center justify-center`,t),children:e===`connecting`?(0,I.jsx)(ln,{className:r(`h-3 w-3 animate-spin`,n.dotClass)}):(0,I.jsx)(`span`,{className:r(e===`connected`?`h-2 w-2 rounded-full`:``,n.dotClass)})})}),(0,I.jsx)(Dt,{side:`bottom`,className:`text-xs`,children:i})]})})}function lz(){let e=vL();return async t=>{await e({sessionKey:t.sessionKey,patch:{label:t.label},successMessage:s(`configSavedApplied`)})}}function uz(){let e=lz(),[t,n]=(0,F.useState)(null),[r,i]=(0,F.useState)(``),[a,o]=(0,F.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 dz(e,t){return e.filter(e=>$s(e,t))}function fz(e){return e.isChildSession?e.isPromotedChildSession===!0:!0}function pz(e={}){let t=tP(e=>e.snapshot.query),n=wi({limit:e.limit??200}),r=(0,F.useMemo)(()=>dz($I(n.data?.sessions??[]).filter(fz),t).map(e=>({session:e,runStatus:e.status===`running`?`running`:void 0})),[t,n.data?.sessions]);return{isLoading:n.isLoading,items:r}}function mz(e){let{item:t,selectedSessionKey:n,optimisticReadAtBySessionKey:r,agentsById:i,childSessionsByParentKey:a,editingSessionKey:o,draftLabel:s,savingSessionKey:c,sessionTitle:l,onSelectSession:u,onOpenChildSessions:d,onStartEditingSessionLabel:f,onDraftLabelChange:p,onSaveSessionLabel:m,onCancelEditingSessionLabel:h}=e,{session:g,runStatus:_}=t,v=Z(e=>e.snapshot),y=n===g.key,b=r[g.key],x=b&&g.readAt?b.localeCompare(g.readAt)>0?b:g.readAt:b??g.readAt,S=a.get(g.key)??[];return(0,I.jsx)(nc,{session:g,active:y,showUnreadDot:ZN({active:y,lastMessageAt:g.lastMessageAt,readAt:x,runStatus:_}),runStatus:_,context:Ms(g,v.sessionTypeOptions),title:l(g),agentId:g.agentId??null,agentLabel:g.agentId?i.get(g.agentId)?.displayName??g.agentId:null,agentAvatarUrl:g.agentId?i.get(g.agentId)?.avatarUrl??null:null,childSessionCount:S.length,isEditing:o===g.key,draftLabel:s,isSaving:c===g.key,onSelect:()=>u(g.key),onOpenChildSessions:()=>d(g.key,S[0]?.session.key??null),onStartEditing:()=>f(g),onDraftLabelChange:p,onSave:()=>m(g),onCancel:h})}function hz(e){let t=e.sessionTypeOptions.find(t=>t.value===e.defaultSessionType);return[...t?[t]:[],...e.nonDefaultSessionTypeOptions]}function gz(e){let{query:t,defaultSessionType:n,nonDefaultSessionTypeOptions:i,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:c,onQueryChange:l}=e;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`px-4 pb-3`,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(T,{variant:`primary`,className:r(`min-w-0 rounded-xl`,i.length>0?`flex-1 rounded-r-md`:`w-full`),onClick:()=>{o(!1),c(n)},children:[(0,I.jsx)(pn,{className:`mr-2 h-4 w-4`}),s(`chatSidebarNewTask`)]}),i.length>0?(0,I.jsxs)(Tn,{open:a,onOpenChange:o,children:[(0,I.jsx)(Cn,{asChild:!0,children:(0,I.jsx)(T,{variant:`primary`,size:`icon`,className:`h-9 w-10 shrink-0 rounded-xl rounded-l-md`,"aria-label":s(`chatSessionTypeLabel`),children:(0,I.jsx)(Rn,{className:`h-4 w-4`})})}),(0,I.jsxs)(xn,{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,I.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,children:s(`chatSessionTypeLabel`)}),(0,I.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,I.jsx)(zs,{option:e,onSelect:()=>{c(e.value),o(!1)}},e.value))})]})]}):null]})}),(0,I.jsx)(`div`,{className:`px-4 pb-3`,children:(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(hn,{className:`absolute left-3 top-2.5 h-3.5 w-3.5 text-gray-400`}),(0,I.jsx)(oe,{value:t,onChange:e=>l(e.target.value),placeholder:s(`chatSidebarSearchPlaceholder`),className:`h-9 rounded-lg pl-8 text-xs`})]})})]})}function _z(e){let{query:t,defaultSessionType:n,sessionTypeOptions:r,nonDefaultSessionTypeOptions:i,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:c,onQueryChange:l}=e,u=hz({defaultSessionType:n,sessionTypeOptions:r,nonDefaultSessionTypeOptions:i}),d=u.length>1;return(0,I.jsx)(`div`,{className:`px-4 pb-2 pt-1`,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,I.jsx)(hn,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,I.jsx)(oe,{value:t,onChange:e=>l(e.target.value),placeholder:s(`chatSidebarSearchPlaceholder`),className:`h-9 rounded-full border-transparent bg-gray-100/80 pl-9 pr-3 text-[13px] shadow-none focus:border-gray-200/80 focus:bg-white`})]}),d?(0,I.jsxs)(Tn,{open:a,onOpenChange:o,children:[(0,I.jsx)(Cn,{asChild:!0,children:(0,I.jsx)(T,{variant:`ghost`,size:`icon`,className:`h-9 w-9 shrink-0 rounded-full bg-gray-100/80 text-gray-700 shadow-none hover:bg-gray-200/80 hover:text-gray-900`,"aria-label":s(`chatSidebarNewTask`),children:(0,I.jsx)(pn,{className:`h-4 w-4`})})}),(0,I.jsxs)(xn,{align:`end`,className:`w-60 rounded-3xl border border-gray-200/80 bg-white p-2 shadow-[0_24px_70px_-30px_rgba(15,23,42,0.45)]`,children:[(0,I.jsx)(`div`,{className:`px-3 pb-1.5 pt-2 text-[11px] font-medium text-gray-400`,children:s(`chatSidebarNewTask`)}),(0,I.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>(0,I.jsx)(zs,{option:e,onSelect:()=>{c(e.value),o(!1)}},e.value))})]})]}):(0,I.jsx)(T,{variant:`ghost`,size:`icon`,className:`h-9 w-9 shrink-0 rounded-full bg-gray-100/80 text-gray-700 shadow-none hover:bg-gray-200/80 hover:text-gray-900`,"aria-label":s(`chatSidebarNewTask`),onClick:()=>c(n),children:(0,I.jsx)(pn,{className:`h-4 w-4`})})]})})}function vz({isOpen:e,onOpenChange:t,currentTheme:n,currentThemeLabel:r,themeOptions:i,onSelectTheme:a,currentLanguage:o,currentLanguageLabel:c,languageOptions:l,onSelectLanguage:u,onOpenDocs:d,onOpenApps:f}){let p=()=>{d(),t(!1)},m=()=>{f(),t(!1)};return(0,I.jsxs)(Tn,{open:e,onOpenChange:t,children:[(0,I.jsx)(Cn,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,"aria-label":o===`zh`?`设置菜单`:`Settings menu`,className:`flex w-full items-center gap-2.5 rounded-xl px-3 py-2 text-[13px] font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,children:[(0,I.jsx)(vr,{className:`h-4 w-4 shrink-0 text-gray-400`}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:s(`settings`)}),(0,I.jsxs)(`span`,{className:`max-w-[112px] truncate text-[13px] text-gray-500`,children:[r,` / `,c]})]})}),(0,I.jsxs)(xn,{side:`top`,align:`start`,className:`w-64 p-2`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsxs)(ct,{to:`/settings`,onClick:()=>t(!1),className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-gray-700 transition-colors hover:bg-gray-100`,children:[(0,I.jsx)(vr,{className:`h-4 w-4 text-gray-400`}),(0,I.jsx)(`span`,{className:`flex-1 text-left`,children:s(`settings`)})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:p,className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-gray-700 transition-colors hover:bg-gray-100`,children:[(0,I.jsx)(cn,{className:`h-4 w-4 text-gray-400`}),(0,I.jsx)(`span`,{className:`flex-1 text-left`,children:s(`docBrowserHelp`)})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:m,className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-gray-700 transition-colors hover:bg-gray-100`,children:[(0,I.jsx)(un,{className:`h-4 w-4 text-gray-400`}),(0,I.jsx)(`span`,{className:`flex-1 text-left`,children:s(`appsTitle`)})]})]}),(0,I.jsx)(`div`,{className:`my-2 h-px bg-gray-200/70`}),(0,I.jsx)(yz,{icon:mr,label:s(`theme`),options:i,value:n,valueLabel:r,onSelect:a,onCloseMenu:()=>t(!1)}),(0,I.jsx)(yz,{icon:lr,label:s(`language`),options:l,value:o,valueLabel:c,onSelect:u,onCloseMenu:()=>t(!1)})]})]})}function yz({icon:e,label:t,options:n,value:r,valueLabel:i,onSelect:a,onCloseMenu:o}){return(0,I.jsxs)(yo,{value:r,onOpenChange:e=>{e||o()},onValueChange:e=>a(e),children:[(0,I.jsxs)(xo,{"aria-label":t,className:`h-auto w-full rounded-lg border-0 bg-transparent px-3 py-2 text-[13px] font-medium text-gray-700 shadow-none hover:bg-gray-100 focus:ring-0`,indicator:(0,I.jsx)(zn,{className:`h-4 w-4 text-gray-400`}),children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,I.jsx)(e,{className:`h-4 w-4 shrink-0 text-gray-400`}),(0,I.jsx)(`span`,{className:`text-left`,children:t})]}),(0,I.jsx)(`span`,{className:`ml-auto max-w-[96px] truncate text-[13px] text-gray-500`,children:i})]}),(0,I.jsx)(wo,{side:`right`,align:`center`,sideOffset:6,className:`z-[var(--z-tooltip)] min-w-[7rem] rounded-lg`,viewportClassName:`h-auto min-w-[7rem] w-auto`,children:n.map(e=>(0,I.jsx)(Eo,{value:e.value,className:`text-[13px]`,children:e.label},e.value))})]})}function bz(e){return new Date(e.session.lastMessageAt??e.session.createdAt).getTime()}function xz(e){return[...e].sort((e,t)=>bz(t)-bz(e))}function Sz(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-864e5,i=n-7*864e5,a=[],o=[],c=[],l=[];for(let t of e){let e=bz(t);e>=n?a.push(t):e>=r?o.push(t):e>=i?c.push(t):l.push(t)}let u=[];return a.length>0&&u.push({label:s(`chatSidebarToday`),items:a}),o.length>0&&u.push({label:s(`chatSidebarYesterday`),items:o}),c.length>0&&u.push({label:s(`chatSidebarPrevious7Days`),items:c}),l.length>0&&u.push({label:s(`chatSidebarOlder`),items:l}),u}function Cz(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=bz(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()||CI(e)||e,items:[n],latestUpdatedAt:i})}return[...t.values()].map(e=>({...e,items:xz(e.items)})).sort((e,t)=>t.latestUpdatedAt-e.latestUpdatedAt)}function wz(e){let t=new Map;for(let n of e){let e=n.session.parentSessionId?.trim();if(!e)continue;let r=t.get(e)??[];r.push(n),t.set(e,r)}for(let e of t.values())e.sort((e,t)=>bz(t)-bz(e));return t}function Tz(e){if(e.label&&e.label.trim())return e.label.trim();let t=e.key.split(`:`);return t[t.length-1]||e.key}var Ez=[{target:`/cron`,label:()=>s(`chatSidebarScheduledTasks`),icon:Mn},{target:`/skills`,label:()=>s(`chatSidebarSkills`),icon:rt},{target:`/agents`,label:()=>s(`agentsPageTitle`),icon:Fn}];function Dz(e,t,n){let r=tP(e=>e.optimisticReadAtBySessionKey);return(0,F.useEffect)(()=>{(()=>{if(!t)return;let r=e.find(({session:e})=>e.key===t);if(!r||r.runStatus===`running`)return;let{session:i}=r;n(i.key,i.lastMessageAt,i.readAt)})()},[e,n,t]),r}function Oz({variant:e=`desktop`}){let n=e===`mobile`,i=sc(),a=On(),[o,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(!1),d=Z(e=>e.snapshot),f=tP(e=>e.snapshot),p=Je(),m=aL(),{isLoading:h,items:g}=pz(),{language:_,setLanguage:v}=Ar(),{theme:y,setTheme:b}=rs(),x=s(Jr.find(e=>e.value===y)?.labelKey??`themeWarm`),S=t.find(e=>e.value===_)?.label??_,C=(0,F.useMemo)(()=>Jr.map(e=>({value:e.value,label:s(e.labelKey)})),[]),w=(0,F.useMemo)(()=>t.map(e=>({value:e.value,label:e.label})),[]),T=(0,F.useMemo)(()=>new Map((m.data?.agents??[]).map(e=>[e.id,e])),[m.data?.agents]),E=(0,F.useMemo)(()=>xz(g),[g]),D=(0,F.useMemo)(()=>wz(g),[g]),O=(0,F.useMemo)(()=>Sz(E),[E]),k=(0,F.useMemo)(()=>Cz(E),[E]),A=d.defaultSessionType||`native`,ee=(0,F.useMemo)(()=>d.sessionTypeOptions.filter(e=>e.value!==A),[A,d.sessionTypeOptions]),j=f.listMode===`project-first`,te=Dz(g,f.selectedSessionKey,i.chatSessionListManager.markSessionRead),{editingSessionKey:M,draftLabel:ne,savingSessionKey:re,setDraftLabel:ie,startEditingSessionLabel:ae,cancelEditingSessionLabel:oe,saveSessionLabel:se}=uz(),ce=e=>{_!==e&&(v(e),window.location.reload())},le=e=>(0,I.jsx)(mz,{item:e,selectedSessionKey:f.selectedSessionKey,optimisticReadAtBySessionKey:te,agentsById:T,childSessionsByParentKey:D,editingSessionKey:M,draftLabel:ne,savingSessionKey:re,sessionTitle:Tz,onSelectSession:i.chatSessionListManager.selectSession,onOpenChildSessions:(e,t)=>i.chatThreadManager.openChildSessionPanel({parentSessionKey:e,activeChildSessionKey:t}),onStartEditingSessionLabel:ae,onDraftLabelChange:ie,onSaveSessionLabel:se,onCancelEditingSessionLabel:oe},e.session.key),ue=(e,t)=>{i.chatSessionListManager.createSession(e,typeof t==`string`?t:void 0)};return(0,I.jsxs)(`aside`,{className:r(`flex h-full min-h-0 flex-col bg-secondary`,n?`flex-1 overflow-hidden`:`w-[280px] shrink-0 border-r border-gray-200/60`),children:[!n&&!fs()?(0,I.jsx)(`div`,{className:`px-5 py-2.5`,children:(0,I.jsx)(Mi,{className:`flex min-w-0 items-center gap-2`,suffix:(0,I.jsx)(cz,{status:p.connectionStatus})})}):null,n?(0,I.jsx)(_z,{query:f.query,defaultSessionType:A,sessionTypeOptions:d.sessionTypeOptions,nonDefaultSessionTypeOptions:ee,isCreateMenuOpen:o,onCreateMenuOpenChange:c,onCreateSession:ue,onQueryChange:i.chatSessionListManager.setQuery}):(0,I.jsx)(gz,{query:f.query,defaultSessionType:A,sessionTypeOptions:d.sessionTypeOptions,nonDefaultSessionTypeOptions:ee,isCreateMenuOpen:o,onCreateMenuOpenChange:c,onCreateSession:ue,onQueryChange:i.chatSessionListManager.setQuery}),n?null:(0,I.jsx)(`div`,{className:`px-3 pb-2`,children:(0,I.jsx)(`ul`,{className:`space-y-0.5`,children:Ez.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsx)(Ao,{to:e.target,label:e.label(),icon:e.icon,density:`compact`})},e.target))})}),n?null:(0,I.jsx)(`div`,{className:`mx-4 border-t border-gray-200/60`}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between px-5 pb-2 pt-3`,children:[(0,I.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-gray-400`,children:s(`chatSidebarTaskRecords`)}),(0,I.jsx)(bs,{isProjectFirstView:j,onSelectMode:i.chatSessionListManager.setListMode})]}),(0,I.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto custom-scrollbar px-3 py-2`,children:h?(0,I.jsx)(`div`,{className:`text-xs text-gray-500 p-3`,children:s(`sessionsLoading`)}):j?k.length===0?(0,I.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,I.jsx)(dr,{className:`h-6 w-6 mx-auto mb-2 text-gray-300`}),(0,I.jsx)(`div`,{className:`text-xs text-gray-500`,children:s(`chatSidebarProjectViewEmpty`)})]}):(0,I.jsx)(Vs,{groups:k,defaultSessionType:A,sessionTypeOptions:d.sessionTypeOptions,renderSessionItem:le,onCreateSession:ue}):O.length===0?(0,I.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,I.jsx)(dr,{className:`h-6 w-6 mx-auto mb-2 text-gray-300`}),(0,I.jsx)(`div`,{className:`text-xs text-gray-500`,children:s(`sessionsEmpty`)})]}):(0,I.jsx)(`div`,{className:`space-y-3`,children:O.map(e=>(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-medium text-gray-400 uppercase tracking-wider`,children:e.label}),(0,I.jsx)(`div`,{className:`space-y-0.5`,children:e.items.map(le)})]},e.label))})}),n?null:(0,I.jsx)(`div`,{className:`px-3 py-3 border-t border-gray-200/60`,children:(0,I.jsx)(vz,{isOpen:l,onOpenChange:u,currentTheme:y,currentThemeLabel:x,themeOptions:C,onSelectTheme:b,currentLanguage:_,currentLanguageLabel:S,languageOptions:w,onSelectLanguage:ce,onOpenDocs:()=>a.open(void 0,{kind:`docs`,title:s(`docBrowserHelp`)}),onOpenApps:()=>Tt(a)})})]})}function kz(){return me({queryKey:[`ncp-session-types`],queryFn:pe,staleTime:1e4,retry:!1})}function Az(e){let t=e.trim();return t.length>0?t:null}function jz(e){return e??null}var Mz=class{constructor(e){this.updateSession=e,this.inFlight=null,this.queued=null,this.syncSelectedSessionPreferences=()=>{let e=Z.getState().snapshot,t=tP.getState().snapshot,n=Q.getState().snapshot,r=t.selectedSessionKey;!r||!n.canDeleteSession||this.enqueue({sessionKey:r,patch:{preferredModel:Az(e.selectedModel),preferredThinking:jz(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)}}}},Nz=class{constructor(e,t,n){this.uiManager=e,this.streamActionsManager=t,this.sessionListManager=n,this.sessionPreferenceSync=new Mz(We),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.isRuntimeBlockedForSend=()=>oP(Ke.getStatusView()),this.syncComposerSnapshot=e=>{let t=Z.getState().snapshot.attachments,n=FN(e,t);Z.getState().setSnapshot({composerNodes:e,attachments:n,draft:AN(e),selectedSkills:jN(e)})},this.syncComposerSnapshotWithAttachments=(e,t)=>{Z.getState().setSnapshot({composerNodes:e,attachments:t,draft:AN(e),selectedSkills:jN(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(kN(n))},this.requestComposerFocusAtEnd=()=>{let e=Z.getState().snapshot.composerFocusRequest;Z.getState().setSnapshot({composerFocusRequest:{id:(e?.id??0)+1,placement:`end`}})},this.consumeComposerFocusRequest=e=>{Z.getState().snapshot.composerFocusRequest?.id===e&&Z.getState().setSnapshot({composerFocusRequest:null})},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=PN(t.composerNodes,r);return this.syncComposerSnapshotWithAttachments(a,r),i},this.restoreComposerState=(e,t)=>{let n=this.dedupeAttachments(t),r=PN(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=tP.getState().snapshot,n=Q.getState().snapshot,r=e.draft.trim(),{attachments:i}=e,a=IN(e.composerNodes,i);if(GN({snapshot:e,hasSendableDraft:a.some(e=>e.type!==`text`||e.text.trim().length>0),isRuntimeBlocked:this.isRuntimeBlockedForSend()}))return;let{selectedSkills:o,composerNodes:s}=e,c=n.sessionKey??t.selectedSessionKey??null;!c&&e.selectedSessionType?.trim()&&this.sessionListManager.ensureDraftSession(e.selectedSessionType),this.setComposerNodes(ON()),await this.streamActionsManager.sendMessage({message:r,...c?{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.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=ML(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(NN(t.composerNodes,r,t.skillRecords))},this.selectModel=e=>{this.setSelectedModel(e),zN.remember(e),this.sessionPreferenceSync.syncSelectedSessionPreferences()},this.selectThinkingLevel=e=>{this.setSelectedThinkingLevel(e),this.sessionPreferenceSync.syncSelectedSessionPreferences()},this.rememberSkillSelection=e=>{BN.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})}}},Pz=`sid_`,Fz=`/chat/draft`,Iz=Fz.slice(6);function Lz(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return`${Pz}${btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}`}function Rz(e){if(!e.startsWith(Pz))return null;let t=e.slice(4).replace(/-/g,`+`).replace(/_/g,`/`),n=`=`.repeat((4-t.length%4)%4);try{let e=atob(t+n),r=Uint8Array.from(e,e=>e.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function zz(e){if(!e||e===Iz)return null;let t=Rz(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function Bz(e){return`/chat/${Lz(e)}`}var Vz=class{constructor(e,t){this.uiManager=e,this.streamActionsManager=t,this.syncDraftThreadState=(e=!1)=>{Q.getState().setSnapshot({sessionKey:null,sessionDisplayName:void 0,canDeleteSession:!1,isHistoryLoading:!1,messages:[],isSending:!1,isAwaitingAssistantOutput:!1,hasSubmittedDraftMessage:e,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeWorkspaceFileKey:null})},this.resolveUpdateValue=(e,t)=>typeof t==`function`?t(e):t,this.shouldPersistReadAt=(e,t,n)=>{let r=tP.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=tP.getState().snapshot.selectedAgentId,n=this.resolveUpdateValue(t,e);n!==t&&tP.getState().setSnapshot({selectedAgentId:n})},this.setSelectedSessionKey=e=>{let t=tP.getState().snapshot.selectedSessionKey,n=this.resolveUpdateValue(t,e);n!==t&&tP.getState().setSnapshot({selectedSessionKey:n})},this.setListMode=e=>{let t=tP.getState().snapshot.listMode,n=this.resolveUpdateValue(t,e);n!==t&&tP.getState().setSnapshot({listMode:n})},this.markSessionRead=(e,t,n)=>{let r=e?.trim(),i=t?.trim();!r||!i||this.shouldPersistReadAt(r,i,n)&&(tP.getState().markSessionRead(r,i),We(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=SI(t);this.streamActionsManager.resetStreamState(),tP.getState().setSnapshot({selectedSessionKey:null}),this.syncDraftThreadState(),Z.getState().setSnapshot({pendingSessionType:a,pendingProjectRoot:o,pendingProjectRootSessionKey:null}),this.uiManager.navigateTo(Fz)},this.startAgentDraftChat=(e,t)=>{let n=e.trim()||`main`;this.createSession(t),this.setSelectedAgentId(n)},this.ensureDraftSession=e=>{let{snapshot:t}=tP.getState();if(t.selectedSessionKey)return t.selectedSessionKey;let n=typeof e==`string`&&e.trim().length>0?e.trim():null;return this.syncDraftThreadState(!0),n&&Z.getState().setSnapshot({pendingSessionType:n}),null},this.materializeRootSessionRoute=e=>{let t=e.trim();t&&this.uiManager.isAtChatRoot()&&this.uiManager.goToSession(t,{replace:!0})},this.selectSession=e=>{this.uiManager.goToSession(e)},this.setQuery=e=>{let t=tP.getState().snapshot.query,n=this.resolveUpdateValue(t,e);n!==t&&tP.getState().setSnapshot({query:n})}}},Hz=async()=>{},Uz=()=>{},Wz=class{constructor(){this.actions={sendMessage:Hz,stopCurrentRun:Hz,resumeRun:Hz,resetStreamState:Uz,applyHistoryMessages:Uz},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)}},Gz=async e=>!1,Kz=class{constructor(){this.state={pathname:``},this.actions={navigate:null,confirm:Gz},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.state.pathname===`/chat/draft`,this.goToSession=(e,t)=>{this.navigateTo(Bz(e),t)}}},qz=class{constructor(e,t,n){this.uiManager=e,this.sessionListManager=t,this.streamActionsManager=n,this.hasSnapshotChanges=e=>{let t=Q.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)&&Q.getState().setSnapshot(e)},this.clearDeletedSessionState=e=>{tP.getState().snapshot.selectedSessionKey===e&&this.sessionListManager.setSelectedSessionKey(null),Q.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,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,workspaceFileTabs:[],activeWorkspaceFileKey:null})},this.resolveWorkspaceParentSessionKey=()=>Q.getState().snapshot.sessionKey?.trim()||(tP.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}=Q.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}}=tP.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;Q.getState().setSnapshot({workspacePanelParentKey:t,activeWorkspacePanelKind:`child-session`,activeChildSessionKey:n,activeWorkspaceFileKey:null}),this.ensureWorkspaceParentRoute(t)},this.openFilePreview=e=>{let t=this.resolveWorkspaceParentSessionKey(),n=this.buildWorkspaceFileTab(e,t);n&&(Q.getState().setSnapshot({workspacePanelParentKey:t,activeWorkspacePanelKind:`file`,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()||tP.getState().snapshot.selectedSessionKey||null;if(t){this.openChildSessionPanel({parentSessionKey:t,activeChildSessionKey:e.sessionId});return}}Q.getState().setSnapshot({workspacePanelParentKey:null,activeWorkspacePanelKind:null,activeChildSessionKey:null,activeWorkspaceFileKey:null}),this.uiManager.goToSession(e.sessionId)}},this.selectChildSessionDetail=e=>{let t=e.trim();if(!t)return;let{childSessionTabs:n}=Q.getState().snapshot;n.some(e=>e.sessionKey===t)&&Q.getState().setSnapshot({activeChildSessionKey:t,activeWorkspaceFileKey:null,activeWorkspacePanelKind:`child-session`})},this.selectWorkspaceFile=e=>{let t=e.trim();if(!t)return;let{workspaceFileTabs:n}=Q.getState().snapshot;n.some(e=>e.key===t)&&Q.getState().setSnapshot({activeWorkspaceFileKey:t,activeChildSessionKey:null,activeWorkspacePanelKind:`file`})},this.closeWorkspaceFile=e=>{let t=e.trim();if(!t)return;let{snapshot:n}=Q.getState(),{activeWorkspaceFileKey:r,workspaceFileTabs:i}=n,a={workspaceFileTabs:i.filter(e=>e.key!==t)};r===t&&(a.activeWorkspaceFileKey=null),Q.getState().setSnapshot(a)},this.closeWorkspacePanel=()=>{Q.getState().setSnapshot({workspacePanelParentKey:null,activeWorkspacePanelKind:null,activeChildSessionKey:null,activeWorkspaceFileKey:null})},this.openSessionCronPanel=e=>{let t=e.trim();t&&(Q.getState().setSnapshot({workspacePanelParentKey:t,activeWorkspacePanelKind:`cron`,activeChildSessionKey:null,activeWorkspaceFileKey:null}),this.ensureWorkspaceParentRoute(t))},this.closeChildSessionDetail=()=>{this.closeWorkspacePanel()},this.goToParentSession=()=>{let{parentSessionKey:e,childSessionTabs:t,activeChildSessionKey:n}=Q.getState().snapshot,r=t.find(e=>e.sessionKey===n)?.parentSessionKey??null,i=e??r;i&&(this.closeWorkspacePanel(),this.uiManager.goToSession(i))},this.isCompactViewport=()=>Pr.getSnapshot().mode===`mobile`,this.deleteCurrentSession=async()=>{let{snapshot:{selectedSessionKey:e}}=tP.getState();if(e&&await this.uiManager.confirm({title:s(`chatDeleteSessionConfirm`),variant:`destructive`,confirmLabel:s(`delete`)})){Q.getState().setSnapshot({isDeletePending:!0});try{await Ie(e),Oe(te,e),te.removeQueries({queryKey:[`ncp-session-messages`,e]}),this.streamActionsManager.resetStreamState(),this.clearDeletedSessionState(e),this.uiManager.goToChatRoot({replace:!0})}finally{Q.getState().setSnapshot({isDeletePending:!1})}}}}},Jz=class{constructor(){this.chatUiManager=new Kz,this.chatStreamActionsManager=new Wz,this.chatSessionListManager=new Vz(this.chatUiManager,this.chatStreamActionsManager),this.chatInputManager=new Nz(this.chatUiManager,this.chatStreamActionsManager,this.chatSessionListManager),this.chatThreadManager=new qz(this.chatUiManager,this.chatSessionListManager,this.chatStreamActionsManager),this.startAgentCreationDraft=e=>{this.chatSessionListManager.createSession(),this.chatSessionListManager.setSelectedAgentId(`main`),this.chatInputManager.setDraft(e),this.chatInputManager.requestComposerFocusAtEnd()}}};function Yz(e){return e?.trim().toLowerCase()||`native`}function Xz(e,t){if(typeof t!=`string`)return!1;let n=t.trim();return n?e.some(e=>e.value===n):!1}function Zz(e,t){return typeof t==`string`&&e.includes(t)}function Qz(e){return e.length===0?null:e.includes(`off`)?`off`:e[0]??null}function $z(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 eB(e){let{modelOptions:t,currentSelectedModel:n,selectedSessionPreferredModel:r,fallbackPreferredModel:i,defaultModel:a,preferSessionPreferredModel:o,preserveCurrentSelectedModelOnSessionChange:s}=e;return t.length===0?``:$z({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>Xz(t,e),firstAvailableValue:t[0]?.value??``,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function tB(e){let{supportedThinkingLevels:t,currentSelectedThinkingLevel:n,selectedSessionPreferredThinking:r,fallbackPreferredThinking:i,defaultThinkingLevel:a,preferSessionPreferredThinking:o,preserveCurrentSelectedThinkingOnSessionChange:s}=e;return t.length===0?null:$z({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>Zz(t,e),firstAvailableValue:Qz(t)??`off`,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function nB(e){let{sessions:t,selectedSessionKey:n,sessionType:r,readPreference:i}=e,a=Yz(r),o,s=-1/0;for(let e of t){if(e.key===n||Yz(e.sessionType)!==a)continue;let t=i(e);if(t==null)continue;let r=Date.parse(e.updatedAt),c=Number.isFinite(r)?r:-1/0;(o===void 0||c>s)&&(o=t,s=c)}return o}function rB(e){return e.map(e=>e==null?``:String(e)).join(``)}function iB(e){let{isPreferenceAvailable:t,emptyValue:n,syncKey:r,selectedSessionKey:i,selectedSessionExists:a=!1,setValue:o,resolveValue:s}=e,c=(0,F.useRef)(void 0),l=(0,F.useRef)(s),u=(0,F.useRef)(n);l.current=s,(0,F.useEffect)(()=>{let e=c.current!==i;if(!t){o(n),u.current=n,c.current=i;return}o(t=>{let r=l.current({currentValue:!e&&Object.is(t,u.current)?n:t,sessionChanged:e,preserveCurrentValueOnSessionChange:e&&!!i&&!a});return u.current=r,r}),c.current=i},[n,t,a,i,o,r])}function aB(e){let{modelOptions:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredModel:i,fallbackPreferredModel:a,defaultModel:o,setSelectedModel:s}=e;iB({isPreferenceAvailable:t.length>0,emptyValue:``,syncKey:rB([t.map(e=>e.value).join(``),i,a,o]),selectedSessionKey:n,selectedSessionExists:r,setValue:s,resolveValue:({currentValue:e,sessionChanged:n,preserveCurrentValueOnSessionChange:r})=>eB({currentSelectedModel:e,modelOptions:t,selectedSessionPreferredModel:i,fallbackPreferredModel:a,defaultModel:o,preferSessionPreferredModel:n,preserveCurrentSelectedModelOnSessionChange:r})})}function oB(e){let{supportedThinkingLevels:t,selectedSessionKey:n,selectedSessionExists:r=!1,selectedSessionPreferredThinking:i,fallbackPreferredThinking:a,defaultThinkingLevel:o,setSelectedThinkingLevel:s}=e;iB({isPreferenceAvailable:t.length>0,emptyValue:null,syncKey:rB([t.join(``),i,a,o]),selectedSessionKey:n,selectedSessionExists:r,setValue:s,resolveValue:({currentValue:e,sessionChanged:n,preserveCurrentValueOnSessionChange:r})=>tB({currentSelectedThinkingLevel:e,supportedThinkingLevels:t,selectedSessionPreferredThinking:i,fallbackPreferredThinking:a,defaultThinkingLevel:o,preferSessionPreferredThinking:n,preserveCurrentSelectedThinkingOnSessionChange:r})})}function sB(){let{pathname:e}=$e(),t=nt();return Vr(e)?(0,I.jsx)(oz,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,I.jsx)(Oz,{variant:`mobile`})}var cB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{DocBrowser:e}=await import(`./doc-browser-BlrpUKVJ.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))).DocBrowser}));function lB({pathname:e,isMobileLayout:t=!1,isDocBrowserOpen:n,docBrowserMode:i,docBrowserDockControls:a,docBrowserRenderers:o={},sideDock:s,children:c}){let l=Br(e),u=t&&!Vr(e),d=fs();return(0,I.jsxs)(`div`,{className:r(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,d?`rounded-[10px]`:null),style:d?{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":l?`280px`:`240px`}:void 0,children:[d?(0,I.jsx)(cs,{}):null,(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[!l&&(0,I.jsx)(os,{mode:`settings`}),(0,I.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,I.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:l?(0,I.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:c}):(0,I.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,I.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:c})})}),n&&i===`docked`?(0,I.jsx)(F.Suspense,{fallback:null,children:(0,I.jsx)(cB,{customTabRenderers:o,dockControls:a})}):null,s]})]}),u?(0,I.jsx)(hs,{}):null,n&&i===`floating`?(0,I.jsx)(F.Suspense,{fallback:null,children:(0,I.jsx)(cB,{customTabRenderers:o,dockControls:a})}):null]})}var uB=`NextClaw`,dB=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function fB(e,t){return e===t||e.startsWith(`${t}/`)}function pB(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of dB)if(fB(t,e))return s(n);return s(`settings`)}function mB(e){return`${uB} - ${pB(e)}`}function hB({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=On();Dr();let{pathname:i}=$e(),{language:a}=Ar(),{isMobile:o}=Fr(),s=ds();dt(e=>e.pinnedItems);let c={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,F.useEffect)(()=>{document.title=mB(i)},[i,a]),o&&s!==`win32`?(0,I.jsx)(vs,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:c,docBrowserRenderers:St,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,I.jsx)(lB,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:c,docBrowserRenderers:St,sideDock:(0,I.jsx)(_t,{manager:t}),children:e})}function gB({children:e}){let t=wt();return(0,I.jsx)(An,{manager:t.docBrowserManager,children:(0,I.jsx)(hB,{sideDockManager:t.sideDockManager,children:e})})}function _B(){let{isMobile:e}=Fr();return e?(0,I.jsx)(ys,{}):(0,I.jsx)(et,{to:`/model`,replace:!0})}function vB(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function yB(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function bB(e,t){e&&vB(t)&&e.invalidateQueries({queryKey:[`config`]}),yB(e,t)}function xB(e){let t=(0,F.useRef)(!1);(0,F.useEffect)(()=>{let n=we.eventBus.on(de.connectionOpen,()=>{Ke.handleConnectionRestored(),Ne.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=we.eventBus.on(de.connectionClose,()=>{Ke.handleConnectionInterrupted(null),t.current=!0}),i=we.eventBus.on(de.connectionError,e=>{Ke.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=we.eventBus.on(de.configUpdated,({path:t})=>{bB(e,t)}),o=we.eventBus.on(de.runtimeUpdateSnapshot,e=>{Ne.reportSnapshot(e)}),s=we.eventBus.on(de.sessionRunStatus,t=>{Te(e,{type:`session.run-status`,payload:t})}),c=we.eventBus.on(de.sessionSummaryUpsert,t=>{Te(e,{type:`session.summary.upsert`,payload:t})}),l=we.eventBus.on(de.sessionSummaryDelete,t=>{Te(e,{type:`session.summary.delete`,payload:t})}),u=we.eventBus.on(de.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u()}},[e])}var SB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{ModelConfig:e}=await import(`./model-config-Dbo3zWDl.js`);return{ModelConfig:e}},__vite__mapDeps([11,2,12,13,3,14,15,10,16]))).ModelConfig})),CB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{ChatPage:e}=await import(`./chat-page-DInyWLb4.js`);return{ChatPage:e}},__vite__mapDeps([17,2,18,19,12,20,9,3,21,4,13,5,22,7,23,24,10,25,26,27,28,29,14,15,30,31,32]))).ChatPage})),wB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{SearchConfig:e}=await import(`./search-config-DAibVFGR.js`);return{SearchConfig:e}},__vite__mapDeps([33,2,12,6,3,22,8,34,4]))).SearchConfig})),TB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{ProvidersList:e}=await import(`./providers-list-DOj_7GL8.js`);return{ProvidersList:e}},__vite__mapDeps([35,2,20,19,12,9,3,21,30,22,7,8,24,34,4,26,16,15]))).ProvidersList})),EB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-BnGxv6ma.js`);return{ChannelsList:e}},__vite__mapDeps([36,2,12,3,13,6,22,8,9,34,4,26,32,27,29,16]))).ChannelsList})),DB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-Dg8aEgWx.js`);return{RuntimeConfig:e}},__vite__mapDeps([37,2,12,13,3,31,7,38,39,24,25]))).RuntimeConfig})),OB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-abmYzHSy.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([40,2,12,6,3,23,38]))).DesktopUpdateConfig})),kB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{SecurityConfig:e}=await import(`./api-BAyyGaoz.js`).then(e=>e.ut);return{SecurityConfig:e}},__vite__mapDeps([12,2]))).SecurityConfig})),AB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{SecretsConfig:e}=await import(`./secrets-config-CoJzy13_.js`);return{SecretsConfig:e}},__vite__mapDeps([41,2,12,7,3,39,24]))).SecretsConfig})),jB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{RemoteAccessPage:e}=await import(`./remote-fCE5fLsj.js`);return{RemoteAccessPage:e}},__vite__mapDeps([42,18,2,19,12,20,9,3,21,4,13,5,22,7,23,24,10,25,26,27]))).RemoteAccessPage})),MB=(0,F.lazy)(async()=>({default:(await tt(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-DH11bSVx.js`);return{McpMarketplacePage:e}},__vite__mapDeps([43,28,2,20,19,12,9,3,10,25,29]))).McpMarketplacePage}));function NB(){return(0,I.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function PB({children:e}){return(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(NB,{}),children:e})}function FB(e){return(0,I.jsx)(PB,{children:e})}var IB=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:FB((0,I.jsx)(CB,{view:`chat`}))},{path:`/agents`,element:FB((0,I.jsx)(CB,{view:`agents`}))},{path:`/skills`,element:FB((0,I.jsx)(CB,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:FB((0,I.jsx)(CB,{view:`skills`}))},{path:`/cron`,element:FB((0,I.jsx)(CB,{view:`cron`}))},{path:`/model`,element:FB((0,I.jsx)(SB,{}))},{path:`/search`,element:FB((0,I.jsx)(wB,{}))},{path:`/providers`,element:FB((0,I.jsx)(TB,{}))},{path:`/channels`,element:FB((0,I.jsx)(EB,{}))},{path:`/runtime`,element:FB((0,I.jsx)(DB,{}))},{path:`/updates`,element:FB((0,I.jsx)(OB,{}))},{path:`/remote`,element:FB((0,I.jsx)(jB,{}))},{path:`/security`,element:FB((0,I.jsx)(kB,{}))},{path:`/secrets`,element:FB((0,I.jsx)(AB,{}))},{path:`/language`,element:(0,I.jsx)(as,{})},{path:`/settings`,element:(0,I.jsx)(_B,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:FB((0,I.jsx)(MB,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function LB(e){return`redirectTo`in e?(0,I.jsx)(st,{path:e.path,element:(0,I.jsx)(et,{to:e.redirectTo,replace:!0})},e.path):(0,I.jsx)(st,{path:e.path,element:e.element},e.path)}function RB(){return(0,I.jsx)(lt,{children:IB.map(LB)})}function zB(){return xB(te),Se(),(0,F.useEffect)(()=>(Ne.start(),()=>{Ne.stop()}),[]),(0,I.jsxs)(Et,{children:[(0,I.jsx)(gB,{children:(0,I.jsx)(RB,{})}),(0,I.jsx)(kt,{}),(0,I.jsx)(ft,{})]})}function BB(){let e=ke(),t=e.isError&&Ee(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,I.jsx)(zB,{}):e.data?.enabled&&!e.data.authenticated?(0,I.jsx)(Ot,{username:e.data.username}):(0,I.jsx)(zB,{})}function VB(){return(0,F.useEffect)(()=>{Qo()},[]),(0,I.jsxs)(ye,{client:te,children:[(0,I.jsx)(BB,{}),(0,I.jsx)(Yo,{}),(0,I.jsx)(Xo,{}),(0,I.jsx)(ue,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var HB=window.nextclawDesktop?.platform===`win32`?Ze:ot;(0,Er.createRoot)(document.getElementById(`root`)).render((0,I.jsx)(F.StrictMode,{children:(0,I.jsx)(ns,{children:(0,I.jsx)(kr,{children:(0,I.jsx)(HB,{children:(0,I.jsx)(VB,{})})})})}));export{ui as $,SI as A,ur as At,Ks as B,aL as C,Fr as Ct,$I as D,vr as Dt,rL as E,xr as Et,tP as F,Un as Ft,Jo as G,Ws as H,Z as I,Rn as It,Eo as J,yo as K,lN as L,Ln as Lt,AP as M,sr as Mt,oP as N,ar as Nt,QI as O,gr as Ot,cP as P,Wn as Pt,si as Q,oc as R,Fn as Rt,IL as S,Ir as St,oL as T,Sr as Tt,Is as U,$s as V,Cs as W,bo as X,xo as Y,ai as Z,_R as _,pi as _t,Jz as a,yi as at,NL as b,Si as bt,Oz as c,vi as ct,BR as d,ki as dt,mi as et,zR as f,_i as ft,pR as g,di as gt,FR as h,bi as ht,oB as i,Ci as it,TP as j,cr as jt,CI as k,fr as kt,oz as l,li as lt,IR as m,Oi as mt,nB as n,Di as nt,zz as o,Ti as ot,VR as p,gi as pt,wo as q,aB as r,hi as rt,kz as s,wi as st,sB as t,Ei as tt,XR as u,ci as ut,FL as v,xi as vt,sL as w,Ar as wt,PL as x,Lr as xt,ML as y,fi as yt,sc as z,Mn as zt};