chatlab-cli 0.37.1 → 0.37.3

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 (153) hide show
  1. package/dist/{chat-command-YAFRLHMQ.mjs → chat-command-RQC44FPF.mjs} +53 -13
  2. package/dist/chat-command-RQC44FPF.mjs.map +1 -0
  3. package/dist/{chunk-FPVRSXQ4.mjs → chunk-4FAEB4C2.mjs} +12 -12
  4. package/dist/{chunk-MMTEGUQA.mjs → chunk-5OA4QI3Q.mjs} +3 -3
  5. package/dist/{chunk-UP6JIV3S.mjs → chunk-E2ZFGNZQ.mjs} +16 -12
  6. package/dist/chunk-E2ZFGNZQ.mjs.map +1 -0
  7. package/dist/{chunk-JWJREWVN.mjs → chunk-E6IRRNBQ.mjs} +27 -3
  8. package/dist/chunk-E6IRRNBQ.mjs.map +1 -0
  9. package/dist/{chunk-PDQV4RUA.mjs → chunk-GDKQKHJT.mjs} +2 -2
  10. package/dist/{chunk-GKCIRKOH.mjs → chunk-HJWBFHNR.mjs} +4 -4
  11. package/dist/{chunk-73TJ2S7W.mjs → chunk-IDDTW5JN.mjs} +313 -24
  12. package/dist/chunk-IDDTW5JN.mjs.map +1 -0
  13. package/dist/{chunk-2PY4XCH3.mjs → chunk-IMJVOODY.mjs} +2 -2
  14. package/dist/{chunk-ARIBCH47.mjs → chunk-LUENE6L7.mjs} +25 -15
  15. package/dist/chunk-LUENE6L7.mjs.map +1 -0
  16. package/dist/{chunk-WDLO7OLX.mjs → chunk-O57SQSCO.mjs} +2 -2
  17. package/dist/{chunk-N4SB6QZV.mjs → chunk-ZGXXAPLX.mjs} +2 -2
  18. package/dist/{chunk-OTYNMDDL.mjs → chunk-ZOHSWBD2.mjs} +2237 -1977
  19. package/dist/chunk-ZOHSWBD2.mjs.map +1 -0
  20. package/dist/cli.mjs +9 -9
  21. package/dist/contacts-worker.mjs +2 -2
  22. package/dist/global-insight-worker.mjs +1 -1
  23. package/dist/{http-LPFPVTBC.mjs → http-QJDZKDNJ.mjs} +12 -12
  24. package/dist/{import-T4WX2ZJL.mjs → import-XK6YM26A.mjs} +7 -7
  25. package/dist/index.mjs +12 -12
  26. package/dist/{mcp-SMF3NWIN.mjs → mcp-DMGZFSYN.mjs} +24 -17
  27. package/dist/mcp-DMGZFSYN.mjs.map +1 -0
  28. package/dist/people-relationships-worker.mjs +2 -2
  29. package/dist/semantic-index-worker.mjs +1 -1
  30. package/dist/{src-EGLLMTAU.mjs → src-4AHJUFCW.mjs} +6 -6
  31. package/dist/{stream-import-2BXJTTCE.mjs → stream-import-7VQVT5ST.mjs} +7 -7
  32. package/dist/{worker-runtime-RDLSPXFT.mjs → worker-runtime-PQBAV75N.mjs} +5 -5
  33. package/dist-cli-web/assets/{AISettingsTab-CEhrXlYR.js → AISettingsTab-qS3XKnvh.js} +1 -1
  34. package/dist-cli-web/assets/{AboutTab-Bbu0SsMM.js → AboutTab-K-i40dPv.js} +1 -1
  35. package/dist-cli-web/assets/{Alert-510jTN3l.js → Alert-GSvA5B7J.js} +1 -1
  36. package/dist-cli-web/assets/{ApiSettingsTab-Bi1GRMN4.js → ApiSettingsTab-DIVGTR3g.js} +1 -1
  37. package/dist-cli-web/assets/{BatchManageTab-DhnqMCSM.js → BatchManageTab-CJhwvYWV.js} +1 -1
  38. package/dist-cli-web/assets/{BufferResource-CKZxnACp.js → BufferResource-Cjm0m7sF.js} +1 -1
  39. package/dist-cli-web/assets/{CanvasRenderer-BeK5POBy.js → CanvasRenderer-C-fmrahh.js} +1 -1
  40. package/dist-cli-web/assets/{CardDecoration-RuBA3N2j.js → CardDecoration-Cz54ZPyh.js} +1 -1
  41. package/dist-cli-web/assets/{ChatRecordDrawer-BY_-lIEj.js → ChatRecordDrawer-Cst8zTUv.js} +1 -1
  42. package/dist-cli-web/assets/{ChatRecordWorkspace-7prKd-Tq.js → ChatRecordWorkspace-DKVKaimw.js} +1 -1
  43. package/dist-cli-web/assets/{Checkbox-_eH64bb0.js → Checkbox-CrlY3jiJ.js} +1 -1
  44. package/dist-cli-web/assets/{DataDirCleanupNotice-BHaXwlfr.js → DataDirCleanupNotice-Cjqiub4e.js} +1 -1
  45. package/dist-cli-web/assets/{DatePicker.vue_vue_type_script_setup_true_lang-D9Ul_GYz.js → DatePicker.vue_vue_type_script_setup_true_lang-BYY2UmPA.js} +1 -1
  46. package/dist-cli-web/assets/{DebugToolsPanel-ByKItGrS.js → DebugToolsPanel-I00RV_Lr.js} +1 -1
  47. package/dist-cli-web/assets/{EChart.vue_vue_type_script_setup_true_lang-DubnuUXI.js → EChart.vue_vue_type_script_setup_true_lang-CRTZh9kh.js} +1 -1
  48. package/dist-cli-web/assets/{EChartBar.vue_vue_type_script_setup_true_lang-DKNCZuFm.js → EChartBar.vue_vue_type_script_setup_true_lang-DjDFhnN9.js} +1 -1
  49. package/dist-cli-web/assets/{EChartLine.vue_vue_type_script_setup_true_lang-Fl7xAOSR.js → EChartLine.vue_vue_type_script_setup_true_lang-BLqlW9E4.js} +1 -1
  50. package/dist-cli-web/assets/{EChartWordcloud-C6XM4KOX.js → EChartWordcloud-ChKJM8bU.js} +1 -1
  51. package/dist-cli-web/assets/{FileDropZone.vue_vue_type_script_setup_true_lang-DYDdRSNE.js → FileDropZone.vue_vue_type_script_setup_true_lang-CsRmQhVQ.js} +1 -1
  52. package/dist-cli-web/assets/{Filter-CByj_rCR.js → Filter-Duzxgudo.js} +1 -1
  53. package/dist-cli-web/assets/{GlobalTaskBar-BdELjzrs.js → GlobalTaskBar-DL0IJxlt.js} +1 -1
  54. package/dist-cli-web/assets/{GroupRelationshipGalaxyView-CnzPEgUS.js → GroupRelationshipGalaxyView-BZrB2o2g.js} +1 -1
  55. package/dist-cli-web/assets/{Label-DCIcxkhU.js → Label-CaVKlQnJ.js} +1 -1
  56. package/dist-cli-web/assets/{LoadingState.vue_vue_type_script_setup_true_lang-BBcCt_Qm.js → LoadingState.vue_vue_type_script_setup_true_lang-uF54r-dT.js} +1 -1
  57. package/dist-cli-web/assets/{MessageExportModal-DNU16Bs8.js → MessageExportModal-JpurBsUW.js} +1 -1
  58. package/dist-cli-web/assets/{PageHeader-CKeZjNNR.js → PageHeader-BciykZ_-.js} +1 -1
  59. package/dist-cli-web/assets/{PageTabs.vue_vue_type_script_setup_true_lang-C8M3wNNH.js → PageTabs.vue_vue_type_script_setup_true_lang-2Xe2iUFO.js} +1 -1
  60. package/dist-cli-web/assets/{RelationshipGalaxyCanvas-CDhljGyJ.js → RelationshipGalaxyCanvas-BO5-MowG.js} +3 -3
  61. package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-BP8fsvvf.js → RelationshipGalaxyThreeCanvas-Dp4CcWU5.js} +1 -1
  62. package/dist-cli-web/assets/{RenderTargetSystem-D76QrDT_.js → RenderTargetSystem-CfuoUG_y.js} +1 -1
  63. package/dist-cli-web/assets/{RovingFocusItem-BJMUQ5DJ.js → RovingFocusItem-FpYwYEP_.js} +1 -1
  64. package/dist-cli-web/assets/{ScreenCaptureModal-DkX4z-M1.js → ScreenCaptureModal-cElYPaSj.js} +1 -1
  65. package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-pVQMbTsj.js +1 -0
  66. package/dist-cli-web/assets/{Select-B5oJc5y1.js → Select-H8Fz6RkU.js} +1 -1
  67. package/dist-cli-web/assets/{SettingsModal-BO-QKQ2h.js → SettingsModal-52Fw4fVW.js} +2 -2
  68. package/dist-cli-web/assets/{StorageTab-CPPXXaRm.js → StorageTab-BnugE5BO.js} +1 -1
  69. package/dist-cli-web/assets/{Switch-CDk3LZ4_.js → Switch-K4aqYC4Y.js} +1 -1
  70. package/dist-cli-web/assets/{Tabs-DqWTBV8x.js → Tabs-BXjD45rO.js} +1 -1
  71. package/dist-cli-web/assets/{Tabs-BMq9wODW.js → Tabs-DJ5p8gb6.js} +1 -1
  72. package/dist-cli-web/assets/{ThemeCard.vue_vue_type_script_setup_true_lang-D2outEOV.js → ThemeCard.vue_vue_type_script_setup_true_lang-BLmTpx4f.js} +1 -1
  73. package/dist-cli-web/assets/{TimeSelect.vue_vue_type_script_setup_true_lang-BcflxP_U.js → TimeSelect.vue_vue_type_script_setup_true_lang-geQAlopO.js} +1 -1
  74. package/dist-cli-web/assets/{VisuallyHiddenInput-BAFpkxMI.js → VisuallyHiddenInput-J2KEIQBX.js} +1 -1
  75. package/dist-cli-web/assets/{WebGLRenderer-DjCPvR_O.js → WebGLRenderer-BDFzRniS.js} +1 -1
  76. package/dist-cli-web/assets/{WebGPURenderer-C2B_u03z.js → WebGPURenderer-BKYZyUCZ.js} +1 -1
  77. package/dist-cli-web/assets/aiChat-CdJzpNYW.js +8 -0
  78. package/dist-cli-web/assets/{base-F6s0vTrr.js → base-129JztT1.js} +1 -1
  79. package/dist-cli-web/assets/{browserAll-DiUAZg4L.js → browserAll-CZNZDK1i.js} +1 -1
  80. package/dist-cli-web/assets/{chatMessages-Bd33SSXI.js → chatMessages-zmzHCUCy.js} +3 -3
  81. package/dist-cli-web/assets/{cli-web-DoibEdj2.js → cli-web-_WGCg-ZY.js} +1 -1
  82. package/dist-cli-web/assets/{fetch-CXM-cjDS.js → fetch-B7Tdp7Uo.js} +1 -1
  83. package/dist-cli-web/assets/{fetch-DBpDMy29.js → fetch-BBdyPNj3.js} +1 -1
  84. package/dist-cli-web/assets/{fetch-B_YFABxI.js → fetch-Bafz8jLM.js} +1 -1
  85. package/dist-cli-web/assets/{fetch-CxVcHNid.js → fetch-C4W6tD-D.js} +1 -1
  86. package/dist-cli-web/assets/{fetch-BeX69kpS.js → fetch-DOsmgros.js} +1 -1
  87. package/dist-cli-web/assets/{fetch-CRocA-4C.js → fetch-DTPDtL38.js} +1 -1
  88. package/dist-cli-web/assets/{fetch-CXqeAbnY.js → fetch-DaeoNUip.js} +1 -1
  89. package/dist-cli-web/assets/{fetch-7lUvXbhU.js → fetch-DgHdAlO7.js} +1 -1
  90. package/dist-cli-web/assets/{fetch-DKBBS9Op.js → fetch-Di4QpfqL.js} +1 -1
  91. package/dist-cli-web/assets/{fetch-4nh1LaVF.js → fetch-Dw33HaVP.js} +11 -13
  92. package/dist-cli-web/assets/{fetch-BEaW1j5H.js → fetch-IP6i-mtr.js} +1 -1
  93. package/dist-cli-web/assets/{fetch-epFXmPIQ.js → fetch-sbr95ipd.js} +1 -1
  94. package/dist-cli-web/assets/{host-CtSqR_Zm.js → host-CMnAiJSx.js} +1 -1
  95. package/dist-cli-web/assets/{host-C4rU8pKA.js → host-CuuNLUWx.js} +1 -1
  96. package/dist-cli-web/assets/{index-ekvsNmfe.js → index-BBYtZa7g.js} +1 -1
  97. package/dist-cli-web/assets/{index-mXe1LssU.js → index-BOXh7X5Y.js} +1 -1
  98. package/dist-cli-web/assets/index-BepItDCQ.js +64 -0
  99. package/dist-cli-web/assets/{index-4DVZ2g0M.js → index-BmGA3geF.js} +1 -1
  100. package/dist-cli-web/assets/{index-BvMAw3Zd.js → index-C-u3l4Uh.js} +1 -1
  101. package/dist-cli-web/assets/{index-D8cHMqV-.js → index-CN9WMxb3.js} +2 -2
  102. package/dist-cli-web/assets/{index-BFH1j_R9.js → index-Chh0gCp7.js} +1 -1
  103. package/dist-cli-web/assets/index-DRFMz0cs.css +1 -0
  104. package/dist-cli-web/assets/{index-BgelKQTW.css → index-DbP9vQhR.css} +1 -1
  105. package/dist-cli-web/assets/index-DgCXdbsG.js +2 -0
  106. package/dist-cli-web/assets/{index-CuCQ1d9f.js → index-DhRaZS6z.js} +1 -1
  107. package/dist-cli-web/assets/{index-_m1mf1jm.js → index-Dz4yfeg6.js} +1 -1
  108. package/dist-cli-web/assets/{index-mbLXPIyC.js → index-EtteazuD.js} +1 -1
  109. package/dist-cli-web/assets/index-GNMlsoVH.js +137 -0
  110. package/dist-cli-web/assets/{index-B1oj9KDv.js → index-bQ9oj54q.js} +4 -4
  111. package/dist-cli-web/assets/{index-DlHuILT_.js → index-fsLAooCi.js} +1 -1
  112. package/dist-cli-web/assets/{people-page-header-BbYSSpsO.js → people-page-header-CKXRSnpl.js} +1 -1
  113. package/dist-cli-web/assets/{prompt-C-ofJ7t_.js → prompt-DNxAd1Bj.js} +1 -1
  114. package/dist-cli-web/assets/{semantic-index-config-builder-D3TYVYC-.js → semantic-index-config-builder-CQ27G4TK.js} +1 -1
  115. package/dist-cli-web/assets/{service-CppETV4a.js → service-BwbGKwDn.js} +1 -1
  116. package/dist-cli-web/assets/service-DQjyjQZx.js +1 -0
  117. package/dist-cli-web/assets/service-Dtve_40X.js +1 -0
  118. package/dist-cli-web/assets/useFormControl-CNmp_2bd.js +1 -0
  119. package/dist-cli-web/assets/{ActionToolsPanel.vue_vue_type_script_setup_true_lang-IB1yZxCE.js → useInsightTabAnalytics-DaU_ADbQ.js} +8 -8
  120. package/dist-cli-web/assets/{useTable-Clk7ecq-.js → useTable-BYXxnZMd.js} +1 -1
  121. package/dist-cli-web/assets/{useToast-B5LaA6c-.js → useToast-DPkgv34s.js} +1 -1
  122. package/dist-cli-web/assets/{webworkerAll-CyA4b4LT.js → webworkerAll-Um4PrCaA.js} +1 -1
  123. package/dist-cli-web/index.html +1 -1
  124. package/package.json +1 -1
  125. package/dist/chat-command-YAFRLHMQ.mjs.map +0 -1
  126. package/dist/chunk-73TJ2S7W.mjs.map +0 -1
  127. package/dist/chunk-ARIBCH47.mjs.map +0 -1
  128. package/dist/chunk-JWJREWVN.mjs.map +0 -1
  129. package/dist/chunk-OTYNMDDL.mjs.map +0 -1
  130. package/dist/chunk-UP6JIV3S.mjs.map +0 -1
  131. package/dist/mcp-SMF3NWIN.mjs.map +0 -1
  132. package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-qFhJO5B0.js +0 -1
  133. package/dist-cli-web/assets/aiChat--CR4g2M7.js +0 -8
  134. package/dist-cli-web/assets/index-CIIyg_o9.css +0 -1
  135. package/dist-cli-web/assets/index-CaYtkONV.js +0 -64
  136. package/dist-cli-web/assets/index-D3Hyjv4e.js +0 -137
  137. package/dist-cli-web/assets/index-R4LqAnx9.js +0 -2
  138. package/dist-cli-web/assets/service-BYOUkk7V.js +0 -1
  139. package/dist-cli-web/assets/service-tEx-5LUL.js +0 -1
  140. package/dist-cli-web/assets/useFormControl-CrWi_6Hn.js +0 -1
  141. /package/dist/{chunk-FPVRSXQ4.mjs.map → chunk-4FAEB4C2.mjs.map} +0 -0
  142. /package/dist/{chunk-MMTEGUQA.mjs.map → chunk-5OA4QI3Q.mjs.map} +0 -0
  143. /package/dist/{chunk-PDQV4RUA.mjs.map → chunk-GDKQKHJT.mjs.map} +0 -0
  144. /package/dist/{chunk-GKCIRKOH.mjs.map → chunk-HJWBFHNR.mjs.map} +0 -0
  145. /package/dist/{chunk-2PY4XCH3.mjs.map → chunk-IMJVOODY.mjs.map} +0 -0
  146. /package/dist/{chunk-WDLO7OLX.mjs.map → chunk-O57SQSCO.mjs.map} +0 -0
  147. /package/dist/{chunk-N4SB6QZV.mjs.map → chunk-ZGXXAPLX.mjs.map} +0 -0
  148. /package/dist/{http-LPFPVTBC.mjs.map → http-QJDZKDNJ.mjs.map} +0 -0
  149. /package/dist/{import-T4WX2ZJL.mjs.map → import-XK6YM26A.mjs.map} +0 -0
  150. /package/dist/{src-EGLLMTAU.mjs.map → src-4AHJUFCW.mjs.map} +0 -0
  151. /package/dist/{stream-import-2BXJTTCE.mjs.map → stream-import-7VQVT5ST.mjs.map} +0 -0
  152. /package/dist/{worker-runtime-RDLSPXFT.mjs.map → worker-runtime-PQBAV75N.mjs.map} +0 -0
  153. /package/dist-cli-web/assets/{ActionToolsPanel-DDNXXH8v.css → useInsightTabAnalytics-DDNXXH8v.css} +0 -0
