@nextclaw/ui 0.26.3 → 0.26.4

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 (170) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/.vite/manifest.json +329 -329
  3. package/dist/assets/{account-panel-DIdHjKG-.js → account-panel-DVi_jhkG.js} +1 -1
  4. package/dist/assets/{api-DkLJrSCd.js → api-BZvNpFOS.js} +1 -1
  5. package/dist/assets/app-presenter-provider-BcYL-VNe.js +124 -0
  6. package/dist/assets/{appearance-settings-page-DI8aDY2G.js → appearance-settings-page-AZNBzLmT.js} +1 -1
  7. package/dist/assets/{book-open-BPMkKSci.js → book-open-CmRdT3N1.js} +1 -1
  8. package/dist/assets/card-CdRBL1E0.js +1 -0
  9. package/dist/assets/{channels-list-page-CCIaTQu7.js → channels-list-page-eZN74FN3.js} +2 -2
  10. package/dist/assets/{circle-dashed-B48a0t6p.js → circle-dashed-HOgt3gIJ.js} +1 -1
  11. package/dist/assets/{client-imrVphQb.js → client-DKKbdJ6Q.js} +1 -1
  12. package/dist/assets/config-split-page-BA3V6b3Q.js +1 -0
  13. package/dist/assets/{confirm-dialog-10Qb3dpZ.js → confirm-dialog-8vqYZ0wy.js} +1 -1
  14. package/dist/assets/{context-menu-CRqH2SEk.js → context-menu-DHVVdHzN.js} +1 -1
  15. package/dist/assets/{createLucideIcon-B4xj2I2g.js → createLucideIcon-DE0sB9Nu.js} +1 -1
  16. package/dist/assets/{desktop-capabilities-page-CFcT2g8-.js → desktop-capabilities-page-B9-B9k1A.js} +1 -1
  17. package/dist/assets/{desktop-update-config-CRJd_An1.js → desktop-update-config-Cfr3IRUe.js} +1 -1
  18. package/dist/assets/{dialog-BgL3vKJQ.js → dialog-BUfWO8hr.js} +1 -1
  19. package/dist/assets/{doc-browser-context-DH4aWvkS.js → doc-browser-context-ClLgMbxd.js} +1 -1
  20. package/dist/assets/doc-browser-w8q1j0jL.js +1 -0
  21. package/dist/assets/{download-Cr337h4W.js → download-CKqS1Ksj.js} +1 -1
  22. package/dist/assets/{es2015-D-CRf3_Z.js → es2015-BiB05Sav.js} +1 -1
  23. package/dist/assets/{extensions-CsmJPz7g.js → extensions-vPD4dGqt.js} +1 -1
  24. package/dist/assets/{eye-DrQRSAfJ.js → eye-bKzylu3p.js} +1 -1
  25. package/dist/assets/{form-actions-BEeWTGUZ.js → form-actions-CCoxz33Q.js} +1 -1
  26. package/dist/assets/{keyboard-shortcuts-settings-page-DQU56SrW.js → keyboard-shortcuts-settings-page-D8rosOVh.js} +1 -1
  27. package/dist/assets/loader-circle-Clq1Gtb1.js +1 -0
  28. package/dist/assets/{login-page-sgivRYG1.js → login-page-BT3GV3Sb.js} +1 -1
  29. package/dist/assets/login-page-DKId3By8.js +1 -0
  30. package/dist/assets/{main-B-oxUq-o.js → main-bEWCGDHr.js} +2 -2
  31. package/dist/assets/main-kqMRTwOs.css +1 -0
  32. package/dist/assets/mcp-marketplace-page-CZIP6j3L.js +1 -0
  33. package/dist/assets/{model-config-page-CDQBhmVr.js → model-config-page-D21a-BO0.js} +1 -1
  34. package/dist/assets/{navigation-link-D3pzNHeA.js → navigation-link-DC-Pku0Y.js} +1 -1
  35. package/dist/assets/panelStandalone-BRg7B1EI.css +1 -0
  36. package/dist/assets/{panelStandalone-CGkYeMK5.js → panelStandalone-CX8X2hjh.js} +2 -2
  37. package/dist/assets/{privacy-settings-page-CjoAkoDt.js → privacy-settings-page-e0LFHZJm.js} +1 -1
  38. package/dist/assets/{projects-C7Zxpcoi.js → projects-Rki7Fmth.js} +1 -1
  39. package/dist/assets/provider-models-DFQgF4hS.js +1 -0
  40. package/dist/assets/provider-scoped-model-input-DaONL0j_.js +1 -0
  41. package/dist/assets/providers-config-page-CEOhQlMe.js +1 -0
  42. package/dist/assets/{puzzle--RLCeYML.js → puzzle-D_TiFXOv.js} +1 -1
  43. package/dist/assets/{pwa-DcizGowz.js → pwa-C9ac_1dg.js} +1 -1
  44. package/dist/assets/{refresh-cw-syCVj_nw.js → refresh-cw-BG8VfcdA.js} +1 -1
  45. package/dist/assets/remote-DkSx5x4R.js +1 -0
  46. package/dist/assets/{rotate-cw-BlH9El3x.js → rotate-cw-DPEegUU2.js} +1 -1
  47. package/dist/assets/{runtime-config-page-Cco9dS73.js → runtime-config-page-DDT1dVLt.js} +1 -1
  48. package/dist/assets/{save-BWynuRQ2.js → save-CPlctBjT.js} +1 -1
  49. package/dist/assets/{search-config-page-Cc74_SAU.js → search-config-page-CDwmd6eX.js} +1 -1
  50. package/dist/assets/{secrets-config-page-raYDzlFC.js → secrets-config-page-1OvgmwPv.js} +1 -1
  51. package/dist/assets/security-config-Pv4CM-kw.js +1 -0
  52. package/dist/assets/{select-6Uq4chZW.js → select-Y9IEbx9x.js} +1 -1
  53. package/dist/assets/service-apps-panel-DPrLeF3N.js +1 -0
  54. package/dist/assets/{settings-2-COvVf1XX.js → settings-2-CrGx9_De.js} +1 -1
  55. package/dist/assets/{status-dot-DZlxa5zW.js → status-dot-Cb8ewlUr.js} +1 -1
  56. package/dist/assets/{tag-chip-DXHtZ8AS.js → tag-chip-D-6aPuuh.js} +1 -1
  57. package/dist/assets/{theme-provider-C5PCDBPB.js → theme-provider-BjF1Eowc.js} +1 -1
  58. package/dist/assets/{trash-2-DazgBvmJ.js → trash-2-DER2EJKK.js} +1 -1
  59. package/dist/assets/{use-config-DRRGF9Zb.js → use-config-BM5jC65L.js} +1 -1
  60. package/dist/assets/{use-desktop-capabilities-CdfOUjdE.js → use-desktop-capabilities-ezKJwKqg.js} +1 -1
  61. package/dist/assets/{use-viewport-layout-DdxVnCYc.js → use-viewport-layout-vmbQUNT6.js} +1 -1
  62. package/dist/assets/x-DSz9cGhy.js +1 -0
  63. package/dist/index.html +33 -33
  64. package/dist/panel-standalone.html +10 -10
  65. package/package.json +4 -4
  66. package/src/app/components/layout/__tests__/sidebar.layout.test.tsx +2 -2
  67. package/src/app/components/layout/sidebar-rail.styles.ts +3 -3
  68. package/src/app/styles/charcoal-theme.css +0 -3
  69. package/src/app/styles/design-system.css +12 -6
  70. package/src/app/styles/island-theme.css +2 -15
  71. package/src/features/app-data/components/app-data-removal-choice.tsx +1 -1
  72. package/src/features/channels/pages/channels-list-page.tsx +1 -1
  73. package/src/features/chat/components/chat-sidebar-list-mode-switch.tsx +1 -1
  74. package/src/features/chat/components/conversation/__tests__/chat-conversation-header-section.test.tsx +28 -16
  75. package/src/features/chat/components/conversation/chat-conversation-content.tsx +8 -2
  76. package/src/features/chat/components/layout/__tests__/chat-sidebar-session-area.test.tsx +6 -4
  77. package/src/features/chat/components/layout/__tests__/chat-sidebar-toolbar.test.tsx +22 -1
  78. package/src/features/chat/components/layout/chat-sidebar-desktop-layout.tsx +10 -14
  79. package/src/features/chat/components/layout/chat-sidebar-toolbar.tsx +38 -7
  80. package/src/features/chat/components/layout/chat-sidebar-utility-menu.tsx +4 -4
  81. package/src/features/chat/components/layout/chat-sidebar.tsx +2 -2
  82. package/src/features/chat/features/conversation/components/session-queued-input-rows.tsx +1 -1
  83. package/src/features/chat/features/message/components/chat-message-list.container.tsx +12 -1
  84. package/src/features/chat/features/message/components/chat-tool-call-stress-harness.tsx +32 -2
  85. package/src/features/chat/features/message/hooks/__tests__/use-chat-message-virtualizer.test.tsx +7 -5
  86. package/src/features/chat/features/message/hooks/use-chat-message-virtualizer.ts +7 -3
  87. package/src/features/chat/features/session/components/__tests__/chat-sidebar-project-groups.test.tsx +1 -1
  88. package/src/features/chat/features/session/components/chat-mobile-session-row.tsx +1 -1
  89. package/src/features/chat/features/session/components/chat-sidebar-context-card.tsx +1 -1
  90. package/src/features/chat/features/session/components/chat-sidebar-project-groups.tsx +1 -1
  91. package/src/features/chat/features/session/components/chat-sidebar-session-item.tsx +7 -5
  92. package/src/features/chat/features/session/components/chat-sidebar-session-list.tsx +45 -10
  93. package/src/features/chat/features/session/components/session-header/chat-session-more-actions-menu.tsx +3 -0
  94. package/src/features/chat/features/session/components/session-header/chat-session-switcher-groups.tsx +6 -6
  95. package/src/features/chat/features/session/components/session-header/chat-session-title-switcher.tsx +5 -4
  96. package/src/features/chat/features/session-type/components/chat-session-type-option-item.tsx +1 -1
  97. package/src/features/chat/features/welcome/components/chat-welcome-agent-picker.tsx +0 -1
  98. package/src/features/chat/features/welcome/components/chat-welcome-project-picker.tsx +1 -1
  99. package/src/features/chat/features/welcome/components/chat-welcome-prompt-suggestions.tsx +1 -1
  100. package/src/features/chat/features/welcome/components/chat-welcome-session-type-picker.tsx +1 -1
  101. package/src/features/chat/features/workspace/components/chat-session-workspace-file-breadcrumb-browser.tsx +2 -2
  102. package/src/features/chat/features/workspace/components/chat-session-workspace-file-breadcrumbs.tsx +2 -2
  103. package/src/features/chat/features/workspace/components/chat-session-workspace-panel-content.tsx +1 -1
  104. package/src/features/chat/features/workspace/components/child-sessions/chat-session-child-sessions.tsx +2 -2
  105. package/src/features/chat/features/workspace/components/file-content-preview/workspace-spreadsheet-preview.tsx +2 -2
  106. package/src/features/chat/features/workspace/components/overview/chat-session-continuous-attention.tsx +3 -3
  107. package/src/features/chat/features/workspace/components/overview/chat-session-token-usage.tsx +1 -1
  108. package/src/features/chat/features/workspace/components/project-files/workspace-directory-tree.tsx +4 -3
  109. package/src/features/chat/features/workspace/components/project-files/workspace-new-folder-tree-item.tsx +2 -1
  110. package/src/features/chat/features/workspace/components/session-cron-job-content.tsx +3 -3
  111. package/src/features/chat/features/workspace/components/workspace-file-content-preview.tsx +2 -2
  112. package/src/features/chat/features/workspace/components/workspace-markdown-outline.tsx +1 -1
  113. package/src/features/cron/components/cron-config.tsx +2 -2
  114. package/src/features/cron/components/cron-job-detail-dialog.tsx +1 -1
  115. package/src/features/cron/components/cron-job-row.tsx +3 -3
  116. package/src/features/cron/components/cron-task-discovery.tsx +1 -1
  117. package/src/features/inbox/pages/inbox-page.tsx +1 -1
  118. package/src/features/marketplace/components/curated-shelves/marketplace-curated-shelves.tsx +2 -2
  119. package/src/features/marketplace/components/curated-shelves/marketplace-shelf-card.tsx +2 -2
  120. package/src/features/marketplace/components/marketplace-list-card.tsx +4 -4
  121. package/src/features/marketplace/components/marketplace-page.tsx +2 -2
  122. package/src/features/marketplace/components/mcp/mcp-marketplace-card.tsx +2 -2
  123. package/src/features/marketplace/components/mcp/mcp-marketplace-page.tsx +3 -3
  124. package/src/features/panel-apps/components/panel-app-list-item.tsx +3 -3
  125. package/src/features/pwa/components/pwa-install-entry.tsx +1 -1
  126. package/src/features/right-panel-resources/components/__tests__/page-resource-sidebar-nav.test.tsx +9 -1
  127. package/src/features/right-panel-resources/components/page-resource-sidebar-nav.tsx +1 -1
  128. package/src/features/right-panel-resources/components/right-panel-resource-home-page.tsx +1 -1
  129. package/src/features/service-apps/components/service-action-row.tsx +3 -3
  130. package/src/features/service-apps/components/service-app-list-item.tsx +4 -4
  131. package/src/features/service-apps/components/service-apps-panel.tsx +1 -1
  132. package/src/features/settings/components/config/provider-model-list.tsx +5 -5
  133. package/src/features/settings/components/config/provider-model-suggestions-panel.tsx +4 -4
  134. package/src/features/settings/components/config/provider-pill-selector.tsx +1 -1
  135. package/src/features/settings/pages/appearance-settings-page.tsx +2 -2
  136. package/src/features/settings/pages/providers-config-page.tsx +6 -6
  137. package/src/features/side-dock/components/side-dock.tsx +4 -4
  138. package/src/index.css +4 -0
  139. package/src/platforms/desktop/components/desktop-window-chrome.tsx +1 -1
  140. package/src/platforms/mobile/components/mobile-bottom-nav.tsx +3 -3
  141. package/src/shared/components/common/brand-header.tsx +1 -1
  142. package/src/shared/components/common/searchable-model-input.tsx +2 -2
  143. package/src/shared/components/config-split-page.tsx +3 -3
  144. package/src/shared/components/doc-browser/doc-browser-tab-strip.tsx +2 -2
  145. package/src/shared/components/path-picker/server-path-picker-locations.tsx +1 -1
  146. package/src/shared/components/ui/button.tsx +2 -2
  147. package/src/shared/components/ui/card.tsx +1 -1
  148. package/src/shared/components/ui/context-menu/context-menu-items.tsx +3 -3
  149. package/src/shared/components/ui/input.tsx +7 -3
  150. package/src/shared/components/ui/overlays/sheet.tsx +1 -1
  151. package/src/shared/components/ui/popover.tsx +1 -1
  152. package/src/shared/components/ui/select.tsx +2 -2
  153. package/src/shared/components/ui/tab-strip/compact-tab-strip.tsx +3 -3
  154. package/src/shared/components/ui/tabs.tsx +1 -1
  155. package/dist/assets/app-presenter-provider-Co8uKOyW.js +0 -124
  156. package/dist/assets/card-Bqu8zWLq.js +0 -1
  157. package/dist/assets/config-split-page-Bd-bGKsw.js +0 -1
  158. package/dist/assets/doc-browser-52t2_rSF.js +0 -1
  159. package/dist/assets/loader-circle-DbOQWT9C.js +0 -1
  160. package/dist/assets/login-page-DW1AZXqX.js +0 -1
  161. package/dist/assets/main-BpL6OjwM.css +0 -1
  162. package/dist/assets/mcp-marketplace-page-DSLRpJEB.js +0 -1
  163. package/dist/assets/panelStandalone-D-mhAGNa.css +0 -1
  164. package/dist/assets/provider-models-YW7rIeOD.js +0 -1
  165. package/dist/assets/provider-scoped-model-input-axJ-pTEu.js +0 -1
  166. package/dist/assets/providers-config-page-_QhBXQ4M.js +0 -1
  167. package/dist/assets/remote-BLQU7aY5.js +0 -1
  168. package/dist/assets/security-config-aE_jOwy-.js +0 -1
  169. package/dist/assets/service-apps-panel-jBWAa4qZ.js +0 -1
  170. package/dist/assets/x-CQIp_nJT.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{Jt as t,Kt as n,Qt as r,Ut as i,_n as a,cr as o,qt as s,yr as c}from"./api-DkLJrSCd.js";import{G as l,o as u}from"./app-presenter-provider-Co8uKOyW.js";import{i as d,n as f,u as p}from"./theme-provider-C5PCDBPB.js";import{T as m,a as h,i as g,n as _,r as v,t as y}from"./select-6Uq4chZW.js";import{c as b,s as x}from"./i18n-OGmF0Ws_.js";var S=e(c(),1);function C(){let{language:e,setLanguage:t}=p();return{currentLanguage:e,currentLanguageLabel:b.find(t=>t.value===e)?.label??e,languageOptions:b,selectLanguage:(0,S.useCallback)(n=>{e!==n&&(t(n),window.location.reload())},[e,t])}}var w=o(),T=[{value:`card`,labelKey:`chatMessageLayoutCard`,descriptionKey:`chatMessageLayoutCardDescription`},{value:`flat`,labelKey:`chatMessageLayoutFlat`,descriptionKey:`chatMessageLayoutFlatDescription`}];function E(){let{theme:e,setTheme:o}=f(),{currentLanguage:c,languageOptions:p,selectLanguage:b}=C(),S=l(e=>e.layout),E=l(e=>e.setLayout),D=u(e=>e.isVisible),O=u(e=>e.setVisible);return(0,w.jsx)(r,{title:x(`appearance`),children:(0,w.jsx)(t,{children:(0,w.jsxs)(s,{children:[(0,w.jsx)(n,{title:x(`theme`),control:(0,w.jsxs)(y,{value:e,onValueChange:e=>o(e),children:[(0,w.jsx)(g,{"aria-label":x(`theme`),className:`w-36 sm:w-44`,children:(0,w.jsx)(h,{})}),(0,w.jsx)(_,{children:d.map(e=>(0,w.jsx)(v,{value:e.value,children:x(e.labelKey)},e.value))})]})}),(0,w.jsx)(n,{title:x(`language`),control:(0,w.jsxs)(y,{value:c,onValueChange:e=>b(e),children:[(0,w.jsx)(g,{"aria-label":x(`language`),className:`w-36 sm:w-44`,children:(0,w.jsx)(h,{})}),(0,w.jsx)(_,{children:p.map(e=>(0,w.jsx)(v,{value:e.value,children:e.label},e.value))})]})}),(0,w.jsx)(n,{title:x(`chatMessageLayoutTitle`),description:x(`chatMessageLayoutDescription`),layout:`stacked`,children:(0,w.jsx)(`div`,{role:`radiogroup`,"aria-label":x(`chatMessageLayoutTitle`),className:`grid gap-1 rounded-xl bg-background/65 p-1 sm:grid-cols-2`,children:T.map(e=>{let t=e.value===S;return(0,w.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,onClick:()=>E(e.value),className:a(`flex min-w-0 items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,t?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:bg-card/60 hover:text-foreground`),children:[(0,w.jsx)(`span`,{className:a(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full ring-1`,t?`bg-primary text-primary-foreground ring-primary`:`bg-background ring-border`),children:t?(0,w.jsx)(m,{className:`h-2.5 w-2.5`,strokeWidth:3}):null}),(0,w.jsxs)(`span`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-medium`,children:x(e.labelKey)}),(0,w.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-muted-foreground`,children:x(e.descriptionKey)})]})]},e.value)})})}),(0,w.jsx)(n,{title:x(`sideDockVisibilityTitle`),description:x(`sideDockVisibilityDescription`),control:(0,w.jsx)(i,{id:`appearance-side-dock-visible`,"aria-label":x(`sideDockVisibilityTitle`),checked:D,onCheckedChange:O})})]})})})}export{E as AppearanceSettingsPage};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{Jt as t,Kt as n,Qt as r,Ut as i,_n as a,cr as o,qt as s,yr as c}from"./api-BZvNpFOS.js";import{G as l,o as u}from"./app-presenter-provider-BcYL-VNe.js";import{i as d,n as f,u as p}from"./theme-provider-BjF1Eowc.js";import{T as m,a as h,i as g,n as _,r as v,t as y}from"./select-Y9IEbx9x.js";import{c as b,s as x}from"./i18n-OGmF0Ws_.js";var S=e(c(),1);function C(){let{language:e,setLanguage:t}=p();return{currentLanguage:e,currentLanguageLabel:b.find(t=>t.value===e)?.label??e,languageOptions:b,selectLanguage:(0,S.useCallback)(n=>{e!==n&&(t(n),window.location.reload())},[e,t])}}var w=o(),T=[{value:`card`,labelKey:`chatMessageLayoutCard`,descriptionKey:`chatMessageLayoutCardDescription`},{value:`flat`,labelKey:`chatMessageLayoutFlat`,descriptionKey:`chatMessageLayoutFlatDescription`}];function E(){let{theme:e,setTheme:o}=f(),{currentLanguage:c,languageOptions:p,selectLanguage:b}=C(),S=l(e=>e.layout),E=l(e=>e.setLayout),D=u(e=>e.isVisible),O=u(e=>e.setVisible);return(0,w.jsx)(r,{title:x(`appearance`),children:(0,w.jsx)(t,{children:(0,w.jsxs)(s,{children:[(0,w.jsx)(n,{title:x(`theme`),control:(0,w.jsxs)(y,{value:e,onValueChange:e=>o(e),children:[(0,w.jsx)(g,{"aria-label":x(`theme`),className:`w-36 sm:w-44`,children:(0,w.jsx)(h,{})}),(0,w.jsx)(_,{children:d.map(e=>(0,w.jsx)(v,{value:e.value,children:x(e.labelKey)},e.value))})]})}),(0,w.jsx)(n,{title:x(`language`),control:(0,w.jsxs)(y,{value:c,onValueChange:e=>b(e),children:[(0,w.jsx)(g,{"aria-label":x(`language`),className:`w-36 sm:w-44`,children:(0,w.jsx)(h,{})}),(0,w.jsx)(_,{children:p.map(e=>(0,w.jsx)(v,{value:e.value,children:e.label},e.value))})]})}),(0,w.jsx)(n,{title:x(`chatMessageLayoutTitle`),description:x(`chatMessageLayoutDescription`),layout:`stacked`,children:(0,w.jsx)(`div`,{role:`radiogroup`,"aria-label":x(`chatMessageLayoutTitle`),className:`grid gap-1 rounded-xl bg-background/65 p-1 sm:grid-cols-2`,children:T.map(e=>{let t=e.value===S;return(0,w.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,onClick:()=>E(e.value),className:a(`flex min-w-0 items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,t?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[(0,w.jsx)(`span`,{className:a(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full ring-1`,t?`bg-primary text-primary-foreground ring-primary`:`bg-background ring-border`),children:t?(0,w.jsx)(m,{className:`h-2.5 w-2.5`,strokeWidth:3}):null}),(0,w.jsxs)(`span`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-medium`,children:x(e.labelKey)}),(0,w.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-muted-foreground`,children:x(e.descriptionKey)})]})]},e.value)})})}),(0,w.jsx)(n,{title:x(`sideDockVisibilityTitle`),description:x(`sideDockVisibilityDescription`),control:(0,w.jsx)(i,{id:`appearance-side-dock-visible`,"aria-label":x(`sideDockVisibilityTitle`),checked:D,onCheckedChange:O})})]})})})}export{E as AppearanceSettingsPage};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-B4xj2I2g.js";var t=e(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]);export{t};
1
+ import{t as e}from"./createLucideIcon-DE0sB9Nu.js";var t=e(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-BZvNpFOS.js";var i=e(r(),1),a=n(),o=i.forwardRef(({className:e,hover:n=!0,surface:r=`raised`,...i},o)=>(0,a.jsx)(`div`,{ref:o,className:t(`rounded-2xl border bg-card text-card-foreground transition-colors duration-base`,r===`raised`?`border-border shadow-card`:`border-border/75 shadow-none`,n&&r===`raised`&&`hover:border-primary/25 hover:shadow-card-hover`,n&&r===`flat`&&`hover:bg-[var(--interaction-hover)]`,e),...i}));o.displayName=`Card`;var s=i.forwardRef(({className:e,...n},r)=>(0,a.jsx)(`div`,{ref:r,className:t(`flex flex-col space-y-1.5 p-6`,e),...n}));s.displayName=`CardHeader`;var c=i.forwardRef(({className:e,...n},r)=>(0,a.jsx)(`h3`,{ref:r,className:t(`text-[15px] font-semibold leading-tight tracking-tight text-foreground`,e),...n}));c.displayName=`CardTitle`;var l=i.forwardRef(({className:e,...n},r)=>(0,a.jsx)(`p`,{ref:r,className:t(`text-[13px] text-muted-foreground leading-relaxed`,e),...n}));l.displayName=`CardDescription`;var u=i.forwardRef(({className:e,...n},r)=>(0,a.jsx)(`div`,{ref:r,className:t(`p-6 pt-0`,e),...n}));u.displayName=`CardContent`;var d=i.forwardRef(({className:e,...n},r)=>(0,a.jsx)(`div`,{ref:r,className:t(`flex items-center justify-between p-6 pt-0`,e),...n}));d.displayName=`CardFooter`;export{c as a,s as i,u as n,l as r,o as t};
@@ -1,8 +1,8 @@
1
- import{i as e,t}from"./chunk-DF37yw5_.js";import{Gn as n,Gt as r,Jn as i,Lt as a,Mt as o,Nt as s,Qt as c,Ut as l,Wt as u,Xn as d,Yn as f,Yt as p,_n as m,cr as h,jt as g,sr as _,yr as v}from"./api-DkLJrSCd.js";import{n as y,t as b}from"./navigation-link-D3pzNHeA.js";import{t as x}from"./createLucideIcon-B4xj2I2g.js";import{a as S,i as C,t as w}from"./use-viewport-layout-DdxVnCYc.js";import{t as ee}from"./book-open-BPMkKSci.js";import{a as T,i as E,n as D,r as O,t as k,w as te}from"./select-6Uq4chZW.js";import{a as A,c as ne,i as j,l as re,n as M,o as N,r as ie,s as ae,t as oe}from"./tag-chip-DXHtZ8AS.js";import{t as se}from"./loader-circle-DbOQWT9C.js";import{t as ce}from"./x-CQIp_nJT.js";import{l as le,n as ue,s as P}from"./i18n-OGmF0Ws_.js";import{n as de,t as fe}from"./status-dot-DZlxa5zW.js";import{g as pe,n as me,r as he,s as ge,t as _e}from"./use-config-DRRGF9Zb.js";import{t as ve}from"./form-actions-BEeWTGUZ.js";import{t as F}from"./config-hints-DbmiyTKg.js";import{a as ye,c as I,i as be,l as xe,n as Se,o as L,r as Ce,s as we,t as Te}from"./config-split-page-Bd-bGKsw.js";var Ee=x(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),De=x(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),R=x(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),z=x(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),Oe=x(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=e(v(),1),V=h();function ke({value:e,onChange:t,className:n,placeholder:r=``}){let[i,a]=(0,B.useState)(``),o=n=>{n.key===`Enter`&&i.trim()?(n.preventDefault(),t([...e,i.trim()]),a(``)):n.key===`Backspace`&&!i&&e.length>0&&t(e.slice(0,-1))},s=n=>{t(e.filter((e,t)=>t!==n))};return(0,V.jsxs)(`div`,{className:m(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,n),children:[e.map((e,t)=>(0,V.jsxs)(oe,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,V.jsx)(`button`,{type:`button`,onClick:()=>s(t),className:`transition-colors hover:text-rose-200`,children:(0,V.jsx)(ce,{className:`h-3 w-3`})})]},t)),(0,V.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:o,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:r||P(`enterTag`)})]})}function Ae(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,V.jsx)(S,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,V.jsx)(re,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,V.jsx)(De,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,V.jsx)(Ee,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,V.jsx)(Oe,{className:`h-3.5 w-3.5 text-gray-500`}):(0,V.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function je({channelName:e,fields:t,formData:n,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,V.jsx)(V.Fragment,{children:t.map(t=>{let c=F(`channels.${e}.${t.name}`,s),d=c?.label??t.label,f=c?.placeholder;return(0,V.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,V.jsxs)(u,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ae(t.name),d]}),t.type===`boolean`&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?P(`enabled`):P(`disabled`)}),(0,V.jsx)(l,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,V.jsx)(r,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f,className:`rounded-xl`}),t.type===`password`&&(0,V.jsx)(r,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f??P(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,V.jsx)(r,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:f,className:`rounded-xl`}),t.type===`tags`&&(0,V.jsx)(ke,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,V.jsxs)(k,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,V.jsx)(E,{className:`rounded-xl`,children:(0,V.jsx)(T,{})}),(0,V.jsx)(D,{children:(t.options??[]).map(e=>(0,V.jsx)(O,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,V.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Me=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),H=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),U=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Ne=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Pe=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Fe=t((e=>{var t=H().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Ie=t((e=>{var t=H().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Le=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),W=t((e=>{var t=U(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Re=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),ze=t((e=>{var t=Re();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Be=t(((e,t)=>{var n=ze();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),G=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),K=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
1
+ import{i as e,t}from"./chunk-DF37yw5_.js";import{Gn as n,Gt as r,Jn as i,Lt as a,Mt as o,Nt as s,Qt as c,Ut as l,Wt as u,Xn as d,Yn as f,Yt as p,_n as m,cr as h,jt as g,sr as _,yr as v}from"./api-BZvNpFOS.js";import{n as y,t as b}from"./navigation-link-DC-Pku0Y.js";import{t as x}from"./createLucideIcon-DE0sB9Nu.js";import{a as S,i as C,t as w}from"./use-viewport-layout-vmbQUNT6.js";import{t as ee}from"./book-open-CmRdT3N1.js";import{a as T,i as E,n as D,r as O,t as k,w as te}from"./select-Y9IEbx9x.js";import{a as A,c as ne,i as j,l as re,n as M,o as N,r as ie,s as ae,t as oe}from"./tag-chip-D-6aPuuh.js";import{t as se}from"./loader-circle-Clq1Gtb1.js";import{t as ce}from"./x-DSz9cGhy.js";import{l as le,n as ue,s as P}from"./i18n-OGmF0Ws_.js";import{n as de,t as fe}from"./status-dot-Cb8ewlUr.js";import{g as pe,n as me,r as he,s as ge,t as _e}from"./use-config-BM5jC65L.js";import{t as ve}from"./form-actions-CCoxz33Q.js";import{t as F}from"./config-hints-DbmiyTKg.js";import{a as ye,c as I,i as be,l as xe,n as Se,o as L,r as Ce,s as we,t as Te}from"./config-split-page-BA3V6b3Q.js";var Ee=x(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),De=x(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),R=x(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),z=x(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),Oe=x(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=e(v(),1),V=h();function ke({value:e,onChange:t,className:n,placeholder:r=``}){let[i,a]=(0,B.useState)(``),o=n=>{n.key===`Enter`&&i.trim()?(n.preventDefault(),t([...e,i.trim()]),a(``)):n.key===`Backspace`&&!i&&e.length>0&&t(e.slice(0,-1))},s=n=>{t(e.filter((e,t)=>t!==n))};return(0,V.jsxs)(`div`,{className:m(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,n),children:[e.map((e,t)=>(0,V.jsxs)(oe,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,V.jsx)(`button`,{type:`button`,onClick:()=>s(t),className:`transition-colors hover:text-rose-200`,children:(0,V.jsx)(ce,{className:`h-3 w-3`})})]},t)),(0,V.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:o,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:r||P(`enterTag`)})]})}function Ae(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,V.jsx)(S,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,V.jsx)(re,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,V.jsx)(De,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,V.jsx)(Ee,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,V.jsx)(Oe,{className:`h-3.5 w-3.5 text-gray-500`}):(0,V.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function je({channelName:e,fields:t,formData:n,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,V.jsx)(V.Fragment,{children:t.map(t=>{let c=F(`channels.${e}.${t.name}`,s),d=c?.label??t.label,f=c?.placeholder;return(0,V.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,V.jsxs)(u,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Ae(t.name),d]}),t.type===`boolean`&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?P(`enabled`):P(`disabled`)}),(0,V.jsx)(l,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,V.jsx)(r,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f,className:`rounded-xl`}),t.type===`password`&&(0,V.jsx)(r,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f??P(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,V.jsx)(r,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:f,className:`rounded-xl`}),t.type===`tags`&&(0,V.jsx)(ke,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,V.jsxs)(k,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,V.jsx)(E,{className:`rounded-xl`,children:(0,V.jsx)(T,{})}),(0,V.jsx)(D,{children:(t.options??[]).map(e=>(0,V.jsx)(O,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,V.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var Me=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),H=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),U=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Ne=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Pe=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Fe=t((e=>{var t=H().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Ie=t((e=>{var t=H().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Le=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),W=t((e=>{var t=U(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Re=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),ze=t((e=>{var t=Re();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Be=t(((e,t)=>{var n=ze();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),G=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),K=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
2
  ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),q=t((e=>{var t=G(),n=K();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Ve=t((e=>{var t=H(),n=W(),r=U(),i=q(),a=G(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),He=t((e=>{var t=H(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Ue=t(((e,t)=>{var n=q();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),We=t(((e,t)=>{var n=q(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Ge=t(((e,t)=>{var n=q();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ke=t(((e,t)=>{var n=q(),r=H();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
3
  Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),qe=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Je=t((e=>{var t=q(),n=Ue(),r=We(),i=Ge(),a=Ke(),o=K(),s=H(),c=qe();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
4
  Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Ye=t((e=>{var t=H(),n=U(),r=Ne(),i=Pe(),a=Fe(),o=Ie(),s=Le(),c=W(),l=Be(),u=Ve(),d=He(),f=q(),p=Je();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
5
  The chosen QR Code version cannot contain this amount of data.
6
6
  Minimum version required to store current data is: `+c+`.
7
7
  `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Xe=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[a[t*i+r]?1:0]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Ze=t((e=>{var t=Xe();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Qe=t((e=>{var t=Xe();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
- `;return typeof a==`function`&&a(null,p),p}})),$e=t((e=>{var t=Me(),n=Ye(),r=Ze(),i=Qe();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))();function et(){return f({mutationFn:({channel:e,data:t})=>s(e,t)})}function tt(){return f({mutationFn:({channel:e,data:t})=>o(e,t)})}function nt(){return f({mutationFn:({channel:e,data:t})=>g(e,t)})}var rt={weixin:{title:`weixinAuthTitle`,description:`weixinAuthDescription`,hint:`weixinAuthHint`,capabilityHint:`weixinAuthCapabilityHint`,disabledHint:`weixinAuthDisabledHint`,connect:`weixinAuthConnect`,qrAlt:`weixinAuthQrAlt`,scanPrompt:`weixinAuthScanPrompt`,readyTitle:`weixinAuthReadyTitle`,readyDescription:`weixinAuthReadyDescription`,advancedTitle:`weixinAuthAdvancedTitle`,advancedDescription:`weixinAuthAdvancedDescription`},feishu:{title:`feishuAuthTitle`,description:`feishuAuthDescription`,hint:`feishuAuthHint`,capabilityHint:`feishuAuthCapabilityHint`,disabledHint:`feishuAuthDisabledHint`,connect:`feishuAuthConnect`,qrAlt:`feishuAuthQrAlt`,scanPrompt:`feishuAuthScanPrompt`,readyTitle:`feishuAuthReadyTitle`,readyDescription:`feishuAuthReadyDescription`,advancedTitle:`feishuAuthAdvancedTitle`,advancedDescription:`feishuAuthAdvancedDescription`,domainLabel:`feishuAuthDomain`}};function it(e){let{accounts:t}=e,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function at(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function ot(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function st(e,t){return ot(e,t)===`lark`?`lark`:`feishu`}function ct(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function lt(e,t){return d({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,$e.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function ut({activeSession:e,baseUrl:t,channelEnabled:n,copy:r,connectButtonLabel:i,connectedAccountIds:a,disabled:o,domain:s,handleStartAuth:c,hasConnectedAccount:l,primaryAccountId:u,statusLabel:d}){return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,V.jsx)(z,{className:`h-3.5 w-3.5`}),P(r.title)]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:P(r.description)}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:P(r.hint)})]}),(0,V.jsxs)(`div`,{className:m(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,e?`bg-amber-50 text-amber-700`:l?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[e?(0,V.jsx)(se,{className:`h-3.5 w-3.5 animate-spin`}):(0,V.jsx)(R,{className:`h-3.5 w-3.5`}),d]}),(0,V.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,V.jsx)(`p`,{children:P(n||!l?r.capabilityHint:r.disabledHint)}),u?(0,V.jsxs)(`p`,{children:[P(`weixinAuthPrimaryAccount`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:u})]}):null,a.length>1?(0,V.jsxs)(`p`,{children:[P(`weixinAuthConnectedAccounts`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:a.join(`, `)})]}):null,t?(0,V.jsxs)(`p`,{children:[P(`weixinAuthBaseUrl`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:t})]}):null,s&&r.domainLabel?(0,V.jsxs)(`p`,{children:[P(r.domainLabel),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s})]}):null]}),(0,V.jsx)(p,{type:`button`,onClick:()=>void c(),disabled:o,className:`rounded-xl`,children:i})]})}function dt({activeSession:e,authMessage:t,copy:n,qrDataUrl:r}){return(0,V.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:e?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:r?(0,V.jsx)(`img`,{src:r,alt:P(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,V.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,V.jsx)(se,{className:`h-5 w-5 animate-spin`}),(0,V.jsx)(`p`,{className:`text-xs`,children:P(`weixinAuthStarting`)})]})})}),(0,V.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,V.jsx)(`p`,{children:t||e.note||P(n.scanPrompt)}),(0,V.jsxs)(`p`,{children:[P(`weixinAuthExpiresAt`),`: `,ue(e.expiresAt)]})]}),(0,V.jsx)(b,{href:e.qrCodeUrl,external:!0,size:`xs`,children:P(`weixinAuthOpenQr`)})]}):(0,V.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,V.jsx)(z,{className:`h-9 w-9 text-gray-300`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:P(n.readyTitle)}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:P(n.readyDescription)})]})})}function ft({channelConfig:e,channelEnabled:t,channelName:n,disabled:r,formData:a}){let o=_(),s=et(),c=tt(),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!1),h=(0,B.useMemo)(()=>it(e),[e]),g=h[0],v=at(a,e),y=n===`feishu`?ot(a,e):void 0,b=h.length>0,x=b&&!p?null:l,S=lt(n,x?.qrCodeUrl),C=rt[n];(0,B.useEffect)(()=>{if(!x)return;let e=!1,t=null,r=async()=>{try{let a=await c.mutateAsync({channel:n,data:{sessionId:x.sessionId}});if(e)return;if(f(a),a.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),i.success(a.message||P(`weixinAuthAuthorized`)),u(null);return}if(a.status===`expired`||a.status===`error`){i.error(a.message||P(`weixinAuthRetryRequired`)),u(null);return}t=setTimeout(r,a.nextPollMs??x.intervalMs)}catch(t){e||(i.error(`${P(`error`)}: ${t instanceof Error?t.message:String(t)}`),u(null))}};return t=setTimeout(r,x.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[n,x,c,o]);let w=async()=>{try{let e=await s.mutateAsync({channel:n,data:{baseUrl:v,domain:y,accountId:typeof a.defaultAccountId==`string`&&a.defaultAccountId.trim()?a.defaultAccountId.trim():void 0}});m(b),u(e),f({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){i.error(`${P(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},ee=x?d?.status===`scanned`?P(`weixinAuthScanned`):P(`weixinAuthWaiting`):P(b?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),T=s.isPending?P(`weixinAuthStarting`):P(x?`weixinAuthWaiting`:b?`weixinAuthReconnect`:C.connect),E=b?P(`weixinAuthAuthorized`):d?.message;return(0,V.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,V.jsx)(ut,{activeSession:x,baseUrl:v,channelEnabled:t,copy:C,connectButtonLabel:T,connectedAccountIds:h,disabled:r||s.isPending||!!x,domain:y,handleStartAuth:w,hasConnectedAccount:b,primaryAccountId:g,statusLabel:ee}),(0,V.jsx)(dt,{activeSession:x,authMessage:E,copy:C,qrDataUrl:S})]})})}function pt({channelConfig:e,disabled:t,formData:n}){let a=_(),o=nt(),[s,c]=(0,B.useState)(()=>st(n,e)),[l,d]=(0,B.useState)(``),[f,m]=(0,B.useState)(``),h=ct(s),g=!!(l.trim()&&f.trim())&&!t&&!o.isPending,v=async()=>{try{let e=await o.mutateAsync({channel:`feishu`,data:{domain:s,fields:{appId:l.trim(),appSecret:f.trim()}}});await a.invalidateQueries({queryKey:[`config`]}),await a.invalidateQueries({queryKey:[`config-meta`]}),i.success(e.message||P(`feishuExistingAgentConnectSuccess`)),m(``)}catch(e){i.error(`${P(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,V.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,V.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:[(0,V.jsx)(R,{className:`h-3.5 w-3.5`}),P(`feishuExistingAgentTitle`)]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:P(`feishuExistingAgentDescription`)}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:P(`feishuExistingAgentHint`)})]}),(0,V.jsx)(b,{href:h,external:!0,children:P(s===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)})]}),(0,V.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(u,{htmlFor:`feishu-existing-platform`,children:P(`feishuPlatform`)}),(0,V.jsxs)(k,{value:s,onValueChange:e=>c(e===`lark`?`lark`:`feishu`),children:[(0,V.jsx)(E,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,V.jsx)(T,{})}),(0,V.jsxs)(D,{children:[(0,V.jsx)(O,{value:`feishu`,children:`Feishu`}),(0,V.jsx)(O,{value:`lark`,children:`Lark`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(u,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,V.jsx)(r,{id:`feishu-existing-app-id`,value:l,onChange:e=>d(e.target.value),className:`rounded-xl`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(u,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,V.jsx)(r,{id:`feishu-existing-app-secret`,type:`password`,value:f,onChange:e=>m(e.target.value),className:`rounded-xl`})]}),(0,V.jsx)(p,{type:`button`,onClick:()=>void v(),disabled:!g,className:`w-full rounded-xl`,children:o.isPending?P(`feishuExistingAgentConnecting`):P(`feishuExistingAgentConnect`)})]})]})})}function mt(e){let[t,n]=(0,B.useState)(`create`);return(0,V.jsxs)(M,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,V.jsxs)(j,{children:[(0,V.jsx)(A,{value:`create`,children:P(`feishuAuthCreateNew`)}),(0,V.jsx)(A,{value:`existing`,children:P(`feishuAuthConnectExisting`)})]}),(0,V.jsx)(ie,{value:`create`,className:`mt-4`,children:(0,V.jsx)(ft,{...e,channelName:`feishu`})}),(0,V.jsx)(ie,{value:`existing`,className:`mt-4`,children:(0,V.jsx)(pt,{...e})})]})}var ht=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],J=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],gt=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],_t=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function vt(){return{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:P(`defaultAccountId`)},{name:`domain`,type:`select`,label:P(`feishuAuthDomain`),options:gt},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:P(`groupPolicy`),options:J},{name:`requireMention`,type:`boolean`,label:P(`requireMention`)},{name:`accounts`,type:`json`,label:P(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`feishu-auth`},{type:`fields`,section:`advanced`,collapsible:{title:P(`feishuAuthAdvancedTitle`),description:P(`feishuAuthAdvancedDescription`)}}]}}function yt(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`token`,type:`password`,label:P(`botToken`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`proxy`,type:`text`,label:P(`proxy`)},{name:`accountId`,type:`text`,label:P(`accountId`)},{name:`dmPolicy`,type:`select`,label:P(`dmPolicy`),options:ht},{name:`groupPolicy`,type:`select`,label:P(`groupPolicy`),options:J},{name:`groupAllowFrom`,type:`tags`,label:P(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:P(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:P(`mentionPatterns`)},{name:`groups`,type:`json`,label:P(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`token`,type:`password`,label:P(`botToken`)},{name:`allowBots`,type:`boolean`,label:P(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:P(`gatewayUrl`)},{name:`intents`,type:`number`,label:P(`intents`)},{name:`proxy`,type:`text`,label:P(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:P(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:P(`streamingMode`),options:_t},{name:`draftChunk`,type:`json`,label:P(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:P(`textChunkLimit`)},{name:`accountId`,type:`text`,label:P(`accountId`)},{name:`dmPolicy`,type:`select`,label:P(`dmPolicy`),options:ht},{name:`groupPolicy`,type:`select`,label:P(`groupPolicy`),options:J},{name:`groupAllowFrom`,type:`tags`,label:P(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:P(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:P(`mentionPatterns`)},{name:`groups`,type:`json`,label:P(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`bridgeUrl`,type:`text`,label:P(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]},feishu:vt(),dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`clientId`,type:`text`,label:P(`clientId`)},{name:`clientSecret`,type:`password`,label:P(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`corpId`,type:`text`,label:P(`corpId`)},{name:`agentId`,type:`text`,label:P(`agentId`)},{name:`secret`,type:`password`,label:P(`secret`)},{name:`token`,type:`password`,label:P(`token`)},{name:`callbackPort`,type:`number`,label:P(`callbackPort`)},{name:`callbackPath`,type:`text`,label:P(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:P(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:P(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:P(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`accounts`,type:`json`,label:P(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:P(`weixinAuthAdvancedTitle`),description:P(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`mode`,type:`text`,label:P(`mode`)},{name:`webhookPath`,type:`text`,label:P(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:P(`allowBotMessages`)},{name:`botToken`,type:`password`,label:P(`botToken`)},{name:`appToken`,type:`password`,label:P(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`consentGranted`,type:`boolean`,label:P(`consentGranted`)},{name:`imapHost`,type:`text`,label:P(`imapHost`)},{name:`imapPort`,type:`number`,label:P(`imapPort`)},{name:`imapUsername`,type:`text`,label:P(`imapUsername`)},{name:`imapPassword`,type:`password`,label:P(`imapPassword`)},{name:`fromAddress`,type:`email`,label:P(`fromAddress`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`appId`,type:`text`,label:P(`appId`)},{name:`secret`,type:`password`,label:P(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:P(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]}}}function Y(e){let t=le();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var bt=[],xt=[{type:`fields`,section:`all`}],X=new Set,Z=new Map,Q=null;function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function St(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=$(n[e])&&$(r)?St(n[e],r):r;return n}function Ct(e,t){let n={},r=n,i=e.split(`.`);for(let e=0;e<i.length-1;e+=1)r[i[e]]={},r=r[i[e]];return r[i[i.length-1]]=t,n}function wt(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function Tt(e,t){let n={};return t.filter(e=>e.type===`json`).forEach(t=>{n[t.name]=JSON.stringify(e[t.name]??{},null,2)}),n}function Et(){Q||=a.eventBus.on(n.channelConfigApplyStatus,e=>{Z.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),X.forEach(e=>e())})}function Dt(e){return X.add(e),Et(),()=>{X.delete(e),!X.size&&Q&&(Q(),Q=null,Z.clear())}}function Ot(e){return(0,B.useSyncExternalStore)(Dt,()=>e?Z.get(e)??null:null,()=>null)}function kt(e){return e?e.status===`applying`?{className:`text-amber-600`,label:P(`channelConfigApplying`)}:e.status===`applied`?{className:`text-emerald-600`,label:P(`channelConfigApplied`)}:{className:`text-red-600`,label:`${P(`channelConfigApplyFailed`)}${e.message?`: ${e.message}`:``}`}:null}function At({channelApplyStatus:e,channelLabel:t,channelName:n,enabled:r,tutorialUrl:i}){return(0,V.jsx)(I,{className:`px-5 py-4`,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(de,{name:n,src:N(n),className:m(`h-9 w-9 rounded-lg bg-background/80`,r&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,V.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:n[0]})}),(0,V.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground capitalize`,children:t})]}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:P(`channelsFormDescription`)}),e?(0,V.jsx)(`p`,{className:m(`mt-2 text-xs font-medium`,e.className),children:e.label}):null,i?(0,V.jsx)(b,{href:i,external:!0,icon:ee,size:`xs`,className:`mt-2`,children:P(`channelsGuideTitle`)}):null]}),(0,V.jsx)(fe,{status:r?`active`:`inactive`,label:P(r?`statusActive`:`statusInactive`)})]})})}function jt({channelConfig:e,channelName:t,disabled:n,enabled:r,fields:i,formData:a,jsonDrafts:o,layoutBlocks:s,setJsonDrafts:c,uiHints:l,updateField:u}){return(0,V.jsx)(V.Fragment,{children:s.map((s,d)=>{if(s.type===`fields`){let e=wt(i,s.section);if(e.length===0)return null;let n=(0,V.jsx)(je,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,V.jsxs)(`details`,{className:`group rounded-xl bg-muted/35`,children:[(0,V.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-medium text-foreground`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,V.jsx)(`p`,{className:`mt-1 text-xs font-normal text-muted-foreground`,children:s.collapsible.description}):null]}),(0,V.jsx)(te,{className:`h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,V.jsx)(`div`,{className:`space-y-5 border-t border-border/45 px-4 py-4`,children:n})]},`${s.type}-${s.section}-${d}`):(0,V.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,V.jsx)(mt,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,V.jsx)(ft,{channelConfig:e,formData:a,channelName:`weixin`,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):null})})}function Mt({actions:e,channelConfig:t,channelLabel:n,channelName:r,fields:a,layoutBlocks:o,tutorialUrl:s,uiHints:c}){let l=pe(),u=ge(),[d,f]=(0,B.useState)(()=>({...t})),[m,h]=(0,B.useState)(()=>Tt(t,a)),[g,_]=(0,B.useState)(null),v=kt(Ot(r)),y=typeof d.enabled==`boolean`?d.enabled:!!t.enabled,b=l.isPending||!!g,x=(e,t)=>f(n=>({...n,[e]:t})),S=e=>{e.preventDefault();let t={...d};for(let e of a){if(e.type===`password`){let n=t[e.name];(typeof n!=`string`||n.length===0)&&delete t[e.name]}if(e.type===`json`)try{t[e.name]=(m[e.name]??``).trim()?JSON.parse(m[e.name]):{}}catch{i.error(`${P(`invalidJson`)}: ${e.name}`);return}}l.mutate({channel:r,data:t})},C=e=>{if(!$(e?.channels)||!$(e.channels[r]))return;let t=e.channels[r];f(e=>St(e,t)),h(e=>{let n={...e},r=!1;for(let e of a)e.type!==`json`||!Object.prototype.hasOwnProperty.call(t,e.name)||(n[e.name]=JSON.stringify(t[e.name]??{},null,2),r=!0);return r?n:e})},w=async e=>{_(e.id);try{let t=`channels.${r}`,n={...d};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},f(n),await l.mutateAsync({channel:r,data:n}));let a=await u.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:Ct(t,n)}});C(a.patch),a.ok?i.success(a.message||P(`success`)):i.error(a.message||P(`error`))}catch(e){i.error(`${P(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{_(null)}};return(0,V.jsxs)(Se,{children:[(0,V.jsx)(At,{channelName:r,channelLabel:n,enabled:y,tutorialUrl:s,channelApplyStatus:v}),(0,V.jsxs)(`form`,{onSubmit:S,className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsx)(L,{className:`space-y-5 px-5 py-4`,children:(0,V.jsx)(jt,{channelConfig:t,channelName:r,enabled:y,fields:a,formData:d,jsonDrafts:m,layoutBlocks:o,setJsonDrafts:h,uiHints:c,updateField:x,disabled:b})}),(0,V.jsx)(we,{children:(0,V.jsxs)(ve,{align:`between`,children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,V.jsx)(p,{type:`button`,size:`sm`,onClick:()=>void w(e),disabled:b,variant:`secondary`,children:g===e.id?P(`connecting`):e.title},e.id))}),(0,V.jsx)(p,{type:`submit`,size:`sm`,disabled:b,children:l.isPending?P(`saving`):P(`save`)})]})})]})]})}function Nt({channelName:e}){let{data:t}=_e(),{data:n}=me(),{data:r}=he(),i=e?t?.channels[e]??null:null,a=n?.channels.find(t=>t.name===e),o=(0,B.useMemo)(()=>yt()[e||``],[e]);if(!e||!a||!i)return(0,V.jsx)(Ce,{children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:P(`channelsSelectTitle`)}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:P(`channelsSelectDescription`)})]})});let s=o?.fields??bt,c=o?.layout??xt,l=r?.uiHints,u=F(`channels.${e}`,l)?.label??e,d=Y(a),f=JSON.stringify({channelName:e,channelConfig:i,jsonFields:s.filter(e=>e.type===`json`).map(e=>e.name)});return(0,V.jsx)(Mt,{actions:r?.actions?.filter(t=>t.scope===`channels.${e}`)??[],channelConfig:i,channelLabel:u,channelName:e,fields:s,layoutBlocks:c,tutorialUrl:d,uiHints:l},f)}var Pt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},Ft=[`weixin`,`feishu`,`discord`,`qq`];function It(e){let t=new Map(Ft.map((e,t)=>[e,t]));return e.map((e,t)=>({channel:e,index:t})).sort((e,n)=>{let r=t.get(e.channel.name)??1/0,i=t.get(n.channel.name)??1/0;return r===i?e.index-n.index:r-i}).map(({channel:e})=>e)}function Lt(){let{isMobile:e}=w(),{data:t}=_e(),{data:n}=me(),{data:i}=he(),[a,o]=(0,B.useState)(`enabled`),[s,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(``),f=(0,B.useMemo)(()=>It(n?.channels??[]),[n?.channels]),p=t?.channels,h=(0,B.useMemo)(()=>{let e=u.trim().toLowerCase();return f.filter(e=>a!==`enabled`||!!p?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[a,p,f,u]),g=s&&h.some(e=>e.name===s)?s:e?null:h[0]?.name??null;return!t||!n?(0,V.jsx)(c,{title:P(`channelsPageTitle`),description:P(`channelsPageDescription`),layout:`split`,children:(0,V.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:P(`channelsLoading`)})}):(0,V.jsx)(c,{title:P(`channelsPageTitle`),description:P(`channelsPageDescription`),layout:`split`,children:(0,V.jsxs)(ye,{className:`md:min-h-0`,compactView:s?`detail`:`list`,onMobileBack:()=>l(null),mobileListLabel:P(`channelsPageTitle`),children:[(0,V.jsxs)(xe,{children:[(0,V.jsx)(I,{className:`px-4 pt-4`,children:(0,V.jsx)(M,{value:a,onValueChange:o,children:(0,V.jsxs)(j,{className:`mb-0 h-auto gap-3 border-b-0 bg-transparent p-0`,children:[(0,V.jsxs)(A,{value:`enabled`,className:`gap-1.5 px-0 pb-3`,children:[P(`channelsTabEnabled`),(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:f.filter(e=>p?.[e.name]?.enabled).length})]}),(0,V.jsxs)(A,{value:`all`,className:`gap-1.5 px-0 pb-3`,children:[P(`channelsTabAll`),(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:f.length})]})]})})}),(0,V.jsx)(`div`,{className:`border-b border-border/55 px-4 py-3`,children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,V.jsx)(r,{value:u,onChange:e=>d(e.target.value),placeholder:P(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,V.jsxs)(L,{className:`space-y-2 p-3`,children:[h.map(e=>{let n=!!t.channels[e.name]?.enabled,r=Y(e),a=F(`channels.${e.name}`,i?.uiHints)?.help||P(Pt[e.name]||`channelDescriptionDefault`);return(0,V.jsx)(Te,{onClick:()=>l(e.name),active:g===e.name,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(de,{name:e.name,src:N(e.name),className:m(`h-10 w-10 rounded-lg bg-background/80`,n&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,V.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.name[0]})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:e.displayName||e.name}),(0,V.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:a})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r?(0,V.jsx)(`a`,{href:r,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground/45 transition-colors hover:bg-muted hover:text-foreground`,title:P(`channelsGuideTitle`),children:(0,V.jsx)(y,{className:`h-3.5 w-3.5`})}):null,(0,V.jsx)(fe,{status:n?`active`:`inactive`,label:P(n?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),h.length===0?(0,V.jsx)(be,{icon:ne,title:P(`channelsNoMatch`)}):null]})]}),(0,V.jsx)(Nt,{channelName:g??void 0})]})})}export{Lt as ChannelsList};
8
+ `;return typeof a==`function`&&a(null,p),p}})),$e=t((e=>{var t=Me(),n=Ye(),r=Ze(),i=Qe();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))();function et(){return f({mutationFn:({channel:e,data:t})=>s(e,t)})}function tt(){return f({mutationFn:({channel:e,data:t})=>o(e,t)})}function nt(){return f({mutationFn:({channel:e,data:t})=>g(e,t)})}var rt={weixin:{title:`weixinAuthTitle`,description:`weixinAuthDescription`,hint:`weixinAuthHint`,capabilityHint:`weixinAuthCapabilityHint`,disabledHint:`weixinAuthDisabledHint`,connect:`weixinAuthConnect`,qrAlt:`weixinAuthQrAlt`,scanPrompt:`weixinAuthScanPrompt`,readyTitle:`weixinAuthReadyTitle`,readyDescription:`weixinAuthReadyDescription`,advancedTitle:`weixinAuthAdvancedTitle`,advancedDescription:`weixinAuthAdvancedDescription`},feishu:{title:`feishuAuthTitle`,description:`feishuAuthDescription`,hint:`feishuAuthHint`,capabilityHint:`feishuAuthCapabilityHint`,disabledHint:`feishuAuthDisabledHint`,connect:`feishuAuthConnect`,qrAlt:`feishuAuthQrAlt`,scanPrompt:`feishuAuthScanPrompt`,readyTitle:`feishuAuthReadyTitle`,readyDescription:`feishuAuthReadyDescription`,advancedTitle:`feishuAuthAdvancedTitle`,advancedDescription:`feishuAuthAdvancedDescription`,domainLabel:`feishuAuthDomain`}};function it(e){let{accounts:t}=e,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function at(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function ot(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function st(e,t){return ot(e,t)===`lark`?`lark`:`feishu`}function ct(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function lt(e,t){return d({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,$e.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function ut({activeSession:e,baseUrl:t,channelEnabled:n,copy:r,connectButtonLabel:i,connectedAccountIds:a,disabled:o,domain:s,handleStartAuth:c,hasConnectedAccount:l,primaryAccountId:u,statusLabel:d}){return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,V.jsx)(z,{className:`h-3.5 w-3.5`}),P(r.title)]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:P(r.description)}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:P(r.hint)})]}),(0,V.jsxs)(`div`,{className:m(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,e?`bg-amber-50 text-amber-700`:l?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[e?(0,V.jsx)(se,{className:`h-3.5 w-3.5 animate-spin`}):(0,V.jsx)(R,{className:`h-3.5 w-3.5`}),d]}),(0,V.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,V.jsx)(`p`,{children:P(n||!l?r.capabilityHint:r.disabledHint)}),u?(0,V.jsxs)(`p`,{children:[P(`weixinAuthPrimaryAccount`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:u})]}):null,a.length>1?(0,V.jsxs)(`p`,{children:[P(`weixinAuthConnectedAccounts`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:a.join(`, `)})]}):null,t?(0,V.jsxs)(`p`,{children:[P(`weixinAuthBaseUrl`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:t})]}):null,s&&r.domainLabel?(0,V.jsxs)(`p`,{children:[P(r.domainLabel),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s})]}):null]}),(0,V.jsx)(p,{type:`button`,onClick:()=>void c(),disabled:o,className:`rounded-xl`,children:i})]})}function dt({activeSession:e,authMessage:t,copy:n,qrDataUrl:r}){return(0,V.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:e?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:r?(0,V.jsx)(`img`,{src:r,alt:P(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,V.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,V.jsx)(se,{className:`h-5 w-5 animate-spin`}),(0,V.jsx)(`p`,{className:`text-xs`,children:P(`weixinAuthStarting`)})]})})}),(0,V.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,V.jsx)(`p`,{children:t||e.note||P(n.scanPrompt)}),(0,V.jsxs)(`p`,{children:[P(`weixinAuthExpiresAt`),`: `,ue(e.expiresAt)]})]}),(0,V.jsx)(b,{href:e.qrCodeUrl,external:!0,size:`xs`,children:P(`weixinAuthOpenQr`)})]}):(0,V.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,V.jsx)(z,{className:`h-9 w-9 text-gray-300`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:P(n.readyTitle)}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:P(n.readyDescription)})]})})}function ft({channelConfig:e,channelEnabled:t,channelName:n,disabled:r,formData:a}){let o=_(),s=et(),c=tt(),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!1),h=(0,B.useMemo)(()=>it(e),[e]),g=h[0],v=at(a,e),y=n===`feishu`?ot(a,e):void 0,b=h.length>0,x=b&&!p?null:l,S=lt(n,x?.qrCodeUrl),C=rt[n];(0,B.useEffect)(()=>{if(!x)return;let e=!1,t=null,r=async()=>{try{let a=await c.mutateAsync({channel:n,data:{sessionId:x.sessionId}});if(e)return;if(f(a),a.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),i.success(a.message||P(`weixinAuthAuthorized`)),u(null);return}if(a.status===`expired`||a.status===`error`){i.error(a.message||P(`weixinAuthRetryRequired`)),u(null);return}t=setTimeout(r,a.nextPollMs??x.intervalMs)}catch(t){e||(i.error(`${P(`error`)}: ${t instanceof Error?t.message:String(t)}`),u(null))}};return t=setTimeout(r,x.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[n,x,c,o]);let w=async()=>{try{let e=await s.mutateAsync({channel:n,data:{baseUrl:v,domain:y,accountId:typeof a.defaultAccountId==`string`&&a.defaultAccountId.trim()?a.defaultAccountId.trim():void 0}});m(b),u(e),f({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){i.error(`${P(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},ee=x?d?.status===`scanned`?P(`weixinAuthScanned`):P(`weixinAuthWaiting`):P(b?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),T=s.isPending?P(`weixinAuthStarting`):P(x?`weixinAuthWaiting`:b?`weixinAuthReconnect`:C.connect),E=b?P(`weixinAuthAuthorized`):d?.message;return(0,V.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,V.jsx)(ut,{activeSession:x,baseUrl:v,channelEnabled:t,copy:C,connectButtonLabel:T,connectedAccountIds:h,disabled:r||s.isPending||!!x,domain:y,handleStartAuth:w,hasConnectedAccount:b,primaryAccountId:g,statusLabel:ee}),(0,V.jsx)(dt,{activeSession:x,authMessage:E,copy:C,qrDataUrl:S})]})})}function pt({channelConfig:e,disabled:t,formData:n}){let a=_(),o=nt(),[s,c]=(0,B.useState)(()=>st(n,e)),[l,d]=(0,B.useState)(``),[f,m]=(0,B.useState)(``),h=ct(s),g=!!(l.trim()&&f.trim())&&!t&&!o.isPending,v=async()=>{try{let e=await o.mutateAsync({channel:`feishu`,data:{domain:s,fields:{appId:l.trim(),appSecret:f.trim()}}});await a.invalidateQueries({queryKey:[`config`]}),await a.invalidateQueries({queryKey:[`config-meta`]}),i.success(e.message||P(`feishuExistingAgentConnectSuccess`)),m(``)}catch(e){i.error(`${P(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,V.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,V.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:[(0,V.jsx)(R,{className:`h-3.5 w-3.5`}),P(`feishuExistingAgentTitle`)]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:P(`feishuExistingAgentDescription`)}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:P(`feishuExistingAgentHint`)})]}),(0,V.jsx)(b,{href:h,external:!0,children:P(s===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)})]}),(0,V.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(u,{htmlFor:`feishu-existing-platform`,children:P(`feishuPlatform`)}),(0,V.jsxs)(k,{value:s,onValueChange:e=>c(e===`lark`?`lark`:`feishu`),children:[(0,V.jsx)(E,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,V.jsx)(T,{})}),(0,V.jsxs)(D,{children:[(0,V.jsx)(O,{value:`feishu`,children:`Feishu`}),(0,V.jsx)(O,{value:`lark`,children:`Lark`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(u,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,V.jsx)(r,{id:`feishu-existing-app-id`,value:l,onChange:e=>d(e.target.value),className:`rounded-xl`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(u,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,V.jsx)(r,{id:`feishu-existing-app-secret`,type:`password`,value:f,onChange:e=>m(e.target.value),className:`rounded-xl`})]}),(0,V.jsx)(p,{type:`button`,onClick:()=>void v(),disabled:!g,className:`w-full rounded-xl`,children:o.isPending?P(`feishuExistingAgentConnecting`):P(`feishuExistingAgentConnect`)})]})]})})}function mt(e){let[t,n]=(0,B.useState)(`create`);return(0,V.jsxs)(M,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,V.jsxs)(j,{children:[(0,V.jsx)(A,{value:`create`,children:P(`feishuAuthCreateNew`)}),(0,V.jsx)(A,{value:`existing`,children:P(`feishuAuthConnectExisting`)})]}),(0,V.jsx)(ie,{value:`create`,className:`mt-4`,children:(0,V.jsx)(ft,{...e,channelName:`feishu`})}),(0,V.jsx)(ie,{value:`existing`,className:`mt-4`,children:(0,V.jsx)(pt,{...e})})]})}var ht=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],J=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],gt=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],_t=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function vt(){return{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:P(`defaultAccountId`)},{name:`domain`,type:`select`,label:P(`feishuAuthDomain`),options:gt},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:P(`groupPolicy`),options:J},{name:`requireMention`,type:`boolean`,label:P(`requireMention`)},{name:`accounts`,type:`json`,label:P(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`feishu-auth`},{type:`fields`,section:`advanced`,collapsible:{title:P(`feishuAuthAdvancedTitle`),description:P(`feishuAuthAdvancedDescription`)}}]}}function yt(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`token`,type:`password`,label:P(`botToken`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`proxy`,type:`text`,label:P(`proxy`)},{name:`accountId`,type:`text`,label:P(`accountId`)},{name:`dmPolicy`,type:`select`,label:P(`dmPolicy`),options:ht},{name:`groupPolicy`,type:`select`,label:P(`groupPolicy`),options:J},{name:`groupAllowFrom`,type:`tags`,label:P(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:P(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:P(`mentionPatterns`)},{name:`groups`,type:`json`,label:P(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`token`,type:`password`,label:P(`botToken`)},{name:`allowBots`,type:`boolean`,label:P(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:P(`gatewayUrl`)},{name:`intents`,type:`number`,label:P(`intents`)},{name:`proxy`,type:`text`,label:P(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:P(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:P(`streamingMode`),options:_t},{name:`draftChunk`,type:`json`,label:P(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:P(`textChunkLimit`)},{name:`accountId`,type:`text`,label:P(`accountId`)},{name:`dmPolicy`,type:`select`,label:P(`dmPolicy`),options:ht},{name:`groupPolicy`,type:`select`,label:P(`groupPolicy`),options:J},{name:`groupAllowFrom`,type:`tags`,label:P(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:P(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:P(`mentionPatterns`)},{name:`groups`,type:`json`,label:P(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`bridgeUrl`,type:`text`,label:P(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]},feishu:vt(),dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`clientId`,type:`text`,label:P(`clientId`)},{name:`clientSecret`,type:`password`,label:P(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`corpId`,type:`text`,label:P(`corpId`)},{name:`agentId`,type:`text`,label:P(`agentId`)},{name:`secret`,type:`password`,label:P(`secret`)},{name:`token`,type:`password`,label:P(`token`)},{name:`callbackPort`,type:`number`,label:P(`callbackPort`)},{name:`callbackPath`,type:`text`,label:P(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:P(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:P(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:P(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)},{name:`accounts`,type:`json`,label:P(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:P(`weixinAuthAdvancedTitle`),description:P(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`mode`,type:`text`,label:P(`mode`)},{name:`webhookPath`,type:`text`,label:P(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:P(`allowBotMessages`)},{name:`botToken`,type:`password`,label:P(`botToken`)},{name:`appToken`,type:`password`,label:P(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`consentGranted`,type:`boolean`,label:P(`consentGranted`)},{name:`imapHost`,type:`text`,label:P(`imapHost`)},{name:`imapPort`,type:`number`,label:P(`imapPort`)},{name:`imapUsername`,type:`text`,label:P(`imapUsername`)},{name:`imapPassword`,type:`password`,label:P(`imapPassword`)},{name:`fromAddress`,type:`email`,label:P(`fromAddress`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:P(`enabled`)},{name:`appId`,type:`text`,label:P(`appId`)},{name:`secret`,type:`password`,label:P(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:P(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:P(`allowFrom`)}]}}}function Y(e){let t=le();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var bt=[],xt=[{type:`fields`,section:`all`}],X=new Set,Z=new Map,Q=null;function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function St(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=$(n[e])&&$(r)?St(n[e],r):r;return n}function Ct(e,t){let n={},r=n,i=e.split(`.`);for(let e=0;e<i.length-1;e+=1)r[i[e]]={},r=r[i[e]];return r[i[i.length-1]]=t,n}function wt(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function Tt(e,t){let n={};return t.filter(e=>e.type===`json`).forEach(t=>{n[t.name]=JSON.stringify(e[t.name]??{},null,2)}),n}function Et(){Q||=a.eventBus.on(n.channelConfigApplyStatus,e=>{Z.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),X.forEach(e=>e())})}function Dt(e){return X.add(e),Et(),()=>{X.delete(e),!X.size&&Q&&(Q(),Q=null,Z.clear())}}function Ot(e){return(0,B.useSyncExternalStore)(Dt,()=>e?Z.get(e)??null:null,()=>null)}function kt(e){return e?e.status===`applying`?{className:`text-amber-600`,label:P(`channelConfigApplying`)}:e.status===`applied`?{className:`text-emerald-600`,label:P(`channelConfigApplied`)}:{className:`text-red-600`,label:`${P(`channelConfigApplyFailed`)}${e.message?`: ${e.message}`:``}`}:null}function At({channelApplyStatus:e,channelLabel:t,channelName:n,enabled:r,tutorialUrl:i}){return(0,V.jsx)(I,{className:`px-5 py-4`,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(de,{name:n,src:N(n),className:m(`h-9 w-9 rounded-lg bg-background/80`,r&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,V.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:n[0]})}),(0,V.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground capitalize`,children:t})]}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:P(`channelsFormDescription`)}),e?(0,V.jsx)(`p`,{className:m(`mt-2 text-xs font-medium`,e.className),children:e.label}):null,i?(0,V.jsx)(b,{href:i,external:!0,icon:ee,size:`xs`,className:`mt-2`,children:P(`channelsGuideTitle`)}):null]}),(0,V.jsx)(fe,{status:r?`active`:`inactive`,label:P(r?`statusActive`:`statusInactive`)})]})})}function jt({channelConfig:e,channelName:t,disabled:n,enabled:r,fields:i,formData:a,jsonDrafts:o,layoutBlocks:s,setJsonDrafts:c,uiHints:l,updateField:u}){return(0,V.jsx)(V.Fragment,{children:s.map((s,d)=>{if(s.type===`fields`){let e=wt(i,s.section);if(e.length===0)return null;let n=(0,V.jsx)(je,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,V.jsxs)(`details`,{className:`group rounded-xl bg-muted/35`,children:[(0,V.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-medium text-foreground`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,V.jsx)(`p`,{className:`mt-1 text-xs font-normal text-muted-foreground`,children:s.collapsible.description}):null]}),(0,V.jsx)(te,{className:`h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,V.jsx)(`div`,{className:`space-y-5 border-t border-border/45 px-4 py-4`,children:n})]},`${s.type}-${s.section}-${d}`):(0,V.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,V.jsx)(mt,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,V.jsx)(ft,{channelConfig:e,formData:a,channelName:`weixin`,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):null})})}function Mt({actions:e,channelConfig:t,channelLabel:n,channelName:r,fields:a,layoutBlocks:o,tutorialUrl:s,uiHints:c}){let l=pe(),u=ge(),[d,f]=(0,B.useState)(()=>({...t})),[m,h]=(0,B.useState)(()=>Tt(t,a)),[g,_]=(0,B.useState)(null),v=kt(Ot(r)),y=typeof d.enabled==`boolean`?d.enabled:!!t.enabled,b=l.isPending||!!g,x=(e,t)=>f(n=>({...n,[e]:t})),S=e=>{e.preventDefault();let t={...d};for(let e of a){if(e.type===`password`){let n=t[e.name];(typeof n!=`string`||n.length===0)&&delete t[e.name]}if(e.type===`json`)try{t[e.name]=(m[e.name]??``).trim()?JSON.parse(m[e.name]):{}}catch{i.error(`${P(`invalidJson`)}: ${e.name}`);return}}l.mutate({channel:r,data:t})},C=e=>{if(!$(e?.channels)||!$(e.channels[r]))return;let t=e.channels[r];f(e=>St(e,t)),h(e=>{let n={...e},r=!1;for(let e of a)e.type!==`json`||!Object.prototype.hasOwnProperty.call(t,e.name)||(n[e.name]=JSON.stringify(t[e.name]??{},null,2),r=!0);return r?n:e})},w=async e=>{_(e.id);try{let t=`channels.${r}`,n={...d};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},f(n),await l.mutateAsync({channel:r,data:n}));let a=await u.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:Ct(t,n)}});C(a.patch),a.ok?i.success(a.message||P(`success`)):i.error(a.message||P(`error`))}catch(e){i.error(`${P(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{_(null)}};return(0,V.jsxs)(Se,{children:[(0,V.jsx)(At,{channelName:r,channelLabel:n,enabled:y,tutorialUrl:s,channelApplyStatus:v}),(0,V.jsxs)(`form`,{onSubmit:S,className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsx)(L,{className:`space-y-5 px-5 py-4`,children:(0,V.jsx)(jt,{channelConfig:t,channelName:r,enabled:y,fields:a,formData:d,jsonDrafts:m,layoutBlocks:o,setJsonDrafts:h,uiHints:c,updateField:x,disabled:b})}),(0,V.jsx)(we,{children:(0,V.jsxs)(ve,{align:`between`,children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,V.jsx)(p,{type:`button`,size:`sm`,onClick:()=>void w(e),disabled:b,variant:`secondary`,children:g===e.id?P(`connecting`):e.title},e.id))}),(0,V.jsx)(p,{type:`submit`,size:`sm`,disabled:b,children:l.isPending?P(`saving`):P(`save`)})]})})]})]})}function Nt({channelName:e}){let{data:t}=_e(),{data:n}=me(),{data:r}=he(),i=e?t?.channels[e]??null:null,a=n?.channels.find(t=>t.name===e),o=(0,B.useMemo)(()=>yt()[e||``],[e]);if(!e||!a||!i)return(0,V.jsx)(Ce,{children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:P(`channelsSelectTitle`)}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:P(`channelsSelectDescription`)})]})});let s=o?.fields??bt,c=o?.layout??xt,l=r?.uiHints,u=F(`channels.${e}`,l)?.label??e,d=Y(a),f=JSON.stringify({channelName:e,channelConfig:i,jsonFields:s.filter(e=>e.type===`json`).map(e=>e.name)});return(0,V.jsx)(Mt,{actions:r?.actions?.filter(t=>t.scope===`channels.${e}`)??[],channelConfig:i,channelLabel:u,channelName:e,fields:s,layoutBlocks:c,tutorialUrl:d,uiHints:l},f)}var Pt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},Ft=[`weixin`,`feishu`,`discord`,`qq`];function It(e){let t=new Map(Ft.map((e,t)=>[e,t]));return e.map((e,t)=>({channel:e,index:t})).sort((e,n)=>{let r=t.get(e.channel.name)??1/0,i=t.get(n.channel.name)??1/0;return r===i?e.index-n.index:r-i}).map(({channel:e})=>e)}function Lt(){let{isMobile:e}=w(),{data:t}=_e(),{data:n}=me(),{data:i}=he(),[a,o]=(0,B.useState)(`enabled`),[s,l]=(0,B.useState)(null),[u,d]=(0,B.useState)(``),f=(0,B.useMemo)(()=>It(n?.channels??[]),[n?.channels]),p=t?.channels,h=(0,B.useMemo)(()=>{let e=u.trim().toLowerCase();return f.filter(e=>a!==`enabled`||!!p?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[a,p,f,u]),g=s&&h.some(e=>e.name===s)?s:e?null:h[0]?.name??null;return!t||!n?(0,V.jsx)(c,{title:P(`channelsPageTitle`),description:P(`channelsPageDescription`),layout:`split`,children:(0,V.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:P(`channelsLoading`)})}):(0,V.jsx)(c,{title:P(`channelsPageTitle`),description:P(`channelsPageDescription`),layout:`split`,children:(0,V.jsxs)(ye,{className:`md:min-h-0`,compactView:s?`detail`:`list`,onMobileBack:()=>l(null),mobileListLabel:P(`channelsPageTitle`),children:[(0,V.jsxs)(xe,{children:[(0,V.jsx)(I,{className:`px-4 pt-4`,children:(0,V.jsx)(M,{value:a,onValueChange:o,children:(0,V.jsxs)(j,{className:`mb-0 h-auto gap-3 border-b-0 bg-transparent p-0`,children:[(0,V.jsxs)(A,{value:`enabled`,className:`gap-1.5 px-0 pb-3`,children:[P(`channelsTabEnabled`),(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:f.filter(e=>p?.[e.name]?.enabled).length})]}),(0,V.jsxs)(A,{value:`all`,className:`gap-1.5 px-0 pb-3`,children:[P(`channelsTabAll`),(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:f.length})]})]})})}),(0,V.jsx)(`div`,{className:`border-b border-border/55 px-4 py-3`,children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(C,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,V.jsx)(r,{value:u,onChange:e=>d(e.target.value),placeholder:P(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,V.jsxs)(L,{className:`space-y-2 p-3`,children:[h.map(e=>{let n=!!t.channels[e.name]?.enabled,r=Y(e),a=F(`channels.${e.name}`,i?.uiHints)?.help||P(Pt[e.name]||`channelDescriptionDefault`);return(0,V.jsx)(Te,{onClick:()=>l(e.name),active:g===e.name,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(de,{name:e.name,src:N(e.name),className:m(`h-10 w-10 rounded-lg bg-background/80`,n&&`ring-1 ring-primary/20`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,V.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.name[0]})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:e.displayName||e.name}),(0,V.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:a})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r?(0,V.jsx)(`a`,{href:r,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground/45 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,title:P(`channelsGuideTitle`),children:(0,V.jsx)(y,{className:`h-3.5 w-3.5`})}):null,(0,V.jsx)(fe,{status:n?`active`:`inactive`,label:P(n?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),h.length===0?(0,V.jsx)(be,{icon:ne,title:P(`channelsNoMatch`)}):null]})]}),(0,V.jsx)(Nt,{channelName:g??void 0})]})})}export{Lt as ChannelsList};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-B4xj2I2g.js";var t=e(`CircleDashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]);export{t};
1
+ import{t as e}from"./createLucideIcon-DE0sB9Nu.js";var t=e(`CircleDashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]);export{t};
@@ -1 +1 @@
1
- import{t as e}from"./chunk-DF37yw5_.js";import{vr as t}from"./api-DkLJrSCd.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var n=e((e=>{var n=t();e.createRoot=n.createRoot,e.hydrateRoot=n.hydrateRoot}));export{n as t};
1
+ import{t as e}from"./chunk-DF37yw5_.js";import{vr as t}from"./api-BZvNpFOS.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var n=e((e=>{var n=t();e.createRoot=n.createRoot,e.hydrateRoot=n.hydrateRoot}));export{n as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-BZvNpFOS.js";import{o as i}from"./use-viewport-layout-vmbQUNT6.js";import{s as a}from"./i18n-OGmF0Ws_.js";var o=e(r(),1),s=n(),c=`min-w-0 overflow-hidden bg-card/70 text-card-foreground md:h-[calc(100vh-180px)] md:max-h-[860px]`,l=`min-h-0 overflow-hidden rounded-2xl bg-muted/30 ring-1 ring-border/45`,u=640;function d({className:e,children:n,compactView:r,onMobileBack:c,mobileListLabel:d,...f}){let p=(0,o.useRef)(null),[m,h]=(0,o.useState)(!1),[g,_,...v]=o.Children.toArray(n);(0,o.useEffect)(()=>{let e=p.current;if(!e||!r||typeof ResizeObserver>`u`)return;let t=()=>h(e.clientWidth>0&&e.clientWidth<u),n=new ResizeObserver(t);return n.observe(e),t(),()=>n.disconnect()},[r]);let y=!!(m&&r&&g&&_);return(0,s.jsx)(`div`,{ref:p,className:t(`min-h-0 md:flex-1`,e),...f,children:y?(0,s.jsxs)(`div`,{className:`space-y-3`,children:[r===`detail`?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`button`,{type:`button`,onClick:c,className:`inline-flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,children:[(0,s.jsx)(i,{className:`h-4 w-4`}),(0,s.jsx)(`span`,{children:d??a(`backToMain`)})]}),(0,s.jsx)(`div`,{className:l,children:_})]}):(0,s.jsx)(`div`,{className:l,children:g}),v]}):(0,s.jsx)(`div`,{className:t(l,`grid grid-cols-1 md:grid-cols-[minmax(240px,30%)_minmax(0,1fr)]`),children:n})})}function f({className:e,...n}){return(0,s.jsx)(`section`,{className:t(c,`flex flex-col md:border-r md:border-border/55`,e),...n})}function p({className:e,...n}){return(0,s.jsx)(`section`,{className:t(c,`flex flex-col`,e),...n})}function m({className:e,...n}){return(0,s.jsx)(`section`,{className:t(c,`flex items-center justify-center px-6 py-12 text-center`,e),...n})}function h({className:e,...n}){return(0,s.jsx)(`div`,{className:t(`shrink-0 border-b border-border/70`,e),...n})}function g({className:e,scrollOnDesktop:n=!0,...r}){return(0,s.jsx)(`div`,{className:t(`min-h-0 flex-1`,n&&`overflow-visible md:overflow-y-auto md:overscroll-contain`,e),...r})}function _({className:e,...n}){return(0,s.jsx)(`div`,{className:t(`shrink-0 border-t border-border/70 px-4 py-2.5`,e),...n})}function v({active:e=!1,className:n,type:r=`button`,...i}){return(0,s.jsx)(`button`,{type:r,className:t(`w-full rounded-xl p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40`,e?`bg-[var(--interaction-selection)] text-foreground`:`bg-transparent text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`,n),...i})}function y({icon:e,title:n,description:r,className:i,...a}){return(0,s.jsxs)(`div`,{className:t(`flex min-h-[220px] flex-col items-center justify-center rounded-xl bg-background/55 px-4 py-10 text-center`,i),...a,children:[(0,s.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-card`,children:(0,s.jsx)(e,{className:`h-5 w-5 text-muted-foreground/45`})}),(0,s.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:n}),r?(0,s.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:r}):null]})}export{d as a,h as c,y as i,f as l,p as n,g as o,m as r,_ as s,v as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{Yt as t,cr as n,yr as r}from"./api-DkLJrSCd.js";import{t as i}from"./createLucideIcon-B4xj2I2g.js";import{s as a}from"./i18n-OGmF0Ws_.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./dialog-BgL3vKJQ.js";var f=i(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),p=i(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),m=i(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),h=e(r(),1),g=n(),_=({open:e,onOpenChange:n,title:r,description:i,confirmLabel:f=a(`confirm`),cancelLabel:p=a(`cancel`),variant:m=`default`,onConfirm:_,onCancel:v})=>{let y=h.useRef(null);return(0,g.jsx)(d,{open:e,onOpenChange:n,children:(0,g.jsxs)(c,{className:`[&>:last-child]:hidden`,onOpenAutoFocus:e=>{e.preventDefault(),y.current?.focus()},onCloseAutoFocus:e=>e.preventDefault(),children:[(0,g.jsxs)(o,{children:[(0,g.jsx)(l,{children:r}),i?(0,g.jsx)(u,{children:i}):null]}),(0,g.jsxs)(s,{className:`gap-2 sm:gap-0`,children:[(0,g.jsx)(t,{type:`button`,variant:`outline`,onClick:()=>{v(),n(!1)},children:p}),(0,g.jsx)(t,{ref:y,type:`button`,variant:m===`destructive`?`destructive`:`default`,onClick:()=>{_(),n(!1)},children:f})]})]})})};export{f as i,m as n,p as r,_ as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{Yt as t,cr as n,yr as r}from"./api-BZvNpFOS.js";import{t as i}from"./createLucideIcon-DE0sB9Nu.js";import{s as a}from"./i18n-OGmF0Ws_.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./dialog-BUfWO8hr.js";var f=i(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),p=i(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),m=i(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),h=e(r(),1),g=n(),_=({open:e,onOpenChange:n,title:r,description:i,confirmLabel:f=a(`confirm`),cancelLabel:p=a(`cancel`),variant:m=`default`,onConfirm:_,onCancel:v})=>{let y=h.useRef(null);return(0,g.jsx)(d,{open:e,onOpenChange:n,children:(0,g.jsxs)(c,{className:`[&>:last-child]:hidden`,onOpenAutoFocus:e=>{e.preventDefault(),y.current?.focus()},onCloseAutoFocus:e=>e.preventDefault(),children:[(0,g.jsxs)(o,{children:[(0,g.jsx)(l,{children:r}),i?(0,g.jsx)(u,{children:i}):null]}),(0,g.jsxs)(s,{className:`gap-2 sm:gap-0`,children:[(0,g.jsx)(t,{type:`button`,variant:`outline`,onClick:()=>{v(),n(!1)},children:p}),(0,g.jsx)(t,{ref:y,type:`button`,variant:m===`destructive`?`destructive`:`default`,onClick:()=>{_(),n(!1)},children:f})]})]})})};export{f as i,m as n,p as r,_ as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,vr as r,yr as i}from"./api-DkLJrSCd.js";import{t as a}from"./createLucideIcon-B4xj2I2g.js";import{S as o,_ as s,a as c,b as l,c as u,d,f,g as p,i as m,l as h,m as g,n as _,o as ee,p as v,r as te,s as y,t as ne,u as b,x}from"./es2015-D-CRf3_Z.js";var S=a(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),C=e(i(),1);function re(e,t){return C.useReducer((e,n)=>t[e][n]??e,e)}var w=e=>{let{present:t,children:n}=e,r=ie(t),i=typeof n==`function`?n({present:r.isPresent}):C.Children.only(n),a=x(r.ref,ae(i));return typeof n==`function`||r.isPresent?C.cloneElement(i,{ref:a}):null};w.displayName=`Presence`;function ie(e){let[t,n]=C.useState(),r=C.useRef(null),i=C.useRef(e),a=C.useRef(`none`),[o,s]=re(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return C.useEffect(()=>{let e=T(r.current);a.current=o===`mounted`?e:`none`},[o]),v(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=T(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),v(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=T(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=T(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:C.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function T(e){return e?.animationName||`none`}function ae(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var E=`flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1 text-left text-[13px] leading-5 font-medium outline-none transition-colors disabled:pointer-events-none disabled:opacity-45`,D={icon:`hover:before:bg-[var(--interaction-hover)] active:before:bg-[var(--interaction-hover)] disabled:hover:before:bg-transparent disabled:active:before:bg-transparent`,item:`hover:bg-[var(--interaction-hover)] focus-visible:bg-[var(--interaction-hover)] active:bg-[var(--interaction-hover)] disabled:hover:bg-transparent disabled:active:bg-transparent`,destructive:`text-destructive hover:bg-destructive/10 focus-visible:bg-destructive/10 disabled:hover:bg-transparent`},O=n(),k=`Popover`,[A,oe]=l(k,[d]),j=d(),[se,M]=A(k),N=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=j(t),l=C.useRef(null),[u,d]=C.useState(!1),[p,m]=c({prop:r,defaultProp:i??!1,onChange:a,caller:k});return(0,O.jsx)(b,{...s,children:(0,O.jsx)(se,{scope:t,contentId:f(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:C.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:C.useCallback(()=>d(!0),[]),onCustomAnchorRemove:C.useCallback(()=>d(!1),[]),modal:o,children:n})})};N.displayName=k;var P=`PopoverAnchor`,F=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=M(P,n),a=j(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return C.useEffect(()=>(o(),()=>s()),[o,s]),(0,O.jsx)(y,{...a,...r,ref:t})});F.displayName=P;var I=`PopoverTrigger`,L=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=M(I,n),a=j(n),s=x(t,i.triggerRef),c=(0,O.jsx)(p.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":G(i.open),...r,ref:s,onClick:o(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,O.jsx)(y,{asChild:!0,...a,children:c})});L.displayName=I;var R=`PopoverPortal`,[ce,le]=A(R,{forceMount:void 0}),z=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=M(R,t);return(0,O.jsx)(ce,{scope:t,forceMount:n,children:(0,O.jsx)(w,{present:n||a.open,children:(0,O.jsx)(ee,{asChild:!0,container:i,children:r})})})};z.displayName=R;var B=`PopoverContent`,V=C.forwardRef((e,t)=>{let n=le(B,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=M(B,e.__scopePopover);return(0,O.jsx)(w,{present:r||a.open,children:a.modal?(0,O.jsx)(H,{...i,ref:t}):(0,O.jsx)(de,{...i,ref:t})})});V.displayName=B;var ue=s(`PopoverContent.RemoveScroll`),H=C.forwardRef((e,t)=>{let n=M(B,e.__scopePopover),r=C.useRef(null),i=x(t,r),a=C.useRef(!1);return C.useEffect(()=>{let e=r.current;if(e)return ne(e)},[]),(0,O.jsx)(_,{as:ue,allowPinchZoom:!0,children:(0,O.jsx)(U,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:o(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:o(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:o(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),de=C.forwardRef((e,t)=>{let n=M(B,e.__scopePopover),r=C.useRef(!1),i=C.useRef(!1);return(0,O.jsx)(U,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),U=C.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=M(B,n),p=j(n);return te(),(0,O.jsx)(m,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,O.jsx)(g,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,O.jsx)(h,{"data-state":G(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),W=`PopoverClose`,fe=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=M(W,n);return(0,O.jsx)(p.button,{type:`button`,...r,ref:t,onClick:o(e.onClick,()=>i.onOpenChange(!1))})});fe.displayName=W;var pe=`PopoverArrow`,me=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=j(n);return(0,O.jsx)(u,{...i,...r,ref:t})});me.displayName=pe;function G(e){return e?`open`:`closed`}var K=N,he=F,q=L,J=z,Y=V,X=`w-max min-w-52 max-w-[min(18rem,calc(100vw-16px))] overflow-y-auto rounded-xl border border-border bg-popover p-1 text-popover-foreground shadow-[0_18px_48px_-20px_rgba(15,23,42,0.42)] outline-none`;function ge({item:e}){return(0,O.jsxs)(O.Fragment,{children:[e.icon?(0,O.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:e.icon}):null,(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.children?(0,O.jsx)(S,{className:`h-4 w-4 shrink-0`}):null]})}function _e({item:e,open:n,onOpenChange:r,onClose:i,className:a,children:o}){let s=(0,C.useRef)(null),c=(0,C.useRef)(null),[l,u]=(0,C.useState)(),d=(0,C.useCallback)(e=>{s.current=e,u(e?.closest(`[data-context-menu-layer]`)??void 0)},[]),f=(0,C.useRef)(),p=(0,C.useRef)(!1),m=()=>clearTimeout(f.current),h=e=>{m(),f.current=setTimeout(()=>r(e),e?100:250)};(0,C.useEffect)(()=>()=>clearTimeout(f.current),[]);let g=()=>{m(),r(!1),s.current?.focus()},_=()=>{m(),p.current=!0,r(!0),c.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()};return(0,O.jsxs)(K,{open:n,onOpenChange:r,children:[(0,O.jsx)(q,{asChild:!0,children:(0,O.jsx)(`button`,{ref:d,type:`button`,role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":n,disabled:e.disabled,"data-menu-key":e.key,className:t(a,n&&`bg-[var(--interaction-hover)]`),onPointerEnter:e=>{e.pointerType!==`touch`&&(p.current=!1,h(!0))},onPointerLeave:()=>h(!1),onClick:e=>{e.preventDefault(),e.stopPropagation(),_()},onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),_())},children:o})}),(0,O.jsx)(J,{container:l,children:(0,O.jsx)(Y,{ref:c,role:`menu`,"aria-label":e.label,"data-menu-escape-owner":``,"data-theme-overlay":`menu`,side:`right`,align:`start`,sideOffset:2,collisionPadding:8,className:t(X,`z-[var(--z-tooltip)]`),style:{minWidth:`min(13rem, var(--radix-popover-content-available-width))`,maxWidth:`min(18rem, var(--radix-popover-content-available-width))`,maxHeight:`var(--radix-popover-content-available-height)`},onPointerEnter:m,onPointerLeave:()=>h(!1),onPointerDown:e=>e.stopPropagation(),onOpenAutoFocus:e=>{p.current||e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{e.preventDefault(),g()},onKeyDown:e=>{(e.key===`ArrowLeft`||e.key===`Escape`)&&(e.preventDefault(),e.stopPropagation(),g())},children:(0,O.jsx)(Z,{groups:e.children,onClose:i})})})]})}function Z({groups:e,onClose:n}){let[r,i]=(0,C.useState)(null),a=(0,C.useRef)(null);return(0,O.jsx)(`div`,{ref:a,"data-menu-level":``,"data-menu-escape-owner":r?``:void 0,onKeyDown:e=>{if(e.target.closest(`[data-menu-level]`)===a.current){if(e.key===`Escape`&&r)e.preventDefault(),e.stopPropagation(),a.current?.querySelector(`[aria-expanded="true"]`)?.focus(),i(null);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault(),e.stopPropagation();let t=Array.from(a.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]).filter(e=>e.closest(`[data-menu-level]`)===a.current),n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowUp`?-1:1)+t.length)%t.length;i(null),t[r]?.focus()}}},children:e.filter(e=>e.items.length).map((e,a)=>(0,O.jsxs)(`div`,{role:`group`,children:[a>0?(0,O.jsx)(`div`,{className:`my-1 h-px bg-border`}):null,e.items.map(e=>{let a=t(E,e.destructive?D.destructive:`text-foreground ${D.item}`),o=(0,O.jsx)(ge,{item:e});if(e.children)return(0,O.jsx)(_e,{item:e,open:r===e.key,onOpenChange:t=>i(n=>t?e.key:n===e.key?null:n),onClose:n,className:a,children:o},e.key);let s=()=>{e.onSelect?.(),n(e.href?!1:e.restoreFocus!==!1)};return e.href?(0,O.jsx)(`a`,{role:`menuitem`,className:a,href:e.href,download:e.download,onPointerEnter:()=>i(null),onClick:e=>{e.stopPropagation(),s()},children:o},e.key):(0,O.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,"aria-pressed":e.pressed,"data-menu-key":e.key,className:a,onPointerEnter:()=>i(null),onClick:e=>{e.stopPropagation(),s()},children:o},e.key)})]},e.key))})}var ve=e(r(),1),Q=(0,C.createContext)(null),$=8;function ye(e){return!(e.target instanceof Element)||!e.target.closest(`[data-menu-escape-owner]`)?!1:(e.preventDefault(),!0)}function be({groups:e,label:n,onClose:r,position:i}){let a=(0,C.useRef)(null),o=i.trigger.closest(`[role="dialog"]`)??document.body,s=o!==document.body;return(0,C.useLayoutEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=s?o.getBoundingClientRect():{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight,height:window.innerHeight};e.style.maxHeight=`${Math.max(0,t.height-$*2)}px`;let n=e.getBoundingClientRect(),r=i.align===`end`?i.x-n.width:i.x,a=Math.max(t.left+$,Math.min(r,t.right-n.width-$)),c=Math.max(t.top+$,Math.min(i.y,t.bottom-n.height-$));e.style.left=`${a-t.left}px`,e.style.top=`${c-t.top}px`};t(),e.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[i,o,s]),(0,ve.createPortal)((0,O.jsx)(`div`,{className:t(`pointer-events-auto inset-0 z-[var(--z-tooltip)]`,s?`absolute`:`fixed`),"data-context-menu-layer":``,onContextMenu:e=>e.preventDefault(),onPointerDown:()=>r(!0),children:(0,O.jsx)(`div`,{ref:a,role:`menu`,"data-menu-escape-owner":``,"data-theme-overlay":`menu`,"aria-label":n,className:t(X,s?`absolute`:`fixed`),style:{left:i.x,top:i.y},onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r(!0))},children:(0,O.jsx)(Z,{groups:e,onClose:r})})}),o)}function xe({children:e,groups:t,label:n}){let[r,i]=(0,C.useState)(null),a=t.filter(e=>e.items.length>0),o=e=>{let t=r?.trigger;i(null),e&&t&&window.setTimeout(()=>t.isConnected&&t.focus(),0)},s=e=>{if(r?.trigger===e){o(!0);return}if(a.length===0)return;let t=e.getBoundingClientRect();i({align:`end`,x:t.right,y:t.bottom,trigger:e})},c=(0,C.cloneElement)(e,{"data-context-menu-open":r?``:void 0,onContextMenu:t=>{if(e.props.onContextMenu?.(t),t.defaultPrevented||a.length===0)return;t.preventDefault();let n=t.currentTarget,r=n.getBoundingClientRect();i({align:`start`,x:t.clientX||r.left,y:t.clientY||r.bottom,trigger:n})}});return(0,O.jsxs)(Q.Provider,{value:{isOpen:!!r,toggleFromButton:s},children:[c,r?(0,O.jsx)(be,{groups:a,label:n,position:r,onClose:o}):null]})}function Se({children:e}){let t=(0,C.useContext)(Q);if(!t)throw Error(`ContextMenuTrigger must be rendered inside ContextMenu`);return(0,C.cloneElement)(e,{"aria-expanded":t.isOpen,"aria-haspopup":`menu`,onClick:n=>{e.props.onClick?.(n),!n.defaultPrevented&&(n.stopPropagation(),t.toggleFromButton(n.currentTarget))}})}export{Z as a,J as c,D as d,E as f,X as i,K as l,S as m,Se as n,he as o,w as p,ye as r,Y as s,xe as t,q as u};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,vr as r,yr as i}from"./api-BZvNpFOS.js";import{t as a}from"./createLucideIcon-DE0sB9Nu.js";import{S as o,_ as s,a as c,b as l,c as u,d,f,g as p,i as m,l as h,m as g,n as _,o as ee,p as v,r as te,s as y,t as ne,u as b,x}from"./es2015-BiB05Sav.js";var S=a(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),C=e(i(),1);function re(e,t){return C.useReducer((e,n)=>t[e][n]??e,e)}var w=e=>{let{present:t,children:n}=e,r=ie(t),i=typeof n==`function`?n({present:r.isPresent}):C.Children.only(n),a=x(r.ref,ae(i));return typeof n==`function`||r.isPresent?C.cloneElement(i,{ref:a}):null};w.displayName=`Presence`;function ie(e){let[t,n]=C.useState(),r=C.useRef(null),i=C.useRef(e),a=C.useRef(`none`),[o,s]=re(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return C.useEffect(()=>{let e=T(r.current);a.current=o===`mounted`?e:`none`},[o]),v(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=T(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),v(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=T(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=T(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:C.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function T(e){return e?.animationName||`none`}function ae(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var E=`flex min-h-8 w-full items-center gap-2 rounded-lg px-2.5 py-1 text-left text-[13px] leading-5 font-medium outline-none transition-colors disabled:pointer-events-none disabled:opacity-45`,D={icon:`hover:before:bg-[var(--interaction-hover)] active:before:bg-[var(--interaction-hover)] disabled:hover:before:bg-transparent disabled:active:before:bg-transparent`,item:`hover:bg-[var(--interaction-hover)] focus-visible:bg-[var(--interaction-hover)] active:bg-[var(--interaction-hover)] disabled:hover:bg-transparent disabled:active:bg-transparent`,destructive:`text-destructive hover:bg-destructive/10 focus-visible:bg-destructive/10 disabled:hover:bg-transparent`},O=n(),k=`Popover`,[A,oe]=l(k,[d]),j=d(),[se,M]=A(k),N=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=j(t),l=C.useRef(null),[u,d]=C.useState(!1),[p,m]=c({prop:r,defaultProp:i??!1,onChange:a,caller:k});return(0,O.jsx)(b,{...s,children:(0,O.jsx)(se,{scope:t,contentId:f(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:C.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:C.useCallback(()=>d(!0),[]),onCustomAnchorRemove:C.useCallback(()=>d(!1),[]),modal:o,children:n})})};N.displayName=k;var P=`PopoverAnchor`,F=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=M(P,n),a=j(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return C.useEffect(()=>(o(),()=>s()),[o,s]),(0,O.jsx)(y,{...a,...r,ref:t})});F.displayName=P;var I=`PopoverTrigger`,L=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=M(I,n),a=j(n),s=x(t,i.triggerRef),c=(0,O.jsx)(p.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":G(i.open),...r,ref:s,onClick:o(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,O.jsx)(y,{asChild:!0,...a,children:c})});L.displayName=I;var R=`PopoverPortal`,[ce,le]=A(R,{forceMount:void 0}),z=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=M(R,t);return(0,O.jsx)(ce,{scope:t,forceMount:n,children:(0,O.jsx)(w,{present:n||a.open,children:(0,O.jsx)(ee,{asChild:!0,container:i,children:r})})})};z.displayName=R;var B=`PopoverContent`,V=C.forwardRef((e,t)=>{let n=le(B,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=M(B,e.__scopePopover);return(0,O.jsx)(w,{present:r||a.open,children:a.modal?(0,O.jsx)(H,{...i,ref:t}):(0,O.jsx)(de,{...i,ref:t})})});V.displayName=B;var ue=s(`PopoverContent.RemoveScroll`),H=C.forwardRef((e,t)=>{let n=M(B,e.__scopePopover),r=C.useRef(null),i=x(t,r),a=C.useRef(!1);return C.useEffect(()=>{let e=r.current;if(e)return ne(e)},[]),(0,O.jsx)(_,{as:ue,allowPinchZoom:!0,children:(0,O.jsx)(U,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:o(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:o(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:o(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),de=C.forwardRef((e,t)=>{let n=M(B,e.__scopePopover),r=C.useRef(!1),i=C.useRef(!1);return(0,O.jsx)(U,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),U=C.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=M(B,n),p=j(n);return te(),(0,O.jsx)(m,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,O.jsx)(g,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,O.jsx)(h,{"data-state":G(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),W=`PopoverClose`,fe=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=M(W,n);return(0,O.jsx)(p.button,{type:`button`,...r,ref:t,onClick:o(e.onClick,()=>i.onOpenChange(!1))})});fe.displayName=W;var pe=`PopoverArrow`,me=C.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=j(n);return(0,O.jsx)(u,{...i,...r,ref:t})});me.displayName=pe;function G(e){return e?`open`:`closed`}var K=N,he=F,q=L,J=z,Y=V,X=`w-max min-w-52 max-w-[min(18rem,calc(100vw-16px))] overflow-y-auto rounded-xl border border-border/40 bg-popover p-1 text-popover-foreground shadow-floating outline-none`;function ge({item:e}){return(0,O.jsxs)(O.Fragment,{children:[e.icon?(0,O.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:e.icon}):null,(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.children?(0,O.jsx)(S,{className:`h-4 w-4 shrink-0`}):null]})}function _e({item:e,open:n,onOpenChange:r,onClose:i,className:a,children:o}){let s=(0,C.useRef)(null),c=(0,C.useRef)(null),[l,u]=(0,C.useState)(),d=(0,C.useCallback)(e=>{s.current=e,u(e?.closest(`[data-context-menu-layer]`)??void 0)},[]),f=(0,C.useRef)(),p=(0,C.useRef)(!1),m=()=>clearTimeout(f.current),h=e=>{m(),f.current=setTimeout(()=>r(e),e?100:250)};(0,C.useEffect)(()=>()=>clearTimeout(f.current),[]);let g=()=>{m(),r(!1),s.current?.focus()},_=()=>{m(),p.current=!0,r(!0),c.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()};return(0,O.jsxs)(K,{open:n,onOpenChange:r,children:[(0,O.jsx)(q,{asChild:!0,children:(0,O.jsx)(`button`,{ref:d,type:`button`,role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":n,disabled:e.disabled,"data-menu-key":e.key,className:t(a,n&&`bg-[var(--interaction-hover)]`),onPointerEnter:e=>{e.pointerType!==`touch`&&(p.current=!1,h(!0))},onPointerLeave:()=>h(!1),onClick:e=>{e.preventDefault(),e.stopPropagation(),_()},onKeyDown:e=>{e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),_())},children:o})}),(0,O.jsx)(J,{container:l,children:(0,O.jsx)(Y,{ref:c,role:`menu`,"aria-label":e.label,"data-menu-escape-owner":``,"data-theme-overlay":`menu`,side:`right`,align:`start`,sideOffset:2,collisionPadding:8,className:t(X,`z-[var(--z-tooltip)]`),style:{minWidth:`min(13rem, var(--radix-popover-content-available-width))`,maxWidth:`min(18rem, var(--radix-popover-content-available-width))`,maxHeight:`var(--radix-popover-content-available-height)`},onPointerEnter:m,onPointerLeave:()=>h(!1),onPointerDown:e=>e.stopPropagation(),onOpenAutoFocus:e=>{p.current||e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{e.preventDefault(),g()},onKeyDown:e=>{(e.key===`ArrowLeft`||e.key===`Escape`)&&(e.preventDefault(),e.stopPropagation(),g())},children:(0,O.jsx)(Z,{groups:e.children,onClose:i})})})]})}function Z({groups:e,onClose:n}){let[r,i]=(0,C.useState)(null),a=(0,C.useRef)(null);return(0,O.jsx)(`div`,{ref:a,"data-menu-level":``,"data-menu-escape-owner":r?``:void 0,onKeyDown:e=>{if(e.target.closest(`[data-menu-level]`)===a.current){if(e.key===`Escape`&&r)e.preventDefault(),e.stopPropagation(),a.current?.querySelector(`[aria-expanded="true"]`)?.focus(),i(null);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault(),e.stopPropagation();let t=Array.from(a.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]).filter(e=>e.closest(`[data-menu-level]`)===a.current),n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowUp`?-1:1)+t.length)%t.length;i(null),t[r]?.focus()}}},children:e.filter(e=>e.items.length).map((e,a)=>(0,O.jsxs)(`div`,{role:`group`,children:[a>0?(0,O.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border/50`}):null,e.items.map(e=>{let a=t(E,e.destructive?D.destructive:`text-foreground ${D.item}`),o=(0,O.jsx)(ge,{item:e});if(e.children)return(0,O.jsx)(_e,{item:e,open:r===e.key,onOpenChange:t=>i(n=>t?e.key:n===e.key?null:n),onClose:n,className:a,children:o},e.key);let s=()=>{e.onSelect?.(),n(e.href?!1:e.restoreFocus!==!1)};return e.href?(0,O.jsx)(`a`,{role:`menuitem`,className:a,href:e.href,download:e.download,onPointerEnter:()=>i(null),onClick:e=>{e.stopPropagation(),s()},children:o},e.key):(0,O.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,"aria-pressed":e.pressed,"data-menu-key":e.key,className:a,onPointerEnter:()=>i(null),onClick:e=>{e.stopPropagation(),s()},children:o},e.key)})]},e.key))})}var ve=e(r(),1),Q=(0,C.createContext)(null),$=8;function ye(e){return!(e.target instanceof Element)||!e.target.closest(`[data-menu-escape-owner]`)?!1:(e.preventDefault(),!0)}function be({groups:e,label:n,onClose:r,position:i}){let a=(0,C.useRef)(null),o=i.trigger.closest(`[role="dialog"]`)??document.body,s=o!==document.body;return(0,C.useLayoutEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=s?o.getBoundingClientRect():{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight,height:window.innerHeight};e.style.maxHeight=`${Math.max(0,t.height-$*2)}px`;let n=e.getBoundingClientRect(),r=i.align===`end`?i.x-n.width:i.x,a=Math.max(t.left+$,Math.min(r,t.right-n.width-$)),c=Math.max(t.top+$,Math.min(i.y,t.bottom-n.height-$));e.style.left=`${a-t.left}px`,e.style.top=`${c-t.top}px`};t(),e.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[i,o,s]),(0,ve.createPortal)((0,O.jsx)(`div`,{className:t(`pointer-events-auto inset-0 z-[var(--z-tooltip)]`,s?`absolute`:`fixed`),"data-context-menu-layer":``,onContextMenu:e=>e.preventDefault(),onPointerDown:()=>r(!0),children:(0,O.jsx)(`div`,{ref:a,role:`menu`,"data-menu-escape-owner":``,"data-theme-overlay":`menu`,"aria-label":n,className:t(X,s?`absolute`:`fixed`),style:{left:i.x,top:i.y},onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r(!0))},children:(0,O.jsx)(Z,{groups:e,onClose:r})})}),o)}function xe({children:e,groups:t,label:n}){let[r,i]=(0,C.useState)(null),a=t.filter(e=>e.items.length>0),o=e=>{let t=r?.trigger;i(null),e&&t&&window.setTimeout(()=>t.isConnected&&t.focus(),0)},s=e=>{if(r?.trigger===e){o(!0);return}if(a.length===0)return;let t=e.getBoundingClientRect();i({align:`end`,x:t.right,y:t.bottom,trigger:e})},c=(0,C.cloneElement)(e,{"data-context-menu-open":r?``:void 0,onContextMenu:t=>{if(e.props.onContextMenu?.(t),t.defaultPrevented||a.length===0)return;t.preventDefault();let n=t.currentTarget,r=n.getBoundingClientRect();i({align:`start`,x:t.clientX||r.left,y:t.clientY||r.bottom,trigger:n})}});return(0,O.jsxs)(Q.Provider,{value:{isOpen:!!r,toggleFromButton:s},children:[c,r?(0,O.jsx)(be,{groups:a,label:n,position:r,onClose:o}):null]})}function Se({children:e}){let t=(0,C.useContext)(Q);if(!t)throw Error(`ContextMenuTrigger must be rendered inside ContextMenu`);return(0,C.cloneElement)(e,{"aria-expanded":t.isOpen,"aria-haspopup":`menu`,onClick:n=>{e.props.onClick?.(n),!n.defaultPrevented&&(n.stopPropagation(),t.toggleFromButton(n.currentTarget))}})}export{Z as a,J as c,D as d,E as f,X as i,K as l,S as m,Se as n,he as o,w as p,ye as r,Y as s,xe as t,q as u};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{yr as t}from"./api-DkLJrSCd.js";var n=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},a=e(t()),o=(0,a.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:s=``,children:c,iconNode:l,...u},d)=>(0,a.createElement)(`svg`,{ref:d,...i,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:r(`lucide`,s),...u},[...l.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(c)?c:[c]])),s=(e,t)=>{let i=(0,a.forwardRef)(({className:i,...s},c)=>(0,a.createElement)(o,{ref:c,iconNode:t,className:r(`lucide-${n(e)}`,i),...s}));return i.displayName=`${e}`,i};export{s as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{yr as t}from"./api-BZvNpFOS.js";var n=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},a=e(t()),o=(0,a.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:s=``,children:c,iconNode:l,...u},d)=>(0,a.createElement)(`svg`,{ref:d,...i,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:r(`lucide`,s),...u},[...l.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(c)?c:[c]])),s=(e,t)=>{let i=(0,a.forwardRef)(({className:i,...s},c)=>(0,a.createElement)(o,{ref:c,iconNode:t,className:r(`lucide-${n(e)}`,i),...s}));return i.displayName=`${e}`,i};export{s as t};
@@ -1 +1 @@
1
- import{Jt as e,Kt as t,Qt as n,Yt as r,cr as i,qt as a}from"./api-DkLJrSCd.js";import{s as o}from"./i18n-OGmF0Ws_.js";import{a as s,i as c,n as l,o as u,r as d}from"./use-desktop-capabilities-CdfOUjdE.js";var f=i();function p(){let i=d(),p=l(),h=s(),v=c(),y=u(),b=i.data,x=h.isPending||v.isPending;return(0,f.jsxs)(n,{title:o(`desktopCapabilitiesPageTitle`),description:o(`desktopCapabilitiesPageDescription`),children:[(0,f.jsx)(e,{title:o(`desktopCapabilitiesSystemTitle`),description:o(`desktopCapabilitiesSystemDescription`),children:(0,f.jsxs)(a,{children:[(0,f.jsx)(t,{title:o(`desktopCapabilitiesHostStatus`),description:i.isLoading?o(`loading`):b?.online?o(`desktopCapabilitiesHostOnline`):o(`desktopCapabilitiesHostOffline`),control:(0,f.jsx)(r,{type:`button`,variant:`outline`,size:`sm`,disabled:i.isFetching,onClick:()=>void i.refetch(),children:o(`desktopCapabilitiesRecheck`)})}),(0,f.jsx)(t,{title:o(`desktopCapabilitiesAccessibility`),description:g(b?.permissions.accessibility),control:(0,f.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,f.jsx)(r,{type:`button`,variant:`outline`,size:`sm`,disabled:x,onClick:()=>v.mutate(),children:o(`desktopCapabilitiesOpenSettings`)}),(0,f.jsx)(r,{type:`button`,size:`sm`,disabled:x,onClick:()=>h.mutate(),children:o(`desktopCapabilitiesRequestPermission`)})]})})]})}),(0,f.jsx)(e,{title:o(`desktopCapabilitiesGrantsTitle`),description:o(`desktopCapabilitiesGrantsDescription`),children:(0,f.jsx)(a,{children:p.isLoading?(0,f.jsx)(t,{title:o(`loading`)}):p.data?.length?p.data.map(e=>(0,f.jsx)(m,{grant:e,disabled:y.isPending,onRevoke:()=>y.mutate(e)},_(e))):(0,f.jsx)(t,{title:o(`desktopCapabilitiesNoGrants`),description:o(`desktopCapabilitiesNoGrantsDescription`)})})})]})}function m({disabled:e,grant:n,onRevoke:i}){let a=h(n.resource.target);return(0,f.jsx)(t,{title:n.subject.type===`agent`?`${o(`desktopCapabilitiesAgent`)} · ${n.subject.id}`:`${o(`desktopCapabilitiesExtension`)} · ${n.subject.id}`,description:`${a} · ${n.access.join(`, `)}`,control:(0,f.jsx)(r,{type:`button`,variant:`destructive`,size:`sm`,disabled:e,onClick:i,children:o(`desktopCapabilitiesRevoke`)})})}function h(e){if(!e||typeof e!=`object`||Array.isArray(e))return o(`desktopCapabilitiesUnknownApplication`);let{applicationId:t}=e;return typeof t==`string`&&t.trim()?t.trim():o(`desktopCapabilitiesUnknownApplication`)}function g(e){switch(e){case`granted`:return o(`desktopCapabilitiesPermissionGranted`);case`not_granted`:return o(`desktopCapabilitiesPermissionNotGranted`);case`not_supported`:return o(`desktopCapabilitiesPermissionNotSupported`);default:return o(`desktopCapabilitiesPermissionUnknown`)}}function _(e){return`${e.subject.type}:${e.subject.id}:${JSON.stringify(e.resource.target)}:${e.access.join(`,`)}`}export{p as DesktopCapabilitiesPage};
1
+ import{Jt as e,Kt as t,Qt as n,Yt as r,cr as i,qt as a}from"./api-BZvNpFOS.js";import{s as o}from"./i18n-OGmF0Ws_.js";import{a as s,i as c,n as l,o as u,r as d}from"./use-desktop-capabilities-ezKJwKqg.js";var f=i();function p(){let i=d(),p=l(),h=s(),v=c(),y=u(),b=i.data,x=h.isPending||v.isPending;return(0,f.jsxs)(n,{title:o(`desktopCapabilitiesPageTitle`),description:o(`desktopCapabilitiesPageDescription`),children:[(0,f.jsx)(e,{title:o(`desktopCapabilitiesSystemTitle`),description:o(`desktopCapabilitiesSystemDescription`),children:(0,f.jsxs)(a,{children:[(0,f.jsx)(t,{title:o(`desktopCapabilitiesHostStatus`),description:i.isLoading?o(`loading`):b?.online?o(`desktopCapabilitiesHostOnline`):o(`desktopCapabilitiesHostOffline`),control:(0,f.jsx)(r,{type:`button`,variant:`outline`,size:`sm`,disabled:i.isFetching,onClick:()=>void i.refetch(),children:o(`desktopCapabilitiesRecheck`)})}),(0,f.jsx)(t,{title:o(`desktopCapabilitiesAccessibility`),description:g(b?.permissions.accessibility),control:(0,f.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,f.jsx)(r,{type:`button`,variant:`outline`,size:`sm`,disabled:x,onClick:()=>v.mutate(),children:o(`desktopCapabilitiesOpenSettings`)}),(0,f.jsx)(r,{type:`button`,size:`sm`,disabled:x,onClick:()=>h.mutate(),children:o(`desktopCapabilitiesRequestPermission`)})]})})]})}),(0,f.jsx)(e,{title:o(`desktopCapabilitiesGrantsTitle`),description:o(`desktopCapabilitiesGrantsDescription`),children:(0,f.jsx)(a,{children:p.isLoading?(0,f.jsx)(t,{title:o(`loading`)}):p.data?.length?p.data.map(e=>(0,f.jsx)(m,{grant:e,disabled:y.isPending,onRevoke:()=>y.mutate(e)},_(e))):(0,f.jsx)(t,{title:o(`desktopCapabilitiesNoGrants`),description:o(`desktopCapabilitiesNoGrantsDescription`)})})})]})}function m({disabled:e,grant:n,onRevoke:i}){let a=h(n.resource.target);return(0,f.jsx)(t,{title:n.subject.type===`agent`?`${o(`desktopCapabilitiesAgent`)} · ${n.subject.id}`:`${o(`desktopCapabilitiesExtension`)} · ${n.subject.id}`,description:`${a} · ${n.access.join(`, `)}`,control:(0,f.jsx)(r,{type:`button`,variant:`destructive`,size:`sm`,disabled:e,onClick:i,children:o(`desktopCapabilitiesRevoke`)})})}function h(e){if(!e||typeof e!=`object`||Array.isArray(e))return o(`desktopCapabilitiesUnknownApplication`);let{applicationId:t}=e;return typeof t==`string`&&t.trim()?t.trim():o(`desktopCapabilitiesUnknownApplication`)}function g(e){switch(e){case`granted`:return o(`desktopCapabilitiesPermissionGranted`);case`not_granted`:return o(`desktopCapabilitiesPermissionNotGranted`);case`not_supported`:return o(`desktopCapabilitiesPermissionNotSupported`);default:return o(`desktopCapabilitiesPermissionUnknown`)}}function _(e){return`${e.subject.type}:${e.subject.id}:${JSON.stringify(e.resource.target)}:${e.access.join(`,`)}`}export{p as DesktopCapabilitiesPage};
@@ -1 +1 @@
1
- import{Jt as e,Kt as t,Qt as n,Xn as r,Yt as i,_n as a,cr as o,in as s,nn as c,on as l,qt as u,rn as d,sn as f}from"./api-DkLJrSCd.js";import{t as p}from"./navigation-link-D3pzNHeA.js";import{a as m,i as h,n as g,r as _,t as v}from"./select-6Uq4chZW.js";import{t as y}from"./download-Cr337h4W.js";import{t as b}from"./refresh-cw-syCVj_nw.js";import{t as x}from"./rotate-cw-BlH9El3x.js";import{l as S,n as C,s as w}from"./i18n-OGmF0Ws_.js";import{a as T,i as E,n as D,r as O,t as k}from"./card-Bqu8zWLq.js";var A=o(),j=`https://github.com/Peiiii/nextclaw/releases`,M={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,applying:`desktopUpdatesStatusApplying`,"restart-required":`desktopUpdatesStatusRestartRequired`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`},N={feature:`desktopUpdatesReleaseNotesFeature`,enhancement:`desktopUpdatesReleaseNotesEnhancement`,fix:`desktopUpdatesReleaseNotesFix`,compatibility:`desktopUpdatesReleaseNotesCompatibility`};function P({snapshot:e}){return(0,A.jsx)(`span`,{className:a(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,U(e.status)),children:H(e)})}function F({label:e,value:t}){return(0,A.jsxs)(`div`,{className:`rounded-lg bg-background/70 p-3`,children:[(0,A.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground`,children:e}),(0,A.jsx)(`p`,{className:`mt-1 text-sm font-semibold text-foreground`,children:t})]})}function I({snapshot:e}){if(e.status!==`downloading`)return null;let t=e.progress?.percent,n=t==null?w(`desktopUpdatesDownloadProgressUnknown`):w(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(t)),r=z(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,A.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:n}),(0,A.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:r})]}),(0,A.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,A.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${t??0}%`}})})]})}function L(e){return e?.trim()||`-`}function R(e){return e?C(e):`-`}function z(e,t){let n=B(e);return t&&t>0?`${n} / ${B(t)}`:n}function B(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function V(e){return w(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function H(e){return e.status===`failed`&&e.failureStage?w(`desktopUpdatesFailureStage.${e.failureStage}`):w(M[e.status]??`desktopUpdatesStatusIdle`)}function U(e){return e===`downloaded`||e===`restart-required`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function W(e){return e.status===`blocked`&&e.installationKind===`desktop-bundle`&&e.blockReason===`unsupported-installation`}function G(){return S()===`zh`?`zh-CN`:`en-US`}function K(e,t){return d(e.title,t)??w(N[e.kind]??`desktopUpdatesReleaseNotesEnhancement`)}function q({snapshot:e}){let t=s(e),n=G(),i=r({queryKey:[`runtime-release-notes`,t],queryFn:async()=>await c(t??``),enabled:!!t,retry:!1,staleTime:300*1e3}),a=i.data,o=d(a?.title,n)??w(`desktopUpdatesReleaseNotesPreviewTitle`),l=d(a?.summary,n)??w(`desktopUpdatesReleaseNotesPreviewDescription`);return e.releaseNotesUrl?(0,A.jsxs)(k,{children:[(0,A.jsx)(E,{children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(T,{children:o}),(0,A.jsx)(O,{children:l})]}),(0,A.jsx)(p,{href:e.releaseNotesUrl,external:!0,children:w(`desktopUpdatesReleaseNotes`)})]})}),(0,A.jsxs)(D,{className:`space-y-4`,children:[i.isLoading?(0,A.jsx)(`p`,{className:`text-sm text-gray-500`,children:w(`desktopUpdatesReleaseNotesPreviewLoading`)}):null,!t||i.isError?(0,A.jsx)(`p`,{className:`text-sm text-gray-500`,children:w(`desktopUpdatesReleaseNotesPreviewUnavailable`)}):null,a?(0,A.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:a.sections.map(e=>(0,A.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:K(e,n)}),(0,A.jsx)(`ul`,{className:`mt-3 space-y-3`,children:e.items.map((t,r)=>{let i=d(t.title,n),a=d(t.body,n);return(0,A.jsxs)(`li`,{className:`space-y-1`,children:[i?(0,A.jsx)(`p`,{className:`text-sm font-medium text-gray-800`,children:i}):null,a?(0,A.jsx)(`p`,{className:`text-sm leading-5 text-gray-600`,children:a}):null]},`${i??e.kind}-${r}`)})})]},e.kind))}):null]})]}):null}function J(){return(0,A.jsx)(n,{title:w(`runtimeUpdatesPageTitle`),description:w(`runtimeUpdatesPageDescription`),children:(0,A.jsx)(e,{title:w(`runtimeUpdatesUnavailableTitle`),description:w(`runtimeUpdatesUnavailableDescription`),children:(0,A.jsx)(u,{children:(0,A.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:w(`runtimeUpdatesUnavailableHint`)})})})})}function Y(){let{supported:r,initialized:o,busyAction:s,snapshot:c}=f();if(!o)return(0,A.jsx)(n,{title:w(`runtimeUpdatesPageTitle`),description:w(`runtimeUpdatesPageDescription`),children:(0,A.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:w(`loading`)})});if(!r||!c)return(0,A.jsx)(J,{});let d=s===`checking`,S=s===`downloading`,C=s===`applying`,T=s===`updating`,E=s===`switching-channel`,D=(c.status===`update-available`||c.status===`downloaded`)&&!S&&!C&&!T,O=[[w(`runtimeUpdatesHostVersion`),L(c.hostVersion)],[w(`desktopUpdatesCurrentBundleVersion`),L(c.currentVersion)],[w(`desktopUpdatesAvailableVersion`),L(c.availableVersion)],[w(`desktopUpdatesLastCheckedAt`),R(c.lastCheckedAt)],[w(`desktopUpdatesCurrentChannel`),V(c.channel)]];return(0,A.jsxs)(n,{title:w(`runtimeUpdatesPageTitle`),description:w(`runtimeUpdatesPageDescription`),actions:(0,A.jsxs)(i,{variant:`outline`,onClick:()=>void l.checkForUpdates(),disabled:d||S||C||T,children:[(0,A.jsx)(b,{className:a(`mr-2 h-4 w-4`,d&&`animate-spin`)}),w(`desktopUpdatesCheckNow`)]}),children:[(0,A.jsx)(e,{title:w(`desktopUpdatesOverviewTitle`),description:w(`desktopUpdatesOverviewDescription`),children:(0,A.jsx)(u,{children:(0,A.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:w(`desktopUpdatesStatusLabel`)}),(0,A.jsx)(P,{snapshot:c})]}),(0,A.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:O.map(([e,t])=>(0,A.jsx)(F,{label:e,value:t},e))}),c.channel===`beta`?(0,A.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:w(`desktopUpdatesBetaBadgeTitle`)}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:w(`desktopUpdatesBetaBadgeDescription`)})]}):null,c.downloadedVersion?(0,A.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:w(`desktopUpdatesDownloadedBannerTitle`)}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:w(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,c.downloadedVersion)})]}):null,(0,A.jsx)(I,{snapshot:c}),c.status===`blocked`?(0,A.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:w(`desktopUpdatesBlockedTitle`)}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:c.errorMessage??w(`desktopUpdatesBlockedDescription`)}),c.recoveryCommand?(0,A.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:c.recoveryCommand}):null,W(c)?(0,A.jsx)(p,{href:j,external:!0,icon:y,className:`mt-3 rounded-full border border-red-300 bg-white/70 px-3 py-2 text-red-800 no-underline hover:bg-white hover:text-red-900 hover:no-underline`,children:w(`desktopUpdatesManualPortableDownload`)}):null]}):null,c.errorMessage&&c.status!==`blocked`?(0,A.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:c.errorMessage}):null]})})}),(0,A.jsx)(q,{snapshot:c}),(0,A.jsx)(e,{title:w(`desktopUpdatesChannelSettingsTitle`),description:w(`desktopUpdatesChannelSettingsDescription`),children:(0,A.jsx)(u,{children:(0,A.jsx)(t,{title:w(`desktopUpdatesReleaseChannel`),description:w(`desktopUpdatesReleaseChannelHelp`),layout:`stacked`,children:(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsxs)(v,{value:c.channel,disabled:E||d||S||C||T,onValueChange:e=>void l.updateChannel(e),children:[(0,A.jsx)(h,{className:`w-full max-w-sm`,children:(0,A.jsx)(m,{placeholder:w(`desktopUpdatesReleaseChannel`)})}),(0,A.jsxs)(g,{children:[(0,A.jsx)(_,{value:`stable`,children:w(`desktopUpdatesChannelStable`)}),(0,A.jsx)(_,{value:`beta`,children:w(`desktopUpdatesChannelBeta`)})]})]}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:w(`desktopUpdatesReleaseChannelDowngradeHint`)})]})})})}),(0,A.jsx)(e,{title:w(`desktopUpdatesActionsTitle`),description:w(`runtimeUpdatesActionsDescription`),children:(0,A.jsx)(u,{children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,A.jsxs)(i,{variant:`outline`,onClick:()=>void l.checkForUpdates(),disabled:d||S||C||T,children:[(0,A.jsx)(b,{className:a(`mr-2 h-4 w-4`,d&&`animate-spin`)}),w(`desktopUpdatesCheckNow`)]}),(0,A.jsxs)(i,{onClick:()=>void l.updateNow(),disabled:!D,children:[(0,A.jsx)(x,{className:a(`mr-2 h-4 w-4`,T&&`animate-spin`)}),w(`runtimeUpdatesApplyNow`)]})]})})})]})}export{Y as DesktopUpdateConfig};
1
+ import{Jt as e,Kt as t,Qt as n,Xn as r,Yt as i,_n as a,cr as o,in as s,nn as c,on as l,qt as u,rn as d,sn as f}from"./api-BZvNpFOS.js";import{t as p}from"./navigation-link-DC-Pku0Y.js";import{a as m,i as h,n as g,r as _,t as v}from"./select-Y9IEbx9x.js";import{t as y}from"./download-CKqS1Ksj.js";import{t as b}from"./refresh-cw-BG8VfcdA.js";import{t as x}from"./rotate-cw-DPEegUU2.js";import{l as S,n as C,s as w}from"./i18n-OGmF0Ws_.js";import{a as T,i as E,n as D,r as O,t as k}from"./card-CdRBL1E0.js";var A=o(),j=`https://github.com/Peiiii/nextclaw/releases`,M={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,applying:`desktopUpdatesStatusApplying`,"restart-required":`desktopUpdatesStatusRestartRequired`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`},N={feature:`desktopUpdatesReleaseNotesFeature`,enhancement:`desktopUpdatesReleaseNotesEnhancement`,fix:`desktopUpdatesReleaseNotesFix`,compatibility:`desktopUpdatesReleaseNotesCompatibility`};function P({snapshot:e}){return(0,A.jsx)(`span`,{className:a(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,U(e.status)),children:H(e)})}function F({label:e,value:t}){return(0,A.jsxs)(`div`,{className:`rounded-lg bg-background/70 p-3`,children:[(0,A.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground`,children:e}),(0,A.jsx)(`p`,{className:`mt-1 text-sm font-semibold text-foreground`,children:t})]})}function I({snapshot:e}){if(e.status!==`downloading`)return null;let t=e.progress?.percent,n=t==null?w(`desktopUpdatesDownloadProgressUnknown`):w(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(t)),r=z(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,A.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:n}),(0,A.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:r})]}),(0,A.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,A.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${t??0}%`}})})]})}function L(e){return e?.trim()||`-`}function R(e){return e?C(e):`-`}function z(e,t){let n=B(e);return t&&t>0?`${n} / ${B(t)}`:n}function B(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function V(e){return w(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function H(e){return e.status===`failed`&&e.failureStage?w(`desktopUpdatesFailureStage.${e.failureStage}`):w(M[e.status]??`desktopUpdatesStatusIdle`)}function U(e){return e===`downloaded`||e===`restart-required`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function W(e){return e.status===`blocked`&&e.installationKind===`desktop-bundle`&&e.blockReason===`unsupported-installation`}function G(){return S()===`zh`?`zh-CN`:`en-US`}function K(e,t){return d(e.title,t)??w(N[e.kind]??`desktopUpdatesReleaseNotesEnhancement`)}function q({snapshot:e}){let t=s(e),n=G(),i=r({queryKey:[`runtime-release-notes`,t],queryFn:async()=>await c(t??``),enabled:!!t,retry:!1,staleTime:300*1e3}),a=i.data,o=d(a?.title,n)??w(`desktopUpdatesReleaseNotesPreviewTitle`),l=d(a?.summary,n)??w(`desktopUpdatesReleaseNotesPreviewDescription`);return e.releaseNotesUrl?(0,A.jsxs)(k,{children:[(0,A.jsx)(E,{children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(T,{children:o}),(0,A.jsx)(O,{children:l})]}),(0,A.jsx)(p,{href:e.releaseNotesUrl,external:!0,children:w(`desktopUpdatesReleaseNotes`)})]})}),(0,A.jsxs)(D,{className:`space-y-4`,children:[i.isLoading?(0,A.jsx)(`p`,{className:`text-sm text-gray-500`,children:w(`desktopUpdatesReleaseNotesPreviewLoading`)}):null,!t||i.isError?(0,A.jsx)(`p`,{className:`text-sm text-gray-500`,children:w(`desktopUpdatesReleaseNotesPreviewUnavailable`)}):null,a?(0,A.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:a.sections.map(e=>(0,A.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:K(e,n)}),(0,A.jsx)(`ul`,{className:`mt-3 space-y-3`,children:e.items.map((t,r)=>{let i=d(t.title,n),a=d(t.body,n);return(0,A.jsxs)(`li`,{className:`space-y-1`,children:[i?(0,A.jsx)(`p`,{className:`text-sm font-medium text-gray-800`,children:i}):null,a?(0,A.jsx)(`p`,{className:`text-sm leading-5 text-gray-600`,children:a}):null]},`${i??e.kind}-${r}`)})})]},e.kind))}):null]})]}):null}function J(){return(0,A.jsx)(n,{title:w(`runtimeUpdatesPageTitle`),description:w(`runtimeUpdatesPageDescription`),children:(0,A.jsx)(e,{title:w(`runtimeUpdatesUnavailableTitle`),description:w(`runtimeUpdatesUnavailableDescription`),children:(0,A.jsx)(u,{children:(0,A.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:w(`runtimeUpdatesUnavailableHint`)})})})})}function Y(){let{supported:r,initialized:o,busyAction:s,snapshot:c}=f();if(!o)return(0,A.jsx)(n,{title:w(`runtimeUpdatesPageTitle`),description:w(`runtimeUpdatesPageDescription`),children:(0,A.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:w(`loading`)})});if(!r||!c)return(0,A.jsx)(J,{});let d=s===`checking`,S=s===`downloading`,C=s===`applying`,T=s===`updating`,E=s===`switching-channel`,D=(c.status===`update-available`||c.status===`downloaded`)&&!S&&!C&&!T,O=[[w(`runtimeUpdatesHostVersion`),L(c.hostVersion)],[w(`desktopUpdatesCurrentBundleVersion`),L(c.currentVersion)],[w(`desktopUpdatesAvailableVersion`),L(c.availableVersion)],[w(`desktopUpdatesLastCheckedAt`),R(c.lastCheckedAt)],[w(`desktopUpdatesCurrentChannel`),V(c.channel)]];return(0,A.jsxs)(n,{title:w(`runtimeUpdatesPageTitle`),description:w(`runtimeUpdatesPageDescription`),actions:(0,A.jsxs)(i,{variant:`outline`,onClick:()=>void l.checkForUpdates(),disabled:d||S||C||T,children:[(0,A.jsx)(b,{className:a(`mr-2 h-4 w-4`,d&&`animate-spin`)}),w(`desktopUpdatesCheckNow`)]}),children:[(0,A.jsx)(e,{title:w(`desktopUpdatesOverviewTitle`),description:w(`desktopUpdatesOverviewDescription`),children:(0,A.jsx)(u,{children:(0,A.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:w(`desktopUpdatesStatusLabel`)}),(0,A.jsx)(P,{snapshot:c})]}),(0,A.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:O.map(([e,t])=>(0,A.jsx)(F,{label:e,value:t},e))}),c.channel===`beta`?(0,A.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:w(`desktopUpdatesBetaBadgeTitle`)}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:w(`desktopUpdatesBetaBadgeDescription`)})]}):null,c.downloadedVersion?(0,A.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:w(`desktopUpdatesDownloadedBannerTitle`)}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:w(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,c.downloadedVersion)})]}):null,(0,A.jsx)(I,{snapshot:c}),c.status===`blocked`?(0,A.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:w(`desktopUpdatesBlockedTitle`)}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:c.errorMessage??w(`desktopUpdatesBlockedDescription`)}),c.recoveryCommand?(0,A.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:c.recoveryCommand}):null,W(c)?(0,A.jsx)(p,{href:j,external:!0,icon:y,className:`mt-3 rounded-full border border-red-300 bg-white/70 px-3 py-2 text-red-800 no-underline hover:bg-white hover:text-red-900 hover:no-underline`,children:w(`desktopUpdatesManualPortableDownload`)}):null]}):null,c.errorMessage&&c.status!==`blocked`?(0,A.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:c.errorMessage}):null]})})}),(0,A.jsx)(q,{snapshot:c}),(0,A.jsx)(e,{title:w(`desktopUpdatesChannelSettingsTitle`),description:w(`desktopUpdatesChannelSettingsDescription`),children:(0,A.jsx)(u,{children:(0,A.jsx)(t,{title:w(`desktopUpdatesReleaseChannel`),description:w(`desktopUpdatesReleaseChannelHelp`),layout:`stacked`,children:(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsxs)(v,{value:c.channel,disabled:E||d||S||C||T,onValueChange:e=>void l.updateChannel(e),children:[(0,A.jsx)(h,{className:`w-full max-w-sm`,children:(0,A.jsx)(m,{placeholder:w(`desktopUpdatesReleaseChannel`)})}),(0,A.jsxs)(g,{children:[(0,A.jsx)(_,{value:`stable`,children:w(`desktopUpdatesChannelStable`)}),(0,A.jsx)(_,{value:`beta`,children:w(`desktopUpdatesChannelBeta`)})]})]}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:w(`desktopUpdatesReleaseChannelDowngradeHint`)})]})})})}),(0,A.jsx)(e,{title:w(`desktopUpdatesActionsTitle`),description:w(`runtimeUpdatesActionsDescription`),children:(0,A.jsx)(u,{children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,A.jsxs)(i,{variant:`outline`,onClick:()=>void l.checkForUpdates(),disabled:d||S||C||T,children:[(0,A.jsx)(b,{className:a(`mr-2 h-4 w-4`,d&&`animate-spin`)}),w(`desktopUpdatesCheckNow`)]}),(0,A.jsxs)(i,{onClick:()=>void l.updateNow(),disabled:!D,children:[(0,A.jsx)(x,{className:a(`mr-2 h-4 w-4`,T&&`animate-spin`)}),w(`runtimeUpdatesApplyNow`)]})]})})})]})}export{Y as DesktopUpdateConfig};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-DkLJrSCd.js";import{p as i,r as a}from"./context-menu-CRqH2SEk.js";import{t as o}from"./x-CQIp_nJT.js";import{S as s,_ as c,a as l,b as u,f as d,g as f,i as p,m as ee,n as m,o as te,r as ne,t as re,x as h,y as ie}from"./es2015-D-CRf3_Z.js";var g=e(r(),1),_=n(),v=`Dialog`,[y,ae]=u(v),[oe,b]=y(v),x=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=g.useRef(null),c=g.useRef(null),[u,f]=l({prop:r,defaultProp:i??!1,onChange:a,caller:v});return(0,_.jsx)(oe,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};x.displayName=v;var S=`DialogTrigger`,C=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(S,n),a=h(t,i.triggerRef);return(0,_.jsx)(f.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":R(i.open),...r,ref:a,onClick:s(e.onClick,i.onOpenToggle)})});C.displayName=S;var w=`DialogPortal`,[se,T]=y(w,{forceMount:void 0}),E=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=b(w,t);return(0,_.jsx)(se,{scope:t,forceMount:n,children:g.Children.map(r,e=>(0,_.jsx)(i,{present:n||o.open,children:(0,_.jsx)(te,{asChild:!0,container:a,children:e})}))})};E.displayName=w;var D=`DialogOverlay`,O=g.forwardRef((e,t)=>{let n=T(D,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=b(D,e.__scopeDialog);return o.modal?(0,_.jsx)(i,{present:r||o.open,children:(0,_.jsx)(le,{...a,ref:t})}):null});O.displayName=D;var ce=c(`DialogOverlay.RemoveScroll`),le=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(D,n);return(0,_.jsx)(m,{as:ce,allowPinchZoom:!0,shards:[i.contentRef],children:(0,_.jsx)(f.div,{"data-state":R(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),k=`DialogContent`,A=g.forwardRef((e,t)=>{let n=T(k,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=b(k,e.__scopeDialog);return(0,_.jsx)(i,{present:r||o.open,children:o.modal?(0,_.jsx)(ue,{...a,ref:t}):(0,_.jsx)(de,{...a,ref:t})})});A.displayName=k;var ue=g.forwardRef((e,t)=>{let n=b(k,e.__scopeDialog),r=g.useRef(null),i=h(t,n.contentRef,r);return g.useEffect(()=>{let e=r.current;if(e)return re(e)},[]),(0,_.jsx)(j,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault())})}),de=g.forwardRef((e,t)=>{let n=b(k,e.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return(0,_.jsx)(j,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),j=g.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=b(k,n),c=g.useRef(null),l=h(t,c);return ne(),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(p,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,_.jsx)(ee,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":R(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(pe,{titleId:s.titleId}),(0,_.jsx)(he,{contentRef:c,descriptionId:s.descriptionId})]})]})}),M=`DialogTitle`,N=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(M,n);return(0,_.jsx)(f.h2,{id:i.titleId,...r,ref:t})});N.displayName=M;var P=`DialogDescription`,F=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(P,n);return(0,_.jsx)(f.p,{id:i.descriptionId,...r,ref:t})});F.displayName=P;var I=`DialogClose`,L=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(I,n);return(0,_.jsx)(f.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});L.displayName=I;function R(e){return e?`open`:`closed`}var z=`DialogTitleWarning`,[fe,B]=ie(z,{contentName:k,titleName:M,docsSlug:`dialog`}),pe=({titleId:e})=>{let t=B(z),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{_n as t,cr as n,yr as r}from"./api-BZvNpFOS.js";import{p as i,r as a}from"./context-menu-DHVVdHzN.js";import{t as o}from"./x-DSz9cGhy.js";import{S as s,_ as c,a as l,b as u,f as d,g as f,i as p,m as ee,n as m,o as te,r as ne,t as re,x as h,y as ie}from"./es2015-BiB05Sav.js";var g=e(r(),1),_=n(),v=`Dialog`,[y,ae]=u(v),[oe,b]=y(v),x=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=g.useRef(null),c=g.useRef(null),[u,f]=l({prop:r,defaultProp:i??!1,onChange:a,caller:v});return(0,_.jsx)(oe,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),open:u,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};x.displayName=v;var S=`DialogTrigger`,C=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(S,n),a=h(t,i.triggerRef);return(0,_.jsx)(f.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":R(i.open),...r,ref:a,onClick:s(e.onClick,i.onOpenToggle)})});C.displayName=S;var w=`DialogPortal`,[se,T]=y(w,{forceMount:void 0}),E=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=b(w,t);return(0,_.jsx)(se,{scope:t,forceMount:n,children:g.Children.map(r,e=>(0,_.jsx)(i,{present:n||o.open,children:(0,_.jsx)(te,{asChild:!0,container:a,children:e})}))})};E.displayName=w;var D=`DialogOverlay`,O=g.forwardRef((e,t)=>{let n=T(D,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=b(D,e.__scopeDialog);return o.modal?(0,_.jsx)(i,{present:r||o.open,children:(0,_.jsx)(le,{...a,ref:t})}):null});O.displayName=D;var ce=c(`DialogOverlay.RemoveScroll`),le=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(D,n);return(0,_.jsx)(m,{as:ce,allowPinchZoom:!0,shards:[i.contentRef],children:(0,_.jsx)(f.div,{"data-state":R(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),k=`DialogContent`,A=g.forwardRef((e,t)=>{let n=T(k,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=b(k,e.__scopeDialog);return(0,_.jsx)(i,{present:r||o.open,children:o.modal?(0,_.jsx)(ue,{...a,ref:t}):(0,_.jsx)(de,{...a,ref:t})})});A.displayName=k;var ue=g.forwardRef((e,t)=>{let n=b(k,e.__scopeDialog),r=g.useRef(null),i=h(t,n.contentRef,r);return g.useEffect(()=>{let e=r.current;if(e)return re(e)},[]),(0,_.jsx)(j,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:s(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:s(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:s(e.onFocusOutside,e=>e.preventDefault())})}),de=g.forwardRef((e,t)=>{let n=b(k,e.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return(0,_.jsx)(j,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),j=g.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=b(k,n),c=g.useRef(null),l=h(t,c);return ne(),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(p,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,_.jsx)(ee,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":R(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(pe,{titleId:s.titleId}),(0,_.jsx)(he,{contentRef:c,descriptionId:s.descriptionId})]})]})}),M=`DialogTitle`,N=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(M,n);return(0,_.jsx)(f.h2,{id:i.titleId,...r,ref:t})});N.displayName=M;var P=`DialogDescription`,F=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(P,n);return(0,_.jsx)(f.p,{id:i.descriptionId,...r,ref:t})});F.displayName=P;var I=`DialogClose`,L=g.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(I,n);return(0,_.jsx)(f.button,{type:`button`,...r,ref:t,onClick:s(e.onClick,()=>i.onOpenChange(!1))})});L.displayName=I;function R(e){return e?`open`:`closed`}var z=`DialogTitleWarning`,[fe,B]=ie(z,{contentName:k,titleName:M,docsSlug:`dialog`}),pe=({titleId:e})=>{let t=B(z),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
2
 
3
3
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{Mn as t,_n as n,cr as r,pn as i,yr as a}from"./api-DkLJrSCd.js";import{l as o,s}from"./i18n-OGmF0Ws_.js";import{n as c,t as l}from"./middleware-B--6mAUM.js";import{o as u,t as d}from"./navigation-history-CzErJuPG.js";var f=`global-resources`,p=`floating-conversation`,m={placement:`docked`,minimized:!1,maximized:!1,rect:{x:80,y:80,w:560,h:640},layer:0};function h(e){if(!e||typeof e!=`object`||!(`surfaces`in e)||!e.surfaces||typeof e.surfaces!=`object`)return{};let t={};for(let[n,r]of Object.entries(e.surfaces).slice(-64)){if(!r||typeof r!=`object`)continue;let{placement:e,rect:i}=r;e!==`docked`&&e!==`floating`||!i||![`x`,`y`,`w`,`h`].every(e=>typeof i[e]==`number`&&Number.isFinite(i[e]))||(t[n]={...m,placement:e,rect:i})}return t}function ee(){try{if(JSON.parse(window.localStorage.getItem(`nextclaw.doc-browser.state`)??`null`)?.state?.snapshot?.mode===`floating`)return{[f]:{...m,placement:`floating`}}}catch{}return{}}var g=i()(c(()=>({surfaces:ee(),visibleSurfaceIds:[]}),{name:`nextclaw.workbench.layout`,version:1,storage:l(()=>new d),partialize:({surfaces:e})=>({surfaces:Object.fromEntries(Object.entries(e).slice(-64).map(([e,t])=>[e,{...t,minimized:!1,maximized:!1,layer:0}]))}),merge:(e,t)=>({...t,surfaces:{...t.surfaces,...h(e)}})})),_=r();function te({className:e,...t}){return(0,_.jsx)(`div`,{className:n(`animate-pulse rounded-md bg-slate-200`,e),...t})}var v=`docs.nextclaw.io`,y=`docs.nextclaw.net`,b=`nextclaw-docs.pages.dev`,x=new Set([v,`www.${v}`,y,`www.${y}`,b,`www.${b}`]),S=`https://${v}`,C=`https://${y}`,w=`home`,T=`nextclaw://new-tab`,E=`/guide/getting-started`;function D(e){return e===`zh`?`zh`:`en`}function O(e,t){let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`||n===``?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function k(e){let t=e?.trim();if(t)try{return new URL(t).origin}catch{return}}function A(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function j(e){return/^[a-z][a-z\d+.-]*:/i.test(e.trim())}function M(){return o()===`zh`||A()===`Asia/Shanghai`}function N(){return k(void 0)||(M()?k(void 0)??C:S)}function P(e){let t=D(o()),n=N();try{let r=new URL(e,n),i=new URL(n);return!j(e)||x.has(r.hostname)||r.origin===i.origin?(r.protocol=i.protocol,r.host=i.host,r.pathname=O(r.pathname,t),r.toString()):r.toString()}catch{return new URL(`/${t}${E}`,n).toString()}}function ne(){return P(E)}function re(e){return P(e)}function ie(e){try{return new URL(e).pathname.replace(/\.html$/,``).replace(/\/$/,``)}catch{return e}}function F(e,t,n=`Docs`){try{let r=new URL(e,S);if(r.protocol===`data:`)return t===`docs`?n:`Detail`;let i=r.pathname.split(`/`).filter(Boolean),a=i[i.length-1]??n;return decodeURIComponent(a).replace(/[-_]/g,` `).slice(0,40)||n}catch{return n}}function I(e){try{let t=typeof window<`u`?window.location.origin:S,n=new URL(e,t);return x.has(n.hostname)}catch{return!1}}function L(e,t){return t===`docs`?P(e):e}var R=0;function z(e){return typeof e==`number`&&Number.isFinite(e)?Math.min(860,Math.max(320,e)):420}function B(){return R+=1,`doc-tab-${Date.now()}-${R}`}function V(e,t,n,r,i,a,o,c){let l=n?.trim()||F(e,t,t===`docs`?s(`docBrowserHelp`):`Detail`),u=i?.trim();return{id:B(),kind:t,title:l,currentUrl:e,resourceUri:u||void 0,contentParams:o,viewState:c,dockIcon:a,dedupeKey:r,history:[e],historyIndex:0,navVersion:0}}function H(e,t){let n=u({entries:e.history,index:e.historyIndex},t);return{history:[...n.entries],historyIndex:n.index}}function U(e,n,r,i,a){let o={...n,title:i?.title||r.title||n.title,kind:r.kind,resourceUri:r.resourceUri??r.url,dockIcon:i?.dockIcon??r.dockIcon,dedupeKey:a,contentParams:r.contentParams,viewState:i?.viewState??r.viewState??n.viewState},s=e.areUrlsEquivalent(n.currentUrl,r.url,n.kind,r.kind);return s&&t(n.contentParams)===t(r.contentParams)?o:s?{...o,navVersion:n.navVersion+1}:{...o,currentUrl:r.url,...H(n,r.url),navVersion:n.navVersion+1}}function W(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function G(){let e=V(T,w,s(`docBrowserHomeTitle`));return{isOpen:!1,dockedWidth:420,tabs:[e],activeTabId:e.id,activeHistory:[W(e)],activeHistoryIndex:0}}var K=`nextclaw.doc-browser.state`,q=1,J=8;function Y(e){return!!e&&typeof e==`object`}function ae(e,t){if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`&&e.trim().length>0);return n.length>0?n:[t]}function X(e,t,n,r){return typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function oe(e){if(!(!Y(e)||typeof e.type!=`string`)){if(e.type===`builtin`&&typeof e.name==`string`&&e.name.trim().length>0)return{type:`builtin`,name:e.name.trim()};if(e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0)return{type:`url`,url:e.url.trim()};if(e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0)return{type:`text`,value:e.value.trim()}}}function se(e){if(!Y(e)||typeof e.id!=`string`||typeof e.kind!=`string`||typeof e.title!=`string`||typeof e.currentUrl!=`string`||e.currentUrl.trim().length===0)return null;let t=ae(e.history,e.currentUrl),n=X(e.historyIndex,0,t.length-1,t.length-1),r=X(e.navVersion,0,2**53-1,0),i=typeof e.dedupeKey==`string`&&e.dedupeKey.trim().length>0?e.dedupeKey:void 0,a=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0,o=oe(e.dockIcon);return{id:e.id,kind:e.kind,title:e.title,currentUrl:t[n]??e.currentUrl,resourceUri:a,dockIcon:o,viewState:e.viewState,dedupeKey:i,history:t,historyIndex:n,navVersion:r}}function ce(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function le(e,t){if(!Y(e)||typeof e.tabId!=`string`||typeof e.kind!=`string`||typeof e.url!=`string`||e.url.trim().length===0||!t.has(e.tabId))return null;let n=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0;return{kind:e.kind,resourceUri:n,tabId:e.tabId,url:e.url}}function ue(e){if(!Y(e))return null;let t=Array.isArray(e.tabs)?e.tabs.map(se).filter(e=>e!==null).slice(-J):[];if(t.length===0)return null;let n=typeof e.activeTabId==`string`?e.activeTabId:null,r=t.some(e=>e.id===n)?n??t[0].id:t[0].id,i=new Map(t.map(e=>[e.id,e])),a=Array.isArray(e.activeHistory)?e.activeHistory.map(e=>le(e,i)).filter(e=>e!==null):[],o=[ce(i.get(r)??t[0])],s=a.length>0?a:o,c=X(e.activeHistoryIndex,0,s.length-1,s.length-1),l=s[c],u=i.has(l.tabId)?l.tabId:r;return{isOpen:e.isOpen===!0,dockedWidth:z(e.dockedWidth),tabs:t,activeTabId:u,activeHistory:s,activeHistoryIndex:c}}function de(e,t){return typeof t==`function`?t(e):t}var Z=i()(c(e=>({snapshot:G(),setSnapshot:t=>e(e=>({snapshot:de(e.snapshot,t)}))}),{name:K,version:q,storage:l(()=>new d),partialize:e=>({snapshot:{isOpen:e.snapshot.isOpen,dockedWidth:e.snapshot.dockedWidth,tabs:e.snapshot.tabs.slice(-J),activeTabId:e.snapshot.activeTabId,activeHistory:e.snapshot.activeHistory,activeHistoryIndex:e.snapshot.activeHistoryIndex}}),merge:(e,t)=>{let n=ue(Y(e)?e.snapshot:null);return n?{...t,snapshot:n}:t}})),Q=e(a(),1),$=(0,Q.createContext)(null);function fe(){let e=(0,Q.useContext)($);if(!e)throw Error(`useDocBrowser must be used within DocBrowserProvider`);return e}function pe({children:e,manager:t}){let n=g(e=>e.surfaces[`global-resources`]?.placement??`docked`),r=Z(e=>e.snapshot),i=(0,Q.useMemo)(()=>r.tabs.find(e=>e.id===r.activeTabId)??r.tabs[0],[r.activeTabId,r.tabs]),a=(0,Q.useMemo)(()=>({...r,mode:n,currentTab:i,open:t.open,openTarget:t.openTarget,openNewTab:t.openNewTab,close:t.close,toggleMode:t.toggleMode,setDockedWidth:t.setDockedWidth,navigate:t.navigate,syncUrl:t.syncUrl,goBack:t.goBack,goForward:t.goForward,closeTab:t.closeTab,setActiveTab:t.setActiveTab}),[i,t,r,n]);return(0,_.jsx)($.Provider,{value:a,children:e})}export{p as C,f as S,ie as _,G as a,g as b,z as c,w as d,T as f,I as g,F as h,H as i,U as l,re as m,fe as n,W as o,ne as p,Z as r,V as s,pe as t,S as u,L as v,m as x,te as y};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{Mn as t,_n as n,cr as r,pn as i,yr as a}from"./api-BZvNpFOS.js";import{l as o,s}from"./i18n-OGmF0Ws_.js";import{n as c,t as l}from"./middleware-B--6mAUM.js";import{o as u,t as d}from"./navigation-history-CzErJuPG.js";var f=`global-resources`,p=`floating-conversation`,m={placement:`docked`,minimized:!1,maximized:!1,rect:{x:80,y:80,w:560,h:640},layer:0};function h(e){if(!e||typeof e!=`object`||!(`surfaces`in e)||!e.surfaces||typeof e.surfaces!=`object`)return{};let t={};for(let[n,r]of Object.entries(e.surfaces).slice(-64)){if(!r||typeof r!=`object`)continue;let{placement:e,rect:i}=r;e!==`docked`&&e!==`floating`||!i||![`x`,`y`,`w`,`h`].every(e=>typeof i[e]==`number`&&Number.isFinite(i[e]))||(t[n]={...m,placement:e,rect:i})}return t}function ee(){try{if(JSON.parse(window.localStorage.getItem(`nextclaw.doc-browser.state`)??`null`)?.state?.snapshot?.mode===`floating`)return{[f]:{...m,placement:`floating`}}}catch{}return{}}var g=i()(c(()=>({surfaces:ee(),visibleSurfaceIds:[]}),{name:`nextclaw.workbench.layout`,version:1,storage:l(()=>new d),partialize:({surfaces:e})=>({surfaces:Object.fromEntries(Object.entries(e).slice(-64).map(([e,t])=>[e,{...t,minimized:!1,maximized:!1,layer:0}]))}),merge:(e,t)=>({...t,surfaces:{...t.surfaces,...h(e)}})})),_=r();function te({className:e,...t}){return(0,_.jsx)(`div`,{className:n(`animate-pulse rounded-md bg-slate-200`,e),...t})}var v=`docs.nextclaw.io`,y=`docs.nextclaw.net`,b=`nextclaw-docs.pages.dev`,x=new Set([v,`www.${v}`,y,`www.${y}`,b,`www.${b}`]),S=`https://${v}`,C=`https://${y}`,w=`home`,T=`nextclaw://new-tab`,E=`/guide/getting-started`;function D(e){return e===`zh`?`zh`:`en`}function O(e,t){let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`||n===``?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function k(e){let t=e?.trim();if(t)try{return new URL(t).origin}catch{return}}function A(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function j(e){return/^[a-z][a-z\d+.-]*:/i.test(e.trim())}function M(){return o()===`zh`||A()===`Asia/Shanghai`}function N(){return k(void 0)||(M()?k(void 0)??C:S)}function P(e){let t=D(o()),n=N();try{let r=new URL(e,n),i=new URL(n);return!j(e)||x.has(r.hostname)||r.origin===i.origin?(r.protocol=i.protocol,r.host=i.host,r.pathname=O(r.pathname,t),r.toString()):r.toString()}catch{return new URL(`/${t}${E}`,n).toString()}}function ne(){return P(E)}function re(e){return P(e)}function ie(e){try{return new URL(e).pathname.replace(/\.html$/,``).replace(/\/$/,``)}catch{return e}}function F(e,t,n=`Docs`){try{let r=new URL(e,S);if(r.protocol===`data:`)return t===`docs`?n:`Detail`;let i=r.pathname.split(`/`).filter(Boolean),a=i[i.length-1]??n;return decodeURIComponent(a).replace(/[-_]/g,` `).slice(0,40)||n}catch{return n}}function I(e){try{let t=typeof window<`u`?window.location.origin:S,n=new URL(e,t);return x.has(n.hostname)}catch{return!1}}function L(e,t){return t===`docs`?P(e):e}var R=0;function z(e){return typeof e==`number`&&Number.isFinite(e)?Math.min(860,Math.max(320,e)):420}function B(){return R+=1,`doc-tab-${Date.now()}-${R}`}function V(e,t,n,r,i,a,o,c){let l=n?.trim()||F(e,t,t===`docs`?s(`docBrowserHelp`):`Detail`),u=i?.trim();return{id:B(),kind:t,title:l,currentUrl:e,resourceUri:u||void 0,contentParams:o,viewState:c,dockIcon:a,dedupeKey:r,history:[e],historyIndex:0,navVersion:0}}function H(e,t){let n=u({entries:e.history,index:e.historyIndex},t);return{history:[...n.entries],historyIndex:n.index}}function U(e,n,r,i,a){let o={...n,title:i?.title||r.title||n.title,kind:r.kind,resourceUri:r.resourceUri??r.url,dockIcon:i?.dockIcon??r.dockIcon,dedupeKey:a,contentParams:r.contentParams,viewState:i?.viewState??r.viewState??n.viewState},s=e.areUrlsEquivalent(n.currentUrl,r.url,n.kind,r.kind);return s&&t(n.contentParams)===t(r.contentParams)?o:s?{...o,navVersion:n.navVersion+1}:{...o,currentUrl:r.url,...H(n,r.url),navVersion:n.navVersion+1}}function W(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function G(){let e=V(T,w,s(`docBrowserHomeTitle`));return{isOpen:!1,dockedWidth:420,tabs:[e],activeTabId:e.id,activeHistory:[W(e)],activeHistoryIndex:0}}var K=`nextclaw.doc-browser.state`,q=1,J=8;function Y(e){return!!e&&typeof e==`object`}function ae(e,t){if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`&&e.trim().length>0);return n.length>0?n:[t]}function X(e,t,n,r){return typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function oe(e){if(!(!Y(e)||typeof e.type!=`string`)){if(e.type===`builtin`&&typeof e.name==`string`&&e.name.trim().length>0)return{type:`builtin`,name:e.name.trim()};if(e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0)return{type:`url`,url:e.url.trim()};if(e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0)return{type:`text`,value:e.value.trim()}}}function se(e){if(!Y(e)||typeof e.id!=`string`||typeof e.kind!=`string`||typeof e.title!=`string`||typeof e.currentUrl!=`string`||e.currentUrl.trim().length===0)return null;let t=ae(e.history,e.currentUrl),n=X(e.historyIndex,0,t.length-1,t.length-1),r=X(e.navVersion,0,2**53-1,0),i=typeof e.dedupeKey==`string`&&e.dedupeKey.trim().length>0?e.dedupeKey:void 0,a=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0,o=oe(e.dockIcon);return{id:e.id,kind:e.kind,title:e.title,currentUrl:t[n]??e.currentUrl,resourceUri:a,dockIcon:o,viewState:e.viewState,dedupeKey:i,history:t,historyIndex:n,navVersion:r}}function ce(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function le(e,t){if(!Y(e)||typeof e.tabId!=`string`||typeof e.kind!=`string`||typeof e.url!=`string`||e.url.trim().length===0||!t.has(e.tabId))return null;let n=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0;return{kind:e.kind,resourceUri:n,tabId:e.tabId,url:e.url}}function ue(e){if(!Y(e))return null;let t=Array.isArray(e.tabs)?e.tabs.map(se).filter(e=>e!==null).slice(-J):[];if(t.length===0)return null;let n=typeof e.activeTabId==`string`?e.activeTabId:null,r=t.some(e=>e.id===n)?n??t[0].id:t[0].id,i=new Map(t.map(e=>[e.id,e])),a=Array.isArray(e.activeHistory)?e.activeHistory.map(e=>le(e,i)).filter(e=>e!==null):[],o=[ce(i.get(r)??t[0])],s=a.length>0?a:o,c=X(e.activeHistoryIndex,0,s.length-1,s.length-1),l=s[c],u=i.has(l.tabId)?l.tabId:r;return{isOpen:e.isOpen===!0,dockedWidth:z(e.dockedWidth),tabs:t,activeTabId:u,activeHistory:s,activeHistoryIndex:c}}function de(e,t){return typeof t==`function`?t(e):t}var Z=i()(c(e=>({snapshot:G(),setSnapshot:t=>e(e=>({snapshot:de(e.snapshot,t)}))}),{name:K,version:q,storage:l(()=>new d),partialize:e=>({snapshot:{isOpen:e.snapshot.isOpen,dockedWidth:e.snapshot.dockedWidth,tabs:e.snapshot.tabs.slice(-J),activeTabId:e.snapshot.activeTabId,activeHistory:e.snapshot.activeHistory,activeHistoryIndex:e.snapshot.activeHistoryIndex}}),merge:(e,t)=>{let n=ue(Y(e)?e.snapshot:null);return n?{...t,snapshot:n}:t}})),Q=e(a(),1),$=(0,Q.createContext)(null);function fe(){let e=(0,Q.useContext)($);if(!e)throw Error(`useDocBrowser must be used within DocBrowserProvider`);return e}function pe({children:e,manager:t}){let n=g(e=>e.surfaces[`global-resources`]?.placement??`docked`),r=Z(e=>e.snapshot),i=(0,Q.useMemo)(()=>r.tabs.find(e=>e.id===r.activeTabId)??r.tabs[0],[r.activeTabId,r.tabs]),a=(0,Q.useMemo)(()=>({...r,mode:n,currentTab:i,open:t.open,openTarget:t.openTarget,openNewTab:t.openNewTab,close:t.close,toggleMode:t.toggleMode,setDockedWidth:t.setDockedWidth,navigate:t.navigate,syncUrl:t.syncUrl,goBack:t.goBack,goForward:t.goForward,closeTab:t.closeTab,setActiveTab:t.setActiveTab}),[i,t,r,n]);return(0,_.jsx)($.Provider,{value:a,children:e})}export{p as C,f as S,ie as _,G as a,g as b,z as c,w as d,T as f,I as g,F as h,H as i,U as l,re as m,fe as n,W as o,ne as p,Z as r,V as s,pe as t,S as u,L as v,m as x,te as y};
@@ -0,0 +1 @@
1
+ import{it as e}from"./app-presenter-provider-BcYL-VNe.js";export{e as DocBrowser};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-B4xj2I2g.js";var t=e(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]);export{t};
1
+ import{t as e}from"./createLucideIcon-DE0sB9Nu.js";var t=e(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]);export{t};