chatlab-cli 0.37.0 → 0.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/{chat-command-WBAJBKIE.mjs → chat-command-G2EX7VHR.mjs} +24 -12
  2. package/dist/chat-command-G2EX7VHR.mjs.map +1 -0
  3. package/dist/{chunk-N2WGG3MS.mjs → chunk-E6LCCPIB.mjs} +6 -3
  4. package/dist/chunk-E6LCCPIB.mjs.map +1 -0
  5. package/dist/{chunk-EJBBVLUN.mjs → chunk-EFX66A2O.mjs} +2 -2
  6. package/dist/{chunk-DKIYHA3O.mjs → chunk-EK5QIJLZ.mjs} +20 -23
  7. package/dist/chunk-EK5QIJLZ.mjs.map +1 -0
  8. package/dist/{chunk-5YOHLJFB.mjs → chunk-F4HVCFZL.mjs} +48 -7
  9. package/dist/chunk-F4HVCFZL.mjs.map +1 -0
  10. package/dist/{chunk-SQWN4GTQ.mjs → chunk-FCUUAGGC.mjs} +2 -2
  11. package/dist/{chunk-DQR2YS3I.mjs → chunk-H46CLFWK.mjs} +8 -6
  12. package/dist/{chunk-DQR2YS3I.mjs.map → chunk-H46CLFWK.mjs.map} +1 -1
  13. package/dist/{chunk-4J4MA3RC.mjs → chunk-HBAQPF6X.mjs} +2180 -1941
  14. package/dist/chunk-HBAQPF6X.mjs.map +1 -0
  15. package/dist/{chunk-RXMSZIYD.mjs → chunk-HMVM7VCA.mjs} +3 -3
  16. package/dist/{chunk-FM3GXNEO.mjs → chunk-L6RJIVLS.mjs} +2 -2
  17. package/dist/{chunk-MSMDLDPB.mjs → chunk-T5H56AZV.mjs} +16 -8
  18. package/dist/chunk-T5H56AZV.mjs.map +1 -0
  19. package/dist/{chunk-2TV7M4CC.mjs → chunk-XQ6Z2KNN.mjs} +2 -2
  20. package/dist/{chunk-CR2MU7LN.mjs → chunk-YI3EQYEG.mjs} +12 -12
  21. package/dist/cli.mjs +9 -9
  22. package/dist/contacts-worker.mjs +2 -2
  23. package/dist/global-insight-worker.mjs +1 -1
  24. package/dist/{http-X6OEOOSH.mjs → http-5BRVWAJR.mjs} +12 -12
  25. package/dist/{import-WBJ6YIQ7.mjs → import-IAECQDKC.mjs} +7 -7
  26. package/dist/index.mjs +12 -12
  27. package/dist/{mcp-FR6OKWKL.mjs → mcp-XXSQJBGU.mjs} +8 -8
  28. package/dist/people-relationships-worker.mjs +2 -2
  29. package/dist/semantic-index-worker.mjs +1 -1
  30. package/dist/{src-WE5HNN2O.mjs → src-4HLKMQ7S.mjs} +6 -6
  31. package/dist/{stream-import-YYQVZDGQ.mjs → stream-import-PUG42I36.mjs} +7 -7
  32. package/dist/{worker-runtime-YGB5ZDE4.mjs → worker-runtime-X5563TVT.mjs} +5 -5
  33. package/dist-cli-web/assets/{AISettingsTab-Co2sM1iY.js → AISettingsTab-m_r2fFEj.js} +1 -1
  34. package/dist-cli-web/assets/{AboutTab-DQ8r6mYE.js → AboutTab-J65UqIuk.js} +1 -1
  35. package/dist-cli-web/assets/{Alert-DU1tLAAg.js → Alert-qBIGn_CW.js} +1 -1
  36. package/dist-cli-web/assets/{ApiSettingsTab-D5g5b79L.js → ApiSettingsTab-CxWRJI9j.js} +1 -1
  37. package/dist-cli-web/assets/{BatchManageTab-BFUyVaGU.js → BatchManageTab-BINNVwm1.js} +1 -1
  38. package/dist-cli-web/assets/{BufferResource-C-RfYwQW.js → BufferResource-C-jLPrHv.js} +1 -1
  39. package/dist-cli-web/assets/{CanvasRenderer-Dz7JAMrR.js → CanvasRenderer-kDLW8GSt.js} +1 -1
  40. package/dist-cli-web/assets/{CardDecoration-D28DI1G9.js → CardDecoration-CnYxleQM.js} +1 -1
  41. package/dist-cli-web/assets/{ChatRecordDrawer-Cph819yY.js → ChatRecordDrawer-CMg3FEWH.js} +1 -1
  42. package/dist-cli-web/assets/{ChatRecordWorkspace-BAfERdPc.js → ChatRecordWorkspace-AfFIMUbZ.js} +1 -1
  43. package/dist-cli-web/assets/{Checkbox-B8uqt13j.js → Checkbox-D-hAv15R.js} +1 -1
  44. package/dist-cli-web/assets/{DataDirCleanupNotice-3sGBE5vU.js → DataDirCleanupNotice-P80h2p4l.js} +1 -1
  45. package/dist-cli-web/assets/{DatePicker.vue_vue_type_script_setup_true_lang-CQuub8-f.js → DatePicker.vue_vue_type_script_setup_true_lang-CSp691Uv.js} +1 -1
  46. package/dist-cli-web/assets/{DebugToolsPanel-Cwkr0BOY.js → DebugToolsPanel-BK2VbKB0.js} +1 -1
  47. package/dist-cli-web/assets/{EChart.vue_vue_type_script_setup_true_lang-BuLujQCF.js → EChart.vue_vue_type_script_setup_true_lang-BcE0mE_N.js} +1 -1
  48. package/dist-cli-web/assets/{EChartBar.vue_vue_type_script_setup_true_lang-DuA5xbcC.js → EChartBar.vue_vue_type_script_setup_true_lang-BypaV5wc.js} +1 -1
  49. package/dist-cli-web/assets/{EChartLine.vue_vue_type_script_setup_true_lang-CvmMEfYq.js → EChartLine.vue_vue_type_script_setup_true_lang-D8SyOfWC.js} +1 -1
  50. package/dist-cli-web/assets/{EChartWordcloud-CHVtyPR7.js → EChartWordcloud-0rihhg03.js} +1 -1
  51. package/dist-cli-web/assets/{FileDropZone.vue_vue_type_script_setup_true_lang-BKPy9Qv-.js → FileDropZone.vue_vue_type_script_setup_true_lang-Dyuzh7Ex.js} +1 -1
  52. package/dist-cli-web/assets/{Filter-CMfRHIoK.js → Filter-rD_jWpbO.js} +1 -1
  53. package/dist-cli-web/assets/{GlobalTaskBar-Jz6MASCu.js → GlobalTaskBar-sXQuGvF-.js} +1 -1
  54. package/dist-cli-web/assets/{GroupRelationshipGalaxyView-Ch4obfEq.js → GroupRelationshipGalaxyView-BN1L9DFf.js} +1 -1
  55. package/dist-cli-web/assets/{Label-CuryuymO.js → Label-Ce4wl_Ph.js} +1 -1
  56. package/dist-cli-web/assets/{LoadingState.vue_vue_type_script_setup_true_lang-CoeQsaiL.js → LoadingState.vue_vue_type_script_setup_true_lang-DmVfwvnD.js} +1 -1
  57. package/dist-cli-web/assets/{MessageExportModal-JqGZ-iLr.js → MessageExportModal-C2IUNPhg.js} +1 -1
  58. package/dist-cli-web/assets/{PageHeader-D4up77TB.js → PageHeader-D5BcYKBs.js} +1 -1
  59. package/dist-cli-web/assets/{PageTabs.vue_vue_type_script_setup_true_lang-DYQRFk9s.js → PageTabs.vue_vue_type_script_setup_true_lang-DHly2-fe.js} +1 -1
  60. package/dist-cli-web/assets/{RelationshipGalaxyCanvas-Cn7Eta5U.js → RelationshipGalaxyCanvas-CHPqtqQz.js} +3 -3
  61. package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-LlaX57z6.js → RelationshipGalaxyThreeCanvas-qR4S-9n7.js} +1 -1
  62. package/dist-cli-web/assets/{RenderTargetSystem-JhA2PUFi.js → RenderTargetSystem-BaIFulUj.js} +1 -1
  63. package/dist-cli-web/assets/{RovingFocusItem-DHaiTb4j.js → RovingFocusItem-Bqgmzo42.js} +1 -1
  64. package/dist-cli-web/assets/{ScreenCaptureModal-Bxhyt5g1.js → ScreenCaptureModal-sJqB_hrK.js} +1 -1
  65. package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-BPt98e6z.js +1 -0
  66. package/dist-cli-web/assets/{Select-Beeqv0wU.js → Select-BAnN4HMs.js} +1 -1
  67. package/dist-cli-web/assets/SettingsModal-C4ANMlJJ.js +2 -0
  68. package/dist-cli-web/assets/{StorageTab-B7GHadia.js → StorageTab-BgNQliz4.js} +1 -1
  69. package/dist-cli-web/assets/{Switch-u4zlvUMa.js → Switch-DddEvDJa.js} +1 -1
  70. package/dist-cli-web/assets/{Tabs-B7-Koq3x.js → Tabs-DwjL-ueH.js} +1 -1
  71. package/dist-cli-web/assets/{Tabs-RWKHwtfM.js → Tabs-xVtuBuO0.js} +1 -1
  72. package/dist-cli-web/assets/{ThemeCard.vue_vue_type_script_setup_true_lang-ndsa3-aT.js → ThemeCard.vue_vue_type_script_setup_true_lang-CNCVa86b.js} +1 -1
  73. package/dist-cli-web/assets/{TimeSelect.vue_vue_type_script_setup_true_lang-DKa1flT-.js → TimeSelect.vue_vue_type_script_setup_true_lang-BehUIWki.js} +1 -1
  74. package/dist-cli-web/assets/{VisuallyHiddenInput-DGDqcvUy.js → VisuallyHiddenInput-ST6JNfSG.js} +1 -1
  75. package/dist-cli-web/assets/{WebGLRenderer-ifvgA1fe.js → WebGLRenderer-DRraqD4Y.js} +1 -1
  76. package/dist-cli-web/assets/{WebGPURenderer-DwzmuWF0.js → WebGPURenderer-CnzaYARg.js} +1 -1
  77. package/dist-cli-web/assets/aiChat-CeJy-gG-.js +8 -0
  78. package/dist-cli-web/assets/{base-BWDX-164.js → base-BHbtUviQ.js} +1 -1
  79. package/dist-cli-web/assets/{browserAll-CSIIETeE.js → browserAll-DYxkitnx.js} +1 -1
  80. package/dist-cli-web/assets/{chatMessages--r0obAVw.css → chatMessages-BGRbSlvD.css} +1 -1
  81. package/dist-cli-web/assets/{chatMessages-Zywjea1n.js → chatMessages-Dj1u-tFB.js} +20 -20
  82. package/dist-cli-web/assets/{cli-web-BRY49NWe.js → cli-web-BtH8nfjA.js} +1 -1
  83. package/dist-cli-web/assets/{fetch-DNSDHSqQ.js → fetch-BJ82mWvv.js} +1 -1
  84. package/dist-cli-web/assets/{fetch-D3nLtFBi.js → fetch-C1Tm66i9.js} +1 -1
  85. package/dist-cli-web/assets/{fetch-jx1VdM9j.js → fetch-CAEyoWQA.js} +1 -1
  86. package/dist-cli-web/assets/{fetch-qBaUXqFt.js → fetch-CGnWNSsG.js} +1 -1
  87. package/dist-cli-web/assets/{fetch-mYSeL4Ki.js → fetch-D7hfFyoG.js} +1 -1
  88. package/dist-cli-web/assets/{fetch-BiXab0IF.js → fetch-DNmRaRxX.js} +1 -1
  89. package/dist-cli-web/assets/{fetch-wzv71PYy.js → fetch-DogRrvT6.js} +1 -1
  90. package/dist-cli-web/assets/fetch-JEEBqR_7.js +1 -0
  91. package/dist-cli-web/assets/{fetch-r6mhEGrP.js → fetch-T5Gi1TUZ.js} +1 -1
  92. package/dist-cli-web/assets/{fetch-DeHqF6yL.js → fetch-U9QyidNZ.js} +1 -1
  93. package/dist-cli-web/assets/{fetch-Co2vLmiE.js → fetch-ejEMWPM2.js} +1 -1
  94. package/dist-cli-web/assets/{fetch-Bf4cqeM3.js → fetch-emZXHmoE.js} +1 -1
  95. package/dist-cli-web/assets/{host-1emQf9_4.js → host-BUvwCvZR.js} +1 -1
  96. package/dist-cli-web/assets/{host-jXJHyyOX.js → host-VTWF81F5.js} +1 -1
  97. package/dist-cli-web/assets/{index-CYc_VLgK.js → index-B3MCGDwx.js} +1 -1
  98. package/dist-cli-web/assets/index-BI2Rb_L3.js +2 -0
  99. package/dist-cli-web/assets/{index-BOcFyPCa.js → index-BLYSew5C.js} +1 -1
  100. package/dist-cli-web/assets/index-Bs7gk1gf.css +1 -0
  101. package/dist-cli-web/assets/{index-BgelKQTW.css → index-C75W1B5J.css} +1 -1
  102. package/dist-cli-web/assets/{index-DOqbUvhA.js → index-CVRBBnQw.js} +1 -1
  103. package/dist-cli-web/assets/index-Cza8BzZE.js +137 -0
  104. package/dist-cli-web/assets/{index-DnpnIyle.js → index-D9C3dyV8.js} +33 -33
  105. package/dist-cli-web/assets/{index-LV9LfFNu.js → index-DDt7Tfda.js} +1 -1
  106. package/dist-cli-web/assets/{index-B4mJkX_d.js → index-DQFcmWSa.js} +1 -1
  107. package/dist-cli-web/assets/{index-slDUxib2.js → index-DUBl6aBF.js} +1 -1
  108. package/dist-cli-web/assets/{index-B7biznha.js → index-DZK9Njvy.js} +1 -1
  109. package/dist-cli-web/assets/{index-Cw0IhKZ6.js → index-HjrJ3DXO.js} +1 -1
  110. package/dist-cli-web/assets/index-KpnLSzzX.js +64 -0
  111. package/dist-cli-web/assets/{index-BQ463TS7.js → index-e6fOnhNS.js} +1 -1
  112. package/dist-cli-web/assets/{index-ClHMs0-a.js → index-iEQnKg2R.js} +2 -2
  113. package/dist-cli-web/assets/{people-page-header-Cx5r9Bk2.js → people-page-header-DWXwFJ8M.js} +1 -1
  114. package/dist-cli-web/assets/{prompt-BggEDxxi.js → prompt-Cepfb-5-.js} +1 -1
  115. package/dist-cli-web/assets/{semantic-index-config-builder-1sO0aEc1.js → semantic-index-config-builder-hTY6QyCe.js} +1 -1
  116. package/dist-cli-web/assets/service-BjE0YJaM.js +1 -0
  117. package/dist-cli-web/assets/service-DQxttlJp.js +1 -0
  118. package/dist-cli-web/assets/{service-Bvq1fRkC.js → service-DwCmXFtI.js} +1 -1
  119. package/dist-cli-web/assets/useFormControl-CJyJY8AK.js +1 -0
  120. package/dist-cli-web/assets/useInsightTabAnalytics-CplGbsbe.js +75 -0
  121. package/dist-cli-web/assets/{ActionToolsPanel-CmYpw8Mt.css → useInsightTabAnalytics-DDNXXH8v.css} +1 -1
  122. package/dist-cli-web/assets/{useTable-DC7oxmBl.js → useTable-Dmpbk7fZ.js} +1 -1
  123. package/dist-cli-web/assets/{useToast-CCPBE-Sy.js → useToast-Bmgpd3sl.js} +1 -1
  124. package/dist-cli-web/assets/{webworkerAll-FCJk6reG.js → webworkerAll-DkPWEyVL.js} +1 -1
  125. package/dist-cli-web/index.html +1 -1
  126. package/package.json +3 -3
  127. package/dist/chat-command-WBAJBKIE.mjs.map +0 -1
  128. package/dist/chunk-4J4MA3RC.mjs.map +0 -1
  129. package/dist/chunk-5YOHLJFB.mjs.map +0 -1
  130. package/dist/chunk-DKIYHA3O.mjs.map +0 -1
  131. package/dist/chunk-MSMDLDPB.mjs.map +0 -1
  132. package/dist/chunk-N2WGG3MS.mjs.map +0 -1
  133. package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang--RPlmfIu.js +0 -75
  134. package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-BlAje3Tf.js +0 -1
  135. package/dist-cli-web/assets/SettingsModal-DV8yDBJs.js +0 -2
  136. package/dist-cli-web/assets/aiChat-BY4C3UQe.js +0 -8
  137. package/dist-cli-web/assets/fetch-C8CcoTWY.js +0 -1
  138. package/dist-cli-web/assets/index-2dJCozDq.js +0 -64
  139. package/dist-cli-web/assets/index-6ejRbH3h.js +0 -2
  140. package/dist-cli-web/assets/index-CIIyg_o9.css +0 -1
  141. package/dist-cli-web/assets/index-kePiJ3ca.js +0 -137
  142. package/dist-cli-web/assets/service-DkPheDt8.js +0 -1
  143. package/dist-cli-web/assets/service-DvI8O_7K.js +0 -1
  144. package/dist-cli-web/assets/useFormControl-B0aShtLp.js +0 -1
  145. /package/dist/{chunk-EJBBVLUN.mjs.map → chunk-EFX66A2O.mjs.map} +0 -0
  146. /package/dist/{chunk-SQWN4GTQ.mjs.map → chunk-FCUUAGGC.mjs.map} +0 -0
  147. /package/dist/{chunk-RXMSZIYD.mjs.map → chunk-HMVM7VCA.mjs.map} +0 -0
  148. /package/dist/{chunk-FM3GXNEO.mjs.map → chunk-L6RJIVLS.mjs.map} +0 -0
  149. /package/dist/{chunk-2TV7M4CC.mjs.map → chunk-XQ6Z2KNN.mjs.map} +0 -0
  150. /package/dist/{chunk-CR2MU7LN.mjs.map → chunk-YI3EQYEG.mjs.map} +0 -0
  151. /package/dist/{http-X6OEOOSH.mjs.map → http-5BRVWAJR.mjs.map} +0 -0
  152. /package/dist/{import-WBJ6YIQ7.mjs.map → import-IAECQDKC.mjs.map} +0 -0
  153. /package/dist/{mcp-FR6OKWKL.mjs.map → mcp-XXSQJBGU.mjs.map} +0 -0
  154. /package/dist/{src-WE5HNN2O.mjs.map → src-4HLKMQ7S.mjs.map} +0 -0
  155. /package/dist/{stream-import-YYQVZDGQ.mjs.map → stream-import-PUG42I36.mjs.map} +0 -0
  156. /package/dist/{worker-runtime-YGB5ZDE4.mjs.map → worker-runtime-X5563TVT.mjs.map} +0 -0
@@ -1,13 +1,13 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/service-Bvq1fRkC.js","assets/index-DnpnIyle.js","assets/vendor-snapdom--nZvo8Sg.js","assets/index-BZpR015e.css"])))=>i.map(i=>d[i]);
2
- import{e as S,g as k,bD as Qs,x as wt,al as _t,d as be,cI as ze,c0 as ti,C as Oe,b as J,cB as ni,cJ as ri,cK as Js,G as si,cL as ai,cM as ii,cN as ls,cO as oi,cP as li,cQ as ci,cR as ui,cS as di,cT as pi,cU as hi,cV as Be,ce as Lt,K as Te,cW as fi,cX as gi,cg as cs,aI as Je,bt as mi,o as m,f as se,a6 as qe,J as Xn,aA as er,c as x,n as Y,a as h,z as F,a7 as Ne,p as w,a8 as tr,w as de,a9 as He,F as me,j as _e,aK as Zs,aL as Xs,aR as mt,aQ as yn,bO as ea,cY as yi,l as U,aF as It,a0 as vi,aa as ta,a3 as ki,O as xi,r as Rt,ah as nr,bh as na,cZ as Nt,c_ as xt,c$ as Pt,d0 as fe,d1 as Ee,d2 as ra,d3 as bi,d4 as sa,d5 as vt,d6 as Or,d7 as wi,d8 as _i,d9 as Ti,da as Ci,db as Ue,dc as Si,dd as us,de as aa,df as Mi,dg as en,dh as rr,di as tn,dj as Ai,dk as Ke,dl as Li,dm as $t,dn as $i,dp as tt,dq as Ei,dr as Ii,ds as Ht,dt as wr,du as Ri,dv as Pi,dw as Hi,dx as Ni,dy as zi,dz as ia,dA as Oi,dB as ds,dC as _r,dD as Bi,dE as Di,dF as oa,dG as ji,as as la,aX as Fi,aT as qi,bG as Ui,P as ca,aw as xn,av as ua,H as Ki,aN as Wi,aH as Vi,aE as Gi,ap as Yi,L as lr,bS as Qi,ar as Ji,aP as Zi,aV as Xi,cb as eo,m as ps,au as to,bC as no,cf as ro}from"./index-DnpnIyle.js";import{M as da,_ as so}from"./index-Cw0IhKZ6.js";import{u as Br}from"./useToast-CCPBE-Sy.js";import{_ as hs}from"./EChartBar.vue_vue_type_script_setup_true_lang-DuA5xbcC.js";import{_ as pa}from"./EChart.vue_vue_type_script_setup_true_lang-BuLujQCF.js";import{_ as fs}from"./EChartLine.vue_vue_type_script_setup_true_lang-CvmMEfYq.js";import{s as ao,a as ha}from"./aiChat-BY4C3UQe.js";import{u as fa}from"./prompt-BggEDxxi.js";import{useCacheService as io}from"./service-Bvq1fRkC.js";function oo(e){const t=S(()=>k(e)),n=S(()=>new Intl.Collator("en",{usage:"search",...t.value}));return{startsWith:(a,o)=>o.length===0?!0:(a=a.normalize("NFC"),o=o.normalize("NFC"),n.value.compare(a.slice(0,o.length),o)===0),endsWith:(a,o)=>o.length===0?!0:(a=a.normalize("NFC"),o=o.normalize("NFC"),n.value.compare(a.slice(-o.length),o)===0),contains:(a,o)=>{if(o.length===0)return!0;a=a.normalize("NFC"),o=o.normalize("NFC");let l=0;const c=o.length;for(;l+c<=a.length;l++){const u=a.slice(l,l+c);if(n.value.compare(o,u)===0)return!0}return!1}}}const lo={none:[],qwen:["default","off","high"],deepseek_v4:["default","off","high","xhigh"],deepseek_hybrid:["default","off","auto"],o_series:["default","low","medium","high"],gpt5:["default","minimal","low","medium","high"],gpt5_1:["default","off","low","medium","high"],gpt5_2plus:["default","off","minimal","low","medium","high","xhigh"],grok:["default","low","high"],kimi:["default","off","auto","low","medium","high"],doubao:["default","off","auto","high"],hunyuan:["default","off","high"],gemini:["default","off","low","medium","high"],default:["default","off","low","medium","high"]},gs=/^(?!.*-non-reasoning\b)(o\d+(?:-[\w-]+)?|.*\b(?:reasoning|reasoner|thinking|think)\b.*|.*-[rR]\d+.*|.*\bqwq(?:-[\w-]+)?\b.*|.*\bhunyuan-t1(?:-[\w-]+)?\b.*|.*\bgrok-(?:3-mini|4|4-fast|build)(?:-[\w-]+)?\b.*)$/i;function co(e,t){const n=t.toLowerCase(),s=e.toLowerCase();if(n.includes("-non-reasoning")||s==="anthropic")return"none";if(s==="gemini")return/gemini-(?:2\.5|3(?:\.\d+)?-(?:flash|pro)|flash-latest|pro-latest)/i.test(n)?"gemini":"none";if(s==="qwen"||/\bqwen|qwq/i.test(n))return"qwen";if(/deepseek[_-]v([4-9]|\d{2,})/i.test(n)||/deepseek-ai\/deepseek-r1/i.test(n))return"deepseek_v4";if(/deepseek[_-]chat|deepseek[_-]v3/i.test(n))return"deepseek_hybrid";if(s==="openai"||s==="openai-compatible"){if(/gpt-5\.[2-9]|gpt-5\.[1-9]\d/.test(n))return"gpt5_2plus";if(/gpt-5\.1/.test(n))return"gpt5_1";if(/gpt-5/.test(n))return"gpt5";if(/^o\d/.test(n))return"o_series"}return/^o\d/.test(n)?"o_series":/\bgrok-(?:3-mini|4|4-fast|build)\b/i.test(n)?"grok":/\bkimi-k(?:2-thinking|2\.[5-9]|[3-9])/i.test(n)||s==="kimi"&&/thinking/i.test(n)?"kimi":/\bdoubao-.*seed/i.test(n)||s==="doubao"&&/seed/i.test(n)?"doubao":/\bhunyuan-(?:t1|a13b)/i.test(n)?"hunyuan":s==="glm"||/\bglm-?(?:5|4\.[5-7]|z1|zero)/i.test(n)?"qwen":s==="siliconflow"&&/r[1-9]/i.test(n)?"deepseek_v4":s==="openrouter"?/deepseek.*(v[4-9]|r\d)/i.test(n)?"deepseek_v4":/deepseek[_-]?(chat|v3)/i.test(n)?"deepseek_hybrid":/\bgrok-(?:3-mini|4|4-fast|build)\b/i.test(n)?"grok":/\bkimi-k(?:2-thinking|2\.[5-9]|[3-9])/i.test(n)?"kimi":gs.test(n)?"default":"none":/\bmimo-v2/i.test(n)||/\bminimax-m[123]/i.test(n)||/\bseed-oss/i.test(n)?"deepseek_hybrid":/\bbaichuan-m[23]/i.test(n)||/\bmagistral/i.test(n)||/\bmistral-small-2603/i.test(n)||/\bstep-(?:3|r1-v-mini)/i.test(n)||/\bgemma-?4/i.test(n)||/\bpangu-pro-moe/i.test(n)||/\bsonar-deep-research/i.test(n)||/\bring-(?:1t|mini|flash)/i.test(n)?"default":/\bqwen|qwq/i.test(n)?"qwen":/deepseek[_-]?r\d|deepseek[_-]?v[4-9]/i.test(n)?"deepseek_v4":/^o\d/i.test(n)?"o_series":gs.test(n)?"default":"none"}function uo(e,t){const n=co(e,t);return lo[n]}function po(){const{contains:e,startsWith:t}=oo({sensitivity:"base"});function n(a,o){return e(a,o)?e(o,a)?0:t(a,o)?1:2:null}function s(a,o,l){if(typeof a!="object"||a===null)return n(String(a),o);let c=null;for(const u of l){const d=Qs(a,u);if(d==null)continue;const p=Array.isArray(d)?d.map(String):[String(d)];for(const f of p){const y=n(f,o);if(y!==null&&(c===null||y<c)&&(c=y),c===0)return 0}}return c}function r(a,o,l){if(!o)return a;const c=[];for(const u of a){const d=s(u,o,l);d!==null&&c.push({item:u,score:d})}return c.sort((u,d)=>u.score-d.score),c.map(({item:u})=>u)}function i(a,o,l){return o?a.map(c=>{const u=[];for(const d of c){if(d==null)continue;if(l.isStructural?.(d)){u.push({item:d,score:-1});continue}const p=s(d,o,l.fields);p!==null&&u.push({item:d,score:p})}return u.sort((d,p)=>d.score-p.score),u.map(({item:d})=>d)}).filter(c=>c.some(u=>!l.isStructural?.(u))):a}return{score:n,scoreItem:s,filter:r,filterGroups:i}}function ms(e){return ai((t,n)=>({get(){return t(),e},set(s){e=s,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var ho=class extends ri{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=ms(this.view.state),this.reactiveExtensionStorage=ms(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),Js(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},fo=be({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const t=J(),n=ni();return ti(()=>{const s=e.editor;s&&s.options.element&&t.value&&Oe(()=>{var r;if(!t.value||!((r=s.view.dom)!=null&&r.parentNode))return;const i=k(t.value);t.value.append(...s.view.dom.parentNode.childNodes),s.contentComponent=n.ctx._,n&&(s.appContext={...n.appContext,provides:n.provides}),s.setOptions({element:i}),s.createNodeViews()})}),_t(()=>{const s=e.editor;s&&(s.contentComponent=null,s.appContext=null)}),{rootEl:t}},render(){return ze("div",{ref:e=>{this.rootEl=e}})}}),go=(e={})=>{const t=si();return wt(()=>{t.value=new ho(e)}),_t(()=>{var n,s,r,i;const a=(s=(n=t.value)==null?void 0:n.view.dom)==null?void 0:s.parentNode,o=a?.cloneNode(!0);(r=a?.parentNode)==null||r.replaceChild(o,a),(i=t.value)==null||i.destroy()}),t},mo=class{constructor(e,{props:t={},editor:n}){this.destroyed=!1,this.editor=n,this.component=Js(e),this.el=document.createElement("div"),this.props=ii(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,n,s;return(t=(e=this.renderedComponent.vNode)==null?void 0:e.component)!=null&&t.exposed?this.renderedComponent.vNode.component.exposed:(s=(n=this.renderedComponent.vNode)==null?void 0:n.component)==null?void 0:s.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=ze(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&ls(e,this.el),{vNode:e,destroy:()=>{this.el&&ls(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([t,n])=>{this.props[t]=n}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}};function yo(e,t){if(!t?.schema)return!1;const n=typeof e=="string"?e:e.name;return t.schema.spec.marks.get(n)!==void 0}function Tt(e,t){if(!e)return!1;const{selection:n}=e.state,{$from:s,to:r}=n;return t.some(i=>e.state.doc.nodesBetween(s.pos,r,a=>a.type.name===i))}function ut(e,t){return e?e.extensionManager.extensions.some(n=>n.name===t):!1}function ys(e){const t=`toggle${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:n=>n.can()[t](),execute:n=>n.chain().focus()[t](),isActive:n=>n.isActive(e),isDisabled:n=>Tt(n,["image"])||n.isActive("code")}}function vs(e){const t=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:n=>n.can()[t](),execute:n=>n.chain().focus()[t](),isActive:n=>n.isActive(e),isDisabled:n=>Tt(n,["image"])||n.isActive("code")}}function ks(e){return{canExecute:t=>t.can()[e](),execute:t=>t.chain()[e](),isActive:()=>!1,isDisabled:void 0}}function vo(){return{canExecute:(e,t)=>e.can().toggleMark(t.mark),execute:(e,t)=>e.chain().focus().toggleMark(t.mark),isActive:(e,t)=>e.isActive(t.mark),isDisabled:(e,t)=>!yo(t.mark,e)||Tt(e,["image"])}}function ko(){return{canExecute:(e,t)=>e.can().setTextAlign(t.align),execute:(e,t)=>e.chain().focus().setTextAlign(t.align),isActive:(e,t)=>e.isActive({textAlign:t.align}),isDisabled:e=>!ut(e,"textAlign")||Tt(e,["image","horizontalRule"])}}function xo(){return{canExecute:(e,t)=>e.can().toggleHeading({level:t.level}),execute:(e,t)=>e.chain().focus().toggleHeading({level:t.level}),isActive:(e,t)=>e.isActive("heading",{level:t.level}),isDisabled:e=>Tt(e,["image"])||e.isActive("code")}}function bo(){return{canExecute:e=>e.can().setLink({href:""})||e.can().unsetLink(),execute:(e,t)=>{const n=e.chain(),s=e.getAttributes("link").href,r=e.isActive("code");if(s)return n.focus().unsetLink();const i=t?.href||prompt("Enter the URL:");return i?r?n.focus().extendMarkRange("code").setLink({href:i}):n.focus().setLink({href:i}):n},isActive:e=>e.isActive("link"),isDisabled:e=>{if(!ut(e,"link")||Tt(e,["image"]))return!0;const{selection:t}=e.state;return t.empty&&!e.isActive("link")}}}function wo(){return{canExecute:e=>e.can().setImage({src:""}),execute:(e,t)=>{const n=e.chain().focus();if(t?.src)return n.setImage({src:t.src});const s=prompt("Enter the image URL:");return s?n.setImage({src:s}):n},isActive:e=>e.isActive("image"),isDisabled:e=>!ut(e,"image")}}function cr(e){const n={bulletList:"toggleBulletList",orderedList:"toggleOrderedList",taskList:"toggleTaskList"}[e],s=e==="taskList"?"taskItem":"listItem",r=["bulletList","orderedList","taskList"];return{canExecute:i=>i.can()[n]()||i.isActive("listItem")||r.some(a=>ut(i,a)&&i.isActive(a)),execute:i=>{const{state:a}=i,{selection:o}=a;let l=i.chain().focus();if(o.node){const c=o.node,u=c.firstChild?.firstChild,d=c.lastChild?.lastChild,p=u?o.from+u.nodeSize:o.from+1,f=d?o.to-d.nodeSize:o.to-1;l=l.setTextSelection({from:p,to:f}).clearNodes()}if(i.isActive(e)){let c=l.liftListItem(s);for(const u of r)ut(i,u)&&(c=c.lift(u));return c.selectTextblockEnd()}if(r.some(c=>ut(i,c)&&i.isActive(c))){const c=i.isActive("taskList")?"taskItem":"listItem";let u=l.liftListItem(c);for(const d of r)ut(i,d)&&(u=u.lift(d));return u[n]().selectTextblockEnd()}return l[n]().selectTextblockEnd()},isActive:i=>i.isActive(e),isDisabled:i=>ut(i,e)?Tt(i,["image"])||i.isActive("code"):!0}}function xs(e){return{canExecute:(t,n)=>{if(n?.pos==null||!t.state.doc.nodeAt(n.pos))return!1;const r=t.state.doc.resolve(n.pos),i=r.parent,a=r.index();return e==="up"?a>0:a<i.childCount-1},execute:(t,n)=>{if(n?.pos==null)return t.chain();const s=t.state.doc.nodeAt(n.pos);if(!s)return t.chain();const r=t.state.doc.resolve(n.pos),i=r.parent,a=r.index();if(e==="up"&&a>0){const o=i.child(a-1),l=n.pos-o.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+s.nodeSize}).insertContentAt(l,s.toJSON())}if(e==="down"&&a<i.childCount-1){const o=i.child(a+1),l=n.pos+o.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+s.nodeSize}).insertContentAt(l,s.toJSON())}return t.chain()},isActive:()=>!1,isDisabled:void 0}}function _o(){return{mark:vo(),textAlign:ko(),heading:xo(),link:bo(),image:wo(),blockquote:ys("blockquote"),bulletList:cr("bulletList"),orderedList:cr("orderedList"),taskList:cr("taskList"),codeBlock:ys("codeBlock"),horizontalRule:vs("horizontalRule"),paragraph:vs("paragraph"),undo:ks("undo"),redo:ks("redo"),clearFormatting:{canExecute:(e,t)=>t?.pos!=null?!!e.state.doc.nodeAt(t.pos):e.can().clearNodes()||e.can().unsetAllMarks(),execute:(e,t)=>{if(t?.pos!=null){const n=e.state.doc.nodeAt(t.pos);if(!n)return e.chain();const s=t.pos+1,r=t.pos+n.nodeSize-1;return e.chain().focus().setTextSelection({from:s,to:r}).clearNodes().unsetAllMarks()}return e.chain().focus().clearNodes().unsetAllMarks()},isActive:()=>!1,isDisabled:void 0},duplicate:{canExecute:(e,t)=>t?.pos==null?!1:!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();const n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().insertContentAt(t.pos+n.nodeSize,n.toJSON()):e.chain()},isActive:()=>!1,isDisabled:void 0},delete:{canExecute:(e,t)=>t?.pos==null?!1:!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();const n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().deleteRange({from:t.pos,to:t.pos+n.nodeSize}):e.chain()},isActive:()=>!1,isDisabled:void 0},moveUp:xs("up"),moveDown:xs("down"),suggestion:{canExecute:()=>!0,execute:(e,t)=>{const{state:n}=e,{selection:s}=n,{$from:r}=s;if(t?.pos!==void 0){const l=n.doc.nodeAt(t.pos);if(l){const c=t.pos+l.nodeSize;return e.chain().focus().insertContentAt(c,{type:"paragraph",content:[{type:"text",text:"/"}]})}}const i=r.node(r.depth),o=r.before(r.depth)+i.nodeSize;return e.chain().focus().insertContentAt(o,{type:"paragraph",content:[{type:"text",text:"/"}]})},isActive:()=>!1,isDisabled:void 0},mention:{canExecute:()=>!0,execute:e=>{const{state:t}=e,{selection:n}=t,{$from:s}=n,r=s.parent.textBetween(Math.max(0,s.parentOffset-1),s.parentOffset,void 0," "),i=r&&r!==" ";return e.chain().focus().insertContent(i?" @":"@")},isActive:()=>!1,isDisabled:void 0},emoji:{canExecute:()=>!0,execute:e=>{const{state:t}=e,{selection:n}=t,{$from:s}=n,r=s.parent.textBetween(Math.max(0,s.parentOffset-1),s.parentOffset,void 0," "),i=r&&r!==" ";return e.chain().focus().insertContent(i?" :":":")},isActive:()=>!1,isDisabled:void 0}}}function To(e){const t=[];return e.offset&&t.push(oi(typeof e.offset!="boolean"?e.offset:void 0)),e.flip&&t.push(li(typeof e.flip!="boolean"?e.flip:void 0)),e.shift&&t.push(ci(typeof e.shift!="boolean"?e.shift:void 0)),e.size&&t.push(ui(typeof e.size!="boolean"?e.size:void 0)),e.autoPlacement&&t.push(di(typeof e.autoPlacement!="boolean"?e.autoPlacement:void 0)),e.hide&&t.push(pi(typeof e.hide!="boolean"?e.hide:void 0)),e.inline&&t.push(hi(typeof e.inline!="boolean"?e.inline:void 0)),t}function Co(e){const t=J([]),n=J(0),s=J("closed"),r=e.searchTerm??J("");let i=null,a=null,o=null,l=null,c=null,u=null,d=null,p=null,f=null,y=null,_=null;const{score:M}=po(),v=()=>{s.value!=="closed"&&(s.value="closed",u&&(document.removeEventListener("keydown",u,!0),u=null),d&&(e.editor.view.dom.removeEventListener("blur",d),d=null),y&&(window.removeEventListener("scroll",y,!0),y=null),a&&o&&(a.removeEventListener("mousedown",o),o=null),i&&(i.destroy(),i=null),a&&(a.remove(),a=null))},C=e.filterFields??["label"],O=(H,V)=>{if(!V)return H;const j=[];for(const re of H){let oe=null;for(const Se of C){const Ae=Qs(re,Se);if(Ae==null)continue;const we=Array.isArray(Ae)?Ae.map(String):[String(Ae)];for(const he of we){const De=he.replace(/[\s_-]/g,""),Me=Math.min(M(he,V)??3,M(De,V)??3);if((oe===null||Me<oe)&&(oe=Me),oe===0)break}if(oe===0)break}oe!==null&&oe<3&&j.push({item:re,score:oe})}return j.sort((re,oe)=>re.score-oe.score),j.map(({item:re})=>re)},L=e.filter||O,I=e.limit??42,G=typeof e.pluginKey=="string"?new Be(e.pluginKey):e.pluginKey,ue=S(()=>{const H=k(e.items);return H?.length?cs(H)?H:[H]:[]}),te=S(()=>ue.value.flatMap(H=>H)),W=S(()=>t.value.length?e.ignoreFilter?[t.value]:ue.value.map(H=>{const V=H.filter(j=>t.value.includes(j));return V.sort((j,re)=>t.value.indexOf(j)-t.value.indexOf(re)),V}).filter(H=>H.length>0):[]),ae=S(()=>t.value.filter(H=>H.type!=="label"&&H.type!=="separator")),N=Lt(e.options,{strategy:"absolute",placement:"bottom-start",offset:8,flip:{},shift:{padding:8},size:!1,autoPlacement:!1,hide:!1,inline:!1}),$=To(N),K=H=>{if(!p)return;const V=p();if(!V)return;gi({getBoundingClientRect:()=>V},H,{placement:N.placement,strategy:N.strategy,middleware:$}).then(({x:re,y:oe,strategy:Se})=>{H.style.width="max-content",H.style.position=Se,H.style.top="0",H.style.left="0",H.style.transform=`translate(${Math.round(re)}px, ${Math.round(oe)}px)`})},ie=()=>{s.value="open",u||(u=j=>{c&&c({event:j})&&(j.preventDefault(),j.stopPropagation())},document.addEventListener("keydown",u,!0)),d||(d=()=>{setTimeout(()=>{if(s.value==="open"){const j=e.editor.view.state.tr.setMeta(G,{exit:!0});e.editor.view.dispatch(j)}},0)},e.editor.view.dom.addEventListener("blur",d)),y||(y=()=>{a&&K(a)},window.addEventListener("scroll",y,!0)),f=j=>{n.value=j,i&&i.updateProps({groups:W.value,selectedIndex:j,onSelect:l,onHover:f,state:s.value})},i=new mo(q,{props:{groups:W.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value},editor:e.editor}),a=document.createElement("div"),a.style.position=N.strategy,a.style.zIndex="50",o=j=>{j.preventDefault()},a.addEventListener("mousedown",o),((typeof e.appendTo=="function"?e.appendTo():e.appendTo)??e.editor.view.dom.parentElement)?.appendChild(a),i.element&&a.appendChild(i.element),K(a)};e.ignoreFilter&&(_=Te(()=>k(e.items),H=>{if(!p)return;const V=H?.length?cs(H)?H.flat():H:[];if(t.value=V.slice(0,I),!t.value.length){v();return}if(n.value>=ae.value.length&&(n.value=Math.max(0,ae.value.length-1)),s.value==="closed"&&t.value.length){ie();return}i&&i.updateProps({groups:W.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}),a&&K(a)},{deep:!0,flush:"sync"}));const q={props:{groups:{type:Array,required:!0},selectedIndex:{type:Number,required:!0},onSelect:{type:Function,required:!0},onHover:{type:Function,required:!0},state:{type:String,required:!0}},setup(H){function V(re,oe,Se){re.preventDefault(),H.onSelect(oe,Se)}function j(re){H.onHover(re)}return()=>{const re=H.groups,oe=new Map;let Se=0;for(const Ae of re)for(const we of Ae){const he=we;he.type!=="label"&&he.type!=="separator"&&oe.set(we,Se++)}return ze("div",{class:e.ui.value.content(),role:"listbox","data-state":H.state},[ze("div",{class:e.ui.value.viewport(),role:"presentation"},re.map((Ae,we)=>ze("div",{key:`group-${we}`,class:e.ui.value.group(),role:"group"},Ae.map((he,De)=>{const Me=he;if(Me.type==="label")return ze("div",{key:`label-${we}-${De}`,class:e.ui.value.label({class:Me.class})},e.renderItem(he,e.ui));if(Me.type==="separator")return ze("div",{key:`separator-${we}-${De}`,class:e.ui.value.separator({class:Me.class}),role:"separator"});const Ie=oe.get(he),pt=Ie===H.selectedIndex;return ze("div",{key:`item-${Ie}`,class:e.ui.value.item({class:Me.class,active:!1}),role:"option","aria-selected":pt,"data-highlighted":pt?"":void 0,"data-disabled":Me.disabled?"":void 0,onMousedown:it=>V(it,he,Ie),onMouseenter:()=>j(Ie),ref:it=>{it&&pt&&it.scrollIntoView({block:"nearest",inline:"nearest"})}},e.renderItem(he,e.ui))}))))])}}};return{plugin:fi({...e.suggestion||{},pluginKey:G,editor:e.editor,char:e.char,items:({query:H})=>(r.value=H,e.ignoreFilter?te.value.slice(0,I):L(te.value,H).slice(0,I)),command:({editor:H,range:V,props:j})=>{e.onSelect(H,V,j)},render:()=>(c=V=>{const{event:j}=V;if(!i||!ae.value.length)return!1;if(j.key==="Escape")return v(),!0;if(j.key==="ArrowUp")return n.value=(n.value+ae.value.length-1)%ae.value.length,i?.updateProps({groups:W.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}),!0;if(j.key==="ArrowDown")return n.value=(n.value+1)%ae.value.length,i?.updateProps({groups:W.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}),!0;if(j.key==="Enter"||j.key==="Tab"){const re=ae.value[n.value];return re&&l&&l(re),!0}return!1},{onStart:V=>{t.value=e.ignoreFilter?te.value.slice(0,I):V.items,n.value=0,l=j=>V.command(j),p=V.clientRect,t.value.length&&ie()},onUpdate:V=>{if(t.value=e.ignoreFilter?te.value.slice(0,I):V.items,l=j=>V.command(j),n.value>=ae.value.length&&(n.value=Math.max(0,ae.value.length-1)),!t.value.length){v();return}i?i.updateProps({groups:W.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}):ie(),a&&K(a)},onKeyDown:c,onExit:()=>{v(),p=null,r.value=""}})}),destroy:()=>{s.value="closed",u&&(document.removeEventListener("keydown",u,!0),u=null),d&&(e.editor.view.dom.removeEventListener("blur",d),d=null),y&&(window.removeEventListener("scroll",y,!0),y=null),a&&o&&(a.removeEventListener("mousedown",o),o=null),i&&(i.destroy(),i=null),a&&(a.remove(),a=null),_&&(_(),_=null)},filteredItems:t,searchTerm:r}}function So(e){return e.content.trim()?e.content:e.contentBlocks?.filter(n=>n.type==="text"&&!!n.text).map(n=>n.text).join("")??""}function Tr(e){return e.flatMap(t=>{if(t.role!=="user"&&t.role!=="assistant")return[];const n=So(t);return n.trim()?[{role:t.role,content:n,timestamp:t.timestamp}]:[]})}function Mo(e){return Tr(e).length>0}function Ao(e,t,n,s){const r=[];r.push(`# ${e}`),r.push(""),r.push(`> ${s.createdAt}: ${Je(n).format("YYYY-MM-DD HH:mm:ss")}`),r.push(""),r.push("---"),r.push("");for(const i of t){const a=Je(i.timestamp).format("YYYY-MM-DD HH:mm:ss"),o=i.role==="user"?s.user:s.assistant;r.push(`### ${o}`),r.push(`*${a}*`),r.push(""),r.push(i.content),r.push(""),r.push("---"),r.push("")}return r.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/service-DwCmXFtI.js","assets/index-D9C3dyV8.js","assets/vendor-snapdom--nZvo8Sg.js","assets/index-BZpR015e.css"])))=>i.map(i=>d[i]);
2
+ import{e as S,g as k,bD as Qs,x as wt,al as _t,d as be,cI as ze,c0 as ti,C as Oe,b as J,cB as ni,cJ as ri,cK as Js,G as si,cL as ai,cM as ii,cN as ls,cO as oi,cP as li,cQ as ci,cR as ui,cS as di,cT as pi,cU as hi,cV as Be,ce as Lt,K as Te,cW as fi,cX as gi,cg as cs,aI as Je,bt as mi,o as m,f as ae,a6 as qe,J as Xn,aA as er,c as x,n as Y,a as h,z as F,a7 as Ne,p as w,a8 as tr,w as de,a9 as He,F as me,j as _e,aK as Zs,aL as Xs,aR as mt,aQ as yn,bO as ea,cY as yi,l as q,aF as It,a0 as vi,aa as ta,a3 as ki,O as xi,r as Rt,ah as nr,bh as na,cZ as Nt,c_ as xt,c$ as Pt,d0 as fe,d1 as Ee,d2 as ra,d3 as bi,d4 as sa,d5 as vt,d6 as Or,d7 as wi,d8 as _i,d9 as Ti,da as Ci,db as Ue,dc as Si,dd as us,de as aa,df as Mi,dg as en,dh as rr,di as tn,dj as Ai,dk as Ke,dl as Li,dm as $t,dn as $i,dp as tt,dq as Ei,dr as Ii,ds as Ht,dt as wr,du as Ri,dv as Pi,dw as Hi,dx as Ni,dy as zi,dz as ia,dA as Oi,dB as ds,dC as _r,dD as Bi,dE as Di,dF as oa,dG as ji,as as la,aX as Fi,aT as qi,bG as Ui,P as ca,aw as xn,av as ua,H as Ki,aN as Wi,aH as Vi,aE as Gi,ap as Yi,L as lr,bS as Qi,ar as Ji,aP as Zi,aV as Xi,cb as eo,m as ps,au as to,bC as no,cf as ro}from"./index-D9C3dyV8.js";import{M as da,_ as so}from"./index-HjrJ3DXO.js";import{u as Br}from"./useToast-Bmgpd3sl.js";import{_ as hs}from"./EChartBar.vue_vue_type_script_setup_true_lang-BypaV5wc.js";import{_ as pa}from"./EChart.vue_vue_type_script_setup_true_lang-BcE0mE_N.js";import{_ as fs}from"./EChartLine.vue_vue_type_script_setup_true_lang-D8SyOfWC.js";import{s as ao,a as ha}from"./aiChat-CeJy-gG-.js";import{u as fa}from"./prompt-Cepfb-5-.js";import{useCacheService as io}from"./service-DwCmXFtI.js";function oo(e){const t=S(()=>k(e)),n=S(()=>new Intl.Collator("en",{usage:"search",...t.value}));return{startsWith:(a,o)=>o.length===0?!0:(a=a.normalize("NFC"),o=o.normalize("NFC"),n.value.compare(a.slice(0,o.length),o)===0),endsWith:(a,o)=>o.length===0?!0:(a=a.normalize("NFC"),o=o.normalize("NFC"),n.value.compare(a.slice(-o.length),o)===0),contains:(a,o)=>{if(o.length===0)return!0;a=a.normalize("NFC"),o=o.normalize("NFC");let l=0;const c=o.length;for(;l+c<=a.length;l++){const u=a.slice(l,l+c);if(n.value.compare(o,u)===0)return!0}return!1}}}const lo={none:[],qwen:["default","off","high"],deepseek_v4:["default","off","high","xhigh"],deepseek_hybrid:["default","off","auto"],o_series:["default","low","medium","high"],gpt5:["default","minimal","low","medium","high"],gpt5_1:["default","off","low","medium","high"],gpt5_2plus:["default","off","minimal","low","medium","high","xhigh"],grok:["default","low","high"],kimi:["default","off","auto","low","medium","high"],doubao:["default","off","auto","high"],hunyuan:["default","off","high"],gemini:["default","off","low","medium","high"],default:["default","off","low","medium","high"]},gs=/^(?!.*-non-reasoning\b)(o\d+(?:-[\w-]+)?|.*\b(?:reasoning|reasoner|thinking|think)\b.*|.*-[rR]\d+.*|.*\bqwq(?:-[\w-]+)?\b.*|.*\bhunyuan-t1(?:-[\w-]+)?\b.*|.*\bgrok-(?:3-mini|4|4-fast|build)(?:-[\w-]+)?\b.*)$/i;function co(e,t){const n=t.toLowerCase(),s=e.toLowerCase();if(n.includes("-non-reasoning")||s==="anthropic")return"none";if(s==="gemini")return/gemini-(?:2\.5|3(?:\.\d+)?-(?:flash|pro)|flash-latest|pro-latest)/i.test(n)?"gemini":"none";if(s==="qwen"||/\bqwen|qwq/i.test(n))return"qwen";if(/deepseek[_-]v([4-9]|\d{2,})/i.test(n)||/deepseek-ai\/deepseek-r1/i.test(n))return"deepseek_v4";if(/deepseek[_-]chat|deepseek[_-]v3/i.test(n))return"deepseek_hybrid";if(s==="openai"||s==="openai-compatible"){if(/gpt-5\.[2-9]|gpt-5\.[1-9]\d/.test(n))return"gpt5_2plus";if(/gpt-5\.1/.test(n))return"gpt5_1";if(/gpt-5/.test(n))return"gpt5";if(/^o\d/.test(n))return"o_series"}return/^o\d/.test(n)?"o_series":/\bgrok-(?:3-mini|4|4-fast|build)\b/i.test(n)?"grok":/\bkimi-k(?:2-thinking|2\.[5-9]|[3-9])/i.test(n)||s==="kimi"&&/thinking/i.test(n)?"kimi":/\bdoubao-.*seed/i.test(n)||s==="doubao"&&/seed/i.test(n)?"doubao":/\bhunyuan-(?:t1|a13b)/i.test(n)?"hunyuan":s==="glm"||/\bglm-?(?:5|4\.[5-7]|z1|zero)/i.test(n)?"qwen":s==="siliconflow"&&/r[1-9]/i.test(n)?"deepseek_v4":s==="openrouter"?/deepseek.*(v[4-9]|r\d)/i.test(n)?"deepseek_v4":/deepseek[_-]?(chat|v3)/i.test(n)?"deepseek_hybrid":/\bgrok-(?:3-mini|4|4-fast|build)\b/i.test(n)?"grok":/\bkimi-k(?:2-thinking|2\.[5-9]|[3-9])/i.test(n)?"kimi":gs.test(n)?"default":"none":/\bmimo-v2/i.test(n)||/\bminimax-m[123]/i.test(n)||/\bseed-oss/i.test(n)?"deepseek_hybrid":/\bbaichuan-m[23]/i.test(n)||/\bmagistral/i.test(n)||/\bmistral-small-2603/i.test(n)||/\bstep-(?:3|r1-v-mini)/i.test(n)||/\bgemma-?4/i.test(n)||/\bpangu-pro-moe/i.test(n)||/\bsonar-deep-research/i.test(n)||/\bring-(?:1t|mini|flash)/i.test(n)?"default":/\bqwen|qwq/i.test(n)?"qwen":/deepseek[_-]?r\d|deepseek[_-]?v[4-9]/i.test(n)?"deepseek_v4":/^o\d/i.test(n)?"o_series":gs.test(n)?"default":"none"}function uo(e,t){const n=co(e,t);return lo[n]}function po(){const{contains:e,startsWith:t}=oo({sensitivity:"base"});function n(a,o){return e(a,o)?e(o,a)?0:t(a,o)?1:2:null}function s(a,o,l){if(typeof a!="object"||a===null)return n(String(a),o);let c=null;for(const u of l){const d=Qs(a,u);if(d==null)continue;const p=Array.isArray(d)?d.map(String):[String(d)];for(const f of p){const y=n(f,o);if(y!==null&&(c===null||y<c)&&(c=y),c===0)return 0}}return c}function r(a,o,l){if(!o)return a;const c=[];for(const u of a){const d=s(u,o,l);d!==null&&c.push({item:u,score:d})}return c.sort((u,d)=>u.score-d.score),c.map(({item:u})=>u)}function i(a,o,l){return o?a.map(c=>{const u=[];for(const d of c){if(d==null)continue;if(l.isStructural?.(d)){u.push({item:d,score:-1});continue}const p=s(d,o,l.fields);p!==null&&u.push({item:d,score:p})}return u.sort((d,p)=>d.score-p.score),u.map(({item:d})=>d)}).filter(c=>c.some(u=>!l.isStructural?.(u))):a}return{score:n,scoreItem:s,filter:r,filterGroups:i}}function ms(e){return ai((t,n)=>({get(){return t(),e},set(s){e=s,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}var ho=class extends ri{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=ms(this.view.state),this.reactiveExtensionStorage=ms(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),Js(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}},fo=be({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const t=J(),n=ni();return ti(()=>{const s=e.editor;s&&s.options.element&&t.value&&Oe(()=>{var r;if(!t.value||!((r=s.view.dom)!=null&&r.parentNode))return;const i=k(t.value);t.value.append(...s.view.dom.parentNode.childNodes),s.contentComponent=n.ctx._,n&&(s.appContext={...n.appContext,provides:n.provides}),s.setOptions({element:i}),s.createNodeViews()})}),_t(()=>{const s=e.editor;s&&(s.contentComponent=null,s.appContext=null)}),{rootEl:t}},render(){return ze("div",{ref:e=>{this.rootEl=e}})}}),go=(e={})=>{const t=si();return wt(()=>{t.value=new ho(e)}),_t(()=>{var n,s,r,i;const a=(s=(n=t.value)==null?void 0:n.view.dom)==null?void 0:s.parentNode,o=a?.cloneNode(!0);(r=a?.parentNode)==null||r.replaceChild(o,a),(i=t.value)==null||i.destroy()}),t},mo=class{constructor(e,{props:t={},editor:n}){this.destroyed=!1,this.editor=n,this.component=Js(e),this.el=document.createElement("div"),this.props=ii(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,n,s;return(t=(e=this.renderedComponent.vNode)==null?void 0:e.component)!=null&&t.exposed?this.renderedComponent.vNode.component.exposed:(s=(n=this.renderedComponent.vNode)==null?void 0:n.component)==null?void 0:s.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=ze(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&ls(e,this.el),{vNode:e,destroy:()=>{this.el&&ls(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([t,n])=>{this.props[t]=n}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}};function yo(e,t){if(!t?.schema)return!1;const n=typeof e=="string"?e:e.name;return t.schema.spec.marks.get(n)!==void 0}function Tt(e,t){if(!e)return!1;const{selection:n}=e.state,{$from:s,to:r}=n;return t.some(i=>e.state.doc.nodesBetween(s.pos,r,a=>a.type.name===i))}function ut(e,t){return e?e.extensionManager.extensions.some(n=>n.name===t):!1}function ys(e){const t=`toggle${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:n=>n.can()[t](),execute:n=>n.chain().focus()[t](),isActive:n=>n.isActive(e),isDisabled:n=>Tt(n,["image"])||n.isActive("code")}}function vs(e){const t=`set${e.charAt(0).toUpperCase()}${e.slice(1)}`;return{canExecute:n=>n.can()[t](),execute:n=>n.chain().focus()[t](),isActive:n=>n.isActive(e),isDisabled:n=>Tt(n,["image"])||n.isActive("code")}}function ks(e){return{canExecute:t=>t.can()[e](),execute:t=>t.chain()[e](),isActive:()=>!1,isDisabled:void 0}}function vo(){return{canExecute:(e,t)=>e.can().toggleMark(t.mark),execute:(e,t)=>e.chain().focus().toggleMark(t.mark),isActive:(e,t)=>e.isActive(t.mark),isDisabled:(e,t)=>!yo(t.mark,e)||Tt(e,["image"])}}function ko(){return{canExecute:(e,t)=>e.can().setTextAlign(t.align),execute:(e,t)=>e.chain().focus().setTextAlign(t.align),isActive:(e,t)=>e.isActive({textAlign:t.align}),isDisabled:e=>!ut(e,"textAlign")||Tt(e,["image","horizontalRule"])}}function xo(){return{canExecute:(e,t)=>e.can().toggleHeading({level:t.level}),execute:(e,t)=>e.chain().focus().toggleHeading({level:t.level}),isActive:(e,t)=>e.isActive("heading",{level:t.level}),isDisabled:e=>Tt(e,["image"])||e.isActive("code")}}function bo(){return{canExecute:e=>e.can().setLink({href:""})||e.can().unsetLink(),execute:(e,t)=>{const n=e.chain(),s=e.getAttributes("link").href,r=e.isActive("code");if(s)return n.focus().unsetLink();const i=t?.href||prompt("Enter the URL:");return i?r?n.focus().extendMarkRange("code").setLink({href:i}):n.focus().setLink({href:i}):n},isActive:e=>e.isActive("link"),isDisabled:e=>{if(!ut(e,"link")||Tt(e,["image"]))return!0;const{selection:t}=e.state;return t.empty&&!e.isActive("link")}}}function wo(){return{canExecute:e=>e.can().setImage({src:""}),execute:(e,t)=>{const n=e.chain().focus();if(t?.src)return n.setImage({src:t.src});const s=prompt("Enter the image URL:");return s?n.setImage({src:s}):n},isActive:e=>e.isActive("image"),isDisabled:e=>!ut(e,"image")}}function cr(e){const n={bulletList:"toggleBulletList",orderedList:"toggleOrderedList",taskList:"toggleTaskList"}[e],s=e==="taskList"?"taskItem":"listItem",r=["bulletList","orderedList","taskList"];return{canExecute:i=>i.can()[n]()||i.isActive("listItem")||r.some(a=>ut(i,a)&&i.isActive(a)),execute:i=>{const{state:a}=i,{selection:o}=a;let l=i.chain().focus();if(o.node){const c=o.node,u=c.firstChild?.firstChild,d=c.lastChild?.lastChild,p=u?o.from+u.nodeSize:o.from+1,f=d?o.to-d.nodeSize:o.to-1;l=l.setTextSelection({from:p,to:f}).clearNodes()}if(i.isActive(e)){let c=l.liftListItem(s);for(const u of r)ut(i,u)&&(c=c.lift(u));return c.selectTextblockEnd()}if(r.some(c=>ut(i,c)&&i.isActive(c))){const c=i.isActive("taskList")?"taskItem":"listItem";let u=l.liftListItem(c);for(const d of r)ut(i,d)&&(u=u.lift(d));return u[n]().selectTextblockEnd()}return l[n]().selectTextblockEnd()},isActive:i=>i.isActive(e),isDisabled:i=>ut(i,e)?Tt(i,["image"])||i.isActive("code"):!0}}function xs(e){return{canExecute:(t,n)=>{if(n?.pos==null||!t.state.doc.nodeAt(n.pos))return!1;const r=t.state.doc.resolve(n.pos),i=r.parent,a=r.index();return e==="up"?a>0:a<i.childCount-1},execute:(t,n)=>{if(n?.pos==null)return t.chain();const s=t.state.doc.nodeAt(n.pos);if(!s)return t.chain();const r=t.state.doc.resolve(n.pos),i=r.parent,a=r.index();if(e==="up"&&a>0){const o=i.child(a-1),l=n.pos-o.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+s.nodeSize}).insertContentAt(l,s.toJSON())}if(e==="down"&&a<i.childCount-1){const o=i.child(a+1),l=n.pos+o.nodeSize;return t.chain().focus().deleteRange({from:n.pos,to:n.pos+s.nodeSize}).insertContentAt(l,s.toJSON())}return t.chain()},isActive:()=>!1,isDisabled:void 0}}function _o(){return{mark:vo(),textAlign:ko(),heading:xo(),link:bo(),image:wo(),blockquote:ys("blockquote"),bulletList:cr("bulletList"),orderedList:cr("orderedList"),taskList:cr("taskList"),codeBlock:ys("codeBlock"),horizontalRule:vs("horizontalRule"),paragraph:vs("paragraph"),undo:ks("undo"),redo:ks("redo"),clearFormatting:{canExecute:(e,t)=>t?.pos!=null?!!e.state.doc.nodeAt(t.pos):e.can().clearNodes()||e.can().unsetAllMarks(),execute:(e,t)=>{if(t?.pos!=null){const n=e.state.doc.nodeAt(t.pos);if(!n)return e.chain();const s=t.pos+1,r=t.pos+n.nodeSize-1;return e.chain().focus().setTextSelection({from:s,to:r}).clearNodes().unsetAllMarks()}return e.chain().focus().clearNodes().unsetAllMarks()},isActive:()=>!1,isDisabled:void 0},duplicate:{canExecute:(e,t)=>t?.pos==null?!1:!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();const n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().insertContentAt(t.pos+n.nodeSize,n.toJSON()):e.chain()},isActive:()=>!1,isDisabled:void 0},delete:{canExecute:(e,t)=>t?.pos==null?!1:!!e.state.doc.nodeAt(t.pos),execute:(e,t)=>{if(t?.pos==null)return e.chain();const n=e.state.doc.nodeAt(t.pos);return n?e.chain().focus().deleteRange({from:t.pos,to:t.pos+n.nodeSize}):e.chain()},isActive:()=>!1,isDisabled:void 0},moveUp:xs("up"),moveDown:xs("down"),suggestion:{canExecute:()=>!0,execute:(e,t)=>{const{state:n}=e,{selection:s}=n,{$from:r}=s;if(t?.pos!==void 0){const l=n.doc.nodeAt(t.pos);if(l){const c=t.pos+l.nodeSize;return e.chain().focus().insertContentAt(c,{type:"paragraph",content:[{type:"text",text:"/"}]})}}const i=r.node(r.depth),o=r.before(r.depth)+i.nodeSize;return e.chain().focus().insertContentAt(o,{type:"paragraph",content:[{type:"text",text:"/"}]})},isActive:()=>!1,isDisabled:void 0},mention:{canExecute:()=>!0,execute:e=>{const{state:t}=e,{selection:n}=t,{$from:s}=n,r=s.parent.textBetween(Math.max(0,s.parentOffset-1),s.parentOffset,void 0," "),i=r&&r!==" ";return e.chain().focus().insertContent(i?" @":"@")},isActive:()=>!1,isDisabled:void 0},emoji:{canExecute:()=>!0,execute:e=>{const{state:t}=e,{selection:n}=t,{$from:s}=n,r=s.parent.textBetween(Math.max(0,s.parentOffset-1),s.parentOffset,void 0," "),i=r&&r!==" ";return e.chain().focus().insertContent(i?" :":":")},isActive:()=>!1,isDisabled:void 0}}}function To(e){const t=[];return e.offset&&t.push(oi(typeof e.offset!="boolean"?e.offset:void 0)),e.flip&&t.push(li(typeof e.flip!="boolean"?e.flip:void 0)),e.shift&&t.push(ci(typeof e.shift!="boolean"?e.shift:void 0)),e.size&&t.push(ui(typeof e.size!="boolean"?e.size:void 0)),e.autoPlacement&&t.push(di(typeof e.autoPlacement!="boolean"?e.autoPlacement:void 0)),e.hide&&t.push(pi(typeof e.hide!="boolean"?e.hide:void 0)),e.inline&&t.push(hi(typeof e.inline!="boolean"?e.inline:void 0)),t}function Co(e){const t=J([]),n=J(0),s=J("closed"),r=e.searchTerm??J("");let i=null,a=null,o=null,l=null,c=null,u=null,d=null,p=null,f=null,y=null,_=null;const{score:M}=po(),v=()=>{s.value!=="closed"&&(s.value="closed",u&&(document.removeEventListener("keydown",u,!0),u=null),d&&(e.editor.view.dom.removeEventListener("blur",d),d=null),y&&(window.removeEventListener("scroll",y,!0),y=null),a&&o&&(a.removeEventListener("mousedown",o),o=null),i&&(i.destroy(),i=null),a&&(a.remove(),a=null))},C=e.filterFields??["label"],z=(H,W)=>{if(!W)return H;const j=[];for(const se of H){let oe=null;for(const Se of C){const Ae=Qs(se,Se);if(Ae==null)continue;const we=Array.isArray(Ae)?Ae.map(String):[String(Ae)];for(const he of we){const De=he.replace(/[\s_-]/g,""),Me=Math.min(M(he,W)??3,M(De,W)??3);if((oe===null||Me<oe)&&(oe=Me),oe===0)break}if(oe===0)break}oe!==null&&oe<3&&j.push({item:se,score:oe})}return j.sort((se,oe)=>se.score-oe.score),j.map(({item:se})=>se)},L=e.filter||z,E=e.limit??42,G=typeof e.pluginKey=="string"?new Be(e.pluginKey):e.pluginKey,ue=S(()=>{const H=k(e.items);return H?.length?cs(H)?H:[H]:[]}),te=S(()=>ue.value.flatMap(H=>H)),V=S(()=>t.value.length?e.ignoreFilter?[t.value]:ue.value.map(H=>{const W=H.filter(j=>t.value.includes(j));return W.sort((j,se)=>t.value.indexOf(j)-t.value.indexOf(se)),W}).filter(H=>H.length>0):[]),I=S(()=>t.value.filter(H=>H.type!=="label"&&H.type!=="separator")),U=Lt(e.options,{strategy:"absolute",placement:"bottom-start",offset:8,flip:{},shift:{padding:8},size:!1,autoPlacement:!1,hide:!1,inline:!1}),O=To(U),Z=H=>{if(!p)return;const W=p();if(!W)return;gi({getBoundingClientRect:()=>W},H,{placement:U.placement,strategy:U.strategy,middleware:O}).then(({x:se,y:oe,strategy:Se})=>{H.style.width="max-content",H.style.position=Se,H.style.top="0",H.style.left="0",H.style.transform=`translate(${Math.round(se)}px, ${Math.round(oe)}px)`})},ie=()=>{s.value="open",u||(u=j=>{c&&c({event:j})&&(j.preventDefault(),j.stopPropagation())},document.addEventListener("keydown",u,!0)),d||(d=()=>{setTimeout(()=>{if(s.value==="open"){const j=e.editor.view.state.tr.setMeta(G,{exit:!0});e.editor.view.dispatch(j)}},0)},e.editor.view.dom.addEventListener("blur",d)),y||(y=()=>{a&&Z(a)},window.addEventListener("scroll",y,!0)),f=j=>{n.value=j,i&&i.updateProps({groups:V.value,selectedIndex:j,onSelect:l,onHover:f,state:s.value})},i=new mo(K,{props:{groups:V.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value},editor:e.editor}),a=document.createElement("div"),a.style.position=U.strategy,a.style.zIndex="50",o=j=>{j.preventDefault()},a.addEventListener("mousedown",o),((typeof e.appendTo=="function"?e.appendTo():e.appendTo)??e.editor.view.dom.parentElement)?.appendChild(a),i.element&&a.appendChild(i.element),Z(a)};e.ignoreFilter&&(_=Te(()=>k(e.items),H=>{if(!p)return;const W=H?.length?cs(H)?H.flat():H:[];if(t.value=W.slice(0,E),!t.value.length){v();return}if(n.value>=I.value.length&&(n.value=Math.max(0,I.value.length-1)),s.value==="closed"&&t.value.length){ie();return}i&&i.updateProps({groups:V.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}),a&&Z(a)},{deep:!0,flush:"sync"}));const K={props:{groups:{type:Array,required:!0},selectedIndex:{type:Number,required:!0},onSelect:{type:Function,required:!0},onHover:{type:Function,required:!0},state:{type:String,required:!0}},setup(H){function W(se,oe,Se){se.preventDefault(),H.onSelect(oe,Se)}function j(se){H.onHover(se)}return()=>{const se=H.groups,oe=new Map;let Se=0;for(const Ae of se)for(const we of Ae){const he=we;he.type!=="label"&&he.type!=="separator"&&oe.set(we,Se++)}return ze("div",{class:e.ui.value.content(),role:"listbox","data-state":H.state},[ze("div",{class:e.ui.value.viewport(),role:"presentation"},se.map((Ae,we)=>ze("div",{key:`group-${we}`,class:e.ui.value.group(),role:"group"},Ae.map((he,De)=>{const Me=he;if(Me.type==="label")return ze("div",{key:`label-${we}-${De}`,class:e.ui.value.label({class:Me.class})},e.renderItem(he,e.ui));if(Me.type==="separator")return ze("div",{key:`separator-${we}-${De}`,class:e.ui.value.separator({class:Me.class}),role:"separator"});const Ie=oe.get(he),pt=Ie===H.selectedIndex;return ze("div",{key:`item-${Ie}`,class:e.ui.value.item({class:Me.class,active:!1}),role:"option","aria-selected":pt,"data-highlighted":pt?"":void 0,"data-disabled":Me.disabled?"":void 0,onMousedown:it=>W(it,he,Ie),onMouseenter:()=>j(Ie),ref:it=>{it&&pt&&it.scrollIntoView({block:"nearest",inline:"nearest"})}},e.renderItem(he,e.ui))}))))])}}};return{plugin:fi({...e.suggestion||{},pluginKey:G,editor:e.editor,char:e.char,items:({query:H})=>(r.value=H,e.ignoreFilter?te.value.slice(0,E):L(te.value,H).slice(0,E)),command:({editor:H,range:W,props:j})=>{e.onSelect(H,W,j)},render:()=>(c=W=>{const{event:j}=W;if(!i||!I.value.length)return!1;if(j.key==="Escape")return v(),!0;if(j.key==="ArrowUp")return n.value=(n.value+I.value.length-1)%I.value.length,i?.updateProps({groups:V.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}),!0;if(j.key==="ArrowDown")return n.value=(n.value+1)%I.value.length,i?.updateProps({groups:V.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}),!0;if(j.key==="Enter"||j.key==="Tab"){const se=I.value[n.value];return se&&l&&l(se),!0}return!1},{onStart:W=>{t.value=e.ignoreFilter?te.value.slice(0,E):W.items,n.value=0,l=j=>W.command(j),p=W.clientRect,t.value.length&&ie()},onUpdate:W=>{if(t.value=e.ignoreFilter?te.value.slice(0,E):W.items,l=j=>W.command(j),n.value>=I.value.length&&(n.value=Math.max(0,I.value.length-1)),!t.value.length){v();return}i?i.updateProps({groups:V.value,selectedIndex:n.value,onSelect:l,onHover:f,state:s.value}):ie(),a&&Z(a)},onKeyDown:c,onExit:()=>{v(),p=null,r.value=""}})}),destroy:()=>{s.value="closed",u&&(document.removeEventListener("keydown",u,!0),u=null),d&&(e.editor.view.dom.removeEventListener("blur",d),d=null),y&&(window.removeEventListener("scroll",y,!0),y=null),a&&o&&(a.removeEventListener("mousedown",o),o=null),i&&(i.destroy(),i=null),a&&(a.remove(),a=null),_&&(_(),_=null)},filteredItems:t,searchTerm:r}}function So(e){return e.content.trim()?e.content:e.contentBlocks?.filter(n=>n.type==="text"&&!!n.text).map(n=>n.text).join("")??""}function Tr(e){return e.flatMap(t=>{if(t.role!=="user"&&t.role!=="assistant")return[];const n=So(t);return n.trim()?[{role:t.role,content:n,timestamp:t.timestamp}]:[]})}function Mo(e){return Tr(e).length>0}function Ao(e,t,n,s){const r=[];r.push(`# ${e}`),r.push(""),r.push(`> ${s.createdAt}: ${Je(n).format("YYYY-MM-DD HH:mm:ss")}`),r.push(""),r.push("---"),r.push("");for(const i of t){const a=Je(i.timestamp).format("YYYY-MM-DD HH:mm:ss"),o=i.role==="user"?s.user:s.assistant;r.push(`### ${o}`),r.push(`*${a}*`),r.push(""),r.push(i.content),r.push(""),r.push("---"),r.push("")}return r.join(`
3
3
  `)}function Lo(e,t,n,s){const r=[];r.push(`${e}`),r.push(`${s.createdAt}: ${Je(n).format("YYYY-MM-DD HH:mm:ss")}`),r.push(""),r.push("=".repeat(50)),r.push("");for(const i of t){const a=Je(i.timestamp).format("YYYY-MM-DD HH:mm:ss"),o=i.role==="user"?s.user:s.assistant;r.push(`[${o}] ${a}`),r.push(""),r.push(i.content),r.push(""),r.push("-".repeat(50)),r.push("")}return r.join(`
4
- `)}function $o(e){return e.replace(/[/\\?%*:|"<>]/g,"_")}async function Eo(e,t,n,s,r){if(t.length===0)return{success:!1,error:"No messages to export"};let i,a;const o=Je(n).format("YYYYMMDD_HHmmss"),l=$o(e);s==="markdown"?(i=Ao(e,t,n,r),a=`${l}_${o}.md`):(i=Lo(e,t,n,r),a=`${l}_${o}.txt`);const c=`data:text/plain;charset=utf-8,${encodeURIComponent(i)}`,{useCacheService:u}=await mi(async()=>{const{useCacheService:p}=await import("./service-Bvq1fRkC.js");return{useCacheService:p}},__vite__mapDeps([0,1,2,3]));return await u().saveToDownloads(a,c)}const bs=be({__name:"EChartPie",props:{data:{},height:{default:280},mode:{default:"expanded"},doughnut:{type:Boolean,default:!0},innerRadius:{default:"50%"},showLegend:{type:Boolean,default:!0}},setup(e){const t=e,n=["#6366f1","#8b5cf6","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"],s=S(()=>{const r=t.data.labels.map((p,f)=>({name:p,value:t.data.values[f]})),i=t.data.labels.length,a=t.mode==="compact",o=i>(a?8:14),l=i>(a?6:12),c=a?{type:l?"scroll":"plain",orient:"horizontal",left:8,right:8,bottom:0,height:28,textStyle:{fontSize:11,overflow:"truncate",width:72}}:{type:l?"scroll":"plain",orient:"vertical",right:10,top:24,bottom:24,textStyle:{fontSize:12,overflow:"truncate",width:120}},u=!a&&!o,d=t.showLegend&&!u;return{color:n,tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)",confine:!0,extraCssText:"max-width: min(360px, 70vw); white-space: normal; word-break: break-word;",backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"}},legend:d?c:void 0,series:[{type:"pie",radius:t.doughnut?[t.innerRadius,a?"58%":"68%"]:a?"58%":"68%",center:d?a?["50%","42%"]:["38%","50%"]:["50%",a?"46%":"50%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:4,borderColor:"#fff",borderWidth:2},label:{show:u,formatter:"{b}",overflow:"truncate",width:110,alignTo:"edge",edgeDistance:12},emphasis:{label:{show:u,fontSize:14,fontWeight:"bold",overflow:"truncate",width:140},itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},data:r}]}});return(r,i)=>(m(),se(pa,{option:s.value,height:e.height},null,8,["option","height"]))}}),ws=be({__name:"EChartHeatmap",props:{data:{},height:{default:280},mode:{default:"expanded"},minColor:{default:"#fee5e8"},maxColor:{default:"#ee4567"}},setup(e){const t=e,n=S(()=>{let r=0;for(const[,,i]of t.data.data)i>r&&(r=i);return r||1}),s=S(()=>{const r=t.mode==="compact",i=t.data.xLabels.length,a=t.data.yLabels.length;return{tooltip:{position:"top",confine:!0,extraCssText:"max-width: min(360px, 70vw); white-space: normal; word-break: break-word;",formatter:o=>{const l=t.data.xLabels[o.data[0]],c=t.data.yLabels[o.data[1]],u=o.data[2];return`${c} ${l}<br/>消息数: <strong>${u}</strong>`},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"}},grid:{left:r?52:72,right:20,top:r?12:24,bottom:r?52:70,outerBoundsMode:"same"},xAxis:{type:"category",data:t.data.xLabels,splitArea:{show:!0},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:r?10:11,color:"#6b7280",interval:r&&i>16?"auto":0,hideOverlap:!0}},yAxis:{type:"category",data:t.data.yLabels,splitArea:{show:!0},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:r?10:11,color:"#6b7280",interval:r&&a>14?"auto":0,hideOverlap:!0}},visualMap:{min:0,max:n.value,calculable:!0,orient:"horizontal",left:"center",bottom:0,itemWidth:r?8:10,itemHeight:r?84:120,inRange:{color:[t.minColor,t.maxColor]},textStyle:{color:"#6b7280",fontSize:11}},series:[{type:"heatmap",data:t.data.data,label:{show:!1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]}});return(r,i)=>(m(),se(pa,{option:s.value,height:e.height},null,8,["option","height"]))}}),Io=["inert","aria-hidden"],Ro={class:"flex h-full w-64 flex-col"},Po={class:"flex-1 overflow-y-auto p-2"},Ho={key:0,class:"flex items-center justify-center py-8"},No={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},zo={class:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-50 dark:bg-gray-800"},Oo={class:"mt-3 text-xs text-gray-400"},Bo={key:2,class:"space-y-3"},Do={class:"px-2 pb-1 pt-1.5 text-[10px] font-medium tracking-wide text-gray-400 dark:text-gray-500"},jo={class:"space-y-0.5"},Fo=["onClick"],qo=["placeholder","onBlur","onKeyup"],Uo={key:1,class:"flex items-center"},Ko={class:"line-clamp-1 min-w-0 flex-1 text-sm leading-snug"},Wo={class:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"},Vo={class:"w-28 p-1"},Go=["disabled","onClick"],Yo=["onClick"],Qo=["disabled","onClick"],Jo={class:"pointer-events-none absolute left-0 top-0 z-10 h-[52px] w-[92px]"},Zo={key:0,class:"pointer-events-auto absolute left-2 top-2"},Xo=["title","disabled"],fg=be({__name:"ConversationList",props:{sessionId:{},activeId:{},disabled:{type:Boolean},conversations:{},loading:{type:Boolean},embedded:{type:Boolean},collapsible:{type:Boolean,default:!0}},emits:["select","create","delete","rename"],setup(e,{expose:t,emit:n}){const{t:s}=qe(),r=Xn(),{isAIChatSidebarCollapsed:i}=er(r),{toggleAIChatSidebar:a}=r,o=e,l=n,c=J([]),u=J(!1),d=J(null),p=J(""),f=J(null),y=S(()=>o.conversations!==void 0),_=S(()=>o.conversations??c.value),M=S(()=>y.value?o.loading??!1:u.value),v=S(()=>o.collapsible!==!1),C=S(()=>v.value&&i.value);async function O(){if(!y.value){u.value=!0;try{c.value=await It().getAIChats(o.sessionId)}catch($){console.error("加载对话列表失败:",$)}finally{u.value=!1}}}const L=S(()=>{if(_.value.length===0)return[];const $=Je(),K=$.subtract(7,"day").startOf("day"),ie=$.subtract(30,"day").startOf("day"),q=[],B=[],ne=new Map;for(const j of _.value){const re=Je(j.updatedAt*1e3);if(re.isAfter(K))q.push(j);else if(re.isAfter(ie))B.push(j);else{const oe=re.format("YYYY-MM");ne.has(oe)||ne.set(oe,[]),ne.get(oe).push(j)}}const H=[];q.length>0&&H.push({label:s("ai.chat.conversation.group.last7Days"),conversations:q}),B.length>0&&H.push({label:s("ai.chat.conversation.group.last30Days"),conversations:B});const V=[...ne.keys()].sort((j,re)=>re.localeCompare(j));for(const j of V){const re=Je(j+"-01");H.push({label:re.format(re.year()===$.year()?"M月":"YYYY年M月"),conversations:ne.get(j)})}return H});function I($){return $.title||s("ai.chat.conversation.newChat")}function G($){o.disabled||(d.value=$.id,p.value=$.title||"")}async function ue($){if(!o.disabled){if(p.value.trim()){if(y.value){l("rename",{id:$,title:p.value.trim()}),d.value=null;return}try{await It().updateAIChatTitle($,p.value.trim());const K=c.value.find(ie=>ie.id===$);K&&(K.title=p.value.trim())}catch(K){console.error("更新标题失败:",K)}}d.value=null}}function te($){f.value=null,G($)}function W($){f.value=null,navigator.clipboard.writeText($)}function ae($){f.value=null,N($)}async function N($){if(!o.disabled){if(y.value){l("delete",$);return}try{await It().deleteAIChat($),c.value=c.value.filter(K=>K.id!==$),l("delete",$)}catch(K){console.error("删除对话失败:",K)}}}return wt(()=>{O()}),Te(()=>o.sessionId,()=>{O()}),t({refresh:O}),($,K)=>{const ie=Ne,q=tr,B=ea;return m(),x("div",{class:Y(["relative shrink-0 overflow-hidden transition-[width] duration-300 ease-in-out motion-reduce:transition-none",[o.embedded?"h-full":"m-3 h-[calc(100%-1.5rem)]",C.value?"w-[92px]":"w-64"]])},[h("div",{class:Y(["absolute inset-y-0 left-0 overflow-hidden rounded-lg bg-white transition-[width] duration-300 ease-in-out motion-reduce:transition-none dark:bg-sidebar-dark",C.value?"pointer-events-none w-0":"w-64"]),inert:C.value,"aria-hidden":C.value?"true":void 0},[h("div",Ro,[K[5]||(K[5]=h("div",{class:"h-[52px] shrink-0 border-b border-gray-200 dark:border-gray-800"},null,-1)),h("div",Po,[M.value?(m(),x("div",Ho,[F(ie,{name:"i-heroicons-arrow-path",class:"h-5 w-5 animate-spin text-gray-400"})])):_.value.length===0?(m(),x("div",No,[h("div",zo,[F(ie,{name:"i-heroicons-chat-bubble-left",class:"h-6 w-6 text-gray-300 dark:text-gray-600"})]),h("p",Oo,w(k(s)("ai.chat.conversation.empty")),1),F(q,{class:"mt-2",size:"xs",variant:"link",color:"primary",disabled:e.disabled,onClick:K[0]||(K[0]=ne=>!e.disabled&&l("create"))},{default:de(()=>[He(w(k(s)("ai.chat.conversation.startNew")),1)]),_:1},8,["disabled"])])):(m(),x("div",Bo,[(m(!0),x(me,null,_e(L.value,ne=>(m(),x("div",{key:ne.label},[h("div",Do,w(ne.label),1),h("div",jo,[(m(!0),x(me,null,_e(ne.conversations,H=>(m(),x("div",{key:H.id,class:Y(["group relative rounded-lg px-3 py-2 transition-all",["cursor-pointer",e.activeId===H.id?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"text-gray-600 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50"]]),onClick:V=>l("select",H.id)},[d.value===H.id?Zs((m(),x("input",{key:0,"onUpdate:modelValue":K[1]||(K[1]=V=>p.value=V),class:"w-full rounded border-none bg-white px-2 py-1 text-sm shadow-sm outline-none ring-1 ring-gray-200 focus:ring-2 focus:ring-primary-500 dark:bg-page-dark dark:ring-gray-700",placeholder:k(s)("ai.chat.conversation.titlePlaceholder"),autoFocus:"",onBlur:V=>ue(H.id),onKeyup:yn(V=>ue(H.id),["enter"]),onClick:K[2]||(K[2]=mt(()=>{},["stop"]))},null,40,qo)),[[Xs,p.value]]):(m(),x("div",Uo,[h("p",Ko,w(I(H)),1),h("div",{class:Y(["ml-1 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",{"opacity-100":e.activeId===H.id||f.value===H.id}]),onClick:K[3]||(K[3]=mt(()=>{},["stop"]))},[F(B,{open:f.value===H.id,ui:{content:"z-50 p-0"},"onUpdate:open":V=>f.value=V?H.id:null},{content:de(()=>[h("div",Vo,[h("button",{class:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800",disabled:e.disabled,onClick:V=>te(H)},[F(ie,{name:"i-heroicons-pencil",class:"h-3.5 w-3.5"}),He(" "+w(k(s)("ai.chat.conversation.rename")),1)],8,Go),h("button",{class:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800",onClick:V=>W(H.id)},[F(ie,{name:"i-heroicons-clipboard-document",class:"h-3.5 w-3.5"}),He(" "+w(k(s)("ai.chat.conversation.copyId")),1)],8,Yo),h("button",{class:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-red-500 transition-colors hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/30",disabled:e.disabled,onClick:V=>ae(H.id)},[F(ie,{name:"i-heroicons-trash",class:"h-3.5 w-3.5"}),He(" "+w(k(s)("ai.chat.conversation.delete")),1)],8,Qo)])]),default:de(()=>[h("button",Wo,[F(ie,{name:"i-heroicons-ellipsis-horizontal",class:"h-4 w-4"})])]),_:2},1032,["open","onUpdate:open"])],2)]))],10,Fo))),128))])]))),128))]))])])],10,Io),h("div",Jo,[v.value?(m(),x("div",Zo,[F(yi,{collapsed:C.value,"accessible-label":k(s)(C.value?"common.expandSidebar":"common.collapseSidebar"),onClick:k(a)},null,8,["collapsed","accessible-label","onClick"])])):U("",!0),h("button",{type:"button",class:Y(["pointer-events-auto absolute left-12 top-2 flex h-9 w-9 items-center justify-center rounded-full text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",{"cursor-not-allowed opacity-50":e.disabled}]),title:k(s)("ai.chat.conversation.newConversation"),disabled:e.disabled,onClick:K[4]||(K[4]=ne=>!e.disabled&&l("create"))},[F(ie,{name:"i-lucide-square-pen",class:"h-4 w-4"})],10,Xo)])],2)}}}),el={class:"flex max-h-[80vh] flex-col overflow-hidden"},tl={class:"shrink-0 border-b border-gray-200 px-6 py-4 dark:border-gray-800"},nl={class:"flex items-center justify-between"},rl={class:"flex items-center gap-3"},sl={class:"flex h-8 w-8 items-center justify-center rounded-lg bg-red-100 dark:bg-red-900/40"},al={class:"text-lg font-semibold text-gray-900 dark:text-white"},il={class:"flex-1 overflow-y-auto px-6 py-4"},ol={class:"flex flex-col gap-4"},ll={class:"text-sm font-semibold text-gray-700 dark:text-gray-300"},cl={key:0,class:"rounded-md border border-red-200 bg-red-50/50 p-3 dark:border-red-900/40 dark:bg-red-950/20"},ul={class:"m-0 whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-red-600 dark:text-red-400"},dl={key:1,class:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-page-dark"},pl={class:"m-0 max-h-[300px] overflow-auto whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-gray-700 dark:text-gray-300"},hl={key:2,class:"select-text break-words rounded-md border border-gray-200 bg-gray-50 px-3 py-2 font-mono text-xs text-gray-700 dark:border-gray-700 dark:bg-page-dark dark:text-gray-300"},fl={key:0,class:"py-8 text-center text-sm text-gray-400 dark:text-gray-500"},gl={class:"shrink-0 border-t border-gray-200 px-6 py-3 dark:border-gray-800"},ml={class:"flex justify-end"},yl=be({__name:"ErrorDetailModal",props:ki({error:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:["update:open"],setup(e){const{t}=qe(),n=Br(),s=vi(e,"open"),r=e,i=S(()=>{const l=r.error,c=[];return l.url&&c.push({label:t("ai.chat.error.requestUrl"),value:l.url}),l.statusCode!=null&&c.push({label:t("ai.chat.error.statusCode"),value:String(l.statusCode)}),l.responseBody&&c.push({label:t("ai.chat.error.responseBody"),value:a(l.responseBody),isCode:!0}),l.responseHeaders&&c.push({label:t("ai.chat.error.responseHeaders"),value:JSON.stringify(l.responseHeaders,null,2),isCode:!0}),l.name&&c.push({label:t("ai.chat.error.name"),value:l.name}),l.message&&c.push({label:t("ai.chat.error.message"),value:l.message}),l.stack&&c.push({label:t("ai.chat.error.stack"),value:l.stack,isStack:!0}),l.cause&&c.push({label:t("ai.chat.error.cause"),value:a(l.cause),isCode:!0}),l.provider&&c.push({label:t("ai.chat.error.provider"),value:l.provider}),l.requestBody&&c.push({label:t("ai.chat.error.requestBody"),value:a(l.requestBody),isCode:!0}),c});function a(l){try{return JSON.stringify(JSON.parse(l),null,2)}catch{return l}}function o(){const l=i.value.map(c=>`${c.label}: ${c.value}`).join(`
4
+ `)}function $o(e){return e.replace(/[/\\?%*:|"<>]/g,"_")}async function Eo(e,t,n,s,r){if(t.length===0)return{success:!1,error:"No messages to export"};let i,a;const o=Je(n).format("YYYYMMDD_HHmmss"),l=$o(e);s==="markdown"?(i=Ao(e,t,n,r),a=`${l}_${o}.md`):(i=Lo(e,t,n,r),a=`${l}_${o}.txt`);const c=`data:text/plain;charset=utf-8,${encodeURIComponent(i)}`,{useCacheService:u}=await mi(async()=>{const{useCacheService:p}=await import("./service-DwCmXFtI.js");return{useCacheService:p}},__vite__mapDeps([0,1,2,3]));return await u().saveToDownloads(a,c)}const bs=be({__name:"EChartPie",props:{data:{},height:{default:280},mode:{default:"expanded"},doughnut:{type:Boolean,default:!0},innerRadius:{default:"50%"},showLegend:{type:Boolean,default:!0}},setup(e){const t=e,n=["#6366f1","#8b5cf6","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"],s=S(()=>{const r=t.data.labels.map((p,f)=>({name:p,value:t.data.values[f]})),i=t.data.labels.length,a=t.mode==="compact",o=i>(a?8:14),l=i>(a?6:12),c=a?{type:l?"scroll":"plain",orient:"horizontal",left:8,right:8,bottom:0,height:28,textStyle:{fontSize:11,overflow:"truncate",width:72}}:{type:l?"scroll":"plain",orient:"vertical",right:10,top:24,bottom:24,textStyle:{fontSize:12,overflow:"truncate",width:120}},u=!a&&!o,d=t.showLegend&&!u;return{color:n,tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)",confine:!0,extraCssText:"max-width: min(360px, 70vw); white-space: normal; word-break: break-word;",backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"}},legend:d?c:void 0,series:[{type:"pie",radius:t.doughnut?[t.innerRadius,a?"58%":"68%"]:a?"58%":"68%",center:d?a?["50%","42%"]:["38%","50%"]:["50%",a?"46%":"50%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:4,borderColor:"#fff",borderWidth:2},label:{show:u,formatter:"{b}",overflow:"truncate",width:110,alignTo:"edge",edgeDistance:12},emphasis:{label:{show:u,fontSize:14,fontWeight:"bold",overflow:"truncate",width:140},itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},data:r}]}});return(r,i)=>(m(),ae(pa,{option:s.value,height:e.height},null,8,["option","height"]))}}),ws=be({__name:"EChartHeatmap",props:{data:{},height:{default:280},mode:{default:"expanded"},minColor:{default:"#fee5e8"},maxColor:{default:"#ee4567"}},setup(e){const t=e,n=S(()=>{let r=0;for(const[,,i]of t.data.data)i>r&&(r=i);return r||1}),s=S(()=>{const r=t.mode==="compact",i=t.data.xLabels.length,a=t.data.yLabels.length;return{tooltip:{position:"top",confine:!0,extraCssText:"max-width: min(360px, 70vw); white-space: normal; word-break: break-word;",formatter:o=>{const l=t.data.xLabels[o.data[0]],c=t.data.yLabels[o.data[1]],u=o.data[2];return`${c} ${l}<br/>消息数: <strong>${u}</strong>`},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"}},grid:{left:r?52:72,right:20,top:r?12:24,bottom:r?52:70,outerBoundsMode:"same"},xAxis:{type:"category",data:t.data.xLabels,splitArea:{show:!0},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:r?10:11,color:"#6b7280",interval:r&&i>16?"auto":0,hideOverlap:!0}},yAxis:{type:"category",data:t.data.yLabels,splitArea:{show:!0},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:r?10:11,color:"#6b7280",interval:r&&a>14?"auto":0,hideOverlap:!0}},visualMap:{min:0,max:n.value,calculable:!0,orient:"horizontal",left:"center",bottom:0,itemWidth:r?8:10,itemHeight:r?84:120,inRange:{color:[t.minColor,t.maxColor]},textStyle:{color:"#6b7280",fontSize:11}},series:[{type:"heatmap",data:t.data.data,label:{show:!1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]}});return(r,i)=>(m(),ae(pa,{option:s.value,height:e.height},null,8,["option","height"]))}}),Io=["inert","aria-hidden"],Ro={class:"flex h-full w-64 flex-col"},Po={class:"flex-1 overflow-y-auto p-2"},Ho={key:0,class:"flex items-center justify-center py-8"},No={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},zo={class:"flex h-12 w-12 items-center justify-center rounded-full bg-gray-50 dark:bg-gray-800"},Oo={class:"mt-3 text-xs text-gray-400"},Bo={key:2,class:"space-y-3"},Do={class:"px-2 pb-1 pt-1.5 text-[10px] font-medium tracking-wide text-gray-400 dark:text-gray-500"},jo={class:"space-y-0.5"},Fo=["onClick"],qo=["placeholder","onBlur","onKeyup"],Uo={key:1,class:"flex items-center"},Ko={class:"line-clamp-1 min-w-0 flex-1 text-sm leading-snug"},Wo={class:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"},Vo={class:"w-28 p-1"},Go=["disabled","onClick"],Yo=["onClick"],Qo=["disabled","onClick"],Jo={class:"pointer-events-none absolute left-0 top-0 z-10 h-[52px] w-[92px]"},Zo={key:0,class:"pointer-events-auto absolute left-2 top-2"},Xo=["title","disabled"],fg=be({__name:"ConversationList",props:{sessionId:{},activeId:{},disabled:{type:Boolean},conversations:{},loading:{type:Boolean},embedded:{type:Boolean},collapsible:{type:Boolean,default:!0}},emits:["select","create","delete","rename"],setup(e,{expose:t,emit:n}){const{t:s}=qe(),r=Xn(),{isAIChatSidebarCollapsed:i}=er(r),{toggleAIChatSidebar:a}=r,o=e,l=n,c=J([]),u=J(!1),d=J(null),p=J(""),f=J(null),y=S(()=>o.conversations!==void 0),_=S(()=>o.conversations??c.value),M=S(()=>y.value?o.loading??!1:u.value),v=S(()=>o.collapsible!==!1),C=S(()=>v.value&&i.value);async function z(){if(!y.value){u.value=!0;try{c.value=await It().getAIChats(o.sessionId)}catch(O){console.error("加载对话列表失败:",O)}finally{u.value=!1}}}const L=S(()=>{if(_.value.length===0)return[];const O=Je(),Z=O.subtract(7,"day").startOf("day"),ie=O.subtract(30,"day").startOf("day"),K=[],B=[],re=new Map;for(const j of _.value){const se=Je(j.updatedAt*1e3);if(se.isAfter(Z))K.push(j);else if(se.isAfter(ie))B.push(j);else{const oe=se.format("YYYY-MM");re.has(oe)||re.set(oe,[]),re.get(oe).push(j)}}const H=[];K.length>0&&H.push({label:s("ai.chat.conversation.group.last7Days"),conversations:K}),B.length>0&&H.push({label:s("ai.chat.conversation.group.last30Days"),conversations:B});const W=[...re.keys()].sort((j,se)=>se.localeCompare(j));for(const j of W){const se=Je(j+"-01");H.push({label:se.format(se.year()===O.year()?"M月":"YYYY年M月"),conversations:re.get(j)})}return H});function E(O){return O.title||s("ai.chat.conversation.newChat")}function G(O){o.disabled||(d.value=O.id,p.value=O.title||"")}async function ue(O){if(!o.disabled){if(p.value.trim()){if(y.value){l("rename",{id:O,title:p.value.trim()}),d.value=null;return}try{await It().updateAIChatTitle(O,p.value.trim());const Z=c.value.find(ie=>ie.id===O);Z&&(Z.title=p.value.trim())}catch(Z){console.error("更新标题失败:",Z)}}d.value=null}}function te(O){f.value=null,G(O)}function V(O){f.value=null,navigator.clipboard.writeText(O)}function I(O){f.value=null,U(O)}async function U(O){if(!o.disabled){if(y.value){l("delete",O);return}try{await It().deleteAIChat(O),c.value=c.value.filter(Z=>Z.id!==O),l("delete",O)}catch(Z){console.error("删除对话失败:",Z)}}}return wt(()=>{z()}),Te(()=>o.sessionId,()=>{z()}),t({refresh:z}),(O,Z)=>{const ie=Ne,K=tr,B=ea;return m(),x("div",{class:Y(["relative shrink-0 overflow-hidden transition-[width] duration-300 ease-in-out motion-reduce:transition-none",[o.embedded?"h-full":"m-3 h-[calc(100%-1.5rem)]",C.value?"w-[92px]":"w-64"]])},[h("div",{class:Y(["absolute inset-y-0 left-0 overflow-hidden rounded-lg bg-white transition-[width] duration-300 ease-in-out motion-reduce:transition-none dark:bg-sidebar-dark",C.value?"pointer-events-none w-0":"w-64"]),inert:C.value,"aria-hidden":C.value?"true":void 0},[h("div",Ro,[Z[5]||(Z[5]=h("div",{class:"h-[52px] shrink-0 border-b border-gray-200 dark:border-gray-800"},null,-1)),h("div",Po,[M.value?(m(),x("div",Ho,[F(ie,{name:"i-heroicons-arrow-path",class:"h-5 w-5 animate-spin text-gray-400"})])):_.value.length===0?(m(),x("div",No,[h("div",zo,[F(ie,{name:"i-heroicons-chat-bubble-left",class:"h-6 w-6 text-gray-300 dark:text-gray-600"})]),h("p",Oo,w(k(s)("ai.chat.conversation.empty")),1),F(K,{class:"mt-2",size:"xs",variant:"link",color:"primary",disabled:e.disabled,onClick:Z[0]||(Z[0]=re=>!e.disabled&&l("create"))},{default:de(()=>[He(w(k(s)("ai.chat.conversation.startNew")),1)]),_:1},8,["disabled"])])):(m(),x("div",Bo,[(m(!0),x(me,null,_e(L.value,re=>(m(),x("div",{key:re.label},[h("div",Do,w(re.label),1),h("div",jo,[(m(!0),x(me,null,_e(re.conversations,H=>(m(),x("div",{key:H.id,class:Y(["group relative rounded-lg px-3 py-2 transition-all",["cursor-pointer",e.activeId===H.id?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"text-gray-600 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50"]]),onClick:W=>l("select",H.id)},[d.value===H.id?Zs((m(),x("input",{key:0,"onUpdate:modelValue":Z[1]||(Z[1]=W=>p.value=W),class:"w-full rounded border-none bg-white px-2 py-1 text-sm shadow-sm outline-none ring-1 ring-gray-200 focus:ring-2 focus:ring-primary-500 dark:bg-page-dark dark:ring-gray-700",placeholder:k(s)("ai.chat.conversation.titlePlaceholder"),autoFocus:"",onBlur:W=>ue(H.id),onKeyup:yn(W=>ue(H.id),["enter"]),onClick:Z[2]||(Z[2]=mt(()=>{},["stop"]))},null,40,qo)),[[Xs,p.value]]):(m(),x("div",Uo,[h("p",Ko,w(E(H)),1),h("div",{class:Y(["ml-1 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",{"opacity-100":e.activeId===H.id||f.value===H.id}]),onClick:Z[3]||(Z[3]=mt(()=>{},["stop"]))},[F(B,{open:f.value===H.id,ui:{content:"z-50 p-0"},"onUpdate:open":W=>f.value=W?H.id:null},{content:de(()=>[h("div",Vo,[h("button",{class:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800",disabled:e.disabled,onClick:W=>te(H)},[F(ie,{name:"i-heroicons-pencil",class:"h-3.5 w-3.5"}),He(" "+w(k(s)("ai.chat.conversation.rename")),1)],8,Go),h("button",{class:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-gray-600 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800",onClick:W=>V(H.id)},[F(ie,{name:"i-heroicons-clipboard-document",class:"h-3.5 w-3.5"}),He(" "+w(k(s)("ai.chat.conversation.copyId")),1)],8,Yo),h("button",{class:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-red-500 transition-colors hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/30",disabled:e.disabled,onClick:W=>I(H.id)},[F(ie,{name:"i-heroicons-trash",class:"h-3.5 w-3.5"}),He(" "+w(k(s)("ai.chat.conversation.delete")),1)],8,Qo)])]),default:de(()=>[h("button",Wo,[F(ie,{name:"i-heroicons-ellipsis-horizontal",class:"h-4 w-4"})])]),_:2},1032,["open","onUpdate:open"])],2)]))],10,Fo))),128))])]))),128))]))])])],10,Io),h("div",Jo,[v.value?(m(),x("div",Zo,[F(yi,{collapsed:C.value,"accessible-label":k(s)(C.value?"common.expandSidebar":"common.collapseSidebar"),onClick:k(a)},null,8,["collapsed","accessible-label","onClick"])])):q("",!0),h("button",{type:"button",class:Y(["pointer-events-auto absolute left-12 top-2 flex h-9 w-9 items-center justify-center rounded-full text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",{"cursor-not-allowed opacity-50":e.disabled}]),title:k(s)("ai.chat.conversation.newConversation"),disabled:e.disabled,onClick:Z[4]||(Z[4]=re=>!e.disabled&&l("create"))},[F(ie,{name:"i-lucide-square-pen",class:"h-4 w-4"})],10,Xo)])],2)}}}),el={class:"flex max-h-[80vh] flex-col overflow-hidden"},tl={class:"shrink-0 border-b border-gray-200 px-6 py-4 dark:border-gray-800"},nl={class:"flex items-center justify-between"},rl={class:"flex items-center gap-3"},sl={class:"flex h-8 w-8 items-center justify-center rounded-lg bg-red-100 dark:bg-red-900/40"},al={class:"text-lg font-semibold text-gray-900 dark:text-white"},il={class:"flex-1 overflow-y-auto px-6 py-4"},ol={class:"flex flex-col gap-4"},ll={class:"text-sm font-semibold text-gray-700 dark:text-gray-300"},cl={key:0,class:"rounded-md border border-red-200 bg-red-50/50 p-3 dark:border-red-900/40 dark:bg-red-950/20"},ul={class:"m-0 whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-red-600 dark:text-red-400"},dl={key:1,class:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-700 dark:bg-page-dark"},pl={class:"m-0 max-h-[300px] overflow-auto whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-gray-700 dark:text-gray-300"},hl={key:2,class:"select-text break-words rounded-md border border-gray-200 bg-gray-50 px-3 py-2 font-mono text-xs text-gray-700 dark:border-gray-700 dark:bg-page-dark dark:text-gray-300"},fl={key:0,class:"py-8 text-center text-sm text-gray-400 dark:text-gray-500"},gl={class:"shrink-0 border-t border-gray-200 px-6 py-3 dark:border-gray-800"},ml={class:"flex justify-end"},yl=be({__name:"ErrorDetailModal",props:ki({error:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:["update:open"],setup(e){const{t}=qe(),n=Br(),s=vi(e,"open"),r=e,i=S(()=>{const l=r.error,c=[];return l.url&&c.push({label:t("ai.chat.error.requestUrl"),value:l.url}),l.statusCode!=null&&c.push({label:t("ai.chat.error.statusCode"),value:String(l.statusCode)}),l.responseBody&&c.push({label:t("ai.chat.error.responseBody"),value:a(l.responseBody),isCode:!0}),l.responseHeaders&&c.push({label:t("ai.chat.error.responseHeaders"),value:JSON.stringify(l.responseHeaders,null,2),isCode:!0}),l.name&&c.push({label:t("ai.chat.error.name"),value:l.name}),l.message&&c.push({label:t("ai.chat.error.message"),value:l.message}),l.stack&&c.push({label:t("ai.chat.error.stack"),value:l.stack,isStack:!0}),l.cause&&c.push({label:t("ai.chat.error.cause"),value:a(l.cause),isCode:!0}),l.provider&&c.push({label:t("ai.chat.error.provider"),value:l.provider}),l.requestBody&&c.push({label:t("ai.chat.error.requestBody"),value:a(l.requestBody),isCode:!0}),c});function a(l){try{return JSON.stringify(JSON.parse(l),null,2)}catch{return l}}function o(){const l=i.value.map(c=>`${c.label}: ${c.value}`).join(`
5
5
 
6
- `);navigator.clipboard.writeText(l).then(()=>{n.success(t("ai.chat.error.copied"))})}return(l,c)=>{const u=Ne,d=tr,p=ta;return m(),se(p,{open:s.value,"onUpdate:open":c[1]||(c[1]=f=>s.value=f),ui:{content:"sm:max-w-[700px] z-[100]",overlay:"backdrop-blur-sm z-[99]"}},{content:de(()=>[h("div",el,[h("div",tl,[h("div",nl,[h("div",rl,[h("div",sl,[F(u,{name:"i-heroicons-exclamation-triangle",class:"h-4 w-4 text-red-600 dark:text-red-400"})]),h("h2",al,w(k(t)("ai.chat.error.detail")),1)]),F(d,{icon:"i-heroicons-x-mark",variant:"ghost",color:"neutral",size:"sm",onClick:c[0]||(c[0]=f=>s.value=!1)})])]),h("div",il,[h("div",ol,[(m(!0),x(me,null,_e(i.value,(f,y)=>(m(),x("div",{key:y,class:"flex flex-col gap-1.5"},[h("div",ll,w(f.label),1),f.isStack?(m(),x("div",cl,[h("pre",ul,w(f.value),1)])):f.isCode?(m(),x("div",dl,[h("pre",pl,w(f.value),1)])):(m(),x("div",hl,w(f.value),1))]))),128)),i.value.length===0?(m(),x("div",fl,w(k(t)("ai.chat.error.unknown")),1)):U("",!0)])]),h("div",gl,[h("div",ml,[F(d,{icon:"i-heroicons-document-duplicate",variant:"soft",color:"neutral",size:"sm",onClick:o},{default:de(()=>[He(w(k(t)("ai.chat.error.copyAll")),1)]),_:1})])])])]),_:1},8,["open"])}}}),vl={class:"min-w-0 flex-1 truncate"},kl={class:"shrink-0 text-[11px] text-amber-600/80 dark:text-amber-400/80"},xl={class:"mb-1.5 flex items-center gap-2"},bl={class:"flex shrink-0 items-center justify-center text-red-500 dark:text-red-400"},wl={class:"pr-5 text-[13px] font-semibold leading-[1.4] text-red-600 dark:text-red-400"},_l={class:"ml-6 line-clamp-3 break-words text-xs leading-normal text-gray-600 dark:text-gray-400"},Tl={class:"mt-2.5 ml-6 flex items-center"},Cl={class:"ml-auto inline-flex items-center gap-0.5 text-xs text-gray-400 transition-colors duration-150 group-hover:text-red-500 dark:text-gray-500 dark:group-hover:text-red-400"},Sl=be({__name:"ErrorBlock",props:{error:{},compact:{type:Boolean}},setup(e){const{t}=qe(),n=e,s=J(!1);function r(i){return i.friendlyMessage||i.message||t("ai.chat.error.unknown")}return(i,a)=>{const o=Ne;return m(),x(me,null,[n.compact?(m(),x("button",{key:0,type:"button",class:"flex w-full min-w-0 items-start gap-2 rounded-md py-1 text-left text-xs text-amber-700 transition-colors hover:bg-amber-50/70 dark:text-amber-300 dark:hover:bg-amber-950/20",onClick:a[0]||(a[0]=l=>s.value=!0)},[F(o,{name:"i-heroicons-exclamation-circle",class:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),h("span",vl,w(r(e.error)),1),h("span",kl,w(k(t)("ai.chat.error.viewDetail")),1)])):(m(),x("div",{key:1,class:"group relative my-2 w-full min-w-[320px] cursor-pointer rounded-lg border border-red-200 bg-red-50/60 px-3.5 py-3 text-[13px] transition-all duration-200 hover:border-red-300 hover:bg-red-50 dark:border-red-900/30 dark:bg-red-950/20 dark:hover:border-red-800/50 dark:hover:bg-red-950/30",onClick:a[1]||(a[1]=l=>s.value=!0)},[h("div",xl,[h("div",bl,[F(o,{name:"i-heroicons-exclamation-triangle",class:"h-4 w-4"})]),h("div",wl,w(k(t)("ai.chat.error.title")),1)]),h("div",_l,w(r(e.error)),1),h("div",Tl,[h("div",Cl,[He(w(k(t)("ai.chat.error.viewDetail"))+" ",1),F(o,{name:"i-heroicons-chevron-right",class:"h-3.5 w-3.5"})])])])),F(yl,{open:s.value,"onUpdate:open":a[2]||(a[2]=l=>s.value=l),error:e.error},null,8,["open","error"])],64)}}}),Ml={class:"my-2 w-full overflow-hidden rounded-lg border border-gray-200 bg-white/80 dark:border-gray-700/70 dark:bg-page-dark/70"},Al={class:"border-b border-gray-100 px-3 py-2 dark:border-gray-800"},Ll={class:"flex min-w-0 items-start justify-between gap-3"},$l={class:"min-w-0"},El={class:"truncate text-sm font-semibold text-gray-900 dark:text-gray-100"},Il={key:0,class:"mt-0.5 line-clamp-2 text-xs text-gray-500 dark:text-gray-400"},Rl={class:"flex shrink-0 items-center gap-1.5"},Pl={class:"rounded-md bg-gray-100 px-1.5 py-0.5 text-[10px] uppercase text-gray-500 dark:bg-gray-800"},Hl={class:"flex max-h-[92vh] flex-col overflow-hidden bg-white dark:bg-page-dark"},Nl={class:"flex items-start justify-between gap-4 border-b border-gray-200 px-5 py-4 dark:border-gray-800"},zl={class:"min-w-0"},Ol={class:"truncate text-base font-semibold text-gray-900 dark:text-gray-100"},Bl={key:0,class:"mt-1 line-clamp-2 text-xs text-gray-500 dark:text-gray-400"},Dl={class:"mt-1 text-[11px] text-gray-400 dark:text-gray-500"},jl={class:"min-h-0 flex-1 overflow-auto p-4"},Fl={key:0,class:"flex h-64 items-center justify-center text-xs text-gray-400 dark:text-gray-500"},ql={class:"mt-1 text-[11px] text-gray-400 dark:text-gray-500"},Ul={class:"px-2 py-3"},Kl={key:0,class:"flex h-32 items-center justify-center text-xs text-gray-400 dark:text-gray-500"},Wl=be({__name:"ChartBlockRenderer",props:{chart:{}},setup(e){const{t}=qe(),n=e,s=J(!1),r=S(()=>n.chart.spec.title),i=S(()=>n.chart.spec.subtitle||n.chart.spec.description||""),a=S(()=>n.chart.spec.display?.height??(n.chart.spec.type==="heatmap"?300:260)),o=S(()=>n.chart.rowCount===0),l=S(()=>{const v=[];return n.chart.spec.unit&&v.push(n.chart.spec.unit),n.chart.truncated&&v.push(t("ai.chat.message.chart.truncated")),v.push(t("ai.chat.message.chart.rows",{count:n.chart.rowCount})),v.join(" · ")}),c=S(()=>n.chart.data),u=S(()=>n.chart.data),d=S(()=>n.chart.data),p=S(()=>n.chart.data),f=S(()=>n.chart.spec.type==="pie"?d.value.labels.length>8:n.chart.spec.type==="line"?u.value.labels.length>28||(u.value.series?.length??0)>4:n.chart.spec.type==="bar"?c.value.labels.length>12:n.chart.spec.type==="heatmap"?p.value.xLabels.length*p.value.yLabels.length>180:!1),y=S(()=>{const v=f.value?320:380;return Math.min(a.value,v)}),_=S(()=>{const v=a.value;if(n.chart.spec.type==="pie")return Math.max(v,560);if(n.chart.spec.type==="line")return Math.max(v,u.value.labels.length>40?620:540);if(n.chart.spec.type==="bar"){const C=n.chart.spec.display?.horizontal?c.value.labels.length*28+120:520;return Math.min(Math.max(v,C),820)}return n.chart.spec.type==="heatmap"?Math.min(Math.max(v,p.value.yLabels.length*22+150,560),860):Math.max(v,520)}),M=S(()=>n.chart.spec.type==="pie"?"640px":n.chart.spec.type==="bar"?"720px":"780px");return(v,C)=>{const O=tr,L=ta;return m(),x("div",Ml,[h("div",Al,[h("div",Ll,[h("div",$l,[h("h3",El,w(r.value),1),i.value?(m(),x("p",Il,w(i.value),1)):U("",!0)]),h("div",Rl,[h("span",Pl,w(e.chart.spec.type),1),F(L,{open:s.value,"onUpdate:open":C[2]||(C[2]=I=>s.value=I),ui:{overlay:"z-[10040] backdrop-blur-sm",content:"z-[10050] w-[96vw] max-w-6xl max-h-[92vh] overflow-hidden"}},{content:de(()=>[h("div",Hl,[h("div",Nl,[h("div",zl,[h("h3",Ol,w(r.value),1),i.value?(m(),x("p",Bl,w(i.value),1)):U("",!0),h("p",Dl,w(l.value),1)]),F(O,{icon:"i-heroicons-x-mark",size:"sm",color:"neutral",variant:"ghost",class:"shrink-0",title:k(t)("common.close"),"aria-label":k(t)("common.close"),onClick:C[1]||(C[1]=I=>s.value=!1)},null,8,["title","aria-label"])]),h("div",jl,[h("div",{class:"mx-auto w-full",style:xi({minWidth:M.value})},[o.value?(m(),x("div",Fl,w(k(t)("ai.chat.message.chart.empty")),1)):e.chart.spec.type==="bar"?(m(),se(hs,{key:1,data:c.value,height:_.value,mode:"expanded",horizontal:e.chart.spec.display?.horizontal},null,8,["data","height","horizontal"])):e.chart.spec.type==="line"?(m(),se(fs,{key:2,data:u.value,height:_.value,mode:"expanded"},null,8,["data","height"])):e.chart.spec.type==="pie"?(m(),se(bs,{key:3,data:d.value,height:_.value,mode:"expanded","show-legend":e.chart.spec.display?.showLegend??!0},null,8,["data","height","show-legend"])):e.chart.spec.type==="heatmap"?(m(),se(ws,{key:4,data:p.value,height:_.value,mode:"expanded"},null,8,["data","height"])):U("",!0)],4)])])]),default:de(()=>[F(O,{icon:"i-heroicons-arrows-pointing-out",size:"xs",color:"neutral",variant:"ghost",class:"no-capture",title:k(t)("ai.chat.message.chart.expand"),"aria-label":k(t)("ai.chat.message.chart.expand"),onClick:C[0]||(C[0]=mt(()=>{},["stop"]))},null,8,["title","aria-label"])]),_:1},8,["open"])])]),h("p",ql,w(l.value),1)]),h("div",Ul,[o.value?(m(),x("div",Kl,w(k(t)("ai.chat.message.chart.empty")),1)):e.chart.spec.type==="bar"?(m(),se(hs,{key:1,data:c.value,height:y.value,mode:"compact",horizontal:e.chart.spec.display?.horizontal},null,8,["data","height","horizontal"])):e.chart.spec.type==="line"?(m(),se(fs,{key:2,data:u.value,height:y.value,mode:"compact"},null,8,["data","height"])):e.chart.spec.type==="pie"?(m(),se(bs,{key:3,data:d.value,height:y.value,mode:"compact","show-legend":e.chart.spec.display?.showLegend??!0},null,8,["data","height","show-legend"])):e.chart.spec.type==="heatmap"?(m(),se(ws,{key:4,data:p.value,height:y.value,mode:"compact"},null,8,["data","height"])):U("",!0)])])}}}),Vl=["data-open","aria-hidden","inert"],Gl={class:"ai-process-fold-inner"},Kt=be({__name:"ProcessDisclosure",props:{lazy:{type:Boolean,default:!1}},setup(e){const t=e,n=J(!1),s=J(!1);function r(){n.value||(s.value=!0),n.value=!n.value}return(i,a)=>(m(),x("div",null,[Rt(i.$slots,"summary",{open:n.value,toggle:r}),h("div",{class:"ai-process-fold","data-open":n.value||void 0,"aria-hidden":!n.value,inert:n.value?void 0:!0},[h("div",Gl,[!t.lazy||s.value?Rt(i.$slots,"default",{key:0}):U("",!0)])],8,Vl)]))}}),Yl={class:"relative flex h-4 w-4 shrink-0 items-center justify-center","aria-hidden":"true"},Wt=be({__name:"ProcessDisclosureIcon",props:{icon:{},open:{type:Boolean},iconClass:{default:"text-gray-400 dark:text-gray-500"}},setup(e){return(t,n)=>{const s=Ne;return m(),x("span",Yl,[e.open?U("",!0):(m(),se(s,{key:0,name:e.icon,class:Y(["absolute h-3.5 w-3.5 transition-opacity duration-100 group-hover/process-toggle:opacity-0",e.iconClass])},null,8,["name","class"])),F(s,{name:"i-heroicons-chevron-down",class:Y(["absolute h-3.5 w-3.5 text-gray-500 transition-opacity duration-100 dark:text-gray-400",e.open?"opacity-100":"opacity-0 group-hover/process-toggle:opacity-100"])},null,8,["class"])])}}}),Ql=["aria-expanded","onClick"],Jl={class:"shrink-0 text-gray-600 dark:text-gray-300"},Zl={class:"ml-auto flex min-w-0 items-center gap-2"},Xl={key:0,class:"truncate text-[11px] text-gray-400 dark:text-gray-500"},ec={class:"evidence-details mx-px mt-1 rounded-lg border border-gray-200/60 bg-gray-50/80 px-3 py-2 dark:border-white/5 dark:bg-white/[0.03]"},tc={class:"mb-2 space-y-0.5 text-xs text-gray-600 dark:text-gray-400"},nc={class:"font-medium"},rc={key:0},sc={class:"font-medium"},ac={key:0,class:"mb-2 space-y-1"},ic={key:1,class:"py-1.5 text-center text-xs text-gray-400 dark:text-gray-500"},oc={key:2,class:"space-y-2"},lc={class:"flex items-center gap-2"},cc={class:"ml-auto shrink-0 text-[11px] text-gray-400 dark:text-gray-500"},uc={key:0,class:"mt-1 text-[11px] text-gray-500 dark:text-gray-400"},dc={class:"mt-1 space-y-0.5"},pc=["onClick"],hc={class:"min-w-0 flex-1 text-xs leading-snug text-gray-600 dark:text-gray-300"},fc={key:0,class:"mr-1 text-gray-400 dark:text-gray-500"},gc={class:"line-clamp-2 break-words align-middle"},mc={key:3,class:"mt-1.5 text-right text-[11px] text-gray-400 dark:text-gray-500"},yc=be({__name:"EvidenceBlock",props:{evidence:{}},setup(e){const t=e,{t:n}=qe(),s=Xn(),r=["included","uncertain","excluded"],i=S(()=>[...t.evidence.groups].sort((p,f)=>r.indexOf(p.status)-r.indexOf(f.status))),a=S(()=>t.evidence.groups.reduce((p,f)=>p+f.sources.length,0)),o=S(()=>r.map(p=>({status:p,count:t.evidence.groups.filter(f=>f.status===p).length})).filter(p=>p.count>0)),l=S(()=>t.evidence.warnings??[]),c={included:"bg-emerald-50 text-emerald-600 dark:bg-emerald-900/20 dark:text-emerald-400",uncertain:"bg-amber-50 text-amber-600 dark:bg-amber-900/20 dark:text-amber-400",excluded:"bg-gray-100 text-gray-500 dark:bg-gray-800/40 dark:text-gray-400"},u={included:"bg-emerald-500",uncertain:"bg-amber-500",excluded:"bg-gray-400"};function d(p){s.openChatRecordDrawer({scrollToMessageId:p})}return(p,f)=>{const y=Ne;return m(),se(Kt,{lazy:"",class:"w-full text-[13px]"},{summary:de(({open:_,toggle:M})=>[h("button",{type:"button",class:"group/process-toggle flex h-7 w-full items-center gap-2 rounded-md text-left text-sm leading-7 text-gray-500 transition-colors hover:bg-gray-50/80 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800/30 dark:hover:text-gray-300","aria-expanded":_,onClick:M},[F(Wt,{icon:"i-heroicons-document-magnifying-glass",open:_},null,8,["open"]),h("span",Jl,w(k(n)("ai.chat.evidence.title")),1),h("div",Zl,[(m(!0),x(me,null,_e(o.value,v=>(m(),x("span",{key:v.status,class:"flex shrink-0 items-center gap-1 text-[11px] text-gray-500 dark:text-gray-400"},[h("span",{class:Y(["h-1.5 w-1.5 rounded-full",u[v.status]])},null,2),He(" "+w(k(n)(`ai.chat.evidence.group.${v.status}`))+" "+w(v.count),1)]))),128)),o.value.length===0?(m(),x("span",Xl,w(k(n)("ai.chat.evidence.empty")),1)):U("",!0)])],8,Ql)]),default:de(()=>[h("div",ec,[h("div",tc,[h("div",null,[h("span",nc,w(k(n)("ai.chat.evidence.query"))+":",1),He(" "+w(e.evidence.query),1)]),e.evidence.criteria?(m(),x("div",rc,[h("span",sc,w(k(n)("ai.chat.evidence.criteria"))+":",1),He(" "+w(e.evidence.criteria),1)])):U("",!0)]),l.value.length>0?(m(),x("div",ac,[(m(!0),x(me,null,_e(l.value,_=>(m(),x("div",{key:_,class:"flex items-start gap-1.5 rounded bg-amber-50/70 px-2 py-1 text-[11px] text-amber-600 dark:bg-amber-900/15 dark:text-amber-400"},[F(y,{name:"i-heroicons-exclamation-triangle",class:"mt-0.5 h-3 w-3 shrink-0"}),h("span",null,w(k(n)(`ai.chat.evidence.warning.${_}`)),1)]))),128))])):U("",!0),i.value.length===0?(m(),x("div",ic,w(k(n)("ai.chat.evidence.empty")),1)):(m(),x("div",oc,[(m(!0),x(me,null,_e(i.value,_=>(m(),x("div",{key:_.id,class:"rounded-md border border-gray-200/80 bg-white px-2.5 py-1.5 dark:border-gray-700/50 dark:bg-page-dark/30"},[h("div",lc,[h("span",{class:Y(["rounded px-1.5 py-0.5 text-[11px] font-medium",c[_.status]])},w(k(n)(`ai.chat.evidence.group.${_.status}`)),3),h("span",cc,w(_.title),1)]),_.reason?(m(),x("div",uc,w(_.reason),1)):U("",!0),h("ul",dc,[(m(!0),x(me,null,_e(_.sources,(M,v)=>(m(),x("li",{key:`${_.id}-${v}`,class:"group/source flex cursor-pointer items-start gap-1.5 rounded px-1.5 py-1 transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/40",onClick:C=>d(M.messageId)},[h("div",hc,[M.senderName?(m(),x("span",fc,w(M.senderName)+": ",1)):U("",!0),h("span",gc,w(M.snippet),1)]),F(y,{name:"i-heroicons-arrow-top-right-on-square",class:"mt-0.5 h-3 w-3 shrink-0 text-gray-400 opacity-0 transition-opacity group-hover/source:opacity-100 dark:text-gray-500"})],8,pc))),128))])]))),128))])),i.value.length>0?(m(),x("div",mc,w(k(n)("ai.chat.evidence.totalSources",{count:a.value})),1)):U("",!0)])]),_:1})}}}),vc=nr(yc,[["__scopeId","data-v-812e30c9"]]),kc=["aria-expanded","onClick"],xc={class:"shrink-0 text-gray-600 dark:text-gray-300"},bc={class:"ml-auto shrink-0 text-[11px] text-gray-400 dark:text-gray-500"},wc={class:"cross-chat-evidence-details mx-px mt-1 rounded-lg border border-gray-200/60 bg-gray-50/80 px-3 py-2 dark:border-white/5 dark:bg-white/[0.03]"},_c={class:"mb-2 flex items-start gap-2 text-xs text-gray-500 dark:text-gray-400"},Tc={class:"min-w-0 flex-1"},Cc={class:"text-gray-600 dark:text-gray-300"},Sc={key:0,class:"shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] text-amber-600 dark:bg-amber-900/20 dark:text-amber-400"},Mc={key:0,class:"py-2 text-center text-xs text-gray-400 dark:text-gray-500"},Ac={key:1,class:"space-y-2"},Lc={class:"mb-1 flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300"},$c={class:"min-w-0 flex-1 truncate"},Ec={class:"shrink-0 text-[11px] text-gray-400"},Ic=["onClick"],Rc={class:"min-w-0 flex-1 text-xs leading-snug text-gray-600 dark:text-gray-300"},Pc={class:"mr-1 text-gray-400 dark:text-gray-500"},Hc={class:"line-clamp-2 break-words"},Nc={class:"mt-2 text-right text-[11px] text-gray-400 dark:text-gray-500"},zc=be({__name:"CrossChatEvidenceBlock",props:{evidence:{}},setup(e){const t=e,{t:n}=qe(),s=Xn(),r=S(()=>{const a=new Map;for(const o of t.evidence.sources){const l=a.get(o.sessionId);l?l.sources.push(o):a.set(o.sessionId,{sessionName:o.sessionName,sessionType:o.sessionType,sources:[o]})}return[...a.entries()].map(([o,l])=>({sessionId:o,...l}))});function i(a){s.openChatRecordDrawer({sessionId:a.sessionId,scrollToMessageId:a.messageId})}return(a,o)=>{const l=Ne;return m(),se(Kt,{lazy:"",class:"w-full text-[13px]"},{summary:de(({open:c,toggle:u})=>[h("button",{type:"button",class:"group/process-toggle flex h-7 w-full items-center gap-2 rounded-md text-left text-sm leading-7 text-gray-500 transition-colors hover:bg-gray-50/80 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800/30 dark:hover:text-gray-300","aria-expanded":c,onClick:u},[F(Wt,{icon:"i-heroicons-document-magnifying-glass",open:c},null,8,["open"]),h("span",xc,w(k(n)("ai.chat.crossChatEvidence.title")),1),h("span",bc,w(k(n)("ai.chat.crossChatEvidence.summary",{sources:e.evidence.sources.length,sessions:r.value.length})),1)],8,kc)]),default:de(()=>[h("div",wc,[h("div",_c,[h("span",Tc,[h("span",Cc,w(k(n)("ai.chat.crossChatEvidence.query"))+":",1),He(" "+w(e.evidence.query),1)]),e.evidence.coverage.truncated?(m(),x("span",Sc,w(k(n)("ai.chat.crossChatEvidence.partial")),1)):U("",!0)]),r.value.length===0?(m(),x("div",Mc,w(k(n)("ai.chat.crossChatEvidence.empty")),1)):(m(),x("div",Ac,[(m(!0),x(me,null,_e(r.value,c=>(m(),x("section",{key:c.sessionId,class:"rounded-md border border-gray-200/80 bg-white px-2.5 py-2 dark:border-gray-700/50 dark:bg-page-dark/30"},[h("div",Lc,[F(l,{name:c.sessionType==="group"?"i-heroicons-user-group":"i-heroicons-user",class:"h-3.5 w-3.5 shrink-0 text-gray-400"},null,8,["name"]),h("span",$c,w(c.sessionName),1),h("span",Ec,w(k(n)("ai.chat.crossChatEvidence.sourceCount",{count:c.sources.length})),1)]),(m(!0),x(me,null,_e(c.sources,u=>(m(),x("button",{key:`${u.sessionId}:${u.messageId}`,type:"button",class:"group/source flex w-full items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/40",onClick:d=>i(u)},[h("div",Rc,[h("span",Pc,w(u.senderName)+":",1),h("span",Hc,w(u.snippet),1)]),F(l,{name:"i-heroicons-arrow-top-right-on-square",class:"mt-0.5 h-3 w-3 shrink-0 text-gray-400 opacity-0 transition-opacity group-hover/source:opacity-100"})],8,Ic))),128))]))),128))])),h("p",Nc,w(k(n)("ai.chat.crossChatEvidence.coverage",{scanned:e.evidence.coverage.scannedSessions,candidates:e.evidence.coverage.candidateSessions})),1)])]),_:1})}}}),Oc=nr(zc,[["__scopeId","data-v-8bc36d76"]]),Bc=/^\s*!\[[^\]\n]*\]\(\s*(?:(?:https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?)?\/?|\.\/)?chart[\w-]*(?:\.(?:png|jpg|jpeg|webp|svg))?(?:\?[^)\s]*)?\s*(?:"[^"]*")?\s*\)\s*$/gim;function Dc(e){return e&&e.replace(Bc,"").replace(/\n{3,}/g,`
6
+ `);navigator.clipboard.writeText(l).then(()=>{n.success(t("ai.chat.error.copied"))})}return(l,c)=>{const u=Ne,d=tr,p=ta;return m(),ae(p,{open:s.value,"onUpdate:open":c[1]||(c[1]=f=>s.value=f),ui:{content:"sm:max-w-[700px] z-[100]",overlay:"backdrop-blur-sm z-[99]"}},{content:de(()=>[h("div",el,[h("div",tl,[h("div",nl,[h("div",rl,[h("div",sl,[F(u,{name:"i-heroicons-exclamation-triangle",class:"h-4 w-4 text-red-600 dark:text-red-400"})]),h("h2",al,w(k(t)("ai.chat.error.detail")),1)]),F(d,{icon:"i-heroicons-x-mark",variant:"ghost",color:"neutral",size:"sm",onClick:c[0]||(c[0]=f=>s.value=!1)})])]),h("div",il,[h("div",ol,[(m(!0),x(me,null,_e(i.value,(f,y)=>(m(),x("div",{key:y,class:"flex flex-col gap-1.5"},[h("div",ll,w(f.label),1),f.isStack?(m(),x("div",cl,[h("pre",ul,w(f.value),1)])):f.isCode?(m(),x("div",dl,[h("pre",pl,w(f.value),1)])):(m(),x("div",hl,w(f.value),1))]))),128)),i.value.length===0?(m(),x("div",fl,w(k(t)("ai.chat.error.unknown")),1)):q("",!0)])]),h("div",gl,[h("div",ml,[F(d,{icon:"i-heroicons-document-duplicate",variant:"soft",color:"neutral",size:"sm",onClick:o},{default:de(()=>[He(w(k(t)("ai.chat.error.copyAll")),1)]),_:1})])])])]),_:1},8,["open"])}}}),vl={class:"min-w-0 flex-1 truncate"},kl={class:"shrink-0 text-[11px] text-amber-600/80 dark:text-amber-400/80"},xl={class:"mb-1.5 flex items-center gap-2"},bl={class:"flex shrink-0 items-center justify-center text-red-500 dark:text-red-400"},wl={class:"pr-5 text-[13px] font-semibold leading-[1.4] text-red-600 dark:text-red-400"},_l={class:"ml-6 line-clamp-3 break-words text-xs leading-normal text-gray-600 dark:text-gray-400"},Tl={class:"mt-2.5 ml-6 flex items-center"},Cl={class:"ml-auto inline-flex items-center gap-0.5 text-xs text-gray-400 transition-colors duration-150 group-hover:text-red-500 dark:text-gray-500 dark:group-hover:text-red-400"},Sl=be({__name:"ErrorBlock",props:{error:{},compact:{type:Boolean}},setup(e){const{t}=qe(),n=e,s=J(!1);function r(i){return i.friendlyMessage||i.message||t("ai.chat.error.unknown")}return(i,a)=>{const o=Ne;return m(),x(me,null,[n.compact?(m(),x("button",{key:0,type:"button",class:"flex w-full min-w-0 items-start gap-2 rounded-md py-1 text-left text-xs text-amber-700 transition-colors hover:bg-amber-50/70 dark:text-amber-300 dark:hover:bg-amber-950/20",onClick:a[0]||(a[0]=l=>s.value=!0)},[F(o,{name:"i-heroicons-exclamation-circle",class:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),h("span",vl,w(r(e.error)),1),h("span",kl,w(k(t)("ai.chat.error.viewDetail")),1)])):(m(),x("div",{key:1,class:"group relative my-2 w-full min-w-[320px] cursor-pointer rounded-lg border border-red-200 bg-red-50/60 px-3.5 py-3 text-[13px] transition-all duration-200 hover:border-red-300 hover:bg-red-50 dark:border-red-900/30 dark:bg-red-950/20 dark:hover:border-red-800/50 dark:hover:bg-red-950/30",onClick:a[1]||(a[1]=l=>s.value=!0)},[h("div",xl,[h("div",bl,[F(o,{name:"i-heroicons-exclamation-triangle",class:"h-4 w-4"})]),h("div",wl,w(k(t)("ai.chat.error.title")),1)]),h("div",_l,w(r(e.error)),1),h("div",Tl,[h("div",Cl,[He(w(k(t)("ai.chat.error.viewDetail"))+" ",1),F(o,{name:"i-heroicons-chevron-right",class:"h-3.5 w-3.5"})])])])),F(yl,{open:s.value,"onUpdate:open":a[2]||(a[2]=l=>s.value=l),error:e.error},null,8,["open","error"])],64)}}}),Ml={class:"my-2 w-full overflow-hidden rounded-lg border border-gray-200 bg-white/80 dark:border-gray-700/70 dark:bg-page-dark/70"},Al={class:"border-b border-gray-100 px-3 py-2 dark:border-gray-800"},Ll={class:"flex min-w-0 items-start justify-between gap-3"},$l={class:"min-w-0"},El={class:"truncate text-sm font-semibold text-gray-900 dark:text-gray-100"},Il={key:0,class:"mt-0.5 line-clamp-2 text-xs text-gray-500 dark:text-gray-400"},Rl={class:"flex shrink-0 items-center gap-1.5"},Pl={class:"rounded-md bg-gray-100 px-1.5 py-0.5 text-[10px] uppercase text-gray-500 dark:bg-gray-800"},Hl={class:"flex max-h-[92vh] flex-col overflow-hidden bg-white dark:bg-page-dark"},Nl={class:"flex items-start justify-between gap-4 border-b border-gray-200 px-5 py-4 dark:border-gray-800"},zl={class:"min-w-0"},Ol={class:"truncate text-base font-semibold text-gray-900 dark:text-gray-100"},Bl={key:0,class:"mt-1 line-clamp-2 text-xs text-gray-500 dark:text-gray-400"},Dl={class:"mt-1 text-[11px] text-gray-400 dark:text-gray-500"},jl={class:"min-h-0 flex-1 overflow-auto p-4"},Fl={key:0,class:"flex h-64 items-center justify-center text-xs text-gray-400 dark:text-gray-500"},ql={class:"mt-1 text-[11px] text-gray-400 dark:text-gray-500"},Ul={class:"px-2 py-3"},Kl={key:0,class:"flex h-32 items-center justify-center text-xs text-gray-400 dark:text-gray-500"},Wl=be({__name:"ChartBlockRenderer",props:{chart:{}},setup(e){const{t}=qe(),n=e,s=J(!1),r=S(()=>n.chart.spec.title),i=S(()=>n.chart.spec.subtitle||n.chart.spec.description||""),a=S(()=>n.chart.spec.display?.height??(n.chart.spec.type==="heatmap"?300:260)),o=S(()=>n.chart.rowCount===0),l=S(()=>{const v=[];return n.chart.spec.unit&&v.push(n.chart.spec.unit),n.chart.truncated&&v.push(t("ai.chat.message.chart.truncated")),v.push(t("ai.chat.message.chart.rows",{count:n.chart.rowCount})),v.join(" · ")}),c=S(()=>n.chart.data),u=S(()=>n.chart.data),d=S(()=>n.chart.data),p=S(()=>n.chart.data),f=S(()=>n.chart.spec.type==="pie"?d.value.labels.length>8:n.chart.spec.type==="line"?u.value.labels.length>28||(u.value.series?.length??0)>4:n.chart.spec.type==="bar"?c.value.labels.length>12:n.chart.spec.type==="heatmap"?p.value.xLabels.length*p.value.yLabels.length>180:!1),y=S(()=>{const v=f.value?320:380;return Math.min(a.value,v)}),_=S(()=>{const v=a.value;if(n.chart.spec.type==="pie")return Math.max(v,560);if(n.chart.spec.type==="line")return Math.max(v,u.value.labels.length>40?620:540);if(n.chart.spec.type==="bar"){const C=n.chart.spec.display?.horizontal?c.value.labels.length*28+120:520;return Math.min(Math.max(v,C),820)}return n.chart.spec.type==="heatmap"?Math.min(Math.max(v,p.value.yLabels.length*22+150,560),860):Math.max(v,520)}),M=S(()=>n.chart.spec.type==="pie"?"640px":n.chart.spec.type==="bar"?"720px":"780px");return(v,C)=>{const z=tr,L=ta;return m(),x("div",Ml,[h("div",Al,[h("div",Ll,[h("div",$l,[h("h3",El,w(r.value),1),i.value?(m(),x("p",Il,w(i.value),1)):q("",!0)]),h("div",Rl,[h("span",Pl,w(e.chart.spec.type),1),F(L,{open:s.value,"onUpdate:open":C[2]||(C[2]=E=>s.value=E),ui:{overlay:"z-[10040] backdrop-blur-sm",content:"z-[10050] w-[96vw] max-w-6xl max-h-[92vh] overflow-hidden"}},{content:de(()=>[h("div",Hl,[h("div",Nl,[h("div",zl,[h("h3",Ol,w(r.value),1),i.value?(m(),x("p",Bl,w(i.value),1)):q("",!0),h("p",Dl,w(l.value),1)]),F(z,{icon:"i-heroicons-x-mark",size:"sm",color:"neutral",variant:"ghost",class:"shrink-0",title:k(t)("common.close"),"aria-label":k(t)("common.close"),onClick:C[1]||(C[1]=E=>s.value=!1)},null,8,["title","aria-label"])]),h("div",jl,[h("div",{class:"mx-auto w-full",style:xi({minWidth:M.value})},[o.value?(m(),x("div",Fl,w(k(t)("ai.chat.message.chart.empty")),1)):e.chart.spec.type==="bar"?(m(),ae(hs,{key:1,data:c.value,height:_.value,mode:"expanded",horizontal:e.chart.spec.display?.horizontal},null,8,["data","height","horizontal"])):e.chart.spec.type==="line"?(m(),ae(fs,{key:2,data:u.value,height:_.value,mode:"expanded"},null,8,["data","height"])):e.chart.spec.type==="pie"?(m(),ae(bs,{key:3,data:d.value,height:_.value,mode:"expanded","show-legend":e.chart.spec.display?.showLegend??!0},null,8,["data","height","show-legend"])):e.chart.spec.type==="heatmap"?(m(),ae(ws,{key:4,data:p.value,height:_.value,mode:"expanded"},null,8,["data","height"])):q("",!0)],4)])])]),default:de(()=>[F(z,{icon:"i-heroicons-arrows-pointing-out",size:"xs",color:"neutral",variant:"ghost",class:"no-capture",title:k(t)("ai.chat.message.chart.expand"),"aria-label":k(t)("ai.chat.message.chart.expand"),onClick:C[0]||(C[0]=mt(()=>{},["stop"]))},null,8,["title","aria-label"])]),_:1},8,["open"])])]),h("p",ql,w(l.value),1)]),h("div",Ul,[o.value?(m(),x("div",Kl,w(k(t)("ai.chat.message.chart.empty")),1)):e.chart.spec.type==="bar"?(m(),ae(hs,{key:1,data:c.value,height:y.value,mode:"compact",horizontal:e.chart.spec.display?.horizontal},null,8,["data","height","horizontal"])):e.chart.spec.type==="line"?(m(),ae(fs,{key:2,data:u.value,height:y.value,mode:"compact"},null,8,["data","height"])):e.chart.spec.type==="pie"?(m(),ae(bs,{key:3,data:d.value,height:y.value,mode:"compact","show-legend":e.chart.spec.display?.showLegend??!0},null,8,["data","height","show-legend"])):e.chart.spec.type==="heatmap"?(m(),ae(ws,{key:4,data:p.value,height:y.value,mode:"compact"},null,8,["data","height"])):q("",!0)])])}}}),Vl=["data-open","aria-hidden","inert"],Gl={class:"ai-process-fold-inner"},Kt=be({__name:"ProcessDisclosure",props:{lazy:{type:Boolean,default:!1}},setup(e){const t=e,n=J(!1),s=J(!1);function r(){n.value||(s.value=!0),n.value=!n.value}return(i,a)=>(m(),x("div",null,[Rt(i.$slots,"summary",{open:n.value,toggle:r}),h("div",{class:"ai-process-fold","data-open":n.value||void 0,"aria-hidden":!n.value,inert:n.value?void 0:!0},[h("div",Gl,[!t.lazy||s.value?Rt(i.$slots,"default",{key:0}):q("",!0)])],8,Vl)]))}}),Yl={class:"relative flex h-4 w-4 shrink-0 items-center justify-center","aria-hidden":"true"},Wt=be({__name:"ProcessDisclosureIcon",props:{icon:{},open:{type:Boolean},iconClass:{default:"text-gray-400 dark:text-gray-500"}},setup(e){return(t,n)=>{const s=Ne;return m(),x("span",Yl,[e.open?q("",!0):(m(),ae(s,{key:0,name:e.icon,class:Y(["absolute h-3.5 w-3.5 transition-opacity duration-100 group-hover/process-toggle:opacity-0",e.iconClass])},null,8,["name","class"])),F(s,{name:"i-heroicons-chevron-down",class:Y(["absolute h-3.5 w-3.5 text-gray-500 transition-opacity duration-100 dark:text-gray-400",e.open?"opacity-100":"opacity-0 group-hover/process-toggle:opacity-100"])},null,8,["class"])])}}}),Ql=["aria-expanded","onClick"],Jl={class:"shrink-0 text-gray-600 dark:text-gray-300"},Zl={class:"ml-auto flex min-w-0 items-center gap-2"},Xl={key:0,class:"truncate text-[11px] text-gray-400 dark:text-gray-500"},ec={class:"evidence-details mx-px mt-1 rounded-lg border border-gray-200/60 bg-gray-50/80 px-3 py-2 dark:border-white/5 dark:bg-white/[0.03]"},tc={class:"mb-2 space-y-0.5 text-xs text-gray-600 dark:text-gray-400"},nc={class:"font-medium"},rc={key:0},sc={class:"font-medium"},ac={key:0,class:"mb-2 space-y-1"},ic={key:1,class:"py-1.5 text-center text-xs text-gray-400 dark:text-gray-500"},oc={key:2,class:"space-y-2"},lc={class:"flex items-center gap-2"},cc={class:"ml-auto shrink-0 text-[11px] text-gray-400 dark:text-gray-500"},uc={key:0,class:"mt-1 text-[11px] text-gray-500 dark:text-gray-400"},dc={class:"mt-1 space-y-0.5"},pc=["onClick"],hc={class:"min-w-0 flex-1 text-xs leading-snug text-gray-600 dark:text-gray-300"},fc={key:0,class:"mr-1 text-gray-400 dark:text-gray-500"},gc={class:"line-clamp-2 break-words align-middle"},mc={key:3,class:"mt-1.5 text-right text-[11px] text-gray-400 dark:text-gray-500"},yc=be({__name:"EvidenceBlock",props:{evidence:{}},setup(e){const t=e,{t:n}=qe(),s=Xn(),r=["included","uncertain","excluded"],i=S(()=>[...t.evidence.groups].sort((p,f)=>r.indexOf(p.status)-r.indexOf(f.status))),a=S(()=>t.evidence.groups.reduce((p,f)=>p+f.sources.length,0)),o=S(()=>r.map(p=>({status:p,count:t.evidence.groups.filter(f=>f.status===p).length})).filter(p=>p.count>0)),l=S(()=>t.evidence.warnings??[]),c={included:"bg-emerald-50 text-emerald-600 dark:bg-emerald-900/20 dark:text-emerald-400",uncertain:"bg-amber-50 text-amber-600 dark:bg-amber-900/20 dark:text-amber-400",excluded:"bg-gray-100 text-gray-500 dark:bg-gray-800/40 dark:text-gray-400"},u={included:"bg-emerald-500",uncertain:"bg-amber-500",excluded:"bg-gray-400"};function d(p){s.openChatRecordDrawer({scrollToMessageId:p})}return(p,f)=>{const y=Ne;return m(),ae(Kt,{lazy:"",class:"w-full text-[13px]"},{summary:de(({open:_,toggle:M})=>[h("button",{type:"button",class:"group/process-toggle flex h-7 w-full items-center gap-2 rounded-md text-left text-sm leading-7 text-gray-500 transition-colors hover:bg-gray-50/80 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800/30 dark:hover:text-gray-300","aria-expanded":_,onClick:M},[F(Wt,{icon:"i-heroicons-document-magnifying-glass",open:_},null,8,["open"]),h("span",Jl,w(k(n)("ai.chat.evidence.title")),1),h("div",Zl,[(m(!0),x(me,null,_e(o.value,v=>(m(),x("span",{key:v.status,class:"flex shrink-0 items-center gap-1 text-[11px] text-gray-500 dark:text-gray-400"},[h("span",{class:Y(["h-1.5 w-1.5 rounded-full",u[v.status]])},null,2),He(" "+w(k(n)(`ai.chat.evidence.group.${v.status}`))+" "+w(v.count),1)]))),128)),o.value.length===0?(m(),x("span",Xl,w(k(n)("ai.chat.evidence.empty")),1)):q("",!0)])],8,Ql)]),default:de(()=>[h("div",ec,[h("div",tc,[h("div",null,[h("span",nc,w(k(n)("ai.chat.evidence.query"))+":",1),He(" "+w(e.evidence.query),1)]),e.evidence.criteria?(m(),x("div",rc,[h("span",sc,w(k(n)("ai.chat.evidence.criteria"))+":",1),He(" "+w(e.evidence.criteria),1)])):q("",!0)]),l.value.length>0?(m(),x("div",ac,[(m(!0),x(me,null,_e(l.value,_=>(m(),x("div",{key:_,class:"flex items-start gap-1.5 rounded bg-amber-50/70 px-2 py-1 text-[11px] text-amber-600 dark:bg-amber-900/15 dark:text-amber-400"},[F(y,{name:"i-heroicons-exclamation-triangle",class:"mt-0.5 h-3 w-3 shrink-0"}),h("span",null,w(k(n)(`ai.chat.evidence.warning.${_}`)),1)]))),128))])):q("",!0),i.value.length===0?(m(),x("div",ic,w(k(n)("ai.chat.evidence.empty")),1)):(m(),x("div",oc,[(m(!0),x(me,null,_e(i.value,_=>(m(),x("div",{key:_.id,class:"rounded-md border border-gray-200/80 bg-white px-2.5 py-1.5 dark:border-gray-700/50 dark:bg-page-dark/30"},[h("div",lc,[h("span",{class:Y(["rounded px-1.5 py-0.5 text-[11px] font-medium",c[_.status]])},w(k(n)(`ai.chat.evidence.group.${_.status}`)),3),h("span",cc,w(_.title),1)]),_.reason?(m(),x("div",uc,w(_.reason),1)):q("",!0),h("ul",dc,[(m(!0),x(me,null,_e(_.sources,(M,v)=>(m(),x("li",{key:`${_.id}-${v}`,class:"group/source flex cursor-pointer items-start gap-1.5 rounded px-1.5 py-1 transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/40",onClick:C=>d(M.messageId)},[h("div",hc,[M.senderName?(m(),x("span",fc,w(M.senderName)+": ",1)):q("",!0),h("span",gc,w(M.snippet),1)]),F(y,{name:"i-heroicons-arrow-top-right-on-square",class:"mt-0.5 h-3 w-3 shrink-0 text-gray-400 opacity-0 transition-opacity group-hover/source:opacity-100 dark:text-gray-500"})],8,pc))),128))])]))),128))])),i.value.length>0?(m(),x("div",mc,w(k(n)("ai.chat.evidence.totalSources",{count:a.value})),1)):q("",!0)])]),_:1})}}}),vc=nr(yc,[["__scopeId","data-v-812e30c9"]]),kc=["aria-expanded","onClick"],xc={class:"shrink-0 text-gray-600 dark:text-gray-300"},bc={class:"ml-auto shrink-0 text-[11px] text-gray-400 dark:text-gray-500"},wc={class:"cross-chat-evidence-details mx-px mt-1 rounded-lg border border-gray-200/60 bg-gray-50/80 px-3 py-2 dark:border-white/5 dark:bg-white/[0.03]"},_c={class:"mb-2 flex items-start gap-2 text-xs text-gray-500 dark:text-gray-400"},Tc={class:"min-w-0 flex-1"},Cc={class:"text-gray-600 dark:text-gray-300"},Sc={key:0,class:"shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] text-amber-600 dark:bg-amber-900/20 dark:text-amber-400"},Mc={key:0,class:"py-2 text-center text-xs text-gray-400 dark:text-gray-500"},Ac={key:1,class:"space-y-2"},Lc={class:"mb-1 flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300"},$c={class:"min-w-0 flex-1 truncate"},Ec={class:"shrink-0 text-[11px] text-gray-400"},Ic=["onClick"],Rc={class:"min-w-0 flex-1 text-xs leading-snug text-gray-600 dark:text-gray-300"},Pc={class:"mr-1 text-gray-400 dark:text-gray-500"},Hc={class:"line-clamp-2 break-words"},Nc={class:"mt-2 text-right text-[11px] text-gray-400 dark:text-gray-500"},zc=be({__name:"CrossChatEvidenceBlock",props:{evidence:{}},setup(e){const t=e,{t:n}=qe(),s=Xn(),r=S(()=>{const a=new Map;for(const o of t.evidence.sources){const l=a.get(o.sessionId);l?l.sources.push(o):a.set(o.sessionId,{sessionName:o.sessionName,sessionType:o.sessionType,sources:[o]})}return[...a.entries()].map(([o,l])=>({sessionId:o,...l}))});function i(a){s.openChatRecordDrawer({sessionId:a.sessionId,scrollToMessageId:a.messageId})}return(a,o)=>{const l=Ne;return m(),ae(Kt,{lazy:"",class:"w-full text-[13px]"},{summary:de(({open:c,toggle:u})=>[h("button",{type:"button",class:"group/process-toggle flex h-7 w-full items-center gap-2 rounded-md text-left text-sm leading-7 text-gray-500 transition-colors hover:bg-gray-50/80 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800/30 dark:hover:text-gray-300","aria-expanded":c,onClick:u},[F(Wt,{icon:"i-heroicons-document-magnifying-glass",open:c},null,8,["open"]),h("span",xc,w(k(n)("ai.chat.crossChatEvidence.title")),1),h("span",bc,w(k(n)("ai.chat.crossChatEvidence.summary",{sources:e.evidence.sources.length,sessions:r.value.length})),1)],8,kc)]),default:de(()=>[h("div",wc,[h("div",_c,[h("span",Tc,[h("span",Cc,w(k(n)("ai.chat.crossChatEvidence.query"))+":",1),He(" "+w(e.evidence.query),1)]),e.evidence.coverage.truncated?(m(),x("span",Sc,w(k(n)("ai.chat.crossChatEvidence.partial")),1)):q("",!0)]),r.value.length===0?(m(),x("div",Mc,w(k(n)("ai.chat.crossChatEvidence.empty")),1)):(m(),x("div",Ac,[(m(!0),x(me,null,_e(r.value,c=>(m(),x("section",{key:c.sessionId,class:"rounded-md border border-gray-200/80 bg-white px-2.5 py-2 dark:border-gray-700/50 dark:bg-page-dark/30"},[h("div",Lc,[F(l,{name:c.sessionType==="group"?"i-heroicons-user-group":"i-heroicons-user",class:"h-3.5 w-3.5 shrink-0 text-gray-400"},null,8,["name"]),h("span",$c,w(c.sessionName),1),h("span",Ec,w(k(n)("ai.chat.crossChatEvidence.sourceCount",{count:c.sources.length})),1)]),(m(!0),x(me,null,_e(c.sources,u=>(m(),x("button",{key:`${u.sessionId}:${u.messageId}`,type:"button",class:"group/source flex w-full items-start gap-2 rounded px-1.5 py-1 text-left transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/40",onClick:d=>i(u)},[h("div",Rc,[h("span",Pc,w(u.senderName)+":",1),h("span",Hc,w(u.snippet),1)]),F(l,{name:"i-heroicons-arrow-top-right-on-square",class:"mt-0.5 h-3 w-3 shrink-0 text-gray-400 opacity-0 transition-opacity group-hover/source:opacity-100"})],8,Ic))),128))]))),128))])),h("p",Nc,w(k(n)("ai.chat.crossChatEvidence.coverage",{scanned:e.evidence.coverage.scannedSessions,candidates:e.evidence.coverage.candidateSessions})),1)])]),_:1})}}}),Oc=nr(zc,[["__scopeId","data-v-8bc36d76"]]),Bc=/^\s*!\[[^\]\n]*\]\(\s*(?:(?:https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?)?\/?|\.\/)?chart[\w-]*(?:\.(?:png|jpg|jpeg|webp|svg))?(?:\?[^)\s]*)?\s*(?:"[^"]*")?\s*\)\s*$/gim;function Dc(e){return e&&e.replace(Bc,"").replace(/\n{3,}/g,`
7
7
 
8
8
  `).replace(/^\n+|\n+$/g,"")}const jc=["data-follow-end"],_s=be({__name:"LiveFollowText",props:{text:{},followEnd:{type:Boolean,default:!1}},setup(e){const t=e,n=J(null);let s=null;function r(){const a=n.value;a&&(a.scrollLeft=t.followEnd?Math.max(0,a.scrollWidth-a.clientWidth):0)}function i(){if(s!==null)return;let a=3;const o=()=>{if(a-=1,a>0){s=requestAnimationFrame(o);return}s=null,r()};s=requestAnimationFrame(o)}return Te(()=>[t.text,t.followEnd],async()=>{await Oe(),i()},{flush:"post",immediate:!0}),_t(()=>{s!==null&&cancelAnimationFrame(s)}),(a,o)=>(m(),x("span",{ref_key:"el",ref:n,class:Y(["min-w-0 flex-1 overflow-hidden whitespace-nowrap text-gray-400 dark:text-gray-500",[t.followEnd?"":"text-ellipsis"]]),"data-follow-end":t.followEnd||void 0},w(t.text),11,jc))}});function ur(e){const t=e.indexOf(`
9
9
  `);return t===-1?e:e.slice(0,t)}function Ts(e){const t=e.trimEnd(),n=t.lastIndexOf(`
10
- `);return n===-1?t:t.slice(n+1)}function Fc(e,t,n){for(let s=t+1;s<e.length;s+=1)if(n(e[s]))return!0;return!1}function qc(e,t){const n=[];let s=[];const r=()=>{s.length!==0&&(n.push({type:"process",blocks:s}),s=[])};for(const i of e){if(t(i)){s.push(i);continue}r(),n.push({type:"visible",block:i})}return r(),n}function Uc(e,t,n){const s=e.map((o,l)=>t(o)||n(o)&&Fc(e,l,t)),r=e.filter((o,l)=>s[l]),i=s.findIndex(Boolean),a=[];return e.forEach((o,l)=>{if(l===i){a.push({type:"process",blocks:r});return}s[l]||a.push({type:"visible",block:o})}),a}function Kc(e,t){return t.mode==="timeline"?qc(e,t.isFoldableProcessBlock):Uc(e,t.isFoldableProcessBlock,t.isTextBlock)}function Wc(e,t,n){return n&&t===e.length-1&&e[t]?.type==="process"}function Vc(e){return e.flatMap(t=>t.type==="visible"?[t.block]:[])}function Gc(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.type==="think"&&n.tag?.toLowerCase()!=="plan_validation"&&n.text?.trim())return n}}function Yc(e,t){const n=Math.max(0,Math.round(e/1e3));if(t.startsWith("zh")||t.startsWith("ja")){if(n<60)return`${n}秒`;if(n<3600){const c=Math.floor(n/60),u=n%60;return`${c}分${u.toString().padStart(2,"0")}秒`}const a=Math.floor(n/3600),o=Math.floor(n%3600/60),l=n%60;return`${a}时${o.toString().padStart(2,"0")}分${l.toString().padStart(2,"0")}秒`}if(n<60)return`${n}s`;if(n<3600){const a=Math.floor(n/60),o=n%60;return`${a}m ${o.toString().padStart(2,"0")}s`}const s=Math.floor(n/3600),r=Math.floor(n%3600/60),i=n%60;return`${s}h ${r.toString().padStart(2,"0")}m ${i.toString().padStart(2,"0")}s`}function Qc(e,t){return e.type!=="process"?0:e.blocks.reduce((n,s)=>n+(t(s)??0),0)}function Jc(e){return e.isStreaming?e.liveElapsedMs:e.settledElapsedMs||e.recordedElapsedMs}function Zc(e){if(e.isActive&&e.activeToolName)return{type:"tool",name:e.activeToolName,progressPhase:e.activeToolProgressPhase};if(e.isActive&&e.lastFoldable){if(e.lastFoldable.kind==="think")return{type:"think"};if(e.lastFoldable.kind==="skill"&&e.lastFoldable.name)return{type:"skill",name:e.lastFoldable.name};if(e.lastFoldable.kind==="plan"||e.lastFoldable.kind==="plan_draft")return{type:"plan"};if(e.lastFoldable.kind==="tool"&&e.lastFoldable.name)return{type:"tool",name:e.lastFoldable.name}}return{type:"generic"}}const Xc=["data-ai-message-id"],eu={key:0,class:"w-full rounded-lg border border-gray-200 bg-gray-50/80 dark:border-gray-700/50 dark:bg-gray-800/40"},tu={class:"flex cursor-pointer select-none items-center gap-2 px-3 py-2 text-xs font-medium text-gray-500 transition-colors hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"},nu={class:"border-t border-gray-200/60 px-3 py-2.5 dark:border-gray-700/40"},ru=["innerHTML"],su={class:"mt-2 text-[11px] text-gray-400 dark:text-gray-500"},au={key:0,class:"rounded-2xl bg-gray-100 p-4 text-gray-900 dark:bg-gray-800 dark:text-gray-100"},iu=["onKeydown"],ou={class:"mt-2 flex justify-end"},lu={class:"flex gap-2"},cu={key:1,class:"ai-user-bubble w-fit max-w-full rounded-3xl bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-100"},uu={key:0,class:"mb-1.5 flex flex-wrap gap-1.5"},du=["innerHTML"],pu=["data-running","aria-expanded","onClick"],hu={key:0,class:"relative mr-1.5 flex h-4 w-4 shrink-0 items-center justify-center"},fu={key:0},gu=["data-open"],mu=["innerHTML"],yu={key:0,class:"ml-1 inline-block h-4 w-1.5 animate-pulse rounded-sm bg-gray-800 dark:bg-gray-200"},vu=["data-running","aria-expanded","onClick"],ku={class:"shrink-0 text-gray-600 dark:text-gray-300"},xu={key:0,class:"mx-2 h-0.5 w-0.5 shrink-0 rounded-full bg-gray-300 dark:bg-gray-600","aria-hidden":"true"},bu={key:2,class:"ml-3 shrink-0 text-xs text-gray-400 dark:text-gray-500"},wu={class:"prose prose-sm ai-process-detail-content ai-thought-content dark:prose-invert mt-1 max-w-none pl-[22px]"},_u={key:0,class:"mb-2 font-medium text-gray-700 dark:text-gray-200"},Tu={class:"not-prose space-y-2 text-xs leading-relaxed"},Cu={class:"font-medium text-gray-800 dark:text-gray-200"},Su={key:0,class:"mt-1 text-gray-500 dark:text-gray-400"},Mu={class:"mt-0.5 text-gray-500 dark:text-gray-400"},Au={key:1,class:"not-prose mt-2 border-t border-gray-100 pt-2 dark:border-gray-800"},Lu={class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},$u={class:"mt-1 list-disc space-y-0.5 pl-4 text-xs leading-relaxed text-gray-600 dark:text-gray-300"},Eu=["innerHTML"],Iu=["aria-expanded","onClick"],Ru={class:"min-w-0 truncate text-gray-600 dark:text-gray-300"},Pu={class:"mt-2 pl-[22px] text-sm leading-6"},Hu=["innerHTML"],Nu={key:1,class:"space-y-2"},zu={class:"font-medium text-gray-800 dark:text-gray-200"},Ou={class:"mt-1 text-gray-500 dark:text-gray-400"},Bu={class:"mt-0.5 text-gray-500 dark:text-gray-400"},Du={key:2,class:"mt-2 border-t border-gray-100 pt-2 dark:border-gray-800"},ju={class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},Fu={class:"mt-1 list-disc space-y-0.5 pl-4 text-xs leading-relaxed text-gray-600 dark:text-gray-300"},qu={key:4,class:"py-1 text-sm text-gray-600 dark:text-gray-400"},Uu={class:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-300"},Ku={key:0,class:"text-[11px] font-normal text-gray-400 dark:text-gray-500"},Wu=["innerHTML"],Vu=["aria-expanded","onClick"],Gu={key:0,class:"min-w-0 truncate text-xs text-gray-400 dark:text-gray-500"},Yu={class:"ml-auto shrink-0 text-xs text-gray-400 dark:text-gray-500"},Qu={class:"mx-px mt-1 overflow-hidden rounded-lg border border-gray-200/60 bg-gray-50/80 dark:border-white/5 dark:bg-white/[0.03]"},Ju={class:"flex items-center justify-between gap-2 border-b border-gray-200/60 px-3 py-2 dark:border-white/5"},Zu={class:"text-xs font-medium text-gray-500 dark:text-gray-400"},Xu={key:0,class:"border-b border-amber-200/70 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-300"},ed={class:"ai-tool-result-scroll whitespace-pre-wrap break-words px-3 py-2.5 text-xs leading-relaxed text-gray-700 dark:text-gray-200"},td=["data-running"],nd={key:0,class:"min-w-0 truncate text-xs text-gray-400 dark:text-gray-500"},rd={key:1,class:"ml-auto shrink-0 text-xs text-gray-400 dark:text-gray-500"},sd={key:3,class:"py-1 text-gray-900 dark:text-gray-100"},ad=["innerHTML"],id={key:0,class:"ml-1 inline-block h-4 w-1.5 animate-pulse rounded-sm bg-gray-800 dark:bg-gray-200"},od={key:4,class:"ai-message-actions mt-1 flex items-center gap-2 px-1"},ld={class:"max-w-0 overflow-hidden text-xs whitespace-nowrap text-gray-400 opacity-0 transition-[max-width,opacity] duration-150 group-hover/message:max-w-[12rem] group-hover/message:opacity-100 group-focus-within/message:max-w-[12rem] group-focus-within/message:opacity-100"},cd=32,gg=be({__name:"ChatMessage",props:{messageId:{},role:{},content:{},timestamp:{},isStreaming:{type:Boolean},processDurationMs:{},contentBlocks:{},showCaptureButton:{type:Boolean},highlighted:{type:Boolean},editable:{type:Boolean},activeTool:{},entityRefs:{}},emits:["edit","fork"],setup(e,{emit:t}){const{t:n,te:s,locale:r}=qe(),i=Br(),a=e,o=t,l=S(()=>{const g=Je(a.timestamp);if(g.isSame(Je(),"day"))return g.format("HH:mm");const b=r.value.startsWith("zh")||r.value.startsWith("ja");return g.isSame(Je(),"year")?g.format(b?"M月D日 HH:mm":"M/D HH:mm"):g.format(b?"YYYY年M月D日 HH:mm":"YYYY/M/D HH:mm")}),c=S(()=>a.role==="user"),u=S(()=>a.role==="summary"),d=J(!1),p=J(a.content),f=J(null),y=S(()=>c.value&&a.editable&&!a.isStreaming&&!!a.messageId),_=S(()=>!c.value&&!u.value&&!a.isStreaming&&!!a.messageId),M=new da({html:!1,breaks:!0,linkify:!0,typographer:!0});M.renderer.rules.link_open=(g,b,T,Q,D)=>(g[b].attrSet("target","_blank"),g[b].attrSet("rel","noopener noreferrer"),D.renderToken(g,b,T));const v=new Map;function C(g){if(!g)return"";const b=v.get(g);if(b!==void 0)return v.delete(g),v.set(g,b),b;const T=M.render(g);if(v.set(g,T),v.size>cd){const Q=v.keys().next().value;Q!==void 0&&v.delete(Q)}return T}function O(g){const b=g?.toLowerCase()||"think";return b==="analysis"?n("ai.chat.message.think.labels.analysis"):b==="reasoning"?n("ai.chat.message.think.labels.reasoning"):b==="reflection"?n("ai.chat.message.think.labels.reflection"):b==="plan_validation"?n("ai.chat.message.think.labels.planValidation"):b==="think"||b==="thought"||b==="thinking"?n("ai.chat.message.think.labels.think"):n("ai.chat.message.think.labels.other",{tag:g})}function L(g){if(!g)return"";const b=(g/1e3).toFixed(1);return n("ai.chat.message.think.duration",{seconds:b})}const I=S(()=>a.content?M.render(ae(a.content)):"");Te(()=>a.content,g=>{d.value||(p.value=g)});function G(){const g=f.value;if(!g)return;g.style.height="auto";const b=384,T=Math.min(g.scrollHeight,b);g.style.height=`${T}px`,g.style.overflowY=g.scrollHeight>b?"auto":"hidden"}async function ue(){y.value&&(p.value=a.content,d.value=!0,await Oe(),G(),f.value?.focus())}function te(){d.value=!1,p.value=a.content}function W(){if(!a.messageId)return;const g=p.value.trim();if(!g||g===a.content.trim()){te();return}d.value=!1,o("edit",{messageId:a.messageId,content:g})}function ae(g){return Dc(g)}const N=S(()=>{const g=a.contentBlocks||[];return g.filter((b,T)=>b.type==="text"?ae(b.text).trim().length>0:b.type==="think"?b.text.trim().length>0:b.type==="error"?!ao(g,T,{isStreaming:a.isStreaming}):!0)});function $(g){return g.type==="think"||g.type==="tool"||g.type==="skill"||g.type==="plan"||g.type==="plan_draft"||g.type==="error"}function K(g){return g.type==="text"}const ie=S(()=>!!a.isStreaming&&a.processDurationMs===void 0),q=S(()=>Kc(N.value,{isFoldableProcessBlock:$,isTextBlock:K,mode:ie.value?"timeline":"completed"})),B=S(()=>q.value.reduce((g,b)=>g+Qc(b,pt),0)),ne=S(()=>Jc({isStreaming:ie.value,liveElapsedMs:0,settledElapsedMs:a.processDurationMs??0,recordedElapsedMs:B.value})),H=S(()=>Vc(q.value)),V=J({});function j(g){return g.type==="process"?g.blocks:[g.block]}function re(g){return`${a.messageId??a.timestamp}:process:${g}`}function oe(g){const b=re(g),T=V.value[b];return T!==void 0?T:Ie(q.value[g])}function Se(g){const b=re(g);V.value={...V.value,[b]:!oe(g)}}function Ae(g){return N.value[N.value.length-1]===g}function we(g){return Wc(q.value,g,ie.value)}function he(g){return g.type==="process"&&!ie.value}function De(g){return g.type!=="process"?0:g.blocks.filter($).length}function Me(g){const b=De(g);return n(b===1?"ai.chat.message.process.step":"ai.chat.message.process.steps",{count:b})}function Ie(g){return g?.type!=="process"?!1:g.blocks.some(b=>b.type==="error"||b.type==="tool"&&b.tool.status==="error")}function pt(g){return g.type==="think"?g.durationMs??0:g.type==="tool"?g.tool.durationMs??0:0}function it(g){if(g.type==="process")for(let b=g.blocks.length-1;b>=0;b-=1){const T=g.blocks[b];if($(T))return T}}function zt(g){return g.type==="process"?Gc(g.blocks):void 0}function Ot(g,b){const T=it(g);return Zc({isActive:we(b),activeToolName:a.activeTool?.status==="running"?a.activeTool.name:void 0,activeToolProgressPhase:a.activeTool?.status==="running"?a.activeTool.progress?.phase:void 0,lastFoldable:T?{kind:T.type,name:T.type==="tool"?T.tool.name:T.type==="skill"?T.skillName:void 0}:void 0})}function or(g,b){if(he(g))return Ie(g)?n("ai.chat.message.process.failed"):n("ai.chat.message.process.duration",{duration:Yc(ne.value,r.value)});if(!we(b)){const Q=zt(g);return Q?O(Q.tag):n("ai.chat.message.process.label")}const T=Ot(g,b);if(T.type==="tool"){if(a.activeTool?.status==="running"&&a.activeTool.name===T.name)return ft(a.activeTool);const Q=g.type==="process"?g.blocks.find(D=>D.type==="tool"&&D.tool.name===T.name):void 0;return Q?.type==="tool"?ft(Q.tool):T.name}return T.type==="think"?n("ai.chat.message.think.loading"):T.type==="skill"?n("ai.skill.active.label",{name:T.name}):T.type==="plan"?n("ai.chat.message.process.planning"):n("ai.chat.message.process.working")}function on(g,b){if(he(g))return"";if(we(b)){const T=Ot(g,b);if(T.type==="tool"&&T.progressPhase){const Q=`ai.chat.thinking.toolProgress.${T.progressPhase}`;return s(Q)?n(Q):""}return""}return Me(g)}function ht(g,b){if(g.type!=="process"||he(g))return"";if(!we(b)){const T=zt(g);return T?ur(T.text):""}if(a.activeTool?.status==="running")return"";for(let T=g.blocks.length-1;T>=0;T-=1){const Q=g.blocks[T];if(Q.type==="think"||Q.type==="plan_draft"||Q.type==="text"){const D=Ts(Q.text);if(D)return D}}return""}function ln(g,b){if(Ie(g))return"i-heroicons-exclamation-circle";if(!we(b))return zt(g)?"i-heroicons-light-bulb":"i-heroicons-queue-list";const T=Ot(g,b);return T.type==="tool"?"i-heroicons-wrench-screwdriver":T.type==="think"?"i-heroicons-light-bulb":T.type==="skill"?"i-heroicons-bolt":T.type==="plan"?"i-heroicons-clipboard-document-list":"i-heroicons-sparkles"}function St(g){return g.type==="think"&&!!a.isStreaming&&!g.durationMs}const Mt=S(()=>a.role==="assistant"&&N.value.length>0);function ft(g){return s(`ai.assistant.builtinToolDesc.${g.name}`)?n(`ai.assistant.builtinToolDesc.${g.name}`):g.displayName}function cn(g){return g==="running"?"running":g==="done"?"done":"error"}function E(g){return g.displayResult??g.result??""}function z(g){return g.status!=="running"&&E(g).trim().length>0}function Z(g){return!g.displayResult&&(g.result??"").includes("…[truncated]")}async function Le(g){const b=E(g);if(b.trim())try{await navigator.clipboard.writeText(b),i.success(n("ai.chat.message.toolResult.copySuccess"))}catch(T){i.fail(n("ai.chat.message.toolResult.copyFailed"),{description:String(T)})}}function We(g){return g.length===0?n("ai.chat.message.plan.noTools"):g.join(", ")}function xe(g){try{const b=JSON.parse(g.trim());if(!b||typeof b!="object")return null;const T=b,Q=Array.isArray(T.steps)?T.steps.filter(D=>!!D&&typeof D=="object").map(D=>({goal:typeof D.goal=="string"?D.goal:"",suggestedTools:Array.isArray(D.suggestedTools)?D.suggestedTools.filter(R=>typeof R=="string"):[],evidenceNeeded:typeof D.evidenceNeeded=="string"?D.evidenceNeeded:""})).filter(D=>D.goal):[];return{title:typeof T.title=="string"?T.title:void 0,steps:Q,successCriteria:Array.isArray(T.successCriteria)?T.successCriteria.filter(D=>typeof D=="string"):[]}}catch{return null}}const Ve=new Map;function X(g){const b=Ve.get(g);if(b)return b;const T=xe(g);return T&&Ve.set(g,T),T}function At(g){if(g.start_time||g.end_time){const b=g.start_time?String(g.start_time):"",T=g.end_time?String(g.end_time):"";return b&&T?`${b} ~ ${T}`:b||T}if(g.year)if(r.value.startsWith("zh")){let b=`${g.year}年`;return g.month&&(b+=`${g.month}月`,g.day&&(b+=`${g.day}日`,g.hour!==void 0&&(b+=` ${g.hour}点`))),b}else{const b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];let T="";if(g.month){if(T=b[g.month-1]||String(g.month),g.day&&(T+=` ${g.day}`,g.hour!==void 0)){const Q=g.hour,D=Q>=12?"pm":"am",R=Q%12||12;T+=`, ${R}${D}`}T+=`, ${g.year}`}else T=String(g.year);return T}return""}function Bt(g){if(!g.params)return"";const b=g.name,T=g.params;if(b==="search_messages"){const D=T.keywords,R=[];D&&D.length>0&&R.push(`${n("ai.chat.message.toolParams.keywords")}: ${D.join(", ")}`);const le=At(T);return le&&R.push(`${n("ai.chat.message.toolParams.time")}: ${le}`),R.join(" | ")}if(b==="get_recent_messages"){const D=[];D.push(n("ai.chat.message.toolParams.getMessages",{count:T.limit||100}));const R=At(T);return R&&D.push(R),D.join(" | ")}if(b==="get_conversation_between"){const D=[],R=At(T);return R&&D.push(`${n("ai.chat.message.toolParams.time")}: ${R}`),T.limit&&D.push(n("ai.chat.message.toolParams.limit",{count:T.limit})),D.join(" | ")}if(b==="get_message_context"){const D=T.message_ids,R=T.context_size||20;return D&&D.length>0?n("ai.chat.message.toolParams.contextWithMessages",{msgCount:D.length,contextSize:R}):n("ai.chat.message.toolParams.context",{size:R})}if(b==="get_member_stats")return n("ai.chat.message.toolParams.topMembers",{count:T.top_n||10});if(b==="get_time_stats"){const D=T.type;return n(`ai.chat.message.toolParams.timeStats.${D}`)||String(T.type)}if(b==="render_chart"){const D=T.spec&&typeof T.spec=="object"?T.spec:null;return[D?.title,D?.type].filter(le=>typeof le=="string"&&le.length>0).join(" | ")}if(b==="get_members")return T.search?`${n("ai.chat.message.toolParams.search")}: ${T.search}`:n("ai.chat.message.toolParams.getMemberList");if(b==="get_member_name_history")return`${n("ai.chat.message.toolParams.memberId")}: ${T.member_id}`;if(b==="semantic_search_current_chat"){const D=typeof T.query=="string"?T.query:"";return D?D.length>40?`“${D.slice(0,40)}…”`:`“${D}”`:""}const Q=[];for(const[D,R]of Object.entries(T)){if(R==null||R==="")continue;const le=typeof R=="object"?JSON.stringify(R):String(R),P=le.length>30?le.substring(0,30)+"...":le;if(Q.push(`${D}: ${P}`),Q.length>=3){Q.push("...");break}}return Q.join(" | ")}const is=S(()=>!Mt.value&&a.content.trim()?ae(a.content):Mt.value?H.value.map(b=>{if(b.type==="text")return ae(b.text);if(b.type==="think"){const T=O(b.tag),Q=b.text.split(`
10
+ `);return n===-1?t:t.slice(n+1)}function Fc(e,t,n){for(let s=t+1;s<e.length;s+=1)if(n(e[s]))return!0;return!1}function qc(e,t){const n=[];let s=[];const r=()=>{s.length!==0&&(n.push({type:"process",blocks:s}),s=[])};for(const i of e){if(t(i)){s.push(i);continue}r(),n.push({type:"visible",block:i})}return r(),n}function Uc(e,t,n){const s=e.map((o,l)=>t(o)||n(o)&&Fc(e,l,t)),r=e.filter((o,l)=>s[l]),i=s.findIndex(Boolean),a=[];return e.forEach((o,l)=>{if(l===i){a.push({type:"process",blocks:r});return}s[l]||a.push({type:"visible",block:o})}),a}function Kc(e,t){return t.mode==="timeline"?qc(e,t.isFoldableProcessBlock):Uc(e,t.isFoldableProcessBlock,t.isTextBlock)}function Wc(e,t,n){return n&&t===e.length-1&&e[t]?.type==="process"}function Vc(e){return e.flatMap(t=>t.type==="visible"?[t.block]:[])}function Gc(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n.type==="think"&&n.tag?.toLowerCase()!=="plan_validation"&&n.text?.trim())return n}}function Yc(e,t){const n=Math.max(0,Math.round(e/1e3));if(t.startsWith("zh")||t.startsWith("ja")){if(n<60)return`${n}秒`;if(n<3600){const c=Math.floor(n/60),u=n%60;return`${c}分${u.toString().padStart(2,"0")}秒`}const a=Math.floor(n/3600),o=Math.floor(n%3600/60),l=n%60;return`${a}时${o.toString().padStart(2,"0")}分${l.toString().padStart(2,"0")}秒`}if(n<60)return`${n}s`;if(n<3600){const a=Math.floor(n/60),o=n%60;return`${a}m ${o.toString().padStart(2,"0")}s`}const s=Math.floor(n/3600),r=Math.floor(n%3600/60),i=n%60;return`${s}h ${r.toString().padStart(2,"0")}m ${i.toString().padStart(2,"0")}s`}function Qc(e,t){return e.type!=="process"?0:e.blocks.reduce((n,s)=>n+(t(s)??0),0)}function Jc(e){return e.isStreaming?e.liveElapsedMs:e.settledElapsedMs||e.recordedElapsedMs}function Zc(e){if(e.isActive&&e.activeToolName)return{type:"tool",name:e.activeToolName,progressPhase:e.activeToolProgressPhase};if(e.isActive&&e.lastFoldable){if(e.lastFoldable.kind==="think")return{type:"think"};if(e.lastFoldable.kind==="skill"&&e.lastFoldable.name)return{type:"skill",name:e.lastFoldable.name};if(e.lastFoldable.kind==="plan"||e.lastFoldable.kind==="plan_draft")return{type:"plan"};if(e.lastFoldable.kind==="tool"&&e.lastFoldable.name)return{type:"tool",name:e.lastFoldable.name}}return{type:"generic"}}const Xc=["data-ai-message-id"],eu={key:0,class:"w-full rounded-lg border border-gray-200 bg-gray-50/80 dark:border-gray-700/50 dark:bg-gray-800/40"},tu={class:"flex cursor-pointer select-none items-center gap-2 px-3 py-2 text-xs font-medium text-gray-500 transition-colors hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"},nu={class:"border-t border-gray-200/60 px-3 py-2.5 dark:border-gray-700/40"},ru=["innerHTML"],su={class:"mt-2 text-[11px] text-gray-400 dark:text-gray-500"},au={key:0,class:"rounded-2xl bg-gray-100 p-4 text-gray-900 dark:bg-gray-800 dark:text-gray-100"},iu=["onKeydown"],ou={class:"mt-2 flex justify-end"},lu={class:"flex gap-2"},cu={key:1,class:"ai-user-bubble w-fit max-w-full rounded-3xl bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-100"},uu={key:0,class:"mb-1.5 flex flex-wrap gap-1.5"},du=["innerHTML"],pu=["data-running","aria-expanded","onClick"],hu={key:0,class:"relative mr-1.5 flex h-4 w-4 shrink-0 items-center justify-center"},fu={key:0},gu=["data-open"],mu=["innerHTML"],yu={key:0,class:"ml-1 inline-block h-4 w-1.5 animate-pulse rounded-sm bg-gray-800 dark:bg-gray-200"},vu=["data-running","aria-expanded","onClick"],ku={class:"shrink-0 text-gray-600 dark:text-gray-300"},xu={key:0,class:"mx-2 h-0.5 w-0.5 shrink-0 rounded-full bg-gray-300 dark:bg-gray-600","aria-hidden":"true"},bu={key:2,class:"ml-3 shrink-0 text-xs text-gray-400 dark:text-gray-500"},wu={class:"prose prose-sm ai-process-detail-content ai-thought-content dark:prose-invert mt-1 max-w-none pl-[22px]"},_u={key:0,class:"mb-2 font-medium text-gray-700 dark:text-gray-200"},Tu={class:"not-prose space-y-2 text-xs leading-relaxed"},Cu={class:"font-medium text-gray-800 dark:text-gray-200"},Su={key:0,class:"mt-1 text-gray-500 dark:text-gray-400"},Mu={class:"mt-0.5 text-gray-500 dark:text-gray-400"},Au={key:1,class:"not-prose mt-2 border-t border-gray-100 pt-2 dark:border-gray-800"},Lu={class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},$u={class:"mt-1 list-disc space-y-0.5 pl-4 text-xs leading-relaxed text-gray-600 dark:text-gray-300"},Eu=["innerHTML"],Iu=["aria-expanded","onClick"],Ru={class:"min-w-0 truncate text-gray-600 dark:text-gray-300"},Pu={class:"mt-2 pl-[22px] text-sm leading-6"},Hu=["innerHTML"],Nu={key:1,class:"space-y-2"},zu={class:"font-medium text-gray-800 dark:text-gray-200"},Ou={class:"mt-1 text-gray-500 dark:text-gray-400"},Bu={class:"mt-0.5 text-gray-500 dark:text-gray-400"},Du={key:2,class:"mt-2 border-t border-gray-100 pt-2 dark:border-gray-800"},ju={class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},Fu={class:"mt-1 list-disc space-y-0.5 pl-4 text-xs leading-relaxed text-gray-600 dark:text-gray-300"},qu={key:4,class:"py-1 text-sm text-gray-600 dark:text-gray-400"},Uu={class:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-300"},Ku={key:0,class:"text-[11px] font-normal text-gray-400 dark:text-gray-500"},Wu=["innerHTML"],Vu=["aria-expanded","onClick"],Gu={key:0,class:"min-w-0 truncate text-xs text-gray-400 dark:text-gray-500"},Yu={class:"ml-auto shrink-0 text-xs text-gray-400 dark:text-gray-500"},Qu={class:"mx-px mt-1 overflow-hidden rounded-lg border border-gray-200/60 bg-gray-50/80 dark:border-white/5 dark:bg-white/[0.03]"},Ju={class:"flex items-center justify-between gap-2 border-b border-gray-200/60 px-3 py-2 dark:border-white/5"},Zu={class:"text-xs font-medium text-gray-500 dark:text-gray-400"},Xu={key:0,class:"border-b border-amber-200/70 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-300"},ed={class:"ai-tool-result-scroll whitespace-pre-wrap break-words px-3 py-2.5 text-xs leading-relaxed text-gray-700 dark:text-gray-200"},td=["data-running"],nd={key:0,class:"min-w-0 truncate text-xs text-gray-400 dark:text-gray-500"},rd={key:1,class:"ml-auto shrink-0 text-xs text-gray-400 dark:text-gray-500"},sd={key:3,class:"py-1 text-gray-900 dark:text-gray-100"},ad=["innerHTML"],id={key:0,class:"ml-1 inline-block h-4 w-1.5 animate-pulse rounded-sm bg-gray-800 dark:bg-gray-200"},od={key:4,class:"ai-message-actions mt-1 flex items-center gap-2 px-1"},ld={class:"max-w-0 overflow-hidden text-xs whitespace-nowrap text-gray-400 opacity-0 transition-[max-width,opacity] duration-150 group-hover/message:max-w-[12rem] group-hover/message:opacity-100 group-focus-within/message:max-w-[12rem] group-focus-within/message:opacity-100"},cd=32,gg=be({__name:"ChatMessage",props:{messageId:{},role:{},content:{},timestamp:{},isStreaming:{type:Boolean},processDurationMs:{},contentBlocks:{},showCaptureButton:{type:Boolean},highlighted:{type:Boolean},editable:{type:Boolean},activeTool:{},entityRefs:{}},emits:["edit","fork"],setup(e,{emit:t}){const{t:n,te:s,locale:r}=qe(),i=Br(),a=e,o=t,l=S(()=>{const g=Je(a.timestamp);if(g.isSame(Je(),"day"))return g.format("HH:mm");const b=r.value.startsWith("zh")||r.value.startsWith("ja");return g.isSame(Je(),"year")?g.format(b?"M月D日 HH:mm":"M/D HH:mm"):g.format(b?"YYYY年M月D日 HH:mm":"YYYY/M/D HH:mm")}),c=S(()=>a.role==="user"),u=S(()=>a.role==="summary"),d=J(!1),p=J(a.content),f=J(null),y=S(()=>c.value&&a.editable&&!a.isStreaming&&!!a.messageId),_=S(()=>!c.value&&!u.value&&!a.isStreaming&&!!a.messageId),M=new da({html:!1,breaks:!0,linkify:!0,typographer:!0});M.renderer.rules.link_open=(g,b,T,Q,D)=>(g[b].attrSet("target","_blank"),g[b].attrSet("rel","noopener noreferrer"),D.renderToken(g,b,T));const v=new Map;function C(g){if(!g)return"";const b=v.get(g);if(b!==void 0)return v.delete(g),v.set(g,b),b;const T=M.render(g);if(v.set(g,T),v.size>cd){const Q=v.keys().next().value;Q!==void 0&&v.delete(Q)}return T}function z(g){const b=g?.toLowerCase()||"think";return b==="analysis"?n("ai.chat.message.think.labels.analysis"):b==="reasoning"?n("ai.chat.message.think.labels.reasoning"):b==="reflection"?n("ai.chat.message.think.labels.reflection"):b==="plan_validation"?n("ai.chat.message.think.labels.planValidation"):b==="think"||b==="thought"||b==="thinking"?n("ai.chat.message.think.labels.think"):n("ai.chat.message.think.labels.other",{tag:g})}function L(g){if(!g)return"";const b=(g/1e3).toFixed(1);return n("ai.chat.message.think.duration",{seconds:b})}const E=S(()=>a.content?M.render(I(a.content)):"");Te(()=>a.content,g=>{d.value||(p.value=g)});function G(){const g=f.value;if(!g)return;g.style.height="auto";const b=384,T=Math.min(g.scrollHeight,b);g.style.height=`${T}px`,g.style.overflowY=g.scrollHeight>b?"auto":"hidden"}async function ue(){y.value&&(p.value=a.content,d.value=!0,await Oe(),G(),f.value?.focus())}function te(){d.value=!1,p.value=a.content}function V(){if(!a.messageId)return;const g=p.value.trim();if(!g||g===a.content.trim()){te();return}d.value=!1,o("edit",{messageId:a.messageId,content:g})}function I(g){return Dc(g)}const U=S(()=>{const g=a.contentBlocks||[];return g.filter((b,T)=>b.type==="text"?I(b.text).trim().length>0:b.type==="think"?b.text.trim().length>0:b.type==="error"?!ao(g,T,{isStreaming:a.isStreaming}):!0)});function O(g){return g.type==="think"||g.type==="tool"||g.type==="skill"||g.type==="plan"||g.type==="plan_draft"||g.type==="error"}function Z(g){return g.type==="text"}const ie=S(()=>!!a.isStreaming&&a.processDurationMs===void 0),K=S(()=>Kc(U.value,{isFoldableProcessBlock:O,isTextBlock:Z,mode:ie.value?"timeline":"completed"})),B=S(()=>K.value.reduce((g,b)=>g+Qc(b,pt),0)),re=S(()=>Jc({isStreaming:ie.value,liveElapsedMs:0,settledElapsedMs:a.processDurationMs??0,recordedElapsedMs:B.value})),H=S(()=>Vc(K.value)),W=J({});function j(g){return g.type==="process"?g.blocks:[g.block]}function se(g){return`${a.messageId??a.timestamp}:process:${g}`}function oe(g){const b=se(g),T=W.value[b];return T!==void 0?T:Ie(K.value[g])}function Se(g){const b=se(g);W.value={...W.value,[b]:!oe(g)}}function Ae(g){return U.value[U.value.length-1]===g}function we(g){return Wc(K.value,g,ie.value)}function he(g){return g.type==="process"&&!ie.value}function De(g){return g.type!=="process"?0:g.blocks.filter(O).length}function Me(g){const b=De(g);return n(b===1?"ai.chat.message.process.step":"ai.chat.message.process.steps",{count:b})}function Ie(g){return g?.type!=="process"?!1:g.blocks.some(b=>b.type==="error"||b.type==="tool"&&b.tool.status==="error")}function pt(g){return g.type==="think"?g.durationMs??0:g.type==="tool"?g.tool.durationMs??0:0}function it(g){if(g.type==="process")for(let b=g.blocks.length-1;b>=0;b-=1){const T=g.blocks[b];if(O(T))return T}}function zt(g){return g.type==="process"?Gc(g.blocks):void 0}function Ot(g,b){const T=it(g);return Zc({isActive:we(b),activeToolName:a.activeTool?.status==="running"?a.activeTool.name:void 0,activeToolProgressPhase:a.activeTool?.status==="running"?a.activeTool.progress?.phase:void 0,lastFoldable:T?{kind:T.type,name:T.type==="tool"?T.tool.name:T.type==="skill"?T.skillName:void 0}:void 0})}function or(g,b){if(he(g))return Ie(g)?n("ai.chat.message.process.failed"):n("ai.chat.message.process.duration",{duration:Yc(re.value,r.value)});if(!we(b)){const Q=zt(g);return Q?z(Q.tag):n("ai.chat.message.process.label")}const T=Ot(g,b);if(T.type==="tool"){if(a.activeTool?.status==="running"&&a.activeTool.name===T.name)return ft(a.activeTool);const Q=g.type==="process"?g.blocks.find(D=>D.type==="tool"&&D.tool.name===T.name):void 0;return Q?.type==="tool"?ft(Q.tool):T.name}return T.type==="think"?n("ai.chat.message.think.loading"):T.type==="skill"?n("ai.skill.active.label",{name:T.name}):T.type==="plan"?n("ai.chat.message.process.planning"):n("ai.chat.message.process.working")}function on(g,b){if(he(g))return"";if(we(b)){const T=Ot(g,b);if(T.type==="tool"&&T.progressPhase){const Q=`ai.chat.thinking.toolProgress.${T.progressPhase}`;return s(Q)?n(Q):""}return""}return Me(g)}function ht(g,b){if(g.type!=="process"||he(g))return"";if(!we(b)){const T=zt(g);return T?ur(T.text):""}if(a.activeTool?.status==="running")return"";for(let T=g.blocks.length-1;T>=0;T-=1){const Q=g.blocks[T];if(Q.type==="think"||Q.type==="plan_draft"||Q.type==="text"){const D=Ts(Q.text);if(D)return D}}return""}function ln(g,b){if(Ie(g))return"i-heroicons-exclamation-circle";if(!we(b))return zt(g)?"i-heroicons-light-bulb":"i-heroicons-queue-list";const T=Ot(g,b);return T.type==="tool"?"i-heroicons-wrench-screwdriver":T.type==="think"?"i-heroicons-light-bulb":T.type==="skill"?"i-heroicons-bolt":T.type==="plan"?"i-heroicons-clipboard-document-list":"i-heroicons-sparkles"}function St(g){return g.type==="think"&&!!a.isStreaming&&!g.durationMs}const Mt=S(()=>a.role==="assistant"&&U.value.length>0);function ft(g){return s(`ai.assistant.builtinToolDesc.${g.name}`)?n(`ai.assistant.builtinToolDesc.${g.name}`):g.displayName}function cn(g){return g==="running"?"running":g==="done"?"done":"error"}function $(g){return g.displayResult??g.result??""}function N(g){return g.status!=="running"&&$(g).trim().length>0}function X(g){return!g.displayResult&&(g.result??"").includes("…[truncated]")}async function Le(g){const b=$(g);if(b.trim())try{await navigator.clipboard.writeText(b),i.success(n("ai.chat.message.toolResult.copySuccess"))}catch(T){i.fail(n("ai.chat.message.toolResult.copyFailed"),{description:String(T)})}}function We(g){return g.length===0?n("ai.chat.message.plan.noTools"):g.join(", ")}function xe(g){try{const b=JSON.parse(g.trim());if(!b||typeof b!="object")return null;const T=b,Q=Array.isArray(T.steps)?T.steps.filter(D=>!!D&&typeof D=="object").map(D=>({goal:typeof D.goal=="string"?D.goal:"",suggestedTools:Array.isArray(D.suggestedTools)?D.suggestedTools.filter(R=>typeof R=="string"):[],evidenceNeeded:typeof D.evidenceNeeded=="string"?D.evidenceNeeded:""})).filter(D=>D.goal):[];return{title:typeof T.title=="string"?T.title:void 0,steps:Q,successCriteria:Array.isArray(T.successCriteria)?T.successCriteria.filter(D=>typeof D=="string"):[]}}catch{return null}}const Ve=new Map;function ee(g){const b=Ve.get(g);if(b)return b;const T=xe(g);return T&&Ve.set(g,T),T}function At(g){if(g.start_time||g.end_time){const b=g.start_time?String(g.start_time):"",T=g.end_time?String(g.end_time):"";return b&&T?`${b} ~ ${T}`:b||T}if(g.year)if(r.value.startsWith("zh")){let b=`${g.year}年`;return g.month&&(b+=`${g.month}月`,g.day&&(b+=`${g.day}日`,g.hour!==void 0&&(b+=` ${g.hour}点`))),b}else{const b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];let T="";if(g.month){if(T=b[g.month-1]||String(g.month),g.day&&(T+=` ${g.day}`,g.hour!==void 0)){const Q=g.hour,D=Q>=12?"pm":"am",R=Q%12||12;T+=`, ${R}${D}`}T+=`, ${g.year}`}else T=String(g.year);return T}return""}function Bt(g){if(!g.params)return"";const b=g.name,T=g.params;if(b==="search_messages"){const D=T.keywords,R=[];D&&D.length>0&&R.push(`${n("ai.chat.message.toolParams.keywords")}: ${D.join(", ")}`);const le=At(T);return le&&R.push(`${n("ai.chat.message.toolParams.time")}: ${le}`),R.join(" | ")}if(b==="get_recent_messages"){const D=[];D.push(n("ai.chat.message.toolParams.getMessages",{count:T.limit||100}));const R=At(T);return R&&D.push(R),D.join(" | ")}if(b==="get_conversation_between"){const D=[],R=At(T);return R&&D.push(`${n("ai.chat.message.toolParams.time")}: ${R}`),T.limit&&D.push(n("ai.chat.message.toolParams.limit",{count:T.limit})),D.join(" | ")}if(b==="get_message_context"){const D=T.message_ids,R=T.context_size||20;return D&&D.length>0?n("ai.chat.message.toolParams.contextWithMessages",{msgCount:D.length,contextSize:R}):n("ai.chat.message.toolParams.context",{size:R})}if(b==="get_member_stats")return n("ai.chat.message.toolParams.topMembers",{count:T.top_n||10});if(b==="get_time_stats"){const D=T.type;return n(`ai.chat.message.toolParams.timeStats.${D}`)||String(T.type)}if(b==="render_chart"){const D=T.spec&&typeof T.spec=="object"?T.spec:null;return[D?.title,D?.type].filter(le=>typeof le=="string"&&le.length>0).join(" | ")}if(b==="get_members")return T.search?`${n("ai.chat.message.toolParams.search")}: ${T.search}`:n("ai.chat.message.toolParams.getMemberList");if(b==="get_member_name_history")return`${n("ai.chat.message.toolParams.memberId")}: ${T.member_id}`;if(b==="semantic_search_current_chat"){const D=typeof T.query=="string"?T.query:"";return D?D.length>40?`“${D.slice(0,40)}…”`:`“${D}”`:""}const Q=[];for(const[D,R]of Object.entries(T)){if(R==null||R==="")continue;const le=typeof R=="object"?JSON.stringify(R):String(R),P=le.length>30?le.substring(0,30)+"...":le;if(Q.push(`${D}: ${P}`),Q.length>=3){Q.push("...");break}}return Q.join(" | ")}const is=S(()=>!Mt.value&&a.content.trim()?I(a.content):Mt.value?H.value.map(b=>{if(b.type==="text")return I(b.text);if(b.type==="think"){const T=z(b.tag),Q=b.text.split(`
11
11
  `).map(D=>`> ${D}`).join(`
12
12
  `);return`> ${T}
13
13
  >
@@ -36,7 +36,7 @@ ${b.text.split(`
36
36
  `).map(T=>`> ${T}`).join(`
37
37
  `)}`;if(b.type==="tool"){const T=ft(b.tool),Q=Bt(b.tool),D=Q?` (${Q})`:"";return`- [${cn(b.tool.status)}] ${T}${D}`}return""}).filter(b=>b.trim().length>0).join(`
38
38
 
39
- `):""),os=S(()=>!a.isStreaming&&is.value.trim().length>0);async function Xa(){if(os.value)try{await navigator.clipboard.writeText(is.value),i.success(n("ai.chat.message.copy.success"))}catch(g){i.fail(n("ai.chat.message.copy.failed"),{description:String(g)})}}return(g,b)=>{const T=Ne,Q=tr,D=na;return m(),x("div",{class:Y(["flex items-start gap-3",[c.value&&!d.value?"flex-row-reverse":"",u.value?"justify-center":"",e.highlighted?"rounded-xl ring-2 ring-primary-400/70 ring-offset-4 dark:ring-offset-gray-950":""]]),"data-ai-message-id":e.messageId},[h("div",{class:Y(["group/message",[c.value&&!d.value?"flex max-w-[85%] min-w-0 flex-col items-end":"w-full min-w-0"]])},[u.value?(m(),x("details",eu,[h("summary",tu,[F(T,{name:"i-heroicons-arrow-path",class:"h-3.5 w-3.5 shrink-0"}),h("span",null,w(k(n)("ai.chat.message.summary.label")),1),F(T,{name:"i-heroicons-chevron-right",class:"ml-auto h-3 w-3 transition-transform [[open]>&]:rotate-90"})]),h("div",nu,[h("div",{class:"prose prose-sm dark:prose-invert max-w-none text-xs leading-relaxed text-gray-600 dark:text-gray-300",innerHTML:I.value},null,8,ru),h("p",su,w(k(n)("ai.chat.message.summary.info")),1)])])):c.value?(m(),x(me,{key:1},[d.value?(m(),x("div",au,[Zs(h("textarea",{ref_key:"editTextareaRef",ref:f,"onUpdate:modelValue":b[0]||(b[0]=R=>p.value=R),rows:"2",class:"w-full resize-none rounded-xl border border-primary-200 bg-white/90 px-4 py-3 text-sm leading-relaxed outline-none focus:border-primary-400 dark:border-primary-400/40 dark:bg-page-dark/70",onInput:G,onKeydown:[yn(mt(te,["prevent"]),["esc"]),yn(mt(W,["ctrl","prevent"]),["enter"]),yn(mt(W,["meta","prevent"]),["enter"])]},null,40,iu),[[Xs,p.value]]),h("div",ou,[h("div",lu,[F(Q,{size:"xs",variant:"ghost",color:"gray",onClick:te},{default:de(()=>[He(w(k(n)("common.cancel")),1)]),_:1}),F(Q,{size:"xs",color:"primary",onClick:W},{default:de(()=>[He(w(k(n)("ai.chat.message.edit.submit")),1)]),_:1})])])])):(m(),x("div",cu,[e.entityRefs?.length?(m(),x("div",uu,[(m(!0),x(me,null,_e(e.entityRefs,R=>(m(),x("span",{key:R.type==="contact"?`contact:${R.contactKey}`:`session:${R.sessionId}`,class:"inline-flex items-center gap-1 rounded-full bg-white/70 px-2 py-0.5 text-xs text-primary-600 dark:bg-white/10 dark:text-primary-300"},[F(T,{name:R.type==="contact"?"i-heroicons-user":"i-heroicons-user-group",class:"h-3 w-3"},null,8,["name"]),He(" "+w(R.displayName),1)]))),128))])):U("",!0),h("div",{class:"prose prose-sm dark:prose-invert max-w-none",innerHTML:I.value},null,8,du)]))],64)):Mt.value?(m(),x("div",{key:2,class:Y(ie.value?"space-y-2":"space-y-3")},[(m(!0),x(me,null,_e(q.value,(R,le)=>(m(),x("div",{key:le},[R.type==="process"?(m(),x("button",{key:0,type:"button",class:"ai-live-row group/process flex h-6 w-full min-w-0 max-w-full items-center text-left text-sm leading-6 text-gray-500 transition-colors hover:text-gray-700 focus:outline-none focus-visible:bg-gray-50 dark:text-gray-400 dark:hover:text-gray-200 dark:focus-visible:bg-gray-800/30","data-running":we(le)||void 0,"aria-expanded":oe(le),onClick:P=>Se(le)},[!he(R)||Ie(R)?(m(),x("span",hu,[oe(le)?(m(),se(T,{key:0,name:"i-heroicons-chevron-down",class:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"})):(m(),x(me,{key:1},[F(T,{name:ln(R,le),class:Y(["absolute h-3.5 w-3.5 text-gray-400 transition-opacity duration-100 group-hover/process:opacity-0 dark:text-gray-500",[Ie(R)?"text-amber-500 dark:text-amber-400":""]])},null,8,["name","class"]),F(T,{name:"i-heroicons-chevron-down",class:"absolute h-3.5 w-3.5 text-gray-500 opacity-0 transition-opacity duration-100 group-hover/process:opacity-100 dark:text-gray-400"})],64))])):U("",!0),h("span",{class:Y(["shrink-0",Ie(R)?"text-amber-700 dark:text-amber-300":"text-gray-600 dark:text-gray-300"])},w(or(R,le)),3),he(R)&&!Ie(R)?(m(),se(T,{key:1,name:oe(le)?"i-heroicons-chevron-down":"i-heroicons-chevron-right",class:"ml-1 h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400"},null,8,["name"])):U("",!0),!oe(le)&&ht(R,le)?(m(),x(me,{key:2},[b[2]||(b[2]=h("span",{class:"mx-2 h-0.5 w-0.5 shrink-0 rounded-full bg-gray-300 dark:bg-gray-600","aria-hidden":"true"},null,-1)),F(_s,{text:ht(R,le),"follow-end":we(le)},null,8,["text","follow-end"])],64)):U("",!0),on(R,le)?(m(),x("span",{key:3,class:Y(["shrink-0 text-xs text-gray-400 dark:text-gray-500",[!oe(le)&&ht(R,le)?"ml-3":"ml-1.5"]])},[oe(le)||!ht(R,le)?(m(),x("span",fu," · ")):U("",!0),He(" "+w(on(R,le)),1)],2)):U("",!0)],8,pu)):U("",!0),h("div",{class:Y(R.type==="process"?"ai-process-fold":""),"data-open":R.type!=="process"||oe(le)?!0:void 0},[h("div",{class:Y(R.type==="process"?"ai-process-fold-inner":"")},[h("div",{class:Y([R.type==="process"?["ai-process-fold-content",he(R)?"pt-2.5 space-y-1.5":"ml-1.5 pt-1 space-y-0.5 border-l border-gray-200/80 pl-3 dark:border-white/10"]:""])},[(m(!0),x(me,null,_e(j(R),(P,ei)=>(m(),x(me,{key:`${le}-${ei}`},[P.type==="text"?(m(),x("div",{key:0,class:Y(["text-gray-900 dark:text-gray-100",[R.type==="process"?he(R)?"py-2":"py-1 text-xs text-gray-500 dark:text-gray-400":ie.value?"py-1":""]])},[h("div",{class:Y(["prose dark:prose-invert max-w-none",[R.type==="process"&&!he(R)?"prose-sm leading-relaxed":"ai-chat-prose"]]),innerHTML:C(ae(P.text))},null,10,mu),e.isStreaming&&Ae(P)?(m(),x("span",yu)):U("",!0)],2)):P.type==="think"?(m(),se(Kt,{key:1,class:"w-full text-sm text-gray-500 dark:text-gray-400"},{summary:de(({open:ye,toggle:Re})=>[h("button",{type:"button",class:Y(["ai-live-row group/process-toggle flex w-full min-w-0 cursor-pointer select-none items-center text-left transition-colors hover:text-gray-700 dark:hover:text-gray-300",[he(R)?"h-7 text-sm leading-7":"h-6 text-sm leading-6"]]),"data-running":St(P)||void 0,"aria-expanded":ye,onClick:Re},[F(Wt,{icon:"i-heroicons-light-bulb",open:ye,class:"mr-1.5"},null,8,["open"]),h("span",ku,w(O(P.tag)),1),!ye&&P.tag?.toLowerCase()!=="plan_validation"&&(k(ur)(P.text)||St(P))?(m(),x("span",xu)):U("",!0),!ye&&P.tag?.toLowerCase()!=="plan_validation"?(m(),se(_s,{key:1,text:St(P)?k(Ts)(P.text):k(ur)(P.text),"follow-end":St(P)},null,8,["text","follow-end"])):U("",!0),P.durationMs?(m(),x("span",bu,w(L(P.durationMs)),1)):U("",!0)],10,vu)]),default:de(()=>[h("div",wu,[P.tag==="plan_validation"&&X(P.text)?(m(),x(me,{key:0},[X(P.text)?.title?(m(),x("div",_u,w(X(P.text)?.title),1)):U("",!0),h("ol",Tu,[(m(!0),x(me,null,_e(X(P.text)?.steps,(ye,Re)=>(m(),x("li",{key:Re,class:"text-gray-600 dark:text-gray-300"},[h("div",Cu,w(ye.goal),1),ye.evidenceNeeded?(m(),x("div",Su,w(k(n)("ai.chat.message.plan.evidenceNeeded"))+": "+w(ye.evidenceNeeded),1)):U("",!0),h("div",Mu,w(k(n)("ai.chat.message.plan.suggestedTools"))+": "+w(We(ye.suggestedTools)),1)]))),128))]),X(P.text)?.successCriteria.length?(m(),x("div",Au,[h("div",Lu,w(k(n)("ai.chat.message.plan.successCriteria")),1),h("ul",$u,[(m(!0),x(me,null,_e(X(P.text)?.successCriteria,(ye,Re)=>(m(),x("li",{key:Re},w(ye),1))),128))])])):U("",!0)],64)):(m(),x("div",{key:1,innerHTML:C(P.text)},null,8,Eu))])]),_:2},1024)):P.type==="skill"?(m(),x("div",{key:2,class:Y(["flex items-center gap-2 font-medium text-gray-600 dark:text-gray-300",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs"]])},[F(T,{name:"i-heroicons-bolt",class:"h-3.5 w-3.5 shrink-0 text-gray-400"}),h("span",null,w(k(n)("ai.skill.active.label",{name:P.skillName})),1)],2)):P.type==="plan"?(m(),se(Kt,{key:3,class:"group w-full text-sm text-gray-600 dark:text-gray-400"},{summary:de(({open:ye,toggle:Re})=>[h("button",{type:"button",class:Y(["group/process-toggle flex w-full cursor-pointer select-none items-center gap-2 rounded-md text-left text-gray-500 transition-colors hover:bg-gray-50/80 hover:text-gray-700 dark:hover:bg-gray-800/30 dark:hover:text-gray-300",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs"]]),"aria-expanded":ye,onClick:Re},[F(Wt,{icon:"i-heroicons-clipboard-document-list",open:ye},null,8,["open"]),h("span",Ru,w(k(n)("ai.chat.message.plan.label"))+" · "+w(P.plan.title),1)],10,Iu)]),default:de(()=>[h("div",Pu,[P.displayText?(m(),x("div",{key:0,class:"prose prose-sm ai-process-detail-content dark:prose-invert max-w-none text-gray-600 dark:text-gray-300",innerHTML:C(P.displayText)},null,8,Hu)):(m(),x("ol",Nu,[(m(!0),x(me,null,_e(P.plan.steps,(ye,Re)=>(m(),x("li",{key:Re,class:"text-sm leading-6"},[h("div",zu,w(Re+1)+". "+w(ye.goal),1),h("div",Ou,w(k(n)("ai.chat.message.plan.evidenceNeeded"))+": "+w(ye.evidenceNeeded),1),h("div",Bu,w(k(n)("ai.chat.message.plan.suggestedTools"))+": "+w(We(ye.suggestedTools)),1)]))),128))])),P.displayText?U("",!0):(m(),x("div",Du,[h("div",ju,w(k(n)("ai.chat.message.plan.successCriteria")),1),h("ul",Fu,[(m(!0),x(me,null,_e(P.plan.successCriteria,(ye,Re)=>(m(),x("li",{key:Re},w(ye),1))),128))])]))])]),_:2},1024)):P.type==="plan_draft"?(m(),x("div",qu,[h("div",Uu,[F(T,{name:"i-heroicons-clipboard-document-list",class:"h-3.5 w-3.5 shrink-0 text-gray-400"}),h("span",null,w(k(n)("ai.chat.message.plan.label")),1),e.isStreaming?(m(),x("span",Ku,w(k(n)("ai.chat.message.process.planning")),1)):U("",!0)]),h("div",{class:"mt-2 prose prose-sm dark:prose-invert max-w-none text-xs leading-relaxed text-gray-600 dark:text-gray-300",innerHTML:C(P.text)},null,8,Wu)])):P.type==="chart"?(m(),se(Wl,{key:5,chart:P.chart},null,8,["chart"])):P.type==="evidence"?(m(),se(vc,{key:6,evidence:P.evidence},null,8,["evidence"])):P.type==="cross_chat_evidence"?(m(),se(Oc,{key:7,evidence:P.evidence},null,8,["evidence"])):P.type==="tool"&&z(P.tool)?(m(),se(Kt,{key:8,class:"group w-full max-w-full"},{summary:de(({open:ye,toggle:Re})=>[h("button",{type:"button",class:Y(["group/process-toggle flex w-full cursor-pointer select-none items-center gap-2 rounded-md text-left text-gray-500 transition-colors hover:bg-gray-50/80 dark:text-gray-400 dark:hover:bg-gray-800/30",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs",P.tool.status==="error"?"text-amber-700 dark:text-amber-400":""]]),"aria-expanded":ye,onClick:Re},[F(Wt,{icon:P.tool.status==="error"?"i-heroicons-exclamation-circle":"i-heroicons-wrench-screwdriver",open:ye,"icon-class":P.tool.status==="error"?"text-amber-500":"text-gray-400 dark:text-gray-500"},null,8,["icon","open","icon-class"]),h("span",{class:Y(["shrink-0",[P.tool.status==="error"?"text-amber-700 dark:text-amber-300":"text-gray-600 dark:text-gray-300"]])},w(ft(P.tool)),3),Bt(P.tool)?(m(),x("span",Gu,w(Bt(P.tool)),1)):U("",!0),h("span",Yu,w(k(n)("ai.chat.message.toolResult.view")),1)],10,Vu)]),default:de(()=>[h("div",Qu,[h("div",Ju,[h("span",Zu,w(k(n)("ai.chat.message.toolResult.title")),1),F(Q,{size:"xs",variant:"ghost",color:"primary",icon:"i-heroicons-document-duplicate",title:k(n)("ai.chat.message.toolResult.copy"),onClick:mt(ye=>Le(P.tool),["stop"])},null,8,["title","onClick"])]),Z(P.tool)?(m(),x("div",Xu,w(k(n)("ai.chat.message.toolResult.displayTruncated")),1)):U("",!0),h("pre",ed,w(E(P.tool)),1)])]),_:2},1024)):P.type==="tool"?(m(),x("div",{key:9,class:Y(["ai-live-row flex min-w-0 items-center gap-2",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs",P.tool.status==="error"?"text-amber-700 dark:text-amber-400":"text-gray-500 dark:text-gray-400"]]),"data-running":P.tool.status==="running"||void 0},[F(T,{name:P.tool.status==="running"?"i-heroicons-arrow-path":P.tool.status==="error"?"i-heroicons-exclamation-circle":"i-heroicons-wrench-screwdriver",class:Y(["h-3.5 w-3.5 shrink-0",[P.tool.status==="running"?"animate-spin text-primary-500":P.tool.status==="error"?"text-amber-500":"text-gray-400"]])},null,8,["name","class"]),h("span",{class:Y(["shrink-0",[P.tool.status==="error"?"text-amber-700 dark:text-amber-300":"text-gray-600 dark:text-gray-300"]])},w(ft(P.tool)),3),Bt(P.tool)?(m(),x("span",nd,w(Bt(P.tool)),1)):U("",!0),P.tool.status==="done"&&P.tool.durationMs?(m(),x("span",rd,w(L(P.tool.durationMs)),1)):U("",!0)],10,td)):P.type==="error"?(m(),se(Sl,{key:10,error:P.error,compact:R.type==="process"},null,8,["error","compact"])):U("",!0)],64))),128))],2)],2)],10,gu)]))),128))],2)):(m(),x("div",sd,[h("div",{class:"prose ai-chat-prose dark:prose-invert max-w-none",innerHTML:I.value},null,8,ad),e.isStreaming?(m(),x("span",id)):U("",!0)])),!u.value&&!e.isStreaming?(m(),x("div",od,[F(D,{text:k(n)("ai.chat.message.copy.tooltip"),class:"no-capture"},{default:de(()=>[F(Q,{icon:"i-heroicons-document-duplicate",variant:"ghost",color:"neutral",size:"xs",disabled:!os.value,onClick:Xa},null,8,["disabled"])]),_:1},8,["text"]),y.value?(m(),se(D,{key:0,text:k(n)("ai.chat.message.edit.tooltip"),class:"no-capture"},{default:de(()=>[F(Q,{icon:"i-heroicons-pencil-square",variant:"ghost",color:"neutral",size:"xs",onClick:ue})]),_:1},8,["text"])):U("",!0),_.value?(m(),se(D,{key:1,text:k(n)("ai.chat.message.fork.tooltip"),class:"no-capture"},{default:de(()=>[F(Q,{icon:"i-heroicons-arrow-top-right-on-square",variant:"ghost",color:"neutral",size:"xs",onClick:b[1]||(b[1]=R=>o("fork",e.messageId))})]),_:1},8,["text"])):U("",!0),e.showCaptureButton&&!c.value&&!e.isStreaming?(m(),se(so,{key:2,size:"xs",color:"neutral",type:"element","target-selector":".qa-pair","markdown-fix":"","capture-frame":"","progressive-narrowing":!0})):U("",!0),h("span",ld,w(l.value),1)])):U("",!0)],2)],10,Xc)}}});var ud=/(^|[^`])`([^`]+)`(?!`)$/,dd=/(^|[^`])`([^`]+)`(?!`)/g,ga=Nt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",fe(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Pt({find:ud,type:this.type})]},addPasteRules(){return[xt({find:dd,type:this.type})]}}),pd=ga,ma=Ee.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",fe(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!bi(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:s}=n,r=e();return sa(n)?r.insertContentAt(s.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:i,tr:a,dispatch:o})=>{if(o){const{$to:l}=a.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?a.setSelection(vt.create(a.doc,l.pos+1)):l.nodeAfter.isBlock?a.setSelection(Or.create(a.doc,l.pos)):a.setSelection(vt.create(a.doc,l.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u?.create();d&&(a.insert(c,d),a.setSelection(vt.create(a.doc,c+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ra({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),hd=ma,fd=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,gd=Ee.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",fe(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,s,r,i,a;const o=(n=(t=e.attrs)==null?void 0:t.src)!=null?n:"",l=(r=(s=e.attrs)==null?void 0:s.alt)!=null?r:"",c=(a=(i=e.attrs)==null?void 0:i.title)!=null?a:"";return c?`![${l}](${o} "${c}")`:`![${l}](${o})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:s}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:a,editor:o})=>{const l=document.createElement("img");Object.entries(a).forEach(([d,p])=>{if(p!=null)switch(d){case"width":case"height":break;default:l.setAttribute(d,p);break}}),l.src=a.src;const c=new wi({element:l,editor:o,node:r,getPos:i,onResize:(d,p)=>{l.style.width=`${d}px`,l.style.height=`${p}px`},onCommit:(d,p)=>{const f=i();f!==void 0&&this.editor.chain().setNodeSelection(f).updateAttributes(this.name,{width:d,height:p}).run()},onUpdate:(d,p,f)=>d.type===r.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:s===!0}}),u=c.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",l.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},c}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[ra({find:fd,type:this.type,getAttributes:e=>{const[,,t,n,s]=e;return{src:n,alt:t,title:s}}})]}}),md=gd;function yd({editor:e,overrideSuggestionOptions:t,extensionName:n,char:s="@"}){const r=new Be;return{editor:e,char:s,pluginKey:r,command:({editor:i,range:a,props:o})=>{var l,c,u;const d=i.view.state.selection.$to.nodeAfter;(l=d?.text)!=null&&l.startsWith(" ")&&(a.to+=1),i.chain().focus().insertContentAt(a,[{type:n,attrs:{...o,mentionSuggestionChar:s}},{type:"text",text:" "}]).run(),(u=(c=i.view.dom.ownerDocument.defaultView)==null?void 0:c.getSelection())==null||u.collapseToEnd()},allow:({state:i,range:a})=>{const o=i.doc.resolve(a.from),l=i.schema.nodes[n];return!!o.parent.type.contentMatch.matchType(l)},...t}}function ya(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>yd({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function Cs(e,t){const n=ya(e),s=n.find(r=>r.char===t);return s||(n.length?n[0]:null)}var vd=Ee.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var n,s;return`${(n=t?.char)!=null?n:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:n}){var s,r;return["span",fe(this.HTMLAttributes,e.HTMLAttributes),`${(s=n?.char)!=null?s:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const n=Cs(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",fe({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:n})];const s={...this.options};s.HTMLAttributes=fe({"data-type":this.name},this.options.HTMLAttributes,t);const r=this.options.renderHTML({options:s,node:e,suggestion:n});return typeof r=="string"?["span",fe({"data-type":this.name},this.options.HTMLAttributes,t),r]:r},...Ci({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let s=n.exec(e);for(;s!==null;){const[,r,i,a]=s,o=i??a;t[r==="char"?"mentionSuggestionChar":r]=o,s=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t==="mentionSuggestionChar"?"char":t}="${n}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:Cs(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1;const{selection:s}=t,{empty:r,anchor:i}=s;if(!r)return!1;let a=new Ti,o=0;return t.doc.nodesBetween(i-1,i,(l,c)=>{if(l.type.name===this.name)return n=!0,a=l,o=c,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?"":a.attrs.mentionSuggestionChar,o,o+a.nodeSize),n})}},addProseMirrorPlugins(){return ya(this).map(_i)}}),kd=vd;function xd(e={}){return new Ue({view(t){return new bd(t,e)}})}class bd{constructor(t,n){var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=a=>{this[r](a)};return t.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,s,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(n){let d=t.nodeBefore,p=t.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let y=f.getBoundingClientRect(),_=d?y.bottom:y.top;d&&p&&(_=(_+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let M=this.width/2*o;s={left:y.left,right:y.right,top:_-M,bottom:_+M}}}}if(!s){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*a;s={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(s.left-c)/a+"px",this.element.style.top=(s.top-u)/o+"px",this.element.style.width=(s.right-s.left)/a+"px",this.element.style.height=(s.bottom-s.top)/o+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=s&&s.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,n,t):r;if(n&&!i){let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=Si(this.editorView.state.doc,a,this.editorView.dragging.slice);o!=null&&(a=o)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class ke extends tn{constructor(t){super(t,t)}map(t,n){let s=t.resolve(n.map(this.head));return ke.valid(s)?new ke(s):tn.near(s)}content(){return aa.empty}eq(t){return t instanceof ke&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ke(t.resolve(n.pos))}getBookmark(){return new Dr(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!wd(t)||!_d(t))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let r=n.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,s=!1){e:for(;;){if(!s&&ke.valid(t))return t;let r=t.pos,i=null;for(let a=t.depth;;a--){let o=t.node(a);if(n>0?t.indexAfter(a)<o.childCount:t.index(a)>0){i=o.child(n>0?t.indexAfter(a):t.index(a)-1);break}else if(a==0)return null;r+=n;let l=t.doc.resolve(r);if(ke.valid(l))return l}for(;;){let a=n>0?i.firstChild:i.lastChild;if(!a){if(i.isAtom&&!i.isText&&!Or.isSelectable(i)){t=t.doc.resolve(r+i.nodeSize*n),s=!1;continue e}break}i=a,r+=n;let o=t.doc.resolve(r);if(ke.valid(o))return o}return null}}}ke.prototype.visible=!1;ke.findFrom=ke.findGapCursorFrom;tn.jsonID("gapcursor",ke);class Dr{constructor(t){this.pos=t}map(t){return new Dr(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return ke.valid(n)?new ke(n):tn.near(n)}}function va(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function wd(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),s=e.node(t);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||va(r.type))return!0;if(r.inlineContent)return!1}}return!0}function _d(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),s=e.node(t);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||va(r.type))return!0;if(r.inlineContent)return!1}}return!0}function Td(){return new Ue({props:{decorations:Ad,createSelectionBetween(e,t,n){return t.pos==n.pos&&ke.valid(n)?new ke(n):null},handleClick:Sd,handleKeyDown:Cd,handleDOMEvents:{beforeinput:Md}}})}const Cd=Mi({ArrowLeft:un("horiz",-1),ArrowRight:un("horiz",1),ArrowUp:un("vert",-1),ArrowDown:un("vert",1)});function un(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(s,r,i){let a=s.selection,o=t>0?a.$to:a.$from,l=a.empty;if(a instanceof vt){if(!i.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=s.doc.resolve(t>0?o.after():o.before())}let c=ke.findGapCursorFrom(o,t,l);return c?(r&&r(s.tr.setSelection(new ke(c))),!0):!1}}function Sd(e,t,n){if(!e||!e.editable)return!1;let s=e.state.doc.resolve(t);if(!ke.valid(s))return!1;let r=e.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&Or.isSelectable(e.state.doc.nodeAt(r.inside))?!1:(e.dispatch(e.state.tr.setSelection(new ke(s))),!0)}function Md(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof ke))return!1;let{$from:n}=e.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!s)return!1;let r=us.empty;for(let a=s.length-1;a>=0;a--)r=us.from(s[a].createAndFill(null,r));let i=e.state.tr.replace(n.pos,n.pos,new aa(r,0,0));return i.setSelection(vt.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Ad(e){if(!(e.selection instanceof ke))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",en.create(e.doc,[rr.widget(e.selection.head,t,{key:"gapcursor"})])}var bn=200,Ce=function(){};Ce.prototype.append=function(t){return t.length?(t=Ce.from(t),!this.length&&t||t.length<bn&&this.leafAppend(t)||this.length<bn&&t.leafPrepend(this)||this.appendInner(t)):this};Ce.prototype.prepend=function(t){return t.length?Ce.from(t).append(this):this};Ce.prototype.appendInner=function(t){return new Ld(this,t)};Ce.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Ce.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};Ce.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ce.prototype.forEach=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(t,n,s,0):this.forEachInvertedInner(t,n,s,0)};Ce.prototype.map=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var r=[];return this.forEach(function(i,a){return r.push(t(i,a))},n,s),r};Ce.from=function(t){return t instanceof Ce?t:t&&t.length?new ka(t):Ce.empty};var ka=(function(e){function t(s){e.call(this),this.values=s}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new t(this.values.slice(r,i))},t.prototype.getInner=function(r){return this.values[r]},t.prototype.forEachInner=function(r,i,a,o){for(var l=i;l<a;l++)if(r(this.values[l],o+l)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,a,o){for(var l=i-1;l>=a;l--)if(r(this.values[l],o+l)===!1)return!1},t.prototype.leafAppend=function(r){if(this.length+r.length<=bn)return new t(this.values.concat(r.flatten()))},t.prototype.leafPrepend=function(r){if(this.length+r.length<=bn)return new t(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})(Ce);Ce.empty=new ka([]);var Ld=(function(e){function t(n,s){e.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(s){return s<this.left.length?this.left.get(s):this.right.get(s-this.left.length)},t.prototype.forEachInner=function(s,r,i,a){var o=this.left.length;if(r<o&&this.left.forEachInner(s,r,Math.min(i,o),a)===!1||i>o&&this.right.forEachInner(s,Math.max(r-o,0),Math.min(this.length,i)-o,a+o)===!1)return!1},t.prototype.forEachInvertedInner=function(s,r,i,a){var o=this.left.length;if(r>o&&this.right.forEachInvertedInner(s,r-o,Math.max(i,o)-o,a+o)===!1||i<o&&this.left.forEachInvertedInner(s,Math.min(r,o),i,a)===!1)return!1},t.prototype.sliceInner=function(s,r){if(s==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(s,r):s>=i?this.right.slice(s-i,r-i):this.left.slice(s,i).append(this.right.slice(0,r-i))},t.prototype.leafAppend=function(s){var r=this.right.leafAppend(s);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(s){var r=this.left.leafPrepend(s);if(r)return new t(r,this.right)},t.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new t(this.left,new t(this.right,s)):new t(this,s)},t})(Ce);const $d=500;class Qe{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let r,i;n&&(r=this.remapping(s,this.items.length),i=r.maps.length);let a=t.tr,o,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){r||(r=this.remapping(s,p+1),i=r.maps.length),i--,u.push(d);return}if(r){u.push(new Ze(d.map));let f=d.step.map(r.slice(i)),y;f&&a.maybeStep(f).doc&&(y=a.mapping.maps[a.mapping.maps.length-1],c.push(new Ze(y,void 0,void 0,c.length+u.length))),i--,y&&r.appendMap(y,i)}else a.maybeStep(d.step);if(d.selection)return o=r?d.selection.map(r.slice(i)):d.selection,l=new Qe(this.items.slice(0,s).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:a,selection:o}}addTransform(t,n,s,r){let i=[],a=this.eventCount,o=this.items,l=!r&&o.length?o.get(o.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),p=new Ze(t.mapping.maps[u],d,n),f;(f=l&&l.merge(p))&&(p=f,u?i.pop():o=o.slice(0,o.length-1)),i.push(p),n&&(a++,n=void 0),r||(l=p)}let c=a-s.depth;return c>Id&&(o=Ed(o,c),a-=c),new Qe(o.append(i),a)}remapping(t,n){let s=new Ai;return this.items.forEach((r,i)=>{let a=r.mirrorOffset!=null&&i-r.mirrorOffset>=t?s.maps.length-r.mirrorOffset:void 0;s.appendMap(r.map,a)},t,n),s}addMaps(t){return this.eventCount==0?this:new Qe(this.items.append(t.map(n=>new Ze(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let s=[],r=Math.max(0,this.items.length-n),i=t.mapping,a=t.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},r);let l=n;this.items.forEach(p=>{let f=i.getMirror(--l);if(f==null)return;a=Math.min(a,f);let y=i.maps[f];if(p.step){let _=t.steps[f].invert(t.docs[f]),M=p.selection&&p.selection.map(i.slice(l+1,f));M&&o++,s.push(new Ze(y,_,M))}else s.push(new Ze(y))},r);let c=[];for(let p=n;p<a;p++)c.push(new Ze(i.maps[p]));let u=this.items.slice(0,r).append(c).append(s),d=new Qe(u,o);return d.emptyItemCount()>$d&&(d=d.compress(this.items.length-s.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),s=n.maps.length,r=[],i=0;return this.items.forEach((a,o)=>{if(o>=t)r.push(a),a.selection&&i++;else if(a.step){let l=a.step.map(n.slice(s)),c=l&&l.getMap();if(s--,c&&n.appendMap(c,s),l){let u=a.selection&&a.selection.map(n.slice(s));u&&i++;let d=new Ze(c.invert(),l,u),p,f=r.length-1;(p=r.length&&r[f].merge(d))?r[f]=p:r.push(d)}}else a.map&&s--},this.items.length,0),new Qe(Ce.from(r.reverse()),i)}}Qe.empty=new Qe(Ce.empty,0);function Ed(e,t){let n;return e.forEach((s,r)=>{if(s.selection&&t--==0)return n=r,!1}),e.slice(n)}class Ze{constructor(t,n,s,r){this.map=t,this.step=n,this.selection=s,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Ze(n.getMap().invert(),n,this.selection)}}}class lt{constructor(t,n,s,r,i){this.done=t,this.undone=n,this.prevRanges=s,this.prevTime=r,this.prevComposition=i}}const Id=20;function Rd(e,t,n,s){let r=n.getMeta(kt),i;if(r)return r.historyState;n.getMeta(Nd)&&(e=new lt(e.done,e.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(a&&a.getMeta(kt))return a.getMeta(kt).redo?new lt(e.done.addTransform(n,void 0,s,vn(t)),e.undone,Ss(n.mapping.maps),e.prevTime,e.prevComposition):new lt(e.done,e.undone.addTransform(n,void 0,s,vn(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=e.prevTime==0||!a&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-s.newGroupDelay||!Pd(n,e.prevRanges)),c=a?dr(e.prevRanges,n.mapping):Ss(n.mapping.maps);return new lt(e.done.addTransform(n,l?t.selection.getBookmark():void 0,s,vn(t)),Qe.empty,c,n.time,o??e.prevComposition)}else return(i=n.getMeta("rebased"))?new lt(e.done.rebased(n,i),e.undone.rebased(n,i),dr(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new lt(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),dr(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Pd(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((s,r)=>{for(let i=0;i<t.length;i+=2)s<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function Ss(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((s,r,i,a)=>t.push(i,a));return t}function dr(e,t){if(!e)return null;let n=[];for(let s=0;s<e.length;s+=2){let r=t.map(e[s],1),i=t.map(e[s+1],-1);r<=i&&n.push(r,i)}return n}function Hd(e,t,n){let s=vn(t),r=kt.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,s);if(!i)return null;let a=i.selection.resolve(i.transform.doc),o=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),r,s),l=new lt(n?o:i.remaining,n?i.remaining:o,null,0,-1);return i.transform.setSelection(a).setMeta(kt,{redo:n,historyState:l})}let pr=!1,Ms=null;function vn(e){let t=e.plugins;if(Ms!=t){pr=!1,Ms=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){pr=!0;break}}return pr}const kt=new Be("history"),Nd=new Be("closeHistory");function zd(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ue({key:kt,state:{init(){return new lt(Qe.empty,Qe.empty,null,0,-1)},apply(t,n,s){return Rd(n,s,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let s=n.inputType,r=s=="historyUndo"?ba:s=="historyRedo"?wa:null;return!r||!t.editable?!1:(n.preventDefault(),r(t.state,t.dispatch))}}}})}function xa(e,t){return(n,s)=>{let r=kt.getState(n);if(!r||(e?r.undone:r.done).eventCount==0)return!1;if(s){let i=Hd(r,n,e);i&&s(t?i.scrollIntoView():i)}return!0}}const ba=xa(!1,!0),wa=xa(!0,!0);Ke.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)==="textSize"){const s=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(s)}return t.nodeSize},this.storage.words=e=>{const t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Ue({key:new Be("characterCount"),appendTransaction:(t,n,s)=>{if(e)return;const r=this.options.limit;if(r==null||r===0){e=!0;return}const i=this.storage.characters({node:s.doc});if(i>r){const a=i-r,o=0,l=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const c=s.tr.deleteRange(o,l);return e=!0,c}e=!0},filterTransaction:(t,n)=>{const s=this.options.limit;if(!t.docChanged||s===0||s===null||s===void 0)return!0;const r=this.storage.characters({node:n.doc}),i=this.storage.characters({node:t.doc});if(i<=s||r>s&&i>s&&i<=r)return!0;if(r>s&&i>s&&i>r||!t.getMeta("paste"))return!1;const o=t.selection.$head.pos,l=i-s,c=o-l,u=o;return t.deleteRange(c,u),!(this.storage.characters({node:t.doc})>s)}})]}});var Od=Ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[xd(this.options)]}});Ke.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ue({key:new Be("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:s}=this.editor,{anchor:r}=t,i=[];if(!n||!s)return en.create(e,[]);let a=0;this.options.mode==="deepest"&&e.descendants((l,c)=>{if(l.isText)return;if(!(r>=c&&r<=c+l.nodeSize-1))return!1;a+=1});let o=0;return e.descendants((l,c)=>{if(l.isText||!(r>=c&&r<=c+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&a-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";i.push(rr.node(c,c+l.nodeSize,{class:this.options.className}))}),en.create(e,i)}}})]}});var Bd=Ke.create({name:"gapCursor",addProseMirrorPlugins(){return[Td()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Li($t(e,"allowGapCursor",n)))!=null?t:null}}}),As="placeholder";function Dd(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var jd=Ke.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:As,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${Dd(this.options.dataAttribute)}`:`data-${As}`;return[new Ue({key:new Be("placeholder"),props:{decorations:({doc:t,selection:n})=>{const s=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=n,i=[];if(!s)return null;const a=this.editor.isEmpty;return t.descendants((o,l)=>{const c=r>=l&&r<=l+o.nodeSize,u=!o.isLeaf&&$i(o);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];a&&d.push(this.options.emptyEditorClass);const p=rr.node(l,l+o.nodeSize,{class:d.join(" "),[e]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:c}):this.options.placeholder});i.push(p)}return this.options.includeChildren}),en.create(t,i)}}})]}});Ke.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Ue({key:new Be("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||sa(n.selection)||e.view.dragging?null:en.create(n.doc,[rr.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function Ls({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Fd=Ke.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Be(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",s=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(n).includes(r.name));return[new Ue({key:t,appendTransaction:(r,i,a)=>{const{doc:o,tr:l,schema:c}=a,u=t.getState(a),d=o.content.size,p=c.nodes[n];if(u)return l.insert(d,p.create())},state:{init:(r,i)=>{const a=i.tr.doc.lastChild;return!Ls({node:a,types:s})},apply:(r,i)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return i;const a=r.doc.lastChild;return!Ls({node:a,types:s})}}})]}}),qd=Ke.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>ba(e,t),redo:()=>({state:e,dispatch:t})=>wa(e,t)}},addProseMirrorPlugins(){return[zd(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ud=jd;function jr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ct=jr();function _a(e){Ct=e}var Vt={exec:()=>null};function ce(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace($e.caret,"$1"),n=n.replace(r,a),s},getRegex:()=>new RegExp(n,t)};return s}var Kd=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),$e={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Wd=/^(?:[ \t]*(?:\n|$))+/,Vd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Gd=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,sn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Yd=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fr=/(?:[*+-]|\d{1,9}[.)])/,Ta=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ca=ce(Ta).replace(/bull/g,Fr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Qd=ce(Ta).replace(/bull/g,Fr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),qr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Jd=/^[^\n]+/,Ur=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Zd=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ur).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xd=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Fr).getRegex(),sr="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Kr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ep=ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Kr).replace("tag",sr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Sa=ce(qr).replace("hr",sn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sr).getRegex(),tp=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Sa).getRegex(),Wr={blockquote:tp,code:Vd,def:Zd,fences:Gd,heading:Yd,hr:sn,html:ep,lheading:Ca,list:Xd,newline:Wd,paragraph:Sa,table:Vt,text:Jd},$s=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",sn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sr).getRegex(),np={...Wr,lheading:Qd,table:$s,paragraph:ce(qr).replace("hr",sn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$s).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sr).getRegex()},rp={...Wr,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Kr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Vt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(qr).replace("hr",sn).replace("heading",` *#{1,6} *[^
39
+ `):""),os=S(()=>!a.isStreaming&&is.value.trim().length>0);async function Xa(){if(os.value)try{await navigator.clipboard.writeText(is.value),i.success(n("ai.chat.message.copy.success"))}catch(g){i.fail(n("ai.chat.message.copy.failed"),{description:String(g)})}}return(g,b)=>{const T=Ne,Q=tr,D=na;return m(),x("div",{class:Y(["flex items-start gap-3",[c.value&&!d.value?"flex-row-reverse":"",u.value?"justify-center":"",e.highlighted?"rounded-xl ring-2 ring-primary-400/70 ring-offset-4 dark:ring-offset-gray-950":""]]),"data-ai-message-id":e.messageId},[h("div",{class:Y(["group/message",[c.value&&!d.value?"flex max-w-[85%] min-w-0 flex-col items-end":"w-full min-w-0"]])},[u.value?(m(),x("details",eu,[h("summary",tu,[F(T,{name:"i-heroicons-arrow-path",class:"h-3.5 w-3.5 shrink-0"}),h("span",null,w(k(n)("ai.chat.message.summary.label")),1),F(T,{name:"i-heroicons-chevron-right",class:"ml-auto h-3 w-3 transition-transform [[open]>&]:rotate-90"})]),h("div",nu,[h("div",{class:"prose prose-sm dark:prose-invert max-w-none text-xs leading-relaxed text-gray-600 dark:text-gray-300",innerHTML:E.value},null,8,ru),h("p",su,w(k(n)("ai.chat.message.summary.info")),1)])])):c.value?(m(),x(me,{key:1},[d.value?(m(),x("div",au,[Zs(h("textarea",{ref_key:"editTextareaRef",ref:f,"onUpdate:modelValue":b[0]||(b[0]=R=>p.value=R),rows:"2",class:"w-full resize-none rounded-xl border border-primary-200 bg-white/90 px-4 py-3 text-sm leading-relaxed outline-none focus:border-primary-400 dark:border-primary-400/40 dark:bg-page-dark/70",onInput:G,onKeydown:[yn(mt(te,["prevent"]),["esc"]),yn(mt(V,["ctrl","prevent"]),["enter"]),yn(mt(V,["meta","prevent"]),["enter"])]},null,40,iu),[[Xs,p.value]]),h("div",ou,[h("div",lu,[F(Q,{size:"xs",variant:"ghost",color:"gray",onClick:te},{default:de(()=>[He(w(k(n)("common.cancel")),1)]),_:1}),F(Q,{size:"xs",color:"primary",onClick:V},{default:de(()=>[He(w(k(n)("ai.chat.message.edit.submit")),1)]),_:1})])])])):(m(),x("div",cu,[e.entityRefs?.length?(m(),x("div",uu,[(m(!0),x(me,null,_e(e.entityRefs,R=>(m(),x("span",{key:R.type==="contact"?`contact:${R.contactKey}`:`session:${R.sessionId}`,class:"inline-flex items-center gap-1 rounded-full bg-white/70 px-2 py-0.5 text-xs text-primary-600 dark:bg-white/10 dark:text-primary-300"},[F(T,{name:R.type==="contact"?"i-heroicons-user":"i-heroicons-user-group",class:"h-3 w-3"},null,8,["name"]),He(" "+w(R.displayName),1)]))),128))])):q("",!0),h("div",{class:"prose prose-sm dark:prose-invert max-w-none",innerHTML:E.value},null,8,du)]))],64)):Mt.value?(m(),x("div",{key:2,class:Y(ie.value?"space-y-2":"space-y-3")},[(m(!0),x(me,null,_e(K.value,(R,le)=>(m(),x("div",{key:le},[R.type==="process"?(m(),x("button",{key:0,type:"button",class:"ai-live-row group/process flex h-6 w-full min-w-0 max-w-full items-center text-left text-sm leading-6 text-gray-500 transition-colors hover:text-gray-700 focus:outline-none focus-visible:bg-gray-50 dark:text-gray-400 dark:hover:text-gray-200 dark:focus-visible:bg-gray-800/30","data-running":we(le)||void 0,"aria-expanded":oe(le),onClick:P=>Se(le)},[!he(R)||Ie(R)?(m(),x("span",hu,[oe(le)?(m(),ae(T,{key:0,name:"i-heroicons-chevron-down",class:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"})):(m(),x(me,{key:1},[F(T,{name:ln(R,le),class:Y(["absolute h-3.5 w-3.5 text-gray-400 transition-opacity duration-100 group-hover/process:opacity-0 dark:text-gray-500",[Ie(R)?"text-amber-500 dark:text-amber-400":""]])},null,8,["name","class"]),F(T,{name:"i-heroicons-chevron-down",class:"absolute h-3.5 w-3.5 text-gray-500 opacity-0 transition-opacity duration-100 group-hover/process:opacity-100 dark:text-gray-400"})],64))])):q("",!0),h("span",{class:Y(["shrink-0",Ie(R)?"text-amber-700 dark:text-amber-300":"text-gray-600 dark:text-gray-300"])},w(or(R,le)),3),he(R)&&!Ie(R)?(m(),ae(T,{key:1,name:oe(le)?"i-heroicons-chevron-down":"i-heroicons-chevron-right",class:"ml-1 h-3.5 w-3.5 shrink-0 text-gray-500 dark:text-gray-400"},null,8,["name"])):q("",!0),!oe(le)&&ht(R,le)?(m(),x(me,{key:2},[b[2]||(b[2]=h("span",{class:"mx-2 h-0.5 w-0.5 shrink-0 rounded-full bg-gray-300 dark:bg-gray-600","aria-hidden":"true"},null,-1)),F(_s,{text:ht(R,le),"follow-end":we(le)},null,8,["text","follow-end"])],64)):q("",!0),on(R,le)?(m(),x("span",{key:3,class:Y(["shrink-0 text-xs text-gray-400 dark:text-gray-500",[!oe(le)&&ht(R,le)?"ml-3":"ml-1.5"]])},[oe(le)||!ht(R,le)?(m(),x("span",fu," · ")):q("",!0),He(" "+w(on(R,le)),1)],2)):q("",!0)],8,pu)):q("",!0),h("div",{class:Y(R.type==="process"?"ai-process-fold":""),"data-open":R.type!=="process"||oe(le)?!0:void 0},[h("div",{class:Y(R.type==="process"?"ai-process-fold-inner":"")},[h("div",{class:Y([R.type==="process"?["ai-process-fold-content",he(R)?"pt-2.5 space-y-1.5":"ml-1.5 pt-1 space-y-0.5 border-l border-gray-200/80 pl-3 dark:border-white/10"]:""])},[(m(!0),x(me,null,_e(j(R),(P,ei)=>(m(),x(me,{key:`${le}-${ei}`},[P.type==="text"?(m(),x("div",{key:0,class:Y(["text-gray-900 dark:text-gray-100",[R.type==="process"?he(R)?"py-2":"py-1 text-xs text-gray-500 dark:text-gray-400":ie.value?"py-1":""]])},[h("div",{class:Y(["prose dark:prose-invert max-w-none",[R.type==="process"&&!he(R)?"prose-sm leading-relaxed":"ai-chat-prose"]]),innerHTML:C(I(P.text))},null,10,mu),e.isStreaming&&Ae(P)?(m(),x("span",yu)):q("",!0)],2)):P.type==="think"?(m(),ae(Kt,{key:1,class:"w-full text-sm text-gray-500 dark:text-gray-400"},{summary:de(({open:ye,toggle:Re})=>[h("button",{type:"button",class:Y(["ai-live-row group/process-toggle flex w-full min-w-0 cursor-pointer select-none items-center text-left transition-colors hover:text-gray-700 dark:hover:text-gray-300",[he(R)?"h-7 text-sm leading-7":"h-6 text-sm leading-6"]]),"data-running":St(P)||void 0,"aria-expanded":ye,onClick:Re},[F(Wt,{icon:"i-heroicons-light-bulb",open:ye,class:"mr-1.5"},null,8,["open"]),h("span",ku,w(z(P.tag)),1),!ye&&P.tag?.toLowerCase()!=="plan_validation"&&(k(ur)(P.text)||St(P))?(m(),x("span",xu)):q("",!0),!ye&&P.tag?.toLowerCase()!=="plan_validation"?(m(),ae(_s,{key:1,text:St(P)?k(Ts)(P.text):k(ur)(P.text),"follow-end":St(P)},null,8,["text","follow-end"])):q("",!0),P.durationMs?(m(),x("span",bu,w(L(P.durationMs)),1)):q("",!0)],10,vu)]),default:de(()=>[h("div",wu,[P.tag==="plan_validation"&&ee(P.text)?(m(),x(me,{key:0},[ee(P.text)?.title?(m(),x("div",_u,w(ee(P.text)?.title),1)):q("",!0),h("ol",Tu,[(m(!0),x(me,null,_e(ee(P.text)?.steps,(ye,Re)=>(m(),x("li",{key:Re,class:"text-gray-600 dark:text-gray-300"},[h("div",Cu,w(ye.goal),1),ye.evidenceNeeded?(m(),x("div",Su,w(k(n)("ai.chat.message.plan.evidenceNeeded"))+": "+w(ye.evidenceNeeded),1)):q("",!0),h("div",Mu,w(k(n)("ai.chat.message.plan.suggestedTools"))+": "+w(We(ye.suggestedTools)),1)]))),128))]),ee(P.text)?.successCriteria.length?(m(),x("div",Au,[h("div",Lu,w(k(n)("ai.chat.message.plan.successCriteria")),1),h("ul",$u,[(m(!0),x(me,null,_e(ee(P.text)?.successCriteria,(ye,Re)=>(m(),x("li",{key:Re},w(ye),1))),128))])])):q("",!0)],64)):(m(),x("div",{key:1,innerHTML:C(P.text)},null,8,Eu))])]),_:2},1024)):P.type==="skill"?(m(),x("div",{key:2,class:Y(["flex items-center gap-2 font-medium text-gray-600 dark:text-gray-300",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs"]])},[F(T,{name:"i-heroicons-bolt",class:"h-3.5 w-3.5 shrink-0 text-gray-400"}),h("span",null,w(k(n)("ai.skill.active.label",{name:P.skillName})),1)],2)):P.type==="plan"?(m(),ae(Kt,{key:3,class:"group w-full text-sm text-gray-600 dark:text-gray-400"},{summary:de(({open:ye,toggle:Re})=>[h("button",{type:"button",class:Y(["group/process-toggle flex w-full cursor-pointer select-none items-center gap-2 rounded-md text-left text-gray-500 transition-colors hover:bg-gray-50/80 hover:text-gray-700 dark:hover:bg-gray-800/30 dark:hover:text-gray-300",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs"]]),"aria-expanded":ye,onClick:Re},[F(Wt,{icon:"i-heroicons-clipboard-document-list",open:ye},null,8,["open"]),h("span",Ru,w(k(n)("ai.chat.message.plan.label"))+" · "+w(P.plan.title),1)],10,Iu)]),default:de(()=>[h("div",Pu,[P.displayText?(m(),x("div",{key:0,class:"prose prose-sm ai-process-detail-content dark:prose-invert max-w-none text-gray-600 dark:text-gray-300",innerHTML:C(P.displayText)},null,8,Hu)):(m(),x("ol",Nu,[(m(!0),x(me,null,_e(P.plan.steps,(ye,Re)=>(m(),x("li",{key:Re,class:"text-sm leading-6"},[h("div",zu,w(Re+1)+". "+w(ye.goal),1),h("div",Ou,w(k(n)("ai.chat.message.plan.evidenceNeeded"))+": "+w(ye.evidenceNeeded),1),h("div",Bu,w(k(n)("ai.chat.message.plan.suggestedTools"))+": "+w(We(ye.suggestedTools)),1)]))),128))])),P.displayText?q("",!0):(m(),x("div",Du,[h("div",ju,w(k(n)("ai.chat.message.plan.successCriteria")),1),h("ul",Fu,[(m(!0),x(me,null,_e(P.plan.successCriteria,(ye,Re)=>(m(),x("li",{key:Re},w(ye),1))),128))])]))])]),_:2},1024)):P.type==="plan_draft"?(m(),x("div",qu,[h("div",Uu,[F(T,{name:"i-heroicons-clipboard-document-list",class:"h-3.5 w-3.5 shrink-0 text-gray-400"}),h("span",null,w(k(n)("ai.chat.message.plan.label")),1),e.isStreaming?(m(),x("span",Ku,w(k(n)("ai.chat.message.process.planning")),1)):q("",!0)]),h("div",{class:"mt-2 prose prose-sm dark:prose-invert max-w-none text-xs leading-relaxed text-gray-600 dark:text-gray-300",innerHTML:C(P.text)},null,8,Wu)])):P.type==="chart"?(m(),ae(Wl,{key:5,chart:P.chart},null,8,["chart"])):P.type==="evidence"?(m(),ae(vc,{key:6,evidence:P.evidence},null,8,["evidence"])):P.type==="cross_chat_evidence"?(m(),ae(Oc,{key:7,evidence:P.evidence},null,8,["evidence"])):P.type==="tool"&&N(P.tool)?(m(),ae(Kt,{key:8,class:"group w-full max-w-full"},{summary:de(({open:ye,toggle:Re})=>[h("button",{type:"button",class:Y(["group/process-toggle flex w-full cursor-pointer select-none items-center gap-2 rounded-md text-left text-gray-500 transition-colors hover:bg-gray-50/80 dark:text-gray-400 dark:hover:bg-gray-800/30",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs",P.tool.status==="error"?"text-amber-700 dark:text-amber-400":""]]),"aria-expanded":ye,onClick:Re},[F(Wt,{icon:P.tool.status==="error"?"i-heroicons-exclamation-circle":"i-heroicons-wrench-screwdriver",open:ye,"icon-class":P.tool.status==="error"?"text-amber-500":"text-gray-400 dark:text-gray-500"},null,8,["icon","open","icon-class"]),h("span",{class:Y(["shrink-0",[P.tool.status==="error"?"text-amber-700 dark:text-amber-300":"text-gray-600 dark:text-gray-300"]])},w(ft(P.tool)),3),Bt(P.tool)?(m(),x("span",Gu,w(Bt(P.tool)),1)):q("",!0),h("span",Yu,w(k(n)("ai.chat.message.toolResult.view")),1)],10,Vu)]),default:de(()=>[h("div",Qu,[h("div",Ju,[h("span",Zu,w(k(n)("ai.chat.message.toolResult.title")),1),F(Q,{size:"xs",variant:"ghost",color:"primary",icon:"i-heroicons-document-duplicate",title:k(n)("ai.chat.message.toolResult.copy"),onClick:mt(ye=>Le(P.tool),["stop"])},null,8,["title","onClick"])]),X(P.tool)?(m(),x("div",Xu,w(k(n)("ai.chat.message.toolResult.displayTruncated")),1)):q("",!0),h("pre",ed,w($(P.tool)),1)])]),_:2},1024)):P.type==="tool"?(m(),x("div",{key:9,class:Y(["ai-live-row flex min-w-0 items-center gap-2",[he(R)?"h-7 text-sm leading-7":"py-1 text-xs",P.tool.status==="error"?"text-amber-700 dark:text-amber-400":"text-gray-500 dark:text-gray-400"]]),"data-running":P.tool.status==="running"||void 0},[F(T,{name:P.tool.status==="running"?"i-heroicons-arrow-path":P.tool.status==="error"?"i-heroicons-exclamation-circle":"i-heroicons-wrench-screwdriver",class:Y(["h-3.5 w-3.5 shrink-0",[P.tool.status==="running"?"animate-spin text-primary-500":P.tool.status==="error"?"text-amber-500":"text-gray-400"]])},null,8,["name","class"]),h("span",{class:Y(["shrink-0",[P.tool.status==="error"?"text-amber-700 dark:text-amber-300":"text-gray-600 dark:text-gray-300"]])},w(ft(P.tool)),3),Bt(P.tool)?(m(),x("span",nd,w(Bt(P.tool)),1)):q("",!0),P.tool.status==="done"&&P.tool.durationMs?(m(),x("span",rd,w(L(P.tool.durationMs)),1)):q("",!0)],10,td)):P.type==="error"?(m(),ae(Sl,{key:10,error:P.error,compact:R.type==="process"},null,8,["error","compact"])):q("",!0)],64))),128))],2)],2)],10,gu)]))),128))],2)):(m(),x("div",sd,[h("div",{class:"prose ai-chat-prose dark:prose-invert max-w-none",innerHTML:E.value},null,8,ad),e.isStreaming?(m(),x("span",id)):q("",!0)])),!u.value&&!e.isStreaming?(m(),x("div",od,[F(D,{text:k(n)("ai.chat.message.copy.tooltip"),class:"no-capture"},{default:de(()=>[F(Q,{icon:"i-heroicons-document-duplicate",variant:"ghost",color:"neutral",size:"xs",disabled:!os.value,onClick:Xa},null,8,["disabled"])]),_:1},8,["text"]),y.value?(m(),ae(D,{key:0,text:k(n)("ai.chat.message.edit.tooltip"),class:"no-capture"},{default:de(()=>[F(Q,{icon:"i-heroicons-pencil-square",variant:"ghost",color:"neutral",size:"xs",onClick:ue})]),_:1},8,["text"])):q("",!0),_.value?(m(),ae(D,{key:1,text:k(n)("ai.chat.message.fork.tooltip"),class:"no-capture"},{default:de(()=>[F(Q,{icon:"i-heroicons-arrow-top-right-on-square",variant:"ghost",color:"neutral",size:"xs",onClick:b[1]||(b[1]=R=>o("fork",e.messageId))})]),_:1},8,["text"])):q("",!0),e.showCaptureButton&&!c.value&&!e.isStreaming?(m(),ae(so,{key:2,size:"xs",color:"neutral",type:"element","target-selector":".qa-pair","markdown-fix":"","capture-frame":"","progressive-narrowing":!0})):q("",!0),h("span",ld,w(l.value),1)])):q("",!0)],2)],10,Xc)}}});var ud=/(^|[^`])`([^`]+)`(?!`)$/,dd=/(^|[^`])`([^`]+)`(?!`)/g,ga=Nt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",fe(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Pt({find:ud,type:this.type})]},addPasteRules(){return[xt({find:dd,type:this.type})]}}),pd=ga,ma=Ee.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",fe(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!bi(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:s}=n,r=e();return sa(n)?r.insertContentAt(s.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:i,tr:a,dispatch:o})=>{if(o){const{$to:l}=a.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?a.setSelection(vt.create(a.doc,l.pos+1)):l.nodeAfter.isBlock?a.setSelection(Or.create(a.doc,l.pos)):a.setSelection(vt.create(a.doc,l.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u?.create();d&&(a.insert(c,d),a.setSelection(vt.create(a.doc,c+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ra({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),hd=ma,fd=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,gd=Ee.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",fe(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,s,r,i,a;const o=(n=(t=e.attrs)==null?void 0:t.src)!=null?n:"",l=(r=(s=e.attrs)==null?void 0:s.alt)!=null?r:"",c=(a=(i=e.attrs)==null?void 0:i.title)!=null?a:"";return c?`![${l}](${o} "${c}")`:`![${l}](${o})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:s}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:a,editor:o})=>{const l=document.createElement("img");Object.entries(a).forEach(([d,p])=>{if(p!=null)switch(d){case"width":case"height":break;default:l.setAttribute(d,p);break}}),l.src=a.src;const c=new wi({element:l,editor:o,node:r,getPos:i,onResize:(d,p)=>{l.style.width=`${d}px`,l.style.height=`${p}px`},onCommit:(d,p)=>{const f=i();f!==void 0&&this.editor.chain().setNodeSelection(f).updateAttributes(this.name,{width:d,height:p}).run()},onUpdate:(d,p,f)=>d.type===r.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:s===!0}}),u=c.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",l.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},c}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[ra({find:fd,type:this.type,getAttributes:e=>{const[,,t,n,s]=e;return{src:n,alt:t,title:s}}})]}}),md=gd;function yd({editor:e,overrideSuggestionOptions:t,extensionName:n,char:s="@"}){const r=new Be;return{editor:e,char:s,pluginKey:r,command:({editor:i,range:a,props:o})=>{var l,c,u;const d=i.view.state.selection.$to.nodeAfter;(l=d?.text)!=null&&l.startsWith(" ")&&(a.to+=1),i.chain().focus().insertContentAt(a,[{type:n,attrs:{...o,mentionSuggestionChar:s}},{type:"text",text:" "}]).run(),(u=(c=i.view.dom.ownerDocument.defaultView)==null?void 0:c.getSelection())==null||u.collapseToEnd()},allow:({state:i,range:a})=>{const o=i.doc.resolve(a.from),l=i.schema.nodes[n];return!!o.parent.type.contentMatch.matchType(l)},...t}}function ya(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>yd({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function Cs(e,t){const n=ya(e),s=n.find(r=>r.char===t);return s||(n.length?n[0]:null)}var vd=Ee.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var n,s;return`${(n=t?.char)!=null?n:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:n}){var s,r;return["span",fe(this.HTMLAttributes,e.HTMLAttributes),`${(s=n?.char)!=null?s:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const n=Cs(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",fe({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:n})];const s={...this.options};s.HTMLAttributes=fe({"data-type":this.name},this.options.HTMLAttributes,t);const r=this.options.renderHTML({options:s,node:e,suggestion:n});return typeof r=="string"?["span",fe({"data-type":this.name},this.options.HTMLAttributes,t),r]:r},...Ci({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let s=n.exec(e);for(;s!==null;){const[,r,i,a]=s,o=i??a;t[r==="char"?"mentionSuggestionChar":r]=o,s=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t==="mentionSuggestionChar"?"char":t}="${n}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:Cs(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1;const{selection:s}=t,{empty:r,anchor:i}=s;if(!r)return!1;let a=new Ti,o=0;return t.doc.nodesBetween(i-1,i,(l,c)=>{if(l.type.name===this.name)return n=!0,a=l,o=c,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?"":a.attrs.mentionSuggestionChar,o,o+a.nodeSize),n})}},addProseMirrorPlugins(){return ya(this).map(_i)}}),kd=vd;function xd(e={}){return new Ue({view(t){return new bd(t,e)}})}class bd{constructor(t,n){var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=a=>{this[r](a)};return t.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,s,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(n){let d=t.nodeBefore,p=t.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let y=f.getBoundingClientRect(),_=d?y.bottom:y.top;d&&p&&(_=(_+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let M=this.width/2*o;s={left:y.left,right:y.right,top:_-M,bottom:_+M}}}}if(!s){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*a;s={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(s.left-c)/a+"px",this.element.style.top=(s.top-u)/o+"px",this.element.style.width=(s.right-s.left)/a+"px",this.element.style.height=(s.bottom-s.top)/o+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=s&&s.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,n,t):r;if(n&&!i){let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=Si(this.editorView.state.doc,a,this.editorView.dragging.slice);o!=null&&(a=o)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class ke extends tn{constructor(t){super(t,t)}map(t,n){let s=t.resolve(n.map(this.head));return ke.valid(s)?new ke(s):tn.near(s)}content(){return aa.empty}eq(t){return t instanceof ke&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ke(t.resolve(n.pos))}getBookmark(){return new Dr(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!wd(t)||!_d(t))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let r=n.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,s=!1){e:for(;;){if(!s&&ke.valid(t))return t;let r=t.pos,i=null;for(let a=t.depth;;a--){let o=t.node(a);if(n>0?t.indexAfter(a)<o.childCount:t.index(a)>0){i=o.child(n>0?t.indexAfter(a):t.index(a)-1);break}else if(a==0)return null;r+=n;let l=t.doc.resolve(r);if(ke.valid(l))return l}for(;;){let a=n>0?i.firstChild:i.lastChild;if(!a){if(i.isAtom&&!i.isText&&!Or.isSelectable(i)){t=t.doc.resolve(r+i.nodeSize*n),s=!1;continue e}break}i=a,r+=n;let o=t.doc.resolve(r);if(ke.valid(o))return o}return null}}}ke.prototype.visible=!1;ke.findFrom=ke.findGapCursorFrom;tn.jsonID("gapcursor",ke);class Dr{constructor(t){this.pos=t}map(t){return new Dr(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return ke.valid(n)?new ke(n):tn.near(n)}}function va(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function wd(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),s=e.node(t);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||va(r.type))return!0;if(r.inlineContent)return!1}}return!0}function _d(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),s=e.node(t);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let r=s.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||va(r.type))return!0;if(r.inlineContent)return!1}}return!0}function Td(){return new Ue({props:{decorations:Ad,createSelectionBetween(e,t,n){return t.pos==n.pos&&ke.valid(n)?new ke(n):null},handleClick:Sd,handleKeyDown:Cd,handleDOMEvents:{beforeinput:Md}}})}const Cd=Mi({ArrowLeft:un("horiz",-1),ArrowRight:un("horiz",1),ArrowUp:un("vert",-1),ArrowDown:un("vert",1)});function un(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(s,r,i){let a=s.selection,o=t>0?a.$to:a.$from,l=a.empty;if(a instanceof vt){if(!i.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=s.doc.resolve(t>0?o.after():o.before())}let c=ke.findGapCursorFrom(o,t,l);return c?(r&&r(s.tr.setSelection(new ke(c))),!0):!1}}function Sd(e,t,n){if(!e||!e.editable)return!1;let s=e.state.doc.resolve(t);if(!ke.valid(s))return!1;let r=e.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&Or.isSelectable(e.state.doc.nodeAt(r.inside))?!1:(e.dispatch(e.state.tr.setSelection(new ke(s))),!0)}function Md(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof ke))return!1;let{$from:n}=e.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!s)return!1;let r=us.empty;for(let a=s.length-1;a>=0;a--)r=us.from(s[a].createAndFill(null,r));let i=e.state.tr.replace(n.pos,n.pos,new aa(r,0,0));return i.setSelection(vt.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Ad(e){if(!(e.selection instanceof ke))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",en.create(e.doc,[rr.widget(e.selection.head,t,{key:"gapcursor"})])}var bn=200,Ce=function(){};Ce.prototype.append=function(t){return t.length?(t=Ce.from(t),!this.length&&t||t.length<bn&&this.leafAppend(t)||this.length<bn&&t.leafPrepend(this)||this.appendInner(t)):this};Ce.prototype.prepend=function(t){return t.length?Ce.from(t).append(this):this};Ce.prototype.appendInner=function(t){return new Ld(this,t)};Ce.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Ce.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};Ce.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ce.prototype.forEach=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(t,n,s,0):this.forEachInvertedInner(t,n,s,0)};Ce.prototype.map=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var r=[];return this.forEach(function(i,a){return r.push(t(i,a))},n,s),r};Ce.from=function(t){return t instanceof Ce?t:t&&t.length?new ka(t):Ce.empty};var ka=(function(e){function t(s){e.call(this),this.values=s}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new t(this.values.slice(r,i))},t.prototype.getInner=function(r){return this.values[r]},t.prototype.forEachInner=function(r,i,a,o){for(var l=i;l<a;l++)if(r(this.values[l],o+l)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,a,o){for(var l=i-1;l>=a;l--)if(r(this.values[l],o+l)===!1)return!1},t.prototype.leafAppend=function(r){if(this.length+r.length<=bn)return new t(this.values.concat(r.flatten()))},t.prototype.leafPrepend=function(r){if(this.length+r.length<=bn)return new t(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})(Ce);Ce.empty=new ka([]);var Ld=(function(e){function t(n,s){e.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(s){return s<this.left.length?this.left.get(s):this.right.get(s-this.left.length)},t.prototype.forEachInner=function(s,r,i,a){var o=this.left.length;if(r<o&&this.left.forEachInner(s,r,Math.min(i,o),a)===!1||i>o&&this.right.forEachInner(s,Math.max(r-o,0),Math.min(this.length,i)-o,a+o)===!1)return!1},t.prototype.forEachInvertedInner=function(s,r,i,a){var o=this.left.length;if(r>o&&this.right.forEachInvertedInner(s,r-o,Math.max(i,o)-o,a+o)===!1||i<o&&this.left.forEachInvertedInner(s,Math.min(r,o),i,a)===!1)return!1},t.prototype.sliceInner=function(s,r){if(s==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(s,r):s>=i?this.right.slice(s-i,r-i):this.left.slice(s,i).append(this.right.slice(0,r-i))},t.prototype.leafAppend=function(s){var r=this.right.leafAppend(s);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(s){var r=this.left.leafPrepend(s);if(r)return new t(r,this.right)},t.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new t(this.left,new t(this.right,s)):new t(this,s)},t})(Ce);const $d=500;class Qe{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let r,i;n&&(r=this.remapping(s,this.items.length),i=r.maps.length);let a=t.tr,o,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){r||(r=this.remapping(s,p+1),i=r.maps.length),i--,u.push(d);return}if(r){u.push(new Ze(d.map));let f=d.step.map(r.slice(i)),y;f&&a.maybeStep(f).doc&&(y=a.mapping.maps[a.mapping.maps.length-1],c.push(new Ze(y,void 0,void 0,c.length+u.length))),i--,y&&r.appendMap(y,i)}else a.maybeStep(d.step);if(d.selection)return o=r?d.selection.map(r.slice(i)):d.selection,l=new Qe(this.items.slice(0,s).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:a,selection:o}}addTransform(t,n,s,r){let i=[],a=this.eventCount,o=this.items,l=!r&&o.length?o.get(o.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),p=new Ze(t.mapping.maps[u],d,n),f;(f=l&&l.merge(p))&&(p=f,u?i.pop():o=o.slice(0,o.length-1)),i.push(p),n&&(a++,n=void 0),r||(l=p)}let c=a-s.depth;return c>Id&&(o=Ed(o,c),a-=c),new Qe(o.append(i),a)}remapping(t,n){let s=new Ai;return this.items.forEach((r,i)=>{let a=r.mirrorOffset!=null&&i-r.mirrorOffset>=t?s.maps.length-r.mirrorOffset:void 0;s.appendMap(r.map,a)},t,n),s}addMaps(t){return this.eventCount==0?this:new Qe(this.items.append(t.map(n=>new Ze(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let s=[],r=Math.max(0,this.items.length-n),i=t.mapping,a=t.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},r);let l=n;this.items.forEach(p=>{let f=i.getMirror(--l);if(f==null)return;a=Math.min(a,f);let y=i.maps[f];if(p.step){let _=t.steps[f].invert(t.docs[f]),M=p.selection&&p.selection.map(i.slice(l+1,f));M&&o++,s.push(new Ze(y,_,M))}else s.push(new Ze(y))},r);let c=[];for(let p=n;p<a;p++)c.push(new Ze(i.maps[p]));let u=this.items.slice(0,r).append(c).append(s),d=new Qe(u,o);return d.emptyItemCount()>$d&&(d=d.compress(this.items.length-s.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),s=n.maps.length,r=[],i=0;return this.items.forEach((a,o)=>{if(o>=t)r.push(a),a.selection&&i++;else if(a.step){let l=a.step.map(n.slice(s)),c=l&&l.getMap();if(s--,c&&n.appendMap(c,s),l){let u=a.selection&&a.selection.map(n.slice(s));u&&i++;let d=new Ze(c.invert(),l,u),p,f=r.length-1;(p=r.length&&r[f].merge(d))?r[f]=p:r.push(d)}}else a.map&&s--},this.items.length,0),new Qe(Ce.from(r.reverse()),i)}}Qe.empty=new Qe(Ce.empty,0);function Ed(e,t){let n;return e.forEach((s,r)=>{if(s.selection&&t--==0)return n=r,!1}),e.slice(n)}class Ze{constructor(t,n,s,r){this.map=t,this.step=n,this.selection=s,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Ze(n.getMap().invert(),n,this.selection)}}}class lt{constructor(t,n,s,r,i){this.done=t,this.undone=n,this.prevRanges=s,this.prevTime=r,this.prevComposition=i}}const Id=20;function Rd(e,t,n,s){let r=n.getMeta(kt),i;if(r)return r.historyState;n.getMeta(Nd)&&(e=new lt(e.done,e.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(a&&a.getMeta(kt))return a.getMeta(kt).redo?new lt(e.done.addTransform(n,void 0,s,vn(t)),e.undone,Ss(n.mapping.maps),e.prevTime,e.prevComposition):new lt(e.done,e.undone.addTransform(n,void 0,s,vn(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=e.prevTime==0||!a&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-s.newGroupDelay||!Pd(n,e.prevRanges)),c=a?dr(e.prevRanges,n.mapping):Ss(n.mapping.maps);return new lt(e.done.addTransform(n,l?t.selection.getBookmark():void 0,s,vn(t)),Qe.empty,c,n.time,o??e.prevComposition)}else return(i=n.getMeta("rebased"))?new lt(e.done.rebased(n,i),e.undone.rebased(n,i),dr(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new lt(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),dr(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Pd(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((s,r)=>{for(let i=0;i<t.length;i+=2)s<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function Ss(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((s,r,i,a)=>t.push(i,a));return t}function dr(e,t){if(!e)return null;let n=[];for(let s=0;s<e.length;s+=2){let r=t.map(e[s],1),i=t.map(e[s+1],-1);r<=i&&n.push(r,i)}return n}function Hd(e,t,n){let s=vn(t),r=kt.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,s);if(!i)return null;let a=i.selection.resolve(i.transform.doc),o=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),r,s),l=new lt(n?o:i.remaining,n?i.remaining:o,null,0,-1);return i.transform.setSelection(a).setMeta(kt,{redo:n,historyState:l})}let pr=!1,Ms=null;function vn(e){let t=e.plugins;if(Ms!=t){pr=!1,Ms=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){pr=!0;break}}return pr}const kt=new Be("history"),Nd=new Be("closeHistory");function zd(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ue({key:kt,state:{init(){return new lt(Qe.empty,Qe.empty,null,0,-1)},apply(t,n,s){return Rd(n,s,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let s=n.inputType,r=s=="historyUndo"?ba:s=="historyRedo"?wa:null;return!r||!t.editable?!1:(n.preventDefault(),r(t.state,t.dispatch))}}}})}function xa(e,t){return(n,s)=>{let r=kt.getState(n);if(!r||(e?r.undone:r.done).eventCount==0)return!1;if(s){let i=Hd(r,n,e);i&&s(t?i.scrollIntoView():i)}return!0}}const ba=xa(!1,!0),wa=xa(!0,!0);Ke.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)==="textSize"){const s=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(s)}return t.nodeSize},this.storage.words=e=>{const t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Ue({key:new Be("characterCount"),appendTransaction:(t,n,s)=>{if(e)return;const r=this.options.limit;if(r==null||r===0){e=!0;return}const i=this.storage.characters({node:s.doc});if(i>r){const a=i-r,o=0,l=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const c=s.tr.deleteRange(o,l);return e=!0,c}e=!0},filterTransaction:(t,n)=>{const s=this.options.limit;if(!t.docChanged||s===0||s===null||s===void 0)return!0;const r=this.storage.characters({node:n.doc}),i=this.storage.characters({node:t.doc});if(i<=s||r>s&&i>s&&i<=r)return!0;if(r>s&&i>s&&i>r||!t.getMeta("paste"))return!1;const o=t.selection.$head.pos,l=i-s,c=o-l,u=o;return t.deleteRange(c,u),!(this.storage.characters({node:t.doc})>s)}})]}});var Od=Ke.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[xd(this.options)]}});Ke.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ue({key:new Be("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:s}=this.editor,{anchor:r}=t,i=[];if(!n||!s)return en.create(e,[]);let a=0;this.options.mode==="deepest"&&e.descendants((l,c)=>{if(l.isText)return;if(!(r>=c&&r<=c+l.nodeSize-1))return!1;a+=1});let o=0;return e.descendants((l,c)=>{if(l.isText||!(r>=c&&r<=c+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&a-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";i.push(rr.node(c,c+l.nodeSize,{class:this.options.className}))}),en.create(e,i)}}})]}});var Bd=Ke.create({name:"gapCursor",addProseMirrorPlugins(){return[Td()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Li($t(e,"allowGapCursor",n)))!=null?t:null}}}),As="placeholder";function Dd(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var jd=Ke.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:As,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${Dd(this.options.dataAttribute)}`:`data-${As}`;return[new Ue({key:new Be("placeholder"),props:{decorations:({doc:t,selection:n})=>{const s=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=n,i=[];if(!s)return null;const a=this.editor.isEmpty;return t.descendants((o,l)=>{const c=r>=l&&r<=l+o.nodeSize,u=!o.isLeaf&&$i(o);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];a&&d.push(this.options.emptyEditorClass);const p=rr.node(l,l+o.nodeSize,{class:d.join(" "),[e]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:c}):this.options.placeholder});i.push(p)}return this.options.includeChildren}),en.create(t,i)}}})]}});Ke.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Ue({key:new Be("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||sa(n.selection)||e.view.dragging?null:en.create(n.doc,[rr.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function Ls({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Fd=Ke.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Be(this.name),n=this.options.node||((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||"paragraph",s=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(n).includes(r.name));return[new Ue({key:t,appendTransaction:(r,i,a)=>{const{doc:o,tr:l,schema:c}=a,u=t.getState(a),d=o.content.size,p=c.nodes[n];if(u)return l.insert(d,p.create())},state:{init:(r,i)=>{const a=i.tr.doc.lastChild;return!Ls({node:a,types:s})},apply:(r,i)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return i;const a=r.doc.lastChild;return!Ls({node:a,types:s})}}})]}}),qd=Ke.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>ba(e,t),redo:()=>({state:e,dispatch:t})=>wa(e,t)}},addProseMirrorPlugins(){return[zd(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ud=jd;function jr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ct=jr();function _a(e){Ct=e}var Vt={exec:()=>null};function ce(e,t=""){let n=typeof e=="string"?e:e.source,s={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace($e.caret,"$1"),n=n.replace(r,a),s},getRegex:()=>new RegExp(n,t)};return s}var Kd=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),$e={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Wd=/^(?:[ \t]*(?:\n|$))+/,Vd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Gd=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,sn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Yd=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fr=/(?:[*+-]|\d{1,9}[.)])/,Ta=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ca=ce(Ta).replace(/bull/g,Fr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Qd=ce(Ta).replace(/bull/g,Fr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),qr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Jd=/^[^\n]+/,Ur=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Zd=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ur).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xd=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Fr).getRegex(),sr="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Kr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ep=ce("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Kr).replace("tag",sr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Sa=ce(qr).replace("hr",sn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sr).getRegex(),tp=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Sa).getRegex(),Wr={blockquote:tp,code:Vd,def:Zd,fences:Gd,heading:Yd,hr:sn,html:ep,lheading:Ca,list:Xd,newline:Wd,paragraph:Sa,table:Vt,text:Jd},$s=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",sn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sr).getRegex(),np={...Wr,lheading:Qd,table:$s,paragraph:ce(qr).replace("hr",sn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$s).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sr).getRegex()},rp={...Wr,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Kr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Vt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(qr).replace("hr",sn).replace("heading",` *#{1,6} *[^
40
40
  ]`).replace("lheading",Ca).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},sp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ap=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ma=/^( {2,}|\\)\n(?!\s*$)/,ip=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ar=/[\p{P}\p{S}]/u,Vr=/[\s\p{P}\p{S}]/u,Aa=/[^\s\p{P}\p{S}]/u,op=ce(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Vr).getRegex(),La=/(?!~)[\p{P}\p{S}]/u,lp=/(?!~)[\s\p{P}\p{S}]/u,cp=/(?:[^\s\p{P}\p{S}]|~)/u,up=ce(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Kd?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$a=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,dp=ce($a,"u").replace(/punct/g,ar).getRegex(),pp=ce($a,"u").replace(/punct/g,La).getRegex(),Ea="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",hp=ce(Ea,"gu").replace(/notPunctSpace/g,Aa).replace(/punctSpace/g,Vr).replace(/punct/g,ar).getRegex(),fp=ce(Ea,"gu").replace(/notPunctSpace/g,cp).replace(/punctSpace/g,lp).replace(/punct/g,La).getRegex(),gp=ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Aa).replace(/punctSpace/g,Vr).replace(/punct/g,ar).getRegex(),mp=ce(/\\(punct)/,"gu").replace(/punct/g,ar).getRegex(),yp=ce(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),vp=ce(Kr).replace("(?:-->|$)","-->").getRegex(),kp=ce("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",vp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,xp=ce(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",wn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ia=ce(/^!?\[(label)\]\[(ref)\]/).replace("label",wn).replace("ref",Ur).getRegex(),Ra=ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ur).getRegex(),bp=ce("reflink|nolink(?!\\()","g").replace("reflink",Ia).replace("nolink",Ra).getRegex(),Es=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gr={_backpedal:Vt,anyPunctuation:mp,autolink:yp,blockSkip:up,br:Ma,code:ap,del:Vt,emStrongLDelim:dp,emStrongRDelimAst:hp,emStrongRDelimUnd:gp,escape:sp,link:xp,nolink:Ra,punctuation:op,reflink:Ia,reflinkSearch:bp,tag:kp,text:ip,url:Vt},wp={...Gr,link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",wn).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wn).getRegex()},Cr={...Gr,emStrongRDelimAst:fp,emStrongLDelim:pp,url:ce(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Es).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ce(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Es).getRegex()},_p={...Cr,br:ce(Ma).replace("{2,}","*").getRegex(),text:ce(Cr.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},dn={normal:Wr,gfm:np,pedantic:rp},Dt={normal:Gr,gfm:Cr,breaks:_p,pedantic:wp},Tp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Is=e=>Tp[e];function st(e,t){if(t){if($e.escapeTest.test(e))return e.replace($e.escapeReplace,Is)}else if($e.escapeTestNoEncode.test(e))return e.replace($e.escapeReplaceNoEncode,Is);return e}function Rs(e){try{e=encodeURI(e).replace($e.percentDecode,"%")}catch{return null}return e}function Ps(e,t){let n=e.replace($e.findPipe,(i,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),s=n.split($e.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace($e.slashPipe,"|");return s}function jt(e,t,n){let s=e.length;if(s===0)return"";let r=0;for(;r<s&&e.charAt(s-r-1)===t;)r++;return e.slice(0,s-r)}function Cp(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Hs(e,t,n,s,r){let i=t.href,a=t.title||null,o=e[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,l}function Sp(e,t,n){let s=e.match(n.other.indentCodeCompensation);if(s===null)return t;let r=s[1];return t.split(`
41
41
  `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=r.length?i.slice(r.length):i}).join(`
42
42
  `)}var _n=class{options;rules;lexer;constructor(e){this.options=e||Ct}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:jt(n,`
@@ -55,11 +55,11 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
55
55
  `);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let l=!1,c="",u="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let d=t[2].split(`
56
56
  `,1)[0].replace(this.rules.other.listReplaceTabs,_=>" ".repeat(3*_.length)),p=e.split(`
57
57
  `,1)[0],f=!d.trim(),y=0;if(this.options.pedantic?(y=2,u=d.trimStart()):f?y=t[1].length+1:(y=t[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,u=d.slice(y),y+=t[1].length),f&&this.rules.other.blankLine.test(p)&&(c+=p+`
58
- `,e=e.substring(p.length+1),l=!0),!l){let _=this.rules.other.nextBulletRegex(y),M=this.rules.other.hrRegex(y),v=this.rules.other.fencesBeginRegex(y),C=this.rules.other.headingBeginRegex(y),O=this.rules.other.htmlBeginRegex(y);for(;e;){let L=e.split(`
59
- `,1)[0],I;if(p=L,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),I=p):I=p.replace(this.rules.other.tabCharGlobal," "),v.test(p)||C.test(p)||O.test(p)||_.test(p)||M.test(p))break;if(I.search(this.rules.other.nonSpaceChar)>=y||!p.trim())u+=`
60
- `+I.slice(y);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(d)||C.test(d)||M.test(d))break;u+=`
58
+ `,e=e.substring(p.length+1),l=!0),!l){let _=this.rules.other.nextBulletRegex(y),M=this.rules.other.hrRegex(y),v=this.rules.other.fencesBeginRegex(y),C=this.rules.other.headingBeginRegex(y),z=this.rules.other.htmlBeginRegex(y);for(;e;){let L=e.split(`
59
+ `,1)[0],E;if(p=L,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),E=p):E=p.replace(this.rules.other.tabCharGlobal," "),v.test(p)||C.test(p)||z.test(p)||_.test(p)||M.test(p))break;if(E.search(this.rules.other.nonSpaceChar)>=y||!p.trim())u+=`
60
+ `+E.slice(y);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(d)||C.test(d)||M.test(d))break;u+=`
61
61
  `+p}!f&&!p.trim()&&(f=!0),c+=L+`
62
- `,e=e.substring(L.length+1),d=I.slice(y)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=c}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!r.loose){let c=l.tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));r.loose=u}}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ps(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
62
+ `,e=e.substring(L.length+1),d=E.slice(y)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=c}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}if(!r.loose){let c=l.tokens.filter(d=>d.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));r.loose=u}}if(r.loose)for(let l of r.items){l.loose=!0;for(let c of l.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ps(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
63
63
  `):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of r)i.rows.push(Ps(a,i.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[l]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
64
64
  `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=jt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Cp(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let s=t[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Hs(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[s.toLowerCase()];if(!r){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Hs(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,a,o=r,l=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+r);(s=c.exec(t))!=null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){o+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){l+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let u=[...s[0]][0].length,d=e.slice(0,r+s.index+u+a);if(Math.min(r,a)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let p=d.slice(2,-2);return{type:"strong",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=t[0],s="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Ge=class Sr{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Ct,this.options.tokenizer=this.options.tokenizer||new _n,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:$e,block:dn.normal,inline:Dt.normal};this.options.pedantic?(n.block=dn.pedantic,n.inline=Dt.pedantic):this.options.gfm&&(n.block=dn.gfm,this.options.breaks?n.inline=Dt.breaks:n.inline=Dt.gfm),this.tokenizer.rules=n}static get rules(){return{block:dn,inline:Dt}}static lex(t,n){return new Sr(n).lex(t)}static lexInline(t,n){return new Sr(n).inlineTokens(t)}lex(t){t=t.replace($e.carriageReturn,`
65
65
  `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){for(this.options.pedantic&&(t=t.replace($e.tabCharGlobal," ").replace($e.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let a=n.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
@@ -98,9 +98,9 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
98
98
  `).flatMap(r=>[r,""]).map(r=>`${e}${r}`).join(`
99
99
  `);return s.slice(0,s.length-1)}function Lp(e,t){const n=[];return Array.from(e.keys()).forEach(s=>{(!t||!t.marks||!t.marks.map(r=>r.type).includes(s))&&n.push(s)}),n}function $p(e,t){const n=[];return Array.from(t.entries()).forEach(([s,r])=>{e.has(s)||n.push({type:s,mark:r})}),n}function Ep(e,t,n,s){const r=!n,i=n&&n.type==="text"&&(!n.marks||n.marks.length===0),a=n&&n.type==="text"&&n.marks&&!s(t,new Map(n.marks.map(l=>[l.type,l]))),o=[];if(r||i||a)if(n&&n.type==="text"&&n.marks){const l=new Map(n.marks.map(c=>[c.type,c]));Array.from(e.keys()).forEach(c=>{l.has(c)||o.push(c)})}else(r||i)&&o.push(...Array.from(e.keys()));return o}function Ip(e,t){let n="";return Array.from(e.keys()).reverse().forEach(s=>{const r=e.get(s),i=t(s,r);i&&(n=i+n)}),e.clear(),n}function Rp(e,t,n){let s="";return Array.from(e.entries()).forEach(([r,i])=>{const a=n(r,i);a&&(s+=a),t.set(r,i)}),s}function hr(e){const n=(e.raw||e.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return n?{isTask:!0,checked:n[2].toLowerCase()==="x",indentLevel:n[1].length}:{isTask:!1,indentLevel:0}}function pn(e,t){return typeof e!="string"?"json":t}var Pp=class{constructor(e){this.baseExtensions=[],this.extensions=[],this.lastParseResult=null;var t,n,s,r,i;this.markedInstance=(t=e?.marked)!=null?t:pe,this.lexer=new this.markedInstance.Lexer,this.indentStyle=(s=(n=e?.indentation)==null?void 0:n.style)!=null?s:"space",this.indentSize=(i=(r=e?.indentation)==null?void 0:r.size)!=null?i:2,this.baseExtensions=e?.extensions||[],e?.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(e.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,e?.extensions&&(this.baseExtensions=e.extensions,Ei(e.extensions).forEach(o=>this.registerExtension(o,!1))),this.lexer=new this.markedInstance.Lexer}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(e,t=!0){var n,s;this.extensions.push(e);const r=e.name,i=$t(e,"markdownTokenName")||r,a=$t(e,"parseMarkdown"),o=$t(e,"renderMarkdown"),l=$t(e,"markdownTokenizer"),c=(n=$t(e,"markdownOptions"))!=null?n:null,u=(s=c?.indentsContent)!=null?s:!1,d={tokenName:i,nodeName:r,parseMarkdown:a,renderMarkdown:o,isIndenting:u,tokenizer:l};if(i&&a){const p=this.registry.get(i)||[];p.push(d),this.registry.set(i,p)}if(o){const p=this.nodeTypeRegistry.get(r)||[];p.push(d),this.nodeTypeRegistry.set(r,p)}l&&this.hasMarked()&&(this.registerTokenizer(l),t&&(this.lexer=new this.markedInstance.Lexer))}registerTokenizer(e){if(!this.hasMarked())return;const{name:t,start:n,level:s="inline",tokenize:r}=e,o={inlineTokens:u=>this.lexer.inlineTokens(u),blockTokens:u=>this.lexer.blockTokens(u)};let l;n?l=typeof n=="function"?n:u=>u.indexOf(n):l=u=>{const d=r(u,[],o);return d&&d.raw?u.indexOf(d.raw):-1};const c={name:t,level:s,start:l,tokenizer:(u,d)=>{const p=r(u,d,o);if(p&&p.type)return{...p,type:p.type||t,raw:p.raw||"",tokens:p.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[c]})}getHandlersForToken(e){try{return this.registry.get(e)||[]}catch{return[]}}getHandlerForToken(e){const t=this.getHandlersForToken(e);if(t.length>0)return t[0];const n=this.getHandlersForNodeType(e);return n.length>0?n[0]:void 0}getHandlersForNodeType(e){try{return this.nodeTypeRegistry.get(e)||[]}catch{return[]}}serialize(e){return e?Array.isArray(e)?this.renderNodes(e,e):this.renderNodes(e,e):""}parse(e){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const t=this.markedInstance.lexer(e);return{type:"doc",content:this.parseTokens(t)}}parseTokens(e){return e.map(t=>this.parseToken(t)).filter(t=>t!==null).flatMap(t=>Array.isArray(t)?t:[t])}parseToken(e){if(!e.type)return null;if(e.type==="list")return this.parseListToken(e);const t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(r=>{if(!r.parseMarkdown)return!1;const i=r.parseMarkdown(e,n),a=this.normalizeParseResult(i);return a&&(!Array.isArray(a)||a.length>0)?(this.lastParseResult=a,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(e)}parseListToken(e){if(!e.items||e.items.length===0)return this.parseTokenWithHandlers(e);const t=e.items.some(o=>hr(o).isTask),n=e.items.some(o=>!hr(o).isTask);if(!t||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(e);const s=[];let r=[],i=null;for(let o=0;o<e.items.length;o+=1){const l=e.items[o],{isTask:c,checked:u,indentLevel:d}=hr(l);let p=l;if(c){const _=(l.raw||l.text||"").split(`
100
100
  `),M=_[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),v=M?M[2]:"";let C=[];if(_.length>1&&_.slice(1).join(`
101
- `).trim()){const L=_.slice(1),I=L.filter(G=>G.trim());if(I.length>0){const G=Math.min(...I.map(W=>W.length-W.trimStart().length)),te=L.map(W=>W.trim()?W.slice(G):"").join(`
101
+ `).trim()){const L=_.slice(1),E=L.filter(G=>G.trim());if(E.length>0){const G=Math.min(...E.map(V=>V.length-V.trimStart().length)),te=L.map(V=>V.trim()?V.slice(G):"").join(`
102
102
  `).trim();te&&(C=this.markedInstance.lexer(`${te}
103
- `))}}p={type:"taskItem",raw:"",mainContent:v,indentLevel:d,checked:u??!1,text:v,tokens:this.lexer.inlineTokens(v),nestedTokens:C}}const f=c?"taskList":"list";i!==f?(r.length>0&&s.push({type:i,items:r}),r=[p],i=f):r.push(p)}r.length>0&&s.push({type:i,items:r});const a=[];for(let o=0;o<s.length;o+=1){const l=s[o],c={...e,type:l.type,items:l.items},u=this.parseToken(c);u&&(Array.isArray(u)?a.push(...u):a.push(u))}return a.length>0?a:null}parseTokenWithHandlers(e){if(!e.type)return null;const t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(r=>{if(!r.parseMarkdown)return!1;const i=r.parseMarkdown(e,n),a=this.normalizeParseResult(i);return a&&(!Array.isArray(a)||a.length>0)?(this.lastParseResult=a,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(e)}createParseHelpers(){return{parseInline:e=>this.parseInlineTokens(e),parseChildren:e=>this.parseTokens(e),createTextNode:(e,t)=>({type:"text",text:e,marks:t||void 0}),createNode:(e,t,n)=>{const s={type:e,attrs:t||void 0,content:n||void 0};return(!t||Object.keys(t).length===0)&&delete s.attrs,s},applyMark:(e,t,n)=>({mark:e,content:t,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(e){var t,n,s,r;const i=[];for(let a=0;a<e.length;a+=1){const o=e[a];if(o.type==="text")i.push({type:"text",text:o.text||""});else if(o.type==="html"){const l=((n=(t=o.raw)!=null?t:o.text)!=null?n:"").toString(),c=/^<\/[\s]*[\w-]+/i.test(l),u=l.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!c&&u&&!/\/>$/.test(l)){const p=u[1],f=this.escapeRegex(p),y=new RegExp(`^<\\/\\s*${f}\\b`,"i");let _=-1;const M=[l];for(let v=a+1;v<e.length;v+=1){const C=e[v],O=((r=(s=C.raw)!=null?s:C.text)!=null?r:"").toString();if(M.push(O),C.type==="html"&&y.test(O)){_=v;break}}if(_!==-1){const v=M.join(""),C={type:"html",raw:v,text:v,block:!1},O=this.parseHTMLToken(C);if(O){const L=this.normalizeParseResult(O);Array.isArray(L)?i.push(...L):L&&i.push(L)}a=_;continue}}const d=this.parseHTMLToken(o);if(d){const p=this.normalizeParseResult(d);Array.isArray(p)?i.push(...p):p&&i.push(p)}}else if(o.type){const l=this.getHandlerForToken(o.type);if(l&&l.parseMarkdown){const c=this.createParseHelpers(),u=l.parseMarkdown(o,c);if(this.isMarkResult(u)){const d=this.applyMarkToContent(u.mark,u.content,u.attrs);i.push(...d)}else{const d=this.normalizeParseResult(u);Array.isArray(d)?i.push(...d):d&&i.push(d)}}else o.tokens&&i.push(...this.parseInlineTokens(o.tokens))}}return i}applyMarkToContent(e,t,n){return t.map(s=>{if(s.type==="text"){const r=s.marks||[],i=n?{type:e,attrs:n}:{type:e};return{...s,marks:[...r,i]}}return{...s,content:s.content?this.applyMarkToContent(e,s.content,n):void 0}})}isMarkResult(e){return e&&typeof e=="object"&&"mark"in e}normalizeParseResult(e){return e?this.isMarkResult(e)?e.content:e:null}parseFallbackToken(e){switch(e.type){case"paragraph":return{type:"paragraph",content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"heading":return{type:"heading",attrs:{level:e.depth||1},content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"text":return{type:"text",text:e.text||""};case"html":return this.parseHTMLToken(e);case"space":return null;default:return e.tokens?this.parseTokens(e.tokens):null}}parseHTMLToken(e){const t=e.text||e.raw||"";if(!t.trim())return null;if(typeof window>"u")return e.block?{type:"paragraph",content:[{type:"text",text:t}]}:{type:"text",text:t};try{const n=Ii(t,this.baseExtensions);return n.type==="doc"&&n.content?e.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}renderNodeToMarkdown(e,t,n=0,s=0){var r;if(e.type==="text")return e.text||"";if(!e.type)return"";const i=this.getHandlerForToken(e.type);if(!i)return"";const a={renderChildren:(c,u)=>{const d=i.isIndenting?s+1:s;return!Array.isArray(c)&&c.content?this.renderNodes(c.content,e,u||"",n,d):this.renderNodes(c,e,u||"",n,d)},indent:c=>this.indentString+c,wrapInBlock:Ap},o={index:n,level:s,parentType:t?.type,meta:{parentAttrs:t?.attrs}};return((r=i.renderMarkdown)==null?void 0:r.call(i,e,a,o))||""}renderNodes(e,t,n="",s=0,r=0){return Array.isArray(e)?this.renderNodesWithMarkBoundaries(e,t,n,r):e.type?this.renderNodeToMarkdown(e,t,s,r):""}renderNodesWithMarkBoundaries(e,t,n="",s=0){const r=[],i=new Map;return e.forEach((a,o)=>{const l=o<e.length-1?e[o+1]:null;if(a.type)if(a.type==="text"){let c=a.text||"";const u=new Map((a.marks||[]).map(v=>[v.type,v])),d=$p(i,u),p=Lp(u,l);let f="";if(p.length>0){const v=c.match(/(\s+)$/);v&&(f=v[1],c=c.slice(0,-f.length))}p.forEach(v=>{const C=u.get(v),O=this.getMarkClosing(v,C);O&&(c+=O),i.has(v)&&i.delete(v)});let y="";if(d.length>0){const v=c.match(/^(\s+)/);v&&(y=v[1],c=c.slice(y.length))}d.forEach(({type:v,mark:C})=>{const O=this.getMarkOpening(v,C);O&&(c=O+c),p.includes(v)||i.set(v,C)}),c=y+c;const _=Ep(i,u,l,this.markSetsEqual.bind(this));let M="";if(_.length>0){const v=c.match(/(\s+)$/);v&&(M=v[1],c=c.slice(0,-M.length))}_.forEach(v=>{const C=i.get(v),O=this.getMarkClosing(v,C);O&&(c+=O),i.delete(v)}),c+=M,c+=f,r.push(c)}else{const c=new Map(i),u=Ip(i,this.getMarkClosing.bind(this)),d=this.renderNodeToMarkdown(a,t,o,s),p=a.type==="hardBreak"?"":Rp(c,i,this.getMarkOpening.bind(this));r.push(u+d+p)}}),r.join(n)}getMarkOpening(e,t){const n=this.getHandlersForNodeType(e),s=n.length>0?n[0]:void 0;if(!s||!s.renderMarkdown)return"";const r="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:r}]};try{const a=s.renderMarkdown(i,{renderChildren:()=>r,indent:l=>l,wrapInBlock:(l,c)=>l+c},{index:0,level:0,parentType:"text",meta:{}}),o=a.indexOf(r);return o>=0?a.substring(0,o):""}catch(a){throw new Error(`Failed to get mark opening for ${e}: ${a}`)}}getMarkClosing(e,t){const n=this.getHandlersForNodeType(e),s=n.length>0?n[0]:void 0;if(!s||!s.renderMarkdown)return"";const r="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:r}]};try{const a=s.renderMarkdown(i,{renderChildren:()=>r,indent:c=>c,wrapInBlock:(c,u)=>c+u},{index:0,level:0,parentType:"text",meta:{}}),o=a.indexOf(r),l=o+r.length;return o>=0?a.substring(l):""}catch(a){throw new Error(`Failed to get mark closing for ${e}: ${a}`)}}markSetsEqual(e,t){return e.size!==t.size?!1:Array.from(e.keys()).every(n=>t.has(n))}},Ns=Pp,Hp=Ke.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!t?.contentType)return tt.setContent(e,t);if(pn(e,t?.contentType)!=="markdown"||!this.editor.markdown)return tt.setContent(e,t);const s=this.editor.markdown.parse(e);return tt.setContent(s,t)},insertContent:(e,t)=>{if(!t?.contentType)return tt.insertContent(e,t);if(pn(e,t?.contentType)!=="markdown"||!this.editor.markdown)return tt.insertContent(e,t);const s=this.editor.markdown.parse(e);return tt.insertContent(s,t)},insertContentAt:(e,t,n)=>{if(!n?.contentType)return tt.insertContentAt(e,t,n);if(pn(t,n?.contentType)!=="markdown"||!this.editor.markdown)return tt.insertContentAt(e,t,n);const r=this.editor.markdown.parse(t);return tt.insertContentAt(e,r,n)}}},addStorage(){return{manager:new Ns({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new Ns({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||pn(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const t=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=t}}),Cn=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:n,...s}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,s,n]},Np=/^\s*>\s$/,zp=Ee.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return Cn("blockquote",{...fe(this.options.HTMLAttributes,e),children:Cn("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=">",s=[];return e.content.forEach(r=>{const o=t.renderChildren([r]).split(`
103
+ `))}}p={type:"taskItem",raw:"",mainContent:v,indentLevel:d,checked:u??!1,text:v,tokens:this.lexer.inlineTokens(v),nestedTokens:C}}const f=c?"taskList":"list";i!==f?(r.length>0&&s.push({type:i,items:r}),r=[p],i=f):r.push(p)}r.length>0&&s.push({type:i,items:r});const a=[];for(let o=0;o<s.length;o+=1){const l=s[o],c={...e,type:l.type,items:l.items},u=this.parseToken(c);u&&(Array.isArray(u)?a.push(...u):a.push(u))}return a.length>0?a:null}parseTokenWithHandlers(e){if(!e.type)return null;const t=this.getHandlersForToken(e.type),n=this.createParseHelpers();if(t.find(r=>{if(!r.parseMarkdown)return!1;const i=r.parseMarkdown(e,n),a=this.normalizeParseResult(i);return a&&(!Array.isArray(a)||a.length>0)?(this.lastParseResult=a,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(e)}createParseHelpers(){return{parseInline:e=>this.parseInlineTokens(e),parseChildren:e=>this.parseTokens(e),createTextNode:(e,t)=>({type:"text",text:e,marks:t||void 0}),createNode:(e,t,n)=>{const s={type:e,attrs:t||void 0,content:n||void 0};return(!t||Object.keys(t).length===0)&&delete s.attrs,s},applyMark:(e,t,n)=>({mark:e,content:t,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(e){var t,n,s,r;const i=[];for(let a=0;a<e.length;a+=1){const o=e[a];if(o.type==="text")i.push({type:"text",text:o.text||""});else if(o.type==="html"){const l=((n=(t=o.raw)!=null?t:o.text)!=null?n:"").toString(),c=/^<\/[\s]*[\w-]+/i.test(l),u=l.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!c&&u&&!/\/>$/.test(l)){const p=u[1],f=this.escapeRegex(p),y=new RegExp(`^<\\/\\s*${f}\\b`,"i");let _=-1;const M=[l];for(let v=a+1;v<e.length;v+=1){const C=e[v],z=((r=(s=C.raw)!=null?s:C.text)!=null?r:"").toString();if(M.push(z),C.type==="html"&&y.test(z)){_=v;break}}if(_!==-1){const v=M.join(""),C={type:"html",raw:v,text:v,block:!1},z=this.parseHTMLToken(C);if(z){const L=this.normalizeParseResult(z);Array.isArray(L)?i.push(...L):L&&i.push(L)}a=_;continue}}const d=this.parseHTMLToken(o);if(d){const p=this.normalizeParseResult(d);Array.isArray(p)?i.push(...p):p&&i.push(p)}}else if(o.type){const l=this.getHandlerForToken(o.type);if(l&&l.parseMarkdown){const c=this.createParseHelpers(),u=l.parseMarkdown(o,c);if(this.isMarkResult(u)){const d=this.applyMarkToContent(u.mark,u.content,u.attrs);i.push(...d)}else{const d=this.normalizeParseResult(u);Array.isArray(d)?i.push(...d):d&&i.push(d)}}else o.tokens&&i.push(...this.parseInlineTokens(o.tokens))}}return i}applyMarkToContent(e,t,n){return t.map(s=>{if(s.type==="text"){const r=s.marks||[],i=n?{type:e,attrs:n}:{type:e};return{...s,marks:[...r,i]}}return{...s,content:s.content?this.applyMarkToContent(e,s.content,n):void 0}})}isMarkResult(e){return e&&typeof e=="object"&&"mark"in e}normalizeParseResult(e){return e?this.isMarkResult(e)?e.content:e:null}parseFallbackToken(e){switch(e.type){case"paragraph":return{type:"paragraph",content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"heading":return{type:"heading",attrs:{level:e.depth||1},content:e.tokens?this.parseInlineTokens(e.tokens):[]};case"text":return{type:"text",text:e.text||""};case"html":return this.parseHTMLToken(e);case"space":return null;default:return e.tokens?this.parseTokens(e.tokens):null}}parseHTMLToken(e){const t=e.text||e.raw||"";if(!t.trim())return null;if(typeof window>"u")return e.block?{type:"paragraph",content:[{type:"text",text:t}]}:{type:"text",text:t};try{const n=Ii(t,this.baseExtensions);return n.type==="doc"&&n.content?e.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}renderNodeToMarkdown(e,t,n=0,s=0){var r;if(e.type==="text")return e.text||"";if(!e.type)return"";const i=this.getHandlerForToken(e.type);if(!i)return"";const a={renderChildren:(c,u)=>{const d=i.isIndenting?s+1:s;return!Array.isArray(c)&&c.content?this.renderNodes(c.content,e,u||"",n,d):this.renderNodes(c,e,u||"",n,d)},indent:c=>this.indentString+c,wrapInBlock:Ap},o={index:n,level:s,parentType:t?.type,meta:{parentAttrs:t?.attrs}};return((r=i.renderMarkdown)==null?void 0:r.call(i,e,a,o))||""}renderNodes(e,t,n="",s=0,r=0){return Array.isArray(e)?this.renderNodesWithMarkBoundaries(e,t,n,r):e.type?this.renderNodeToMarkdown(e,t,s,r):""}renderNodesWithMarkBoundaries(e,t,n="",s=0){const r=[],i=new Map;return e.forEach((a,o)=>{const l=o<e.length-1?e[o+1]:null;if(a.type)if(a.type==="text"){let c=a.text||"";const u=new Map((a.marks||[]).map(v=>[v.type,v])),d=$p(i,u),p=Lp(u,l);let f="";if(p.length>0){const v=c.match(/(\s+)$/);v&&(f=v[1],c=c.slice(0,-f.length))}p.forEach(v=>{const C=u.get(v),z=this.getMarkClosing(v,C);z&&(c+=z),i.has(v)&&i.delete(v)});let y="";if(d.length>0){const v=c.match(/^(\s+)/);v&&(y=v[1],c=c.slice(y.length))}d.forEach(({type:v,mark:C})=>{const z=this.getMarkOpening(v,C);z&&(c=z+c),p.includes(v)||i.set(v,C)}),c=y+c;const _=Ep(i,u,l,this.markSetsEqual.bind(this));let M="";if(_.length>0){const v=c.match(/(\s+)$/);v&&(M=v[1],c=c.slice(0,-M.length))}_.forEach(v=>{const C=i.get(v),z=this.getMarkClosing(v,C);z&&(c+=z),i.delete(v)}),c+=M,c+=f,r.push(c)}else{const c=new Map(i),u=Ip(i,this.getMarkClosing.bind(this)),d=this.renderNodeToMarkdown(a,t,o,s),p=a.type==="hardBreak"?"":Rp(c,i,this.getMarkOpening.bind(this));r.push(u+d+p)}}),r.join(n)}getMarkOpening(e,t){const n=this.getHandlersForNodeType(e),s=n.length>0?n[0]:void 0;if(!s||!s.renderMarkdown)return"";const r="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:r}]};try{const a=s.renderMarkdown(i,{renderChildren:()=>r,indent:l=>l,wrapInBlock:(l,c)=>l+c},{index:0,level:0,parentType:"text",meta:{}}),o=a.indexOf(r);return o>=0?a.substring(0,o):""}catch(a){throw new Error(`Failed to get mark opening for ${e}: ${a}`)}}getMarkClosing(e,t){const n=this.getHandlersForNodeType(e),s=n.length>0?n[0]:void 0;if(!s||!s.renderMarkdown)return"";const r="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:e,attrs:t.attrs||{},content:[{type:"text",text:r}]};try{const a=s.renderMarkdown(i,{renderChildren:()=>r,indent:c=>c,wrapInBlock:(c,u)=>c+u},{index:0,level:0,parentType:"text",meta:{}}),o=a.indexOf(r),l=o+r.length;return o>=0?a.substring(l):""}catch(a){throw new Error(`Failed to get mark closing for ${e}: ${a}`)}}markSetsEqual(e,t){return e.size!==t.size?!1:Array.from(e.keys()).every(n=>t.has(n))}},Ns=Pp,Hp=Ke.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(e,t)=>{if(!t?.contentType)return tt.setContent(e,t);if(pn(e,t?.contentType)!=="markdown"||!this.editor.markdown)return tt.setContent(e,t);const s=this.editor.markdown.parse(e);return tt.setContent(s,t)},insertContent:(e,t)=>{if(!t?.contentType)return tt.insertContent(e,t);if(pn(e,t?.contentType)!=="markdown"||!this.editor.markdown)return tt.insertContent(e,t);const s=this.editor.markdown.parse(e);return tt.insertContent(s,t)},insertContentAt:(e,t,n)=>{if(!n?.contentType)return tt.insertContentAt(e,t,n);if(pn(t,n?.contentType)!=="markdown"||!this.editor.markdown)return tt.insertContentAt(e,t,n);const r=this.editor.markdown.parse(t);return tt.insertContentAt(e,r,n)}}},addStorage(){return{manager:new Ns({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new Ns({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||pn(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const t=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=t}}),Cn=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:n,...s}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,s,n]},Np=/^\s*>\s$/,zp=Ee.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return Cn("blockquote",{...fe(this.options.HTMLAttributes,e),children:Cn("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=">",s=[];return e.content.forEach(r=>{const o=t.renderChildren([r]).split(`
104
104
  `).map(l=>l.trim()===""?n:`${n} ${l}`);s.push(o.join(`
105
105
  `))}),s.join(`
106
106
  ${n}
@@ -114,7 +114,7 @@ ${n}
114
114
  `);return l.replaceWith(c,u,s.schema.text(f)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:fr,{state:s}=e,{selection:r}=s,{$from:i,empty:a}=r;return i.parent.type!==this.type?!1:a?e.commands.command(({tr:o})=>{var l;const{pos:c}=i,u=i.start(),d=i.end(),f=s.doc.textBetween(u,d,`
115
115
  `,`
116
116
  `).split(`
117
- `);let y=0,_=0;const M=c-u;for(let G=0;G<f.length;G+=1){if(_+f[G].length>=M){y=G;break}_+=f[G].length+1}const C=((l=f[y].match(/^ */))==null?void 0:l[0])||"",O=Math.min(C.length,n);if(O===0)return!0;let L=u;for(let G=0;G<y;G+=1)L+=f[G].length+1;return o.delete(L,L+O),c-L<=O&&o.setSelection(vt.create(o.doc,L)),!0}):e.commands.command(({tr:o})=>{const{from:l,to:c}=r,p=s.doc.textBetween(l,c,`
117
+ `);let y=0,_=0;const M=c-u;for(let G=0;G<f.length;G+=1){if(_+f[G].length>=M){y=G;break}_+=f[G].length+1}const C=((l=f[y].match(/^ */))==null?void 0:l[0])||"",z=Math.min(C.length,n);if(z===0)return!0;let L=u;for(let G=0;G<y;G+=1)L+=f[G].length+1;return o.delete(L,L+z),c-L<=z&&o.setSelection(vt.create(o.doc,L)),!0}):e.commands.command(({tr:o})=>{const{from:l,to:c}=r,p=s.doc.textBetween(l,c,`
118
118
  `,`
119
119
  `).split(`
120
120
  `).map(f=>{var y;const _=((y=f.match(/^ */))==null?void 0:y[0])||"",M=Math.min(_.length,n);return f.slice(M)}).join(`
@@ -125,8 +125,8 @@ ${n}
125
125
 
126
126
  `):""}),Vp=Ee.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",fe(this.options.HTMLAttributes,e)]},renderText(){return`
127
127
  `},renderMarkdown:()=>`
128
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:s})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:o}=s.extensionManager,l=i||r.$to.parentOffset&&r.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&a){const d=l.filter(p=>o.includes(p.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Gp=Ee.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const s=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,r="#".repeat(s);return e.content?`${r} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>wr({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),Yp=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Qp=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Jp=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Zp=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Xp=Nt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Pt({find:Yp,type:this.type}),Pt({find:Jp,type:this.type})]},addPasteRules(){return[xt({find:Qp,type:this.type}),xt({find:Zp,type:this.type})]}});const eh="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",th="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Ar="numeric",Lr="ascii",$r="alpha",Gt="asciinumeric",Ut="alphanumeric",Er="domain",Pa="emoji",nh="scheme",rh="slashscheme",gr="whitespace";function sh(e,t){return e in t||(t[e]=[]),t[e]}function yt(e,t,n){t[Ar]&&(t[Gt]=!0,t[Ut]=!0),t[Lr]&&(t[Gt]=!0,t[$r]=!0),t[Gt]&&(t[Ut]=!0),t[$r]&&(t[Ut]=!0),t[Ut]&&(t[Er]=!0),t[Pa]&&(t[Er]=!0);for(const s in t){const r=sh(s,n);r.indexOf(e)<0&&r.push(e)}}function ah(e,t){const n={};for(const s in t)t[s].indexOf(e)>=0&&(n[s]=!0);return n}function Pe(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Pe.groups={};Pe.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let s=0;s<t.jr.length;s++){const r=t.jr[s][0],i=t.jr[s][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,s){for(let r=0;r<e.length;r++)this.tt(e[r],t,n,s)},tr(e,t,n,s){s=s||Pe.groups;let r;return t&&t.j?r=t:(r=new Pe(t),n&&s&&yt(t,n,s)),this.jr.push([e,r]),r},ts(e,t,n,s){let r=this;const i=e.length;if(!i)return r;for(let a=0;a<i-1;a++)r=r.tt(e[a]);return r.tt(e[i-1],t,n,s)},tt(e,t,n,s){s=s||Pe.groups;const r=this;if(t&&t.j)return r.j[e]=t,t;const i=t;let a,o=r.go(e);if(o?(a=new Pe,Object.assign(a.j,o.j),a.jr.push.apply(a.jr,o.jr),a.jd=o.jd,a.t=o.t):a=new Pe,i){if(s)if(a.t&&typeof a.t=="string"){const l=Object.assign(ah(a.t,s),n);yt(i,l,s)}else n&&yt(i,n,s);a.t=i}return r.j[e]=a,a}};const ee=(e,t,n,s,r)=>e.ta(t,n,s,r),ve=(e,t,n,s,r)=>e.tr(t,n,s,r),zs=(e,t,n,s,r)=>e.ts(t,n,s,r),A=(e,t,n,s,r)=>e.tt(t,n,s,r),at="WORD",Ir="UWORD",Ha="ASCIINUMERICAL",Na="ALPHANUMERICAL",nn="LOCALHOST",Rr="TLD",Pr="UTLD",kn="SCHEME",Et="SLASH_SCHEME",Qr="NUM",Hr="WS",Jr="NL",Yt="OPENBRACE",Qt="CLOSEBRACE",Sn="OPENBRACKET",Mn="CLOSEBRACKET",An="OPENPAREN",Ln="CLOSEPAREN",$n="OPENANGLEBRACKET",En="CLOSEANGLEBRACKET",In="FULLWIDTHLEFTPAREN",Rn="FULLWIDTHRIGHTPAREN",Pn="LEFTCORNERBRACKET",Hn="RIGHTCORNERBRACKET",Nn="LEFTWHITECORNERBRACKET",zn="RIGHTWHITECORNERBRACKET",On="FULLWIDTHLESSTHAN",Bn="FULLWIDTHGREATERTHAN",Dn="AMPERSAND",jn="APOSTROPHE",Fn="ASTERISK",ct="AT",qn="BACKSLASH",Un="BACKTICK",Kn="CARET",dt="COLON",Zr="COMMA",Wn="DOLLAR",Xe="DOT",Vn="EQUALS",Xr="EXCLAMATION",Fe="HYPHEN",Jt="PERCENT",Gn="PIPE",Yn="PLUS",Qn="POUND",Zt="QUERY",es="QUOTE",za="FULLWIDTHMIDDLEDOT",ts="SEMI",et="SLASH",Xt="TILDE",Jn="UNDERSCORE",Oa="EMOJI",Zn="SYM";var Ba=Object.freeze({__proto__:null,ALPHANUMERICAL:Na,AMPERSAND:Dn,APOSTROPHE:jn,ASCIINUMERICAL:Ha,ASTERISK:Fn,AT:ct,BACKSLASH:qn,BACKTICK:Un,CARET:Kn,CLOSEANGLEBRACKET:En,CLOSEBRACE:Qt,CLOSEBRACKET:Mn,CLOSEPAREN:Ln,COLON:dt,COMMA:Zr,DOLLAR:Wn,DOT:Xe,EMOJI:Oa,EQUALS:Vn,EXCLAMATION:Xr,FULLWIDTHGREATERTHAN:Bn,FULLWIDTHLEFTPAREN:In,FULLWIDTHLESSTHAN:On,FULLWIDTHMIDDLEDOT:za,FULLWIDTHRIGHTPAREN:Rn,HYPHEN:Fe,LEFTCORNERBRACKET:Pn,LEFTWHITECORNERBRACKET:Nn,LOCALHOST:nn,NL:Jr,NUM:Qr,OPENANGLEBRACKET:$n,OPENBRACE:Yt,OPENBRACKET:Sn,OPENPAREN:An,PERCENT:Jt,PIPE:Gn,PLUS:Yn,POUND:Qn,QUERY:Zt,QUOTE:es,RIGHTCORNERBRACKET:Hn,RIGHTWHITECORNERBRACKET:zn,SCHEME:kn,SEMI:ts,SLASH:et,SLASH_SCHEME:Et,SYM:Zn,TILDE:Xt,TLD:Rr,UNDERSCORE:Jn,UTLD:Pr,UWORD:Ir,WORD:at,WS:Hr});const nt=/[a-z]/,Ft=new RegExp("\\p{L}","u"),mr=new RegExp("\\p{Emoji}","u"),rt=/\d/,yr=/\s/,Os="\r",vr=`
129
- `,ih="️",oh="‍",kr="";let hn=null,fn=null;function lh(e=[]){const t={};Pe.groups=t;const n=new Pe;hn==null&&(hn=Bs(eh)),fn==null&&(fn=Bs(th)),A(n,"'",jn),A(n,"{",Yt),A(n,"}",Qt),A(n,"[",Sn),A(n,"]",Mn),A(n,"(",An),A(n,")",Ln),A(n,"<",$n),A(n,">",En),A(n,"(",In),A(n,")",Rn),A(n,"「",Pn),A(n,"」",Hn),A(n,"『",Nn),A(n,"』",zn),A(n,"<",On),A(n,">",Bn),A(n,"&",Dn),A(n,"*",Fn),A(n,"@",ct),A(n,"`",Un),A(n,"^",Kn),A(n,":",dt),A(n,",",Zr),A(n,"$",Wn),A(n,".",Xe),A(n,"=",Vn),A(n,"!",Xr),A(n,"-",Fe),A(n,"%",Jt),A(n,"|",Gn),A(n,"+",Yn),A(n,"#",Qn),A(n,"?",Zt),A(n,'"',es),A(n,"/",et),A(n,";",ts),A(n,"~",Xt),A(n,"_",Jn),A(n,"\\",qn),A(n,"・",za);const s=ve(n,rt,Qr,{[Ar]:!0});ve(s,rt,s);const r=ve(s,nt,Ha,{[Gt]:!0}),i=ve(s,Ft,Na,{[Ut]:!0}),a=ve(n,nt,at,{[Lr]:!0});ve(a,rt,r),ve(a,nt,a),ve(r,rt,r),ve(r,nt,r);const o=ve(n,Ft,Ir,{[$r]:!0});ve(o,nt),ve(o,rt,i),ve(o,Ft,o),ve(i,rt,i),ve(i,nt),ve(i,Ft,i);const l=A(n,vr,Jr,{[gr]:!0}),c=A(n,Os,Hr,{[gr]:!0}),u=ve(n,yr,Hr,{[gr]:!0});A(n,kr,u),A(c,vr,l),A(c,kr,u),ve(c,yr,u),A(u,Os),A(u,vr),ve(u,yr,u),A(u,kr,u);const d=ve(n,mr,Oa,{[Pa]:!0});A(d,"#"),ve(d,mr,d),A(d,ih,d);const p=A(d,oh);A(p,"#"),ve(p,mr,d);const f=[[nt,a],[rt,r]],y=[[nt,null],[Ft,o],[rt,i]];for(let _=0;_<hn.length;_++)ot(n,hn[_],Rr,at,f);for(let _=0;_<fn.length;_++)ot(n,fn[_],Pr,Ir,y);yt(Rr,{tld:!0,ascii:!0},t),yt(Pr,{utld:!0,alpha:!0},t),ot(n,"file",kn,at,f),ot(n,"mailto",kn,at,f),ot(n,"http",Et,at,f),ot(n,"https",Et,at,f),ot(n,"ftp",Et,at,f),ot(n,"ftps",Et,at,f),yt(kn,{scheme:!0,ascii:!0},t),yt(Et,{slashscheme:!0,ascii:!0},t),e=e.sort((_,M)=>_[0]>M[0]?1:-1);for(let _=0;_<e.length;_++){const M=e[_][0],C=e[_][1]?{[nh]:!0}:{[rh]:!0};M.indexOf("-")>=0?C[Er]=!0:nt.test(M)?rt.test(M)?C[Gt]=!0:C[Lr]=!0:C[Ar]=!0,zs(n,M,M,C)}return zs(n,"localhost",nn,{ascii:!0}),n.jd=new Pe(Zn),{start:n,tokens:Object.assign({groups:t},Ba)}}function Da(e,t){const n=ch(t.replace(/[A-Z]/g,o=>o.toLowerCase())),s=n.length,r=[];let i=0,a=0;for(;a<s;){let o=e,l=null,c=0,u=null,d=-1,p=-1;for(;a<s&&(l=o.go(n[a]));)o=l,o.accepts()?(d=0,p=0,u=o):d>=0&&(d+=n[a].length,p++),c+=n[a].length,i+=n[a].length,a++;i-=d,a-=p,c-=d,r.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return r}function ch(e){const t=[],n=e.length;let s=0;for(;s<n;){let r=e.charCodeAt(s),i,a=r<55296||r>56319||s+1===n||(i=e.charCodeAt(s+1))<56320||i>57343?e[s]:e.slice(s,s+2);t.push(a),s+=a.length}return t}function ot(e,t,n,s,r){let i;const a=t.length;for(let o=0;o<a-1;o++){const l=t[o];e.j[l]?i=e.j[l]:(i=new Pe(s),i.jr=r.slice(),e.j[l]=i),e=i}return i=new Pe(n),i.jr=r.slice(),e.j[t[a-1]]=i,i}function Bs(e){const t=[],n=[];let s=0,r="0123456789";for(;s<e.length;){let i=0;for(;r.indexOf(e[s+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let a=parseInt(e.substring(s,s+i),10);a>0;a--)n.pop();s+=i}else n.push(e[s]),s++}return t}const rn={defaultProtocol:"http",events:null,format:Ds,formatHref:Ds,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ns(e,t=null){let n=Object.assign({},rn);e&&(n=Object.assign(n,e instanceof ns?e.o:e));const s=n.ignoreTags,r=[];for(let i=0;i<s.length;i++)r.push(s[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=r}ns.prototype={o:rn,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const s=t!=null;let r=this.o[e];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:rn[e],typeof r=="function"&&s&&(r=r(t,n))):typeof r=="function"&&s&&(r=r(t,n.t,n)),r)},getObj(e,t,n){let s=this.o[e];return typeof s=="function"&&t!=null&&(s=s(t,n.t,n)),s},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function Ds(e){return e}function ja(e,t){this.t="token",this.v=e,this.tk=t}ja.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),s=e.get("format",t,this);return n&&s.length>n?s.substring(0,n)+"…":s},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=rn.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),s=e.get("formatHref",n,this),r=e.get("tagName",n,t),i=this.toFormattedString(e),a={},o=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return a.href=s,o&&(a.class=o),l&&(a.target=l),c&&(a.rel=c),u&&Object.assign(a,u),{tagName:r,attributes:a,content:i,eventListeners:d}}};function ir(e,t){class n extends ja{constructor(r,i){super(r,i),this.t=e}}for(const s in t)n.prototype[s]=t[s];return n.t=e,n}const js=ir("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Fs=ir("text"),uh=ir("nl"),gn=ir("url",{isLink:!0,toHref(e=rn.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==nn&&e[1].t===dt}}),je=e=>new Pe(e);function dh({groups:e}){const t=e.domain.concat([Dn,Fn,ct,qn,Un,Kn,Wn,Vn,Fe,Qr,Jt,Gn,Yn,Qn,et,Zn,Xt,Jn]),n=[jn,dt,Zr,Xe,Xr,Jt,Zt,es,ts,$n,En,Yt,Qt,Mn,Sn,An,Ln,In,Rn,Pn,Hn,Nn,zn,On,Bn],s=[Dn,jn,Fn,qn,Un,Kn,Wn,Vn,Fe,Yt,Qt,Jt,Gn,Yn,Qn,Zt,et,Zn,Xt,Jn],r=je(),i=A(r,Xt);ee(i,s,i),ee(i,e.domain,i);const a=je(),o=je(),l=je();ee(r,e.domain,a),ee(r,e.scheme,o),ee(r,e.slashscheme,l),ee(a,s,i),ee(a,e.domain,a);const c=A(a,ct);A(i,ct,c),A(o,ct,c),A(l,ct,c);const u=A(i,Xe);ee(u,s,i),ee(u,e.domain,i);const d=je();ee(c,e.domain,d),ee(d,e.domain,d);const p=A(d,Xe);ee(p,e.domain,d);const f=je(js);ee(p,e.tld,f),ee(p,e.utld,f),A(c,nn,f);const y=A(d,Fe);A(y,Fe,y),ee(y,e.domain,d),ee(f,e.domain,d),A(f,Xe,p),A(f,Fe,y);const _=A(f,dt);ee(_,e.numeric,js);const M=A(a,Fe),v=A(a,Xe);A(M,Fe,M),ee(M,e.domain,a),ee(v,s,i),ee(v,e.domain,a);const C=je(gn);ee(v,e.tld,C),ee(v,e.utld,C),ee(C,e.domain,a),ee(C,s,i),A(C,Xe,v),A(C,Fe,M),A(C,ct,c);const O=A(C,dt),L=je(gn);ee(O,e.numeric,L);const I=je(gn),G=je();ee(I,t,I),ee(I,n,G),ee(G,t,I),ee(G,n,G),A(C,et,I),A(L,et,I);const ue=A(o,dt),te=A(l,dt),W=A(te,et),ae=A(W,et);ee(o,e.domain,a),A(o,Xe,v),A(o,Fe,M),ee(l,e.domain,a),A(l,Xe,v),A(l,Fe,M),ee(ue,e.domain,I),A(ue,et,I),A(ue,Zt,I),ee(ae,e.domain,I),ee(ae,t,I),A(ae,et,I);const N=[[Yt,Qt],[Sn,Mn],[An,Ln],[$n,En],[In,Rn],[Pn,Hn],[Nn,zn],[On,Bn]];for(let $=0;$<N.length;$++){const[K,ie]=N[$],q=A(I,K);A(G,K,q),A(q,ie,I);const B=je(gn);ee(q,t,B);const ne=je();ee(q,n),ee(B,t,B),ee(B,n,ne),ee(ne,t,B),ee(ne,n,ne),A(B,ie,I),A(ne,ie,I)}return A(r,nn,C),A(r,Jr,uh),{start:r,tokens:Ba}}function ph(e,t,n){let s=n.length,r=0,i=[],a=[];for(;r<s;){let o=e,l=null,c=null,u=0,d=null,p=-1;for(;r<s&&!(l=o.go(n[r].t));)a.push(n[r++]);for(;r<s&&(c=l||o.go(n[r].t));)l=null,o=c,o.accepts()?(p=0,d=o):p>=0&&p++,r++,u++;if(p<0)r-=u,r<s&&(a.push(n[r]),r++);else{a.length>0&&(i.push(xr(Fs,t,a)),a=[]),r-=p,u-=p;const f=d.t,y=n.slice(r-u,r);i.push(xr(f,t,y))}}return a.length>0&&i.push(xr(Fs,t,a)),i}function xr(e,t,n){const s=n[0].s,r=n[n.length-1].e,i=t.slice(s,r);return new e(i,n)}const hh=typeof console<"u"&&console&&console.warn||(()=>{}),fh="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ge={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function gh(){return Pe.groups={},ge.scanner=null,ge.parser=null,ge.tokenQueue=[],ge.pluginQueue=[],ge.customSchemes=[],ge.initialized=!1,ge}function qs(e,t=!1){if(ge.initialized&&hh(`linkifyjs: already initialized - will not register custom scheme "${e}" ${fh}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
128
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:s})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:o}=s.extensionManager,l=i||r.$to.parentOffset&&r.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&a){const d=l.filter(p=>o.includes(p.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Gp=Ee.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const s=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,r="#".repeat(s);return e.content?`${r} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>wr({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),Yp=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Qp=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Jp=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Zp=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Xp=Nt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Pt({find:Yp,type:this.type}),Pt({find:Jp,type:this.type})]},addPasteRules(){return[xt({find:Qp,type:this.type}),xt({find:Zp,type:this.type})]}});const eh="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",th="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Ar="numeric",Lr="ascii",$r="alpha",Gt="asciinumeric",Ut="alphanumeric",Er="domain",Pa="emoji",nh="scheme",rh="slashscheme",gr="whitespace";function sh(e,t){return e in t||(t[e]=[]),t[e]}function yt(e,t,n){t[Ar]&&(t[Gt]=!0,t[Ut]=!0),t[Lr]&&(t[Gt]=!0,t[$r]=!0),t[Gt]&&(t[Ut]=!0),t[$r]&&(t[Ut]=!0),t[Ut]&&(t[Er]=!0),t[Pa]&&(t[Er]=!0);for(const s in t){const r=sh(s,n);r.indexOf(e)<0&&r.push(e)}}function ah(e,t){const n={};for(const s in t)t[s].indexOf(e)>=0&&(n[s]=!0);return n}function Pe(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Pe.groups={};Pe.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let s=0;s<t.jr.length;s++){const r=t.jr[s][0],i=t.jr[s][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,s){for(let r=0;r<e.length;r++)this.tt(e[r],t,n,s)},tr(e,t,n,s){s=s||Pe.groups;let r;return t&&t.j?r=t:(r=new Pe(t),n&&s&&yt(t,n,s)),this.jr.push([e,r]),r},ts(e,t,n,s){let r=this;const i=e.length;if(!i)return r;for(let a=0;a<i-1;a++)r=r.tt(e[a]);return r.tt(e[i-1],t,n,s)},tt(e,t,n,s){s=s||Pe.groups;const r=this;if(t&&t.j)return r.j[e]=t,t;const i=t;let a,o=r.go(e);if(o?(a=new Pe,Object.assign(a.j,o.j),a.jr.push.apply(a.jr,o.jr),a.jd=o.jd,a.t=o.t):a=new Pe,i){if(s)if(a.t&&typeof a.t=="string"){const l=Object.assign(ah(a.t,s),n);yt(i,l,s)}else n&&yt(i,n,s);a.t=i}return r.j[e]=a,a}};const ne=(e,t,n,s,r)=>e.ta(t,n,s,r),ve=(e,t,n,s,r)=>e.tr(t,n,s,r),zs=(e,t,n,s,r)=>e.ts(t,n,s,r),A=(e,t,n,s,r)=>e.tt(t,n,s,r),at="WORD",Ir="UWORD",Ha="ASCIINUMERICAL",Na="ALPHANUMERICAL",nn="LOCALHOST",Rr="TLD",Pr="UTLD",kn="SCHEME",Et="SLASH_SCHEME",Qr="NUM",Hr="WS",Jr="NL",Yt="OPENBRACE",Qt="CLOSEBRACE",Sn="OPENBRACKET",Mn="CLOSEBRACKET",An="OPENPAREN",Ln="CLOSEPAREN",$n="OPENANGLEBRACKET",En="CLOSEANGLEBRACKET",In="FULLWIDTHLEFTPAREN",Rn="FULLWIDTHRIGHTPAREN",Pn="LEFTCORNERBRACKET",Hn="RIGHTCORNERBRACKET",Nn="LEFTWHITECORNERBRACKET",zn="RIGHTWHITECORNERBRACKET",On="FULLWIDTHLESSTHAN",Bn="FULLWIDTHGREATERTHAN",Dn="AMPERSAND",jn="APOSTROPHE",Fn="ASTERISK",ct="AT",qn="BACKSLASH",Un="BACKTICK",Kn="CARET",dt="COLON",Zr="COMMA",Wn="DOLLAR",Xe="DOT",Vn="EQUALS",Xr="EXCLAMATION",Fe="HYPHEN",Jt="PERCENT",Gn="PIPE",Yn="PLUS",Qn="POUND",Zt="QUERY",es="QUOTE",za="FULLWIDTHMIDDLEDOT",ts="SEMI",et="SLASH",Xt="TILDE",Jn="UNDERSCORE",Oa="EMOJI",Zn="SYM";var Ba=Object.freeze({__proto__:null,ALPHANUMERICAL:Na,AMPERSAND:Dn,APOSTROPHE:jn,ASCIINUMERICAL:Ha,ASTERISK:Fn,AT:ct,BACKSLASH:qn,BACKTICK:Un,CARET:Kn,CLOSEANGLEBRACKET:En,CLOSEBRACE:Qt,CLOSEBRACKET:Mn,CLOSEPAREN:Ln,COLON:dt,COMMA:Zr,DOLLAR:Wn,DOT:Xe,EMOJI:Oa,EQUALS:Vn,EXCLAMATION:Xr,FULLWIDTHGREATERTHAN:Bn,FULLWIDTHLEFTPAREN:In,FULLWIDTHLESSTHAN:On,FULLWIDTHMIDDLEDOT:za,FULLWIDTHRIGHTPAREN:Rn,HYPHEN:Fe,LEFTCORNERBRACKET:Pn,LEFTWHITECORNERBRACKET:Nn,LOCALHOST:nn,NL:Jr,NUM:Qr,OPENANGLEBRACKET:$n,OPENBRACE:Yt,OPENBRACKET:Sn,OPENPAREN:An,PERCENT:Jt,PIPE:Gn,PLUS:Yn,POUND:Qn,QUERY:Zt,QUOTE:es,RIGHTCORNERBRACKET:Hn,RIGHTWHITECORNERBRACKET:zn,SCHEME:kn,SEMI:ts,SLASH:et,SLASH_SCHEME:Et,SYM:Zn,TILDE:Xt,TLD:Rr,UNDERSCORE:Jn,UTLD:Pr,UWORD:Ir,WORD:at,WS:Hr});const nt=/[a-z]/,Ft=new RegExp("\\p{L}","u"),mr=new RegExp("\\p{Emoji}","u"),rt=/\d/,yr=/\s/,Os="\r",vr=`
129
+ `,ih="️",oh="‍",kr="";let hn=null,fn=null;function lh(e=[]){const t={};Pe.groups=t;const n=new Pe;hn==null&&(hn=Bs(eh)),fn==null&&(fn=Bs(th)),A(n,"'",jn),A(n,"{",Yt),A(n,"}",Qt),A(n,"[",Sn),A(n,"]",Mn),A(n,"(",An),A(n,")",Ln),A(n,"<",$n),A(n,">",En),A(n,"(",In),A(n,")",Rn),A(n,"「",Pn),A(n,"」",Hn),A(n,"『",Nn),A(n,"』",zn),A(n,"<",On),A(n,">",Bn),A(n,"&",Dn),A(n,"*",Fn),A(n,"@",ct),A(n,"`",Un),A(n,"^",Kn),A(n,":",dt),A(n,",",Zr),A(n,"$",Wn),A(n,".",Xe),A(n,"=",Vn),A(n,"!",Xr),A(n,"-",Fe),A(n,"%",Jt),A(n,"|",Gn),A(n,"+",Yn),A(n,"#",Qn),A(n,"?",Zt),A(n,'"',es),A(n,"/",et),A(n,";",ts),A(n,"~",Xt),A(n,"_",Jn),A(n,"\\",qn),A(n,"・",za);const s=ve(n,rt,Qr,{[Ar]:!0});ve(s,rt,s);const r=ve(s,nt,Ha,{[Gt]:!0}),i=ve(s,Ft,Na,{[Ut]:!0}),a=ve(n,nt,at,{[Lr]:!0});ve(a,rt,r),ve(a,nt,a),ve(r,rt,r),ve(r,nt,r);const o=ve(n,Ft,Ir,{[$r]:!0});ve(o,nt),ve(o,rt,i),ve(o,Ft,o),ve(i,rt,i),ve(i,nt),ve(i,Ft,i);const l=A(n,vr,Jr,{[gr]:!0}),c=A(n,Os,Hr,{[gr]:!0}),u=ve(n,yr,Hr,{[gr]:!0});A(n,kr,u),A(c,vr,l),A(c,kr,u),ve(c,yr,u),A(u,Os),A(u,vr),ve(u,yr,u),A(u,kr,u);const d=ve(n,mr,Oa,{[Pa]:!0});A(d,"#"),ve(d,mr,d),A(d,ih,d);const p=A(d,oh);A(p,"#"),ve(p,mr,d);const f=[[nt,a],[rt,r]],y=[[nt,null],[Ft,o],[rt,i]];for(let _=0;_<hn.length;_++)ot(n,hn[_],Rr,at,f);for(let _=0;_<fn.length;_++)ot(n,fn[_],Pr,Ir,y);yt(Rr,{tld:!0,ascii:!0},t),yt(Pr,{utld:!0,alpha:!0},t),ot(n,"file",kn,at,f),ot(n,"mailto",kn,at,f),ot(n,"http",Et,at,f),ot(n,"https",Et,at,f),ot(n,"ftp",Et,at,f),ot(n,"ftps",Et,at,f),yt(kn,{scheme:!0,ascii:!0},t),yt(Et,{slashscheme:!0,ascii:!0},t),e=e.sort((_,M)=>_[0]>M[0]?1:-1);for(let _=0;_<e.length;_++){const M=e[_][0],C=e[_][1]?{[nh]:!0}:{[rh]:!0};M.indexOf("-")>=0?C[Er]=!0:nt.test(M)?rt.test(M)?C[Gt]=!0:C[Lr]=!0:C[Ar]=!0,zs(n,M,M,C)}return zs(n,"localhost",nn,{ascii:!0}),n.jd=new Pe(Zn),{start:n,tokens:Object.assign({groups:t},Ba)}}function Da(e,t){const n=ch(t.replace(/[A-Z]/g,o=>o.toLowerCase())),s=n.length,r=[];let i=0,a=0;for(;a<s;){let o=e,l=null,c=0,u=null,d=-1,p=-1;for(;a<s&&(l=o.go(n[a]));)o=l,o.accepts()?(d=0,p=0,u=o):d>=0&&(d+=n[a].length,p++),c+=n[a].length,i+=n[a].length,a++;i-=d,a-=p,c-=d,r.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return r}function ch(e){const t=[],n=e.length;let s=0;for(;s<n;){let r=e.charCodeAt(s),i,a=r<55296||r>56319||s+1===n||(i=e.charCodeAt(s+1))<56320||i>57343?e[s]:e.slice(s,s+2);t.push(a),s+=a.length}return t}function ot(e,t,n,s,r){let i;const a=t.length;for(let o=0;o<a-1;o++){const l=t[o];e.j[l]?i=e.j[l]:(i=new Pe(s),i.jr=r.slice(),e.j[l]=i),e=i}return i=new Pe(n),i.jr=r.slice(),e.j[t[a-1]]=i,i}function Bs(e){const t=[],n=[];let s=0,r="0123456789";for(;s<e.length;){let i=0;for(;r.indexOf(e[s+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let a=parseInt(e.substring(s,s+i),10);a>0;a--)n.pop();s+=i}else n.push(e[s]),s++}return t}const rn={defaultProtocol:"http",events:null,format:Ds,formatHref:Ds,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ns(e,t=null){let n=Object.assign({},rn);e&&(n=Object.assign(n,e instanceof ns?e.o:e));const s=n.ignoreTags,r=[];for(let i=0;i<s.length;i++)r.push(s[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=r}ns.prototype={o:rn,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const s=t!=null;let r=this.o[e];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:rn[e],typeof r=="function"&&s&&(r=r(t,n))):typeof r=="function"&&s&&(r=r(t,n.t,n)),r)},getObj(e,t,n){let s=this.o[e];return typeof s=="function"&&t!=null&&(s=s(t,n.t,n)),s},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function Ds(e){return e}function ja(e,t){this.t="token",this.v=e,this.tk=t}ja.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),s=e.get("format",t,this);return n&&s.length>n?s.substring(0,n)+"…":s},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=rn.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),s=e.get("formatHref",n,this),r=e.get("tagName",n,t),i=this.toFormattedString(e),a={},o=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return a.href=s,o&&(a.class=o),l&&(a.target=l),c&&(a.rel=c),u&&Object.assign(a,u),{tagName:r,attributes:a,content:i,eventListeners:d}}};function ir(e,t){class n extends ja{constructor(r,i){super(r,i),this.t=e}}for(const s in t)n.prototype[s]=t[s];return n.t=e,n}const js=ir("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Fs=ir("text"),uh=ir("nl"),gn=ir("url",{isLink:!0,toHref(e=rn.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==nn&&e[1].t===dt}}),je=e=>new Pe(e);function dh({groups:e}){const t=e.domain.concat([Dn,Fn,ct,qn,Un,Kn,Wn,Vn,Fe,Qr,Jt,Gn,Yn,Qn,et,Zn,Xt,Jn]),n=[jn,dt,Zr,Xe,Xr,Jt,Zt,es,ts,$n,En,Yt,Qt,Mn,Sn,An,Ln,In,Rn,Pn,Hn,Nn,zn,On,Bn],s=[Dn,jn,Fn,qn,Un,Kn,Wn,Vn,Fe,Yt,Qt,Jt,Gn,Yn,Qn,Zt,et,Zn,Xt,Jn],r=je(),i=A(r,Xt);ne(i,s,i),ne(i,e.domain,i);const a=je(),o=je(),l=je();ne(r,e.domain,a),ne(r,e.scheme,o),ne(r,e.slashscheme,l),ne(a,s,i),ne(a,e.domain,a);const c=A(a,ct);A(i,ct,c),A(o,ct,c),A(l,ct,c);const u=A(i,Xe);ne(u,s,i),ne(u,e.domain,i);const d=je();ne(c,e.domain,d),ne(d,e.domain,d);const p=A(d,Xe);ne(p,e.domain,d);const f=je(js);ne(p,e.tld,f),ne(p,e.utld,f),A(c,nn,f);const y=A(d,Fe);A(y,Fe,y),ne(y,e.domain,d),ne(f,e.domain,d),A(f,Xe,p),A(f,Fe,y);const _=A(f,dt);ne(_,e.numeric,js);const M=A(a,Fe),v=A(a,Xe);A(M,Fe,M),ne(M,e.domain,a),ne(v,s,i),ne(v,e.domain,a);const C=je(gn);ne(v,e.tld,C),ne(v,e.utld,C),ne(C,e.domain,a),ne(C,s,i),A(C,Xe,v),A(C,Fe,M),A(C,ct,c);const z=A(C,dt),L=je(gn);ne(z,e.numeric,L);const E=je(gn),G=je();ne(E,t,E),ne(E,n,G),ne(G,t,E),ne(G,n,G),A(C,et,E),A(L,et,E);const ue=A(o,dt),te=A(l,dt),V=A(te,et),I=A(V,et);ne(o,e.domain,a),A(o,Xe,v),A(o,Fe,M),ne(l,e.domain,a),A(l,Xe,v),A(l,Fe,M),ne(ue,e.domain,E),A(ue,et,E),A(ue,Zt,E),ne(I,e.domain,E),ne(I,t,E),A(I,et,E);const U=[[Yt,Qt],[Sn,Mn],[An,Ln],[$n,En],[In,Rn],[Pn,Hn],[Nn,zn],[On,Bn]];for(let O=0;O<U.length;O++){const[Z,ie]=U[O],K=A(E,Z);A(G,Z,K),A(K,ie,E);const B=je(gn);ne(K,t,B);const re=je();ne(K,n),ne(B,t,B),ne(B,n,re),ne(re,t,B),ne(re,n,re),A(B,ie,E),A(re,ie,E)}return A(r,nn,C),A(r,Jr,uh),{start:r,tokens:Ba}}function ph(e,t,n){let s=n.length,r=0,i=[],a=[];for(;r<s;){let o=e,l=null,c=null,u=0,d=null,p=-1;for(;r<s&&!(l=o.go(n[r].t));)a.push(n[r++]);for(;r<s&&(c=l||o.go(n[r].t));)l=null,o=c,o.accepts()?(p=0,d=o):p>=0&&p++,r++,u++;if(p<0)r-=u,r<s&&(a.push(n[r]),r++);else{a.length>0&&(i.push(xr(Fs,t,a)),a=[]),r-=p,u-=p;const f=d.t,y=n.slice(r-u,r);i.push(xr(f,t,y))}}return a.length>0&&i.push(xr(Fs,t,a)),i}function xr(e,t,n){const s=n[0].s,r=n[n.length-1].e,i=t.slice(s,r);return new e(i,n)}const hh=typeof console<"u"&&console&&console.warn||(()=>{}),fh="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ge={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function gh(){return Pe.groups={},ge.scanner=null,ge.parser=null,ge.tokenQueue=[],ge.pluginQueue=[],ge.customSchemes=[],ge.initialized=!1,ge}function qs(e,t=!1){if(ge.initialized&&hh(`linkifyjs: already initialized - will not register custom scheme "${e}" ${fh}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
130
130
  1. Must only contain digits, lowercase ASCII letters or "-"
131
131
  2. Cannot start or end with "-"
132
132
  3. "-" cannot repeat`);ge.customSchemes.push([e,t])}function mh(){ge.scanner=lh(ge.customSchemes);for(let e=0;e<ge.tokenQueue.length;e++)ge.tokenQueue[e][1]({scanner:ge.scanner});ge.parser=dh(ge.scanner.tokens);for(let e=0;e<ge.pluginQueue.length;e++)ge.pluginQueue[e][1]({scanner:ge.scanner,parser:ge.parser});return ge.initialized=!0,ge}function rs(e){return ge.initialized||mh(),ph(ge.parser.start,e,Da(ge.scanner.start,e))}rs.scan=Da;function Fa(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const s=new ns(n),r=rs(e),i=[];for(let a=0;a<r.length;a++){const o=r[a];o.isLink&&(!t||o.t===t)&&s.check(o)&&i.push(o.toFormattedObject(s))}return i}var ss="[\0-   ᠎ -\u2029  ]",yh=new RegExp(ss),vh=new RegExp(`${ss}$`),kh=new RegExp(ss,"g");function xh(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function bh(e){return new Ue({key:new Be("autolink"),appendTransaction:(t,n,s)=>{const r=t.some(c=>c.docChanged)&&!n.doc.eq(s.doc),i=t.some(c=>c.getMeta("preventAutolink"));if(!r||i)return;const{tr:a}=s,o=Ri(n.doc,[...t]);if(Pi(o).forEach(({newRange:c})=>{const u=Hi(s.doc,c,f=>f.isTextblock);let d,p;if(u.length>1)d=u[0],p=s.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const f=s.doc.textBetween(c.from,c.to," "," ");if(!vh.test(f))return;d=u[0],p=s.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&p){const f=p.split(yh).filter(Boolean);if(f.length<=0)return!1;const y=f[f.length-1],_=d.pos+p.lastIndexOf(y);if(!y)return!1;const M=rs(y).map(v=>v.toObject(e.defaultProtocol));if(!xh(M))return!1;M.filter(v=>v.isLink).map(v=>({...v,from:_+v.start+1,to:_+v.end+1})).filter(v=>s.schema.marks.code?!s.doc.rangeHasMark(v.from,v.to,s.schema.marks.code):!0).filter(v=>e.validate(v.value)).filter(v=>e.shouldAutoLink(v.value)).forEach(v=>{Ni(v.from,v.to,s.doc).some(C=>C.mark.type===e.type)||a.addMark(v.from,v.to,e.type.create({href:v.href}))})}}),!!a.steps.length)return a}})}function wh(e){return new Ue({key:new Be("handleClickLink"),props:{handleClick:(t,n,s)=>{var r,i;if(s.button!==0||!t.editable)return!1;let a=null;if(s.target instanceof HTMLAnchorElement)a=s.target;else{const l=s.target;if(!l)return!1;const c=e.editor.view.dom;a=l.closest("a"),a&&!c.contains(a)&&(a=null)}if(!a)return!1;let o=!1;if(e.enableClickSelection&&(o=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const l=zi(t.state,e.type.name),c=(r=a.href)!=null?r:l.href,u=(i=a.target)!=null?i:l.target;c&&(window.open(c,u),o=!0)}return o}}})}function _h(e){return new Ue({key:new Be("handlePasteLink"),props:{handlePaste:(t,n,s)=>{const{shouldAutoLink:r}=e,{state:i}=t,{selection:a}=i,{empty:o}=a;if(o)return!1;let l="";s.content.forEach(u=>{l+=u.textContent});const c=Fa(l,{defaultProtocol:e.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||r!==void 0&&!r(c.value)?!1:e.editor.commands.setMark(e.type,{href:c.href})}}})}function gt(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(s=>{const r=typeof s=="string"?s:s.scheme;r&&n.push(r)}),!e||e.replace(kh,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Th=Nt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){qs(e);return}qs(e.scheme,e.optionalSlashes)})},onDestroy(){gh()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!gt(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!gt(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!gt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",fe(this.options.HTMLAttributes,e),0]:["a",fe(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,s,r,i;const a=(s=(n=e.attrs)==null?void 0:n.href)!=null?s:"",o=(i=(r=e.attrs)==null?void 0:r.title)!=null?i:"",l=t.renderChildren(e);return o?`[${l}](${a} "${o}")`:`[${l}](${a})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!gt(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:s=>!!gt(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[xt({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:s}=this.options,r=Fa(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:a=>!!gt(a,n),protocols:n,defaultProtocol:s}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(bh({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:r=>!!gt(r,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(wh({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(_h({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Ch=Object.defineProperty,Sh=(e,t)=>{for(var n in t)Ch(e,n,{get:t[n],enumerable:!0})},Mh="listItem",Us="textStyle",Ks=/^\s*([-+*])\s$/,qa=Ee.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",fe(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
@@ -140,8 +140,8 @@ ${f.slice(c+2)}`,d+=1;else break}t.push({indent:c,number:parseInt(o,10),content:
140
140
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=t?.index;return n!==void 0?n:-1},tokenize:(e,t,n)=>{var s;const r=e.split(`
141
141
  `),[i,a]=Eh(r);if(i.length===0)return;const o=Ja(i,0,n);return o.length===0?void 0:{type:"list",ordered:!0,start:((s=i[0])==null?void 0:s.number)||1,items:o,raw:r.slice(0,a).join(`
142
142
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Rh,this.editor.getAttributes(Vs)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Ht({find:Gs,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ht({find:Gs,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Vs)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Ph=/^\s*(\[([( |x])?\])\s$/,Hh=Ee.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",fe(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const s=t.parseChildren(e.nestedTokens);n.push(...s)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;const r=`- [${(n=e.attrs)!=null&&n.checked?"x":" "}] `;return ia(e,t,r)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:s})=>{const r=document.createElement("li"),i=document.createElement("label"),a=document.createElement("span"),o=document.createElement("input"),l=document.createElement("div"),c=d=>{var p,f;o.ariaLabel=((f=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:f.call(p,d,o.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(e),i.contentEditable="false",o.type="checkbox",o.addEventListener("mousedown",d=>d.preventDefault()),o.addEventListener("change",d=>{if(!s.isEditable&&!this.options.onReadOnlyChecked){o.checked=!o.checked;return}const{checked:p}=d.target;s.isEditable&&typeof n=="function"&&s.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const y=n();if(typeof y!="number")return!1;const _=f.doc.nodeAt(y);return f.setNodeMarkup(y,void 0,{..._?.attrs,checked:p}),!0}).run(),!s.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,p)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,p])=>{r.setAttribute(d,p)}),r.dataset.checked=e.attrs.checked,o.checked=e.attrs.checked,i.append(o,a),r.append(i,l),Object.entries(t).forEach(([d,p])=>{r.setAttribute(d,p)});let u=new Set(Object.keys(t));return{dom:r,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;r.dataset.checked=d.attrs.checked,o.checked=d.attrs.checked,c(d);const p=s.extensionManager.attributes,f=Oi(d,p),y=new Set(Object.keys(f)),_=this.options.HTMLAttributes;return u.forEach(M=>{y.has(M)||(M in _?r.setAttribute(M,_[M]):r.removeAttribute(M))}),Object.entries(f).forEach(([M,v])=>{v==null?M in _?r.setAttribute(M,_[M]):r.removeAttribute(M):r.setAttribute(M,v)}),u=y,!0}}}},addInputRules(){return[Ht({find:Ph,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),Nh=Ee.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",fe(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
143
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const s=i=>{const a=ds(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:s},n);return a?[{type:"taskList",raw:a.raw,items:a.items}]:n.blockTokens(i)},r=ds(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,a)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:a}),customNestedParser:s},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ke.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(qa.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(Ua.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Qa.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Za.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Hh.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Nh.configure(this.options.taskList)),e}});var Ys="&nbsp;",zh=" ",Oh=Ee.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",fe(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);const s=t.parseInline(n);return s.length===1&&s[0].type==="text"&&(s[0].text===Ys||s[0].text===zh)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,s)},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return n.length===0?Ys:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Bh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Dh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jh=Nt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",fe(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Pt({find:Bh,type:this.type})]},addPasteRules(){return[xt({find:Dh,type:this.type})]}}),Fh=Ee.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),qh=Nt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",fe(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Uh=Ke.create({name:"starterKit",addExtensions(){var e,t,n,s;const r=[];return this.options.bold!==!1&&r.push(Fp.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(zp.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(qa.configure(this.options.bulletList)),this.options.code!==!1&&r.push(ga.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Kp.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Wp.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(Od.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(Bd.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(Vp.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(Gp.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(qd.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(ma.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(Xp.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Ua.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Qa.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&r.push(Th.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&r.push(Za.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(Oh.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(jh.configure(this.options.strike)),this.options.text!==!1&&r.push(Fh.configure(this.options.text)),this.options.underline!==!1&&r.push(qh.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(Fd.configure((s=this.options)==null?void 0:s.trailingNode)),r}}),Kh=Uh;const Wh={slots:{root:"",content:"relative size-full flex-1",base:["w-full outline-none *:my-5 *:first:mt-0 *:last:mb-0 sm:px-8 selection:bg-primary/20","[&_p]:leading-7","[&_a]:text-primary [&_a]:border-b [&_a]:border-transparent [&_a]:hover:border-primary [&_a]:font-medium","[&_a]:transition-colors","[&_a>code]:border-dashed [&_a:hover>code]:border-primary [&_a:hover>code]:text-primary","[&_a>code]:transition-colors","[&_.mention]:text-primary [&_.mention]:font-medium","[&_:is(h1,h2,h3,h4,h5,h6)]:text-highlighted [&_:is(h1,h2,h3,h4,h5,h6)]:font-bold","[&_h1]:text-3xl","[&_h2]:text-2xl","[&_h3]:text-xl","[&_h4]:text-lg","[&_h5]:text-base","[&_h6]:text-base","[&_:is(h1,h2,h3,h4,h5,h6)>code]:border-dashed [&_:is(h1,h2,h3,h4,h5,h6)>code]:font-bold","[&_h2>code]:text-xl/6","[&_h3>code]:text-lg/5","[&_blockquote]:border-s-4 [&_blockquote]:border-accented [&_blockquote]:ps-4 [&_blockquote]:italic","[&_[data-type=horizontalRule]]:my-8 [&_[data-type=horizontalRule]]:py-2","[&_hr]:border-t [&_hr]:border-default","[&_pre]:text-sm/6 [&_pre]:border [&_pre]:border-muted [&_pre]:bg-muted [&_pre]:rounded-md [&_pre]:px-4 [&_pre]:py-3 [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:overflow-x-auto","[&_pre_code]:p-0 [&_pre_code]:text-inherit [&_pre_code]:font-inherit [&_pre_code]:rounded-none [&_pre_code]:inline [&_pre_code]:border-0 [&_pre_code]:bg-transparent","[&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-sm [&_code]:font-mono [&_code]:font-medium [&_code]:rounded-md [&_code]:inline-block [&_code]:border [&_code]:border-muted [&_code]:text-highlighted [&_code]:bg-muted","[&_:is(ul,ol)]:ps-6","[&_ul]:list-disc [&_ul]:marker:text-(--ui-border-accented)","[&_ol]:list-decimal [&_ol]:marker:text-muted","[&_li]:my-1.5 [&_li]:ps-1.5","[&_img]:rounded-md [&_img]:block [&_img]:max-w-full [&_img.ProseMirror-selectednode]:outline-2 [&_img.ProseMirror-selectednode]:outline-primary","[&_.ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper])]:bg-primary/20"]},variants:{placeholderMode:{firstLine:{base:"[&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:text-dimmed [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:pointer-events-none"},everyLine:{base:"[&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:text-dimmed [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:pointer-events-none"}}},defaultVariants:{placeholderMode:"everyLine"}},Vh=Object.assign({inheritAttrs:!1},{__name:"Editor",props:{as:{type:null,required:!1},modelValue:{type:null,required:!1},contentType:{type:String,required:!1},starterKit:{type:Object,required:!1},placeholder:{type:[String,Object],required:!1},markdown:{type:Object,required:!1},image:{type:[Boolean,Object],required:!1,default:!0},mention:{type:[Boolean,Object],required:!1,default:!0},handlers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},extensions:{type:Array,required:!1},injectCSS:{type:Boolean,required:!1},injectNonce:{type:null,required:!1},autofocus:{type:[String,Number,Boolean,null],required:!1},editable:{type:Boolean,required:!1},textDirection:{type:String,required:!1},editorProps:{type:Object,required:!1},parseOptions:{type:Object,required:!1},coreExtensionOptions:{type:Object,required:!1},enableInputRules:{type:[Array,Boolean],required:!1},enablePasteRules:{type:[Array,Boolean],required:!1},enableCoreExtensions:{type:[Boolean,Object],required:!1},enableContentCheck:{type:Boolean,required:!1},emitContentError:{type:Boolean,required:!1},onBeforeCreate:{type:Function,required:!1},onCreate:{type:Function,required:!1},onMount:{type:Function,required:!1},onUnmount:{type:Function,required:!1},onContentError:{type:Function,required:!1},onUpdate:{type:Function,required:!1},onSelectionUpdate:{type:Function,required:!1},onTransaction:{type:Function,required:!1},onFocus:{type:Function,required:!1},onBlur:{type:Function,required:!1},onDestroy:{type:Function,required:!1},onPaste:{type:Function,required:!1},onDrop:{type:Function,required:!1},onDelete:{type:Function,required:!1},enableExtensionDispatchTransaction:{type:Boolean,required:!1}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=la("editor",s),a=Fi(),o=ua(),l=S(()=>xn({extend:xn(Wh),...o.ui?.editor||{}})({placeholderMode:typeof i.placeholder=="object"?i.placeholder.mode:void 0})),c=qi(Ui(i,"starterKit","extensions","editorProps","contentType","class","placeholder","markdown","image","mention","handlers")),u=S(()=>Lt(i.editorProps,{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off",...a,class:l.value.base({class:i.ui?.base})}})),d=S(()=>i.contentType||(typeof i.modelValue=="string"?"html":"json")),p=S(()=>Lt(i.starterKit,{code:!1,horizontalRule:!1,dropcursor:{color:"var(--ui-primary)",width:2},link:{openOnClick:!1}})),f=S(()=>{const L=typeof i.placeholder=="string"?{placeholder:i.placeholder}:i.placeholder,{mode:I,...G}=L||{};return Lt(G,{showOnlyWhenEditable:!1,showOnlyCurrent:!0})}),y=S(()=>Lt(i.markdown,{markedOptions:{gfm:!0}})),_=S(()=>typeof i.image=="boolean"?{}:i.image),M=S(()=>Lt(typeof i.mention=="boolean"?{}:i.mention,{HTMLAttributes:{class:"mention"},renderText({node:L}){return`${L.attrs.mentionSuggestionChar??"@"}${L.attrs.label??L.attrs.id}`},renderHTML({options:L,node:I}){return["span",fe({"data-type":"mention"},L.HTMLAttributes),`${I.attrs.mentionSuggestionChar??"@"}${I.attrs.label??I.attrs.id}`]}})),v=S(()=>[d.value==="markdown"&&Hp.configure(y.value),Kh.configure(p.value),pd.extend({excludes:"code"}),hd.extend({renderHTML(){return["div",fe(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),i.image!==!1&&md.configure(_.value),i.mention!==!1&&kd.configure(M.value),i.placeholder&&Ud.configure(f.value),...i.extensions||[]].filter(L=>!!L)),C=go({...c.value,content:i.modelValue,contentType:d.value,extensions:v.value,editorProps:u.value,onCreate:({editor:L})=>{i.placeholder&&L.view.dispatch(L.state.tr)},onUpdate:({editor:L})=>{let I;try{d.value==="html"?I=L.getHTML():d.value==="json"?I=L.getJSON():d.value==="markdown"&&(I=L.getMarkdown())}catch{I=L.getText()}r("update:modelValue",I)}});Te(()=>i.modelValue,L=>{if(!C.value||L==null)return;const I=d.value==="html"?C.value.getHTML():d.value==="json"?JSON.stringify(C.value.getJSON()):d.value==="markdown"?C.value.getMarkdown():C.value.getText(),G=d.value==="json"&&typeof L=="object"?JSON.stringify(L):String(L);if(I!==G){const te=C.value.state.selection.from;C.value.commands.setContent(L,{contentType:d.value});const W=C.value.state.doc;te<=W.content.size&&C.value.commands.setTextSelection(te)}});const O=S(()=>({..._o(),...i.handlers}));return Ki("editorHandlers",O),t({editor:C}),(L,I)=>(m(),se(k(ca),{as:k(i).as,"data-slot":"root",class:Y(l.value.root({class:[k(i).ui?.root,k(i).class]}))},{default:de(()=>[k(C)?(m(),x(me,{key:0},[Rt(L.$slots,"default",{editor:k(C),handlers:O.value}),F(k(fo),{role:"presentation",editor:k(C),"data-slot":"content",class:Y(l.value.content({class:k(i).ui?.content}))},null,8,["editor","class"])],64)):U("",!0)]),_:3},8,["as","class"]))}}),Gh=be({__name:"AIChatMentionMenu",props:{editor:{},items:{default:()=>[]},searchTerm:{default:""},filterFields:{default:()=>["label"]},ignoreFilter:{type:Boolean,default:!1},limit:{default:42},appendTo:{},showTabs:{type:Boolean,default:!1},activeTab:{default:"contact"},contactTabLabel:{default:""},groupTabLabel:{default:""}},emits:["update:searchTerm","update:activeTab"],setup(e,{emit:t}){const n=e,s=t,r=S({get:()=>n.searchTerm,set:u=>s("update:searchTerm",u)}),i={id:"__mention-tabs__",label:"",type:"label"},a=S(()=>n.showTabs?[i,...n.items]:n.items),o=S(()=>({content:()=>"flex flex-col",viewport:()=>"relative flex-1 overflow-y-auto",group:()=>"isolate",label:()=>"ai-chat-mention-tabs sticky top-0 z-10",separator:()=>"h-px bg-border",item:()=>"group relative flex w-full items-center select-none outline-none before:absolute before:z-[-1] data-disabled:cursor-not-allowed data-disabled:opacity-75"}));let l=null;function c(){return ze("div",{class:"ai-chat-mention-tabs__inner"},[ze("button",{type:"button",class:["ai-chat-mention-tabs__button",n.activeTab==="contact"&&"is-active"],"aria-pressed":n.activeTab==="contact",onMousedown:u=>u.preventDefault(),onClick:()=>s("update:activeTab","contact")},n.contactTabLabel),ze("button",{type:"button",class:["ai-chat-mention-tabs__button",n.activeTab==="group"&&"is-active"],"aria-pressed":n.activeTab==="group",onMousedown:u=>u.preventDefault(),onClick:()=>s("update:activeTab","group")},n.groupTabLabel)])}return wt(async()=>{await Oe(),!(!n.editor||n.editor.isDestroyed)&&(l=Co({editor:n.editor,char:"@",pluginKey:"mentionMenu",items:Vi(()=>a.value),filterFields:n.filterFields,ignoreFilter:n.ignoreFilter,limit:n.limit,options:{placement:"top-start"},appendTo:n.appendTo,searchTerm:r,ui:o,onSelect:(u,d,p)=>{u.chain().focus().deleteRange(d).insertContent({type:"mention",attrs:{id:p.id,label:p.label,mentionSuggestionChar:"@"}}).run()},renderItem:u=>"type"in u&&u.type==="label"?c():[ze(Wi,{src:u.avatar,alt:u.label,text:u.label.slice(0,1),rootClass:"h-5 w-5 shrink-0",imageClass:"h-5 w-5 rounded-md object-cover",fallbackClass:"flex h-5 w-5 items-center justify-center rounded-md bg-gray-100 text-[9px] text-gray-500 dark:bg-gray-800 dark:text-gray-400",rootMargin:"0px"}),ze("span",{class:"min-w-0 flex-1 truncate text-sm leading-[18px]"},u.label)]}),n.editor.registerPlugin(l.plugin))}),_t(()=>{l?.destroy(),l=null,n.editor&&!n.editor.isDestroyed&&n.editor.unregisterPlugin("mentionMenu")}),(u,d)=>(m(),x("div"))}});function Yh(e){return e.isComposing||e.hasKeyboardSelection?"pass":e.key==="ArrowDown"?"activate-and-block":e.key==="ArrowUp"?"activate":e.key==="Enter"||e.key==="Tab"?"block":"pass"}const Qh={key:0,class:"inline-flex max-w-[180px] shrink-0 items-center rounded-md bg-primary-50 px-2 text-sm leading-6 font-medium text-primary-700 dark:bg-primary-500/10 dark:text-primary-400"},Jh={class:"truncate"},Zh=["disabled","title"],Xh=be({__name:"AIChatComposer",props:{modelValue:{},disabled:{type:Boolean,default:!1},status:{default:"ready"},placeholder:{},sendButtonTitle:{},activeSkillName:{default:null},mentionItems:{default:()=>[]},mentionSearchTerm:{default:""},asyncMentionSearch:{type:Boolean,default:!1},showMentionTabs:{type:Boolean,default:!1},mentionTab:{default:"contact"},contactTabLabel:{default:""},groupTabLabel:{default:""},embedded:{type:Boolean,default:!1}},emits:["update:modelValue","update:mentionSearchTerm","update:mentionTab","mentionsChange","submit","stop","keydown","compositionStart","compositionEnd"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=J(null),a=J(y(s.modelValue));let o=0,l=null,c=!1;const u=S(()=>s.modelValue.trim().length>0&&!s.disabled),d={handleKeyDown:(N,$)=>(r("keydown",$),$.defaultPrevented),handleDOMEvents:{compositionstart:()=>(r("compositionStart"),!1),compositionend:()=>(r("compositionEnd"),!1)}},p={blockquote:!1,bold:!1,bulletList:!1,code:!1,codeBlock:!1,heading:!1,italic:!1,link:!1,listItem:!1,orderedList:!1,strike:!1,underline:!1},f={HTMLAttributes:{class:"ai-chat-mention"},deleteTriggerWithBackspace:!0};function y(N){return{type:"doc",content:N.split(`
144
- `).map(K=>({type:"paragraph",content:K?[{type:"text",text:K}]:void 0}))}}function _(N){const $=typeof N.attrs?.id=="string"?N.attrs.id:"";return`@${typeof N.attrs?.label=="string"?N.attrs.label:$}`}function M(N){if(N.type==="text")return N.text??"";if(N.type==="mention")return _(N);if(N.type==="hardBreak")return`
145
- `;const $=N.content??[],K=N.type==="doc"?`
146
- `:"";return $.map(M).join(K)}function v(N,$=[]){return N.type==="mention"&&typeof N.attrs?.id=="string"&&$.push(N.attrs.id),N.content?.forEach(K=>v(K,$)),$}function C(N){a.value=N;const $=v(N),K=$.length>o;o=$.length,r("update:modelValue",M(N)),r("mentionsChange",[...new Set($)]),K&&Oe(()=>i.value?.editor?.commands.insertContent(" "))}function O(N="end"){i.value?.editor?.commands.focus(N)}function L(N){o=0,a.value=y(N)}function I(){L("")}function G(){}function ue(N){N.target instanceof Element&&N.target.closest('[role="option"]')&&N.stopPropagation()}function te(){c=!0,l?.classList.add("has-keyboard-selection")}function W(N){if(!l?.firstElementChild)return;const $=Yh({key:N.key,isComposing:N.isComposing,hasKeyboardSelection:c});($==="activate"||$==="activate-and-block")&&te(),($==="block"||$==="activate-and-block")&&(N.preventDefault(),N.stopImmediatePropagation())}function ae(){return c=!1,l?.classList.remove("has-keyboard-selection"),l||(l=document.createElement("div"),l.className="ai-chat-mention-menu-host",l.addEventListener("mouseenter",ue,!0),document.body.appendChild(l)),l}return wt(()=>{document.addEventListener("keydown",W,!0)}),_t(()=>{document.removeEventListener("keydown",W,!0),l?.remove(),l=null}),Te(()=>s.modelValue,N=>{M(a.value)!==N&&L(N)}),Te(()=>s.disabled,N=>{i.value?.editor?.setEditable(!N,!1)}),t({focus:O,setText:L,clear:I,syncHeight:G}),(N,$)=>{const K=Ne;return m(),x("div",{class:Y(["flex flex-col overflow-hidden transition-all",[e.embedded?"bg-transparent":"rounded-2xl bg-white shadow-[0_2px_14px_rgba(0,0,0,0.04)] ring-1 ring-gray-200/60 dark:bg-page-dark dark:ring-white/5",!e.embedded&&e.disabled?"bg-gray-50/50 dark:bg-page-dark/50":"",!e.embedded&&!e.disabled?"focus-within:ring-primary-500/40 focus-within:shadow-[0_4px_20px_rgba(0,0,0,0.08)] dark:focus-within:ring-primary-500/40":""]])},[h("div",{class:Y(["px-4 pt-2.5 pb-2.5",{relative:!e.embedded}])},[h("div",{class:Y(["flex items-start gap-2",{"pr-10":!e.embedded}])},[e.activeSkillName?(m(),x("div",Qh,[h("span",Jh,"/"+w(e.activeSkillName),1)])):U("",!0),F(Vh,{ref_key:"editorRef",ref:i,"model-value":a.value,"content-type":"json",class:"ai-chat-editor min-w-0 flex-1",editable:!e.disabled,placeholder:e.placeholder,"starter-kit":p,mention:f,image:!1,"editor-props":d,"onUpdate:modelValue":C},{default:de(({editor:ie})=>[F(Gh,{"search-term":s.mentionSearchTerm,editor:ie,items:e.mentionItems,"filter-fields":["label","searchText"],"ignore-filter":e.asyncMentionSearch,limit:100,"append-to":ae,"show-tabs":e.showMentionTabs,"active-tab":e.mentionTab,"contact-tab-label":e.contactTabLabel,"group-tab-label":e.groupTabLabel,"onUpdate:searchTerm":$[0]||($[0]=q=>r("update:mentionSearchTerm",q)),"onUpdate:activeTab":$[1]||($[1]=q=>r("update:mentionTab",q))},null,8,["search-term","editor","items","ignore-filter","show-tabs","active-tab","contact-tab-label","group-tab-label"])]),_:1},8,["model-value","editable","placeholder"])],2),e.status==="streaming"?(m(),x("button",{key:0,type:"button",class:"absolute right-3 bottom-2 flex h-7 w-7 items-center justify-center rounded-full bg-primary-500 text-white shadow-sm transition-colors hover:bg-primary-600",onClick:$[2]||($[2]=ie=>r("stop"))},[F(K,{name:"i-heroicons-stop-16-solid",class:"h-3.5 w-3.5"})])):(m(),x("button",{key:1,type:"button",class:Y(["absolute right-3 bottom-2 flex h-7 w-7 items-center justify-center rounded-full transition-all duration-200",u.value?"bg-primary-500 text-white hover:bg-primary-600 shadow-sm":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-500"]),disabled:!u.value,title:e.sendButtonTitle,onClick:$[3]||($[3]=ie=>r("submit"))},[F(K,{name:"i-heroicons-arrow-up-20-solid",class:"h-4 w-4"})],10,Zh))],2)],2)}}}),ef=nr(Xh,[["__scopeId","data-v-81d43e7c"]]),tf={key:0,class:"absolute bottom-full left-0 z-20 mb-1.5 w-[240px] max-w-[calc(100vw-2rem)]"},nf={class:"overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-overlay dark:border-gray-700 dark:bg-page-dark"},rf={class:"flex items-center justify-between border-b border-gray-100 px-2.5 py-1.5 dark:border-gray-800"},sf={class:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400"},af=["title"],of=["onMouseenter","onClick"],lf={class:"min-w-0 flex-1"},cf={class:"flex items-center gap-1.5"},uf={class:"truncate text-xs font-medium"},df={class:"mt-0.5 line-clamp-1 text-xs leading-4 text-gray-500 dark:text-gray-400"},pf={key:1,class:"px-3 py-4 text-center"},hf={class:"text-sm font-medium text-gray-700 dark:text-gray-200"},ff={class:"mt-1 text-xs leading-5 text-gray-500 dark:text-gray-400"},gf={key:0,class:"absolute top-1/2 left-full ml-1 flex max-h-[min(348px,calc(100vh-10rem))] w-[300px] -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-overlay dark:border-gray-700 dark:bg-page-dark"},mf={class:"border-b border-gray-100 px-3 py-2 dark:border-gray-800"},yf={class:"truncate text-sm font-medium text-gray-900 dark:text-gray-100"},vf={class:"mt-0.5 text-xs leading-5 text-gray-500 dark:text-gray-400"},kf={key:0,class:"mt-1 flex items-start gap-1.5 text-[11px] leading-4"},xf={class:"shrink-0 font-medium text-gray-600 dark:text-gray-300"},bf={class:"line-clamp-1 min-w-0 flex-1 text-gray-500 dark:text-gray-400"},wf={key:1,class:"mt-0.5 flex items-start gap-1.5 text-[11px] leading-4"},_f={class:"shrink-0 font-medium text-gray-600 dark:text-gray-300"},Tf={class:"line-clamp-1 min-w-0 flex-1 text-gray-500 dark:text-gray-400"},Cf={class:"min-h-0 flex-1 overflow-y-auto px-3 py-2"},Sf={key:0,class:"text-xs text-gray-400 dark:text-gray-500"},Mf=["innerHTML"],Af={key:2,class:"text-xs leading-relaxed text-gray-400 dark:text-gray-500"},Lf=be({__name:"SlashCommandMenu",props:{visible:{type:Boolean},skills:{},highlightIndex:{},activeSkillId:{}},emits:["select","close","manage","highlight"],setup(e,{emit:t}){const{t:n,te:s}=qe(),r=ha(),i=e,a=t,o=J({}),l=J(""),c=J(!1),u=J(null),d=new da({html:!1,breaks:!0,linkify:!0,typographer:!0}),p=S(()=>{if(i.skills.length===0)return null;const v=Math.min(i.highlightIndex,i.skills.length-1);return i.skills[v]??null}),f=S(()=>l.value?d.render(l.value):"");function y(v){const C=`ai.assistant.builtinToolDesc.${v}`;return s(C)?n(C):v}const _=S(()=>p.value?.tags.join(" / ")||""),M=S(()=>p.value?.tools.map(v=>y(v)).join(" / ")||"");return Te(()=>[i.visible,p.value?.id],async([v,C])=>{if(!v||!C){l.value="",c.value=!1;return}if(o.value[C]){l.value=o.value[C],c.value=!1;return}c.value=!0;const L=(await r.getSkillConfig(C))?.prompt?.trim()||"";o.value={...o.value,[C]:L},p.value?.id===C&&(l.value=L,c.value=!1)},{immediate:!0}),Te(()=>[i.visible,i.highlightIndex,i.skills.length],async([v,C])=>{if(!v||!u.value)return;await Oe(),u.value.querySelectorAll("[data-slash-item]")[C]?.scrollIntoView({block:"nearest"})}),(v,C)=>{const O=Ne;return m(),se(Gi,{name:"slash-menu"},{default:de(()=>[e.visible?(m(),x("div",tf,[h("div",nf,[h("div",rf,[h("div",sf,[h("span",null,w(k(n)("ai.chat.input.slashHint")),1)]),h("button",{type:"button",class:"rounded-md p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",title:k(n)("common.close"),onClick:C[0]||(C[0]=L=>a("close"))},[F(O,{name:"i-heroicons-x-mark",class:"h-3.5 w-3.5"})],8,af)]),i.skills.length>0?(m(),x("div",{key:0,ref_key:"listRef",ref:u,class:"max-h-72 overflow-y-auto p-1.5"},[(m(!0),x(me,null,_e(i.skills,(L,I)=>(m(),x("button",{key:L.id,type:"button","data-slash-item":"",class:Y(["flex w-full items-start justify-between gap-1.5 rounded-lg px-2.5 py-1.5 text-left transition-colors",I===i.highlightIndex?"bg-primary-50 text-gray-900 dark:bg-primary-950/30 dark:text-gray-100":"text-gray-700 hover:bg-gray-50 dark:text-gray-200 dark:hover:bg-gray-800/80"]),onMouseenter:G=>a("highlight",I),onClick:G=>a("select",L)},[h("div",lf,[h("div",cf,[h("span",uf,w(L.name),1),i.activeSkillId===L.id?(m(),se(O,{key:0,name:"i-heroicons-check-circle-20-solid",class:"h-3.5 w-3.5 shrink-0 text-primary-500"})):U("",!0)]),h("p",df,w(L.description),1)])],42,of))),128))],512)):(m(),x("div",pf,[h("p",hf,w(k(n)("ai.chat.input.slashEmpty")),1),h("p",ff,w(k(n)("ai.chat.input.slashEmptyHint")),1)])),h("button",{type:"button",class:"flex w-full items-center justify-between border-t border-gray-100 px-2.5 py-1.5 text-xs text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900 dark:border-gray-800 dark:text-gray-300 dark:hover:bg-gray-800/80 dark:hover:text-gray-100",onClick:C[1]||(C[1]=L=>a("manage"))},[h("span",null,w(k(n)("ai.chat.input.manageSkills")),1),F(O,{name:"i-heroicons-arrow-top-right-on-square",class:"h-3.5 w-3.5"})])]),i.skills.length>0&&p.value?(m(),x("div",gf,[h("div",mf,[h("p",yf,w(p.value.name),1),h("p",vf,w(p.value.description),1),_.value?(m(),x("div",kf,[h("span",xf,w(k(n)("ai.chat.input.previewTagsLabel")),1),h("span",bf,w(_.value),1)])):U("",!0),M.value?(m(),x("div",wf,[h("span",_f,w(k(n)("ai.chat.input.previewToolsLabel")),1),h("span",Tf,w(M.value),1)])):U("",!0)]),h("div",Cf,[c.value?(m(),x("div",Sf,w(k(n)("common.loading")),1)):f.value?(m(),x("div",{key:1,class:"prose prose-sm max-w-none text-xs leading-5 dark:prose-invert prose-headings:mb-1.5 prose-headings:mt-2 prose-p:my-1.5 prose-ul:my-1.5 prose-ol:my-1.5",innerHTML:f.value},null,8,Mf)):(m(),x("div",Af,w(k(n)("ai.chat.input.previewUnavailable")),1))])])):U("",!0)])):U("",!0)]),_:1})}}}),$f=nr(Lf,[["__scopeId","data-v-0f67bc21"]]),Ef=1500,mg=be({__name:"AIChatInput",props:{sessionId:{default:""},disabled:{type:Boolean},status:{},chatType:{default:"group"},mentionScope:{default:"session"},skillsEnabled:{type:Boolean,default:!0},placeholder:{default:""},embedded:{type:Boolean,default:!1}},emits:["send","stop","manageSkills","skillActivated"],setup(e,{expose:t,emit:n}){const{t:s}=qe(),r=e,i=n,a=ha(),o=Yi(),{compatibleSkills:l,activeSkill:c,activeSkillId:u,isLoaded:d}=er(a),p=J(null),f=J(null),y=J(""),_=J([]),M=J([]),v=new Map,C=J([]),O=J(""),L=J("contact"),I=J(!1),G=J(""),ue=J(0),te=J(!1),W=J(null);let ae=null,N=null,$=0;const K=S(()=>y.value.trim().length>0&&!r.disabled),ie=S(()=>r.placeholder?r.placeholder:r.skillsEnabled&&c.value&&y.value.trim().length===0?s("ai.chat.input.placeholderWithActiveSkill",{name:c.value.name}):s("ai.chat.input.placeholderWithSlash")),q=S(()=>r.status==="streaming"?"":K.value?s("ai.chat.input.send"):r.skillsEnabled&&c.value?s("ai.chat.input.needMoreThanSkill"):s("ai.chat.input.needQuestion")),B=S(()=>{const E=new Map;return _.value.forEach(z=>{const Z=z.groupNickname||z.accountName||z.platformId;E.set(Z,(E.get(Z)??0)+1)}),_.value.map(z=>{const Z=z.groupNickname||z.accountName||z.platformId,Le=(E.get(Z)??0)>1?`${Z}·${z.platformId}`:Z;return{key:`member:${r.sessionId}:${z.id}`,displayName:Z,avatar:z.avatar,mentionText:`@${Le}`,insertName:Le,mentionedMember:{memberId:z.id,platformId:z.platformId,displayName:Z,aliases:[...z.aliases],mentionText:`@${Le}`},searchText:[Z,z.groupNickname||"",z.accountName||"",z.platformId,Le,z.aliases.join(" ")].join(" ").toLocaleLowerCase()}})}),ne=S(()=>r.mentionScope!=="global"?B.value:M.value.filter(E=>L.value==="contact"?E.entityRef?.type==="contact":E.entityRef?.type==="session")),H=S(()=>{const E=O.value.trim().toLocaleLowerCase();return(r.mentionScope==="global"&&E?ne.value.filter(Z=>Z.searchText.includes(E)):ne.value).map(Z=>({id:Z.key,label:Z.insertName,avatar:Z.avatar,searchText:Z.searchText}))}),V=S(()=>{if(!r.skillsEnabled)return[];const E=G.value.trim().toLocaleLowerCase();return E?l.value.filter(z=>[z.name,z.description,z.tags.join(" ")].join(" ").toLocaleLowerCase().includes(E)):l.value});function j(){f.value?.focus("end")}async function re(){if(r.mentionScope!=="session"||!r.sessionId){_.value=[];return}try{const E=await lr().getMembers(r.sessionId);_.value=[...E].sort((z,Z)=>Z.messageCount-z.messageCount)}catch(E){console.error("Failed to load AI mention members:",E),_.value=[]}}function oe(E,z){const Z=s("ai.global.entityPicker.groups"),Le=[...E.map(X=>({key:`contact:${X.key}`,displayName:X.displayName,avatar:X.avatar,duplicateSuffix:X.platformId,searchText:[X.displayName,X.platformId,X.aliases.join(" ")].join(" ").toLocaleLowerCase(),entityRef:{type:"contact",contactKey:X.key,displayName:X.displayName}})),...o.sessions.filter(X=>X.type==="group").map(X=>({key:`session:${X.id}`,displayName:X.name,avatar:X.groupAvatar,duplicateSuffix:Z,searchText:[X.name,X.platform].join(" ").toLocaleLowerCase(),entityRef:{type:"session",sessionId:X.id,displayName:X.name,sessionType:"group"}}))],We=z.trim().toLocaleLowerCase(),xe=We?Le.filter(X=>X.searchText.includes(We)):Le,Ve=new Map;return xe.forEach(X=>{Ve.set(X.displayName,(Ve.get(X.displayName)??0)+1)}),xe.map(X=>{const At=(Ve.get(X.displayName)??0)>1?`${X.displayName}·${X.duplicateSuffix}`:X.displayName;return{key:X.key,displayName:X.displayName,insertName:At,avatar:X.avatar,searchText:X.searchText,mentionText:`@${At}`,entityRef:X.entityRef}})}async function Se(E){const z=++$;try{const Z={acceptStale:!0,timeRangePreset:"all",page:1,pageSize:100,query:E.trim()||void 0},Le=await Promise.all([lr().getContacts({...Z,pool:"friend"}),lr().getContacts({...Z,pool:"non_friend"})]);if(z!==$)return;const We=new Map;Le.flatMap(xe=>xe.contacts).forEach(xe=>We.set(xe.key,xe)),M.value=oe([...We.values()],E),we(Le,E)}catch(Z){if(z!==$)return;Ae(),console.error("Failed to load global AI mention candidates:",Z),M.value=oe([],E)}}function Ae(){N&&(clearTimeout(N),N=null)}function we(E,z){Ae(),r.mentionScope==="global"&&E.some(Z=>Z.task?.status==="running")&&(N=setTimeout(()=>{N=null,Se(z)},Ef))}function he(E){ae&&clearTimeout(ae),Ae(),$++,ae=setTimeout(()=>{ae=null,Se(E)},E?200:0)}function De(){I.value=!1,G.value="",ue.value=0}function Me(){/^\s*\/([^\n]*)$/.test(y.value)&&(W.value=y.value),De()}function Ie(E){if(r.disabled||!r.skillsEnabled){De();return}W.value&&W.value!==E&&(W.value=null);const z=E.match(/^\s*\/([^\n]*)$/);if(!z){De();return}const Z=!I.value||G.value!==z[1];if(G.value=z[1],W.value===E){I.value=!1;return}I.value=!0,Z&&(ue.value=0)}function pt(){a.activateSkill(null),Oe(j)}function it(){r.disabled||!r.skillsEnabled||(u.value&&a.activateSkill(null),W.value=null,y.value="/",Oe(j))}function zt(E){r.disabled||(W.value=null,y.value=E,Oe(j))}function Ot(){y.value="",C.value=[],O.value="",W.value=null,De(),r.skillsEnabled&&u.value&&a.activateSkill(null)}function or(E){C.value=E}function on(E){O.value=E,r.mentionScope==="global"&&he(E)}function ht(){if(!K.value)return;const E=y.value.trim(),z=[...C.value],Z=z.flatMap(xe=>{const Ve=v.get(xe);return Ve?[Ve]:[]}),Le=r.skillsEnabled?u.value:null,We=()=>{const xe=C.value.length===z.length&&C.value.every((Ve,X)=>Ve===z[X]);y.value.trim()!==E||!xe||(y.value="",C.value=[],O.value="",W.value=null,Le&&u.value===Le&&a.activateSkill(null))};i("send",{content:E,mentionedMembers:Z.flatMap(xe=>xe.mentionedMember?[{...xe.mentionedMember,aliases:[...xe.mentionedMember.aliases]}]:[]),entityRefs:Z.flatMap(xe=>xe.entityRef?[{...xe.entityRef}]:[]),onAccepted:We})}function ln(E){r.disabled||(a.activateSkill(E.id),i("skillActivated",E),y.value="",W.value=null,De(),Oe(j))}function St(){Me(),i("manageSkills")}function Mt(E){if(!V.value.length)return;const z=V.value.length;ue.value=(ue.value+E+z)%z}function ft(E){if(r.skillsEnabled&&E.key==="Backspace"&&y.value.length===0&&u.value){E.preventDefault(),pt();return}if(I.value){if(E.key==="ArrowDown"){E.preventDefault(),Mt(1);return}if(E.key==="ArrowUp"){E.preventDefault(),Mt(-1);return}if(E.key==="Escape"){E.preventDefault(),Me();return}if(E.key==="Enter"&&!E.shiftKey&&!te.value||E.key==="Tab"){E.preventDefault();const z=V.value[ue.value];z&&ln(z);return}}E.key==="Enter"&&!E.shiftKey&&!te.value&&!E.isComposing&&(E.preventDefault(),ht())}function cn(E){if(!I.value||!p.value)return;const z=E.target;z instanceof Node&&!p.value.contains(z)&&Me()}return Te(y,Ie),Te(ne,E=>{E.forEach(z=>v.set(z.key,z))},{immediate:!0}),Te(V,E=>{E.length===0?ue.value=0:ue.value>=E.length&&(ue.value=E.length-1)},{immediate:!0}),Te(()=>[r.chatType,r.skillsEnabled],([E,z])=>{z&&a.setFilterContext(E)},{immediate:!0}),Te(()=>r.disabled,E=>{E&&Me()}),Te(()=>[r.sessionId,r.mentionScope],()=>{C.value=[],O.value="",re(),Ae(),$++,r.mentionScope==="global"?(M.value=oe([],""),Se("")):M.value=[]},{immediate:!0}),wt(async()=>{r.skillsEnabled&&!d.value&&await a.loadSkills(),document.addEventListener("mousedown",cn)}),_t(()=>{ae&&clearTimeout(ae),Ae(),$+=1,document.removeEventListener("mousedown",cn)}),t({clearDraft:Ot,fillInput:zt,openSkillSelector:it}),(E,z)=>(m(),x("div",{class:Y(["shrink-0",[r.embedded?"":"pt-2 pb-2"]])},[h("div",{ref_key:"rootRef",ref:p,class:Y(["w-full max-w-4xl mx-auto",{relative:!r.embedded}])},[r.skillsEnabled?(m(),se($f,{key:0,visible:I.value,skills:V.value,"highlight-index":ue.value,"active-skill-id":k(u),onSelect:ln,onClose:Me,onManage:St,onHighlight:z[0]||(z[0]=Z=>ue.value=Z)},null,8,["visible","skills","highlight-index","active-skill-id"])):U("",!0),F(ef,{ref_key:"composerRef",ref:f,modelValue:y.value,"onUpdate:modelValue":z[1]||(z[1]=Z=>y.value=Z),disabled:r.disabled,status:r.status,placeholder:ie.value,"send-button-title":q.value,"active-skill-name":r.skillsEnabled?k(c)?.name:void 0,"mention-items":H.value,"mention-search-term":O.value,"async-mention-search":r.mentionScope==="global","show-mention-tabs":r.mentionScope==="global","mention-tab":L.value,"contact-tab-label":k(s)("ai.global.entityPicker.contacts"),"group-tab-label":k(s)("ai.global.entityPicker.groups"),embedded:r.embedded,"onUpdate:mentionSearchTerm":on,"onUpdate:mentionTab":z[2]||(z[2]=Z=>L.value=Z),onMentionsChange:or,onSubmit:ht,onStop:z[3]||(z[3]=Z=>i("stop")),onKeydown:ft,onCompositionStart:z[4]||(z[4]=Z=>te.value=!0),onCompositionEnd:z[5]||(z[5]=Z=>te.value=!1)},null,8,["modelValue","disabled","status","placeholder","send-button-title","active-skill-name","mention-items","mention-search-term","async-mention-search","show-mention-tabs","mention-tab","contact-tab-label","group-tab-label","embedded"])],2)],2))}}),If=["data-running"],Rf={class:"min-w-0 truncate"},Pf={class:"text-gray-600 dark:text-gray-300"},Hf={key:0,class:"text-gray-400 dark:text-gray-500"},yg=be({__name:"AIThinkingIndicator",props:{currentToolStatus:{},agentStatus:{}},setup(e){const{t,te:n}=qe();function s(p,f){const y=`ai.assistant.builtinToolDesc.${p}`;return n(y)?t(y):f||p}function r(p){if(!p)return"";const f=`ai.chat.thinking.toolProgress.${p.phase}`;return n(f)?t(f):""}const i=e,a=S(()=>i.agentStatus?.phase==="compressing"),o=S(()=>!a.value&&!i.currentToolStatus),l=S(()=>a.value?t("ai.chat.thinking.compressing"):i.currentToolStatus?s(i.currentToolStatus.name,i.currentToolStatus.displayName):t("ai.chat.thinking.analyzing")),c=S(()=>a.value||!i.currentToolStatus?"":i.currentToolStatus.status==="running"?r(i.currentToolStatus.progress):i.currentToolStatus.status==="done"?t("ai.chat.thinking.processingResult"):""),u=S(()=>a.value||i.currentToolStatus?.status==="running"?"i-heroicons-arrow-path":i.currentToolStatus?.status==="error"?"i-heroicons-exclamation-circle":i.currentToolStatus?"i-heroicons-wrench-screwdriver":"i-heroicons-sparkles"),d=S(()=>a.value||i.currentToolStatus?.status==="running");return(p,f)=>{const y=Ne;return m(),x("div",{class:"ai-live-row flex h-6 min-w-0 items-center gap-1.5 text-sm leading-6 text-gray-500 dark:text-gray-400","data-running":o.value||void 0},[F(y,{name:u.value,class:Y(["h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-gray-500",[d.value?"animate-spin text-primary-500 dark:text-primary-400":""]])},null,8,["name","class"]),h("span",Rf,[h("span",Pf,w(l.value),1),c.value?(m(),x("span",Hf,"· "+w(c.value),1)):U("",!0)])],8,If)}}}),Nf={class:"pointer-events-none relative z-20 flex items-center justify-between"},zf={class:"pointer-events-auto flex items-center gap-1"},Of=["disabled"],Bf={class:"max-w-[160px] truncate"},Df=["title"],jf={class:"w-40 py-1"},Ff={class:"px-3 py-1.5 text-xs font-medium text-gray-400 dark:text-gray-500"},qf=["onClick"],Uf={class:"pointer-events-auto flex items-center gap-1"},Kf=["title"],Wf=["aria-label"],Vf={viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":"true"},Gf=["stroke-dasharray"],Yf={class:"space-y-0.5 whitespace-nowrap text-xs"},Qf={key:0},br=5.5,vg=be({__name:"ChatStatusBar",props:{sessionTokenUsage:{},agentStatus:{},estimatedContextTokens:{}},setup(e){const{t}=qe(),n=Xn(),s=e,r=fa(),i=Qi(),{defaultAssistantConfig:a,isLoading:o}=er(i),l=S(()=>s.agentStatus?t(`ai.chat.statusBar.agent.phase.${s.agentStatus.phase}`):""),c=S(()=>s.agentStatus?t(`ai.chat.statusBar.agent.phaseShort.${s.agentStatus.phase}`):""),u=S(()=>{const q=s.agentStatus?.phase;return q==="compressing"||q==="preparing"||q==="thinking"||q==="tool_running"||q==="responding"}),d=S(()=>{const q=s.agentStatus?.phase;return u.value||q==="error"});function p(q){return Number.isFinite(q)?new Intl.NumberFormat().format(Math.max(0,Math.round(q))):"0"}function f(q){const B=Math.max(0,Math.round(q));return B>=1e6?`${(B/1e6).toFixed(1).replace(/\.0$/,"")}M`:B>=1e3?`${(B/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(B)}const y=S(()=>p(s.sessionTokenUsage.totalTokens)),_=S(()=>f(s.sessionTokenUsage.totalTokens)),M=S(()=>s.sessionTokenUsage.cacheReadTokens>0),v=S(()=>f(s.sessionTokenUsage.cacheReadTokens)),C=S(()=>s.agentStatus?.contextTokens?s.agentStatus.contextTokens:s.estimatedContextTokens&&s.estimatedContextTokens>0?s.estimatedContextTokens:0),O=S(()=>{const q=a.value,B=i.defaultAssistant?.modelId||q?.model;return!q||!B?128e3:(i.getModelById(q.provider,B)||i.findModelAcrossProviders(B))?.contextWindow??128e3}),L=S(()=>C.value<=0||O.value<=0?0:Math.min(100,Math.round(C.value/O.value*100))),I=2*Math.PI*br,G=S(()=>`${I*L.value/100} ${I}`),ue=S(()=>s.agentStatus?[`${t("ai.chat.statusBar.agent.label")}: ${l.value}`,`${t("ai.chat.statusBar.agent.contextTokens")}: ${p(s.agentStatus.contextTokens)}`,`${t("ai.chat.statusBar.tokenUsageTitle")}: ${y.value}`].join(`
147
- `):"");function te(){n.openSettings("ai","defaultModel")}const W=J(!1),ae=S(()=>{const q=a.value,B=i.defaultAssistant?.modelId||q?.model;return!q?.provider||!B?[]:uo(q.provider,B)}),N=S(()=>ae.value.length>0),$=S(()=>{const q=i.defaultAssistant;return!q?.configId||!q?.modelId?"default":r.getThinkingLevel(q.configId,q.modelId)??"default"});function K(q){const B=i.defaultAssistant;!B?.configId||!B?.modelId||(r.setThinkingLevel(B.configId,B.modelId,q),W.value=!1)}const ie=S(()=>t(`ai.chat.statusBar.thinking.level.${$.value}`));return(q,B)=>{const ne=Ne,H=ea,V=na;return m(),x("div",Nf,[h("div",zf,[h("button",{class:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300",disabled:k(o),onClick:te},[F(ne,{name:"i-heroicons-cpu-chip",class:"h-3.5 w-3.5"}),h("span",Bf,w(k(i).defaultAssistant?.modelId?k(i).getModelById(k(a)?.provider??"",k(i).defaultAssistant.modelId)?.name||k(i).defaultAssistant.modelId:k(t)("ai.chat.statusBar.model.notConfigured")),1)],8,Of),N.value?(m(),se(H,{key:0,open:W.value,"onUpdate:open":B[0]||(B[0]=j=>W.value=j),ui:{content:"z-[80] p-0"}},{content:de(()=>[h("div",jf,[h("div",Ff,w(k(t)("ai.chat.statusBar.thinking.title")),1),(m(!0),x(me,null,_e(ae.value,j=>(m(),x("button",{key:j,class:Y(["flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-gray-100 dark:hover:bg-gray-800",$.value===j?"text-primary-600 dark:text-primary-400":"text-gray-700 dark:text-gray-300"]),onClick:re=>K(j)},[F(ne,{name:$.value===j?"i-heroicons-check-circle-solid":"i-heroicons-light-bulb",class:Y(["h-4 w-4 shrink-0",$.value===j?"text-primary-500":"text-gray-400"])},null,8,["name","class"]),h("span",null,w(k(t)(`ai.chat.statusBar.thinking.level.${j}`)),1)],10,qf))),128))])]),default:de(()=>[h("button",{class:Y(["flex items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-gray-100 dark:hover:bg-gray-800",$.value==="default"||$.value==="off"?"text-gray-400 dark:text-gray-500":"text-primary-500 dark:text-primary-400"]),title:k(t)("ai.chat.statusBar.thinking.tooltip")},[F(ne,{name:"i-heroicons-light-bulb",class:"h-3.5 w-3.5"}),h("span",null,w(ie.value),1)],10,Df)]),_:1},8,["open"])):U("",!0)]),h("div",Uf,[d.value?(m(),x("div",{key:0,class:"hidden shrink-0 items-center gap-1.5 px-1.5 py-1 text-[11px] text-gray-400 lg:flex dark:text-gray-500",title:ue.value},[h("span",{class:Y(["h-1.5 w-1.5 rounded-full",[e.agentStatus?.phase==="error"?"bg-amber-500":"bg-primary-500 animate-pulse"]])},null,2),h("span",null,w(c.value),1)],8,Kf)):U("",!0),C.value>0?(m(),se(V,{key:1,ui:{content:"h-auto py-1.5"}},{content:de(()=>[h("div",Yf,[h("div",null,w(k(t)("ai.chat.statusBar.agent.contextTokens"))+": "+w(f(C.value))+" / "+w(f(O.value)),1),h("div",null,w(k(t)("ai.chat.statusBar.tokenUsageTitle"))+": "+w(_.value),1),M.value?(m(),x("div",Qf,w(k(t)("ai.chat.statusBar.cacheHit"))+": "+w(v.value),1)):U("",!0)])]),default:de(()=>[h("div",{class:"hidden h-7 w-7 shrink-0 place-items-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 md:grid dark:text-gray-500 dark:hover:bg-gray-800","aria-label":`${k(t)("ai.chat.statusBar.agent.contextTokens")} ${L.value}%`},[(m(),x("svg",Vf,[h("circle",{cx:"7",cy:"7",r:br,fill:"none",class:"stroke-gray-300 dark:stroke-gray-700","stroke-width":"2"}),h("circle",{cx:"7",cy:"7",r:br,fill:"none",class:"stroke-gray-400 transition-[stroke-dasharray] duration-300 dark:stroke-gray-500","stroke-width":"2","stroke-linecap":"round","stroke-dasharray":G.value,transform:"rotate(-90 7 7)"},null,8,Gf)]))],8,Wf)]),_:1})):U("",!0)])])}}}),Jf={class:"flex shrink-0 items-center gap-1"},Zf=["title","disabled"],Xf=["title","disabled"],kg=be({__name:"ChatHeaderActions",props:{currentAIChatId:{},currentMessages:{},fallbackTitle:{}},setup(e){const t=e,{t:n}=qe(),s=Br(),r=fa(),{aiGlobalSettings:i}=er(r),a=J(!1),o=J(!1),l=S(()=>Tr(t.currentMessages??[])),c=S(()=>!!t.currentAIChatId||Mo(t.currentMessages??[]));function u(){return{createdAt:n("ai.chat.conversation.export.createdAt"),user:n("ai.chat.conversation.export.user"),assistant:n("ai.chat.conversation.export.assistant")}}function d(y){return y.map(_=>({..._,timestamp:_.timestamp*1e3}))}async function p(){if(!(a.value||!c.value)){a.value=!0;try{const y=i.value.exportFormat||"markdown",_=u();let M=t.fallbackTitle||n("ai.chat.conversation.newChat"),v=l.value[0]?.timestamp??Date.now(),C=l.value;if(t.currentAIChatId){const[L,I]=await Promise.all([It().getAIChat(t.currentAIChatId),It().getMessages(t.currentAIChatId)]);L&&(M=L.title||M,v=L.createdAt*1e3);const G=Tr(d(I));G.length>0&&(C=G)}if(C.length===0){s.warn(n("ai.chat.conversation.export.noMessages"));return}const O=await Eo(M,C,v,y,_);if(O.success&&O.filePath){const L=O.filePath.split("/").pop()||O.filePath,I=O.filePath;s.add({title:n("common.exportSuccess"),description:L,color:"primary",actions:[{label:n("common.openFolder"),onClick:()=>{io().showInFolder(I)}}]})}else s.fail(n("common.exportFailed"),{description:O.error})}catch(y){console.error("Failed to export AI conversation:",y),s.fail(n("common.exportFailed"),{description:String(y)})}finally{a.value=!1}}}async function f(){if(!o.value){o.value=!0;try{const y=await It().showAiLogFile();y?.success||s.fail(n("ai.chat.statusBar.log.openFailed"),{description:y?.error||n("ai.chat.statusBar.log.openFailedDesc")})}catch(y){console.error("Failed to open AI log file:",y),s.fail(n("ai.chat.statusBar.log.openFailed"),{description:String(y)})}finally{o.value=!1}}}return(y,_)=>{const M=Ne;return m(),x("div",Jf,[h("button",{type:"button",class:"flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-60 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",title:k(n)("ai.chat.statusBar.export.title"),disabled:a.value||!c.value,onClick:p},[F(M,{name:"i-heroicons-arrow-down-tray",class:"h-3.5 w-3.5"}),h("span",null,w(k(n)("ai.chat.statusBar.export.label")),1)],8,Zf),h("button",{type:"button",class:"flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-60 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",title:k(n)("ai.chat.statusBar.log.title"),disabled:o.value,onClick:f},[F(M,{name:"i-heroicons-document-text",class:"h-3.5 w-3.5"}),h("span",null,w(k(n)("ai.chat.statusBar.log.label")),1)],8,Xf)])}}}),eg={slots:{root:"relative inline-flex items-center",base:["w-full rounded-md border-0 appearance-none placeholder:text-dimmed disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leading:"absolute start-0 flex items-start",leadingIcon:"shrink-0 text-dimmed",leadingAvatar:"shrink-0",leadingAvatarSize:"",trailing:"absolute end-0 flex items-start",trailingIcon:"shrink-0 text-dimmed"},variants:{fieldGroup:{horizontal:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"},vertical:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"}},size:{xs:{base:"px-2 py-1 text-sm/4 gap-1",leading:"ps-2 inset-y-1",trailing:"pe-2 inset-y-1",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},sm:{base:"px-2.5 py-1.5 text-sm/4 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},md:{base:"px-2.5 py-1.5 text-base/5 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},lg:{base:"px-3 py-2 text-base/5 gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},xl:{base:"px-3 py-2 text-base gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-6",leadingAvatarSize:"xs",trailingIcon:"size-6"}},variant:{outline:"text-highlighted bg-default ring ring-inset ring-accented",soft:"text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",subtle:"text-highlighted bg-elevated ring ring-inset ring-accented",ghost:"text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",none:"text-highlighted bg-transparent focus:outline-none"},color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},leading:{true:""},trailing:{true:""},loading:{true:""},highlight:{true:""},fixed:{false:""},type:{file:"file:me-1.5 file:font-medium file:text-muted file:outline-none"},autoresize:{true:{base:"resize-none"}}},compoundVariants:[{color:"primary",variant:["outline","subtle"],class:"outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary"},{color:"secondary",variant:["outline","subtle"],class:"outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary"},{color:"success",variant:["outline","subtle"],class:"outline-success/25 focus-visible:outline-3 focus-visible:ring-success"},{color:"info",variant:["outline","subtle"],class:"outline-info/25 focus-visible:outline-3 focus-visible:ring-info"},{color:"warning",variant:["outline","subtle"],class:"outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning"},{color:"error",variant:["outline","subtle"],class:"outline-error/25 focus-visible:outline-3 focus-visible:ring-error"},{color:"primary",variant:["soft","ghost"],class:"outline-primary/25 focus-visible:outline-3"},{color:"secondary",variant:["soft","ghost"],class:"outline-secondary/25 focus-visible:outline-3"},{color:"success",variant:["soft","ghost"],class:"outline-success/25 focus-visible:outline-3"},{color:"info",variant:["soft","ghost"],class:"outline-info/25 focus-visible:outline-3"},{color:"warning",variant:["soft","ghost"],class:"outline-warning/25 focus-visible:outline-3"},{color:"error",variant:["soft","ghost"],class:"outline-error/25 focus-visible:outline-3"},{color:"primary",highlight:!0,class:"ring ring-inset ring-primary"},{color:"secondary",highlight:!0,class:"ring ring-inset ring-secondary"},{color:"success",highlight:!0,class:"ring ring-inset ring-success"},{color:"info",highlight:!0,class:"ring ring-inset ring-info"},{color:"warning",highlight:!0,class:"ring ring-inset ring-warning"},{color:"error",highlight:!0,class:"ring ring-inset ring-error"},{color:"neutral",variant:["outline","subtle"],class:"outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted"},{color:"neutral",variant:["soft","ghost"],class:"outline-inverted/25 focus-visible:outline-3"},{color:"neutral",highlight:!0,class:"ring ring-inset ring-inverted"},{leading:!0,size:"xs",class:"ps-7"},{leading:!0,size:"sm",class:"ps-8"},{leading:!0,size:"md",class:"ps-9"},{leading:!0,size:"lg",class:"ps-10"},{leading:!0,size:"xl",class:"ps-11"},{trailing:!0,size:"xs",class:"pe-7"},{trailing:!0,size:"sm",class:"pe-8"},{trailing:!0,size:"md",class:"pe-9"},{trailing:!0,size:"lg",class:"pe-10"},{trailing:!0,size:"xl",class:"pe-11"},{loading:!0,leading:!0,class:{leadingIcon:"animate-spin"}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:"animate-spin"}},{fixed:!1,size:"xs",class:"md:text-xs"},{fixed:!1,size:"sm",class:"md:text-xs"},{fixed:!1,size:"md",class:"md:text-sm"},{fixed:!1,size:"lg",class:"md:text-sm"}],defaultVariants:{size:"md",color:"primary",variant:"outline"}},tg=["id","value","name","rows","placeholder","disabled","required"],xg=Object.assign({inheritAttrs:!1},{__name:"Textarea",props:{as:{type:null,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},required:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},autoresize:{type:Boolean,required:!1},autoresizeDelay:{type:Number,required:!1,default:0},disabled:{type:Boolean,required:!1},rows:{type:Number,required:!1,default:3},maxrows:{type:Number,required:!1,default:0},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:["update:modelValue","blur","change"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=Ji(),a=la("textarea",s),o=Zi(a,"modelValue",r,{defaultValue:a.defaultValue}),l=ua(),{emitFormFocus:c,emitFormBlur:u,emitFormInput:d,emitFormChange:p,size:f,color:y,id:_,name:M,highlight:v,disabled:C,ariaAttrs:O}=Xi(s,{deferInputValidation:!0}),{isLeading:L,isTrailing:I,leadingIconName:G,trailingIconName:ue}=no(a),te=S(()=>xn({extend:xn(eg),...l.ui?.textarea||{}})({color:y.value??a.color,variant:a.variant,size:f?.value??a.size,loading:a.loading,highlight:v.value??a.highlight,fixed:a.fixed,autoresize:a.autoresize,leading:L.value||!!a.avatar||!!i.leading,trailing:I.value||!!i.trailing})),W=eo("textareaRef");function ae(B){a.modelModifiers?.trim&&(typeof B=="string"||B===null||B===void 0)&&(B=B?.trim()??null),a.modelModifiers?.number&&(B=ro(B)),a.modelModifiers?.nullable&&(B||=null),a.modelModifiers?.optional&&!a.modelModifiers?.nullable&&B!==null&&(B||=void 0),o.value=B,d()}function N(B){q(),a.modelModifiers?.lazy||ae(B.target.value)}function $(B){const ne=B.target.value;a.modelModifiers?.lazy&&ae(ne),a.modelModifiers?.trim&&(B.target.value=ne.trim()),p(),r("change",B)}function K(B){u(),r("blur",B)}function ie(){a.autofocus&&W.value?.focus()}function q(){if(a.autoresize&&W.value){W.value.rows=a.rows;const B=W.value.style.overflow;W.value.style.overflow="hidden";const ne=window.getComputedStyle(W.value),H=Number.parseInt(ne.paddingTop),V=Number.parseInt(ne.paddingBottom),j=H+V,re=Number.parseInt(ne.lineHeight),{scrollHeight:oe}=W.value,Se=(oe-j)/re;Se>a.rows&&(W.value.rows=a.maxrows?Math.min(Se,a.maxrows):Se),W.value.style.overflow=B}}return Te(o,()=>{Oe(q)}),wt(()=>{setTimeout(()=>{ie()},a.autofocusDelay),setTimeout(async()=>{await Oe(),q()},a.autoresizeDelay)}),t({textareaRef:W,autoResize:q}),(B,ne)=>(m(),se(k(ca),{as:k(a).as,"data-slot":"root",class:Y(te.value.root({class:[k(a).ui?.root,k(a).class]}))},{default:de(()=>[h("textarea",ps({id:k(_),ref_key:"textareaRef",ref:W,value:k(o),name:k(M),rows:k(a).rows,placeholder:k(a).placeholder,"data-slot":"base",class:te.value.base({class:k(a).ui?.base}),disabled:k(C),required:k(a).required},{...B.$attrs,...k(O)},{onInput:N,onBlur:K,onChange:$,onFocus:ne[0]||(ne[0]=(...H)=>k(c)&&k(c)(...H))}),null,16,tg),Rt(B.$slots,"default",{ui:te.value}),k(L)||k(a).avatar||i.leading?(m(),x("span",{key:0,"data-slot":"leading",class:Y(te.value.leading({class:k(a).ui?.leading}))},[Rt(B.$slots,"leading",{ui:te.value},()=>[k(L)&&k(G)?(m(),se(Ne,{key:0,name:k(G),"data-slot":"leadingIcon",class:Y(te.value.leadingIcon({class:k(a).ui?.leadingIcon}))},null,8,["name","class"])):k(a).avatar?(m(),se(to,ps({key:1,size:k(a).ui?.leadingAvatarSize||te.value.leadingAvatarSize()},k(a).avatar,{"data-slot":"leadingAvatar",class:te.value.leadingAvatar({class:k(a).ui?.leadingAvatar})}),null,16,["size","class"])):U("",!0)])],2)):U("",!0),k(I)||i.trailing?(m(),x("span",{key:1,"data-slot":"trailing",class:Y(te.value.trailing({class:k(a).ui?.trailing}))},[Rt(B.$slots,"trailing",{ui:te.value},()=>[k(ue)?(m(),se(Ne,{key:0,name:k(ue),"data-slot":"trailingIcon",class:Y(te.value.trailingIcon({class:k(a).ui?.trailingIcon}))},null,8,["name","class"])):U("",!0)])],2)):U("",!0)]),_:3},8,["as","class"]))}}),ng=30,rg=100;function sg(e,t=rg){let n=null,s=!1;function r(a=!1){s||=a,n===null&&(n=setTimeout(()=>{n=null;const o=s;s=!1,e(o)},t))}function i(){n!==null&&(clearTimeout(n),n=null),s=!1}return{schedule:r,cancel:i}}function bg(e,t){const n=J(null),s=J(!0),r=J(!1),i=sg(u=>{n.value&&(u||s.value)&&(n.value.scrollTop=n.value.scrollHeight,s.value=!0,r.value=!1)});function a(u=!1){i.schedule(u)}function o(u){u.deltaY<0&&t.value&&(s.value=!1,r.value=!0)}function l(){if(!n.value)return;const{scrollTop:u,scrollHeight:d,clientHeight:p}=n.value;d-u-p<ng&&(s.value=!0,r.value=!1)}function c(){a(!0)}return Te(()=>{const u=e.value[e.value.length-1];return[e.value.length,u?.content,u?.contentBlocks?.length]},()=>a()),wt(()=>{n.value&&(n.value.addEventListener("scroll",l),n.value.addEventListener("wheel",o,{passive:!0})),e.value.length>0&&a(!0)}),_t(()=>{i.cancel(),n.value&&(n.value.removeEventListener("scroll",l),n.value.removeEventListener("wheel",o))}),{messagesContainer:n,showScrollToBottom:r,scrollToBottom:a,handleScrollToBottom:c}}const mn=20;function wg(e,t,n){const s=J(mn),r=S(()=>e.value.slice(-s.value)),i=S(()=>s.value<e.value.length);Te([t,()=>e.value.length],([o,l],[c,u])=>{if(o!==c){s.value=mn;return}l<u?s.value=Math.max(mn,Math.min(s.value,l)):u>0&&s.value>=u&&(s.value=l)});async function a(){if(!i.value)return;const o=n.value,l=o?.scrollHeight??0,c=o?.scrollTop??0;s.value=Math.min(e.value.length,s.value+mn),await Oe(),o&&n.value===o&&(o.scrollTop=c+(o.scrollHeight-l))}return{visiblePairs:r,hasOlderPairs:i,loadOlderPairs:a}}function _g(e){const t=[];let n=null;for(const s of e)s.role==="user"?(n&&t.push({user:n,assistant:null,standalone:null,id:n.id}),n=s):s.role==="assistant"?(t.push({user:n,assistant:s,standalone:null,id:n?.id||s.id}),n=null):(n&&(t.push({user:n,assistant:null,standalone:null,id:n.id}),n=null),t.push({user:null,assistant:null,standalone:s,id:s.id}));return n&&t.push({user:n,assistant:null,standalone:null,id:n.id}),t}export{xg as _,wg as a,kg as b,fg as c,gg as d,yg as e,mg as f,vg as g,_g as h,bs as i,oo as j,po as k,ws as l,bg as u};
143
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const s=i=>{const a=ds(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:s},n);return a?[{type:"taskList",raw:a.raw,items:a.items}]:n.blockTokens(i)},r=ds(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,a)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:a}),customNestedParser:s},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ke.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(qa.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(Ua.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(Qa.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Za.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Hh.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Nh.configure(this.options.taskList)),e}});var Ys="&nbsp;",zh=" ",Oh=Ee.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",fe(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(n.length===1&&n[0].type==="image")return t.parseChildren([n[0]]);const s=t.parseInline(n);return s.length===1&&s[0].type==="text"&&(s[0].text===Ys||s[0].text===zh)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,s)},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return n.length===0?Ys:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Bh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Dh=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jh=Nt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",fe(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Pt({find:Bh,type:this.type})]},addPasteRules(){return[xt({find:Dh,type:this.type})]}}),Fh=Ee.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),qh=Nt.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",fe(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Uh=Ke.create({name:"starterKit",addExtensions(){var e,t,n,s;const r=[];return this.options.bold!==!1&&r.push(Fp.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(zp.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(qa.configure(this.options.bulletList)),this.options.code!==!1&&r.push(ga.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Kp.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Wp.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(Od.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(Bd.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(Vp.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(Gp.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(qd.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(ma.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(Xp.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Ua.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Qa.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&r.push(Th.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&r.push(Za.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(Oh.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(jh.configure(this.options.strike)),this.options.text!==!1&&r.push(Fh.configure(this.options.text)),this.options.underline!==!1&&r.push(qh.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(Fd.configure((s=this.options)==null?void 0:s.trailingNode)),r}}),Kh=Uh;const Wh={slots:{root:"",content:"relative size-full flex-1",base:["w-full outline-none *:my-5 *:first:mt-0 *:last:mb-0 sm:px-8 selection:bg-primary/20","[&_p]:leading-7","[&_a]:text-primary [&_a]:border-b [&_a]:border-transparent [&_a]:hover:border-primary [&_a]:font-medium","[&_a]:transition-colors","[&_a>code]:border-dashed [&_a:hover>code]:border-primary [&_a:hover>code]:text-primary","[&_a>code]:transition-colors","[&_.mention]:text-primary [&_.mention]:font-medium","[&_:is(h1,h2,h3,h4,h5,h6)]:text-highlighted [&_:is(h1,h2,h3,h4,h5,h6)]:font-bold","[&_h1]:text-3xl","[&_h2]:text-2xl","[&_h3]:text-xl","[&_h4]:text-lg","[&_h5]:text-base","[&_h6]:text-base","[&_:is(h1,h2,h3,h4,h5,h6)>code]:border-dashed [&_:is(h1,h2,h3,h4,h5,h6)>code]:font-bold","[&_h2>code]:text-xl/6","[&_h3>code]:text-lg/5","[&_blockquote]:border-s-4 [&_blockquote]:border-accented [&_blockquote]:ps-4 [&_blockquote]:italic","[&_[data-type=horizontalRule]]:my-8 [&_[data-type=horizontalRule]]:py-2","[&_hr]:border-t [&_hr]:border-default","[&_pre]:text-sm/6 [&_pre]:border [&_pre]:border-muted [&_pre]:bg-muted [&_pre]:rounded-md [&_pre]:px-4 [&_pre]:py-3 [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:overflow-x-auto","[&_pre_code]:p-0 [&_pre_code]:text-inherit [&_pre_code]:font-inherit [&_pre_code]:rounded-none [&_pre_code]:inline [&_pre_code]:border-0 [&_pre_code]:bg-transparent","[&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-sm [&_code]:font-mono [&_code]:font-medium [&_code]:rounded-md [&_code]:inline-block [&_code]:border [&_code]:border-muted [&_code]:text-highlighted [&_code]:bg-muted","[&_:is(ul,ol)]:ps-6","[&_ul]:list-disc [&_ul]:marker:text-(--ui-border-accented)","[&_ol]:list-decimal [&_ol]:marker:text-muted","[&_li]:my-1.5 [&_li]:ps-1.5","[&_img]:rounded-md [&_img]:block [&_img]:max-w-full [&_img.ProseMirror-selectednode]:outline-2 [&_img.ProseMirror-selectednode]:outline-primary","[&_.ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper])]:bg-primary/20"]},variants:{placeholderMode:{firstLine:{base:"[&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:text-dimmed [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:pointer-events-none"},everyLine:{base:"[&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:text-dimmed [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:pointer-events-none"}}},defaultVariants:{placeholderMode:"everyLine"}},Vh=Object.assign({inheritAttrs:!1},{__name:"Editor",props:{as:{type:null,required:!1},modelValue:{type:null,required:!1},contentType:{type:String,required:!1},starterKit:{type:Object,required:!1},placeholder:{type:[String,Object],required:!1},markdown:{type:Object,required:!1},image:{type:[Boolean,Object],required:!1,default:!0},mention:{type:[Boolean,Object],required:!1,default:!0},handlers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},extensions:{type:Array,required:!1},injectCSS:{type:Boolean,required:!1},injectNonce:{type:null,required:!1},autofocus:{type:[String,Number,Boolean,null],required:!1},editable:{type:Boolean,required:!1},textDirection:{type:String,required:!1},editorProps:{type:Object,required:!1},parseOptions:{type:Object,required:!1},coreExtensionOptions:{type:Object,required:!1},enableInputRules:{type:[Array,Boolean],required:!1},enablePasteRules:{type:[Array,Boolean],required:!1},enableCoreExtensions:{type:[Boolean,Object],required:!1},enableContentCheck:{type:Boolean,required:!1},emitContentError:{type:Boolean,required:!1},onBeforeCreate:{type:Function,required:!1},onCreate:{type:Function,required:!1},onMount:{type:Function,required:!1},onUnmount:{type:Function,required:!1},onContentError:{type:Function,required:!1},onUpdate:{type:Function,required:!1},onSelectionUpdate:{type:Function,required:!1},onTransaction:{type:Function,required:!1},onFocus:{type:Function,required:!1},onBlur:{type:Function,required:!1},onDestroy:{type:Function,required:!1},onPaste:{type:Function,required:!1},onDrop:{type:Function,required:!1},onDelete:{type:Function,required:!1},enableExtensionDispatchTransaction:{type:Boolean,required:!1}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=la("editor",s),a=Fi(),o=ua(),l=S(()=>xn({extend:xn(Wh),...o.ui?.editor||{}})({placeholderMode:typeof i.placeholder=="object"?i.placeholder.mode:void 0})),c=qi(Ui(i,"starterKit","extensions","editorProps","contentType","class","placeholder","markdown","image","mention","handlers")),u=S(()=>Lt(i.editorProps,{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off",...a,class:l.value.base({class:i.ui?.base})}})),d=S(()=>i.contentType||(typeof i.modelValue=="string"?"html":"json")),p=S(()=>Lt(i.starterKit,{code:!1,horizontalRule:!1,dropcursor:{color:"var(--ui-primary)",width:2},link:{openOnClick:!1}})),f=S(()=>{const L=typeof i.placeholder=="string"?{placeholder:i.placeholder}:i.placeholder,{mode:E,...G}=L||{};return Lt(G,{showOnlyWhenEditable:!1,showOnlyCurrent:!0})}),y=S(()=>Lt(i.markdown,{markedOptions:{gfm:!0}})),_=S(()=>typeof i.image=="boolean"?{}:i.image),M=S(()=>Lt(typeof i.mention=="boolean"?{}:i.mention,{HTMLAttributes:{class:"mention"},renderText({node:L}){return`${L.attrs.mentionSuggestionChar??"@"}${L.attrs.label??L.attrs.id}`},renderHTML({options:L,node:E}){return["span",fe({"data-type":"mention"},L.HTMLAttributes),`${E.attrs.mentionSuggestionChar??"@"}${E.attrs.label??E.attrs.id}`]}})),v=S(()=>[d.value==="markdown"&&Hp.configure(y.value),Kh.configure(p.value),pd.extend({excludes:"code"}),hd.extend({renderHTML(){return["div",fe(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),i.image!==!1&&md.configure(_.value),i.mention!==!1&&kd.configure(M.value),i.placeholder&&Ud.configure(f.value),...i.extensions||[]].filter(L=>!!L)),C=go({...c.value,content:i.modelValue,contentType:d.value,extensions:v.value,editorProps:u.value,onCreate:({editor:L})=>{i.placeholder&&L.view.dispatch(L.state.tr)},onUpdate:({editor:L})=>{let E;try{d.value==="html"?E=L.getHTML():d.value==="json"?E=L.getJSON():d.value==="markdown"&&(E=L.getMarkdown())}catch{E=L.getText()}r("update:modelValue",E)}});Te(()=>i.modelValue,L=>{if(!C.value||L==null)return;const E=d.value==="html"?C.value.getHTML():d.value==="json"?JSON.stringify(C.value.getJSON()):d.value==="markdown"?C.value.getMarkdown():C.value.getText(),G=d.value==="json"&&typeof L=="object"?JSON.stringify(L):String(L);if(E!==G){const te=C.value.state.selection.from;C.value.commands.setContent(L,{contentType:d.value});const V=C.value.state.doc;te<=V.content.size&&C.value.commands.setTextSelection(te)}});const z=S(()=>({..._o(),...i.handlers}));return Ki("editorHandlers",z),t({editor:C}),(L,E)=>(m(),ae(k(ca),{as:k(i).as,"data-slot":"root",class:Y(l.value.root({class:[k(i).ui?.root,k(i).class]}))},{default:de(()=>[k(C)?(m(),x(me,{key:0},[Rt(L.$slots,"default",{editor:k(C),handlers:z.value}),F(k(fo),{role:"presentation",editor:k(C),"data-slot":"content",class:Y(l.value.content({class:k(i).ui?.content}))},null,8,["editor","class"])],64)):q("",!0)]),_:3},8,["as","class"]))}}),Gh=be({__name:"AIChatMentionMenu",props:{editor:{},items:{default:()=>[]},searchTerm:{default:""},filterFields:{default:()=>["label"]},ignoreFilter:{type:Boolean,default:!1},limit:{default:42},appendTo:{},showTabs:{type:Boolean,default:!1},activeTab:{default:"contact"},contactTabLabel:{default:""},groupTabLabel:{default:""}},emits:["update:searchTerm","update:activeTab"],setup(e,{emit:t}){const n=e,s=t,r=S({get:()=>n.searchTerm,set:u=>s("update:searchTerm",u)}),i={id:"__mention-tabs__",label:"",type:"label"},a=S(()=>n.showTabs?[i,...n.items]:n.items),o=S(()=>({content:()=>"flex flex-col",viewport:()=>"relative flex-1 overflow-y-auto",group:()=>"isolate",label:()=>"ai-chat-mention-tabs sticky top-0 z-10",separator:()=>"h-px bg-border",item:()=>"group relative flex w-full items-center select-none outline-none before:absolute before:z-[-1] data-disabled:cursor-not-allowed data-disabled:opacity-75"}));let l=null;function c(){return ze("div",{class:"ai-chat-mention-tabs__inner"},[ze("button",{type:"button",class:["ai-chat-mention-tabs__button",n.activeTab==="contact"&&"is-active"],"aria-pressed":n.activeTab==="contact",onMousedown:u=>u.preventDefault(),onClick:()=>s("update:activeTab","contact")},n.contactTabLabel),ze("button",{type:"button",class:["ai-chat-mention-tabs__button",n.activeTab==="group"&&"is-active"],"aria-pressed":n.activeTab==="group",onMousedown:u=>u.preventDefault(),onClick:()=>s("update:activeTab","group")},n.groupTabLabel)])}return wt(async()=>{await Oe(),!(!n.editor||n.editor.isDestroyed)&&(l=Co({editor:n.editor,char:"@",pluginKey:"mentionMenu",items:Vi(()=>a.value),filterFields:n.filterFields,ignoreFilter:n.ignoreFilter,limit:n.limit,options:{placement:"top-start"},appendTo:n.appendTo,searchTerm:r,ui:o,onSelect:(u,d,p)=>{u.chain().focus().deleteRange(d).insertContent({type:"mention",attrs:{id:p.id,label:p.label,mentionSuggestionChar:"@"}}).run()},renderItem:u=>"type"in u&&u.type==="label"?c():[ze(Wi,{src:u.avatar,alt:u.label,text:u.label.slice(0,1),rootClass:"h-5 w-5 shrink-0",imageClass:"h-5 w-5 rounded-md object-cover",fallbackClass:"flex h-5 w-5 items-center justify-center rounded-md bg-gray-100 text-[9px] text-gray-500 dark:bg-gray-800 dark:text-gray-400",rootMargin:"0px"}),ze("span",{class:"min-w-0 flex-1 truncate text-sm leading-[18px]"},u.label)]}),n.editor.registerPlugin(l.plugin))}),_t(()=>{l?.destroy(),l=null,n.editor&&!n.editor.isDestroyed&&n.editor.unregisterPlugin("mentionMenu")}),(u,d)=>(m(),x("div"))}});function Yh(e){return e.isComposing||e.hasKeyboardSelection?"pass":e.key==="ArrowDown"?"activate-and-block":e.key==="ArrowUp"?"activate":e.key==="Enter"||e.key==="Tab"?"block":"pass"}const Qh={key:0,class:"inline-flex max-w-[180px] shrink-0 items-center rounded-md bg-primary-50 px-2 text-sm leading-6 font-medium text-primary-700 dark:bg-primary-500/10 dark:text-primary-400"},Jh={class:"truncate"},Zh=["disabled","title"],Xh=be({__name:"AIChatComposer",props:{modelValue:{},disabled:{type:Boolean,default:!1},status:{default:"ready"},placeholder:{},sendButtonTitle:{},activeSkillName:{default:null},mentionItems:{default:()=>[]},mentionSearchTerm:{default:""},asyncMentionSearch:{type:Boolean,default:!1},showMentionTabs:{type:Boolean,default:!1},mentionTab:{default:"contact"},contactTabLabel:{default:""},groupTabLabel:{default:""},embedded:{type:Boolean,default:!1}},emits:["update:modelValue","update:mentionSearchTerm","update:mentionTab","mentionsChange","submit","stop","keydown","compositionStart","compositionEnd"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=J(null),a=J(y(s.modelValue));let o=0,l=null,c=!1;const u=S(()=>s.modelValue.trim().length>0&&!s.disabled),d={handleKeyDown:(I,U)=>(r("keydown",U),U.defaultPrevented),handleDOMEvents:{compositionstart:()=>(r("compositionStart"),!1),compositionend:()=>(r("compositionEnd"),!1)}},p={blockquote:!1,bold:!1,bulletList:!1,code:!1,codeBlock:!1,heading:!1,italic:!1,link:!1,listItem:!1,orderedList:!1,strike:!1,underline:!1},f={HTMLAttributes:{class:"ai-chat-mention"},deleteTriggerWithBackspace:!0};function y(I){return{type:"doc",content:I.split(`
144
+ `).map(O=>({type:"paragraph",content:O?[{type:"text",text:O}]:void 0}))}}function _(I){const U=typeof I.attrs?.id=="string"?I.attrs.id:"";return`@${typeof I.attrs?.label=="string"?I.attrs.label:U}`}function M(I){if(I.type==="text")return I.text??"";if(I.type==="mention")return _(I);if(I.type==="hardBreak")return`
145
+ `;const U=I.content??[],O=I.type==="doc"?`
146
+ `:"";return U.map(M).join(O)}function v(I,U=[]){return I.type==="mention"&&typeof I.attrs?.id=="string"&&U.push(I.attrs.id),I.content?.forEach(O=>v(O,U)),U}function C(I){a.value=I;const U=v(I),O=U.length>o;o=U.length,r("update:modelValue",M(I)),r("mentionsChange",[...new Set(U)]),O&&Oe(()=>i.value?.editor?.commands.insertContent(" "))}function z(I="end"){i.value?.editor?.commands.focus(I)}function L(I){o=0,a.value=y(I)}function E(){L("")}function G(I){I.target instanceof Element&&I.target.closest('[role="option"]')&&I.stopPropagation()}function ue(){c=!0,l?.classList.add("has-keyboard-selection")}function te(I){if(!l?.firstElementChild)return;const U=Yh({key:I.key,isComposing:I.isComposing,hasKeyboardSelection:c});(U==="activate"||U==="activate-and-block")&&ue(),(U==="block"||U==="activate-and-block")&&(I.preventDefault(),I.stopImmediatePropagation())}function V(){return c=!1,l?.classList.remove("has-keyboard-selection"),l||(l=document.createElement("div"),l.className="ai-chat-mention-menu-host",l.addEventListener("mouseenter",G,!0),document.body.appendChild(l)),l}return wt(()=>{document.addEventListener("keydown",te,!0)}),_t(()=>{document.removeEventListener("keydown",te,!0),l?.remove(),l=null}),Te(()=>s.modelValue,I=>{M(a.value)!==I&&L(I)}),Te(()=>s.disabled,I=>{i.value?.editor?.setEditable(!I,!1)}),t({focus:z,setText:L,clear:E}),(I,U)=>{const O=Ne;return m(),x("div",{class:Y(["flex flex-col overflow-hidden transition-all",[e.embedded?"bg-transparent":"rounded-2xl bg-white shadow-[0_2px_14px_rgba(0,0,0,0.04)] ring-1 ring-gray-200/60 dark:bg-page-dark dark:ring-white/5",!e.embedded&&e.disabled?"bg-gray-50/50 dark:bg-page-dark/50":"",!e.embedded&&!e.disabled?"focus-within:ring-primary-500/40 focus-within:shadow-[0_4px_20px_rgba(0,0,0,0.08)] dark:focus-within:ring-primary-500/40":""]])},[h("div",{class:Y(["px-4 pt-2.5 pb-2.5",{relative:!e.embedded}])},[h("div",{class:Y(["flex items-start gap-2",{"pr-10":!e.embedded}])},[e.activeSkillName?(m(),x("div",Qh,[h("span",Jh,"/"+w(e.activeSkillName),1)])):q("",!0),F(Vh,{ref_key:"editorRef",ref:i,"model-value":a.value,"content-type":"json",class:"ai-chat-editor min-w-0 flex-1",editable:!e.disabled,placeholder:e.placeholder,"starter-kit":p,mention:f,image:!1,"editor-props":d,"onUpdate:modelValue":C},{default:de(({editor:Z})=>[F(Gh,{"search-term":s.mentionSearchTerm,editor:Z,items:e.mentionItems,"filter-fields":["label","searchText"],"ignore-filter":e.asyncMentionSearch,limit:100,"append-to":V,"show-tabs":e.showMentionTabs,"active-tab":e.mentionTab,"contact-tab-label":e.contactTabLabel,"group-tab-label":e.groupTabLabel,"onUpdate:searchTerm":U[0]||(U[0]=ie=>r("update:mentionSearchTerm",ie)),"onUpdate:activeTab":U[1]||(U[1]=ie=>r("update:mentionTab",ie))},null,8,["search-term","editor","items","ignore-filter","show-tabs","active-tab","contact-tab-label","group-tab-label"])]),_:1},8,["model-value","editable","placeholder"])],2),e.status==="streaming"?(m(),x("button",{key:0,type:"button",class:"absolute right-3 bottom-2 flex h-7 w-7 items-center justify-center rounded-full bg-primary-500 text-white shadow-sm transition-colors hover:bg-primary-600",onClick:U[2]||(U[2]=Z=>r("stop"))},[F(O,{name:"i-heroicons-stop-16-solid",class:"h-3.5 w-3.5"})])):(m(),x("button",{key:1,type:"button",class:Y(["absolute right-3 bottom-2 flex h-7 w-7 items-center justify-center rounded-full transition-all duration-200",u.value?"bg-primary-500 text-white hover:bg-primary-600 shadow-sm":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-500"]),disabled:!u.value,title:e.sendButtonTitle,onClick:U[3]||(U[3]=Z=>r("submit"))},[F(O,{name:"i-heroicons-arrow-up-20-solid",class:"h-4 w-4"})],10,Zh))],2)],2)}}}),ef=nr(Xh,[["__scopeId","data-v-f56852af"]]),tf={key:0,class:"absolute bottom-full left-0 z-20 mb-1.5 w-[240px] max-w-[calc(100vw-2rem)]"},nf={class:"overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-overlay dark:border-gray-700 dark:bg-page-dark"},rf={class:"flex items-center justify-between border-b border-gray-100 px-2.5 py-1.5 dark:border-gray-800"},sf={class:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400"},af=["title"],of=["onMouseenter","onClick"],lf={class:"min-w-0 flex-1"},cf={class:"flex items-center gap-1.5"},uf={class:"truncate text-xs font-medium"},df={class:"mt-0.5 line-clamp-1 text-xs leading-4 text-gray-500 dark:text-gray-400"},pf={key:1,class:"px-3 py-4 text-center"},hf={class:"text-sm font-medium text-gray-700 dark:text-gray-200"},ff={class:"mt-1 text-xs leading-5 text-gray-500 dark:text-gray-400"},gf={key:0,class:"absolute top-1/2 left-full ml-1 flex max-h-[min(348px,calc(100vh-10rem))] w-[300px] -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-overlay dark:border-gray-700 dark:bg-page-dark"},mf={class:"border-b border-gray-100 px-3 py-2 dark:border-gray-800"},yf={class:"truncate text-sm font-medium text-gray-900 dark:text-gray-100"},vf={class:"mt-0.5 text-xs leading-5 text-gray-500 dark:text-gray-400"},kf={key:0,class:"mt-1 flex items-start gap-1.5 text-[11px] leading-4"},xf={class:"shrink-0 font-medium text-gray-600 dark:text-gray-300"},bf={class:"line-clamp-1 min-w-0 flex-1 text-gray-500 dark:text-gray-400"},wf={key:1,class:"mt-0.5 flex items-start gap-1.5 text-[11px] leading-4"},_f={class:"shrink-0 font-medium text-gray-600 dark:text-gray-300"},Tf={class:"line-clamp-1 min-w-0 flex-1 text-gray-500 dark:text-gray-400"},Cf={class:"min-h-0 flex-1 overflow-y-auto px-3 py-2"},Sf={key:0,class:"text-xs text-gray-400 dark:text-gray-500"},Mf=["innerHTML"],Af={key:2,class:"text-xs leading-relaxed text-gray-400 dark:text-gray-500"},Lf=be({__name:"SlashCommandMenu",props:{visible:{type:Boolean},skills:{},highlightIndex:{},activeSkillId:{}},emits:["select","close","manage","highlight"],setup(e,{emit:t}){const{t:n,te:s}=qe(),r=ha(),i=e,a=t,o=J({}),l=J(""),c=J(!1),u=J(null),d=new da({html:!1,breaks:!0,linkify:!0,typographer:!0}),p=S(()=>{if(i.skills.length===0)return null;const v=Math.min(i.highlightIndex,i.skills.length-1);return i.skills[v]??null}),f=S(()=>l.value?d.render(l.value):"");function y(v){const C=`ai.assistant.builtinToolDesc.${v}`;return s(C)?n(C):v}const _=S(()=>p.value?.tags.join(" / ")||""),M=S(()=>p.value?.tools.map(v=>y(v)).join(" / ")||"");return Te(()=>[i.visible,p.value?.id],async([v,C])=>{if(!v||!C){l.value="",c.value=!1;return}if(o.value[C]){l.value=o.value[C],c.value=!1;return}c.value=!0;const L=(await r.getSkillConfig(C))?.prompt?.trim()||"";o.value={...o.value,[C]:L},p.value?.id===C&&(l.value=L,c.value=!1)},{immediate:!0}),Te(()=>[i.visible,i.highlightIndex,i.skills.length],async([v,C])=>{if(!v||!u.value)return;await Oe(),u.value.querySelectorAll("[data-slash-item]")[C]?.scrollIntoView({block:"nearest"})}),(v,C)=>{const z=Ne;return m(),ae(Gi,{name:"slash-menu"},{default:de(()=>[e.visible?(m(),x("div",tf,[h("div",nf,[h("div",rf,[h("div",sf,[h("span",null,w(k(n)("ai.chat.input.slashHint")),1)]),h("button",{type:"button",class:"rounded-md p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",title:k(n)("common.close"),onClick:C[0]||(C[0]=L=>a("close"))},[F(z,{name:"i-heroicons-x-mark",class:"h-3.5 w-3.5"})],8,af)]),i.skills.length>0?(m(),x("div",{key:0,ref_key:"listRef",ref:u,class:"max-h-72 overflow-y-auto p-1.5"},[(m(!0),x(me,null,_e(i.skills,(L,E)=>(m(),x("button",{key:L.id,type:"button","data-slash-item":"",class:Y(["flex w-full items-start justify-between gap-1.5 rounded-lg px-2.5 py-1.5 text-left transition-colors",E===i.highlightIndex?"bg-primary-50 text-gray-900 dark:bg-primary-950/30 dark:text-gray-100":"text-gray-700 hover:bg-gray-50 dark:text-gray-200 dark:hover:bg-gray-800/80"]),onMouseenter:G=>a("highlight",E),onClick:G=>a("select",L)},[h("div",lf,[h("div",cf,[h("span",uf,w(L.name),1),i.activeSkillId===L.id?(m(),ae(z,{key:0,name:"i-heroicons-check-circle-20-solid",class:"h-3.5 w-3.5 shrink-0 text-primary-500"})):q("",!0)]),h("p",df,w(L.description),1)])],42,of))),128))],512)):(m(),x("div",pf,[h("p",hf,w(k(n)("ai.chat.input.slashEmpty")),1),h("p",ff,w(k(n)("ai.chat.input.slashEmptyHint")),1)])),h("button",{type:"button",class:"flex w-full items-center justify-between border-t border-gray-100 px-2.5 py-1.5 text-xs text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900 dark:border-gray-800 dark:text-gray-300 dark:hover:bg-gray-800/80 dark:hover:text-gray-100",onClick:C[1]||(C[1]=L=>a("manage"))},[h("span",null,w(k(n)("ai.chat.input.manageSkills")),1),F(z,{name:"i-heroicons-arrow-top-right-on-square",class:"h-3.5 w-3.5"})])]),i.skills.length>0&&p.value?(m(),x("div",gf,[h("div",mf,[h("p",yf,w(p.value.name),1),h("p",vf,w(p.value.description),1),_.value?(m(),x("div",kf,[h("span",xf,w(k(n)("ai.chat.input.previewTagsLabel")),1),h("span",bf,w(_.value),1)])):q("",!0),M.value?(m(),x("div",wf,[h("span",_f,w(k(n)("ai.chat.input.previewToolsLabel")),1),h("span",Tf,w(M.value),1)])):q("",!0)]),h("div",Cf,[c.value?(m(),x("div",Sf,w(k(n)("common.loading")),1)):f.value?(m(),x("div",{key:1,class:"prose prose-sm max-w-none text-xs leading-5 dark:prose-invert prose-headings:mb-1.5 prose-headings:mt-2 prose-p:my-1.5 prose-ul:my-1.5 prose-ol:my-1.5",innerHTML:f.value},null,8,Mf)):(m(),x("div",Af,w(k(n)("ai.chat.input.previewUnavailable")),1))])])):q("",!0)])):q("",!0)]),_:1})}}}),$f=nr(Lf,[["__scopeId","data-v-0f67bc21"]]),Ef=1500,mg=be({__name:"AIChatInput",props:{sessionId:{default:""},disabled:{type:Boolean},status:{},chatType:{default:"group"},mentionScope:{default:"session"},skillsEnabled:{type:Boolean,default:!0},placeholder:{default:""},embedded:{type:Boolean,default:!1}},emits:["send","stop","manageSkills","skillActivated"],setup(e,{expose:t,emit:n}){const{t:s}=qe(),r=e,i=n,a=ha(),o=Yi(),{compatibleSkills:l,activeSkill:c,activeSkillId:u,isLoaded:d}=er(a),p=J(null),f=J(null),y=J(""),_=J([]),M=J([]),v=new Map,C=J([]),z=J(""),L=J("contact"),E=J(!1),G=J(""),ue=J(0),te=J(!1),V=J(null);let I=null,U=null,O=0;const Z=S(()=>y.value.trim().length>0&&!r.disabled),ie=S(()=>r.placeholder?r.placeholder:r.skillsEnabled&&c.value&&y.value.trim().length===0?s("ai.chat.input.placeholderWithActiveSkill",{name:c.value.name}):s("ai.chat.input.placeholderWithSlash")),K=S(()=>r.status==="streaming"?"":Z.value?s("ai.chat.input.send"):r.skillsEnabled&&c.value?s("ai.chat.input.needMoreThanSkill"):s("ai.chat.input.needQuestion")),B=S(()=>{const $=new Map;return _.value.forEach(N=>{const X=N.groupNickname||N.accountName||N.platformId;$.set(X,($.get(X)??0)+1)}),_.value.map(N=>{const X=N.groupNickname||N.accountName||N.platformId,Le=($.get(X)??0)>1?`${X}·${N.platformId}`:X;return{key:`member:${r.sessionId}:${N.id}`,displayName:X,avatar:N.avatar,mentionText:`@${Le}`,insertName:Le,mentionedMember:{memberId:N.id,platformId:N.platformId,displayName:X,aliases:[...N.aliases],mentionText:`@${Le}`},searchText:[X,N.groupNickname||"",N.accountName||"",N.platformId,Le,N.aliases.join(" ")].join(" ").toLocaleLowerCase()}})}),re=S(()=>r.mentionScope!=="global"?B.value:M.value.filter($=>L.value==="contact"?$.entityRef?.type==="contact":$.entityRef?.type==="session")),H=S(()=>{const $=z.value.trim().toLocaleLowerCase();return(r.mentionScope==="global"&&$?re.value.filter(X=>X.searchText.includes($)):re.value).map(X=>({id:X.key,label:X.insertName,avatar:X.avatar,searchText:X.searchText}))}),W=S(()=>{if(!r.skillsEnabled)return[];const $=G.value.trim().toLocaleLowerCase();return $?l.value.filter(N=>[N.name,N.description,N.tags.join(" ")].join(" ").toLocaleLowerCase().includes($)):l.value});function j(){f.value?.focus("end")}async function se(){if(r.mentionScope!=="session"||!r.sessionId){_.value=[];return}try{const $=await lr().getMembers(r.sessionId);_.value=[...$].sort((N,X)=>X.messageCount-N.messageCount)}catch($){console.error("Failed to load AI mention members:",$),_.value=[]}}function oe($,N){const X=s("ai.global.entityPicker.groups"),Le=[...$.map(ee=>({key:`contact:${ee.key}`,displayName:ee.displayName,avatar:ee.avatar,duplicateSuffix:ee.platformId,searchText:[ee.displayName,ee.platformId,ee.aliases.join(" ")].join(" ").toLocaleLowerCase(),entityRef:{type:"contact",contactKey:ee.key,displayName:ee.displayName}})),...o.sessions.filter(ee=>ee.type==="group").map(ee=>({key:`session:${ee.id}`,displayName:ee.name,avatar:ee.groupAvatar,duplicateSuffix:X,searchText:[ee.name,ee.platform].join(" ").toLocaleLowerCase(),entityRef:{type:"session",sessionId:ee.id,displayName:ee.name,sessionType:"group"}}))],We=N.trim().toLocaleLowerCase(),xe=We?Le.filter(ee=>ee.searchText.includes(We)):Le,Ve=new Map;return xe.forEach(ee=>{Ve.set(ee.displayName,(Ve.get(ee.displayName)??0)+1)}),xe.map(ee=>{const At=(Ve.get(ee.displayName)??0)>1?`${ee.displayName}·${ee.duplicateSuffix}`:ee.displayName;return{key:ee.key,displayName:ee.displayName,insertName:At,avatar:ee.avatar,searchText:ee.searchText,mentionText:`@${At}`,entityRef:ee.entityRef}})}async function Se($){const N=++O;try{const X={acceptStale:!0,timeRangePreset:"all",page:1,pageSize:100,query:$.trim()||void 0},Le=await Promise.all([lr().getContacts({...X,pool:"friend"}),lr().getContacts({...X,pool:"non_friend"})]);if(N!==O)return;const We=new Map;Le.flatMap(xe=>xe.contacts).forEach(xe=>We.set(xe.key,xe)),M.value=oe([...We.values()],$),we(Le,$)}catch(X){if(N!==O)return;Ae(),console.error("Failed to load global AI mention candidates:",X),M.value=oe([],$)}}function Ae(){U&&(clearTimeout(U),U=null)}function we($,N){Ae(),r.mentionScope==="global"&&$.some(X=>X.task?.status==="running")&&(U=setTimeout(()=>{U=null,Se(N)},Ef))}function he($){I&&clearTimeout(I),Ae(),O++,I=setTimeout(()=>{I=null,Se($)},$?200:0)}function De(){E.value=!1,G.value="",ue.value=0}function Me(){/^\s*\/([^\n]*)$/.test(y.value)&&(V.value=y.value),De()}function Ie($){if(r.disabled||!r.skillsEnabled){De();return}V.value&&V.value!==$&&(V.value=null);const N=$.match(/^\s*\/([^\n]*)$/);if(!N){De();return}const X=!E.value||G.value!==N[1];if(G.value=N[1],V.value===$){E.value=!1;return}E.value=!0,X&&(ue.value=0)}function pt(){a.activateSkill(null),Oe(j)}function it(){r.disabled||!r.skillsEnabled||(u.value&&a.activateSkill(null),V.value=null,y.value="/",Oe(j))}function zt($){r.disabled||(V.value=null,y.value=$,Oe(j))}function Ot(){y.value="",C.value=[],z.value="",V.value=null,De(),r.skillsEnabled&&u.value&&a.activateSkill(null)}function or($){C.value=$}function on($){z.value=$,r.mentionScope==="global"&&he($)}function ht(){if(!Z.value)return;const $=y.value.trim(),N=[...C.value],X=N.flatMap(xe=>{const Ve=v.get(xe);return Ve?[Ve]:[]}),Le=r.skillsEnabled?u.value:null,We=()=>{const xe=C.value.length===N.length&&C.value.every((Ve,ee)=>Ve===N[ee]);y.value.trim()!==$||!xe||(y.value="",C.value=[],z.value="",V.value=null,Le&&u.value===Le&&a.activateSkill(null))};i("send",{content:$,mentionedMembers:X.flatMap(xe=>xe.mentionedMember?[{...xe.mentionedMember,aliases:[...xe.mentionedMember.aliases]}]:[]),entityRefs:X.flatMap(xe=>xe.entityRef?[{...xe.entityRef}]:[]),onAccepted:We})}function ln($){r.disabled||(a.activateSkill($.id),i("skillActivated",$),y.value="",V.value=null,De(),Oe(j))}function St(){Me(),i("manageSkills")}function Mt($){if(!W.value.length)return;const N=W.value.length;ue.value=(ue.value+$+N)%N}function ft($){if(r.skillsEnabled&&$.key==="Backspace"&&y.value.length===0&&u.value){$.preventDefault(),pt();return}if(E.value){if($.key==="ArrowDown"){$.preventDefault(),Mt(1);return}if($.key==="ArrowUp"){$.preventDefault(),Mt(-1);return}if($.key==="Escape"){$.preventDefault(),Me();return}if($.key==="Enter"&&!$.shiftKey&&!te.value||$.key==="Tab"){$.preventDefault();const N=W.value[ue.value];N&&ln(N);return}}$.key==="Enter"&&!$.shiftKey&&!te.value&&!$.isComposing&&($.preventDefault(),ht())}function cn($){if(!E.value||!p.value)return;const N=$.target;N instanceof Node&&!p.value.contains(N)&&Me()}return Te(y,Ie),Te(re,$=>{$.forEach(N=>v.set(N.key,N))},{immediate:!0}),Te(W,$=>{$.length===0?ue.value=0:ue.value>=$.length&&(ue.value=$.length-1)},{immediate:!0}),Te(()=>[r.chatType,r.skillsEnabled],([$,N])=>{N&&a.setFilterContext($)},{immediate:!0}),Te(()=>r.disabled,$=>{$&&Me()}),Te(()=>[r.sessionId,r.mentionScope],()=>{C.value=[],z.value="",se(),Ae(),O++,r.mentionScope==="global"?(M.value=oe([],""),Se("")):M.value=[]},{immediate:!0}),wt(async()=>{r.skillsEnabled&&!d.value&&await a.loadSkills(),document.addEventListener("mousedown",cn)}),_t(()=>{I&&clearTimeout(I),Ae(),O+=1,document.removeEventListener("mousedown",cn)}),t({clearDraft:Ot,fillInput:zt,openSkillSelector:it}),($,N)=>(m(),x("div",{class:Y(["shrink-0",[r.embedded?"":"pt-2 pb-2"]])},[h("div",{ref_key:"rootRef",ref:p,class:Y(["w-full max-w-4xl mx-auto",{relative:!r.embedded}])},[r.skillsEnabled?(m(),ae($f,{key:0,visible:E.value,skills:W.value,"highlight-index":ue.value,"active-skill-id":k(u),onSelect:ln,onClose:Me,onManage:St,onHighlight:N[0]||(N[0]=X=>ue.value=X)},null,8,["visible","skills","highlight-index","active-skill-id"])):q("",!0),F(ef,{ref_key:"composerRef",ref:f,modelValue:y.value,"onUpdate:modelValue":N[1]||(N[1]=X=>y.value=X),disabled:r.disabled,status:r.status,placeholder:ie.value,"send-button-title":K.value,"active-skill-name":r.skillsEnabled?k(c)?.name:void 0,"mention-items":H.value,"mention-search-term":z.value,"async-mention-search":r.mentionScope==="global","show-mention-tabs":r.mentionScope==="global","mention-tab":L.value,"contact-tab-label":k(s)("ai.global.entityPicker.contacts"),"group-tab-label":k(s)("ai.global.entityPicker.groups"),embedded:r.embedded,"onUpdate:mentionSearchTerm":on,"onUpdate:mentionTab":N[2]||(N[2]=X=>L.value=X),onMentionsChange:or,onSubmit:ht,onStop:N[3]||(N[3]=X=>i("stop")),onKeydown:ft,onCompositionStart:N[4]||(N[4]=X=>te.value=!0),onCompositionEnd:N[5]||(N[5]=X=>te.value=!1)},null,8,["modelValue","disabled","status","placeholder","send-button-title","active-skill-name","mention-items","mention-search-term","async-mention-search","show-mention-tabs","mention-tab","contact-tab-label","group-tab-label","embedded"])],2)],2))}}),If=["data-running"],Rf={class:"min-w-0 truncate"},Pf={class:"text-gray-600 dark:text-gray-300"},Hf={key:0,class:"text-gray-400 dark:text-gray-500"},yg=be({__name:"AIThinkingIndicator",props:{currentToolStatus:{},agentStatus:{}},setup(e){const{t,te:n}=qe();function s(p,f){const y=`ai.assistant.builtinToolDesc.${p}`;return n(y)?t(y):f||p}function r(p){if(!p)return"";const f=`ai.chat.thinking.toolProgress.${p.phase}`;return n(f)?t(f):""}const i=e,a=S(()=>i.agentStatus?.phase==="compressing"),o=S(()=>!a.value&&!i.currentToolStatus),l=S(()=>a.value?t("ai.chat.thinking.compressing"):i.currentToolStatus?s(i.currentToolStatus.name,i.currentToolStatus.displayName):t("ai.chat.thinking.analyzing")),c=S(()=>a.value||!i.currentToolStatus?"":i.currentToolStatus.status==="running"?r(i.currentToolStatus.progress):i.currentToolStatus.status==="done"?t("ai.chat.thinking.processingResult"):""),u=S(()=>a.value||i.currentToolStatus?.status==="running"?"i-heroicons-arrow-path":i.currentToolStatus?.status==="error"?"i-heroicons-exclamation-circle":i.currentToolStatus?"i-heroicons-wrench-screwdriver":"i-heroicons-sparkles"),d=S(()=>a.value||i.currentToolStatus?.status==="running");return(p,f)=>{const y=Ne;return m(),x("div",{class:"ai-live-row flex h-6 min-w-0 items-center gap-1.5 text-sm leading-6 text-gray-500 dark:text-gray-400","data-running":o.value||void 0},[F(y,{name:u.value,class:Y(["h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-gray-500",[d.value?"animate-spin text-primary-500 dark:text-primary-400":""]])},null,8,["name","class"]),h("span",Rf,[h("span",Pf,w(l.value),1),c.value?(m(),x("span",Hf,"· "+w(c.value),1)):q("",!0)])],8,If)}}}),Nf={class:"pointer-events-none relative z-20 flex items-center justify-between"},zf={class:"pointer-events-auto flex items-center gap-1"},Of=["disabled"],Bf={class:"max-w-[160px] truncate"},Df=["title"],jf={class:"w-40 py-1"},Ff={class:"px-3 py-1.5 text-xs font-medium text-gray-400 dark:text-gray-500"},qf=["onClick"],Uf={class:"pointer-events-auto flex items-center gap-1"},Kf=["title"],Wf=["aria-label"],Vf={viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":"true"},Gf=["stroke-dasharray"],Yf={class:"space-y-0.5 whitespace-nowrap text-xs"},Qf={key:0},br=5.5,vg=be({__name:"ChatStatusBar",props:{sessionTokenUsage:{},agentStatus:{},estimatedContextTokens:{}},setup(e){const{t}=qe(),n=Xn(),s=e,r=fa(),i=Qi(),{defaultAssistantConfig:a,isLoading:o}=er(i),l=S(()=>s.agentStatus?t(`ai.chat.statusBar.agent.phase.${s.agentStatus.phase}`):""),c=S(()=>s.agentStatus?t(`ai.chat.statusBar.agent.phaseShort.${s.agentStatus.phase}`):""),u=S(()=>{const K=s.agentStatus?.phase;return K==="compressing"||K==="preparing"||K==="thinking"||K==="tool_running"||K==="responding"}),d=S(()=>{const K=s.agentStatus?.phase;return u.value||K==="error"});function p(K){return Number.isFinite(K)?new Intl.NumberFormat().format(Math.max(0,Math.round(K))):"0"}function f(K){const B=Math.max(0,Math.round(K));return B>=1e6?`${(B/1e6).toFixed(1).replace(/\.0$/,"")}M`:B>=1e3?`${(B/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(B)}const y=S(()=>p(s.sessionTokenUsage.totalTokens)),_=S(()=>f(s.sessionTokenUsage.totalTokens)),M=S(()=>s.sessionTokenUsage.cacheReadTokens>0),v=S(()=>f(s.sessionTokenUsage.cacheReadTokens)),C=S(()=>s.agentStatus?.contextTokens?s.agentStatus.contextTokens:s.estimatedContextTokens&&s.estimatedContextTokens>0?s.estimatedContextTokens:0),z=S(()=>{const K=a.value,B=i.defaultAssistant?.modelId||K?.model;return!K||!B?128e3:(i.getModelById(K.provider,B)||i.findModelAcrossProviders(B))?.contextWindow??128e3}),L=S(()=>C.value<=0||z.value<=0?0:Math.min(100,Math.round(C.value/z.value*100))),E=2*Math.PI*br,G=S(()=>`${E*L.value/100} ${E}`),ue=S(()=>s.agentStatus?[`${t("ai.chat.statusBar.agent.label")}: ${l.value}`,`${t("ai.chat.statusBar.agent.contextTokens")}: ${p(s.agentStatus.contextTokens)}`,`${t("ai.chat.statusBar.tokenUsageTitle")}: ${y.value}`].join(`
147
+ `):"");function te(){n.openSettings("ai","defaultModel")}const V=J(!1),I=S(()=>{const K=a.value,B=i.defaultAssistant?.modelId||K?.model;return!K?.provider||!B?[]:uo(K.provider,B)}),U=S(()=>I.value.length>0),O=S(()=>{const K=i.defaultAssistant;return!K?.configId||!K?.modelId?"default":r.getThinkingLevel(K.configId,K.modelId)??"default"});function Z(K){const B=i.defaultAssistant;!B?.configId||!B?.modelId||(r.setThinkingLevel(B.configId,B.modelId,K),V.value=!1)}const ie=S(()=>t(`ai.chat.statusBar.thinking.level.${O.value}`));return(K,B)=>{const re=Ne,H=ea,W=na;return m(),x("div",Nf,[h("div",zf,[h("button",{class:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300",disabled:k(o),onClick:te},[F(re,{name:"i-heroicons-cpu-chip",class:"h-3.5 w-3.5"}),h("span",Bf,w(k(i).defaultAssistant?.modelId?k(i).getModelById(k(a)?.provider??"",k(i).defaultAssistant.modelId)?.name||k(i).defaultAssistant.modelId:k(t)("ai.chat.statusBar.model.notConfigured")),1)],8,Of),U.value?(m(),ae(H,{key:0,open:V.value,"onUpdate:open":B[0]||(B[0]=j=>V.value=j),ui:{content:"z-[80] p-0"}},{content:de(()=>[h("div",jf,[h("div",Ff,w(k(t)("ai.chat.statusBar.thinking.title")),1),(m(!0),x(me,null,_e(I.value,j=>(m(),x("button",{key:j,class:Y(["flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-gray-100 dark:hover:bg-gray-800",O.value===j?"text-primary-600 dark:text-primary-400":"text-gray-700 dark:text-gray-300"]),onClick:se=>Z(j)},[F(re,{name:O.value===j?"i-heroicons-check-circle-solid":"i-heroicons-light-bulb",class:Y(["h-4 w-4 shrink-0",O.value===j?"text-primary-500":"text-gray-400"])},null,8,["name","class"]),h("span",null,w(k(t)(`ai.chat.statusBar.thinking.level.${j}`)),1)],10,qf))),128))])]),default:de(()=>[h("button",{class:Y(["flex items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-gray-100 dark:hover:bg-gray-800",O.value==="default"||O.value==="off"?"text-gray-400 dark:text-gray-500":"text-primary-500 dark:text-primary-400"]),title:k(t)("ai.chat.statusBar.thinking.tooltip")},[F(re,{name:"i-heroicons-light-bulb",class:"h-3.5 w-3.5"}),h("span",null,w(ie.value),1)],10,Df)]),_:1},8,["open"])):q("",!0)]),h("div",Uf,[d.value?(m(),x("div",{key:0,class:"hidden shrink-0 items-center gap-1.5 px-1.5 py-1 text-[11px] text-gray-400 lg:flex dark:text-gray-500",title:ue.value},[h("span",{class:Y(["h-1.5 w-1.5 rounded-full",[e.agentStatus?.phase==="error"?"bg-amber-500":"bg-primary-500 animate-pulse"]])},null,2),h("span",null,w(c.value),1)],8,Kf)):q("",!0),C.value>0?(m(),ae(W,{key:1,ui:{content:"h-auto py-1.5"}},{content:de(()=>[h("div",Yf,[h("div",null,w(k(t)("ai.chat.statusBar.agent.contextTokens"))+": "+w(f(C.value))+" / "+w(f(z.value)),1),h("div",null,w(k(t)("ai.chat.statusBar.tokenUsageTitle"))+": "+w(_.value),1),M.value?(m(),x("div",Qf,w(k(t)("ai.chat.statusBar.cacheHit"))+": "+w(v.value),1)):q("",!0)])]),default:de(()=>[h("div",{class:"hidden h-7 w-7 shrink-0 place-items-center rounded-full text-gray-400 transition-colors hover:bg-gray-100 md:grid dark:text-gray-500 dark:hover:bg-gray-800","aria-label":`${k(t)("ai.chat.statusBar.agent.contextTokens")} ${L.value}%`},[(m(),x("svg",Vf,[h("circle",{cx:"7",cy:"7",r:br,fill:"none",class:"stroke-gray-300 dark:stroke-gray-700","stroke-width":"2"}),h("circle",{cx:"7",cy:"7",r:br,fill:"none",class:"stroke-gray-400 transition-[stroke-dasharray] duration-300 dark:stroke-gray-500","stroke-width":"2","stroke-linecap":"round","stroke-dasharray":G.value,transform:"rotate(-90 7 7)"},null,8,Gf)]))],8,Wf)]),_:1})):q("",!0)])])}}}),Jf={class:"flex shrink-0 items-center gap-1"},Zf=["title","disabled"],Xf=["title","disabled"],kg=be({__name:"ChatHeaderActions",props:{currentAIChatId:{},currentMessages:{},fallbackTitle:{}},setup(e){const t=e,{t:n}=qe(),s=Br(),r=fa(),{aiGlobalSettings:i}=er(r),a=J(!1),o=J(!1),l=S(()=>Tr(t.currentMessages??[])),c=S(()=>!!t.currentAIChatId||Mo(t.currentMessages??[]));function u(){return{createdAt:n("ai.chat.conversation.export.createdAt"),user:n("ai.chat.conversation.export.user"),assistant:n("ai.chat.conversation.export.assistant")}}function d(y){return y.map(_=>({..._,timestamp:_.timestamp*1e3}))}async function p(){if(!(a.value||!c.value)){a.value=!0;try{const y=i.value.exportFormat||"markdown",_=u();let M=t.fallbackTitle||n("ai.chat.conversation.newChat"),v=l.value[0]?.timestamp??Date.now(),C=l.value;if(t.currentAIChatId){const[L,E]=await Promise.all([It().getAIChat(t.currentAIChatId),It().getMessages(t.currentAIChatId)]);L&&(M=L.title||M,v=L.createdAt*1e3);const G=Tr(d(E));G.length>0&&(C=G)}if(C.length===0){s.warn(n("ai.chat.conversation.export.noMessages"));return}const z=await Eo(M,C,v,y,_);if(z.success&&z.filePath){const L=z.filePath.split("/").pop()||z.filePath,E=z.filePath;s.add({title:n("common.exportSuccess"),description:L,color:"primary",actions:[{label:n("common.openFolder"),onClick:()=>{io().showInFolder(E)}}]})}else s.fail(n("common.exportFailed"),{description:z.error})}catch(y){console.error("Failed to export AI conversation:",y),s.fail(n("common.exportFailed"),{description:String(y)})}finally{a.value=!1}}}async function f(){if(!o.value){o.value=!0;try{const y=await It().showAiLogFile();y?.success||s.fail(n("ai.chat.statusBar.log.openFailed"),{description:y?.error||n("ai.chat.statusBar.log.openFailedDesc")})}catch(y){console.error("Failed to open AI log file:",y),s.fail(n("ai.chat.statusBar.log.openFailed"),{description:String(y)})}finally{o.value=!1}}}return(y,_)=>{const M=Ne;return m(),x("div",Jf,[h("button",{type:"button",class:"flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-60 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",title:k(n)("ai.chat.statusBar.export.title"),disabled:a.value||!c.value,onClick:p},[F(M,{name:"i-heroicons-arrow-down-tray",class:"h-3.5 w-3.5"}),h("span",null,w(k(n)("ai.chat.statusBar.export.label")),1)],8,Zf),h("button",{type:"button",class:"flex items-center gap-1 rounded-md px-1.5 py-1 text-xs text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-60 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",title:k(n)("ai.chat.statusBar.log.title"),disabled:o.value,onClick:f},[F(M,{name:"i-heroicons-document-text",class:"h-3.5 w-3.5"}),h("span",null,w(k(n)("ai.chat.statusBar.log.label")),1)],8,Xf)])}}}),eg={slots:{root:"relative inline-flex items-center",base:["w-full rounded-md border-0 appearance-none placeholder:text-dimmed disabled:cursor-not-allowed disabled:opacity-75","transition-colors"],leading:"absolute start-0 flex items-start",leadingIcon:"shrink-0 text-dimmed",leadingAvatar:"shrink-0",leadingAvatarSize:"",trailing:"absolute end-0 flex items-start",trailingIcon:"shrink-0 text-dimmed"},variants:{fieldGroup:{horizontal:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"},vertical:{root:"group has-focus-visible:z-[1]",base:"group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"}},size:{xs:{base:"px-2 py-1 text-sm/4 gap-1",leading:"ps-2 inset-y-1",trailing:"pe-2 inset-y-1",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},sm:{base:"px-2.5 py-1.5 text-sm/4 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-4",leadingAvatarSize:"3xs",trailingIcon:"size-4"},md:{base:"px-2.5 py-1.5 text-base/5 gap-1.5",leading:"ps-2.5 inset-y-1.5",trailing:"pe-2.5 inset-y-1.5",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},lg:{base:"px-3 py-2 text-base/5 gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-5",leadingAvatarSize:"2xs",trailingIcon:"size-5"},xl:{base:"px-3 py-2 text-base gap-2",leading:"ps-3 inset-y-2",trailing:"pe-3 inset-y-2",leadingIcon:"size-6",leadingAvatarSize:"xs",trailingIcon:"size-6"}},variant:{outline:"text-highlighted bg-default ring ring-inset ring-accented",soft:"text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",subtle:"text-highlighted bg-elevated ring ring-inset ring-accented",ghost:"text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",none:"text-highlighted bg-transparent focus:outline-none"},color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},leading:{true:""},trailing:{true:""},loading:{true:""},highlight:{true:""},fixed:{false:""},type:{file:"file:me-1.5 file:font-medium file:text-muted file:outline-none"},autoresize:{true:{base:"resize-none"}}},compoundVariants:[{color:"primary",variant:["outline","subtle"],class:"outline-primary/25 focus-visible:outline-3 focus-visible:ring-primary"},{color:"secondary",variant:["outline","subtle"],class:"outline-secondary/25 focus-visible:outline-3 focus-visible:ring-secondary"},{color:"success",variant:["outline","subtle"],class:"outline-success/25 focus-visible:outline-3 focus-visible:ring-success"},{color:"info",variant:["outline","subtle"],class:"outline-info/25 focus-visible:outline-3 focus-visible:ring-info"},{color:"warning",variant:["outline","subtle"],class:"outline-warning/25 focus-visible:outline-3 focus-visible:ring-warning"},{color:"error",variant:["outline","subtle"],class:"outline-error/25 focus-visible:outline-3 focus-visible:ring-error"},{color:"primary",variant:["soft","ghost"],class:"outline-primary/25 focus-visible:outline-3"},{color:"secondary",variant:["soft","ghost"],class:"outline-secondary/25 focus-visible:outline-3"},{color:"success",variant:["soft","ghost"],class:"outline-success/25 focus-visible:outline-3"},{color:"info",variant:["soft","ghost"],class:"outline-info/25 focus-visible:outline-3"},{color:"warning",variant:["soft","ghost"],class:"outline-warning/25 focus-visible:outline-3"},{color:"error",variant:["soft","ghost"],class:"outline-error/25 focus-visible:outline-3"},{color:"primary",highlight:!0,class:"ring ring-inset ring-primary"},{color:"secondary",highlight:!0,class:"ring ring-inset ring-secondary"},{color:"success",highlight:!0,class:"ring ring-inset ring-success"},{color:"info",highlight:!0,class:"ring ring-inset ring-info"},{color:"warning",highlight:!0,class:"ring ring-inset ring-warning"},{color:"error",highlight:!0,class:"ring ring-inset ring-error"},{color:"neutral",variant:["outline","subtle"],class:"outline-inverted/25 focus-visible:outline-3 focus-visible:ring-inverted"},{color:"neutral",variant:["soft","ghost"],class:"outline-inverted/25 focus-visible:outline-3"},{color:"neutral",highlight:!0,class:"ring ring-inset ring-inverted"},{leading:!0,size:"xs",class:"ps-7"},{leading:!0,size:"sm",class:"ps-8"},{leading:!0,size:"md",class:"ps-9"},{leading:!0,size:"lg",class:"ps-10"},{leading:!0,size:"xl",class:"ps-11"},{trailing:!0,size:"xs",class:"pe-7"},{trailing:!0,size:"sm",class:"pe-8"},{trailing:!0,size:"md",class:"pe-9"},{trailing:!0,size:"lg",class:"pe-10"},{trailing:!0,size:"xl",class:"pe-11"},{loading:!0,leading:!0,class:{leadingIcon:"animate-spin"}},{loading:!0,leading:!1,trailing:!0,class:{trailingIcon:"animate-spin"}},{fixed:!1,size:"xs",class:"md:text-xs"},{fixed:!1,size:"sm",class:"md:text-xs"},{fixed:!1,size:"md",class:"md:text-sm"},{fixed:!1,size:"lg",class:"md:text-sm"}],defaultVariants:{size:"md",color:"primary",variant:"outline"}},tg=["id","value","name","rows","placeholder","disabled","required"],xg=Object.assign({inheritAttrs:!1},{__name:"Textarea",props:{as:{type:null,required:!1},id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},size:{type:null,required:!1},required:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autofocusDelay:{type:Number,required:!1,default:0},autoresize:{type:Boolean,required:!1},autoresizeDelay:{type:Number,required:!1,default:0},disabled:{type:Boolean,required:!1},rows:{type:Number,required:!1,default:3},maxrows:{type:Number,required:!1,default:0},highlight:{type:Boolean,required:!1},fixed:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},modelModifiers:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},leading:{type:Boolean,required:!1},leadingIcon:{type:null,required:!1},trailing:{type:Boolean,required:!1},trailingIcon:{type:null,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},emits:["update:modelValue","blur","change"],setup(e,{expose:t,emit:n}){const s=e,r=n,i=Ji(),a=la("textarea",s),o=Zi(a,"modelValue",r,{defaultValue:a.defaultValue}),l=ua(),{emitFormFocus:c,emitFormBlur:u,emitFormInput:d,emitFormChange:p,size:f,color:y,id:_,name:M,highlight:v,disabled:C,ariaAttrs:z}=Xi(s,{deferInputValidation:!0}),{isLeading:L,isTrailing:E,leadingIconName:G,trailingIconName:ue}=no(a),te=S(()=>xn({extend:xn(eg),...l.ui?.textarea||{}})({color:y.value??a.color,variant:a.variant,size:f?.value??a.size,loading:a.loading,highlight:v.value??a.highlight,fixed:a.fixed,autoresize:a.autoresize,leading:L.value||!!a.avatar||!!i.leading,trailing:E.value||!!i.trailing})),V=eo("textareaRef");function I(B){a.modelModifiers?.trim&&(typeof B=="string"||B===null||B===void 0)&&(B=B?.trim()??null),a.modelModifiers?.number&&(B=ro(B)),a.modelModifiers?.nullable&&(B||=null),a.modelModifiers?.optional&&!a.modelModifiers?.nullable&&B!==null&&(B||=void 0),o.value=B,d()}function U(B){K(),a.modelModifiers?.lazy||I(B.target.value)}function O(B){const re=B.target.value;a.modelModifiers?.lazy&&I(re),a.modelModifiers?.trim&&(B.target.value=re.trim()),p(),r("change",B)}function Z(B){u(),r("blur",B)}function ie(){a.autofocus&&V.value?.focus()}function K(){if(a.autoresize&&V.value){V.value.rows=a.rows;const B=V.value.style.overflow;V.value.style.overflow="hidden";const re=window.getComputedStyle(V.value),H=Number.parseInt(re.paddingTop),W=Number.parseInt(re.paddingBottom),j=H+W,se=Number.parseInt(re.lineHeight),{scrollHeight:oe}=V.value,Se=(oe-j)/se;Se>a.rows&&(V.value.rows=a.maxrows?Math.min(Se,a.maxrows):Se),V.value.style.overflow=B}}return Te(o,()=>{Oe(K)}),wt(()=>{setTimeout(()=>{ie()},a.autofocusDelay),setTimeout(async()=>{await Oe(),K()},a.autoresizeDelay)}),t({textareaRef:V,autoResize:K}),(B,re)=>(m(),ae(k(ca),{as:k(a).as,"data-slot":"root",class:Y(te.value.root({class:[k(a).ui?.root,k(a).class]}))},{default:de(()=>[h("textarea",ps({id:k(_),ref_key:"textareaRef",ref:V,value:k(o),name:k(M),rows:k(a).rows,placeholder:k(a).placeholder,"data-slot":"base",class:te.value.base({class:k(a).ui?.base}),disabled:k(C),required:k(a).required},{...B.$attrs,...k(z)},{onInput:U,onBlur:Z,onChange:O,onFocus:re[0]||(re[0]=(...H)=>k(c)&&k(c)(...H))}),null,16,tg),Rt(B.$slots,"default",{ui:te.value}),k(L)||k(a).avatar||i.leading?(m(),x("span",{key:0,"data-slot":"leading",class:Y(te.value.leading({class:k(a).ui?.leading}))},[Rt(B.$slots,"leading",{ui:te.value},()=>[k(L)&&k(G)?(m(),ae(Ne,{key:0,name:k(G),"data-slot":"leadingIcon",class:Y(te.value.leadingIcon({class:k(a).ui?.leadingIcon}))},null,8,["name","class"])):k(a).avatar?(m(),ae(to,ps({key:1,size:k(a).ui?.leadingAvatarSize||te.value.leadingAvatarSize()},k(a).avatar,{"data-slot":"leadingAvatar",class:te.value.leadingAvatar({class:k(a).ui?.leadingAvatar})}),null,16,["size","class"])):q("",!0)])],2)):q("",!0),k(E)||i.trailing?(m(),x("span",{key:1,"data-slot":"trailing",class:Y(te.value.trailing({class:k(a).ui?.trailing}))},[Rt(B.$slots,"trailing",{ui:te.value},()=>[k(ue)?(m(),ae(Ne,{key:0,name:k(ue),"data-slot":"trailingIcon",class:Y(te.value.trailingIcon({class:k(a).ui?.trailingIcon}))},null,8,["name","class"])):q("",!0)])],2)):q("",!0)]),_:3},8,["as","class"]))}}),ng=30,rg=100;function sg(e,t=rg){let n=null,s=!1;function r(a=!1){s||=a,n===null&&(n=setTimeout(()=>{n=null;const o=s;s=!1,e(o)},t))}function i(){n!==null&&(clearTimeout(n),n=null),s=!1}return{schedule:r,cancel:i}}function bg(e,t){const n=J(null),s=J(!0),r=J(!1),i=sg(u=>{n.value&&(u||s.value)&&(n.value.scrollTop=n.value.scrollHeight,s.value=!0,r.value=!1)});function a(u=!1){i.schedule(u)}function o(u){u.deltaY<0&&t.value&&(s.value=!1,r.value=!0)}function l(){if(!n.value)return;const{scrollTop:u,scrollHeight:d,clientHeight:p}=n.value;d-u-p<ng&&(s.value=!0,r.value=!1)}function c(){a(!0)}return Te(()=>{const u=e.value[e.value.length-1];return[e.value.length,u?.content,u?.contentBlocks?.length]},()=>a()),wt(()=>{n.value&&(n.value.addEventListener("scroll",l),n.value.addEventListener("wheel",o,{passive:!0})),e.value.length>0&&a(!0)}),_t(()=>{i.cancel(),n.value&&(n.value.removeEventListener("scroll",l),n.value.removeEventListener("wheel",o))}),{messagesContainer:n,showScrollToBottom:r,scrollToBottom:a,handleScrollToBottom:c}}const mn=20;function wg(e,t,n){const s=J(mn),r=S(()=>e.value.slice(-s.value)),i=S(()=>s.value<e.value.length);Te([t,()=>e.value.length],([o,l],[c,u])=>{if(o!==c){s.value=mn;return}l<u?s.value=Math.max(mn,Math.min(s.value,l)):u>0&&s.value>=u&&(s.value=l)});async function a(){if(!i.value)return;const o=n.value,l=o?.scrollHeight??0,c=o?.scrollTop??0;s.value=Math.min(e.value.length,s.value+mn),await Oe(),o&&n.value===o&&(o.scrollTop=c+(o.scrollHeight-l))}return{visiblePairs:r,hasOlderPairs:i,loadOlderPairs:a}}function _g(e){const t=[];let n=null;for(const s of e)s.role==="user"?(n&&t.push({user:n,assistant:null,standalone:null,id:n.id}),n=s):s.role==="assistant"?(t.push({user:n,assistant:s,standalone:null,id:n?.id||s.id}),n=null):(n&&(t.push({user:n,assistant:null,standalone:null,id:n.id}),n=null),t.push({user:null,assistant:null,standalone:s,id:s.id}));return n&&t.push({user:n,assistant:null,standalone:null,id:n.id}),t}export{xg as _,wg as a,kg as b,fg as c,gg as d,yg as e,mg as f,vg as g,_g as h,bs as i,oo as j,po as k,ws as l,bg as u};