@@ -1 +1 @@
1
- import{_ as D}from"./Switch-CDk3LZ4_.js";import{d as j,a6 as z,ay as B,ab as L,J as M,az as N,aA as F,b as h,x as I,o as x,c as f,a as e,z as r,a7 as R,a9 as i,p as a,g as s,w as v,n as $,a8 as H,l as J,aB as d,aC as O}from"./index-B1oj9KDv.js";import{u as P}from"./useToast-B5LaA6c-.js";import"./Label-DCIcxkhU.js";import"./useFormControl-CrWi_6Hn.js";import"./VisuallyHiddenInput-BAFpkxMI.js";import"./vendor-snapdom--nZvo8Sg.js";const q={class:"space-y-6 pr-1"},G={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},K={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},Q={class:"flex items-center justify-between"},W={class:"flex items-center gap-3"},X={class:"flex h-12 w-12 items-center justify-center rounded-xl bg-linear-to-br from-pink-500 to-pink-600"},Y={class:"text-xs text-gray-500 dark:text-gray-400"},Z={class:"mt-1 text-xs text-gray-400"},ee={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},te={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},se={class:"flex items-center justify-between"},oe={class:"text-sm font-medium text-gray-900 dark:text-white"},ae={class:"text-xs text-gray-500 dark:text-gray-400"},re={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},ne={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},ie={class:"flex items-center justify-between"},ce={class:"text-sm font-medium text-gray-900 dark:text-white"},le={class:"text-xs text-gray-500 dark:text-gray-400"},de={key:0},ue={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},ge={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},me={class:"flex items-center justify-between"},he={class:"text-sm font-medium text-gray-900 dark:text-white"},ke=j({__name:"AboutTab",setup(be){const{t}=z(),u=P(),w=B(),b=L(),k=M(),p=N(),{debugMode:U}=F(b),S=p.isAuthenticated;function V(){k.closeSettings(),p.logout(),w.push({name:"login"})}const g=h(t("common.loading")),c=h(!1),m=h(!0);async function C(){try{g.value=await d().getVersion()}catch(o){console.error("Failed to get version:",o),g.value=t("settings.about.unknown")}}async function A(){try{m.value=await d().getAnalyticsEnabled()}catch(o){console.error("Failed to get analytics status:",o)}}async function E(o){try{await d().setAnalyticsEnabled(o),m.value=o}catch(l){console.error("Failed to set analytics:",l)}}async function T(){c.value=!0;try{const o=await d().checkUpdate();if(!o)return;o.error?u.fail(t("settings.about.updateCheckFailed",{error:o.error})):o.hasUpdate?u.success(t("settings.about.newVersionAvailable",{version:o.latestVersion}),{duration:15e3,description:O?void 0:t("settings.about.webUpdateHint")}):u.success(t("settings.about.upToDate"))}catch(o){console.error("Update check failed:",o)}finally{c.value=!1}}return I(()=>{C(),A()}),(o,l)=>{const n=R,_=H,y=D;return x(),f("div",q,[e("div",null,[e("h3",G,[r(n,{name:"i-heroicons-information-circle",class:"h-4 w-4 text-blue-500"}),i(" "+a(s(t)("settings.about.title")),1)]),e("div",K,[e("div",Q,[e("div",W,[e("div",X,[r(n,{name:"i-heroicons-chat-bubble-left-right",class:"h-6 w-6 text-white"})]),e("div",null,[l[0]||(l[0]=e("p",{class:"text-sm font-semibold text-gray-900 dark:text-white"},"ChatLab",-1)),e("p",Y,a(s(t)("settings.about.description")),1),e("p",Z,a(s(t)("settings.about.version"))+" "+a(g.value),1)])]),r(_,{disabled:c.value,color:"primary",variant:"soft",size:"sm",onClick:T},{default:v(()=>[r(n,{name:"i-heroicons-arrow-path",class:$(["mr-1 h-4 w-4",{"animate-spin":c.value}])},null,8,["class"]),i(" "+a(c.value?s(t)("settings.about.checking"):s(t)("settings.about.checkUpdate")),1)]),_:1},8,["disabled"])])])]),e("div",null,[e("h3",ee,[r(n,{name:"i-heroicons-shield-check",class:"h-4 w-4 text-purple-500"}),i(" "+a(s(t)("settings.about.privacy.title")),1)]),e("div",te,[e("div",se,[e("div",null,[e("p",oe,a(s(t)("settings.about.privacy.analytics")),1),e("p",ae,a(s(t)("settings.about.privacy.analyticsDesc")),1)]),r(y,{"model-value":m.value,"onUpdate:modelValue":E},null,8,["model-value"])])])]),e("div",null,[e("h3",re,[r(n,{name:"i-heroicons-wrench-screwdriver",class:"h-4 w-4 text-orange-500"}),i(" "+a(s(t)("settings.about.developer.title")),1)]),e("div",ne,[e("div",ie,[e("div",null,[e("p",ce,a(s(t)("settings.about.developer.debugMode")),1),e("p",le,a(s(t)("settings.about.developer.debugModeDesc")),1)]),r(y,{"model-value":s(U),"onUpdate:modelValue":s(b).setDebugMode},null,8,["model-value","onUpdate:modelValue"])])])]),s(S)?(x(),f("div",de,[e("h3",ue,[r(n,{name:"i-heroicons-arrow-right-on-rectangle",class:"h-4 w-4 text-red-500"}),i(" "+a(s(t)("common.login.logoutTitle")),1)]),e("div",ge,[e("div",me,[e("div",null,[e("p",he,a(s(t)("common.login.logoutDesc")),1)]),r(_,{color:"error",variant:"soft",size:"sm",onClick:V},{default:v(()=>[r(n,{name:"i-heroicons-arrow-right-on-rectangle",class:"mr-1 h-4 w-4"}),i(" "+a(s(t)("common.login.logout")),1)]),_:1})])])])):J("",!0)])}}});export{ke as default};
1
+ import{_ as D}from"./Switch-K4aqYC4Y.js";import{d as j,a6 as z,ay as B,ab as L,J as M,az as N,aA as F,b as h,x as I,o as x,c as f,a as e,z as r,a7 as R,a9 as i,p as a,g as s,w as v,n as $,a8 as H,l as J,aB as d,aC as O}from"./index-bQ9oj54q.js";import{u as P}from"./useToast-DPkgv34s.js";import"./Label-CaVKlQnJ.js";import"./useFormControl-CNmp_2bd.js";import"./VisuallyHiddenInput-J2KEIQBX.js";import"./vendor-snapdom--nZvo8Sg.js";const q={class:"space-y-6 pr-1"},G={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},K={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},Q={class:"flex items-center justify-between"},W={class:"flex items-center gap-3"},X={class:"flex h-12 w-12 items-center justify-center rounded-xl bg-linear-to-br from-pink-500 to-pink-600"},Y={class:"text-xs text-gray-500 dark:text-gray-400"},Z={class:"mt-1 text-xs text-gray-400"},ee={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},te={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},se={class:"flex items-center justify-between"},oe={class:"text-sm font-medium text-gray-900 dark:text-white"},ae={class:"text-xs text-gray-500 dark:text-gray-400"},re={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},ne={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},ie={class:"flex items-center justify-between"},ce={class:"text-sm font-medium text-gray-900 dark:text-white"},le={class:"text-xs text-gray-500 dark:text-gray-400"},de={key:0},ue={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},ge={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},me={class:"flex items-center justify-between"},he={class:"text-sm font-medium text-gray-900 dark:text-white"},ke=j({__name:"AboutTab",setup(be){const{t}=z(),u=P(),w=B(),b=L(),k=M(),p=N(),{debugMode:U}=F(b),S=p.isAuthenticated;function V(){k.closeSettings(),p.logout(),w.push({name:"login"})}const g=h(t("common.loading")),c=h(!1),m=h(!0);async function C(){try{g.value=await d().getVersion()}catch(o){console.error("Failed to get version:",o),g.value=t("settings.about.unknown")}}async function A(){try{m.value=await d().getAnalyticsEnabled()}catch(o){console.error("Failed to get analytics status:",o)}}async function E(o){try{await d().setAnalyticsEnabled(o),m.value=o}catch(l){console.error("Failed to set analytics:",l)}}async function T(){c.value=!0;try{const o=await d().checkUpdate();if(!o)return;o.error?u.fail(t("settings.about.updateCheckFailed",{error:o.error})):o.hasUpdate?u.success(t("settings.about.newVersionAvailable",{version:o.latestVersion}),{duration:15e3,description:O?void 0:t("settings.about.webUpdateHint")}):u.success(t("settings.about.upToDate"))}catch(o){console.error("Update check failed:",o)}finally{c.value=!1}}return I(()=>{C(),A()}),(o,l)=>{const n=R,_=H,y=D;return x(),f("div",q,[e("div",null,[e("h3",G,[r(n,{name:"i-heroicons-information-circle",class:"h-4 w-4 text-blue-500"}),i(" "+a(s(t)("settings.about.title")),1)]),e("div",K,[e("div",Q,[e("div",W,[e("div",X,[r(n,{name:"i-heroicons-chat-bubble-left-right",class:"h-6 w-6 text-white"})]),e("div",null,[l[0]||(l[0]=e("p",{class:"text-sm font-semibold text-gray-900 dark:text-white"},"ChatLab",-1)),e("p",Y,a(s(t)("settings.about.description")),1),e("p",Z,a(s(t)("settings.about.version"))+" "+a(g.value),1)])]),r(_,{disabled:c.value,color:"primary",variant:"soft",size:"sm",onClick:T},{default:v(()=>[r(n,{name:"i-heroicons-arrow-path",class:$(["mr-1 h-4 w-4",{"animate-spin":c.value}])},null,8,["class"]),i(" "+a(c.value?s(t)("settings.about.checking"):s(t)("settings.about.checkUpdate")),1)]),_:1},8,["disabled"])])])]),e("div",null,[e("h3",ee,[r(n,{name:"i-heroicons-shield-check",class:"h-4 w-4 text-purple-500"}),i(" "+a(s(t)("settings.about.privacy.title")),1)]),e("div",te,[e("div",se,[e("div",null,[e("p",oe,a(s(t)("settings.about.privacy.analytics")),1),e("p",ae,a(s(t)("settings.about.privacy.analyticsDesc")),1)]),r(y,{"model-value":m.value,"onUpdate:modelValue":E},null,8,["model-value"])])])]),e("div",null,[e("h3",re,[r(n,{name:"i-heroicons-wrench-screwdriver",class:"h-4 w-4 text-orange-500"}),i(" "+a(s(t)("settings.about.developer.title")),1)]),e("div",ne,[e("div",ie,[e("div",null,[e("p",ce,a(s(t)("settings.about.developer.debugMode")),1),e("p",le,a(s(t)("settings.about.developer.debugModeDesc")),1)]),r(y,{"model-value":s(U),"onUpdate:modelValue":s(b).setDebugMode},null,8,["model-value","onUpdate:modelValue"])])])]),s(S)?(x(),f("div",de,[e("h3",ue,[r(n,{name:"i-heroicons-arrow-right-on-rectangle",class:"h-4 w-4 text-red-500"}),i(" "+a(s(t)("common.login.logoutTitle")),1)]),e("div",ge,[e("div",me,[e("div",null,[e("p",he,a(s(t)("common.login.logoutDesc")),1)]),r(_,{color:"error",variant:"soft",size:"sm",onClick:V},{default:v(()=>[r(n,{name:"i-heroicons-arrow-right-on-rectangle",class:"mr-1 h-4 w-4"}),i(" "+a(s(t)("common.login.logout")),1)]),_:1})])])])):J("",!0)])}}});export{ke as default};
@@ -1 +1 @@
1
- import{ar as S,as as C,at as j,o as a,f as l,w as B,r as c,g as r,au as V,m as d,a7 as P,n as s,l as o,a as A,c as u,a9 as m,p as x,F as b,j as w,a8 as p,P as N,e as O,av as F,aw as h}from"./index-B1oj9KDv.js";const I={slots:{root:"relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5",wrapper:"min-w-0 flex-1 flex flex-col",title:"text-sm font-medium",description:"text-sm opacity-90",icon:"shrink-0 size-5",avatar:"shrink-0",avatarSize:"2xl",actions:"flex flex-wrap gap-1.5 shrink-0",close:"p-0"},variants:{color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{solid:"",outline:"",soft:"",subtle:""},orientation:{horizontal:{root:"items-center",actions:"items-center"},vertical:{root:"items-start",actions:"items-start mt-2.5"}},title:{true:{description:"mt-1"}}},compoundVariants:[{color:"primary",variant:"solid",class:{root:"bg-primary text-inverted"}},{color:"secondary",variant:"solid",class:{root:"bg-secondary text-inverted"}},{color:"success",variant:"solid",class:{root:"bg-success text-inverted"}},{color:"info",variant:"solid",class:{root:"bg-info text-inverted"}},{color:"warning",variant:"solid",class:{root:"bg-warning text-inverted"}},{color:"error",variant:"solid",class:{root:"bg-error text-inverted"}},{color:"primary",variant:"outline",class:{root:"text-primary ring ring-inset ring-primary/25"}},{color:"secondary",variant:"outline",class:{root:"text-secondary ring ring-inset ring-secondary/25"}},{color:"success",variant:"outline",class:{root:"text-success ring ring-inset ring-success/25"}},{color:"info",variant:"outline",class:{root:"text-info ring ring-inset ring-info/25"}},{color:"warning",variant:"outline",class:{root:"text-warning ring ring-inset ring-warning/25"}},{color:"error",variant:"outline",class:{root:"text-error ring ring-inset ring-error/25"}},{color:"primary",variant:"soft",class:{root:"bg-primary/10 text-primary"}},{color:"secondary",variant:"soft",class:{root:"bg-secondary/10 text-secondary"}},{color:"success",variant:"soft",class:{root:"bg-success/10 text-success"}},{color:"info",variant:"soft",class:{root:"bg-info/10 text-info"}},{color:"warning",variant:"soft",class:{root:"bg-warning/10 text-warning"}},{color:"error",variant:"soft",class:{root:"bg-error/10 text-error"}},{color:"primary",variant:"subtle",class:{root:"bg-primary/10 text-primary ring ring-inset ring-primary/25"}},{color:"secondary",variant:"subtle",class:{root:"bg-secondary/10 text-secondary ring ring-inset ring-secondary/25"}},{color:"success",variant:"subtle",class:{root:"bg-success/10 text-success ring ring-inset ring-success/25"}},{color:"info",variant:"subtle",class:{root:"bg-info/10 text-info ring ring-inset ring-info/25"}},{color:"warning",variant:"subtle",class:{root:"bg-warning/10 text-warning ring ring-inset ring-warning/25"}},{color:"error",variant:"subtle",class:{root:"bg-error/10 text-error ring ring-inset ring-error/25"}},{color:"neutral",variant:"solid",class:{root:"text-inverted bg-inverted"}},{color:"neutral",variant:"outline",class:{root:"text-highlighted bg-default ring ring-inset ring-default"}},{color:"neutral",variant:"soft",class:{root:"text-highlighted bg-elevated/50"}},{color:"neutral",variant:"subtle",class:{root:"text-highlighted bg-elevated/50 ring ring-inset ring-accented"}}],defaultVariants:{color:"primary",variant:"solid"}},D={__name:"Alert",props:{as:{type:null,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},orientation:{type:null,required:!1,default:"vertical"},actions:{type:Array,required:!1},close:{type:[Boolean,Object],required:!1},closeIcon:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1}},emits:["update:open"],setup(k,{emit:q}){const z=k,$=q,i=S(),t=C("alert",z),{t:_}=j(),f=F(),e=O(()=>h({extend:h(I),...f.ui?.alert||{}})({color:t.color,variant:t.variant,orientation:t.orientation,title:!!t.title||!!i.title}));return(n,y)=>(a(),l(r(N),{as:r(t).as,"data-orientation":r(t).orientation,"data-slot":"root",class:s(e.value.root({class:[r(t).ui?.root,r(t).class]}))},{default:B(()=>[c(n.$slots,"leading",{ui:e.value},()=>[r(t).avatar?(a(),l(V,d({key:0,size:r(t).ui?.avatarSize||e.value.avatarSize()},r(t).avatar,{"data-slot":"avatar",class:e.value.avatar({class:r(t).ui?.avatar})}),null,16,["size","class"])):r(t).icon?(a(),l(P,{key:1,name:r(t).icon,"data-slot":"icon",class:s(e.value.icon({class:r(t).ui?.icon}))},null,8,["name","class"])):o("",!0)]),A("div",{"data-slot":"wrapper",class:s(e.value.wrapper({class:r(t).ui?.wrapper}))},[r(t).title||i.title?(a(),u("div",{key:0,"data-slot":"title",class:s(e.value.title({class:r(t).ui?.title}))},[c(n.$slots,"title",{},()=>[m(x(r(t).title),1)])],2)):o("",!0),r(t).description||i.description?(a(),u("div",{key:1,"data-slot":"description",class:s(e.value.description({class:r(t).ui?.description}))},[c(n.$slots,"description",{},()=>[m(x(r(t).description),1)])],2)):o("",!0),r(t).orientation==="vertical"&&(r(t).actions?.length||i.actions)?(a(),u("div",{key:2,"data-slot":"actions",class:s(e.value.actions({class:r(t).ui?.actions}))},[c(n.$slots,"actions",{},()=>[(a(!0),u(b,null,w(r(t).actions,(g,v)=>(a(),l(p,d({key:v,size:"xs"},{ref_for:!0},g),null,16))),128))])],2)):o("",!0)],2),r(t).orientation==="horizontal"&&(r(t).actions?.length||i.actions)||r(t).close?(a(),u("div",{key:0,"data-slot":"actions",class:s(e.value.actions({class:r(t).ui?.actions,orientation:"horizontal"}))},[r(t).orientation==="horizontal"&&(r(t).actions?.length||i.actions)?c(n.$slots,"actions",{key:0},()=>[(a(!0),u(b,null,w(r(t).actions,(g,v)=>(a(),l(p,d({key:v,size:"xs"},{ref_for:!0},g),null,16))),128))]):o("",!0),c(n.$slots,"close",{ui:e.value},()=>[r(t).close?(a(),l(p,d({key:0,icon:r(t).closeIcon||r(f).ui.icons.close,color:"neutral",variant:"link","aria-label":r(_)("alert.close")},typeof r(t).close=="object"?r(t).close:{},{"data-slot":"close",class:e.value.close({class:r(t).ui?.close}),onClick:y[0]||(y[0]=g=>$("update:open",!1))}),null,16,["icon","aria-label","class"])):o("",!0)])],2)):o("",!0)]),_:3},8,["as","data-orientation","class"]))}};export{D as _};
1
+ import{ar as S,as as C,at as j,o as a,f as l,w as B,r as c,g as r,au as V,m as d,a7 as P,n as s,l as o,a as A,c as u,a9 as m,p as x,F as b,j as w,a8 as p,P as N,e as O,av as F,aw as h}from"./index-bQ9oj54q.js";const I={slots:{root:"relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5",wrapper:"min-w-0 flex-1 flex flex-col",title:"text-sm font-medium",description:"text-sm opacity-90",icon:"shrink-0 size-5",avatar:"shrink-0",avatarSize:"2xl",actions:"flex flex-wrap gap-1.5 shrink-0",close:"p-0"},variants:{color:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},variant:{solid:"",outline:"",soft:"",subtle:""},orientation:{horizontal:{root:"items-center",actions:"items-center"},vertical:{root:"items-start",actions:"items-start mt-2.5"}},title:{true:{description:"mt-1"}}},compoundVariants:[{color:"primary",variant:"solid",class:{root:"bg-primary text-inverted"}},{color:"secondary",variant:"solid",class:{root:"bg-secondary text-inverted"}},{color:"success",variant:"solid",class:{root:"bg-success text-inverted"}},{color:"info",variant:"solid",class:{root:"bg-info text-inverted"}},{color:"warning",variant:"solid",class:{root:"bg-warning text-inverted"}},{color:"error",variant:"solid",class:{root:"bg-error text-inverted"}},{color:"primary",variant:"outline",class:{root:"text-primary ring ring-inset ring-primary/25"}},{color:"secondary",variant:"outline",class:{root:"text-secondary ring ring-inset ring-secondary/25"}},{color:"success",variant:"outline",class:{root:"text-success ring ring-inset ring-success/25"}},{color:"info",variant:"outline",class:{root:"text-info ring ring-inset ring-info/25"}},{color:"warning",variant:"outline",class:{root:"text-warning ring ring-inset ring-warning/25"}},{color:"error",variant:"outline",class:{root:"text-error ring ring-inset ring-error/25"}},{color:"primary",variant:"soft",class:{root:"bg-primary/10 text-primary"}},{color:"secondary",variant:"soft",class:{root:"bg-secondary/10 text-secondary"}},{color:"success",variant:"soft",class:{root:"bg-success/10 text-success"}},{color:"info",variant:"soft",class:{root:"bg-info/10 text-info"}},{color:"warning",variant:"soft",class:{root:"bg-warning/10 text-warning"}},{color:"error",variant:"soft",class:{root:"bg-error/10 text-error"}},{color:"primary",variant:"subtle",class:{root:"bg-primary/10 text-primary ring ring-inset ring-primary/25"}},{color:"secondary",variant:"subtle",class:{root:"bg-secondary/10 text-secondary ring ring-inset ring-secondary/25"}},{color:"success",variant:"subtle",class:{root:"bg-success/10 text-success ring ring-inset ring-success/25"}},{color:"info",variant:"subtle",class:{root:"bg-info/10 text-info ring ring-inset ring-info/25"}},{color:"warning",variant:"subtle",class:{root:"bg-warning/10 text-warning ring ring-inset ring-warning/25"}},{color:"error",variant:"subtle",class:{root:"bg-error/10 text-error ring ring-inset ring-error/25"}},{color:"neutral",variant:"solid",class:{root:"text-inverted bg-inverted"}},{color:"neutral",variant:"outline",class:{root:"text-highlighted bg-default ring ring-inset ring-default"}},{color:"neutral",variant:"soft",class:{root:"text-highlighted bg-elevated/50"}},{color:"neutral",variant:"subtle",class:{root:"text-highlighted bg-elevated/50 ring ring-inset ring-accented"}}],defaultVariants:{color:"primary",variant:"solid"}},D={__name:"Alert",props:{as:{type:null,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},icon:{type:null,required:!1},avatar:{type:Object,required:!1},color:{type:null,required:!1},variant:{type:null,required:!1},orientation:{type:null,required:!1,default:"vertical"},actions:{type:Array,required:!1},close:{type:[Boolean,Object],required:!1},closeIcon:{type:null,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1}},emits:["update:open"],setup(k,{emit:q}){const z=k,$=q,i=S(),t=C("alert",z),{t:_}=j(),f=F(),e=O(()=>h({extend:h(I),...f.ui?.alert||{}})({color:t.color,variant:t.variant,orientation:t.orientation,title:!!t.title||!!i.title}));return(n,y)=>(a(),l(r(N),{as:r(t).as,"data-orientation":r(t).orientation,"data-slot":"root",class:s(e.value.root({class:[r(t).ui?.root,r(t).class]}))},{default:B(()=>[c(n.$slots,"leading",{ui:e.value},()=>[r(t).avatar?(a(),l(V,d({key:0,size:r(t).ui?.avatarSize||e.value.avatarSize()},r(t).avatar,{"data-slot":"avatar",class:e.value.avatar({class:r(t).ui?.avatar})}),null,16,["size","class"])):r(t).icon?(a(),l(P,{key:1,name:r(t).icon,"data-slot":"icon",class:s(e.value.icon({class:r(t).ui?.icon}))},null,8,["name","class"])):o("",!0)]),A("div",{"data-slot":"wrapper",class:s(e.value.wrapper({class:r(t).ui?.wrapper}))},[r(t).title||i.title?(a(),u("div",{key:0,"data-slot":"title",class:s(e.value.title({class:r(t).ui?.title}))},[c(n.$slots,"title",{},()=>[m(x(r(t).title),1)])],2)):o("",!0),r(t).description||i.description?(a(),u("div",{key:1,"data-slot":"description",class:s(e.value.description({class:r(t).ui?.description}))},[c(n.$slots,"description",{},()=>[m(x(r(t).description),1)])],2)):o("",!0),r(t).orientation==="vertical"&&(r(t).actions?.length||i.actions)?(a(),u("div",{key:2,"data-slot":"actions",class:s(e.value.actions({class:r(t).ui?.actions}))},[c(n.$slots,"actions",{},()=>[(a(!0),u(b,null,w(r(t).actions,(g,v)=>(a(),l(p,d({key:v,size:"xs"},{ref_for:!0},g),null,16))),128))])],2)):o("",!0)],2),r(t).orientation==="horizontal"&&(r(t).actions?.length||i.actions)||r(t).close?(a(),u("div",{key:0,"data-slot":"actions",class:s(e.value.actions({class:r(t).ui?.actions,orientation:"horizontal"}))},[r(t).orientation==="horizontal"&&(r(t).actions?.length||i.actions)?c(n.$slots,"actions",{key:0},()=>[(a(!0),u(b,null,w(r(t).actions,(g,v)=>(a(),l(p,d({key:v,size:"xs"},{ref_for:!0},g),null,16))),128))]):o("",!0),c(n.$slots,"close",{ui:e.value},()=>[r(t).close?(a(),l(p,d({key:0,icon:r(t).closeIcon||r(f).ui.icons.close,color:"neutral",variant:"link","aria-label":r(_)("alert.close")},typeof r(t).close=="object"?r(t).close:{},{"data-slot":"close",class:e.value.close({class:r(t).ui?.close}),onClick:y[0]||(y[0]=g=>$("update:open",!1))}),null,16,["icon","aria-label","class"])):o("",!0)])],2)):o("",!0)]),_:3},8,["as","data-orientation","class"]))}};export{D as _};
@@ -1,2 +1,2 @@
1
- import{d as re,a6 as de,bj as _e,K as ge,o as i,f as Z,w as b,a as e,p as s,g as t,c as u,F as H,z as o,aq as ve,a9 as g,l as V,aQ as je,aR as ye,a8 as ue,j as ie,n as G,e as I,b as k,aa as xe,bk as Be,a7 as ke,aA as Ne,J as Oe,x as Fe,y as Ke}from"./index-B1oj9KDv.js";import{_ as qe}from"./Switch-CDk3LZ4_.js";import{_ as He}from"./SectionTabs.vue_vue_type_script_setup_true_lang-qFhJO5B0.js";import{_ as We}from"./Checkbox-_eH64bb0.js";import{_ as Je}from"./Tabs-BMq9wODW.js";import"./vendor-snapdom--nZvo8Sg.js";import"./Label-DCIcxkhU.js";import"./useFormControl-CrWi_6Hn.js";import"./VisuallyHiddenInput-BAFpkxMI.js";import"./RovingFocusItem-BJMUQ5DJ.js";function me(D){const a=String(D.type||"").trim().toLowerCase(),f=String(D.id||"").trim().toLowerCase();return a==="group"||f.endsWith("@chatroom")?"group":a==="private"?"private":(a==="channel"||a==="official"||a==="other"||f.startsWith("gh_")||f.includes("@openim")||f.startsWith("weixin")&&f!=="weixin","other")}const Ge={class:"p-6",style:{"min-width":"480px","max-height":"80vh","overflow-y":"auto"}},Ye={class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},Qe={class:"space-y-4"},Xe={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Ze={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},et={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},tt={class:"grid grid-cols-2 gap-3"},st={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},at={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},ot={key:1,class:"rounded-md bg-red-50 p-3 text-xs text-red-600 dark:bg-red-900/20 dark:text-red-400"},lt={key:2},nt={class:"mb-2 flex items-center justify-between"},it={class:"text-xs font-medium text-gray-700 dark:text-gray-300"},rt={class:"mb-3 flex items-center gap-2"},dt={class:"mb-2 flex flex-wrap items-center gap-2"},ut={class:"text-xs text-gray-500 dark:text-gray-400"},ct={class:"inline-flex rounded-lg bg-gray-100 p-0.5 dark:bg-gray-800"},pt=["disabled","onClick"],mt={key:0,class:"max-h-64 overflow-y-auto rounded-lg border border-gray-200 dark:border-gray-600"},gt=["onClick"],vt={class:"min-w-0 flex-1"},xt={class:"flex items-center gap-2 truncate text-sm font-medium text-gray-900 dark:text-white"},bt={key:0,class:"rounded-full bg-green-100 px-1.5 py-0.5 text-[10px] text-green-700 dark:bg-green-900/30 dark:text-green-400"},yt={class:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400"},ft={class:"rounded bg-gray-100 px-1 dark:bg-gray-700"},ht={key:0},_t={key:1,class:"rounded-lg border border-dashed border-gray-200 px-3 py-6 text-center text-xs text-gray-500 dark:border-gray-700 dark:text-gray-400"},kt={key:2,class:"mt-3 flex justify-center"},St={class:"flex justify-end gap-2 pt-2"},fe=200,wt=5e3,he=re({__name:"DataSourceAddModal",props:{open:{type:Boolean},manageSource:{},subscribedRemoteIds:{}},emits:["update:open","sourceAdded","sessionsAdded"],setup(D,{emit:a}){const f=D,h=a,{t:l}=de(),S=_e(),M=I(()=>!!f.manageSource),v=k({name:"",baseUrl:"",token:"",intervalMinutes:60,pullLimit:1e3}),_=k([]),n=k(new Set),T=k(!1),U=k(!1),w=k(!1),E=k(""),P=k(""),N=k(),F=k(!1),R=k(!1),j=k("all");ge(()=>f.open,async d=>{d&&(M.value&&f.manageSource?v.value={name:f.manageSource.name||"",baseUrl:f.manageSource.baseUrl,token:f.manageSource.token,intervalMinutes:f.manageSource.intervalMinutes,pullLimit:f.manageSource.pullLimit}:v.value={name:"",baseUrl:"",token:"",intervalMinutes:60,pullLimit:1e3},_.value=[],n.value=new Set,E.value="",P.value="",N.value=void 0,F.value=!1,R.value=!1,j.value="all",M.value&&await q())},{immediate:!0});const L=I(()=>_.value.filter(d=>me(d)!=="other")),W=I(()=>j.value==="all"?L.value:L.value.filter(d=>me(d)===j.value)),J=I(()=>W.value.filter(d=>!f.subscribedRemoteIds?.has(d.id))),Y=I(()=>J.value.length>0&&J.value.every(d=>n.value.has(d.id))),Q=I(()=>[{value:"all",label:l("settings.api.dataSources.discovery.typeAll")},{value:"private",label:l("settings.api.dataSources.discovery.typePrivate")},{value:"group",label:l("settings.api.dataSources.discovery.typeGroup")}].map(d=>({...d,count:d.value==="all"?L.value.length:L.value.filter(r=>me(r)===d.value).length})));function ee(d){j.value=d}function X(){const d=J.value.map(r=>r.id);if(Y.value){const r=new Set(n.value);for(const z of d)r.delete(z);n.value=r}else n.value=new Set([...n.value,...d])}function K(d){if(f.subscribedRemoteIds?.has(d))return;const r=new Set(n.value);r.has(d)?r.delete(d):r.add(d),n.value=r}function O(){h("update:open",!1)}async function q(){await se({append:!1,resetSelection:!0})}async function B(){await se({append:!1,resetSelection:!0})}async function ae(){!F.value||!N.value||await se({append:!0,resetSelection:!1})}function te(d,r){const z=new Map(d.map(A=>[A.id,A]));for(const A of r)z.set(A.id,A);return[...z.values()]}async function se(d){if(v.value.baseUrl){d.append?U.value=!0:T.value=!0,R.value=!0,E.value="",d.append||(_.value=[],N.value=void 0,F.value=!1,j.value="all",d.resetSelection&&(n.value=new Set));try{const r=await S.fetchRemoteSessions(v.value.baseUrl,v.value.token,{keyword:P.value.trim()||void 0,limit:fe,cursor:d.append?N.value:void 0});if(!d.append&&!r.page&&r.sessions.length>=fe){const z=await S.fetchRemoteSessions(v.value.baseUrl,v.value.token,{keyword:P.value.trim()||void 0,limit:wt});_.value=z.sessions,F.value=!1,N.value=void 0}else _.value=d.append?te(_.value,r.sessions):r.sessions,F.value=!!r.page?.hasMore,N.value=r.page?.nextCursor}catch(r){E.value=r.message||l("settings.api.dataSources.discovery.error")}finally{T.value=!1,U.value=!1}}}async function oe(){if(M.value){if(n.value.size===0||!f.manageSource)return;const d=_.value.filter(r=>n.value.has(r.id)).map(r=>({name:r.name,remoteSessionId:r.id}));h("sessionsAdded",f.manageSource.id,d),O();return}w.value=!0,E.value="";try{await S.fetchRemoteSessions(v.value.baseUrl,v.value.token,{limit:1})}catch(d){E.value=d.message||l("settings.api.dataSources.discovery.connectionCheckFailed");return}finally{w.value=!1}w.value=!0;try{await S.addDataSource({name:v.value.name||void 0,baseUrl:v.value.baseUrl,token:v.value.token,intervalMinutes:v.value.intervalMinutes,pullLimit:v.value.pullLimit||void 0}),h("sourceAdded"),O()}finally{w.value=!1}}function ce(d){return d===void 0?"-":d>=1e4?`${(d/1e4).toFixed(1)}w`:d>=1e3?`${(d/1e3).toFixed(1)}k`:String(d)}return(d,r)=>{const z=ve,A=ue,pe=We,le=xe;return i(),Z(le,{open:D.open,ui:{content:"z-[101]",overlay:"z-[100]"},"onUpdate:open":r[7]||(r[7]=x=>h("update:open",x))},{content:b(()=>[e("div",Ge,[e("h3",Ye,s(M.value?t(l)("settings.api.dataSources.edit.manageSessions"):t(l)("settings.api.dataSources.form.modalTitle")),1),e("div",Qe,[M.value?V("",!0):(i(),u(H,{key:0},[e("div",null,[e("label",Xe,s(t(l)("settings.api.dataSources.form.name")),1),o(z,{modelValue:v.value.name,"onUpdate:modelValue":r[0]||(r[0]=x=>v.value.name=x),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.namePlaceholder")},null,8,["modelValue","placeholder"])]),e("div",null,[e("label",Ze,s(t(l)("settings.api.dataSources.discovery.baseUrl")),1),o(z,{modelValue:v.value.baseUrl,"onUpdate:modelValue":r[1]||(r[1]=x=>v.value.baseUrl=x),class:"w-full",placeholder:t(l)("settings.api.dataSources.discovery.baseUrlPlaceholder")},null,8,["modelValue","placeholder"])]),e("div",null,[e("label",et,[g(s(t(l)("settings.api.dataSources.form.token"))+" ",1),r[8]||(r[8]=e("span",{class:"text-red-500"},"*",-1))]),o(z,{modelValue:v.value.token,"onUpdate:modelValue":r[2]||(r[2]=x=>v.value.token=x),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.tokenPlaceholder")},null,8,["modelValue","placeholder"])]),e("div",tt,[e("div",null,[e("label",st,s(t(l)("settings.api.dataSources.form.interval")),1),o(z,{modelValue:v.value.intervalMinutes,"onUpdate:modelValue":r[3]||(r[3]=x=>v.value.intervalMinutes=x),modelModifiers:{number:!0},type:"number",min:1,class:"w-full"},null,8,["modelValue"])]),e("div",null,[e("label",at,s(t(l)("settings.api.dataSources.form.pullLimit")),1),o(z,{modelValue:v.value.pullLimit,"onUpdate:modelValue":r[4]||(r[4]=x=>v.value.pullLimit=x),modelModifiers:{number:!0},type:"number",min:100,max:1e4,class:"w-full",placeholder:t(l)("settings.api.dataSources.form.pullLimitPlaceholder")},null,8,["modelValue","placeholder"])])])],64)),E.value?(i(),u("div",ot,s(E.value),1)):V("",!0),M.value&&R.value?(i(),u("div",lt,[e("div",nt,[e("span",it,s(t(l)("settings.api.dataSources.discovery.found",{count:L.value.length})),1),e("button",{class:"text-xs text-blue-500 hover:text-blue-700 dark:hover:text-blue-400",onClick:X},s(Y.value?t(l)("settings.api.dataSources.discovery.deselectAll"):t(l)("settings.api.dataSources.discovery.selectAll")),1)]),e("div",rt,[o(z,{modelValue:P.value,"onUpdate:modelValue":r[5]||(r[5]=x=>P.value=x),class:"flex-1",placeholder:t(l)("settings.api.dataSources.discovery.searchPlaceholder"),onKeydown:je(ye(B,["prevent"]),["enter"])},null,8,["modelValue","placeholder","onKeydown"]),o(A,{color:"primary",variant:"soft",loading:T.value,onClick:B},{default:b(()=>[g(s(t(l)("settings.api.dataSources.discovery.search")),1)]),_:1},8,["loading"])]),e("div",dt,[e("span",ut,s(t(l)("settings.api.dataSources.discovery.selectByType")),1),e("div",ct,[(i(!0),u(H,null,ie(Q.value,x=>(i(),u("button",{key:x.value,type:"button",class:G(["rounded-md px-2.5 py-1 text-xs transition-colors",j.value===x.value?"bg-white text-blue-600 shadow-sm dark:bg-gray-700 dark:text-blue-300":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200"]),disabled:x.count===0,onClick:ne=>ee(x.value)},s(x.label)+" ("+s(x.count)+") ",11,pt))),128))])]),L.value.length>0?(i(),u("div",mt,[(i(!0),u(H,null,ie(W.value,x=>(i(),u("div",{key:x.id,class:G(["flex items-center gap-3 border-b border-gray-100 px-3 py-2 last:border-0",D.subscribedRemoteIds?.has(x.id)?"opacity-60":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800"]),onClick:ne=>K(x.id)},[o(pe,{"model-value":D.subscribedRemoteIds?.has(x.id)||n.value.has(x.id),disabled:D.subscribedRemoteIds?.has(x.id),onClick:r[6]||(r[6]=ye(()=>{},["stop"])),"onUpdate:modelValue":ne=>K(x.id)},null,8,["model-value","disabled","onUpdate:modelValue"]),e("div",vt,[e("div",xt,[g(s(x.name)+" ",1),D.subscribedRemoteIds?.has(x.id)?(i(),u("span",bt,s(t(l)("settings.api.dataSources.edit.subscribed")),1)):V("",!0)]),e("div",yt,[e("span",ft,s(x.platform),1),e("span",null,s(x.type),1),x.messageCount!==void 0?(i(),u("span",ht,s(ce(x.messageCount))+" "+s(t(l)("settings.api.dataSources.discovery.messages")),1)):V("",!0)])])],10,gt))),128))])):(i(),u("div",_t,s(t(l)("settings.api.dataSources.discovery.found",{count:0})),1)),F.value?(i(),u("div",kt,[o(A,{color:"neutral",variant:"soft",loading:U.value,onClick:ae},{default:b(()=>[g(s(t(l)("settings.api.dataSources.discovery.loadMore")),1)]),_:1},8,["loading"])])):V("",!0)])):V("",!0),e("div",St,[o(A,{variant:"soft",onClick:O},{default:b(()=>[g(s(t(l)("common.cancel")),1)]),_:1}),M.value?(i(),Z(A,{key:0,color:"primary",disabled:n.value.size===0,onClick:oe},{default:b(()=>[g(s(t(l)("settings.api.dataSources.discovery.subscribe",{count:n.value.size})),1)]),_:1},8,["disabled"])):(i(),Z(A,{key:1,color:"primary",disabled:!v.value.baseUrl||!v.value.token,loading:w.value,onClick:oe},{default:b(()=>[g(s(t(l)("settings.api.dataSources.addBtn")),1)]),_:1},8,["disabled","loading"]))])])])]),_:1},8,["open"])}}}),$t={class:"p-6",style:{"min-width":"420px"}},Ct={class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},Ut={class:"space-y-4"},Vt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Mt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},zt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Dt={class:"grid grid-cols-2 gap-3"},It={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Tt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Lt={class:"flex justify-end gap-2 pt-2"},At=re({__name:"DataSourceEditModal",props:{open:{type:Boolean},dataSource:{}},emits:["update:open","saved"],setup(D,{emit:a}){const f=D,h=a,{t:l}=de(),S=k({name:"",baseUrl:"",token:"",intervalMinutes:60,pullLimit:1e3});ge(()=>f.open,v=>{v&&f.dataSource&&(S.value={name:f.dataSource.name,baseUrl:f.dataSource.baseUrl,token:f.dataSource.token,intervalMinutes:f.dataSource.intervalMinutes,pullLimit:f.dataSource.pullLimit})});function M(){h("saved",{name:S.value.name,baseUrl:S.value.baseUrl,token:S.value.token,intervalMinutes:S.value.intervalMinutes,pullLimit:S.value.pullLimit}),h("update:open",!1)}return(v,_)=>{const n=ve,T=ue,U=xe;return i(),Z(U,{open:D.open,ui:{content:"z-[101]",overlay:"z-[100]"},"onUpdate:open":_[6]||(_[6]=w=>h("update:open",w))},{content:b(()=>[e("div",$t,[e("h3",Ct,s(t(l)("settings.api.dataSources.edit.title")),1),e("div",Ut,[e("div",null,[e("label",Vt,s(t(l)("settings.api.dataSources.form.name")),1),o(n,{modelValue:S.value.name,"onUpdate:modelValue":_[0]||(_[0]=w=>S.value.name=w),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.namePlaceholder")},null,8,["modelValue","placeholder"])]),e("div",null,[e("label",Mt,s(t(l)("settings.api.dataSources.discovery.baseUrl")),1),o(n,{modelValue:S.value.baseUrl,"onUpdate:modelValue":_[1]||(_[1]=w=>S.value.baseUrl=w),class:"w-full",placeholder:"https://example.com"},null,8,["modelValue"])]),e("div",null,[e("label",zt,s(t(l)("settings.api.dataSources.form.token")),1),o(n,{modelValue:S.value.token,"onUpdate:modelValue":_[2]||(_[2]=w=>S.value.token=w),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.tokenPlaceholder")},null,8,["modelValue","placeholder"])]),e("div",Dt,[e("div",null,[e("label",It,s(t(l)("settings.api.dataSources.form.interval")),1),o(n,{modelValue:S.value.intervalMinutes,"onUpdate:modelValue":_[3]||(_[3]=w=>S.value.intervalMinutes=w),modelModifiers:{number:!0},type:"number",min:1,class:"w-full"},null,8,["modelValue"])]),e("div",null,[e("label",Tt,s(t(l)("settings.api.dataSources.form.pullLimit")),1),o(n,{modelValue:S.value.pullLimit,"onUpdate:modelValue":_[4]||(_[4]=w=>S.value.pullLimit=w),modelModifiers:{number:!0},type:"number",min:100,max:1e4,class:"w-full",placeholder:t(l)("settings.api.dataSources.form.pullLimitPlaceholder")},null,8,["modelValue","placeholder"])])]),e("div",Lt,[o(T,{variant:"soft",onClick:_[5]||(_[5]=w=>h("update:open",!1))},{default:b(()=>[g(s(t(l)("settings.api.dataSources.edit.cancel")),1)]),_:1}),o(T,{color:"primary",onClick:M},{default:b(()=>[g(s(t(l)("settings.api.dataSources.edit.save")),1)]),_:1})])])])]),_:1},8,["open"])}}}),Pt={class:"space-y-6 pb-6"},Rt={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},Et={class:"rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800/50"},jt={class:"p-4"},Bt={class:"text-sm text-gray-600 dark:text-gray-300"},Nt={class:"mt-3 flex flex-wrap gap-2"},Ot={class:"inline-flex items-center gap-1.5 rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-medium text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400"},Ft={class:"inline-flex items-center gap-1.5 rounded-full bg-blue-100 px-2.5 py-1 text-xs font-medium text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"},Kt={class:"p-4"},qt={class:"text-sm text-gray-600 dark:text-gray-300"},Ht={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},Wt={class:"rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800/50"},Jt={class:"flex items-center justify-between p-4"},Gt={class:"flex-1 pr-4"},Yt={class:"text-sm font-medium text-gray-900 dark:text-white"},Qt={class:"w-72"},Xt={class:"p-4"},Zt={class:"relative"},es={class:"overflow-x-auto rounded-lg bg-gray-900 p-4 text-xs leading-relaxed text-gray-100 dark:bg-page-dark"},ts={class:"mt-2 text-xs text-gray-500 dark:text-gray-400"},ss={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},as={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},os={class:"space-y-2 text-xs text-gray-600 dark:text-gray-400"},ls={class:"flex items-start gap-2"},ns={class:"flex items-start gap-2"},is={class:"flex items-start gap-2"},rs={class:"flex items-start gap-2"},ds=re({__name:"McpSettingsTab",setup(D){const{t:a}=de(),{copy:f,copied:h}=Be({copiedDuring:2e3}),l=k("claude"),S=I(()=>[{label:"ClaudeCode",value:"claude"},{label:"Codex",value:"codex"},{label:"OpenClaw",value:"openclaw"},{label:a("settings.mcp.clients.other"),value:"other"}]),M=I(()=>{const n=["mcp"];switch(l.value){case"codex":return["[mcp_servers.chatlab]",'command = "clb"',`args = ["${n[0]}"]`].join(`
1
+ import{d as re,a6 as de,bj as _e,K as ge,o as i,f as Z,w as b,a as e,p as s,g as t,c as u,F as H,z as o,aq as ve,a9 as g,l as V,aQ as je,aR as ye,a8 as ue,j as ie,n as G,e as I,b as k,aa as xe,bk as Be,a7 as ke,aA as Ne,J as Oe,x as Fe,y as Ke}from"./index-bQ9oj54q.js";import{_ as qe}from"./Switch-K4aqYC4Y.js";import{_ as He}from"./SectionTabs.vue_vue_type_script_setup_true_lang-pVQMbTsj.js";import{_ as We}from"./Checkbox-CrlY3jiJ.js";import{_ as Je}from"./Tabs-DJ5p8gb6.js";import"./vendor-snapdom--nZvo8Sg.js";import"./Label-CaVKlQnJ.js";import"./useFormControl-CNmp_2bd.js";import"./VisuallyHiddenInput-J2KEIQBX.js";import"./RovingFocusItem-FpYwYEP_.js";function me(D){const a=String(D.type||"").trim().toLowerCase(),f=String(D.id||"").trim().toLowerCase();return a==="group"||f.endsWith("@chatroom")?"group":a==="private"?"private":(a==="channel"||a==="official"||a==="other"||f.startsWith("gh_")||f.includes("@openim")||f.startsWith("weixin")&&f!=="weixin","other")}const Ge={class:"p-6",style:{"min-width":"480px","max-height":"80vh","overflow-y":"auto"}},Ye={class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},Qe={class:"space-y-4"},Xe={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Ze={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},et={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},tt={class:"grid grid-cols-2 gap-3"},st={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},at={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},ot={key:1,class:"rounded-md bg-red-50 p-3 text-xs text-red-600 dark:bg-red-900/20 dark:text-red-400"},lt={key:2},nt={class:"mb-2 flex items-center justify-between"},it={class:"text-xs font-medium text-gray-700 dark:text-gray-300"},rt={class:"mb-3 flex items-center gap-2"},dt={class:"mb-2 flex flex-wrap items-center gap-2"},ut={class:"text-xs text-gray-500 dark:text-gray-400"},ct={class:"inline-flex rounded-lg bg-gray-100 p-0.5 dark:bg-gray-800"},pt=["disabled","onClick"],mt={key:0,class:"max-h-64 overflow-y-auto rounded-lg border border-gray-200 dark:border-gray-600"},gt=["onClick"],vt={class:"min-w-0 flex-1"},xt={class:"flex items-center gap-2 truncate text-sm font-medium text-gray-900 dark:text-white"},bt={key:0,class:"rounded-full bg-green-100 px-1.5 py-0.5 text-[10px] text-green-700 dark:bg-green-900/30 dark:text-green-400"},yt={class:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400"},ft={class:"rounded bg-gray-100 px-1 dark:bg-gray-700"},ht={key:0},_t={key:1,class:"rounded-lg border border-dashed border-gray-200 px-3 py-6 text-center text-xs text-gray-500 dark:border-gray-700 dark:text-gray-400"},kt={key:2,class:"mt-3 flex justify-center"},St={class:"flex justify-end gap-2 pt-2"},fe=200,wt=5e3,he=re({__name:"DataSourceAddModal",props:{open:{type:Boolean},manageSource:{},subscribedRemoteIds:{}},emits:["update:open","sourceAdded","sessionsAdded"],setup(D,{emit:a}){const f=D,h=a,{t:l}=de(),S=_e(),M=I(()=>!!f.manageSource),v=k({name:"",baseUrl:"",token:"",intervalMinutes:60,pullLimit:1e3}),_=k([]),n=k(new Set),T=k(!1),U=k(!1),w=k(!1),E=k(""),P=k(""),N=k(),F=k(!1),R=k(!1),j=k("all");ge(()=>f.open,async d=>{d&&(M.value&&f.manageSource?v.value={name:f.manageSource.name||"",baseUrl:f.manageSource.baseUrl,token:f.manageSource.token,intervalMinutes:f.manageSource.intervalMinutes,pullLimit:f.manageSource.pullLimit}:v.value={name:"",baseUrl:"",token:"",intervalMinutes:60,pullLimit:1e3},_.value=[],n.value=new Set,E.value="",P.value="",N.value=void 0,F.value=!1,R.value=!1,j.value="all",M.value&&await q())},{immediate:!0});const L=I(()=>_.value.filter(d=>me(d)!=="other")),W=I(()=>j.value==="all"?L.value:L.value.filter(d=>me(d)===j.value)),J=I(()=>W.value.filter(d=>!f.subscribedRemoteIds?.has(d.id))),Y=I(()=>J.value.length>0&&J.value.every(d=>n.value.has(d.id))),Q=I(()=>[{value:"all",label:l("settings.api.dataSources.discovery.typeAll")},{value:"private",label:l("settings.api.dataSources.discovery.typePrivate")},{value:"group",label:l("settings.api.dataSources.discovery.typeGroup")}].map(d=>({...d,count:d.value==="all"?L.value.length:L.value.filter(r=>me(r)===d.value).length})));function ee(d){j.value=d}function X(){const d=J.value.map(r=>r.id);if(Y.value){const r=new Set(n.value);for(const z of d)r.delete(z);n.value=r}else n.value=new Set([...n.value,...d])}function K(d){if(f.subscribedRemoteIds?.has(d))return;const r=new Set(n.value);r.has(d)?r.delete(d):r.add(d),n.value=r}function O(){h("update:open",!1)}async function q(){await se({append:!1,resetSelection:!0})}async function B(){await se({append:!1,resetSelection:!0})}async function ae(){!F.value||!N.value||await se({append:!0,resetSelection:!1})}function te(d,r){const z=new Map(d.map(A=>[A.id,A]));for(const A of r)z.set(A.id,A);return[...z.values()]}async function se(d){if(v.value.baseUrl){d.append?U.value=!0:T.value=!0,R.value=!0,E.value="",d.append||(_.value=[],N.value=void 0,F.value=!1,j.value="all",d.resetSelection&&(n.value=new Set));try{const r=await S.fetchRemoteSessions(v.value.baseUrl,v.value.token,{keyword:P.value.trim()||void 0,limit:fe,cursor:d.append?N.value:void 0});if(!d.append&&!r.page&&r.sessions.length>=fe){const z=await S.fetchRemoteSessions(v.value.baseUrl,v.value.token,{keyword:P.value.trim()||void 0,limit:wt});_.value=z.sessions,F.value=!1,N.value=void 0}else _.value=d.append?te(_.value,r.sessions):r.sessions,F.value=!!r.page?.hasMore,N.value=r.page?.nextCursor}catch(r){E.value=r.message||l("settings.api.dataSources.discovery.error")}finally{T.value=!1,U.value=!1}}}async function oe(){if(M.value){if(n.value.size===0||!f.manageSource)return;const d=_.value.filter(r=>n.value.has(r.id)).map(r=>({name:r.name,remoteSessionId:r.id}));h("sessionsAdded",f.manageSource.id,d),O();return}w.value=!0,E.value="";try{await S.fetchRemoteSessions(v.value.baseUrl,v.value.token,{limit:1})}catch(d){E.value=d.message||l("settings.api.dataSources.discovery.connectionCheckFailed");return}finally{w.value=!1}w.value=!0;try{await S.addDataSource({name:v.value.name||void 0,baseUrl:v.value.baseUrl,token:v.value.token,intervalMinutes:v.value.intervalMinutes,pullLimit:v.value.pullLimit||void 0}),h("sourceAdded"),O()}finally{w.value=!1}}function ce(d){return d===void 0?"-":d>=1e4?`${(d/1e4).toFixed(1)}w`:d>=1e3?`${(d/1e3).toFixed(1)}k`:String(d)}return(d,r)=>{const z=ve,A=ue,pe=We,le=xe;return i(),Z(le,{open:D.open,ui:{content:"z-[101]",overlay:"z-[100]"},"onUpdate:open":r[7]||(r[7]=x=>h("update:open",x))},{content:b(()=>[e("div",Ge,[e("h3",Ye,s(M.value?t(l)("settings.api.dataSources.edit.manageSessions"):t(l)("settings.api.dataSources.form.modalTitle")),1),e("div",Qe,[M.value?V("",!0):(i(),u(H,{key:0},[e("div",null,[e("label",Xe,s(t(l)("settings.api.dataSources.form.name")),1),o(z,{modelValue:v.value.name,"onUpdate:modelValue":r[0]||(r[0]=x=>v.value.name=x),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.namePlaceholder")},null,8,["modelValue","placeholder"])]),e("div",null,[e("label",Ze,s(t(l)("settings.api.dataSources.discovery.baseUrl")),1),o(z,{modelValue:v.value.baseUrl,"onUpdate:modelValue":r[1]||(r[1]=x=>v.value.baseUrl=x),class:"w-full",placeholder:t(l)("settings.api.dataSources.discovery.baseUrlPlaceholder")},null,8,["modelValue","placeholder"])]),e("div",null,[e("label",et,[g(s(t(l)("settings.api.dataSources.form.token"))+" ",1),r[8]||(r[8]=e("span",{class:"text-red-500"},"*",-1))]),o(z,{modelValue:v.value.token,"onUpdate:modelValue":r[2]||(r[2]=x=>v.value.token=x),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.tokenPlaceholder")},null,8,["modelValue","placeholder"])]),e("div",tt,[e("div",null,[e("label",st,s(t(l)("settings.api.dataSources.form.interval")),1),o(z,{modelValue:v.value.intervalMinutes,"onUpdate:modelValue":r[3]||(r[3]=x=>v.value.intervalMinutes=x),modelModifiers:{number:!0},type:"number",min:1,class:"w-full"},null,8,["modelValue"])]),e("div",null,[e("label",at,s(t(l)("settings.api.dataSources.form.pullLimit")),1),o(z,{modelValue:v.value.pullLimit,"onUpdate:modelValue":r[4]||(r[4]=x=>v.value.pullLimit=x),modelModifiers:{number:!0},type:"number",min:100,max:1e4,class:"w-full",placeholder:t(l)("settings.api.dataSources.form.pullLimitPlaceholder")},null,8,["modelValue","placeholder"])])])],64)),E.value?(i(),u("div",ot,s(E.value),1)):V("",!0),M.value&&R.value?(i(),u("div",lt,[e("div",nt,[e("span",it,s(t(l)("settings.api.dataSources.discovery.found",{count:L.value.length})),1),e("button",{class:"text-xs text-blue-500 hover:text-blue-700 dark:hover:text-blue-400",onClick:X},s(Y.value?t(l)("settings.api.dataSources.discovery.deselectAll"):t(l)("settings.api.dataSources.discovery.selectAll")),1)]),e("div",rt,[o(z,{modelValue:P.value,"onUpdate:modelValue":r[5]||(r[5]=x=>P.value=x),class:"flex-1",placeholder:t(l)("settings.api.dataSources.discovery.searchPlaceholder"),onKeydown:je(ye(B,["prevent"]),["enter"])},null,8,["modelValue","placeholder","onKeydown"]),o(A,{color:"primary",variant:"soft",loading:T.value,onClick:B},{default:b(()=>[g(s(t(l)("settings.api.dataSources.discovery.search")),1)]),_:1},8,["loading"])]),e("div",dt,[e("span",ut,s(t(l)("settings.api.dataSources.discovery.selectByType")),1),e("div",ct,[(i(!0),u(H,null,ie(Q.value,x=>(i(),u("button",{key:x.value,type:"button",class:G(["rounded-md px-2.5 py-1 text-xs transition-colors",j.value===x.value?"bg-white text-blue-600 shadow-sm dark:bg-gray-700 dark:text-blue-300":"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200"]),disabled:x.count===0,onClick:ne=>ee(x.value)},s(x.label)+" ("+s(x.count)+") ",11,pt))),128))])]),L.value.length>0?(i(),u("div",mt,[(i(!0),u(H,null,ie(W.value,x=>(i(),u("div",{key:x.id,class:G(["flex items-center gap-3 border-b border-gray-100 px-3 py-2 last:border-0",D.subscribedRemoteIds?.has(x.id)?"opacity-60":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800"]),onClick:ne=>K(x.id)},[o(pe,{"model-value":D.subscribedRemoteIds?.has(x.id)||n.value.has(x.id),disabled:D.subscribedRemoteIds?.has(x.id),onClick:r[6]||(r[6]=ye(()=>{},["stop"])),"onUpdate:modelValue":ne=>K(x.id)},null,8,["model-value","disabled","onUpdate:modelValue"]),e("div",vt,[e("div",xt,[g(s(x.name)+" ",1),D.subscribedRemoteIds?.has(x.id)?(i(),u("span",bt,s(t(l)("settings.api.dataSources.edit.subscribed")),1)):V("",!0)]),e("div",yt,[e("span",ft,s(x.platform),1),e("span",null,s(x.type),1),x.messageCount!==void 0?(i(),u("span",ht,s(ce(x.messageCount))+" "+s(t(l)("settings.api.dataSources.discovery.messages")),1)):V("",!0)])])],10,gt))),128))])):(i(),u("div",_t,s(t(l)("settings.api.dataSources.discovery.found",{count:0})),1)),F.value?(i(),u("div",kt,[o(A,{color:"neutral",variant:"soft",loading:U.value,onClick:ae},{default:b(()=>[g(s(t(l)("settings.api.dataSources.discovery.loadMore")),1)]),_:1},8,["loading"])])):V("",!0)])):V("",!0),e("div",St,[o(A,{variant:"soft",onClick:O},{default:b(()=>[g(s(t(l)("common.cancel")),1)]),_:1}),M.value?(i(),Z(A,{key:0,color:"primary",disabled:n.value.size===0,onClick:oe},{default:b(()=>[g(s(t(l)("settings.api.dataSources.discovery.subscribe",{count:n.value.size})),1)]),_:1},8,["disabled"])):(i(),Z(A,{key:1,color:"primary",disabled:!v.value.baseUrl||!v.value.token,loading:w.value,onClick:oe},{default:b(()=>[g(s(t(l)("settings.api.dataSources.addBtn")),1)]),_:1},8,["disabled","loading"]))])])])]),_:1},8,["open"])}}}),$t={class:"p-6",style:{"min-width":"420px"}},Ct={class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},Ut={class:"space-y-4"},Vt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Mt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},zt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Dt={class:"grid grid-cols-2 gap-3"},It={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Tt={class:"mb-1 block text-xs font-medium text-gray-700 dark:text-gray-300"},Lt={class:"flex justify-end gap-2 pt-2"},At=re({__name:"DataSourceEditModal",props:{open:{type:Boolean},dataSource:{}},emits:["update:open","saved"],setup(D,{emit:a}){const f=D,h=a,{t:l}=de(),S=k({name:"",baseUrl:"",token:"",intervalMinutes:60,pullLimit:1e3});ge(()=>f.open,v=>{v&&f.dataSource&&(S.value={name:f.dataSource.name,baseUrl:f.dataSource.baseUrl,token:f.dataSource.token,intervalMinutes:f.dataSource.intervalMinutes,pullLimit:f.dataSource.pullLimit})});function M(){h("saved",{name:S.value.name,baseUrl:S.value.baseUrl,token:S.value.token,intervalMinutes:S.value.intervalMinutes,pullLimit:S.value.pullLimit}),h("update:open",!1)}return(v,_)=>{const n=ve,T=ue,U=xe;return i(),Z(U,{open:D.open,ui:{content:"z-[101]",overlay:"z-[100]"},"onUpdate:open":_[6]||(_[6]=w=>h("update:open",w))},{content:b(()=>[e("div",$t,[e("h3",Ct,s(t(l)("settings.api.dataSources.edit.title")),1),e("div",Ut,[e("div",null,[e("label",Vt,s(t(l)("settings.api.dataSources.form.name")),1),o(n,{modelValue:S.value.name,"onUpdate:modelValue":_[0]||(_[0]=w=>S.value.name=w),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.namePlaceholder")},null,8,["modelValue","placeholder"])]),e("div",null,[e("label",Mt,s(t(l)("settings.api.dataSources.discovery.baseUrl")),1),o(n,{modelValue:S.value.baseUrl,"onUpdate:modelValue":_[1]||(_[1]=w=>S.value.baseUrl=w),class:"w-full",placeholder:"https://example.com"},null,8,["modelValue"])]),e("div",null,[e("label",zt,s(t(l)("settings.api.dataSources.form.token")),1),o(n,{modelValue:S.value.token,"onUpdate:modelValue":_[2]||(_[2]=w=>S.value.token=w),class:"w-full",placeholder:t(l)("settings.api.dataSources.form.tokenPlaceholder")},null,8,["modelValue","placeholder"])]),e("div",Dt,[e("div",null,[e("label",It,s(t(l)("settings.api.dataSources.form.interval")),1),o(n,{modelValue:S.value.intervalMinutes,"onUpdate:modelValue":_[3]||(_[3]=w=>S.value.intervalMinutes=w),modelModifiers:{number:!0},type:"number",min:1,class:"w-full"},null,8,["modelValue"])]),e("div",null,[e("label",Tt,s(t(l)("settings.api.dataSources.form.pullLimit")),1),o(n,{modelValue:S.value.pullLimit,"onUpdate:modelValue":_[4]||(_[4]=w=>S.value.pullLimit=w),modelModifiers:{number:!0},type:"number",min:100,max:1e4,class:"w-full",placeholder:t(l)("settings.api.dataSources.form.pullLimitPlaceholder")},null,8,["modelValue","placeholder"])])]),e("div",Lt,[o(T,{variant:"soft",onClick:_[5]||(_[5]=w=>h("update:open",!1))},{default:b(()=>[g(s(t(l)("settings.api.dataSources.edit.cancel")),1)]),_:1}),o(T,{color:"primary",onClick:M},{default:b(()=>[g(s(t(l)("settings.api.dataSources.edit.save")),1)]),_:1})])])])]),_:1},8,["open"])}}}),Pt={class:"space-y-6 pb-6"},Rt={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},Et={class:"rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800/50"},jt={class:"p-4"},Bt={class:"text-sm text-gray-600 dark:text-gray-300"},Nt={class:"mt-3 flex flex-wrap gap-2"},Ot={class:"inline-flex items-center gap-1.5 rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-medium text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400"},Ft={class:"inline-flex items-center gap-1.5 rounded-full bg-blue-100 px-2.5 py-1 text-xs font-medium text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"},Kt={class:"p-4"},qt={class:"text-sm text-gray-600 dark:text-gray-300"},Ht={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},Wt={class:"rounded-lg border border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800/50"},Jt={class:"flex items-center justify-between p-4"},Gt={class:"flex-1 pr-4"},Yt={class:"text-sm font-medium text-gray-900 dark:text-white"},Qt={class:"w-72"},Xt={class:"p-4"},Zt={class:"relative"},es={class:"overflow-x-auto rounded-lg bg-gray-900 p-4 text-xs leading-relaxed text-gray-100 dark:bg-page-dark"},ts={class:"mt-2 text-xs text-gray-500 dark:text-gray-400"},ss={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},as={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},os={class:"space-y-2 text-xs text-gray-600 dark:text-gray-400"},ls={class:"flex items-start gap-2"},ns={class:"flex items-start gap-2"},is={class:"flex items-start gap-2"},rs={class:"flex items-start gap-2"},ds=re({__name:"McpSettingsTab",setup(D){const{t:a}=de(),{copy:f,copied:h}=Be({copiedDuring:2e3}),l=k("claude"),S=I(()=>[{label:"ClaudeCode",value:"claude"},{label:"Codex",value:"codex"},{label:"OpenClaw",value:"openclaw"},{label:a("settings.mcp.clients.other"),value:"other"}]),M=I(()=>{const n=["mcp"];switch(l.value){case"codex":return["[mcp_servers.chatlab]",'command = "clb"',`args = ["${n[0]}"]`].join(`
2
2
  `);case"openclaw":return JSON.stringify({mcp:{servers:{chatlab:{command:"clb",args:n}}}},null,2);case"claude":return JSON.stringify({mcpServers:{chatlab:{command:"clb",args:n}}},null,2);default:return JSON.stringify({command:"clb",args:n},null,2)}});function v(){f(M.value)}return(_,n)=>{const T=ke,U=Je,w=ue;return i(),u("div",Pt,[e("div",null,[e("h3",Rt,[o(T,{name:"i-heroicons-command-line",class:"h-4 w-4 text-emerald-500"}),g(" "+s(t(a)("settings.mcp.overview.title")),1)]),e("div",Et,[e("div",jt,[e("p",Bt,s(t(a)("settings.mcp.overview.description")),1),e("div",Nt,[e("span",Ot,[n[1]||(n[1]=e("span",{class:"h-1.5 w-1.5 rounded-full bg-emerald-500"},null,-1)),g(" "+s(t(a)("settings.mcp.overview.toolCount",{count:33})),1)]),e("span",Ft,[n[2]||(n[2]=e("span",{class:"h-1.5 w-1.5 rounded-full bg-blue-500"},null,-1)),g(" "+s(t(a)("settings.mcp.overview.resourceCount",{count:3})),1)]),n[3]||(n[3]=e("span",{class:"inline-flex items-center gap-1.5 rounded-full bg-purple-100 px-2.5 py-1 text-xs font-medium text-purple-700 dark:bg-purple-900/30 dark:text-purple-400"},[e("span",{class:"h-1.5 w-1.5 rounded-full bg-purple-500"}),g(" stdio ")],-1))])]),n[5]||(n[5]=e("div",{class:"border-t border-gray-200 dark:border-gray-700"},null,-1)),e("div",Kt,[e("p",qt,s(t(a)("settings.mcp.overview.installHint")),1),n[4]||(n[4]=e("div",{class:"mt-2"},[e("code",{class:"inline-block rounded-md bg-gray-900 px-3 py-1.5 text-xs text-gray-100 dark:bg-page-dark"}," npm install -g chatlab-cli ")],-1))])])]),e("div",null,[e("h3",Ht,[o(T,{name:"i-heroicons-clipboard-document",class:"h-4 w-4 text-pink-500"}),g(" "+s(t(a)("settings.mcp.config.title")),1)]),e("div",Wt,[e("div",Jt,[e("div",Gt,[e("p",Yt,s(t(a)("settings.mcp.config.clientLabel")),1)]),e("div",Qt,[o(U,{modelValue:l.value,"onUpdate:modelValue":n[0]||(n[0]=E=>l.value=E),size:"sm",class:"gap-0",items:S.value},null,8,["modelValue","items"])])]),n[6]||(n[6]=e("div",{class:"border-t border-gray-200 dark:border-gray-700"},null,-1)),e("div",Xt,[e("div",Zt,[e("pre",es,[e("code",null,s(M.value),1)]),o(w,{icon:t(h)?"i-heroicons-check":"i-heroicons-clipboard",color:t(h)?"success":"neutral",variant:"soft",size:"xs",class:"absolute right-2 top-2",onClick:v},{default:b(()=>[g(s(t(h)?t(a)("settings.mcp.config.copied"):t(a)("settings.mcp.config.copy")),1)]),_:1},8,["icon","color"])]),e("p",ts,s(t(a)(`settings.mcp.config.${l.value}Hint`)),1)])])]),e("div",null,[e("h3",ss,[o(T,{name:"i-heroicons-light-bulb",class:"h-4 w-4 text-amber-500"}),g(" "+s(t(a)("settings.mcp.tips.title")),1)]),e("div",as,[e("ul",os,[e("li",ls,[n[7]||(n[7]=e("span",{class:"mt-0.5 text-gray-400"},"•",-1)),g(" "+s(t(a)("settings.mcp.tips.dataDir")),1)]),e("li",ns,[n[8]||(n[8]=e("span",{class:"mt-0.5 text-gray-400"},"•",-1)),g(" "+s(t(a)("settings.mcp.tips.readOnly")),1)]),e("li",is,[n[9]||(n[9]=e("span",{class:"mt-0.5 text-gray-400"},"•",-1)),g(" "+s(t(a)("settings.mcp.tips.nodeRequired")),1)]),e("li",rs,[n[10]||(n[10]=e("span",{class:"mt-0.5 text-gray-400"},"•",-1)),g(" "+s(t(a)("settings.mcp.tips.docs")),1)])])])])])}}}),us={class:"flex h-full flex-col -mx-6 -mt-6"},cs={class:"flex-1 min-h-0 overflow-auto"},ps={class:"space-y-6 px-6 pt-4 pb-6"},ms={key:0},gs={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},vs={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},xs={class:"mb-3 text-xs text-gray-500 dark:text-gray-400"},bs={key:0,class:"mb-4 space-y-4"},ys={class:"flex items-center justify-between border-b border-gray-100 px-3 py-2 dark:border-gray-700"},fs={class:"flex items-center gap-2"},hs={key:0,class:"text-xs font-medium text-gray-700 dark:text-gray-300"},_s={class:"text-xs font-mono text-gray-500 dark:text-gray-400"},ks={key:1,class:"text-xs text-gray-400"},Ss={class:"flex items-center gap-1"},ws={key:0,class:"max-h-80 overflow-y-auto"},$s={class:"flex items-center justify-between"},Cs={class:"flex items-center gap-2"},Us={class:"text-sm font-medium text-gray-900 dark:text-white"},Vs={class:"flex items-center gap-1"},Ms={class:"mt-1 flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400"},zs={key:0,class:"text-blue-500"},Ds={key:1,class:"text-blue-500"},Is={key:2},Ts={class:"text-gray-400"},Ls={key:0,class:"text-green-500"},As={key:1,class:"text-red-500"},Ps={key:1,class:"px-3 py-4 text-center text-xs text-gray-400"},Rs={key:1,class:"mb-4 py-4 text-center text-xs text-gray-400"},Es={key:0},js={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},Bs={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},Ns={class:"flex items-center gap-2"},Os={class:"text-xs text-green-500"},Fs={class:"mt-3 space-y-2 border-t border-gray-200 pt-3 text-xs text-gray-600 dark:border-gray-700 dark:text-gray-400"},Ks={key:0,class:"flex items-center justify-between gap-4"},qs={class:"break-all font-mono text-gray-700 dark:text-gray-300"},Hs={key:1,class:"flex items-center justify-between"},Ws={class:"font-mono text-gray-700 dark:text-gray-300"},Js={key:2,class:"flex items-center justify-between gap-2"},Gs={class:"flex items-center gap-1"},Ys={class:"rounded bg-gray-100 px-2 py-0.5 font-mono text-gray-700 dark:bg-gray-800 dark:text-gray-300"},Qs={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},Xs={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},Zs={class:"flex items-center justify-between"},ea={class:"flex-1 pr-4"},ta={class:"text-sm font-medium text-gray-900 dark:text-white"},sa={class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},aa={key:0,class:"mt-3 flex items-center gap-2 border-t border-gray-200 pt-3 dark:border-gray-700"},oa={key:0,class:"ml-auto text-xs text-gray-500 dark:text-gray-400"},la={key:1,class:"mt-2 rounded-md bg-red-50 p-2 text-xs text-red-600 dark:bg-red-900/20 dark:text-red-400"},na={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},ia={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},ra={class:"flex items-center justify-between"},da={class:"flex-1 pr-4"},ua={class:"text-sm font-medium text-gray-900 dark:text-white"},ca={class:"mt-1 text-xs text-gray-500 dark:text-gray-400"},pa={key:0,class:"flex items-center gap-2"},ma={key:1,class:"flex items-center gap-2"},ga={class:"font-mono text-sm text-gray-700 dark:text-gray-300"},va={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},xa={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},ba={class:"mb-2 text-sm font-medium text-gray-900 dark:text-white"},ya={class:"mb-3 text-xs text-gray-500 dark:text-gray-400"},fa={key:0,class:"flex items-center gap-2"},ha={class:"flex-1 rounded bg-gray-100 px-3 py-2 font-mono text-xs text-gray-700 dark:bg-gray-800 dark:text-gray-300"},_a={key:1,class:"text-xs text-gray-400"},ka={class:"mt-3"},Sa={class:"mt-3 border-t border-gray-200 pt-3 dark:border-gray-700"},wa={class:"text-xs text-gray-500 dark:text-gray-400"},$a={class:"mt-1 rounded bg-gray-100 p-2 font-mono text-xs text-gray-700 dark:bg-gray-800 dark:text-gray-300"},Ca={class:"mb-3 flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white"},Ua={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},Va={class:"text-xs text-gray-600 dark:text-gray-400"},Ma=["href"],za={class:"p-4"},Da={class:"mb-3 font-semibold text-gray-900 dark:text-white"},Ia={class:"mb-4 text-sm text-gray-600 dark:text-gray-400"},Ta={class:"flex justify-end gap-2"},La={class:"p-4"},Aa={class:"mb-3 font-semibold text-gray-900 dark:text-white"},Pa={class:"mb-4 text-sm text-gray-600 dark:text-gray-400"},Ra={class:"flex justify-end gap-2"},Ja=re({__name:"ApiSettingsTab",setup(D){const{t:a,locale:f}=de(),h=_e(),{config:l,status:S,loading:M,isRunning:v,hasError:_,isPortInUse:n,dataSources:T,pullingIds:U,syncProgress:w,isWebMode:E}=Ne(h),P=k("sync"),N=Oe();ge(()=>N.settingsSubTab,c=>{N.settingsTab==="api"&&c&&["sync","api","mcp"].includes(c)&&(P.value=c)},{immediate:!0});const F=I(()=>[{id:"sync",label:a("settings.tabs.apiSubTabs.autoSync"),icon:"i-heroicons-cloud-arrow-down"},{id:"api",label:a("settings.tabs.apiSubTabs.apiService"),icon:"i-heroicons-server-stack"},{id:"mcp",label:a("settings.tabs.apiSubTabs.mcp"),icon:"i-heroicons-command-line"}]),R=k(!1),j=k(!1),L=k(3110),W=k(!1),J=k(!1),Y=k(!1),Q=k(null),ee=k(!1),X=k(null),K=k(!1),O=k(null),q=k(!1),B=k(null);let ae=null;Fe(async()=>{await h.refresh(),L.value=l.value.port,ae=h.listenStartupError()}),Ke(()=>{ae?.()});const te=I(()=>l.value.token?l.value.token.slice(0,8)+"••••••••••••••••":""),se=I(()=>M.value?a("settings.api.status.starting"):v.value?a("settings.api.status.running"):n.value?a("settings.api.status.portInUse"):_.value?a("settings.api.status.error"):a("settings.api.status.stopped")),oe=I(()=>M.value?"text-yellow-500":v.value?"text-green-500":_.value?"text-red-500":"text-gray-400"),ce=I(()=>`http://127.0.0.1:${S.value.port||l.value.port}/api/v1`),d=I(()=>f.value==="zh-CN"||f.value==="zh-TW"?"https://docs.chatlab.fun/cn/standard/chatlab-api":"https://docs.chatlab.fun/en/standard/chatlab-api");async function r(){await h.setEnabled(!l.value.enabled)}async function z(){const c=L.value;c<1024||c>65535||(await h.setPort(c),j.value=!1)}function A(){j.value=!0,L.value=l.value.port}function pe(){L.value=l.value.port,j.value=!1}async function le(){try{await navigator.clipboard.writeText(l.value.token),W.value=!0,setTimeout(()=>{W.value=!1},2e3)}catch{}}async function x(){await h.regenerateToken()}function ne(c){Q.value=c,Y.value=!0}async function Se(c){Q.value&&await h.updateDataSource(Q.value.id,c)}function we(c){X.value=c,ee.value=!0}async function $e(c,p){await h.addImportSessions(c,p)}async function Ce(c){await h.updateDataSource(c.id,{enabled:!c.enabled})}function Ue(c){O.value=c,K.value=!0}async function Ve(){if(!O.value)return;const c=O.value;c.enabled&&await h.updateDataSource(c.id,{enabled:!1}),await h.deleteDataSource(c.id),K.value=!1,O.value=null}function Me(c,p){B.value={ds:c,sess:p},q.value=!0}async function ze(){if(!B.value)return;const{ds:c,sess:p}=B.value;await h.removeImportSession(c.id,p.id,!1),q.value=!1,B.value=null}async function De(){if(!B.value)return;const{ds:c,sess:p}=B.value;await h.removeImportSession(c.id,p.id,!0),q.value=!1,B.value=null}async function Ie(c){await h.triggerPullAll(c.id)}async function Te(c,p){await h.triggerPull(c.id,p.id)}function Le(c){return c?new Date(c*1e3).toLocaleString():"-"}function Ae(c){return new Set(c.sessions.map(p=>p.remoteSessionId))}return(c,p)=>{const $=ke,C=ue,Pe=qe,Re=ve,be=xe;return i(),u("div",us,[o(t(He),{modelValue:P.value,"onUpdate:modelValue":p[0]||(p[0]=m=>P.value=m),items:F.value,"persist-key":"apiSubTab"},null,8,["modelValue","items"]),e("div",cs,[e("div",ps,[P.value==="sync"?(i(),u("div",ms,[e("h3",gs,[o($,{name:"i-heroicons-cloud-arrow-down",class:"h-4 w-4 text-indigo-500"}),g(" "+s(t(a)("settings.api.dataSources.title")),1)]),e("div",vs,[e("p",xs,s(t(a)("settings.api.dataSources.desc")),1),t(T).length>0?(i(),u("div",bs,[(i(!0),u(H,null,ie(t(T),m=>(i(),u("div",{key:m.id,class:"rounded-lg border border-gray-200 bg-white dark:border-gray-600 dark:bg-gray-800"},[e("div",ys,[e("div",fs,[o($,{name:"i-heroicons-server-stack",class:"h-3.5 w-3.5 text-gray-500 dark:text-gray-400"}),m.name?(i(),u("span",hs,s(m.name),1)):V("",!0),e("span",_s,s(m.baseUrl),1),m.enabled?V("",!0):(i(),u("span",ks," ("+s(t(a)("settings.api.dataSources.disabled"))+") ",1))]),e("div",Ss,[o(C,{size:"xs",variant:"ghost",onClick:y=>ne(m)},{default:b(()=>[o($,{name:"i-heroicons-pencil-square",class:"mr-1 h-3.5 w-3.5"}),g(" "+s(t(a)("settings.api.dataSources.edit.editSource")),1)]),_:1},8,["onClick"]),o(C,{size:"xs",variant:"ghost",onClick:y=>we(m)},{default:b(()=>[o($,{name:"i-heroicons-queue-list",class:"mr-1 h-3.5 w-3.5"}),g(" "+s(t(a)("settings.api.dataSources.edit.manageSessions")),1)]),_:1},8,["onClick"]),o(C,{size:"xs",variant:"ghost",onClick:y=>Ce(m)},{default:b(()=>[o($,{name:m.enabled?"i-heroicons-pause":"i-heroicons-play",class:"h-3.5 w-3.5"},null,8,["name"])]),_:2},1032,["onClick"]),o(C,{size:"xs",variant:"ghost",disabled:t(U).has(m.id)||m.sessions.some(y=>t(U).has(y.id)),onClick:y=>Ie(m)},{default:b(()=>[o($,{name:"i-heroicons-arrow-path",class:G(["h-3.5 w-3.5",{"animate-spin":t(U).has(m.id)||m.sessions.some(y=>t(U).has(y.id))}])},null,8,["class"])]),_:2},1032,["disabled","onClick"]),o(C,{size:"xs",variant:"ghost",color:"error",disabled:m.sessions.some(y=>t(U).has(y.id)),onClick:y=>Ue(m)},{default:b(()=>[o($,{name:"i-heroicons-trash",class:"h-3.5 w-3.5"})]),_:1},8,["disabled","onClick"])])]),m.sessions.length>0?(i(),u("div",ws,[(i(!0),u(H,null,ie(m.sessions,y=>(i(),u("div",{key:y.id,class:"border-b border-gray-50 px-3 py-2.5 last:border-0 dark:border-gray-700/50"},[e("div",$s,[e("div",Cs,[e("span",{class:G(["inline-block h-2 w-2 rounded-full",t(U).has(y.id)?"animate-pulse bg-blue-500":y.lastStatus==="success"?"bg-green-500":y.lastStatus==="error"?"bg-red-500":"bg-gray-400"])},null,2),e("span",Us,s(y.name),1)]),e("div",Vs,[o(C,{size:"xs",variant:"ghost",disabled:t(U).has(y.id),onClick:Ee=>Te(m,y)},{default:b(()=>[o($,{name:"i-heroicons-arrow-path",class:G(["h-3.5 w-3.5",{"animate-spin":t(U).has(y.id)}])},null,8,["class"])]),_:2},1032,["disabled","onClick"]),o(C,{size:"xs",variant:"ghost",color:"error",disabled:t(U).has(y.id),onClick:Ee=>Me(m,y)},{default:b(()=>[o($,{name:"i-heroicons-trash",class:"h-3.5 w-3.5"})]),_:1},8,["disabled","onClick"])])]),e("div",Ms,[t(w).get(y.id)?(i(),u("span",zs,s(t(a)("settings.api.dataSources.syncing"))+"... "+s(t(w).get(y.id).current)+" "+s(t(a)("settings.api.dataSources.messages")),1)):t(U).has(y.id)&&!t(w).get(y.id)?(i(),u("span",Ds,s(t(a)("settings.api.dataSources.syncing"))+"...",1)):(i(),u("span",Is,s(t(a)("settings.api.dataSources.every"))+" "+s(m.intervalMinutes)+" "+s(t(a)("settings.api.dataSources.minutes")),1)),!t(U).has(y.id)&&y.lastPullAt?(i(),u(H,{key:3},[p[13]||(p[13]=e("span",{class:"text-gray-300 dark:text-gray-600"},"·",-1)),e("span",Ts,s(t(a)("settings.api.dataSources.lastSync"))+": "+s(Le(y.lastPullAt)),1),y.lastStatus==="success"?(i(),u("span",Ls," (+"+s(y.lastNewMessages)+") ",1)):V("",!0),y.lastStatus==="error"?(i(),u("span",As,s(y.lastError),1)):V("",!0)],64)):V("",!0)])]))),128))])):(i(),u("div",Ps,s(t(a)("settings.api.dataSources.noSessions")),1))]))),128))])):(i(),u("div",Rs,s(t(a)("settings.api.dataSources.empty")),1)),o(C,{variant:"soft",onClick:p[1]||(p[1]=m=>J.value=!0)},{default:b(()=>[o($,{name:"i-heroicons-plus",class:"mr-2 h-4 w-4"}),g(" "+s(t(a)("settings.api.dataSources.addBtn")),1)]),_:1})])])):V("",!0),P.value==="api"?(i(),u(H,{key:1},[t(E)?(i(),u("div",Es,[e("h3",js,[o($,{name:"i-heroicons-server-stack",class:"h-4 w-4 text-blue-500"}),g(" "+s(t(a)("settings.api.service.title")),1)]),e("div",Bs,[e("div",Ns,[p[14]||(p[14]=e("span",{class:"inline-block h-2 w-2 rounded-full bg-green-500"},null,-1)),e("span",Os,s(t(a)("settings.api.status.running")),1)]),e("div",Fs,[t(l).socket?(i(),u("div",Ks,[e("span",null,s(t(a)("settings.api.service.socket")),1),e("span",qs,s(t(l).socket),1)])):(i(),u("div",Hs,[e("span",null,s(t(a)("settings.api.port.label")),1),e("span",Ws,s(t(l).port||"-"),1)])),t(l).token?(i(),u("div",Js,[e("span",null,s(t(a)("settings.api.token.label")),1),e("div",Gs,[e("code",Ys,s(R.value?t(l).token:te.value),1),o(C,{size:"xs",variant:"ghost",onClick:p[2]||(p[2]=m=>R.value=!R.value)},{default:b(()=>[o($,{name:R.value?"i-heroicons-eye-slash":"i-heroicons-eye",class:"h-3.5 w-3.5"},null,8,["name"])]),_:1}),o(C,{size:"xs",variant:"ghost",onClick:le},{default:b(()=>[o($,{name:W.value?"i-heroicons-check":"i-heroicons-clipboard",class:"h-3.5 w-3.5"},null,8,["name"])]),_:1})])])):V("",!0)])])])):(i(),u(H,{key:1},[e("div",null,[e("h3",Qs,[o($,{name:"i-heroicons-server-stack",class:"h-4 w-4 text-blue-500"}),g(" "+s(t(a)("settings.api.service.title")),1)]),e("div",Xs,[e("div",Zs,[e("div",ea,[e("p",ta,s(t(a)("settings.api.service.enable")),1),e("p",sa,s(t(a)("settings.api.service.enableDesc")),1)]),o(Pe,{"model-value":t(l).enabled,loading:t(M),"onUpdate:modelValue":r},null,8,["model-value","loading"])]),t(l).enabled?(i(),u("div",aa,[e("span",{class:G(["inline-block h-2 w-2 rounded-full",t(v)?"bg-green-500":t(_)?"bg-red-500":"bg-gray-400"])},null,2),e("span",{class:G(["text-xs",oe.value])},s(se.value),3),t(v)&&t(S).port?(i(),u("span",oa,s(ce.value),1)):V("",!0)])):V("",!0),t(n)?(i(),u("div",la,s(t(a)("settings.api.service.portInUseHint")),1)):V("",!0)])]),e("div",null,[e("h3",na,[o($,{name:"i-heroicons-globe-alt",class:"h-4 w-4 text-purple-500"}),g(" "+s(t(a)("settings.api.port.title")),1)]),e("div",ia,[e("div",ra,[e("div",da,[e("p",ua,s(t(a)("settings.api.port.label")),1),e("p",ca,s(t(a)("settings.api.port.desc")),1)]),j.value?(i(),u("div",pa,[o(Re,{modelValue:L.value,"onUpdate:modelValue":p[3]||(p[3]=m=>L.value=m),modelModifiers:{number:!0},type:"number",min:1024,max:65535,size:"sm",class:"w-24"},null,8,["modelValue"]),o(C,{size:"xs",color:"primary",loading:t(M),onClick:z},{default:b(()=>[g(s(t(a)("settings.api.port.save")),1)]),_:1},8,["loading"]),o(C,{size:"xs",variant:"ghost",onClick:pe},{default:b(()=>[g(s(t(a)("settings.api.port.cancel")),1)]),_:1})])):(i(),u("div",ma,[e("span",ga,s(t(l).port),1),o(C,{size:"xs",variant:"ghost",onClick:A},{default:b(()=>[g(s(t(a)("settings.api.port.edit")),1)]),_:1})]))])])]),e("div",null,[e("h3",va,[o($,{name:"i-heroicons-key",class:"h-4 w-4 text-amber-500"}),g(" "+s(t(a)("settings.api.token.title")),1)]),e("div",xa,[e("p",ba,s(t(a)("settings.api.token.label")),1),e("p",ya,s(t(a)("settings.api.token.desc")),1),t(l).token?(i(),u("div",fa,[e("code",ha,s(R.value?t(l).token:te.value),1),o(C,{size:"xs",variant:"ghost",onClick:p[4]||(p[4]=m=>R.value=!R.value)},{default:b(()=>[o($,{name:R.value?"i-heroicons-eye-slash":"i-heroicons-eye",class:"h-4 w-4"},null,8,["name"])]),_:1}),o(C,{size:"xs",variant:"ghost",onClick:le},{default:b(()=>[o($,{name:W.value?"i-heroicons-check":"i-heroicons-clipboard",class:"h-4 w-4"},null,8,["name"])]),_:1})])):(i(),u("div",_a,s(t(a)("settings.api.token.noToken")),1)),e("div",ka,[o(C,{variant:"soft",color:"warning",onClick:x},{default:b(()=>[o($,{name:"i-heroicons-arrow-path",class:"mr-1 h-4 w-4"}),g(" "+s(t(a)("settings.api.token.regenerate")),1)]),_:1})]),e("div",Sa,[e("p",wa,s(t(a)("settings.api.usage.authHint")),1),e("div",$a," Authorization: Bearer "+s(t(l).token?te.value:"clb_..."),1)])])])],64)),e("div",null,[e("h3",Ca,[o($,{name:"i-heroicons-book-open",class:"h-4 w-4 text-teal-500"}),g(" "+s(t(a)("settings.api.usage.title")),1)]),e("div",Ua,[e("p",Va,s(t(a)("settings.api.usage.desc")),1),e("a",{href:d.value,target:"_blank",class:"mt-2 inline-flex items-center gap-1 text-xs text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-300"},[o($,{name:"i-heroicons-arrow-top-right-on-square",class:"h-3.5 w-3.5"}),g(" "+s(t(a)("settings.api.usage.docLink")),1)],8,Ma)])])],64)):V("",!0),P.value==="mcp"?(i(),Z(ds,{key:2})):V("",!0)])]),o(he,{open:J.value,"onUpdate:open":p[5]||(p[5]=m=>J.value=m),onSourceAdded:p[6]||(p[6]=m=>t(h).fetchDataSources())},null,8,["open"]),o(At,{open:Y.value,"onUpdate:open":p[7]||(p[7]=m=>Y.value=m),"data-source":Q.value,onSaved:Se},null,8,["open","data-source"]),X.value?(i(),Z(he,{key:0,open:ee.value,"onUpdate:open":p[8]||(p[8]=m=>ee.value=m),"manage-source":X.value,"subscribed-remote-ids":Ae(X.value),onSessionsAdded:$e},null,8,["open","manage-source","subscribed-remote-ids"])):V("",!0),o(be,{open:K.value,"onUpdate:open":p[10]||(p[10]=m=>K.value=m),ui:{content:"z-[101]",overlay:"z-[100]"}},{content:b(()=>[e("div",za,[e("h3",Da,s(t(a)("settings.api.dataSources.deleteConfirm.title")),1),e("p",Ia,s(t(a)("settings.api.dataSources.deleteConfirm.message",{name:O.value?.baseUrl})),1),e("div",Ta,[o(C,{variant:"soft",onClick:p[9]||(p[9]=m=>K.value=!1)},{default:b(()=>[g(s(t(a)("common.cancel")),1)]),_:1}),o(C,{color:"error",onClick:Ve},{default:b(()=>[g(s(t(a)("common.delete")),1)]),_:1})])])]),_:1},8,["open"]),o(be,{open:q.value,"onUpdate:open":p[12]||(p[12]=m=>q.value=m),ui:{content:"z-[101]",overlay:"z-[100]"}},{content:b(()=>[e("div",La,[e("h3",Aa,s(t(a)("settings.api.dataSources.deleteSessionConfirm.title")),1),e("p",Pa,s(t(a)("settings.api.dataSources.deleteSessionConfirm.message",{name:B.value?.sess.name})),1),e("div",Ra,[o(C,{variant:"soft",onClick:p[11]||(p[11]=m=>q.value=!1)},{default:b(()=>[g(s(t(a)("common.cancel")),1)]),_:1}),o(C,{variant:"soft",onClick:ze},{default:b(()=>[g(s(t(a)("settings.api.dataSources.deleteSessionConfirm.keepData")),1)]),_:1}),o(C,{color:"error",onClick:De},{default:b(()=>[g(s(t(a)("settings.api.dataSources.deleteSessionConfirm.deleteData")),1)]),_:1})])])]),_:1},8,["open"])])}}});export{Ja as default};
@@ -1 +1 @@
1
- import{bf as He,d as qe,aI as _e,a6 as Ge,ap as Qe,aA as We,K as Je,bg as Ye,x as Xe,o as d,c as u,z as i,a7 as Ze,a,p as n,g as s,l as L,aq as et,w as A,a8 as tt,a9 as P,bh as at,F as se,j as me,n as E,O as Se,aR as Me,aN as st,aK as rt,aL as lt,aQ as Ce,f as ot,aa as nt,b,e as w,C as Te,bi as it}from"./index-B1oj9KDv.js";import{_ as ct}from"./Checkbox-_eH64bb0.js";import{u as dt}from"./useToast-B5LaA6c-.js";import{u as ut,a as gt,_ as mt}from"./useTable-Clk7ecq-.js";import"./vendor-snapdom--nZvo8Sg.js";import"./useFormControl-CrWi_6Hn.js";import"./VisuallyHiddenInput-BAFpkxMI.js";import"./RovingFocusItem-BJMUQ5DJ.js";import"./Label-DCIcxkhU.js";var re={exports:{}},ft=re.exports,Ae;function ht(){return Ae||(Ae=1,(function(le,oe){(function(N,l){le.exports=l()})(ft,(function(){return function(N,l,C){N=N||{};var h=l.prototype,p={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function z(m,v,V,H){return h.fromToBase(m,v,V,H)}C.en.relativeTime=p,h.fromToBase=function(m,v,V,H,ee){for(var q,O,B,F=V.$locale().relativeTime||p,G=N.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],ne=G.length,g=0;g<ne;g+=1){var y=G[g];y.d&&(q=H?C(m).diff(V,y.d,!0):V.diff(m,y.d,!0));var T=(N.rounding||Math.round)(Math.abs(q));if(B=q>0,T<=y.r||!y.r){T<=1&&g>0&&(y=G[g-1]);var K=F[y.l];ee&&(T=ee(""+T)),O=typeof K=="string"?K.replace("%d",T):K(T,v,y.l,B);break}}if(v)return O;var Q=B?F.future:F.past;return typeof Q=="function"?Q(O):Q.replace("%s",O)},h.to=function(m,v){return z(m,v,this,!0)},h.from=function(m,v){return z(m,v,this)};var j=function(m){return m.$u?C.utc():C()};h.toNow=function(m){return this.to(j(this),m)},h.fromNow=function(m){return this.from(j(this),m)}}}))})(re)),re.exports}var pt=ht();const vt=He(pt),xt={class:"flex h-full flex-col"},bt={class:"mb-4"},yt={class:"mb-4 flex items-center justify-between"},wt={class:"flex items-center gap-4"},kt={class:"text-xs text-gray-400 dark:text-gray-500"},_t={key:0,class:"text-sm text-gray-500 dark:text-gray-400"},St={key:1,class:"text-sm text-gray-500 dark:text-gray-400"},Mt={class:"flex gap-2"},Ct={key:1,class:"flex flex-1 items-center justify-center"},Tt={class:"text-center text-gray-500 dark:text-gray-400"},At={key:2,class:"flex flex-1 items-center justify-center"},zt={class:"text-center text-gray-500 dark:text-gray-400"},It={key:3,class:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200/50 dark:border-gray-700/50"},$t={class:"flex shrink-0 items-center gap-3 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs font-medium text-gray-500 dark:border-gray-700 dark:bg-page-dark/80 dark:text-gray-400"},Rt=["onClick"],Et={class:"flex shrink-0 flex-col leading-none"},Nt=["onClick"],Vt={class:"w-6"},jt={class:"w-8"},Ot={class:"min-w-0 flex-1"},Bt={class:"flex items-center gap-1.5"},Ft=["title","onClick"],Kt={class:"w-20 text-center"},Dt=["title","onClick"],Ut={class:"truncate"},Lt={class:"w-24 text-right text-sm text-gray-600 dark:text-gray-300"},Pt={class:"w-16 text-right text-sm text-gray-600 dark:text-gray-300"},Ht={class:"w-16 text-right text-sm text-gray-600 dark:text-gray-300"},qt={class:"w-28 text-right text-xs text-gray-500 dark:text-gray-400"},Gt={class:"p-4"},Qt={class:"mb-4 flex items-center gap-3"},Wt={class:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30"},Jt={class:"text-lg font-semibold text-gray-900 dark:text-white"},Yt={class:"mb-4 text-gray-600 dark:text-gray-400"},Xt={class:"mb-4 max-h-40 overflow-y-auto rounded-lg border border-gray-200 dark:border-gray-700"},Zt={class:"text-sm text-gray-700 dark:text-gray-300"},ea={class:"text-xs text-gray-400"},ta={class:"mb-4"},aa={key:0,class:"mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 dark:border-red-800/50 dark:bg-red-900/20"},sa={class:"flex items-start gap-2"},ra={class:"text-xs leading-5 text-red-700 dark:text-red-300"},la={key:1,class:"mb-4 rounded-lg bg-blue-50 px-4 py-3 dark:bg-blue-900/20"},oa={class:"flex items-center gap-2"},na={class:"text-sm text-blue-700 dark:text-blue-300"},ia={class:"flex justify-end gap-2"},ca={class:"p-4"},da={class:"mb-4 flex items-center gap-3"},ua={class:"flex h-10 w-10 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30"},ga={class:"text-lg font-semibold text-gray-900 dark:text-white"},ma={class:"mb-6 text-gray-600 dark:text-gray-400"},fa={class:"flex justify-end gap-2"},ha=48,Ma=qe({__name:"BatchManageTab",props:{focusOwnerIssues:{type:Boolean,default:!1}},setup(le){_e.extend(vt);const oe=dt(),N=le,{t:l,locale:C}=Ge(),h=Qe(),{sessions:p}=We(h),z=b("");function j(e){return e.ownerStatus!=="resolved"&&!e.ownerExcluded}const m=w(()=>p.value.filter(j).length),v=w(()=>{if(!z.value.trim())return p.value;const e=z.value.toLowerCase().trim();return p.value.filter(t=>t.name.toLowerCase().includes(e)||t.platform.toLowerCase().includes(e))}),V=[{key:"spacer-select",type:"spacer",class:"w-6"},{key:"spacer-avatar",type:"spacer",class:"w-8"},{key:"name",type:"sortable",field:"name",labelKey:"tools.batchManage.columns.name",class:"min-w-0 flex-1",align:"left"},{key:"platform",type:"sortable",field:"platform",labelKey:"tools.batchManage.columns.platform",class:"w-20",align:"center"},{key:"owner",type:"sortable",field:"owner",labelKey:"tools.batchManage.columns.owner",class:"w-28",align:"left"},{key:"messages",type:"sortable",field:"messageCount",labelKey:"tools.batchManage.columns.messages",class:"w-24",align:"right"},{key:"summaries",type:"static",labelKey:"tools.batchManage.columns.summaries",class:"w-16",align:"right"},{key:"aiChats",type:"static",labelKey:"tools.batchManage.columns.aiChats",class:"w-16",align:"right"},{key:"importedAt",type:"sortable",field:"importedAt",labelKey:"tools.batchManage.columns.importedAt",class:"w-28",align:"right"}],{sortState:H,toggleSort:ee,setSort:q,isSortActive:O}=ut({initialState:{field:"importedAt",direction:"desc"}});function B(e,t){return O(e,t)?"text-primary-500 dark:text-primary-400":"text-gray-300 dark:text-gray-600"}function F(e){return e==="left"?"justify-start text-left":e==="center"?"justify-center text-center":"justify-end text-right"}function G(e){return`${e.class} ${F(e.align)}`}function ne(e){return`${e.class} flex items-center gap-1 transition-colors hover:text-gray-700 dark:hover:text-gray-200 ${F(e.align)}`}const g=w(()=>{const e=[...v.value],{field:t,direction:c}=H.value;if(!t||!c)return e;const k=c==="asc"?1:-1;return e.sort((M,x)=>{if(t==="name")return M.name.localeCompare(x.name,C.value)*k;if(t==="platform")return ge(M.platform).localeCompare(ge(x.platform),C.value)*k;if(t==="owner"){const U=_=>_.ownerStatus==="resolved"?`0:${_.ownerName||_.ownerId||""}`:_.ownerExcluded?"1:":_.ownerStatus==="unresolved"?"2:":"3:";return U(M).localeCompare(U(x),C.value)*k}return t==="messageCount"?(M.messageCount-x.messageCount)*k:(M.importedAt-x.importedAt)*k}),e}),y=b(null);function T(){q("owner","desc"),Te(()=>y.value?.scrollTo({top:0}))}Je(()=>N.focusOwnerIssues,e=>{e&&T()},{immediate:!0});const K=Ye(w(()=>({count:g.value.length,getScrollElement:()=>y.value,estimateSize:()=>ha,overscan:10,getItemKey:e=>g.value[e]?.id??e}))),Q=w(()=>K.value.getVirtualItems().map(e=>({virtualItem:e,session:g.value[e.index]}))),ze=w(()=>K.value.getTotalSize()),{selectedIds:f,setSelection:fe,clearSelection:he,isSelected:pe,handleRowClick:ve,handleRowMouseDown:xe}=gt({rows:g,getRowId:e=>e.id}),W=b(!1),J=b(!1),I=b(null),$=b(""),ie=b(null),te=b(!1),ce=b(!1),de=w(()=>p.value.find(e=>e.id===ie.value)??null);function Ie(e,t){t.stopPropagation(),ie.value=e.id,ce.value=j(e),te.value=!0}async function be(){if(await h.loadSessions(),!ce.value)return;await Te();const e=g.value.find(j);e?(ie.value=e.id,te.value=!0):ce.value=!1}const ye=w(()=>p.value.filter(e=>f.value.has(e.id))),$e=w(()=>new Set(ye.value.map(e=>e.type))),ae=w(()=>f.value.size<2?!1:$e.value.size===1),we=w(()=>g.value.length>0&&g.value.every(e=>f.value.has(e.id))),Re=w(()=>{const e=g.value.filter(t=>f.value.has(t.id)).length;return e>0&&e<g.value.length});function Ee(){if(we.value){const e=new Set(g.value.map(t=>t.id));fe([...f.value].filter(t=>!e.has(t)))}else{const e=new Set(f.value);for(const t of g.value)e.add(t.id);fe(e)}}function Ne(e){return _e.unix(e).locale({"zh-CN":"zh-cn","zh-TW":"zh-tw","ja-JP":"ja"}[C.value]??"en").fromNow()}function Y(e){return e.type==="private"}function Ve(e){return Y(e)?e.memberAvatar||null:e.groupAvatar||null}function je(e){const t=e.name||"";return t?Y(e)?t.length<=2?t:t.slice(-2):t.length<=2?t:t.slice(0,2):"?"}const ue={qq:{label:"QQ",class:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},weixin:{label:"微信",class:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300"},discord:{label:"Discord",class:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300"},whatsapp:{label:"WhatsApp",class:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300"},instagram:{label:"Instagram",class:"bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-300"},line:{label:"LINE",class:"bg-lime-100 text-lime-700 dark:bg-lime-900/30 dark:text-lime-300"},unknown:{label:"未知",class:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300"}};function ge(e){return ue[e]?.label||e}function Oe(e){return ue[e]?.class||ue.unknown.class}function Be(e,t){t.stopPropagation(),I.value=e.id,$.value=e.name}async function ke(){if(!I.value||!$.value.trim()){I.value=null,$.value="";return}const e=$.value.trim(),t=p.value.find(c=>c.id===I.value);t&&t.name!==e&&await h.renameSession(I.value,e),I.value=null,$.value=""}function Fe(){I.value=null,$.value=""}function Ke(){f.value.size!==0&&(W.value=!0)}const X=b(!1),D=b(!1),R=b(""),Z=b(!1);async function De(){ae.value&&(Z.value=!1,X.value=!0)}async function Ue(){if(!ae.value)return;D.value=!0,R.value=l("tools.batchManage.mergeSteps.exporting");const e=Array.from(f.value);let t=[];try{const c=await window.mergeApi.exportSessionsToTempFiles(e);if(!c.success)throw new Error(c.error||"导出失败");t=c.tempFiles,R.value=l("tools.batchManage.mergeSteps.parsing");for(const r of t)await window.mergeApi.parseFileInfo(r);R.value=l("tools.batchManage.mergeSteps.checking");const k=await window.mergeApi.checkConflicts(t);k.conflicts.length>0&&console.log(`[BatchDelete] 检测到 ${k.conflicts.length} 个冲突,使用默认解决方案`),R.value=l("tools.batchManage.mergeSteps.merging");const U=`${p.value.find(r=>f.value.has(r.id))?.name||"聊天记录"}(${l("tools.batchManage.mergedSuffix")})`,_=await window.mergeApi.mergeFiles({filePaths:t,outputName:U,outputFormat:"json",conflictResolutions:k.conflicts.map(r=>({id:r.id,resolution:"keep1"})),andAnalyze:!0,sessionGapThreshold:it()});if(!_.success)throw new Error(_.error||"合并失败");if(Z.value){R.value=l("tools.batchManage.mergeSteps.cleaning");for(const r of e)await h.deleteSession(r)}await window.mergeApi.cleanupTempExportFiles(t),await h.loadSessions(),he(),X.value=!1,oe.success(l("tools.batchManage.mergeSuccess",{count:e.length}))}catch(c){console.error("[BatchDelete] 合并失败:",c),oe.fail(l("tools.batchManage.mergeError",{error:String(c)})),t.length>0&&await window.mergeApi.cleanupTempExportFiles(t)}finally{D.value=!1,R.value=""}}async function Le(){if(f.value.size!==0){J.value=!0;try{const e=Array.from(f.value);for(const t of e)await h.deleteSession(t);he(),W.value=!1}catch(e){console.error("Batch delete failed:",e)}finally{J.value=!1}}}function Pe(){W.value=!1}return Xe(()=>{h.loadSessions()}),(e,t)=>{const c=Ze,k=et,M=ct,x=tt,U=at,_=nt;return d(),u("div",xt,[m.value>0?(d(),u("button",{key:0,type:"button",class:"mb-3 inline-flex w-fit max-w-full items-center gap-2 rounded-lg bg-amber-50 px-3 py-2 text-left text-xs text-amber-800 transition-colors hover:bg-amber-100 dark:bg-amber-950/20 dark:text-amber-300 dark:hover:bg-amber-950/30",onClick:T},[i(c,{name:"i-heroicons-user-circle",class:"h-4 w-4 shrink-0"}),a("span",null,n(s(l)("tools.batchManage.ownerIssues",{count:m.value})),1),i(c,{name:"i-heroicons-arrow-right",class:"h-3.5 w-3.5 shrink-0 opacity-70"})])):L("",!0),a("div",bt,[i(k,{modelValue:z.value,"onUpdate:modelValue":t[0]||(t[0]=r=>z.value=r),placeholder:s(l)("tools.batchManage.searchPlaceholder"),icon:"i-heroicons-magnifying-glass",size:"md",class:"w-80"},null,8,["modelValue","placeholder"])]),a("div",yt,[a("div",wt,[i(M,{"model-value":we.value,indeterminate:Re.value,label:s(l)("tools.batchManage.selectAll"),"onUpdate:modelValue":Ee},null,8,["model-value","indeterminate","label"]),a("span",kt,n(s(l)("tools.batchManage.shiftClickHint")),1),s(f).size>0?(d(),u("span",_t,n(s(l)("tools.batchManage.selected",{count:s(f).size})),1)):L("",!0),z.value.trim()&&v.value.length!==s(p).length?(d(),u("span",St,n(s(l)("tools.batchManage.searchResult",{count:v.value.length,total:s(p).length})),1)):L("",!0)]),a("div",Mt,[i(U,{text:ae.value?"":s(l)("tools.batchManage.mergeHint")},{default:A(()=>[i(x,{color:"primary",disabled:!ae.value,icon:"i-heroicons-document-duplicate",onClick:De},{default:A(()=>[P(n(s(l)("tools.batchManage.merge")),1)]),_:1},8,["disabled"])]),_:1},8,["text"]),i(x,{color:"primary",disabled:s(f).size===0,icon:"i-heroicons-trash",onClick:Ke},{default:A(()=>[P(n(s(l)("tools.batchManage.delete")),1)]),_:1},8,["disabled"])])]),s(p).length===0?(d(),u("div",Ct,[a("div",Tt,[i(c,{name:"i-heroicons-inbox",class:"mb-2 h-12 w-12"}),a("p",null,n(s(l)("tools.batchManage.empty")),1)])])):v.value.length===0?(d(),u("div",At,[a("div",zt,[i(c,{name:"i-heroicons-magnifying-glass",class:"mb-2 h-12 w-12"}),a("p",null,n(s(l)("tools.batchManage.noSearchResult")),1)])])):(d(),u("div",It,[a("div",$t,[(d(),u(se,null,me(V,r=>(d(),u(se,{key:r.key},[r.type==="spacer"?(d(),u("div",{key:0,class:E(r.class)},null,2)):r.type==="static"?(d(),u("div",{key:1,class:E(G(r))},n(s(l)(r.labelKey)),3)):(d(),u("button",{key:2,class:E(ne(r)),onClick:o=>s(ee)(r.field)},[a("span",null,n(s(l)(r.labelKey)),1),a("span",Et,[i(c,{name:"i-heroicons-chevron-up",class:E(["h-2.5 w-2.5",B(r.field,"asc")])},null,8,["class"]),i(c,{name:"i-heroicons-chevron-down",class:E(["-mt-0.5 h-2.5 w-2.5",B(r.field,"desc")])},null,8,["class"])])],10,Rt))],64))),64))]),a("div",{ref_key:"listScrollRef",ref:y,class:"min-h-0 flex-1 overflow-y-auto"},[a("div",{class:"relative",style:Se({height:`${ze.value}px`})},[(d(!0),u(se,null,me(Q.value,({virtualItem:r,session:o})=>(d(),u("div",{key:String(r.key),class:E(["absolute left-0 right-0 top-0 flex h-12 cursor-pointer items-center gap-3 px-3 py-2 transition-colors hover:bg-gray-100 dark:hover:bg-gray-800",[s(pe)(o.id)?"bg-pink-50 dark:bg-pink-900/20":"",r.index!==g.value.length-1?"border-b border-gray-100 dark:border-gray-800":""]]),style:Se({transform:`translateY(${r.start}px)`}),onMousedown:t[3]||(t[3]=(...S)=>s(xe)&&s(xe)(...S)),onClick:S=>s(ve)(r.index,o.id,S)},[a("div",Vt,[i(M,{"model-value":s(pe)(o.id),onClick:Me(S=>s(ve)(r.index,o.id,S),["stop"])},null,8,["model-value","onClick"])]),a("div",jt,[i(st,{src:Ve(o),alt:o.name,text:je(o),"fallback-class":["flex h-8 w-8 items-center justify-center rounded-full text-[10px] font-bold",Y(o)?"bg-pink-500 text-white":"bg-primary-500 text-white"]},null,8,["src","alt","text","fallback-class"])]),a("div",Ot,[a("div",Bt,[i(c,{name:Y(o)?"i-heroicons-user":"i-heroicons-user-group",class:"h-3.5 w-3.5 shrink-0 text-gray-400"},null,8,["name"]),I.value===o.id?rt((d(),u("input",{key:0,"onUpdate:modelValue":t[1]||(t[1]=S=>$.value=S),type:"text",class:"w-full rounded border border-pink-300 bg-white px-2 py-0.5 text-sm font-medium text-gray-900 focus:border-pink-500 focus:outline-none focus:ring-1 focus:ring-pink-500 dark:border-pink-600 dark:bg-gray-800 dark:text-white",autofocus:"",onBlur:ke,onKeydown:[Ce(ke,["enter"]),Ce(Fe,["escape"])],onClick:t[2]||(t[2]=Me(()=>{},["stop"]))},null,544)),[[lt,$.value]]):(d(),u("p",{key:1,class:"cursor-text truncate rounded px-1 text-sm font-medium text-gray-900 hover:bg-gray-200 dark:text-white dark:hover:bg-gray-700",title:s(l)("tools.batchManage.clickToEdit"),onClick:S=>Be(o,S)},n(o.name),9,Ft))])]),a("div",Kt,[a("span",{class:E(["inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",Oe(o.platform)])},n(ge(o.platform)),3)]),a("button",{type:"button",class:E(["flex w-28 min-w-0 items-center gap-1.5 text-left text-xs transition-colors hover:text-primary-600 dark:hover:text-primary-400",o.ownerStatus==="resolved"||o.ownerExcluded?"text-gray-600 dark:text-gray-300":"text-amber-600 dark:text-amber-400"]),title:o.ownerId||s(l)("tools.batchManage.ownerStatus.missing"),onClick:S=>Ie(o,S)},[i(c,{name:o.ownerStatus==="resolved"?"i-heroicons-user-circle":o.ownerExcluded?"i-heroicons-user-minus":"i-heroicons-exclamation-circle",class:"h-3.5 w-3.5 shrink-0"},null,8,["name"]),a("span",Ut,n(o.ownerStatus==="resolved"?o.ownerName||o.ownerId:s(l)(`tools.batchManage.ownerStatus.${o.ownerStatus}`)),1),i(c,{name:"i-heroicons-chevron-right",class:"h-3 w-3 shrink-0 opacity-60"})],10,Dt),a("div",Lt,n(o.messageCount.toLocaleString()),1),a("div",Pt,n(o.summaryCount||0),1),a("div",Ht,n(o.aiConversationCount||0),1),a("div",qt,n(Ne(o.importedAt)),1)],46,Nt))),128))],4)],512)])),de.value?(d(),ot(mt,{key:4,modelValue:te.value,"onUpdate:modelValue":t[4]||(t[4]=r=>te.value=r),"session-id":de.value.id,"chat-type":de.value.type,onSaved:be,onCleared:be},null,8,["modelValue","session-id","chat-type"])):L("",!0),i(_,{open:X.value,"onUpdate:open":t[7]||(t[7]=r=>X.value=r),ui:{content:"z-[101]",overlay:"z-[100]"}},{content:A(()=>[a("div",Gt,[a("div",Qt,[a("div",Wt,[i(c,{name:"i-heroicons-document-duplicate",class:"h-5 w-5 text-blue-600 dark:text-blue-400"})]),a("h3",Jt,n(s(l)("tools.batchManage.mergeConfirmTitle")),1)]),a("p",Yt,n(s(l)("tools.batchManage.mergeConfirmMessage",{count:s(f).size})),1),a("div",Xt,[(d(!0),u(se,null,me(ye.value,r=>(d(),u("div",{key:r.id,class:"flex items-center gap-2 border-b border-gray-100 px-3 py-2 last:border-b-0 dark:border-gray-800"},[i(c,{name:Y(r)?"i-heroicons-user":"i-heroicons-user-group",class:"h-4 w-4 text-gray-400"},null,8,["name"]),a("span",Zt,n(r.name),1),a("span",ea,n(r.messageCount.toLocaleString())+" 条",1)]))),128))]),a("div",ta,[i(M,{modelValue:Z.value,"onUpdate:modelValue":t[5]||(t[5]=r=>Z.value=r),label:s(l)("tools.batchManage.deleteOriginalsLabel")},null,8,["modelValue","label"])]),Z.value?(d(),u("div",aa,[a("div",sa,[i(c,{name:"i-heroicons-exclamation-triangle",class:"mt-0.5 h-4 w-4 shrink-0 text-red-600"}),a("p",ra,n(s(l)("tools.batchManage.mergeRiskWarning")),1)])])):L("",!0),D.value?(d(),u("div",la,[a("div",oa,[i(c,{name:"i-heroicons-arrow-path",class:"h-4 w-4 animate-spin text-blue-600 dark:text-blue-400"}),a("span",na,n(R.value),1)])])):L("",!0),a("div",ia,[i(x,{variant:"soft",disabled:D.value,onClick:t[6]||(t[6]=r=>X.value=!1)},{default:A(()=>[P(n(s(l)("common.cancel")),1)]),_:1},8,["disabled"]),i(x,{color:"primary",loading:D.value,onClick:Ue},{default:A(()=>[P(n(D.value?R.value:s(l)("tools.batchManage.merge")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"]),i(_,{open:W.value,"onUpdate:open":t[8]||(t[8]=r=>W.value=r),ui:{content:"z-[101]",overlay:"z-[100]"}},{content:A(()=>[a("div",ca,[a("div",da,[a("div",ua,[i(c,{name:"i-heroicons-exclamation-triangle",class:"h-5 w-5 text-red-600 dark:text-red-400"})]),a("h3",ga,n(s(l)("tools.batchManage.confirmTitle")),1)]),a("p",ma,n(s(l)("tools.batchManage.confirmMessage",{count:s(f).size})),1),a("div",fa,[i(x,{variant:"soft",disabled:J.value,onClick:Pe},{default:A(()=>[P(n(s(l)("common.cancel")),1)]),_:1},8,["disabled"]),i(x,{color:"error",loading:J.value,onClick:Le},{default:A(()=>[P(n(J.value?s(l)("tools.batchManage.deleting"):s(l)("common.delete")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"])])}}});export{Ma as default};
1
+ import{bf as He,d as qe,aI as _e,a6 as Ge,ap as Qe,aA as We,K as Je,bg as Ye,x as Xe,o as d,c as u,z as i,a7 as Ze,a,p as n,g as s,l as L,aq as et,w as A,a8 as tt,a9 as P,bh as at,F as se,j as me,n as E,O as Se,aR as Me,aN as st,aK as rt,aL as lt,aQ as Ce,f as ot,aa as nt,b,e as w,C as Te,bi as it}from"./index-bQ9oj54q.js";import{_ as ct}from"./Checkbox-CrlY3jiJ.js";import{u as dt}from"./useToast-DPkgv34s.js";import{u as ut,a as gt,_ as mt}from"./useTable-BYXxnZMd.js";import"./vendor-snapdom--nZvo8Sg.js";import"./useFormControl-CNmp_2bd.js";import"./VisuallyHiddenInput-J2KEIQBX.js";import"./RovingFocusItem-FpYwYEP_.js";import"./Label-CaVKlQnJ.js";var re={exports:{}},ft=re.exports,Ae;function ht(){return Ae||(Ae=1,(function(le,oe){(function(N,l){le.exports=l()})(ft,(function(){return function(N,l,C){N=N||{};var h=l.prototype,p={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function z(m,v,V,H){return h.fromToBase(m,v,V,H)}C.en.relativeTime=p,h.fromToBase=function(m,v,V,H,ee){for(var q,O,B,F=V.$locale().relativeTime||p,G=N.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],ne=G.length,g=0;g<ne;g+=1){var y=G[g];y.d&&(q=H?C(m).diff(V,y.d,!0):V.diff(m,y.d,!0));var T=(N.rounding||Math.round)(Math.abs(q));if(B=q>0,T<=y.r||!y.r){T<=1&&g>0&&(y=G[g-1]);var K=F[y.l];ee&&(T=ee(""+T)),O=typeof K=="string"?K.replace("%d",T):K(T,v,y.l,B);break}}if(v)return O;var Q=B?F.future:F.past;return typeof Q=="function"?Q(O):Q.replace("%s",O)},h.to=function(m,v){return z(m,v,this,!0)},h.from=function(m,v){return z(m,v,this)};var j=function(m){return m.$u?C.utc():C()};h.toNow=function(m){return this.to(j(this),m)},h.fromNow=function(m){return this.from(j(this),m)}}}))})(re)),re.exports}var pt=ht();const vt=He(pt),xt={class:"flex h-full flex-col"},bt={class:"mb-4"},yt={class:"mb-4 flex items-center justify-between"},wt={class:"flex items-center gap-4"},kt={class:"text-xs text-gray-400 dark:text-gray-500"},_t={key:0,class:"text-sm text-gray-500 dark:text-gray-400"},St={key:1,class:"text-sm text-gray-500 dark:text-gray-400"},Mt={class:"flex gap-2"},Ct={key:1,class:"flex flex-1 items-center justify-center"},Tt={class:"text-center text-gray-500 dark:text-gray-400"},At={key:2,class:"flex flex-1 items-center justify-center"},zt={class:"text-center text-gray-500 dark:text-gray-400"},It={key:3,class:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-200/50 dark:border-gray-700/50"},$t={class:"flex shrink-0 items-center gap-3 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs font-medium text-gray-500 dark:border-gray-700 dark:bg-page-dark/80 dark:text-gray-400"},Rt=["onClick"],Et={class:"flex shrink-0 flex-col leading-none"},Nt=["onClick"],Vt={class:"w-6"},jt={class:"w-8"},Ot={class:"min-w-0 flex-1"},Bt={class:"flex items-center gap-1.5"},Ft=["title","onClick"],Kt={class:"w-20 text-center"},Dt=["title","onClick"],Ut={class:"truncate"},Lt={class:"w-24 text-right text-sm text-gray-600 dark:text-gray-300"},Pt={class:"w-16 text-right text-sm text-gray-600 dark:text-gray-300"},Ht={class:"w-16 text-right text-sm text-gray-600 dark:text-gray-300"},qt={class:"w-28 text-right text-xs text-gray-500 dark:text-gray-400"},Gt={class:"p-4"},Qt={class:"mb-4 flex items-center gap-3"},Wt={class:"flex h-10 w-10 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30"},Jt={class:"text-lg font-semibold text-gray-900 dark:text-white"},Yt={class:"mb-4 text-gray-600 dark:text-gray-400"},Xt={class:"mb-4 max-h-40 overflow-y-auto rounded-lg border border-gray-200 dark:border-gray-700"},Zt={class:"text-sm text-gray-700 dark:text-gray-300"},ea={class:"text-xs text-gray-400"},ta={class:"mb-4"},aa={key:0,class:"mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 dark:border-red-800/50 dark:bg-red-900/20"},sa={class:"flex items-start gap-2"},ra={class:"text-xs leading-5 text-red-700 dark:text-red-300"},la={key:1,class:"mb-4 rounded-lg bg-blue-50 px-4 py-3 dark:bg-blue-900/20"},oa={class:"flex items-center gap-2"},na={class:"text-sm text-blue-700 dark:text-blue-300"},ia={class:"flex justify-end gap-2"},ca={class:"p-4"},da={class:"mb-4 flex items-center gap-3"},ua={class:"flex h-10 w-10 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30"},ga={class:"text-lg font-semibold text-gray-900 dark:text-white"},ma={class:"mb-6 text-gray-600 dark:text-gray-400"},fa={class:"flex justify-end gap-2"},ha=48,Ma=qe({__name:"BatchManageTab",props:{focusOwnerIssues:{type:Boolean,default:!1}},setup(le){_e.extend(vt);const oe=dt(),N=le,{t:l,locale:C}=Ge(),h=Qe(),{sessions:p}=We(h),z=b("");function j(e){return e.ownerStatus!=="resolved"&&!e.ownerExcluded}const m=w(()=>p.value.filter(j).length),v=w(()=>{if(!z.value.trim())return p.value;const e=z.value.toLowerCase().trim();return p.value.filter(t=>t.name.toLowerCase().includes(e)||t.platform.toLowerCase().includes(e))}),V=[{key:"spacer-select",type:"spacer",class:"w-6"},{key:"spacer-avatar",type:"spacer",class:"w-8"},{key:"name",type:"sortable",field:"name",labelKey:"tools.batchManage.columns.name",class:"min-w-0 flex-1",align:"left"},{key:"platform",type:"sortable",field:"platform",labelKey:"tools.batchManage.columns.platform",class:"w-20",align:"center"},{key:"owner",type:"sortable",field:"owner",labelKey:"tools.batchManage.columns.owner",class:"w-28",align:"left"},{key:"messages",type:"sortable",field:"messageCount",labelKey:"tools.batchManage.columns.messages",class:"w-24",align:"right"},{key:"summaries",type:"static",labelKey:"tools.batchManage.columns.summaries",class:"w-16",align:"right"},{key:"aiChats",type:"static",labelKey:"tools.batchManage.columns.aiChats",class:"w-16",align:"right"},{key:"importedAt",type:"sortable",field:"importedAt",labelKey:"tools.batchManage.columns.importedAt",class:"w-28",align:"right"}],{sortState:H,toggleSort:ee,setSort:q,isSortActive:O}=ut({initialState:{field:"importedAt",direction:"desc"}});function B(e,t){return O(e,t)?"text-primary-500 dark:text-primary-400":"text-gray-300 dark:text-gray-600"}function F(e){return e==="left"?"justify-start text-left":e==="center"?"justify-center text-center":"justify-end text-right"}function G(e){return`${e.class} ${F(e.align)}`}function ne(e){return`${e.class} flex items-center gap-1 transition-colors hover:text-gray-700 dark:hover:text-gray-200 ${F(e.align)}`}const g=w(()=>{const e=[...v.value],{field:t,direction:c}=H.value;if(!t||!c)return e;const k=c==="asc"?1:-1;return e.sort((M,x)=>{if(t==="name")return M.name.localeCompare(x.name,C.value)*k;if(t==="platform")return ge(M.platform).localeCompare(ge(x.platform),C.value)*k;if(t==="owner"){const U=_=>_.ownerStatus==="resolved"?`0:${_.ownerName||_.ownerId||""}`:_.ownerExcluded?"1:":_.ownerStatus==="unresolved"?"2:":"3:";return U(M).localeCompare(U(x),C.value)*k}return t==="messageCount"?(M.messageCount-x.messageCount)*k:(M.importedAt-x.importedAt)*k}),e}),y=b(null);function T(){q("owner","desc"),Te(()=>y.value?.scrollTo({top:0}))}Je(()=>N.focusOwnerIssues,e=>{e&&T()},{immediate:!0});const K=Ye(w(()=>({count:g.value.length,getScrollElement:()=>y.value,estimateSize:()=>ha,overscan:10,getItemKey:e=>g.value[e]?.id??e}))),Q=w(()=>K.value.getVirtualItems().map(e=>({virtualItem:e,session:g.value[e.index]}))),ze=w(()=>K.value.getTotalSize()),{selectedIds:f,setSelection:fe,clearSelection:he,isSelected:pe,handleRowClick:ve,handleRowMouseDown:xe}=gt({rows:g,getRowId:e=>e.id}),W=b(!1),J=b(!1),I=b(null),$=b(""),ie=b(null),te=b(!1),ce=b(!1),de=w(()=>p.value.find(e=>e.id===ie.value)??null);function Ie(e,t){t.stopPropagation(),ie.value=e.id,ce.value=j(e),te.value=!0}async function be(){if(await h.loadSessions(),!ce.value)return;await Te();const e=g.value.find(j);e?(ie.value=e.id,te.value=!0):ce.value=!1}const ye=w(()=>p.value.filter(e=>f.value.has(e.id))),$e=w(()=>new Set(ye.value.map(e=>e.type))),ae=w(()=>f.value.size<2?!1:$e.value.size===1),we=w(()=>g.value.length>0&&g.value.every(e=>f.value.has(e.id))),Re=w(()=>{const e=g.value.filter(t=>f.value.has(t.id)).length;return e>0&&e<g.value.length});function Ee(){if(we.value){const e=new Set(g.value.map(t=>t.id));fe([...f.value].filter(t=>!e.has(t)))}else{const e=new Set(f.value);for(const t of g.value)e.add(t.id);fe(e)}}function Ne(e){return _e.unix(e).locale({"zh-CN":"zh-cn","zh-TW":"zh-tw","ja-JP":"ja"}[C.value]??"en").fromNow()}function Y(e){return e.type==="private"}function Ve(e){return Y(e)?e.memberAvatar||null:e.groupAvatar||null}function je(e){const t=e.name||"";return t?Y(e)?t.length<=2?t:t.slice(-2):t.length<=2?t:t.slice(0,2):"?"}const ue={qq:{label:"QQ",class:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},weixin:{label:"微信",class:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300"},discord:{label:"Discord",class:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300"},whatsapp:{label:"WhatsApp",class:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300"},instagram:{label:"Instagram",class:"bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-300"},line:{label:"LINE",class:"bg-lime-100 text-lime-700 dark:bg-lime-900/30 dark:text-lime-300"},unknown:{label:"未知",class:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300"}};function ge(e){return ue[e]?.label||e}function Oe(e){return ue[e]?.class||ue.unknown.class}function Be(e,t){t.stopPropagation(),I.value=e.id,$.value=e.name}async function ke(){if(!I.value||!$.value.trim()){I.value=null,$.value="";return}const e=$.value.trim(),t=p.value.find(c=>c.id===I.value);t&&t.name!==e&&await h.renameSession(I.value,e),I.value=null,$.value=""}function Fe(){I.value=null,$.value=""}function Ke(){f.value.size!==0&&(W.value=!0)}const X=b(!1),D=b(!1),R=b(""),Z=b(!1);async function De(){ae.value&&(Z.value=!1,X.value=!0)}async function Ue(){if(!ae.value)return;D.value=!0,R.value=l("tools.batchManage.mergeSteps.exporting");const e=Array.from(f.value);let t=[];try{const c=await window.mergeApi.exportSessionsToTempFiles(e);if(!c.success)throw new Error(c.error||"导出失败");t=c.tempFiles,R.value=l("tools.batchManage.mergeSteps.parsing");for(const r of t)await window.mergeApi.parseFileInfo(r);R.value=l("tools.batchManage.mergeSteps.checking");const k=await window.mergeApi.checkConflicts(t);k.conflicts.length>0&&console.log(`[BatchDelete] 检测到 ${k.conflicts.length} 个冲突,使用默认解决方案`),R.value=l("tools.batchManage.mergeSteps.merging");const U=`${p.value.find(r=>f.value.has(r.id))?.name||"聊天记录"}(${l("tools.batchManage.mergedSuffix")})`,_=await window.mergeApi.mergeFiles({filePaths:t,outputName:U,outputFormat:"json",conflictResolutions:k.conflicts.map(r=>({id:r.id,resolution:"keep1"})),andAnalyze:!0,sessionGapThreshold:it()});if(!_.success)throw new Error(_.error||"合并失败");if(Z.value){R.value=l("tools.batchManage.mergeSteps.cleaning");for(const r of e)await h.deleteSession(r)}await window.mergeApi.cleanupTempExportFiles(t),await h.loadSessions(),he(),X.value=!1,oe.success(l("tools.batchManage.mergeSuccess",{count:e.length}))}catch(c){console.error("[BatchDelete] 合并失败:",c),oe.fail(l("tools.batchManage.mergeError",{error:String(c)})),t.length>0&&await window.mergeApi.cleanupTempExportFiles(t)}finally{D.value=!1,R.value=""}}async function Le(){if(f.value.size!==0){J.value=!0;try{const e=Array.from(f.value);for(const t of e)await h.deleteSession(t);he(),W.value=!1}catch(e){console.error("Batch delete failed:",e)}finally{J.value=!1}}}function Pe(){W.value=!1}return Xe(()=>{h.loadSessions()}),(e,t)=>{const c=Ze,k=et,M=ct,x=tt,U=at,_=nt;return d(),u("div",xt,[m.value>0?(d(),u("button",{key:0,type:"button",class:"mb-3 inline-flex w-fit max-w-full items-center gap-2 rounded-lg bg-amber-50 px-3 py-2 text-left text-xs text-amber-800 transition-colors hover:bg-amber-100 dark:bg-amber-950/20 dark:text-amber-300 dark:hover:bg-amber-950/30",onClick:T},[i(c,{name:"i-heroicons-user-circle",class:"h-4 w-4 shrink-0"}),a("span",null,n(s(l)("tools.batchManage.ownerIssues",{count:m.value})),1),i(c,{name:"i-heroicons-arrow-right",class:"h-3.5 w-3.5 shrink-0 opacity-70"})])):L("",!0),a("div",bt,[i(k,{modelValue:z.value,"onUpdate:modelValue":t[0]||(t[0]=r=>z.value=r),placeholder:s(l)("tools.batchManage.searchPlaceholder"),icon:"i-heroicons-magnifying-glass",size:"md",class:"w-80"},null,8,["modelValue","placeholder"])]),a("div",yt,[a("div",wt,[i(M,{"model-value":we.value,indeterminate:Re.value,label:s(l)("tools.batchManage.selectAll"),"onUpdate:modelValue":Ee},null,8,["model-value","indeterminate","label"]),a("span",kt,n(s(l)("tools.batchManage.shiftClickHint")),1),s(f).size>0?(d(),u("span",_t,n(s(l)("tools.batchManage.selected",{count:s(f).size})),1)):L("",!0),z.value.trim()&&v.value.length!==s(p).length?(d(),u("span",St,n(s(l)("tools.batchManage.searchResult",{count:v.value.length,total:s(p).length})),1)):L("",!0)]),a("div",Mt,[i(U,{text:ae.value?"":s(l)("tools.batchManage.mergeHint")},{default:A(()=>[i(x,{color:"primary",disabled:!ae.value,icon:"i-heroicons-document-duplicate",onClick:De},{default:A(()=>[P(n(s(l)("tools.batchManage.merge")),1)]),_:1},8,["disabled"])]),_:1},8,["text"]),i(x,{color:"primary",disabled:s(f).size===0,icon:"i-heroicons-trash",onClick:Ke},{default:A(()=>[P(n(s(l)("tools.batchManage.delete")),1)]),_:1},8,["disabled"])])]),s(p).length===0?(d(),u("div",Ct,[a("div",Tt,[i(c,{name:"i-heroicons-inbox",class:"mb-2 h-12 w-12"}),a("p",null,n(s(l)("tools.batchManage.empty")),1)])])):v.value.length===0?(d(),u("div",At,[a("div",zt,[i(c,{name:"i-heroicons-magnifying-glass",class:"mb-2 h-12 w-12"}),a("p",null,n(s(l)("tools.batchManage.noSearchResult")),1)])])):(d(),u("div",It,[a("div",$t,[(d(),u(se,null,me(V,r=>(d(),u(se,{key:r.key},[r.type==="spacer"?(d(),u("div",{key:0,class:E(r.class)},null,2)):r.type==="static"?(d(),u("div",{key:1,class:E(G(r))},n(s(l)(r.labelKey)),3)):(d(),u("button",{key:2,class:E(ne(r)),onClick:o=>s(ee)(r.field)},[a("span",null,n(s(l)(r.labelKey)),1),a("span",Et,[i(c,{name:"i-heroicons-chevron-up",class:E(["h-2.5 w-2.5",B(r.field,"asc")])},null,8,["class"]),i(c,{name:"i-heroicons-chevron-down",class:E(["-mt-0.5 h-2.5 w-2.5",B(r.field,"desc")])},null,8,["class"])])],10,Rt))],64))),64))]),a("div",{ref_key:"listScrollRef",ref:y,class:"min-h-0 flex-1 overflow-y-auto"},[a("div",{class:"relative",style:Se({height:`${ze.value}px`})},[(d(!0),u(se,null,me(Q.value,({virtualItem:r,session:o})=>(d(),u("div",{key:String(r.key),class:E(["absolute left-0 right-0 top-0 flex h-12 cursor-pointer items-center gap-3 px-3 py-2 transition-colors hover:bg-gray-100 dark:hover:bg-gray-800",[s(pe)(o.id)?"bg-pink-50 dark:bg-pink-900/20":"",r.index!==g.value.length-1?"border-b border-gray-100 dark:border-gray-800":""]]),style:Se({transform:`translateY(${r.start}px)`}),onMousedown:t[3]||(t[3]=(...S)=>s(xe)&&s(xe)(...S)),onClick:S=>s(ve)(r.index,o.id,S)},[a("div",Vt,[i(M,{"model-value":s(pe)(o.id),onClick:Me(S=>s(ve)(r.index,o.id,S),["stop"])},null,8,["model-value","onClick"])]),a("div",jt,[i(st,{src:Ve(o),alt:o.name,text:je(o),"fallback-class":["flex h-8 w-8 items-center justify-center rounded-full text-[10px] font-bold",Y(o)?"bg-pink-500 text-white":"bg-primary-500 text-white"]},null,8,["src","alt","text","fallback-class"])]),a("div",Ot,[a("div",Bt,[i(c,{name:Y(o)?"i-heroicons-user":"i-heroicons-user-group",class:"h-3.5 w-3.5 shrink-0 text-gray-400"},null,8,["name"]),I.value===o.id?rt((d(),u("input",{key:0,"onUpdate:modelValue":t[1]||(t[1]=S=>$.value=S),type:"text",class:"w-full rounded border border-pink-300 bg-white px-2 py-0.5 text-sm font-medium text-gray-900 focus:border-pink-500 focus:outline-none focus:ring-1 focus:ring-pink-500 dark:border-pink-600 dark:bg-gray-800 dark:text-white",autofocus:"",onBlur:ke,onKeydown:[Ce(ke,["enter"]),Ce(Fe,["escape"])],onClick:t[2]||(t[2]=Me(()=>{},["stop"]))},null,544)),[[lt,$.value]]):(d(),u("p",{key:1,class:"cursor-text truncate rounded px-1 text-sm font-medium text-gray-900 hover:bg-gray-200 dark:text-white dark:hover:bg-gray-700",title:s(l)("tools.batchManage.clickToEdit"),onClick:S=>Be(o,S)},n(o.name),9,Ft))])]),a("div",Kt,[a("span",{class:E(["inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",Oe(o.platform)])},n(ge(o.platform)),3)]),a("button",{type:"button",class:E(["flex w-28 min-w-0 items-center gap-1.5 text-left text-xs transition-colors hover:text-primary-600 dark:hover:text-primary-400",o.ownerStatus==="resolved"||o.ownerExcluded?"text-gray-600 dark:text-gray-300":"text-amber-600 dark:text-amber-400"]),title:o.ownerId||s(l)("tools.batchManage.ownerStatus.missing"),onClick:S=>Ie(o,S)},[i(c,{name:o.ownerStatus==="resolved"?"i-heroicons-user-circle":o.ownerExcluded?"i-heroicons-user-minus":"i-heroicons-exclamation-circle",class:"h-3.5 w-3.5 shrink-0"},null,8,["name"]),a("span",Ut,n(o.ownerStatus==="resolved"?o.ownerName||o.ownerId:s(l)(`tools.batchManage.ownerStatus.${o.ownerStatus}`)),1),i(c,{name:"i-heroicons-chevron-right",class:"h-3 w-3 shrink-0 opacity-60"})],10,Dt),a("div",Lt,n(o.messageCount.toLocaleString()),1),a("div",Pt,n(o.summaryCount||0),1),a("div",Ht,n(o.aiConversationCount||0),1),a("div",qt,n(Ne(o.importedAt)),1)],46,Nt))),128))],4)],512)])),de.value?(d(),ot(mt,{key:4,modelValue:te.value,"onUpdate:modelValue":t[4]||(t[4]=r=>te.value=r),"session-id":de.value.id,"chat-type":de.value.type,onSaved:be,onCleared:be},null,8,["modelValue","session-id","chat-type"])):L("",!0),i(_,{open:X.value,"onUpdate:open":t[7]||(t[7]=r=>X.value=r),ui:{content:"z-[101]",overlay:"z-[100]"}},{content:A(()=>[a("div",Gt,[a("div",Qt,[a("div",Wt,[i(c,{name:"i-heroicons-document-duplicate",class:"h-5 w-5 text-blue-600 dark:text-blue-400"})]),a("h3",Jt,n(s(l)("tools.batchManage.mergeConfirmTitle")),1)]),a("p",Yt,n(s(l)("tools.batchManage.mergeConfirmMessage",{count:s(f).size})),1),a("div",Xt,[(d(!0),u(se,null,me(ye.value,r=>(d(),u("div",{key:r.id,class:"flex items-center gap-2 border-b border-gray-100 px-3 py-2 last:border-b-0 dark:border-gray-800"},[i(c,{name:Y(r)?"i-heroicons-user":"i-heroicons-user-group",class:"h-4 w-4 text-gray-400"},null,8,["name"]),a("span",Zt,n(r.name),1),a("span",ea,n(r.messageCount.toLocaleString())+" 条",1)]))),128))]),a("div",ta,[i(M,{modelValue:Z.value,"onUpdate:modelValue":t[5]||(t[5]=r=>Z.value=r),label:s(l)("tools.batchManage.deleteOriginalsLabel")},null,8,["modelValue","label"])]),Z.value?(d(),u("div",aa,[a("div",sa,[i(c,{name:"i-heroicons-exclamation-triangle",class:"mt-0.5 h-4 w-4 shrink-0 text-red-600"}),a("p",ra,n(s(l)("tools.batchManage.mergeRiskWarning")),1)])])):L("",!0),D.value?(d(),u("div",la,[a("div",oa,[i(c,{name:"i-heroicons-arrow-path",class:"h-4 w-4 animate-spin text-blue-600 dark:text-blue-400"}),a("span",na,n(R.value),1)])])):L("",!0),a("div",ia,[i(x,{variant:"soft",disabled:D.value,onClick:t[6]||(t[6]=r=>X.value=!1)},{default:A(()=>[P(n(s(l)("common.cancel")),1)]),_:1},8,["disabled"]),i(x,{color:"primary",loading:D.value,onClick:Ue},{default:A(()=>[P(n(D.value?R.value:s(l)("tools.batchManage.merge")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"]),i(_,{open:W.value,"onUpdate:open":t[8]||(t[8]=r=>W.value=r),ui:{content:"z-[101]",overlay:"z-[100]"}},{content:A(()=>[a("div",ca,[a("div",da,[a("div",ua,[i(c,{name:"i-heroicons-exclamation-triangle",class:"h-5 w-5 text-red-600 dark:text-red-400"})]),a("h3",ga,n(s(l)("tools.batchManage.confirmTitle")),1)]),a("p",ma,n(s(l)("tools.batchManage.confirmMessage",{count:s(f).size})),1),a("div",fa,[i(x,{variant:"soft",disabled:J.value,onClick:Pe},{default:A(()=>[P(n(s(l)("common.cancel")),1)]),_:1},8,["disabled"]),i(x,{color:"error",loading:J.value,onClick:Le},{default:A(()=>[P(n(J.value?s(l)("tools.batchManage.deleting"):s(l)("common.delete")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"])])}}});export{Ma as default};
@@ -1,4 +1,4 @@
1
- import{w as U,g,c,u as S,B as _,d as m,E as I,e as p}from"./RelationshipGalaxyCanvas-CDhljGyJ.js";const x={name:"local-uniform-bit",vertex:{header:`
1
+ import{w as U,g,c,u as S,B as _,d as m,E as I,e as p}from"./RelationshipGalaxyCanvas-BO5-MowG.js";const x={name:"local-uniform-bit",vertex:{header:`
2
2
 
3
3
  struct LocalUniforms {
4
4
  uTransformMatrix:mat3x3<f32>,
@@ -1 +1 @@
1
- import{f as C,h as Ce,i as Te,m as Z,M as A,j as _,k as Le,w as Oe,s as Pe,l as ke,n as je,C as be,T as _e,o as Ne,F as Ye,p as Ve,q as $e,D as Se,A as Xe,R as Je,r as te}from"./RelationshipGalaxyCanvas-CDhljGyJ.js";import{R as Ke,S as Qe,B as ze,a as Ze,b as et,c as tt,A as st,C as nt}from"./RenderTargetSystem-D76QrDT_.js";import"./index-B1oj9KDv.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-D8cHMqV-.js";import"./Tabs-BMq9wODW.js";import"./RovingFocusItem-BJMUQ5DJ.js";import"./useToast-B5LaA6c-.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-BBcCt_Qm.js";import"./people-page-header-BbYSSpsO.js";import"./relationship-galaxy-connections-Cg4G5yYE.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-CByj_rCR.js";const he=class L{static _getPatternRepeat(e,t){const a=e&&e!=="clamp-to-edge",s=t&&t!=="clamp-to-edge";return a&&s?"repeat":a?"repeat-x":s?"repeat-y":"no-repeat"}start(e,t,a){}execute(e,t){const a=t.elements;if(!a||!a.length)return;const s=e.renderer,o=s.canvasContext,r=o.activeContext;for(let l=0;l<a.length;l++){const i=a[l];if(!i.packAsQuad)continue;const d=i,h=d.texture,v=h?C.getCanvasSource(h):null;if(!v)continue;const y=h.source.style,H=o.smoothProperty,W=y.scaleMode!=="nearest";r[H]!==W&&(r[H]=W),o.setBlendMode(t.blendMode);const F=s.globalUniforms.globalUniformData?.worldColor??4294967295,S=d.color,G=(F>>>24&255)/255,P=(S>>>24&255)/255,g=s.filter?.alphaMultiplier??1,M=G*P*g;if(M<=0)continue;r.globalAlpha=M;const K=F&16777215,k=S&16777215,q=Te(Z(k,K)),I=h.frame,V=y.addressModeU??y.addressMode,O=y.addressModeV??y.addressMode,u=L._getPatternRepeat(V,O),m=h.source._resolution??h.source.resolution??1,f=d.renderable?.renderGroup?.isCachedAsTexture,D=I.x*m,j=I.y*m,b=I.width*m,E=I.height*m,x=d.bounds,w=s.renderTarget.renderTarget.isRoot,R=x.minX,$=x.minY,U=x.maxX-x.minX,B=x.maxY-x.minY,T=h.rotate,c=h.uvs,se=Math.min(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),Fe=Math.max(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),de=u!=="no-repeat"&&(se<0||Fe>1),Q=T&&!(!de&&(q!==16777215||T));Q?(L._tempPatternMatrix.copyFrom(d.transform),Ce.matrixAppendRotationInv(L._tempPatternMatrix,T,R,$,U,B),o.setContextTransform(L._tempPatternMatrix,d.roundPixels===1,void 0,f&&w)):o.setContextTransform(d.transform,d.roundPixels===1,void 0,f&&w);const ne=U,ae=B;let X=Q?0:R,J=Q?0:$;if(!Q&&d.roundPixels===1&&(X|=0,J|=0),de){let oe=v;const N=q!==16777215&&!T,Y=I.width<=h.source.width&&I.height<=h.source.height;N&&Y&&(oe=C.getTintedCanvas({texture:h},q));const re=r.createPattern(oe,u);if(!re)continue;const pe=ne,ue=ae;if(pe===0||ue===0)continue;const me=1/pe,fe=1/ue,ge=(c.x1-c.x0)*me,ve=(c.y1-c.y0)*me,ye=(c.x3-c.x0)*fe,xe=(c.y3-c.y0)*fe,qe=c.x0-ge*X-ye*J,Ue=c.y0-ve*X-xe*J,ie=h.source.pixelWidth,ce=h.source.pixelHeight;L._tempPatternMatrix.set(ge*ie,ve*ce,ye*ie,xe*ce,qe*ie,Ue*ce),C.applyPatternTransform(re,L._tempPatternMatrix),r.fillStyle=re,r.fillRect(X,J,ne,ae)}else{const N=q!==16777215||T?C.getTintedCanvas({texture:h},q):v,Y=N!==v;r.drawImage(N,Y?0:D,Y?0:j,Y?N.width:b,Y?N.height:E,X,J,ne,ae)}}}};he._tempPatternMatrix=new A;he.extension={type:[_.CanvasPipesAdaptor],name:"batch"};let at=he;class Me{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,a){this._renderer.renderPipes.batch.break(a);const s=this._colorStack;s[this._colorStackIndex]=s[this._colorStackIndex-1]&e.mask;const o=this._colorStack[this._colorStackIndex];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1})),this._colorStackIndex++}pop(e,t,a){this._renderer.renderPipes.batch.break(a);const s=this._colorStack;this._colorStackIndex--;const o=s[this._colorStackIndex-1];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}Me.extension={type:[_.CanvasPipes],name:"colorMask"};function ot(n,e,t,a,s,o){o=Math.max(0,Math.min(o,Math.min(a,s)/2)),n.moveTo(e+o,t),n.lineTo(e+a-o,t),n.quadraticCurveTo(e+a,t,e+a,t+o),n.lineTo(e+a,t+s-o),n.quadraticCurveTo(e+a,t+s,e+a-o,t+s),n.lineTo(e+o,t+s),n.quadraticCurveTo(e,t+s,e,t+s-o),n.lineTo(e,t+o),n.quadraticCurveTo(e,t,e+o,t)}function we(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;ot(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.moveTo(t.x+t.radius,t.y),n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?(n.moveTo(t.x+t.halfWidth,t.y),n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2)):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.moveTo(1,0),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;n.moveTo(a[0],a[1]);for(let s=2;s<a.length;s+=2)n.lineTo(a[s],a[s+1]);t.closePath&&n.closePath();break}}}function rt(n,e,t){const a=[],s=[],o=[];if(!Pe[e.type]?.build(e,a))return!1;const l=e.closePath??!0;ke(a,t,!1,l,s,o);for(let i=0;i<o.length;i+=3){const d=o[i]*2,h=o[i+1]*2,v=o[i+2]*2;n.moveTo(s[d],s[d+1]),n.lineTo(s[h],s[h+1]),n.lineTo(s[v],s[v+1]),n.closePath()}return!0}function it(n,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const s=a.transform,o=s&&!s.isIdentity();o&&(n.save(),n.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),we(n,a.shape),o&&n.restore()}return!0}class Re{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){if(e.action!=="pushMaskBegin"&&e.action!=="popMaskEnd")return;const t=this._renderer,a=t.canvasContext,s=a?.activeContext;if(!s)return;if(e.action==="popMaskEnd"){this._canvasMaskStack.pop()&&s.restore();return}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const o=e.mask.mask;if(!(o instanceof Le)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const r=o,l=r.context?.instructions;if(!l?.length){this._canvasMaskStack.push(!1);return}s.save(),a.setContextTransform(r.groupTransform,(t._roundPixels|r._roundPixels)===1),s.beginPath();let i=!1,d=!1;for(let h=0;h<l.length;h++){const v=l[h],y=v.action;if(y!=="fill"&&y!=="stroke")continue;const H=v.data,W=H?.path?.shapePath;if(!W?.shapePrimitives?.length)continue;const F=y==="stroke",S=W.shapePrimitives;for(let G=0;G<S.length;G++){const P=S[G];if(!P?.shape)continue;const g=P.transform,M=g&&!g.isIdentity();M&&(s.save(),s.transform(g.a,g.b,g.c,g.d,g.tx,g.ty)),F&&H.style?i=rt(s,P.shape,H.style)||i:(we(s,P.shape),d=it(s,P.holes)||d,i=!0),M&&s.restore()}}if(!i){s.restore(),this._canvasMaskStack.push(!1);return}d?s.clip("evenodd"):s.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),Oe(t))}}Re.extension={type:[_.CanvasPipes],name:"stencilMask"};const p="source-over";function ct(){const n=je(),e=Object.create(null);return e.inherit=p,e.none=p,e.normal="source-over",e.add="lighter",e.multiply=n?"multiply":p,e.screen=n?"screen":p,e.overlay=n?"overlay":p,e.darken=n?"darken":p,e.lighten=n?"lighten":p,e["color-dodge"]=n?"color-dodge":p,e["color-burn"]=n?"color-burn":p,e["hard-light"]=n?"hard-light":p,e["soft-light"]=n?"soft-light":p,e.difference=n?"difference":p,e.exclusion=n?"exclusion":p,e.saturation=n?"saturation":p,e.color=n?"color":p,e.luminosity=n?"luminosity":p,e["linear-burn"]=n?"color-burn":p,e["linear-dodge"]=n?"color-dodge":p,e["linear-light"]=n?"hard-light":p,e["pin-light"]=n?"hard-light":p,e["vivid-light"]=n?"hard-light":p,e["hard-mix"]=p,e.negation=n?"difference":p,e["normal-npm"]=e.normal,e["add-npm"]=e.add,e["screen-npm"]=e.screen,e.erase="destination-out",e.subtract=p,e.divide=p,e.min=p,e.max=p,e}const lt=new A;class Ie{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=ct(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,a,s){const o=s?A.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||A.IDENTITY;let r=lt;r.copyFrom(o),r.append(e);const l=this._projTransform,i=this.activeResolution;if(a=a||i,l){const d=A.shared;d.copyFrom(r),d.prepend(l),r=d}t?this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*i|0,r.ty*i|0):this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*i,r.ty*i)}clear(e,t){const a=this.activeContext,s=this._renderer;if(a.clearRect(0,0,s.width,s.height),e){const o=be.shared.setValue(e);a.globalAlpha=t??o.alpha,a.fillStyle=o.toHex(),a.fillRect(0,0,s.width,s.height),a.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t){this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}Ie.extension={type:[_.CanvasSystem],name:"canvasContext"};class Be{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}Be.extension={type:[_.CanvasSystem],name:"limits"};const ht="#808080",z=new A,dt=new A,pt=new A,le=new A;function ut(n,e,t){n.beginPath();for(let a=0;a<t.length;a+=3){const s=t[a]*2,o=t[a+1]*2,r=t[a+2]*2;n.moveTo(e[s],e[s+1]),n.lineTo(e[o],e[o+1]),n.lineTo(e[r],e[r+1]),n.closePath()}n.fill()}function mt(n){return`#${(n&16777215).toString(16).padStart(6,"0")}`}function ft(n,e,t,a,s,o){o=Math.max(0,Math.min(o,Math.min(a,s)/2)),n.moveTo(e+o,t),n.lineTo(e+a-o,t),n.quadraticCurveTo(e+a,t,e+a,t+o),n.lineTo(e+a,t+s-o),n.quadraticCurveTo(e+a,t+s,e+a-o,t+s),n.lineTo(e+o,t+s),n.quadraticCurveTo(e,t+s,e,t+s-o),n.lineTo(e,t+o),n.quadraticCurveTo(e,t,e+o,t)}function ee(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;ft(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;n.moveTo(a[0],a[1]);for(let s=2;s<a.length;s+=2)n.lineTo(a[s],a[s+1]);t.closePath&&n.closePath();break}}}function gt(n,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const s=a.transform,o=s&&!s.isIdentity();o&&(n.save(),n.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),ee(n,a.shape),o&&n.restore()}return!0}function vt(n,e,t,a){const s=n.fill;if(s instanceof Ye){s.buildGradient();const r=s.texture;if(r){const l=C.getTintedPattern(r,e),i=t?le.copyFrom(t).scale(r.source.pixelWidth,r.source.pixelHeight):le.copyFrom(s.transform);return a&&!n.textureSpace&&i.append(a),C.applyPatternTransform(l,i),l}}if(s instanceof Ve){const r=C.getTintedPattern(s.texture,e);return C.applyPatternTransform(r,s.transform,!1),r}const o=n.texture;if(o&&o!==_e.WHITE){if(!o.source.resource)return ht;const r=C.getTintedPattern(o,e),l=t?le.copyFrom(t).scale(o.source.pixelWidth,o.source.pixelHeight):n.matrix;return C.applyPatternTransform(r,l),r}return mt(e)}class Ae{constructor(){this.shader=null}contextChange(e){}execute(e,t){const a=e.renderer,s=a.canvasContext,o=s.activeContext,r=t.groupTransform,l=a.globalUniforms.globalUniformData?.worldColor??4294967295,i=t.groupColorAlpha,d=(l>>>24&255)/255,h=(i>>>24&255)/255,v=a.filter?.alphaMultiplier??1,y=d*h*v;if(y<=0)return;const H=l&16777215,W=i&16777215,F=Te(Z(W,H)),S=a._roundPixels|t._roundPixels;o.save(),s.setContextTransform(r,S===1),s.setBlendMode(t.groupBlendMode);const G=t.context.instructions;for(let P=0;P<G.length;P++){const g=G[P];if(g.action==="texture"){const u=g.data,m=u.image,f=m?C.getCanvasSource(m):null;if(!f)continue;const D=u.alpha*y;if(D<=0)continue;const j=Z(u.style,F);o.globalAlpha=D;let b=f;j!==16777215&&(b=C.getTintedCanvas({texture:m},j));const E=m.frame,x=m.source._resolution??m.source.resolution??1;let w=E.x*x,R=E.y*x;const $=E.width*x,U=E.height*x;b!==f&&(w=0,R=0);const B=u.transform,T=B&&!B.isIdentity(),c=m.rotate;T||c?(z.copyFrom(r),T&&z.append(B),c&&Ce.matrixAppendRotationInv(z,c,u.dx,u.dy,u.dw,u.dh),s.setContextTransform(z,S===1)):s.setContextTransform(r,S===1),o.drawImage(b,w,R,b===f?$:b.width,b===f?U:b.height,c?0:u.dx,c?0:u.dy,u.dw,u.dh),(T||c)&&s.setContextTransform(r,S===1);continue}const M=g.data,K=M?.path?.shapePath;if(!K?.shapePrimitives?.length)continue;const k=M.style,q=Z(k.color,F),I=k.alpha*y;if(I<=0)continue;const V=g.action==="stroke";if(o.globalAlpha=I,V){const u=k;o.lineWidth=u.width,o.lineCap=u.cap,o.lineJoin=u.join,o.miterLimit=u.miterLimit}const O=K.shapePrimitives;if(!V&&M.hole?.shapePath?.shapePrimitives?.length){const u=O[O.length-1];u.holes=M.hole.shapePath.shapePrimitives}for(let u=0;u<O.length;u++){const m=O[u];if(!m?.shape)continue;const f=m.transform,D=f&&!f.isIdentity(),j=k.texture&&k.texture!==_e.WHITE,b=k.textureSpace==="global"?f:null,E=j?Ne(dt,k,m.shape,b):null,x=D?pt.copyFrom(r).append(f):r,w=vt(k,q,E,x);if(D&&(o.save(),o.transform(f.a,f.b,f.c,f.d,f.tx,f.ty)),V){const R=k;if(R.alignment!==.5&&!R.pixelLine){const U=[],B=[],T=[];if(Pe[m.shape.type]?.build(m.shape,U)){const se=m.shape.closePath??!0;ke(U,R,!1,se,B,T),o.fillStyle=w,ut(o,B,T)}else o.strokeStyle=w,o.beginPath(),ee(o,m.shape),o.stroke()}else o.strokeStyle=w,o.beginPath(),ee(o,m.shape),o.stroke()}else o.fillStyle=w,o.beginPath(),ee(o,m.shape),gt(o,m.holes)?o.fill("evenodd"):o.fill();D&&o.restore()}}o.restore()}destroy(){this.shader=null}}Ae.extension={type:[_.CanvasPipesAdaptor],name:"graphics"};class yt{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:a,context:s}=this._ensureCanvas(t);return{canvas:a,context:s,width:a.width,height:a.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:a}=this._ensureCanvas(t);a.width=e.pixelWidth,a.height=e.pixelHeight}startRenderPass(e,t,a,s){const o=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=o.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,a,s)}clear(e,t,a,s){const r=this._renderTargetSystem.getGpuRenderTarget(e).context,l=s||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(r.setTransform(1,0,0,1,0,0),r.clearRect(l.x,l.y,l.width,l.height),a){const i=be.shared.setValue(a);i.alpha>0&&(r.globalAlpha=i.alpha,r.fillStyle=i.toHex(),r.fillRect(l.x,l.y,l.width,l.height),r.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,a,s,o){const l=this._renderTargetSystem.getGpuRenderTarget(e).canvas,i=t.source,{context:d}=this._ensureCanvas(i),h=o?.x??0,v=o?.y??0;return d.drawImage(l,a.x,a.y,s.width,s.height,h,v,s.width,s.height),i.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;(!t||!$e.test(t))&&(t=Se.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(t.width=e.pixelWidth,t.height=e.pixelHeight);const a=t.getContext("2d");return{canvas:t,context:a}}}class He extends Ke{constructor(e){super(e),this.adaptor=new yt,this.adaptor.init(e,this)}}He.extension={type:[_.CanvasSystem],name:"renderTarget"};class Ge{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=Se.get().createCanvas(),a=t.getContext("2d"),s=C.getCanvasSource(e);if(!s)return t;const o=e.frame,r=e.source._resolution??e.source.resolution??1,l=o.x*r,i=o.y*r,d=o.width*r,h=o.height*r;return t.width=Math.ceil(d),t.height=Math.ceil(h),a.drawImage(s,l,i,d,h,0,0,d,h),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}Ge.extension={type:[_.CanvasSystem],name:"texture"};const xt=[...Qe,Ie,Be,Ge,He],Ct=[ze,Ze,et,tt,st,Re,Me,nt],Tt=[at,Ae],De=[],Ee=[],We=[];te.handleByNamedList(_.CanvasSystem,De);te.handleByNamedList(_.CanvasPipes,Ee);te.handleByNamedList(_.CanvasPipesAdaptor,We);te.add(...xt,...Ct,...Tt);class Et extends Xe{constructor(){const e={name:"canvas",type:Je.CANVAS,systems:De,renderPipes:Ee,renderPipeAdaptors:We};super(e)}}export{Et as CanvasRenderer};
1
+ import{f as C,h as Ce,i as Te,m as Z,M as A,j as _,k as Le,w as Oe,s as Pe,l as ke,n as je,C as be,T as _e,o as Ne,F as Ye,p as Ve,q as $e,D as Se,A as Xe,R as Je,r as te}from"./RelationshipGalaxyCanvas-BO5-MowG.js";import{R as Ke,S as Qe,B as ze,a as Ze,b as et,c as tt,A as st,C as nt}from"./RenderTargetSystem-CfuoUG_y.js";import"./index-bQ9oj54q.js";import"./vendor-snapdom--nZvo8Sg.js";import"./index-CN9WMxb3.js";import"./Tabs-DJ5p8gb6.js";import"./RovingFocusItem-FpYwYEP_.js";import"./useToast-DPkgv34s.js";import"./LoadingState.vue_vue_type_script_setup_true_lang-uF54r-dT.js";import"./people-page-header-CKXRSnpl.js";import"./relationship-galaxy-connections-Cg4G5yYE.js";import"./relationship-galaxy-viewport-Cwfa51ER.js";import"./Filter-Duzxgudo.js";const he=class L{static _getPatternRepeat(e,t){const a=e&&e!=="clamp-to-edge",s=t&&t!=="clamp-to-edge";return a&&s?"repeat":a?"repeat-x":s?"repeat-y":"no-repeat"}start(e,t,a){}execute(e,t){const a=t.elements;if(!a||!a.length)return;const s=e.renderer,o=s.canvasContext,r=o.activeContext;for(let l=0;l<a.length;l++){const i=a[l];if(!i.packAsQuad)continue;const d=i,h=d.texture,v=h?C.getCanvasSource(h):null;if(!v)continue;const y=h.source.style,H=o.smoothProperty,W=y.scaleMode!=="nearest";r[H]!==W&&(r[H]=W),o.setBlendMode(t.blendMode);const F=s.globalUniforms.globalUniformData?.worldColor??4294967295,S=d.color,G=(F>>>24&255)/255,P=(S>>>24&255)/255,g=s.filter?.alphaMultiplier??1,M=G*P*g;if(M<=0)continue;r.globalAlpha=M;const K=F&16777215,k=S&16777215,q=Te(Z(k,K)),I=h.frame,V=y.addressModeU??y.addressMode,O=y.addressModeV??y.addressMode,u=L._getPatternRepeat(V,O),m=h.source._resolution??h.source.resolution??1,f=d.renderable?.renderGroup?.isCachedAsTexture,D=I.x*m,j=I.y*m,b=I.width*m,E=I.height*m,x=d.bounds,w=s.renderTarget.renderTarget.isRoot,R=x.minX,$=x.minY,U=x.maxX-x.minX,B=x.maxY-x.minY,T=h.rotate,c=h.uvs,se=Math.min(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),Fe=Math.max(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),de=u!=="no-repeat"&&(se<0||Fe>1),Q=T&&!(!de&&(q!==16777215||T));Q?(L._tempPatternMatrix.copyFrom(d.transform),Ce.matrixAppendRotationInv(L._tempPatternMatrix,T,R,$,U,B),o.setContextTransform(L._tempPatternMatrix,d.roundPixels===1,void 0,f&&w)):o.setContextTransform(d.transform,d.roundPixels===1,void 0,f&&w);const ne=U,ae=B;let X=Q?0:R,J=Q?0:$;if(!Q&&d.roundPixels===1&&(X|=0,J|=0),de){let oe=v;const N=q!==16777215&&!T,Y=I.width<=h.source.width&&I.height<=h.source.height;N&&Y&&(oe=C.getTintedCanvas({texture:h},q));const re=r.createPattern(oe,u);if(!re)continue;const pe=ne,ue=ae;if(pe===0||ue===0)continue;const me=1/pe,fe=1/ue,ge=(c.x1-c.x0)*me,ve=(c.y1-c.y0)*me,ye=(c.x3-c.x0)*fe,xe=(c.y3-c.y0)*fe,qe=c.x0-ge*X-ye*J,Ue=c.y0-ve*X-xe*J,ie=h.source.pixelWidth,ce=h.source.pixelHeight;L._tempPatternMatrix.set(ge*ie,ve*ce,ye*ie,xe*ce,qe*ie,Ue*ce),C.applyPatternTransform(re,L._tempPatternMatrix),r.fillStyle=re,r.fillRect(X,J,ne,ae)}else{const N=q!==16777215||T?C.getTintedCanvas({texture:h},q):v,Y=N!==v;r.drawImage(N,Y?0:D,Y?0:j,Y?N.width:b,Y?N.height:E,X,J,ne,ae)}}}};he._tempPatternMatrix=new A;he.extension={type:[_.CanvasPipesAdaptor],name:"batch"};let at=he;class Me{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,a){this._renderer.renderPipes.batch.break(a);const s=this._colorStack;s[this._colorStackIndex]=s[this._colorStackIndex-1]&e.mask;const o=this._colorStack[this._colorStackIndex];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1})),this._colorStackIndex++}pop(e,t,a){this._renderer.renderPipes.batch.break(a);const s=this._colorStack;this._colorStackIndex--;const o=s[this._colorStackIndex-1];o!==this._currentColor&&(this._currentColor=o,a.add({renderPipeId:"colorMask",colorMask:o,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}Me.extension={type:[_.CanvasPipes],name:"colorMask"};function ot(n,e,t,a,s,o){o=Math.max(0,Math.min(o,Math.min(a,s)/2)),n.moveTo(e+o,t),n.lineTo(e+a-o,t),n.quadraticCurveTo(e+a,t,e+a,t+o),n.lineTo(e+a,t+s-o),n.quadraticCurveTo(e+a,t+s,e+a-o,t+s),n.lineTo(e+o,t+s),n.quadraticCurveTo(e,t+s,e,t+s-o),n.lineTo(e,t+o),n.quadraticCurveTo(e,t,e+o,t)}function we(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;ot(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.moveTo(t.x+t.radius,t.y),n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?(n.moveTo(t.x+t.halfWidth,t.y),n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2)):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.moveTo(1,0),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;n.moveTo(a[0],a[1]);for(let s=2;s<a.length;s+=2)n.lineTo(a[s],a[s+1]);t.closePath&&n.closePath();break}}}function rt(n,e,t){const a=[],s=[],o=[];if(!Pe[e.type]?.build(e,a))return!1;const l=e.closePath??!0;ke(a,t,!1,l,s,o);for(let i=0;i<o.length;i+=3){const d=o[i]*2,h=o[i+1]*2,v=o[i+2]*2;n.moveTo(s[d],s[d+1]),n.lineTo(s[h],s[h+1]),n.lineTo(s[v],s[v+1]),n.closePath()}return!0}function it(n,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const s=a.transform,o=s&&!s.isIdentity();o&&(n.save(),n.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),we(n,a.shape),o&&n.restore()}return!0}class Re{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,a){this._renderer.renderPipes.batch.break(a),a.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){if(e.action!=="pushMaskBegin"&&e.action!=="popMaskEnd")return;const t=this._renderer,a=t.canvasContext,s=a?.activeContext;if(!s)return;if(e.action==="popMaskEnd"){this._canvasMaskStack.pop()&&s.restore();return}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const o=e.mask.mask;if(!(o instanceof Le)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const r=o,l=r.context?.instructions;if(!l?.length){this._canvasMaskStack.push(!1);return}s.save(),a.setContextTransform(r.groupTransform,(t._roundPixels|r._roundPixels)===1),s.beginPath();let i=!1,d=!1;for(let h=0;h<l.length;h++){const v=l[h],y=v.action;if(y!=="fill"&&y!=="stroke")continue;const H=v.data,W=H?.path?.shapePath;if(!W?.shapePrimitives?.length)continue;const F=y==="stroke",S=W.shapePrimitives;for(let G=0;G<S.length;G++){const P=S[G];if(!P?.shape)continue;const g=P.transform,M=g&&!g.isIdentity();M&&(s.save(),s.transform(g.a,g.b,g.c,g.d,g.tx,g.ty)),F&&H.style?i=rt(s,P.shape,H.style)||i:(we(s,P.shape),d=it(s,P.holes)||d,i=!0),M&&s.restore()}}if(!i){s.restore(),this._canvasMaskStack.push(!1);return}d?s.clip("evenodd"):s.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),Oe(t))}}Re.extension={type:[_.CanvasPipes],name:"stencilMask"};const p="source-over";function ct(){const n=je(),e=Object.create(null);return e.inherit=p,e.none=p,e.normal="source-over",e.add="lighter",e.multiply=n?"multiply":p,e.screen=n?"screen":p,e.overlay=n?"overlay":p,e.darken=n?"darken":p,e.lighten=n?"lighten":p,e["color-dodge"]=n?"color-dodge":p,e["color-burn"]=n?"color-burn":p,e["hard-light"]=n?"hard-light":p,e["soft-light"]=n?"soft-light":p,e.difference=n?"difference":p,e.exclusion=n?"exclusion":p,e.saturation=n?"saturation":p,e.color=n?"color":p,e.luminosity=n?"luminosity":p,e["linear-burn"]=n?"color-burn":p,e["linear-dodge"]=n?"color-dodge":p,e["linear-light"]=n?"hard-light":p,e["pin-light"]=n?"hard-light":p,e["vivid-light"]=n?"hard-light":p,e["hard-mix"]=p,e.negation=n?"difference":p,e["normal-npm"]=e.normal,e["add-npm"]=e.add,e["screen-npm"]=e.screen,e.erase="destination-out",e.subtract=p,e.divide=p,e.min=p,e.max=p,e}const lt=new A;class Ie{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=ct(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const t=this.rootContext;t.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":t.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":t.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":t.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,a,s){const o=s?A.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||A.IDENTITY;let r=lt;r.copyFrom(o),r.append(e);const l=this._projTransform,i=this.activeResolution;if(a=a||i,l){const d=A.shared;d.copyFrom(r),d.prepend(l),r=d}t?this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*i|0,r.ty*i|0):this.activeContext.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*i,r.ty*i)}clear(e,t){const a=this.activeContext,s=this._renderer;if(a.clearRect(0,0,s.width,s.height),e){const o=be.shared.setValue(e);a.globalAlpha=t??o.alpha,a.fillStyle=o.toHex(),a.fillRect(0,0,s.width,s.height),a.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t){this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}Ie.extension={type:[_.CanvasSystem],name:"canvasContext"};class Be{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}Be.extension={type:[_.CanvasSystem],name:"limits"};const ht="#808080",z=new A,dt=new A,pt=new A,le=new A;function ut(n,e,t){n.beginPath();for(let a=0;a<t.length;a+=3){const s=t[a]*2,o=t[a+1]*2,r=t[a+2]*2;n.moveTo(e[s],e[s+1]),n.lineTo(e[o],e[o+1]),n.lineTo(e[r],e[r+1]),n.closePath()}n.fill()}function mt(n){return`#${(n&16777215).toString(16).padStart(6,"0")}`}function ft(n,e,t,a,s,o){o=Math.max(0,Math.min(o,Math.min(a,s)/2)),n.moveTo(e+o,t),n.lineTo(e+a-o,t),n.quadraticCurveTo(e+a,t,e+a,t+o),n.lineTo(e+a,t+s-o),n.quadraticCurveTo(e+a,t+s,e+a-o,t+s),n.lineTo(e+o,t+s),n.quadraticCurveTo(e,t+s,e,t+s-o),n.lineTo(e,t+o),n.quadraticCurveTo(e,t,e+o,t)}function ee(n,e){switch(e.type){case"rectangle":{const t=e;n.rect(t.x,t.y,t.width,t.height);break}case"roundedRectangle":{const t=e;ft(n,t.x,t.y,t.width,t.height,t.radius);break}case"circle":{const t=e;n.arc(t.x,t.y,t.radius,0,Math.PI*2);break}case"ellipse":{const t=e;n.ellipse?n.ellipse(t.x,t.y,t.halfWidth,t.halfHeight,0,0,Math.PI*2):(n.save(),n.translate(t.x,t.y),n.scale(t.halfWidth,t.halfHeight),n.arc(0,0,1,0,Math.PI*2),n.restore());break}case"triangle":{const t=e;n.moveTo(t.x,t.y),n.lineTo(t.x2,t.y2),n.lineTo(t.x3,t.y3),n.closePath();break}default:{const t=e,a=t.points;if(!a?.length)break;n.moveTo(a[0],a[1]);for(let s=2;s<a.length;s+=2)n.lineTo(a[s],a[s+1]);t.closePath&&n.closePath();break}}}function gt(n,e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){const a=e[t];if(!a?.shape)continue;const s=a.transform,o=s&&!s.isIdentity();o&&(n.save(),n.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),ee(n,a.shape),o&&n.restore()}return!0}function vt(n,e,t,a){const s=n.fill;if(s instanceof Ye){s.buildGradient();const r=s.texture;if(r){const l=C.getTintedPattern(r,e),i=t?le.copyFrom(t).scale(r.source.pixelWidth,r.source.pixelHeight):le.copyFrom(s.transform);return a&&!n.textureSpace&&i.append(a),C.applyPatternTransform(l,i),l}}if(s instanceof Ve){const r=C.getTintedPattern(s.texture,e);return C.applyPatternTransform(r,s.transform,!1),r}const o=n.texture;if(o&&o!==_e.WHITE){if(!o.source.resource)return ht;const r=C.getTintedPattern(o,e),l=t?le.copyFrom(t).scale(o.source.pixelWidth,o.source.pixelHeight):n.matrix;return C.applyPatternTransform(r,l),r}return mt(e)}class Ae{constructor(){this.shader=null}contextChange(e){}execute(e,t){const a=e.renderer,s=a.canvasContext,o=s.activeContext,r=t.groupTransform,l=a.globalUniforms.globalUniformData?.worldColor??4294967295,i=t.groupColorAlpha,d=(l>>>24&255)/255,h=(i>>>24&255)/255,v=a.filter?.alphaMultiplier??1,y=d*h*v;if(y<=0)return;const H=l&16777215,W=i&16777215,F=Te(Z(W,H)),S=a._roundPixels|t._roundPixels;o.save(),s.setContextTransform(r,S===1),s.setBlendMode(t.groupBlendMode);const G=t.context.instructions;for(let P=0;P<G.length;P++){const g=G[P];if(g.action==="texture"){const u=g.data,m=u.image,f=m?C.getCanvasSource(m):null;if(!f)continue;const D=u.alpha*y;if(D<=0)continue;const j=Z(u.style,F);o.globalAlpha=D;let b=f;j!==16777215&&(b=C.getTintedCanvas({texture:m},j));const E=m.frame,x=m.source._resolution??m.source.resolution??1;let w=E.x*x,R=E.y*x;const $=E.width*x,U=E.height*x;b!==f&&(w=0,R=0);const B=u.transform,T=B&&!B.isIdentity(),c=m.rotate;T||c?(z.copyFrom(r),T&&z.append(B),c&&Ce.matrixAppendRotationInv(z,c,u.dx,u.dy,u.dw,u.dh),s.setContextTransform(z,S===1)):s.setContextTransform(r,S===1),o.drawImage(b,w,R,b===f?$:b.width,b===f?U:b.height,c?0:u.dx,c?0:u.dy,u.dw,u.dh),(T||c)&&s.setContextTransform(r,S===1);continue}const M=g.data,K=M?.path?.shapePath;if(!K?.shapePrimitives?.length)continue;const k=M.style,q=Z(k.color,F),I=k.alpha*y;if(I<=0)continue;const V=g.action==="stroke";if(o.globalAlpha=I,V){const u=k;o.lineWidth=u.width,o.lineCap=u.cap,o.lineJoin=u.join,o.miterLimit=u.miterLimit}const O=K.shapePrimitives;if(!V&&M.hole?.shapePath?.shapePrimitives?.length){const u=O[O.length-1];u.holes=M.hole.shapePath.shapePrimitives}for(let u=0;u<O.length;u++){const m=O[u];if(!m?.shape)continue;const f=m.transform,D=f&&!f.isIdentity(),j=k.texture&&k.texture!==_e.WHITE,b=k.textureSpace==="global"?f:null,E=j?Ne(dt,k,m.shape,b):null,x=D?pt.copyFrom(r).append(f):r,w=vt(k,q,E,x);if(D&&(o.save(),o.transform(f.a,f.b,f.c,f.d,f.tx,f.ty)),V){const R=k;if(R.alignment!==.5&&!R.pixelLine){const U=[],B=[],T=[];if(Pe[m.shape.type]?.build(m.shape,U)){const se=m.shape.closePath??!0;ke(U,R,!1,se,B,T),o.fillStyle=w,ut(o,B,T)}else o.strokeStyle=w,o.beginPath(),ee(o,m.shape),o.stroke()}else o.strokeStyle=w,o.beginPath(),ee(o,m.shape),o.stroke()}else o.fillStyle=w,o.beginPath(),ee(o,m.shape),gt(o,m.holes)?o.fill("evenodd"):o.fill();D&&o.restore()}}o.restore()}destroy(){this.shader=null}}Ae.extension={type:[_.CanvasPipesAdaptor],name:"graphics"};class yt{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:a,context:s}=this._ensureCanvas(t);return{canvas:a,context:s,width:a.width,height:a.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:a}=this._ensureCanvas(t);a.width=e.pixelWidth,a.height=e.pixelHeight}startRenderPass(e,t,a,s){const o=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=o.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,a,s)}clear(e,t,a,s){const r=this._renderTargetSystem.getGpuRenderTarget(e).context,l=s||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(r.setTransform(1,0,0,1,0,0),r.clearRect(l.x,l.y,l.width,l.height),a){const i=be.shared.setValue(a);i.alpha>0&&(r.globalAlpha=i.alpha,r.fillStyle=i.toHex(),r.fillRect(l.x,l.y,l.width,l.height),r.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,a,s,o){const l=this._renderTargetSystem.getGpuRenderTarget(e).canvas,i=t.source,{context:d}=this._ensureCanvas(i),h=o?.x??0,v=o?.y??0;return d.drawImage(l,a.x,a.y,s.width,s.height,h,v,s.width,s.height),i.update(),t}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;(!t||!$e.test(t))&&(t=Se.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),(t.width!==e.pixelWidth||t.height!==e.pixelHeight)&&(t.width=e.pixelWidth,t.height=e.pixelHeight);const a=t.getContext("2d");return{canvas:t,context:a}}}class He extends Ke{constructor(e){super(e),this.adaptor=new yt,this.adaptor.init(e,this)}}He.extension={type:[_.CanvasSystem],name:"renderTarget"};class Ge{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=Se.get().createCanvas(),a=t.getContext("2d"),s=C.getCanvasSource(e);if(!s)return t;const o=e.frame,r=e.source._resolution??e.source.resolution??1,l=o.x*r,i=o.y*r,d=o.width*r,h=o.height*r;return t.width=Math.ceil(d),t.height=Math.ceil(h),a.drawImage(s,l,i,d,h,0,0,d,h),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}Ge.extension={type:[_.CanvasSystem],name:"texture"};const xt=[...Qe,Ie,Be,Ge,He],Ct=[ze,Ze,et,tt,st,Re,Me,nt],Tt=[at,Ae],De=[],Ee=[],We=[];te.handleByNamedList(_.CanvasSystem,De);te.handleByNamedList(_.CanvasPipes,Ee);te.handleByNamedList(_.CanvasPipesAdaptor,We);te.add(...xt,...Ct,...Tt);class Et extends Xe{constructor(){const e={name:"canvas",type:Je.CANVAS,systems:De,renderPipes:Ee,renderPipeAdaptors:We};super(e)}}export{Et as CanvasRenderer};
@@ -1 +1 @@
1
- import{d as u,ab as h,o as a,c as r,O as p,n as o,a as n,l as m,e as l,ao as g,ah as v}from"./index-B1oj9KDv.js";const f={key:0,class:"insight-card-glow-center absolute bottom-0 left-1/3 h-[30%] w-[30%] rounded-full blur-[40px]"},_=u({__name:"CardDecoration",props:{theme:{}},setup(i){const s=i,d=h(),e=l(()=>s.theme!==void 0),c=l(()=>{const t=g(s.theme??d.insightCardTheme);return{"--insight-card-glow-start":t.startColor,"--insight-card-glow-end":t.endColor}});return(t,b)=>(a(),r("div",{class:o(["pointer-events-none absolute inset-0 overflow-hidden",{"card-decoration--vivid":e.value}]),style:p(c.value)},[n("div",{class:o(["insight-card-glow-start absolute rounded-full",e.value?"-left-[15%] -top-[15%] h-[60%] w-[60%] blur-[60px]":"-left-[20%] -top-[20%] h-[70%] w-[70%] blur-[80px]"])},null,2),n("div",{class:o(["insight-card-glow-end absolute rounded-full",e.value?"-right-[15%] top-[5%] h-[60%] w-[60%] blur-[60px]":"-right-[20%] top-[10%] h-[70%] w-[70%] blur-[80px]"])},null,2),e.value?(a(),r("div",f)):m("",!0)],6))}}),C=v(_,[["__scopeId","data-v-17f2762c"]]);export{C};
1
+ import{d as u,ab as h,o as a,c as r,O as p,n as o,a as n,l as m,e as l,ao as g,ah as v}from"./index-bQ9oj54q.js";const f={key:0,class:"insight-card-glow-center absolute bottom-0 left-1/3 h-[30%] w-[30%] rounded-full blur-[40px]"},_=u({__name:"CardDecoration",props:{theme:{}},setup(i){const s=i,d=h(),e=l(()=>s.theme!==void 0),c=l(()=>{const t=g(s.theme??d.insightCardTheme);return{"--insight-card-glow-start":t.startColor,"--insight-card-glow-end":t.endColor}});return(t,b)=>(a(),r("div",{class:o(["pointer-events-none absolute inset-0 overflow-hidden",{"card-decoration--vivid":e.value}]),style:p(c.value)},[n("div",{class:o(["insight-card-glow-start absolute rounded-full",e.value?"-left-[15%] -top-[15%] h-[60%] w-[60%] blur-[60px]":"-left-[20%] -top-[20%] h-[70%] w-[70%] blur-[80px]"])},null,2),n("div",{class:o(["insight-card-glow-end absolute rounded-full",e.value?"-right-[15%] top-[5%] h-[60%] w-[60%] blur-[60px]":"-right-[20%] top-[10%] h-[70%] w-[70%] blur-[80px]"])},null,2),e.value?(a(),r("div",f)):m("",!0)],6))}}),C=v(_,[["__scopeId","data-v-17f2762c"]]);export{C};
@@ -1 +1 @@
1
- import{ar as H,as as U,aT as j,aU as K,aY as X,aH as $,o as r,f as i,w as u,g as e,aZ as F,n as m,r as y,l as c,z as k,a_ as G,a$ as O,b0 as N,b1 as J,m as Q,b2 as Y,af as Z,b3 as C,a9 as q,p as x,b4 as R,a as g,c as L,k as ee,e as S,aw as T,b5 as te,av as oe,d as ae,a6 as re,J as ne,x as se,al as le,O as ie,aR as de,a8 as ce,b as I}from"./index-B1oj9KDv.js";import{B as ue,C as pe,N as fe,_ as me,S as ye,a as he}from"./ChatRecordWorkspace-7prKd-Tq.js";import"./vendor-snapdom--nZvo8Sg.js";import"./useToast-B5LaA6c-.js";import"./DatePicker.vue_vue_type_script_setup_true_lang-D9Ul_GYz.js";import"./clamp-jFYhBC76.js";import"./useFormControl-CrWi_6Hn.js";import"./VisuallyHiddenInput-BAFpkxMI.js";const ve={slots:{overlay:"fixed inset-0 bg-elevated/75",content:"fixed bg-default ring ring-default flex focus:outline-none",handle:["shrink-0 !bg-accented","transition-opacity"],container:"w-full flex flex-col gap-4 p-4 overflow-y-auto",header:"",title:"text-highlighted font-semibold",description:"mt-1 text-muted text-sm",body:"flex-1",footer:"flex flex-col gap-1.5"},variants:{direction:{top:{content:"mb-24 flex-col-reverse",handle:"mb-4"},right:{content:"flex-row rtl:flex-row-reverse",handle:"!ml-4"},bottom:{content:"mt-24 flex-col",handle:"mt-4"},left:{content:"flex-row-reverse rtl:flex-row",handle:"!mr-4"}},inset:{true:{content:"rounded-lg after:hidden overflow-hidden [--initial-transform:calc(100%+1.5rem)]"}},snapPoints:{true:""}},compoundVariants:[{direction:["top","bottom"],class:{content:"h-auto max-h-[96%]",handle:"!w-12 !h-1.5 mx-auto"}},{direction:["top","bottom"],snapPoints:!0,class:{content:"h-full"}},{direction:["right","left"],class:{content:"w-auto max-w-[calc(100%-2rem)]",handle:"!h-12 !w-1.5 mt-auto mb-auto"}},{direction:["right","left"],snapPoints:!0,class:{content:"w-full"}},{direction:"top",inset:!0,class:{content:"inset-x-4 top-4"}},{direction:"top",inset:!1,class:{content:"inset-x-0 top-0 rounded-b-lg"}},{direction:"bottom",inset:!0,class:{content:"inset-x-4 bottom-4"}},{direction:"bottom",inset:!1,class:{content:"inset-x-0 bottom-0 rounded-t-lg"}},{direction:"left",inset:!0,class:{content:"inset-y-4 left-4"}},{direction:"left",inset:!1,class:{content:"inset-y-0 left-0 rounded-r-lg"}},{direction:"right",inset:!0,class:{content:"inset-y-4 right-4"}},{direction:"right",inset:!1,class:{content:"inset-y-0 right-0 rounded-l-lg"}}]},we={__name:"Drawer",props:{as:{type:null,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},inset:{type:Boolean,required:!1},content:{type:Object,required:!1},overlay:{type:Boolean,required:!1,default:!0},handle:{type:Boolean,required:!1,default:!0},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},nested:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},activeSnapPoint:{type:[Number,String,null],required:!1},closeThreshold:{type:Number,required:!1},shouldScaleBackground:{type:Boolean,required:!1},setBackgroundColorOnScale:{type:Boolean,required:!1},scrollLockTimeout:{type:Number,required:!1},fixed:{type:Boolean,required:!1},dismissible:{type:Boolean,required:!1,default:!0},modal:{type:Boolean,required:!1,default:!0},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},direction:{type:String,required:!1,default:"bottom"},noBodyStyles:{type:Boolean,required:!1},handleOnly:{type:Boolean,required:!1},preventScrollRestoration:{type:Boolean,required:!1},snapPoints:{type:Array,required:!1}},emits:["close:prevent","drag","release","close","update:open","update:activeSnapPoint","animationEnd"],setup(E,{emit:_}){const p=E,b=_,o=H(),t=U("drawer",p),f=oe(),d=j(K(t,"activeSnapPoint","closeThreshold","shouldScaleBackground","setBackgroundColorOnScale","scrollLockTimeout","fixed","dismissible","modal","open","defaultOpen","nested","direction","noBodyStyles","handleOnly","preventScrollRestoration","snapPoints"),b),v=X($(()=>t.portal)),B=$(()=>t.content),w=S(()=>t.dismissible?{pointerDownOutside:te}:["interactOutside","escapeKeyDown"].reduce((l,P)=>(l[P]=D=>{D.preventDefault(),b("close:prevent")},l),{})),s=S(()=>T({extend:T(ve),...f.ui?.drawer||{}})({direction:t.direction,inset:t.inset,snapPoints:t.snapPoints&&t.snapPoints.length>0}));return(n,l)=>(r(),i(ee(e(t).nested?e(me):e(ye)),O(N(e(d))),{default:u(()=>[o.default?(r(),i(e(F),{key:0,"as-child":"",class:m(e(t).class)},{default:u(()=>[y(n.$slots,"default")]),_:3},8,["class"])):c("",!0),k(e(G),O(N(e(v))),{default:u(()=>[k(e(J),null,{default:u(()=>[e(t).overlay?(r(),i(e(ue),{key:0,"data-slot":"overlay",class:m(s.value.overlay({class:e(t).ui?.overlay}))},null,8,["class"])):c("",!0),k(e(pe),Q({"data-slot":"content",class:s.value.content({class:[!o.default&&e(t).class,e(t).ui?.content]})},B.value,Y(w.value)),{default:u(()=>[e(t).handle?(r(),i(e(fe),{key:0,"data-slot":"handle",class:m(s.value.handle({class:e(t).ui?.handle}))},null,8,["class"])):c("",!0),!e(t).title&&!o.title||!e(t).description&&!o.description||o.content?(r(),i(e(Z),{key:1},{default:u(()=>[!e(t).title&&!o.title?(r(),i(e(C),{key:0})):o.content?(r(),i(e(C),{key:1},{default:u(()=>[y(n.$slots,"title",{},()=>[q(x(e(t).title),1)])]),_:3})):c("",!0),!e(t).description&&!o.description?(r(),i(e(R),{key:2})):o.content?(r(),i(e(R),{key:3},{default:u(()=>[y(n.$slots,"description",{},()=>[q(x(e(t).description),1)])]),_:3})):c("",!0)]),_:3})):c("",!0),y(n.$slots,"content",{},()=>[g("div",{"data-slot":"container",class:m(s.value.container({class:e(t).ui?.container}))},[o.header||e(t).title||o.title||e(t).description||o.description?(r(),L("div",{key:0,"data-slot":"header",class:m(s.value.header({class:e(t).ui?.header}))},[y(n.$slots,"header",{},()=>[e(t).title||o.title?(r(),i(e(C),{key:0,"data-slot":"title",class:m(s.value.title({class:e(t).ui?.title}))},{default:u(()=>[y(n.$slots,"title",{},()=>[q(x(e(t).title),1)])]),_:3},8,["class"])):c("",!0),e(t).description||o.description?(r(),i(e(R),{key:1,"data-slot":"description",class:m(s.value.description({class:e(t).ui?.description}))},{default:u(()=>[y(n.$slots,"description",{},()=>[q(x(e(t).description),1)])]),_:3},8,["class"])):c("",!0)])],2)):c("",!0),o.body?(r(),L("div",{key:1,"data-slot":"body",class:m(s.value.body({class:e(t).ui?.body}))},[y(n.$slots,"body")],2)):c("",!0),o.footer?(r(),L("div",{key:2,"data-slot":"footer",class:m(s.value.footer({class:e(t).ui?.footer}))},[y(n.$slots,"footer")],2)):c("",!0)],2)])]),_:3},16,["class"])]),_:3})]),_:3},16)]),_:3},16))}},ge=["aria-label","aria-valuemin","aria-valuemax","aria-valuenow"],be={class:"text-lg font-semibold text-gray-900 dark:text-white"},xe=480,z=32,Re=ae({__name:"ChatRecordDrawer",setup(E){const{t:_}=re(),p=ne(),b=I(!1);let o=0,t=0,f=null,d=null;const v=I(1280-z),B=S(()=>Math.min(xe,v.value)),w=S(()=>n(p.chatRecordDrawerWidth));function s(){v.value=Math.max(0,window.innerWidth-z)}function n(a){return Math.min(v.value,Math.max(B.value,a))}function l(a){a instanceof PointerEvent&&a.pointerId!==d||(window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l),window.removeEventListener("blur",l),f?.removeEventListener("lostpointercapture",l),f&&d!==null&&f.hasPointerCapture(d)&&f.releasePointerCapture(d),f=null,d=null,document.body.style.cursor="",document.body.style.userSelect="")}function P(a){a.pointerId===d&&(p.chatRecordDrawerWidth=n(t+o-a.clientX))}function D(a){a.button!==0||d!==null||(f=a.currentTarget,d=a.pointerId,f.setPointerCapture(d),f.addEventListener("lostpointercapture",l),o=a.clientX,t=w.value,window.addEventListener("pointermove",P),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),window.addEventListener("blur",l),document.body.style.cursor="col-resize",document.body.style.userSelect="none")}function M(a){if(a.key!=="ArrowLeft"&&a.key!=="ArrowRight")return;a.preventDefault();const h=a.key==="ArrowLeft"?24:-24;p.chatRecordDrawerWidth=n(w.value+h)}return se(()=>{b.value=navigator.platform.toLowerCase().includes("win"),s(),window.addEventListener("resize",s)}),le(()=>{l(),window.removeEventListener("resize",s)}),(a,h)=>{const V=ce,A=we;return r(),i(A,{open:e(p).showChatRecordDrawer,"onUpdate:open":h[1]||(h[1]=W=>e(p).showChatRecordDrawer=W),direction:"right",handle:!1,"handle-only":"",ui:{content:"z-50"}},{content:u(()=>[g("div",{"data-vaul-no-drag":"",class:"chat-record-drawer-content relative flex h-full flex-col bg-white dark:bg-page-dark",style:ie([{width:`${w.value}px`,maxWidth:`calc(100vw - ${z}px)`},{"-webkit-app-region":"no-drag"}])},[g("div",{class:"group absolute inset-y-0 left-0 z-10 w-2 -translate-x-1/2 cursor-col-resize touch-none",role:"separator","aria-orientation":"vertical","aria-label":e(_)("records.drawer.resize"),"aria-valuemin":B.value,"aria-valuemax":v.value,"aria-valuenow":w.value,tabindex:"0",onPointerdown:de(D,["prevent"]),onKeydown:M},[...h[2]||(h[2]=[g("div",{class:"mx-auto h-full w-px bg-transparent transition-colors group-hover:bg-primary-400 group-focus:bg-primary-500"},null,-1)])],40,ge),g("div",{class:m(["flex items-center justify-between border-b border-gray-200 px-4 dark:border-gray-800",b.value?"pt-10 pb-3":"py-3"])},[g("h3",be,x(e(_)("records.drawer.title")),1),k(V,{icon:"i-heroicons-x-mark",color:"neutral",variant:"ghost",size:"sm",onClick:h[0]||(h[0]=W=>e(p).closeChatRecordDrawer())})],2),k(he,{class:"min-h-0 flex-1","initial-query":e(p).chatRecordQuery,active:e(p).showChatRecordDrawer,mode:"drawer"},null,8,["initial-query","active"])],4)]),_:1},8,["open"])}}});export{Re as default};
1
+ import{ar as H,as as U,aT as j,aU as K,aY as X,aH as $,o as r,f as i,w as u,g as e,aZ as F,n as m,r as y,l as c,z as k,a_ as G,a$ as O,b0 as N,b1 as J,m as Q,b2 as Y,af as Z,b3 as C,a9 as q,p as x,b4 as R,a as g,c as L,k as ee,e as S,aw as T,b5 as te,av as oe,d as ae,a6 as re,J as ne,x as se,al as le,O as ie,aR as de,a8 as ce,b as I}from"./index-bQ9oj54q.js";import{B as ue,C as pe,N as fe,_ as me,S as ye,a as he}from"./ChatRecordWorkspace-DKVKaimw.js";import"./vendor-snapdom--nZvo8Sg.js";import"./useToast-DPkgv34s.js";import"./DatePicker.vue_vue_type_script_setup_true_lang-BYY2UmPA.js";import"./clamp-jFYhBC76.js";import"./useFormControl-CNmp_2bd.js";import"./VisuallyHiddenInput-J2KEIQBX.js";const ve={slots:{overlay:"fixed inset-0 bg-elevated/75",content:"fixed bg-default ring ring-default flex focus:outline-none",handle:["shrink-0 !bg-accented","transition-opacity"],container:"w-full flex flex-col gap-4 p-4 overflow-y-auto",header:"",title:"text-highlighted font-semibold",description:"mt-1 text-muted text-sm",body:"flex-1",footer:"flex flex-col gap-1.5"},variants:{direction:{top:{content:"mb-24 flex-col-reverse",handle:"mb-4"},right:{content:"flex-row rtl:flex-row-reverse",handle:"!ml-4"},bottom:{content:"mt-24 flex-col",handle:"mt-4"},left:{content:"flex-row-reverse rtl:flex-row",handle:"!mr-4"}},inset:{true:{content:"rounded-lg after:hidden overflow-hidden [--initial-transform:calc(100%+1.5rem)]"}},snapPoints:{true:""}},compoundVariants:[{direction:["top","bottom"],class:{content:"h-auto max-h-[96%]",handle:"!w-12 !h-1.5 mx-auto"}},{direction:["top","bottom"],snapPoints:!0,class:{content:"h-full"}},{direction:["right","left"],class:{content:"w-auto max-w-[calc(100%-2rem)]",handle:"!h-12 !w-1.5 mt-auto mb-auto"}},{direction:["right","left"],snapPoints:!0,class:{content:"w-full"}},{direction:"top",inset:!0,class:{content:"inset-x-4 top-4"}},{direction:"top",inset:!1,class:{content:"inset-x-0 top-0 rounded-b-lg"}},{direction:"bottom",inset:!0,class:{content:"inset-x-4 bottom-4"}},{direction:"bottom",inset:!1,class:{content:"inset-x-0 bottom-0 rounded-t-lg"}},{direction:"left",inset:!0,class:{content:"inset-y-4 left-4"}},{direction:"left",inset:!1,class:{content:"inset-y-0 left-0 rounded-r-lg"}},{direction:"right",inset:!0,class:{content:"inset-y-4 right-4"}},{direction:"right",inset:!1,class:{content:"inset-y-0 right-0 rounded-l-lg"}}]},we={__name:"Drawer",props:{as:{type:null,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},inset:{type:Boolean,required:!1},content:{type:Object,required:!1},overlay:{type:Boolean,required:!1,default:!0},handle:{type:Boolean,required:!1,default:!0},portal:{type:[Boolean,String],required:!1,skipCheck:!0,default:!0},nested:{type:Boolean,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},activeSnapPoint:{type:[Number,String,null],required:!1},closeThreshold:{type:Number,required:!1},shouldScaleBackground:{type:Boolean,required:!1},setBackgroundColorOnScale:{type:Boolean,required:!1},scrollLockTimeout:{type:Number,required:!1},fixed:{type:Boolean,required:!1},dismissible:{type:Boolean,required:!1,default:!0},modal:{type:Boolean,required:!1,default:!0},open:{type:Boolean,required:!1},defaultOpen:{type:Boolean,required:!1},direction:{type:String,required:!1,default:"bottom"},noBodyStyles:{type:Boolean,required:!1},handleOnly:{type:Boolean,required:!1},preventScrollRestoration:{type:Boolean,required:!1},snapPoints:{type:Array,required:!1}},emits:["close:prevent","drag","release","close","update:open","update:activeSnapPoint","animationEnd"],setup(E,{emit:_}){const p=E,b=_,o=H(),t=U("drawer",p),f=oe(),d=j(K(t,"activeSnapPoint","closeThreshold","shouldScaleBackground","setBackgroundColorOnScale","scrollLockTimeout","fixed","dismissible","modal","open","defaultOpen","nested","direction","noBodyStyles","handleOnly","preventScrollRestoration","snapPoints"),b),v=X($(()=>t.portal)),B=$(()=>t.content),w=S(()=>t.dismissible?{pointerDownOutside:te}:["interactOutside","escapeKeyDown"].reduce((l,P)=>(l[P]=D=>{D.preventDefault(),b("close:prevent")},l),{})),s=S(()=>T({extend:T(ve),...f.ui?.drawer||{}})({direction:t.direction,inset:t.inset,snapPoints:t.snapPoints&&t.snapPoints.length>0}));return(n,l)=>(r(),i(ee(e(t).nested?e(me):e(ye)),O(N(e(d))),{default:u(()=>[o.default?(r(),i(e(F),{key:0,"as-child":"",class:m(e(t).class)},{default:u(()=>[y(n.$slots,"default")]),_:3},8,["class"])):c("",!0),k(e(G),O(N(e(v))),{default:u(()=>[k(e(J),null,{default:u(()=>[e(t).overlay?(r(),i(e(ue),{key:0,"data-slot":"overlay",class:m(s.value.overlay({class:e(t).ui?.overlay}))},null,8,["class"])):c("",!0),k(e(pe),Q({"data-slot":"content",class:s.value.content({class:[!o.default&&e(t).class,e(t).ui?.content]})},B.value,Y(w.value)),{default:u(()=>[e(t).handle?(r(),i(e(fe),{key:0,"data-slot":"handle",class:m(s.value.handle({class:e(t).ui?.handle}))},null,8,["class"])):c("",!0),!e(t).title&&!o.title||!e(t).description&&!o.description||o.content?(r(),i(e(Z),{key:1},{default:u(()=>[!e(t).title&&!o.title?(r(),i(e(C),{key:0})):o.content?(r(),i(e(C),{key:1},{default:u(()=>[y(n.$slots,"title",{},()=>[q(x(e(t).title),1)])]),_:3})):c("",!0),!e(t).description&&!o.description?(r(),i(e(R),{key:2})):o.content?(r(),i(e(R),{key:3},{default:u(()=>[y(n.$slots,"description",{},()=>[q(x(e(t).description),1)])]),_:3})):c("",!0)]),_:3})):c("",!0),y(n.$slots,"content",{},()=>[g("div",{"data-slot":"container",class:m(s.value.container({class:e(t).ui?.container}))},[o.header||e(t).title||o.title||e(t).description||o.description?(r(),L("div",{key:0,"data-slot":"header",class:m(s.value.header({class:e(t).ui?.header}))},[y(n.$slots,"header",{},()=>[e(t).title||o.title?(r(),i(e(C),{key:0,"data-slot":"title",class:m(s.value.title({class:e(t).ui?.title}))},{default:u(()=>[y(n.$slots,"title",{},()=>[q(x(e(t).title),1)])]),_:3},8,["class"])):c("",!0),e(t).description||o.description?(r(),i(e(R),{key:1,"data-slot":"description",class:m(s.value.description({class:e(t).ui?.description}))},{default:u(()=>[y(n.$slots,"description",{},()=>[q(x(e(t).description),1)])]),_:3},8,["class"])):c("",!0)])],2)):c("",!0),o.body?(r(),L("div",{key:1,"data-slot":"body",class:m(s.value.body({class:e(t).ui?.body}))},[y(n.$slots,"body")],2)):c("",!0),o.footer?(r(),L("div",{key:2,"data-slot":"footer",class:m(s.value.footer({class:e(t).ui?.footer}))},[y(n.$slots,"footer")],2)):c("",!0)],2)])]),_:3},16,["class"])]),_:3})]),_:3},16)]),_:3},16))}},ge=["aria-label","aria-valuemin","aria-valuemax","aria-valuenow"],be={class:"text-lg font-semibold text-gray-900 dark:text-white"},xe=480,z=32,Re=ae({__name:"ChatRecordDrawer",setup(E){const{t:_}=re(),p=ne(),b=I(!1);let o=0,t=0,f=null,d=null;const v=I(1280-z),B=S(()=>Math.min(xe,v.value)),w=S(()=>n(p.chatRecordDrawerWidth));function s(){v.value=Math.max(0,window.innerWidth-z)}function n(a){return Math.min(v.value,Math.max(B.value,a))}function l(a){a instanceof PointerEvent&&a.pointerId!==d||(window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l),window.removeEventListener("blur",l),f?.removeEventListener("lostpointercapture",l),f&&d!==null&&f.hasPointerCapture(d)&&f.releasePointerCapture(d),f=null,d=null,document.body.style.cursor="",document.body.style.userSelect="")}function P(a){a.pointerId===d&&(p.chatRecordDrawerWidth=n(t+o-a.clientX))}function D(a){a.button!==0||d!==null||(f=a.currentTarget,d=a.pointerId,f.setPointerCapture(d),f.addEventListener("lostpointercapture",l),o=a.clientX,t=w.value,window.addEventListener("pointermove",P),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),window.addEventListener("blur",l),document.body.style.cursor="col-resize",document.body.style.userSelect="none")}function M(a){if(a.key!=="ArrowLeft"&&a.key!=="ArrowRight")return;a.preventDefault();const h=a.key==="ArrowLeft"?24:-24;p.chatRecordDrawerWidth=n(w.value+h)}return se(()=>{b.value=navigator.platform.toLowerCase().includes("win"),s(),window.addEventListener("resize",s)}),le(()=>{l(),window.removeEventListener("resize",s)}),(a,h)=>{const V=ce,A=we;return r(),i(A,{open:e(p).showChatRecordDrawer,"onUpdate:open":h[1]||(h[1]=W=>e(p).showChatRecordDrawer=W),direction:"right",handle:!1,"handle-only":"",ui:{content:"z-50"}},{content:u(()=>[g("div",{"data-vaul-no-drag":"",class:"chat-record-drawer-content relative flex h-full flex-col bg-white dark:bg-page-dark",style:ie([{width:`${w.value}px`,maxWidth:`calc(100vw - ${z}px)`},{"-webkit-app-region":"no-drag"}])},[g("div",{class:"group absolute inset-y-0 left-0 z-10 w-2 -translate-x-1/2 cursor-col-resize touch-none",role:"separator","aria-orientation":"vertical","aria-label":e(_)("records.drawer.resize"),"aria-valuemin":B.value,"aria-valuemax":v.value,"aria-valuenow":w.value,tabindex:"0",onPointerdown:de(D,["prevent"]),onKeydown:M},[...h[2]||(h[2]=[g("div",{class:"mx-auto h-full w-px bg-transparent transition-colors group-hover:bg-primary-400 group-focus:bg-primary-500"},null,-1)])],40,ge),g("div",{class:m(["flex items-center justify-between border-b border-gray-200 px-4 dark:border-gray-800",b.value?"pt-10 pb-3":"py-3"])},[g("h3",be,x(e(_)("records.drawer.title")),1),k(V,{icon:"i-heroicons-x-mark",color:"neutral",variant:"ghost",size:"sm",onClick:h[0]||(h[0]=W=>e(p).closeChatRecordDrawer())})],2),k(he,{class:"min-h-0 flex-1","initial-query":e(p).chatRecordQuery,active:e(p).showChatRecordDrawer,mode:"drawer"},null,8,["initial-query","active"])],4)]),_:1},8,["open"])}}});export{Re as default};