libre-webui 0.23.0 → 0.24.0

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 (192) hide show
  1. package/backend/dist/index.d.ts.map +1 -1
  2. package/backend/dist/index.js +2 -0
  3. package/backend/dist/index.js.map +1 -1
  4. package/backend/dist/routes/auth.d.ts.map +1 -1
  5. package/backend/dist/routes/auth.js +20 -3
  6. package/backend/dist/routes/auth.js.map +1 -1
  7. package/backend/dist/routes/chat.d.ts.map +1 -1
  8. package/backend/dist/routes/chat.js +93 -1
  9. package/backend/dist/routes/chat.js.map +1 -1
  10. package/backend/dist/routes/ollama.d.ts.map +1 -1
  11. package/backend/dist/routes/ollama.js +48 -1
  12. package/backend/dist/routes/ollama.js.map +1 -1
  13. package/backend/dist/services/apiTokenService.d.ts.map +1 -1
  14. package/backend/dist/services/apiTokenService.js +1 -0
  15. package/backend/dist/services/apiTokenService.js.map +1 -1
  16. package/backend/dist/services/chatGenerationService.d.ts +11 -1
  17. package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
  18. package/backend/dist/services/chatGenerationService.js +22 -2
  19. package/backend/dist/services/chatGenerationService.js.map +1 -1
  20. package/backend/dist/services/chatService.d.ts +6 -0
  21. package/backend/dist/services/chatService.d.ts.map +1 -1
  22. package/backend/dist/services/chatService.js +51 -1
  23. package/backend/dist/services/chatService.js.map +1 -1
  24. package/backend/dist/services/contextCompactionService.d.ts +31 -0
  25. package/backend/dist/services/contextCompactionService.d.ts.map +1 -0
  26. package/backend/dist/services/contextCompactionService.js +185 -0
  27. package/backend/dist/services/contextCompactionService.js.map +1 -0
  28. package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -1
  29. package/backend/dist/services/durableChatGenerationService.js +114 -10
  30. package/backend/dist/services/durableChatGenerationService.js.map +1 -1
  31. package/backend/dist/services/followUpService.d.ts.map +1 -1
  32. package/backend/dist/services/followUpService.js +8 -2
  33. package/backend/dist/services/followUpService.js.map +1 -1
  34. package/backend/dist/services/modelVisibilityService.d.ts +45 -0
  35. package/backend/dist/services/modelVisibilityService.d.ts.map +1 -0
  36. package/backend/dist/services/modelVisibilityService.js +215 -0
  37. package/backend/dist/services/modelVisibilityService.js.map +1 -0
  38. package/backend/dist/services/ollamaService.d.ts +16 -1
  39. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  40. package/backend/dist/services/ollamaService.js +47 -13
  41. package/backend/dist/services/ollamaService.js.map +1 -1
  42. package/backend/dist/services/pluginService.d.ts +4 -0
  43. package/backend/dist/services/pluginService.d.ts.map +1 -1
  44. package/backend/dist/services/pluginService.js +76 -13
  45. package/backend/dist/services/pluginService.js.map +1 -1
  46. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  47. package/backend/dist/services/titleGenerationService.js +20 -2
  48. package/backend/dist/services/titleGenerationService.js.map +1 -1
  49. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  50. package/backend/dist/services/workAgentService.js +22 -0
  51. package/backend/dist/services/workAgentService.js.map +1 -1
  52. package/backend/dist/services/workRuntimeService.d.ts +11 -0
  53. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  54. package/backend/dist/services/workRuntimeService.js +59 -22
  55. package/backend/dist/services/workRuntimeService.js.map +1 -1
  56. package/backend/dist/types/index.d.ts +16 -2
  57. package/backend/dist/types/index.d.ts.map +1 -1
  58. package/backend/dist/types/index.js.map +1 -1
  59. package/backend/dist/utils/ollamaModelDefaults.d.ts +10 -0
  60. package/backend/dist/utils/ollamaModelDefaults.d.ts.map +1 -1
  61. package/backend/dist/utils/ollamaModelDefaults.js +19 -1
  62. package/backend/dist/utils/ollamaModelDefaults.js.map +1 -1
  63. package/backend/dist/utils/openAIResponsesAdapter.d.ts +2 -0
  64. package/backend/dist/utils/openAIResponsesAdapter.d.ts.map +1 -1
  65. package/backend/dist/utils/openAIResponsesAdapter.js +3 -0
  66. package/backend/dist/utils/openAIResponsesAdapter.js.map +1 -1
  67. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  68. package/backend/dist/utils/pluginChatAdapter.js +29 -2
  69. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  70. package/backend/dist/utils/pluginModelCatalog.d.ts +30 -0
  71. package/backend/dist/utils/pluginModelCatalog.d.ts.map +1 -0
  72. package/backend/dist/utils/pluginModelCatalog.js +129 -0
  73. package/backend/dist/utils/pluginModelCatalog.js.map +1 -0
  74. package/backend/dist/utils/pluginStreamAdapter.d.ts +12 -1
  75. package/backend/dist/utils/pluginStreamAdapter.d.ts.map +1 -1
  76. package/backend/dist/utils/pluginStreamAdapter.js +32 -2
  77. package/backend/dist/utils/pluginStreamAdapter.js.map +1 -1
  78. package/backend/dist/utils/pluginStreaming.d.ts +10 -0
  79. package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
  80. package/backend/dist/utils/pluginStreaming.js.map +1 -1
  81. package/backend/dist/utils/thinkingOptions.d.ts +48 -0
  82. package/backend/dist/utils/thinkingOptions.d.ts.map +1 -0
  83. package/backend/dist/utils/thinkingOptions.js +104 -0
  84. package/backend/dist/utils/thinkingOptions.js.map +1 -0
  85. package/backend/package.json +3 -3
  86. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  87. package/frontend/dist/artifact-runtime/framer-motion.js +3 -3
  88. package/frontend/dist/artifact-runtime/papaparse.js +5 -5
  89. package/frontend/dist/assets/index-BlTbxYPP.js +33 -0
  90. package/frontend/dist/assets/index-CbiWSGOj.css +1 -0
  91. package/frontend/dist/assets/{markdown-math-ClTedVi7.css → markdown-math-Ddr6Z9Sf.css} +1 -1
  92. package/frontend/dist/index.html +14 -14
  93. package/frontend/dist/js/{ArtifactContainer-CigyGLnW.js → ArtifactContainer-C-n1vPsA.js} +1 -1
  94. package/frontend/dist/js/{ArtifactDemoPage-CITpRQXa.js → ArtifactDemoPage-TONeQvof.js} +1 -1
  95. package/frontend/dist/js/{ArtifactSandboxFrame-C8_7sKm1.js → ArtifactSandboxFrame-CV2XXu_t.js} +2 -2
  96. package/frontend/dist/js/{ArtifactSlideOutPanel-D1f9zUZN.js → ArtifactSlideOutPanel-2exw7YqL.js} +1 -1
  97. package/frontend/dist/js/{Button-BV44cTnj.js → Button-BPf_pOxH.js} +1 -1
  98. package/frontend/dist/js/ChatPage-wnyG_TyC.js +23 -0
  99. package/frontend/dist/js/{FirstTimeSetup-DwvqU8Jk.js → FirstTimeSetup-smhj0X6o.js} +1 -1
  100. package/frontend/dist/js/{GalleryPage-CFU6YW9r.js → GalleryPage-BZfeWlBg.js} +1 -1
  101. package/frontend/dist/js/{HomePage-CEoZABYG.js → HomePage-gf4GgI6z.js} +1 -1
  102. package/frontend/dist/js/{LibreClawPage-VV4sD4-v.js → LibreClawPage-CRKei1MM.js} +1 -1
  103. package/frontend/dist/js/{ModelManagerModals-CZAWUxjI.js → ModelManagerModals-D0amaOnl.js} +1 -1
  104. package/frontend/dist/js/ModelSelector-C5Tn6y0p.js +1 -0
  105. package/frontend/dist/js/{ModelsPage-Ce41crA_.js → ModelsPage-Rbags4Xq.js} +2 -2
  106. package/frontend/dist/js/{NotesPage-BV08Gh2X.js → NotesPage-9NR9HZZ8.js} +1 -1
  107. package/frontend/dist/js/{OptimizedSyntaxHighlighter-XwqZEoTf.js → OptimizedSyntaxHighlighter-Dz7D1LPB.js} +1 -1
  108. package/frontend/dist/js/{PersonasPage-CSpK5FvR.js → PersonasPage-DYP67Qiy.js} +1 -1
  109. package/frontend/dist/js/{PluginUsagePage-B9YPhusn.js → PluginUsagePage-QtCgymRu.js} +1 -1
  110. package/frontend/dist/js/RichMessageContent-Bxi_u0gC.js +3 -0
  111. package/frontend/dist/js/SettingsModal-B4RelkLP.js +1 -0
  112. package/frontend/dist/js/{SettingsToggle-WTa0rgvY.js → SettingsToggle-woG_WebF.js} +1 -1
  113. package/frontend/dist/js/{SystemPage-7KbZlMb_.js → SystemPage-xFSTYdBS.js} +1 -1
  114. package/frontend/dist/js/UserManagementPage-Cp430WCP.js +1 -0
  115. package/frontend/dist/js/{WorkPage-B3cuSSwH.js → WorkPage-DFES41Qm.js} +4 -4
  116. package/frontend/dist/js/{api-DSzsasYT.js → api-DUUxxx_B.js} +2 -2
  117. package/frontend/dist/js/{appStore-CYhqdjge.js → appStore-CJtomipz.js} +2 -2
  118. package/frontend/dist/js/ar-DMH3qbt6.js +2 -0
  119. package/frontend/dist/js/authStore-BckFDL70.js +4 -0
  120. package/frontend/dist/js/bn-CGDX8khx.js +2 -0
  121. package/frontend/dist/js/chatStore-DK-_wd-j.js +3 -0
  122. package/frontend/dist/js/{config-EEx_rELa.js → config-CNVNpf_q.js} +1 -1
  123. package/frontend/dist/js/cs-CJLgUk3m.js +2 -0
  124. package/frontend/dist/js/da-DnZMnCVM.js +2 -0
  125. package/frontend/dist/js/de-CWpguVQ5.js +2 -0
  126. package/frontend/dist/js/es-DVU1vjm0.js +2 -0
  127. package/frontend/dist/js/{estree-Dc6SMAYy.js → estree-D1TYSBcf.js} +1 -1
  128. package/frontend/dist/js/fr-pWnSnypD.js +2 -0
  129. package/frontend/dist/js/hi-B6xDfxA5.js +2 -0
  130. package/frontend/dist/js/{html-Bax5_Bzw.js → html-Dmddj0zf.js} +1 -1
  131. package/frontend/dist/js/id-BThSTUAG.js +2 -0
  132. package/frontend/dist/js/is-BOohDFie.js +2 -0
  133. package/frontend/dist/js/it-BdRArcCC.js +2 -0
  134. package/frontend/dist/js/ja-5Cq35sMr.js +2 -0
  135. package/frontend/dist/js/ko-BlzNRtpQ.js +2 -0
  136. package/frontend/dist/js/{markdown-DxaneQad.js → markdown-Bl_LsHEk.js} +1 -1
  137. package/frontend/dist/js/{messageCodeStyles-CxXrl4jD.js → messageCodeStyles-CgKxn4tN.js} +1 -1
  138. package/frontend/dist/js/ms-CtGeurkZ.js +2 -0
  139. package/frontend/dist/js/nl-MKPHGjVF.js +2 -0
  140. package/frontend/dist/js/pl-BwBrqCey.js +2 -0
  141. package/frontend/dist/js/pt-CKzoHWBB.js +2 -0
  142. package/frontend/dist/js/ru-BQC4jh0Y.js +2 -0
  143. package/frontend/dist/js/{standalone-CCpjftAD.js → standalone-BWau8hEE.js} +1 -1
  144. package/frontend/dist/js/sv-Cm0qXxzM.js +2 -0
  145. package/frontend/dist/js/th-DUPbiRI2.js +2 -0
  146. package/frontend/dist/js/thinking-DwlkTfPX.js +1 -0
  147. package/frontend/dist/js/tr-AsFu_Br5.js +2 -0
  148. package/frontend/dist/js/{typescript-DtQEF6kq.js → typescript-DxGn3Yn-.js} +1 -1
  149. package/frontend/dist/js/ui-jlx9WA5A.js +2 -0
  150. package/frontend/dist/js/uk-DrMMOZ17.js +2 -0
  151. package/frontend/dist/js/{useTranslation-C3ei3mJq.js → useTranslation-Bho4HCyg.js} +1 -1
  152. package/frontend/dist/js/{utils-CuC1beTY.js → utils-D9W1Lnkn.js} +1 -1
  153. package/frontend/dist/js/{utils-vendor-BBa8OxtB.js → utils-vendor-DWh39_3x.js} +1 -1
  154. package/frontend/dist/js/vi-BgRaIrQC.js +2 -0
  155. package/frontend/dist/js/{workApi-vRuNfpEf.js → workApi-DWRpZ_cq.js} +2 -2
  156. package/frontend/dist/js/zh-B4rcgcAy.js +2 -0
  157. package/package.json +3 -3
  158. package/frontend/dist/assets/index-CudKJ5Bs.js +0 -27
  159. package/frontend/dist/assets/index-DBaj1DRj.css +0 -1
  160. package/frontend/dist/js/ChatPage-D-Q1SGlI.js +0 -23
  161. package/frontend/dist/js/ModelSelector-DVN9nTCB.js +0 -1
  162. package/frontend/dist/js/RichMessageContent-C3qddYMx.js +0 -3
  163. package/frontend/dist/js/SettingsModal-CQSumlFr.js +0 -1
  164. package/frontend/dist/js/UserManagementPage-DnyW0Wmx.js +0 -1
  165. package/frontend/dist/js/ar-D0z0P4rC.js +0 -2
  166. package/frontend/dist/js/authStore-CnSn5zM7.js +0 -4
  167. package/frontend/dist/js/bn-BYYU41A7.js +0 -2
  168. package/frontend/dist/js/chatStore-P1aGCgiF.js +0 -3
  169. package/frontend/dist/js/cs-BFx6KNZe.js +0 -2
  170. package/frontend/dist/js/da-DSDuY5Du.js +0 -2
  171. package/frontend/dist/js/de-YqhP0FmX.js +0 -2
  172. package/frontend/dist/js/es-Dpr_y1cN.js +0 -2
  173. package/frontend/dist/js/fr-nVg_iAEC.js +0 -2
  174. package/frontend/dist/js/hi-gHKYCgkP.js +0 -2
  175. package/frontend/dist/js/id-C_yID1Zk.js +0 -2
  176. package/frontend/dist/js/is-MoRPLbOM.js +0 -2
  177. package/frontend/dist/js/it-BZTscLxR.js +0 -2
  178. package/frontend/dist/js/ja-DpIbtmZq.js +0 -2
  179. package/frontend/dist/js/ko-LkWggmjU.js +0 -2
  180. package/frontend/dist/js/ms-p3XiQSAo.js +0 -2
  181. package/frontend/dist/js/nl-sEHHO2Kb.js +0 -2
  182. package/frontend/dist/js/pl-D2GD6PDW.js +0 -2
  183. package/frontend/dist/js/pt-DPkn3GUn.js +0 -2
  184. package/frontend/dist/js/ru-C42iHrEd.js +0 -2
  185. package/frontend/dist/js/sv-CGvHo4os.js +0 -2
  186. package/frontend/dist/js/th-BaDNpCdY.js +0 -2
  187. package/frontend/dist/js/tr-BHQvi1cN.js +0 -2
  188. package/frontend/dist/js/ui-CUMAcARd.js +0 -2
  189. package/frontend/dist/js/uk-7pNGS1b2.js +0 -2
  190. package/frontend/dist/js/vi-DgAfh6mo.js +0 -2
  191. package/frontend/dist/js/zh-FRTz6ZqA.js +0 -2
  192. /package/frontend/dist/js/{markdown-math-mH7AZ_mb.js → markdown-math-DK846gXU.js} +0 -0
@@ -60,28 +60,28 @@
60
60
  name="twitter:image:alt"
61
61
  content="Libre WebUI icon over a retro-futuristic cityscape"
62
62
  />
63
- <script type="module" crossorigin src="/assets/index-CudKJ5Bs.js"></script>
63
+ <script type="module" crossorigin src="/assets/index-BlTbxYPP.js"></script>
64
64
  <link rel="modulepreload" crossorigin href="/js/rolldown-runtime-hePW80VL.js">
65
65
  <link rel="modulepreload" crossorigin href="/js/markdown-core-BmPPZiuD.js">
66
66
  <link rel="modulepreload" crossorigin href="/js/react-vendor-C5yShNlM.js">
67
67
  <link rel="modulepreload" crossorigin href="/js/router-vendor-CbPDks39.js">
68
- <link rel="modulepreload" crossorigin href="/js/utils-vendor-BBa8OxtB.js">
69
- <link rel="modulepreload" crossorigin href="/js/utils-CuC1beTY.js">
70
- <link rel="modulepreload" crossorigin href="/js/useTranslation-C3ei3mJq.js">
68
+ <link rel="modulepreload" crossorigin href="/js/utils-vendor-DWh39_3x.js">
69
+ <link rel="modulepreload" crossorigin href="/js/utils-D9W1Lnkn.js">
70
+ <link rel="modulepreload" crossorigin href="/js/useTranslation-Bho4HCyg.js">
71
71
  <link rel="modulepreload" crossorigin href="/js/i18next-DgmgtwsV.js">
72
72
  <link rel="modulepreload" crossorigin href="/js/ui-vendor-54SgntkX.js">
73
73
  <link rel="modulepreload" crossorigin href="/js/logger-DSXjF4ye.js">
74
- <link rel="modulepreload" crossorigin href="/js/config-EEx_rELa.js">
75
- <link rel="modulepreload" crossorigin href="/js/workApi-vRuNfpEf.js">
76
- <link rel="modulepreload" crossorigin href="/js/api-DSzsasYT.js">
77
- <link rel="modulepreload" crossorigin href="/js/chatStore-P1aGCgiF.js">
78
- <link rel="modulepreload" crossorigin href="/js/appStore-CYhqdjge.js">
79
- <link rel="modulepreload" crossorigin href="/js/authStore-CnSn5zM7.js">
74
+ <link rel="modulepreload" crossorigin href="/js/config-CNVNpf_q.js">
75
+ <link rel="modulepreload" crossorigin href="/js/workApi-DWRpZ_cq.js">
76
+ <link rel="modulepreload" crossorigin href="/js/api-DUUxxx_B.js">
77
+ <link rel="modulepreload" crossorigin href="/js/chatStore-DK-_wd-j.js">
78
+ <link rel="modulepreload" crossorigin href="/js/appStore-CJtomipz.js">
79
+ <link rel="modulepreload" crossorigin href="/js/authStore-BckFDL70.js">
80
80
  <link rel="modulepreload" crossorigin href="/js/welcomePrompts-to5mv_gx.js">
81
- <link rel="modulepreload" crossorigin href="/js/messageCodeStyles-CxXrl4jD.js">
82
- <link rel="modulepreload" crossorigin href="/js/Button-BV44cTnj.js">
83
- <link rel="modulepreload" crossorigin href="/js/ui-CUMAcARd.js">
84
- <link rel="stylesheet" crossorigin href="/assets/index-DBaj1DRj.css">
81
+ <link rel="modulepreload" crossorigin href="/js/messageCodeStyles-CgKxn4tN.js">
82
+ <link rel="modulepreload" crossorigin href="/js/Button-BPf_pOxH.js">
83
+ <link rel="modulepreload" crossorigin href="/js/ui-jlx9WA5A.js">
84
+ <link rel="stylesheet" crossorigin href="/assets/index-CbiWSGOj.css">
85
85
  </head>
86
86
  <body>
87
87
  <div id="root"></div>
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{t as r}from"./useTranslation-C3ei3mJq.js";import{t as i}from"./utils-CuC1beTY.js";import{$t as a,Et as o,Gt as s,Qt as c,Ut as l,Xt as u,ct as d,dn as f,p,qt as m,zt as h}from"./ui-vendor-54SgntkX.js";import{t as g}from"./logger-DSXjF4ye.js";import{t as _}from"./appStore-CYhqdjge.js";import{t as v}from"./Button-BV44cTnj.js";import{t as y}from"./OptimizedSyntaxHighlighter-XwqZEoTf.js";import{a as b,i as x,l as S,n as C,o as w,r as T,t as E}from"./ArtifactSandboxFrame-C8_7sKm1.js";var D=e(t(),1),O=n(),k=g(`components:artifact-renderer`),A=({artifact:e,className:t})=>{let{t:n}=r(),[g,A]=(0,D.useState)(!1),[j,M]=(0,D.useState)(`preview`),{theme:N,openArtifactPanel:P}=_(),F=async e=>{try{await navigator.clipboard.writeText(e),A(!0),setTimeout(()=>A(!1),2e3)}catch(e){k.error(`Failed to copy:`,e)}},I=()=>{let t=e.type===`html`?b(e.content,e.title):e.content,n=new Blob([t],{type:L(e.type)}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.title}.${R(e.type)}`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},L=e=>{switch(e){case`html`:return`text/html`;case`react`:return`text/javascript`;case`svg`:return`image/svg+xml`;case`css`:return`text/css`;case`json`:return`application/json`;default:return`text/plain`}},R=e=>{switch(e){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`svg`;case`css`:return`css`;case`json`:return`json`;default:return`txt`}},z=()=>{switch(e.type){case`html`:return(0,O.jsx)(o,{className:`h-4 w-4`});case`react`:return(0,O.jsx)(c,{className:`h-4 w-4`});case`svg`:return(0,O.jsx)(h,{className:`h-4 w-4`});case`code`:return(0,O.jsx)(c,{className:`h-4 w-4`});default:return(0,O.jsx)(h,{className:`h-4 w-4`})}},B=()=>(0,O.jsx)(`div`,{"data-testid":`artifact-html-fallback`,className:`w-full h-64 sm:h-80 lg:h-96 flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200 p-4`,children:(0,O.jsxs)(`div`,{className:`max-w-sm text-center`,children:[(0,O.jsx)(p,{className:`h-8 w-8 text-primary-500 mx-auto mb-3`}),(0,O.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:n(`artifacts.previewUnavailable`)}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-gray-600 dark:text-gray-400`,children:n(`artifacts.previewUnavailableDescription`)}),(0,O.jsxs)(v,{variant:`outline`,size:`sm`,onClick:()=>M(`code`),className:`mt-4`,children:[(0,O.jsx)(a,{className:`h-3.5 w-3.5 mr-1.5`}),n(`artifacts.code`)]})]})}),V=async()=>{try{let t=await T(C(e.type)??`html`,e.content,e.title,{colorScheme:N.mode===`dark`?`dark`:`light`});S(t,x,e.title)}catch(e){k.error(`Failed to open the artifact preview:`,e)}},H=t=>e.content.trim()?(0,O.jsx)(E,{content:e.content,title:e.title,kind:t,colorScheme:N.mode===`dark`?`dark`:`light`,className:`w-full h-64 sm:h-80 lg:h-96 border-0 rounded-lg`,fallback:B()}):B(),U=()=>(0,O.jsx)(`iframe`,{"data-testid":`artifact-svg-preview`,srcDoc:w(e.content,e.title),className:`w-full h-64 sm:h-80 lg:h-96 border-0 rounded-lg bg-white`,sandbox:``,title:e.title}),W=()=>(0,O.jsx)(`div`,{className:`relative max-h-64 sm:max-h-80 lg:max-h-96 overflow-auto`,children:(0,O.jsx)(y,{language:(()=>{if(e.language)return e.language;switch(e.type){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`xml`;case`json`:return`json`;default:return`text`}})(),isDark:N.mode===`dark`,className:`!m-0 !rounded-lg`,children:e.content})}),G=()=>{try{let t=JSON.parse(e.content),n=JSON.stringify(t,null,2);return(0,O.jsx)(`div`,{className:`relative max-h-64 sm:max-h-80 lg:max-h-96 overflow-auto`,children:(0,O.jsx)(y,{language:`json`,isDark:N.mode===`dark`,className:`!m-0 !rounded-lg`,children:n})})}catch{return(0,O.jsx)(`div`,{className:`w-full h-32 flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200`,children:(0,O.jsxs)(`div`,{className:`text-center`,children:[(0,O.jsx)(p,{className:`h-8 w-8 text-primary-500 mx-auto mb-2`}),(0,O.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-600`,children:n(`artifacts.invalidJson`)})]})})}},K=()=>{if(j===`code`)return W();switch(e.type){case`html`:return H(`html`);case`react`:return H(`react`);case`mermaid`:return H(`mermaid`);case`svg`:return U();case`json`:return G();default:return W()}},q=()=>e.type===`html`||e.type===`svg`||e.type===`react`||e.type===`mermaid`;return(0,O.jsxs)(`div`,{className:i(`border border-gray-200 dark:border-dark-200 rounded-xl bg-white dark:bg-dark-25 shadow-lg transition-all duration-300 hover:shadow-xl`,`w-full max-w-full overflow-hidden animate-fade-in`,`max-h-[400px] flex flex-col`,t),children:[(0,O.jsxs)(`div`,{className:`px-1.5 py-1.5 sm:p-4 border-b border-gray-100 dark:border-dark-200 flex-shrink-0`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0 flex items-center justify-center`,children:z()}),(0,O.jsx)(`h3`,{className:`font-medium text-gray-900 dark:text-gray-100 truncate text-sm leading-tight flex-1`,children:e.title})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[q()&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(v,{variant:j===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`preview`),className:`h-5 px-0.5 text-xs`,title:n(`artifacts.previewMode`),children:(0,O.jsx)(l,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(v,{variant:j===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`code`),className:`h-5 px-0.5 text-xs`,title:n(`artifacts.codeMode`),children:(0,O.jsx)(a,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(`div`,{className:`w-px h-2 bg-gray-300 dark:bg-gray-600 mx-0.5`})]}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>F(e.content),className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation`,title:n(`artifacts.copyContent`),children:g?(0,O.jsx)(f,{className:`h-2.5 w-2.5 text-green-500`}):(0,O.jsx)(u,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:I,className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation`,title:n(`artifacts.download`),children:(0,O.jsx)(m,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>P(e),className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation border border-gray-200 dark:border-dark-300 hover:border-gray-300 dark:hover:border-dark-400`,title:n(`artifacts.openInPanel`),children:(0,O.jsx)(d,{className:`h-2.5 w-2.5`})})]})]}),(0,O.jsxs)(`div`,{className:`hidden sm:flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 flex-1`,children:[(0,O.jsx)(`div`,{className:`flex-shrink-0`,children:z()}),(0,O.jsx)(`h3`,{className:`font-semibold text-gray-900 dark:text-gray-100 truncate`,children:e.title})]}),(0,O.jsx)(`span`,{className:`text-xs bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 px-2 py-1 rounded-full font-medium flex-shrink-0`,children:e.type.toUpperCase()})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[q()&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(v,{variant:j===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`preview`),className:`h-8 px-3 text-xs`,title:n(`artifacts.previewMode`),children:[(0,O.jsx)(l,{className:`h-3 w-3 mr-1`}),n(`artifacts.preview`)]}),(0,O.jsxs)(v,{variant:j===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`code`),className:`h-8 px-3 text-xs`,title:n(`artifacts.codeMode`),children:[(0,O.jsx)(a,{className:`h-3 w-3 mr-1`}),n(`artifacts.code`)]}),(0,O.jsx)(`div`,{className:`w-px h-4 bg-gray-300 dark:bg-gray-600 mx-1`})]}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>F(e.content),className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.copyContent`),children:g?(0,O.jsx)(f,{className:`h-4 w-4 text-green-500`}):(0,O.jsx)(u,{className:`h-4 w-4`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:I,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.download`),children:(0,O.jsx)(m,{className:`h-4 w-4`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>P(e),className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.openInPanel`),children:(0,O.jsx)(d,{className:`h-4 w-4`})})]})]})]}),(0,O.jsxs)(`div`,{className:`p-4 flex-1 overflow-hidden min-h-0`,children:[e.description&&(0,O.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mb-4`,children:e.description}),(0,O.jsx)(`div`,{className:`h-full overflow-auto`,children:K()})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-t border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-100/50 flex-shrink-0`,children:[(0,O.jsxs)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[n(`artifacts.created`),`:`,` `,new Date(e.createdAt).toLocaleString()]}),C(e.type)&&(0,O.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>V(),className:`text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,children:[(0,O.jsx)(s,{className:`h-3 w-3 mr-1`}),n(`artifacts.openInNewWindow`)]})]})]})},j=({artifacts:e,className:t})=>!e||e.length===0?null:(0,O.jsx)(`div`,{className:i(`space-y-3`,t),children:e.map(e=>(0,O.jsx)(A,{artifact:e},e.id))});export{j as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{t as r}from"./useTranslation-Bho4HCyg.js";import{t as i}from"./utils-D9W1Lnkn.js";import{$t as a,Et as o,Gt as s,Qt as c,Ut as l,Xt as u,ct as d,dn as f,p,qt as m,zt as h}from"./ui-vendor-54SgntkX.js";import{t as g}from"./logger-DSXjF4ye.js";import{t as _}from"./appStore-CJtomipz.js";import{t as v}from"./Button-BPf_pOxH.js";import{t as y}from"./OptimizedSyntaxHighlighter-Dz7D1LPB.js";import{a as b,i as x,l as S,n as C,o as w,r as T,t as E}from"./ArtifactSandboxFrame-CV2XXu_t.js";var D=e(t(),1),O=n(),k=g(`components:artifact-renderer`),A=({artifact:e,className:t})=>{let{t:n}=r(),[g,A]=(0,D.useState)(!1),[j,M]=(0,D.useState)(`preview`),{theme:N,openArtifactPanel:P}=_(),F=async e=>{try{await navigator.clipboard.writeText(e),A(!0),setTimeout(()=>A(!1),2e3)}catch(e){k.error(`Failed to copy:`,e)}},I=()=>{let t=e.type===`html`?b(e.content,e.title):e.content,n=new Blob([t],{type:L(e.type)}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.title}.${R(e.type)}`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},L=e=>{switch(e){case`html`:return`text/html`;case`react`:return`text/javascript`;case`svg`:return`image/svg+xml`;case`css`:return`text/css`;case`json`:return`application/json`;default:return`text/plain`}},R=e=>{switch(e){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`svg`;case`css`:return`css`;case`json`:return`json`;default:return`txt`}},z=()=>{switch(e.type){case`html`:return(0,O.jsx)(o,{className:`h-4 w-4`});case`react`:return(0,O.jsx)(c,{className:`h-4 w-4`});case`svg`:return(0,O.jsx)(h,{className:`h-4 w-4`});case`code`:return(0,O.jsx)(c,{className:`h-4 w-4`});default:return(0,O.jsx)(h,{className:`h-4 w-4`})}},B=()=>(0,O.jsx)(`div`,{"data-testid":`artifact-html-fallback`,className:`w-full h-64 sm:h-80 lg:h-96 flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200 p-4`,children:(0,O.jsxs)(`div`,{className:`max-w-sm text-center`,children:[(0,O.jsx)(p,{className:`h-8 w-8 text-primary-500 mx-auto mb-3`}),(0,O.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:n(`artifacts.previewUnavailable`)}),(0,O.jsx)(`p`,{className:`mt-1 text-sm text-gray-600 dark:text-gray-400`,children:n(`artifacts.previewUnavailableDescription`)}),(0,O.jsxs)(v,{variant:`outline`,size:`sm`,onClick:()=>M(`code`),className:`mt-4`,children:[(0,O.jsx)(a,{className:`h-3.5 w-3.5 mr-1.5`}),n(`artifacts.code`)]})]})}),V=async()=>{try{let t=await T(C(e.type)??`html`,e.content,e.title,{colorScheme:N.mode===`dark`?`dark`:`light`});S(t,x,e.title)}catch(e){k.error(`Failed to open the artifact preview:`,e)}},H=t=>e.content.trim()?(0,O.jsx)(E,{content:e.content,title:e.title,kind:t,colorScheme:N.mode===`dark`?`dark`:`light`,className:`w-full h-64 sm:h-80 lg:h-96 border-0 rounded-lg`,fallback:B()}):B(),U=()=>(0,O.jsx)(`iframe`,{"data-testid":`artifact-svg-preview`,srcDoc:w(e.content,e.title),className:`w-full h-64 sm:h-80 lg:h-96 border-0 rounded-lg bg-white`,sandbox:``,title:e.title}),W=()=>(0,O.jsx)(`div`,{className:`relative max-h-64 sm:max-h-80 lg:max-h-96 overflow-auto`,children:(0,O.jsx)(y,{language:(()=>{if(e.language)return e.language;switch(e.type){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`xml`;case`json`:return`json`;default:return`text`}})(),isDark:N.mode===`dark`,className:`!m-0 !rounded-lg`,children:e.content})}),G=()=>{try{let t=JSON.parse(e.content),n=JSON.stringify(t,null,2);return(0,O.jsx)(`div`,{className:`relative max-h-64 sm:max-h-80 lg:max-h-96 overflow-auto`,children:(0,O.jsx)(y,{language:`json`,isDark:N.mode===`dark`,className:`!m-0 !rounded-lg`,children:n})})}catch{return(0,O.jsx)(`div`,{className:`w-full h-32 flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200`,children:(0,O.jsxs)(`div`,{className:`text-center`,children:[(0,O.jsx)(p,{className:`h-8 w-8 text-primary-500 mx-auto mb-2`}),(0,O.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-600`,children:n(`artifacts.invalidJson`)})]})})}},K=()=>{if(j===`code`)return W();switch(e.type){case`html`:return H(`html`);case`react`:return H(`react`);case`mermaid`:return H(`mermaid`);case`svg`:return U();case`json`:return G();default:return W()}},q=()=>e.type===`html`||e.type===`svg`||e.type===`react`||e.type===`mermaid`;return(0,O.jsxs)(`div`,{className:i(`border border-gray-200 dark:border-dark-200 rounded-xl bg-white dark:bg-dark-25 shadow-lg transition-all duration-300 hover:shadow-xl`,`w-full max-w-full overflow-hidden animate-fade-in`,`max-h-[400px] flex flex-col`,t),children:[(0,O.jsxs)(`div`,{className:`px-1.5 py-1.5 sm:p-4 border-b border-gray-100 dark:border-dark-200 flex-shrink-0`,children:[(0,O.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`div`,{className:`h-4 w-4 flex-shrink-0 flex items-center justify-center`,children:z()}),(0,O.jsx)(`h3`,{className:`font-medium text-gray-900 dark:text-gray-100 truncate text-sm leading-tight flex-1`,children:e.title})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[q()&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(v,{variant:j===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`preview`),className:`h-5 px-0.5 text-xs`,title:n(`artifacts.previewMode`),children:(0,O.jsx)(l,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(v,{variant:j===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`code`),className:`h-5 px-0.5 text-xs`,title:n(`artifacts.codeMode`),children:(0,O.jsx)(a,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(`div`,{className:`w-px h-2 bg-gray-300 dark:bg-gray-600 mx-0.5`})]}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>F(e.content),className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation`,title:n(`artifacts.copyContent`),children:g?(0,O.jsx)(f,{className:`h-2.5 w-2.5 text-green-500`}):(0,O.jsx)(u,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:I,className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation`,title:n(`artifacts.download`),children:(0,O.jsx)(m,{className:`h-2.5 w-2.5`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>P(e),className:`h-5 w-5 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 touch-manipulation border border-gray-200 dark:border-dark-300 hover:border-gray-300 dark:hover:border-dark-400`,title:n(`artifacts.openInPanel`),children:(0,O.jsx)(d,{className:`h-2.5 w-2.5`})})]})]}),(0,O.jsxs)(`div`,{className:`hidden sm:flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 flex-1`,children:[(0,O.jsx)(`div`,{className:`flex-shrink-0`,children:z()}),(0,O.jsx)(`h3`,{className:`font-semibold text-gray-900 dark:text-gray-100 truncate`,children:e.title})]}),(0,O.jsx)(`span`,{className:`text-xs bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 px-2 py-1 rounded-full font-medium flex-shrink-0`,children:e.type.toUpperCase()})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[q()&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(v,{variant:j===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`preview`),className:`h-8 px-3 text-xs`,title:n(`artifacts.previewMode`),children:[(0,O.jsx)(l,{className:`h-3 w-3 mr-1`}),n(`artifacts.preview`)]}),(0,O.jsxs)(v,{variant:j===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>M(`code`),className:`h-8 px-3 text-xs`,title:n(`artifacts.codeMode`),children:[(0,O.jsx)(a,{className:`h-3 w-3 mr-1`}),n(`artifacts.code`)]}),(0,O.jsx)(`div`,{className:`w-px h-4 bg-gray-300 dark:bg-gray-600 mx-1`})]}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>F(e.content),className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.copyContent`),children:g?(0,O.jsx)(f,{className:`h-4 w-4 text-green-500`}):(0,O.jsx)(u,{className:`h-4 w-4`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:I,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.download`),children:(0,O.jsx)(m,{className:`h-4 w-4`})}),(0,O.jsx)(v,{variant:`ghost`,size:`sm`,onClick:()=>P(e),className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,title:n(`artifacts.openInPanel`),children:(0,O.jsx)(d,{className:`h-4 w-4`})})]})]})]}),(0,O.jsxs)(`div`,{className:`p-4 flex-1 overflow-hidden min-h-0`,children:[e.description&&(0,O.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mb-4`,children:e.description}),(0,O.jsx)(`div`,{className:`h-full overflow-auto`,children:K()})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between p-3 border-t border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-100/50 flex-shrink-0`,children:[(0,O.jsxs)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[n(`artifacts.created`),`:`,` `,new Date(e.createdAt).toLocaleString()]}),C(e.type)&&(0,O.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>V(),className:`text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,children:[(0,O.jsx)(s,{className:`h-3 w-3 mr-1`}),n(`artifacts.openInNewWindow`)]})]})]})},j=({artifacts:e,className:t})=>!e||e.length===0?null:(0,O.jsx)(`div`,{className:i(`space-y-3`,t),children:e.map(e=>(0,O.jsx)(A,{artifact:e},e.id))});export{j as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{t as r}from"./Button-BV44cTnj.js";import{n as i}from"./ui-CUMAcARd.js";import{t as a}from"./ArtifactContainer-CigyGLnW.js";var o=e(t(),1),s=n(),c=[{id:`demo-html-1`,type:`html`,title:`Interactive Button Demo`,description:`A simple HTML page with interactive elements`,content:`<div style="text-align: center; padding: 20px;">
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{t as r}from"./Button-BPf_pOxH.js";import{n as i}from"./ui-jlx9WA5A.js";import{t as a}from"./ArtifactContainer-C-n1vPsA.js";var o=e(t(),1),s=n(),c=[{id:`demo-html-1`,type:`html`,title:`Interactive Button Demo`,description:`A simple HTML page with interactive elements`,content:`<div style="text-align: center; padding: 20px;">
2
2
  <h1 style="color: #333; font-family: Arial, sans-serif;">Welcome to Libre WebUI!</h1>
3
3
  <p style="color: #666; font-size: 16px;">This is an interactive HTML artifact.</p>
4
4
  <button
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{t as r}from"./logger-DSXjF4ye.js";import{t as i}from"./config-EEx_rELa.js";var a=e(t(),1),o=`allow-scripts allow-forms allow-modals allow-popups allow-pointer-lock allow-downloads`,s=`clipboard-read; clipboard-write; fullscreen; gamepad`,c=`libre-artifact:render`;function l(e,t){if(!t||e.source!==t.contentWindow)return!1;let n=e.origin,r=typeof window>`u`?void 0:window.location?.origin;if(typeof n==`string`&&n!==``&&n!==`null`&&n!==r)return!1;let i=e.data;return!!i&&i?.type===`libre-artifact:ready`}function u(e,t){e?.contentWindow?.postMessage({type:c,html:t},`*`)}var d=`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{t as r}from"./logger-DSXjF4ye.js";import{t as i}from"./config-CNVNpf_q.js";var a=e(t(),1),o=`allow-scripts allow-forms allow-modals allow-popups allow-pointer-lock allow-downloads`,s=`clipboard-read; clipboard-write; fullscreen; gamepad`,c=`libre-artifact:render`;function l(e,t){if(!t||e.source!==t.contentWindow)return!1;let n=e.origin,r=typeof window>`u`?void 0:window.location?.origin;if(typeof n==`string`&&n!==``&&n!==`null`&&n!==r)return!1;let i=e.data;return!!i&&i?.type===`libre-artifact:ready`}function u(e,t){e?.contentWindow?.postMessage({type:c,html:t},`*`)}var d=`
2
2
  body {
3
3
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4
4
  margin: 0;
@@ -38,7 +38,7 @@ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./m
38
38
  </head>
39
39
  <body>${e}</body>
40
40
  </html>`}function g(e,t,n=`Artifact`){let r=window.open(``,`_blank`);if(!r)return null;r.opener=null;let{document:i}=r;i.title=n,i.documentElement.style.width=`100%`,i.documentElement.style.height=`100%`,i.body.style.width=`100%`,i.body.style.height=`100%`,i.body.style.margin=`0`,i.body.replaceChildren();let a=i.createElement(`iframe`);return a.title=n,a.src=t,a.setAttribute(`sandbox`,o),a.setAttribute(`allow`,s),a.style.width=`100%`,a.style.height=`100%`,a.style.border=`0`,r.addEventListener(`message`,t=>{l(t,a)&&u(a,e)}),i.body.appendChild(a),r}function _(e,t){let n=e;/<head[\s>]/i.test(n)||(n=n.replace(/<html([^>]*)>/i,`<html$1><head></head>`));let r=[];return/<meta\s+charset=/i.test(n)||r.push(`<meta charset="UTF-8">`),/<meta\s+name=["']viewport["']/i.test(n)||r.push(`<meta name="viewport" content="width=device-width, initial-scale=1.0">`),/<base\s/i.test(n)||r.push(`<base target="_blank">`),/<title[\s>]/i.test(n)||r.push(`<title>${S(t)}</title>`),r.length===0?n:v(n,`\n ${r.join(`
41
- `)}`)}function v(e,t){let n=/<head(\s[^>]*)?>/i;return n.test(e)?e.replace(n,e=>`${e}${t}`):`${t}\n${e}`}function y(e,t){return/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${t}</head>`):/<html[^>]*>/i.test(e)?e.replace(/<html([^>]*)>/i,`<html$1><head>${t}</head>`):`${t}${e}`}function b(e,t){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${t}</body>`):`${e}${t}`}function x(e){return S(e)}function S(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var C=`${i.replace(/\/+$/,``)}/artifacts/sandbox`,ee=window.location.protocol===`file:`?new URL(C).origin:window.location.origin,te=`/artifact-runtime`,w=`runtime`,T=`react`,E=`babel`,D=`tailwind`,O=`fonts`,k={react:T,"react-dom":T,"react-dom/client":T,"react/jsx-runtime":T,"react/jsx-dev-runtime":T,recharts:`recharts`,"lucide-react":`lucide-react`,d3:`d3`,three:`three`,papaparse:`papaparse`,lodash:`lodash`,"lodash-es":`lodash`,mermaid:`mermaid`,"chart.js":`chart`,"chart.js/auto":`chart`,tone:`tone`,mathjs:`mathjs`,"plotly.js":`plotly`,"plotly.js-dist-min":`plotly`,"framer-motion":`framer-motion`,"motion/react":`framer-motion`,motion:`framer-motion`,"three/addons/controls/OrbitControls.js":`three`,"three/examples/jsm/controls/OrbitControls.js":`three`},ne=[w,T,E,D],re=[w,`mermaid`],A=[{pattern:/cdn\.tailwindcss\.com/i,bundle:D},{pattern:/(?:^|\/)tailwindcss(?:@[\d.]+)?(?:\/|$)/i,bundle:D},{pattern:/(?:^|\/)chart\.js(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)chart(?:\.min)?\.js(?:$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)d3(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)d3(?:\.min)?\.js(?:$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)three(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`three`},{pattern:/(?:^|\/)three(?:\.min)?\.js(?:$|\?)/i,bundle:`three`},{pattern:/papaparse/i,bundle:`papaparse`},{pattern:/(?:^|\/)lodash(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`lodash`},{pattern:/(?:^|\/)lodash(?:\.min)?\.js(?:$|\?)/i,bundle:`lodash`},{pattern:/fonts\.(?:googleapis|gstatic)\.com/i,bundle:O},{pattern:/mermaid/i,bundle:`mermaid`},{pattern:/(?:^|\/)tone(?:@[\d.]+)?(?:\/|$|\?)|tone(?:\.min)?\.js/i,bundle:`tone`},{pattern:/mathjs|math(?:\.min)?\.js/i,bundle:`mathjs`},{pattern:/plotly/i,bundle:`plotly`},{pattern:/framer-motion|(?:^|\/)motion(?:@[\d.]+)?(?:\/|$)/i,bundle:`framer-motion`},{pattern:/react-dom/i,bundle:T},{pattern:/(?:^|\/)react(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:T},{pattern:/babel(?:-standalone|\/standalone)/i,bundle:E}],j=`__libreArtifactRuntime`;function ie(e){if(k[e])return e;let t=A.find(({pattern:t})=>t.test(e))?.bundle??Object.values(k).find(t=>e.startsWith(`${t}/`));return t?Object.entries(k).find(([,e])=>e===t)?.[0]??null:null}function ae(e){let t=new Set,n=e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g);for(let[,e]of n){let n=ie(e);n&&t.add(k[n])}return[...t]}var M=/\b(?:flex|grid|hidden|absolute|relative|(?:p|m|px|py|mx|my|mt|mb|ml|mr|gap|space)-\d|(?:w|h|max-w|min-h)-(?:\d|full|screen|auto)|text-(?:xs|sm|base|lg|xl|\dxl|center|left|right|white|black|gray-\d)|bg-(?:white|black|transparent|[a-z]+-\d)|rounded(?:-[a-z]+)?|shadow(?:-[a-z]+)?|border(?:-\d)?|items-(?:center|start|end)|justify-(?:center|between|around|end)|font-(?:bold|medium|semibold|light)|hover:[a-z-]+|(?:sm|md|lg|xl):[a-z-]+)\b/g;function N(e){let t=[...e.matchAll(/class\s*=\s*("|')(.*?)\1/gi)].map(e=>e[2]).join(` `);return new Set(t.match(M)??[]).size>=3}function P(e){let t=new Set;for(let[n,r]of Object.entries(k)){let i=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);RegExp(`(?:from|import|require)\\s*\\(?\\s*['"\`]${i}['"\`]`).test(e)&&t.add(r)}return[...t]}function F(e){return A.find(({pattern:t})=>t.test(e))?.bundle??null}function I(e){let t=new Set;for(let n of e.matchAll(/\b(?:src|href)\s*=\s*("|')(.*?)\1/gi))t.add(n[2]);for(let n of e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g))t.add(n[1]);return[...t]}function L(e){let t=new Set;for(let n of I(e)){let e=F(n);e&&t.add(e)}return[...t]}var R=`54d9c1e9b152aab4`,z=new Map;function B(e){let t=z.get(e);if(t)return t;let n=fetch(`${ee}${te}/${e}.js?v=${R}`,{credentials:`same-origin`,cache:`no-cache`}).then(t=>{if(!t.ok)throw Error(`The artifact runtime bundle "${e}" is unavailable (HTTP ${t.status}).`);return t.text()});return n.catch(()=>z.delete(e)),z.set(e,n),n}async function V(e){let t=await Promise.all(e.map(B));return Object.fromEntries(e.map((e,n)=>[e,t[n]]))}function H(e){return e===`html`||e===`react`||e===`mermaid`?e:null}var U=`
41
+ `)}`)}function v(e,t){let n=/<head(\s[^>]*)?>/i;return n.test(e)?e.replace(n,e=>`${e}${t}`):`${t}\n${e}`}function y(e,t){return/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${t}</head>`):/<html[^>]*>/i.test(e)?e.replace(/<html([^>]*)>/i,`<html$1><head>${t}</head>`):`${t}${e}`}function b(e,t){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${t}</body>`):`${e}${t}`}function x(e){return S(e)}function S(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var C=`${i.replace(/\/+$/,``)}/artifacts/sandbox`,ee=window.location.protocol===`file:`?new URL(C).origin:window.location.origin,te=`/artifact-runtime`,w=`runtime`,T=`react`,E=`babel`,D=`tailwind`,O=`fonts`,k={react:T,"react-dom":T,"react-dom/client":T,"react/jsx-runtime":T,"react/jsx-dev-runtime":T,recharts:`recharts`,"lucide-react":`lucide-react`,d3:`d3`,three:`three`,papaparse:`papaparse`,lodash:`lodash`,"lodash-es":`lodash`,mermaid:`mermaid`,"chart.js":`chart`,"chart.js/auto":`chart`,tone:`tone`,mathjs:`mathjs`,"plotly.js":`plotly`,"plotly.js-dist-min":`plotly`,"framer-motion":`framer-motion`,"motion/react":`framer-motion`,motion:`framer-motion`,"three/addons/controls/OrbitControls.js":`three`,"three/examples/jsm/controls/OrbitControls.js":`three`},ne=[w,T,E,D],re=[w,`mermaid`],A=[{pattern:/cdn\.tailwindcss\.com/i,bundle:D},{pattern:/(?:^|\/)tailwindcss(?:@[\d.]+)?(?:\/|$)/i,bundle:D},{pattern:/(?:^|\/)chart\.js(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)chart(?:\.min)?\.js(?:$|\?)/i,bundle:`chart`},{pattern:/(?:^|\/)d3(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)d3(?:\.min)?\.js(?:$|\?)/i,bundle:`d3`},{pattern:/(?:^|\/)three(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`three`},{pattern:/(?:^|\/)three(?:\.min)?\.js(?:$|\?)/i,bundle:`three`},{pattern:/papaparse/i,bundle:`papaparse`},{pattern:/(?:^|\/)lodash(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:`lodash`},{pattern:/(?:^|\/)lodash(?:\.min)?\.js(?:$|\?)/i,bundle:`lodash`},{pattern:/fonts\.(?:googleapis|gstatic)\.com/i,bundle:O},{pattern:/mermaid/i,bundle:`mermaid`},{pattern:/(?:^|\/)tone(?:@[\d.]+)?(?:\/|$|\?)|tone(?:\.min)?\.js/i,bundle:`tone`},{pattern:/mathjs|math(?:\.min)?\.js/i,bundle:`mathjs`},{pattern:/plotly/i,bundle:`plotly`},{pattern:/framer-motion|(?:^|\/)motion(?:@[\d.]+)?(?:\/|$)/i,bundle:`framer-motion`},{pattern:/react-dom/i,bundle:T},{pattern:/(?:^|\/)react(?:@[\d.]+)?(?:\/|$|\?)/i,bundle:T},{pattern:/babel(?:-standalone|\/standalone)/i,bundle:E}],j=`__libreArtifactRuntime`;function ie(e){if(k[e])return e;let t=A.find(({pattern:t})=>t.test(e))?.bundle??Object.values(k).find(t=>e.startsWith(`${t}/`));return t?Object.entries(k).find(([,e])=>e===t)?.[0]??null:null}function ae(e){let t=new Set,n=e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g);for(let[,e]of n){let n=ie(e);n&&t.add(k[n])}return[...t]}var M=/\b(?:flex|grid|hidden|absolute|relative|(?:p|m|px|py|mx|my|mt|mb|ml|mr|gap|space)-\d|(?:w|h|max-w|min-h)-(?:\d|full|screen|auto)|text-(?:xs|sm|base|lg|xl|\dxl|center|left|right|white|black|gray-\d)|bg-(?:white|black|transparent|[a-z]+-\d)|rounded(?:-[a-z]+)?|shadow(?:-[a-z]+)?|border(?:-\d)?|items-(?:center|start|end)|justify-(?:center|between|around|end)|font-(?:bold|medium|semibold|light)|hover:[a-z-]+|(?:sm|md|lg|xl):[a-z-]+)\b/g;function N(e){let t=[...e.matchAll(/class\s*=\s*("|')(.*?)\1/gi)].map(e=>e[2]).join(` `);return new Set(t.match(M)??[]).size>=3}function P(e){let t=new Set;for(let[n,r]of Object.entries(k)){let i=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);RegExp(`(?:from|import|require)\\s*\\(?\\s*['"\`]${i}['"\`]`).test(e)&&t.add(r)}return[...t]}function F(e){return A.find(({pattern:t})=>t.test(e))?.bundle??null}function I(e){let t=new Set;for(let n of e.matchAll(/\b(?:src|href)\s*=\s*("|')(.*?)\1/gi))t.add(n[2]);for(let n of e.matchAll(/(?:from|import|require)\s*\(?\s*['"`]([^'"`]+)['"`]/g))t.add(n[1]);return[...t]}function L(e){let t=new Set;for(let n of I(e)){let e=F(n);e&&t.add(e)}return[...t]}var R=`964834e72dd28fa9`,z=new Map;function B(e){let t=z.get(e);if(t)return t;let n=fetch(`${ee}${te}/${e}.js?v=${R}`,{credentials:`same-origin`,cache:`no-cache`}).then(t=>{if(!t.ok)throw Error(`The artifact runtime bundle "${e}" is unavailable (HTTP ${t.status}).`);return t.text()});return n.catch(()=>z.delete(e)),z.set(e,n),n}async function V(e){let t=await Promise.all(e.map(B));return Object.fromEntries(e.map((e,n)=>[e,t[n]]))}function H(e){return e===`html`||e===`react`||e===`mermaid`?e:null}var U=`
42
42
  html, body { margin: 0; min-height: 100%; }
43
43
  body {
44
44
  background: #ffffff;
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{n as r}from"./react-vendor-C5yShNlM.js";import{t as i}from"./useTranslation-C3ei3mJq.js";import{t as a}from"./utils-CuC1beTY.js";import{_ as ee,t as o}from"./chatStore-P1aGCgiF.js";import{$t as s,Et as te,Gt as ne,Qt as c,Tt as re,Ut as ie,Xt as ae,cn as oe,dn as l,ln as u,n as d,p as f,qt as p,zt as m}from"./ui-vendor-54SgntkX.js";import{t as h}from"./logger-DSXjF4ye.js";import{t as se}from"./appStore-CYhqdjge.js";import{t as g}from"./Button-BV44cTnj.js";import{t as _}from"./OptimizedSyntaxHighlighter-XwqZEoTf.js";import{a as ce,i as le,l as ue,n as v,o as de,r as y,t as fe}from"./ArtifactSandboxFrame-C8_7sKm1.js";var b=e(t(),1),pe=r(),x=n(),S=h(`components:artifact-slide-out-panel`),C=320,w=.9,me=600,T=()=>{let{t:e,i18n:t}=i(),n=ee(t.language),{artifactPanelOpen:r,artifactPanelArtifact:h,openArtifactPanel:T,closeArtifactPanel:E,theme:D}=se(),O=o(e=>e.currentSession),k=b.useMemo(()=>{if(!h)return[];let e=h.title.trim().toLowerCase(),t=(O?.messages??[]).flatMap(e=>e.artifacts??[]).filter(t=>t.title.trim().toLowerCase()===e);return t.some(e=>e.id===h.id)?t:[...t,h]},[O,h]),A=k.findIndex(e=>e.id===h?.id),[he,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(`preview`),[P,F]=(0,b.useState)(me),[I,L]=(0,b.useState)(!1),R=(0,b.useRef)(null),z=(0,b.useRef)(null),B=(0,b.useRef)(0),V=(0,b.useRef)(0),H=(0,b.useRef)(null),U=(0,b.useRef)(null),W=(0,b.useRef)(P),G=h?.id??null;G!==z.current&&(z.current=G,M!==`preview`&&N(`preview`));let K=(0,b.useCallback)(e=>{W.current=e,U.current===null&&(U.current=window.requestAnimationFrame(()=>{U.current=null,F(W.current)}))},[]),q=(0,b.useCallback)(()=>{H.current=null,L(!1),U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null,F(W.current))},[]),ge=(0,b.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),H.current=e.pointerId,V.current=P,B.current=e.clientX,W.current=P,e.currentTarget.setPointerCapture(e.pointerId),L(!0)},[P]),J=(0,b.useCallback)(e=>{if(!I||H.current!==null&&e.pointerId!==H.current)return;e.preventDefault();let t=(B.current-e.clientX)*(n?-1:1),r=window.innerWidth*w,i=Math.min(r,Math.max(C,V.current+t));K(i)},[I,n,K]);if((0,b.useEffect)(()=>{if(!I){document.body.style.userSelect=``,document.body.style.cursor=``;return}let e=e=>{(H.current===null||e.pointerId===H.current)&&q()};return window.addEventListener(`pointermove`,J,{passive:!1}),window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,q),document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`,()=>{window.removeEventListener(`pointermove`,J),window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,q),document.body.style.userSelect=``,document.body.style.cursor=``}},[I,J,q]),(0,b.useEffect)(()=>{let e=()=>{let e=window.innerWidth*w;P>e&&F(e)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[P]),(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r&&E()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,E]),(0,b.useEffect)(()=>{let e=e=>{I||R.current&&!R.current.contains(e.target)&&r&&E()},t=setTimeout(()=>{window.addEventListener(`mousedown`,e)},100);return()=>{clearTimeout(t),window.removeEventListener(`mousedown`,e)}},[r,E,I]),!h)return null;let Y=h,_e=async e=>{try{await navigator.clipboard.writeText(e),j(!0),setTimeout(()=>j(!1),2e3)}catch(e){S.error(`Failed to copy:`,e)}},ve=()=>{let e=Y.type===`html`?ce(Y.content,Y.title):Y.content,t=new Blob([e],{type:ye(Y.type)}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${Y.title}.${be(Y.type)}`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},ye=e=>{switch(e){case`html`:return`text/html`;case`react`:return`text/javascript`;case`svg`:return`image/svg+xml`;case`css`:return`text/css`;case`json`:return`application/json`;default:return`text/plain`}},be=e=>{switch(e){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`svg`;case`css`:return`css`;case`json`:return`json`;default:return`txt`}},xe=()=>{switch(Y.type){case`html`:return(0,x.jsx)(te,{className:`h-5 w-5`});case`react`:return(0,x.jsx)(c,{className:`h-5 w-5`});case`svg`:return(0,x.jsx)(m,{className:`h-5 w-5`});case`code`:return(0,x.jsx)(c,{className:`h-5 w-5`});default:return(0,x.jsx)(m,{className:`h-5 w-5`})}},X=()=>(0,x.jsx)(`div`,{"data-testid":`artifact-html-fallback`,className:`w-full h-full flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200 p-4`,children:(0,x.jsxs)(`div`,{className:`max-w-sm text-center`,children:[(0,x.jsx)(f,{className:`h-8 w-8 text-primary-500 mx-auto mb-3`}),(0,x.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`artifacts.previewUnavailable`)}),(0,x.jsx)(`p`,{className:`mt-1 text-sm text-gray-600 dark:text-gray-400`,children:e(`artifacts.previewUnavailableDescription`)}),(0,x.jsxs)(g,{variant:`outline`,size:`sm`,onClick:()=>N(`code`),className:`mt-4`,children:[(0,x.jsx)(s,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.code`)]})]})}),Se=async()=>{try{let e=await y(v(Y.type)??`html`,Y.content,Y.title,{colorScheme:D.mode===`dark`?`dark`:`light`});ue(e,le,Y.title)}catch(e){S.error(`Failed to open the artifact preview:`,e)}},Z=e=>Y.content.trim()?(0,x.jsx)(fe,{content:Y.content,title:Y.title,kind:e,colorScheme:D.mode===`dark`?`dark`:`light`,className:a(`w-full h-full border-0 rounded-lg bg-white`,I&&`pointer-events-none`),fallback:X()}):X(),Ce=()=>(0,x.jsx)(`iframe`,{"data-testid":`artifact-svg-preview`,srcDoc:de(Y.content,Y.title),className:`w-full h-full border-0 rounded-lg bg-white`,sandbox:``,title:Y.title}),Q=()=>(0,x.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,x.jsx)(_,{language:(()=>{if(Y.language)return Y.language;switch(Y.type){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`xml`;case`json`:return`json`;default:return`text`}})(),isDark:D.mode===`dark`,className:`!m-0 !rounded-lg !h-full`,children:Y.content})}),we=()=>{try{let e=JSON.parse(Y.content),t=JSON.stringify(e,null,2);return(0,x.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,x.jsx)(_,{language:`json`,isDark:D.mode===`dark`,className:`!m-0 !rounded-lg !h-full`,children:t})})}catch{return(0,x.jsx)(`div`,{className:`w-full h-full flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg`,children:(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(f,{className:`h-8 w-8 text-primary-500 mx-auto mb-2`}),(0,x.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-600`,children:e(`artifacts.invalidJson`)})]})})}},Te=()=>{if(M===`code`)return Q();switch(Y.type){case`html`:return Z(`html`);case`react`:return Z(`react`);case`mermaid`:return Z(`mermaid`);case`svg`:return Ce();case`json`:return we();default:return Q()}},Ee=()=>Y.type===`html`||Y.type===`svg`||Y.type===`react`||Y.type===`mermaid`,$=typeof window<`u`&&window.innerWidth<640,De=$?`100%`:`${P}px`,Oe=(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:a(`fixed inset-0 bg-black/30 dark:bg-black/50 z-40 transition-opacity duration-300`,r?`opacity-100`:`opacity-0 pointer-events-none`)}),I&&(0,x.jsx)(`div`,{className:`fixed inset-0 z-[55] cursor-col-resize select-none`,"aria-hidden":`true`}),(0,x.jsxs)(`div`,{ref:R,"data-testid":`artifact-slide-out-panel`,style:{width:De},className:a(`fixed top-0 end-0 h-full z-50`,`bg-white dark:bg-dark-25`,`shadow-2xl border-s border-gray-200 dark:border-dark-200`,`flex flex-col`,`transform transition-transform duration-300 ease-out`,r?`translate-x-0`:`translate-x-full rtl:-translate-x-full`),children:[!$&&(0,x.jsxs)(`div`,{onPointerDown:ge,"data-testid":`artifact-resize-handle`,className:a(`absolute start-0 top-0 bottom-0 w-4 -ms-2 cursor-col-resize z-[56]`,`flex items-center justify-center`,`touch-none select-none group`),children:[(0,x.jsx)(`div`,{className:a(`w-1 h-16 rounded-full transition-all duration-200`,`bg-gray-300 dark:bg-dark-300`,`group-hover:bg-primary-500 group-hover:h-24`,I&&`bg-primary-500 h-24`)}),(0,x.jsx)(`div`,{className:a(`absolute left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity`,`text-gray-400 dark:text-dark-500`,I&&`opacity-100`),children:(0,x.jsx)(re,{className:`h-4 w-4`})})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-200 dark:border-dark-200`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,x.jsx)(`div`,{className:`text-gray-600 dark:text-gray-400 flex-shrink-0`,children:xe()}),(0,x.jsx)(`h2`,{className:`font-semibold text-gray-900 dark:text-gray-100 truncate`,children:Y.title}),(0,x.jsx)(`span`,{className:`text-xs bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 px-2 py-1 rounded-full font-medium flex-shrink-0`,children:Y.type.toUpperCase()})]}),(0,x.jsx)(g,{variant:`ghost`,size:`sm`,onClick:E,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 flex-shrink-0`,title:e(`artifacts.closePanelEsc`),children:(0,x.jsx)(d,{className:`h-5 w-5`})})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-100/50`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[k.length>1&&A!==-1&&(0,x.jsxs)(`div`,{className:`me-1 flex items-center gap-0.5`,children:[(0,x.jsx)(g,{variant:`ghost`,size:`sm`,disabled:A===0,onClick:()=>T(k[A-1]),className:`h-8 w-8 p-0`,title:e(`artifacts.previousVersion`),children:(0,x.jsx)(u,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,x.jsx)(`span`,{className:`whitespace-nowrap text-xs tabular-nums text-gray-500 dark:text-dark-600`,children:e(`artifacts.versionOf`,{current:A+1,total:k.length})}),(0,x.jsx)(g,{variant:`ghost`,size:`sm`,disabled:A===k.length-1,onClick:()=>T(k[A+1]),className:`h-8 w-8 p-0`,title:e(`artifacts.nextVersion`),children:(0,x.jsx)(oe,{className:`h-3.5 w-3.5 rtl:rotate-180`})})]}),Ee()&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(g,{variant:M===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>N(`preview`),className:`h-8 px-3 text-xs`,title:e(`artifacts.previewMode`),children:[(0,x.jsx)(ie,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.preview`)]}),(0,x.jsxs)(g,{variant:M===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>N(`code`),className:`h-8 px-3 text-xs`,title:e(`artifacts.codeMode`),children:[(0,x.jsx)(s,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.code`)]})]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>_e(Y.content),className:`h-8 px-3 text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.copyContent`),children:he?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l,{className:`h-3.5 w-3.5 me-1.5 text-green-500`}),e(`artifacts.copied`)]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ae,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.copyButton`)]})}),(0,x.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:ve,className:`h-8 px-3 text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.download`),children:[(0,x.jsx)(p,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.download`)]}),v(Y.type)&&(0,x.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:()=>Se(),className:`h-8 px-3 text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.openInNewWindow`),children:[(0,x.jsx)(ne,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.open`)]})]})]}),Y.description&&(0,x.jsx)(`div`,{className:`px-4 py-3 border-b border-gray-100 dark:border-dark-200`,children:(0,x.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:Y.description})}),(0,x.jsx)(`div`,{className:`flex-1 p-4 overflow-hidden`,children:Te()}),(0,x.jsx)(`div`,{className:`px-4 py-2 border-t border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-100/50`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[e(`artifacts.created`),`:`,` `,new Date(Y.createdAt).toLocaleString()]}),!$&&(0,x.jsx)(`div`,{className:`text-xs text-gray-400 dark:text-dark-500`,children:e(`artifacts.dragEdgeToResize`)})]})})]})]});return(0,pe.createPortal)(Oe,document.body)};export{T as ArtifactSlideOutPanel};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{n as r}from"./react-vendor-C5yShNlM.js";import{t as i}from"./useTranslation-Bho4HCyg.js";import{t as a}from"./utils-D9W1Lnkn.js";import{t as ee,v as o}from"./chatStore-DK-_wd-j.js";import{$t as s,Et as te,Gt as ne,Qt as c,Tt as re,Ut as ie,Xt as ae,cn as oe,dn as l,ln as u,n as d,p as f,qt as p,zt as m}from"./ui-vendor-54SgntkX.js";import{t as h}from"./logger-DSXjF4ye.js";import{t as se}from"./appStore-CJtomipz.js";import{t as g}from"./Button-BPf_pOxH.js";import{t as _}from"./OptimizedSyntaxHighlighter-Dz7D1LPB.js";import{a as ce,i as le,l as ue,n as v,o as de,r as y,t as fe}from"./ArtifactSandboxFrame-CV2XXu_t.js";var b=e(t(),1),pe=r(),x=n(),S=h(`components:artifact-slide-out-panel`),C=320,w=.9,me=600,T=()=>{let{t:e,i18n:t}=i(),n=o(t.language),{artifactPanelOpen:r,artifactPanelArtifact:h,openArtifactPanel:T,closeArtifactPanel:E,theme:D}=se(),O=ee(e=>e.currentSession),k=b.useMemo(()=>{if(!h)return[];let e=h.title.trim().toLowerCase(),t=(O?.messages??[]).flatMap(e=>e.artifacts??[]).filter(t=>t.title.trim().toLowerCase()===e);return t.some(e=>e.id===h.id)?t:[...t,h]},[O,h]),A=k.findIndex(e=>e.id===h?.id),[he,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(`preview`),[P,F]=(0,b.useState)(me),[I,L]=(0,b.useState)(!1),R=(0,b.useRef)(null),z=(0,b.useRef)(null),B=(0,b.useRef)(0),V=(0,b.useRef)(0),H=(0,b.useRef)(null),U=(0,b.useRef)(null),W=(0,b.useRef)(P),G=h?.id??null;G!==z.current&&(z.current=G,M!==`preview`&&N(`preview`));let K=(0,b.useCallback)(e=>{W.current=e,U.current===null&&(U.current=window.requestAnimationFrame(()=>{U.current=null,F(W.current)}))},[]),q=(0,b.useCallback)(()=>{H.current=null,L(!1),U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null,F(W.current))},[]),ge=(0,b.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),H.current=e.pointerId,V.current=P,B.current=e.clientX,W.current=P,e.currentTarget.setPointerCapture(e.pointerId),L(!0)},[P]),J=(0,b.useCallback)(e=>{if(!I||H.current!==null&&e.pointerId!==H.current)return;e.preventDefault();let t=(B.current-e.clientX)*(n?-1:1),r=window.innerWidth*w,i=Math.min(r,Math.max(C,V.current+t));K(i)},[I,n,K]);if((0,b.useEffect)(()=>{if(!I){document.body.style.userSelect=``,document.body.style.cursor=``;return}let e=e=>{(H.current===null||e.pointerId===H.current)&&q()};return window.addEventListener(`pointermove`,J,{passive:!1}),window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,q),document.body.style.userSelect=`none`,document.body.style.cursor=`col-resize`,()=>{window.removeEventListener(`pointermove`,J),window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,q),document.body.style.userSelect=``,document.body.style.cursor=``}},[I,J,q]),(0,b.useEffect)(()=>{let e=()=>{let e=window.innerWidth*w;P>e&&F(e)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[P]),(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r&&E()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,E]),(0,b.useEffect)(()=>{let e=e=>{I||R.current&&!R.current.contains(e.target)&&r&&E()},t=setTimeout(()=>{window.addEventListener(`mousedown`,e)},100);return()=>{clearTimeout(t),window.removeEventListener(`mousedown`,e)}},[r,E,I]),!h)return null;let Y=h,_e=async e=>{try{await navigator.clipboard.writeText(e),j(!0),setTimeout(()=>j(!1),2e3)}catch(e){S.error(`Failed to copy:`,e)}},ve=()=>{let e=Y.type===`html`?ce(Y.content,Y.title):Y.content,t=new Blob([e],{type:ye(Y.type)}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${Y.title}.${be(Y.type)}`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},ye=e=>{switch(e){case`html`:return`text/html`;case`react`:return`text/javascript`;case`svg`:return`image/svg+xml`;case`css`:return`text/css`;case`json`:return`application/json`;default:return`text/plain`}},be=e=>{switch(e){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`svg`;case`css`:return`css`;case`json`:return`json`;default:return`txt`}},xe=()=>{switch(Y.type){case`html`:return(0,x.jsx)(te,{className:`h-5 w-5`});case`react`:return(0,x.jsx)(c,{className:`h-5 w-5`});case`svg`:return(0,x.jsx)(m,{className:`h-5 w-5`});case`code`:return(0,x.jsx)(c,{className:`h-5 w-5`});default:return(0,x.jsx)(m,{className:`h-5 w-5`})}},X=()=>(0,x.jsx)(`div`,{"data-testid":`artifact-html-fallback`,className:`w-full h-full flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg border border-gray-200 dark:border-dark-200 p-4`,children:(0,x.jsxs)(`div`,{className:`max-w-sm text-center`,children:[(0,x.jsx)(f,{className:`h-8 w-8 text-primary-500 mx-auto mb-3`}),(0,x.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`artifacts.previewUnavailable`)}),(0,x.jsx)(`p`,{className:`mt-1 text-sm text-gray-600 dark:text-gray-400`,children:e(`artifacts.previewUnavailableDescription`)}),(0,x.jsxs)(g,{variant:`outline`,size:`sm`,onClick:()=>N(`code`),className:`mt-4`,children:[(0,x.jsx)(s,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.code`)]})]})}),Se=async()=>{try{let e=await y(v(Y.type)??`html`,Y.content,Y.title,{colorScheme:D.mode===`dark`?`dark`:`light`});ue(e,le,Y.title)}catch(e){S.error(`Failed to open the artifact preview:`,e)}},Z=e=>Y.content.trim()?(0,x.jsx)(fe,{content:Y.content,title:Y.title,kind:e,colorScheme:D.mode===`dark`?`dark`:`light`,className:a(`w-full h-full border-0 rounded-lg bg-white`,I&&`pointer-events-none`),fallback:X()}):X(),Ce=()=>(0,x.jsx)(`iframe`,{"data-testid":`artifact-svg-preview`,srcDoc:de(Y.content,Y.title),className:`w-full h-full border-0 rounded-lg bg-white`,sandbox:``,title:Y.title}),Q=()=>(0,x.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,x.jsx)(_,{language:(()=>{if(Y.language)return Y.language;switch(Y.type){case`html`:return`html`;case`react`:return`jsx`;case`svg`:return`xml`;case`json`:return`json`;default:return`text`}})(),isDark:D.mode===`dark`,className:`!m-0 !rounded-lg !h-full`,children:Y.content})}),we=()=>{try{let e=JSON.parse(Y.content),t=JSON.stringify(e,null,2);return(0,x.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,x.jsx)(_,{language:`json`,isDark:D.mode===`dark`,className:`!m-0 !rounded-lg !h-full`,children:t})})}catch{return(0,x.jsx)(`div`,{className:`w-full h-full flex items-center justify-center bg-gray-50 dark:bg-dark-100 rounded-lg`,children:(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(f,{className:`h-8 w-8 text-primary-500 mx-auto mb-2`}),(0,x.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-600`,children:e(`artifacts.invalidJson`)})]})})}},Te=()=>{if(M===`code`)return Q();switch(Y.type){case`html`:return Z(`html`);case`react`:return Z(`react`);case`mermaid`:return Z(`mermaid`);case`svg`:return Ce();case`json`:return we();default:return Q()}},Ee=()=>Y.type===`html`||Y.type===`svg`||Y.type===`react`||Y.type===`mermaid`,$=typeof window<`u`&&window.innerWidth<640,De=$?`100%`:`${P}px`,Oe=(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:a(`fixed inset-0 bg-black/30 dark:bg-black/50 z-40 transition-opacity duration-300`,r?`opacity-100`:`opacity-0 pointer-events-none`)}),I&&(0,x.jsx)(`div`,{className:`fixed inset-0 z-[55] cursor-col-resize select-none`,"aria-hidden":`true`}),(0,x.jsxs)(`div`,{ref:R,"data-testid":`artifact-slide-out-panel`,style:{width:De},className:a(`fixed top-0 end-0 h-full z-50`,`bg-white dark:bg-dark-25`,`shadow-2xl border-s border-gray-200 dark:border-dark-200`,`flex flex-col`,`transform transition-transform duration-300 ease-out`,r?`translate-x-0`:`translate-x-full rtl:-translate-x-full`),children:[!$&&(0,x.jsxs)(`div`,{onPointerDown:ge,"data-testid":`artifact-resize-handle`,className:a(`absolute start-0 top-0 bottom-0 w-4 -ms-2 cursor-col-resize z-[56]`,`flex items-center justify-center`,`touch-none select-none group`),children:[(0,x.jsx)(`div`,{className:a(`w-1 h-16 rounded-full transition-all duration-200`,`bg-gray-300 dark:bg-dark-300`,`group-hover:bg-primary-500 group-hover:h-24`,I&&`bg-primary-500 h-24`)}),(0,x.jsx)(`div`,{className:a(`absolute left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity`,`text-gray-400 dark:text-dark-500`,I&&`opacity-100`),children:(0,x.jsx)(re,{className:`h-4 w-4`})})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-gray-200 dark:border-dark-200`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,x.jsx)(`div`,{className:`text-gray-600 dark:text-gray-400 flex-shrink-0`,children:xe()}),(0,x.jsx)(`h2`,{className:`font-semibold text-gray-900 dark:text-gray-100 truncate`,children:Y.title}),(0,x.jsx)(`span`,{className:`text-xs bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-300 px-2 py-1 rounded-full font-medium flex-shrink-0`,children:Y.type.toUpperCase()})]}),(0,x.jsx)(g,{variant:`ghost`,size:`sm`,onClick:E,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200 flex-shrink-0`,title:e(`artifacts.closePanelEsc`),children:(0,x.jsx)(d,{className:`h-5 w-5`})})]}),(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-100/50`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[k.length>1&&A!==-1&&(0,x.jsxs)(`div`,{className:`me-1 flex items-center gap-0.5`,children:[(0,x.jsx)(g,{variant:`ghost`,size:`sm`,disabled:A===0,onClick:()=>T(k[A-1]),className:`h-8 w-8 p-0`,title:e(`artifacts.previousVersion`),children:(0,x.jsx)(u,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,x.jsx)(`span`,{className:`whitespace-nowrap text-xs tabular-nums text-gray-500 dark:text-dark-600`,children:e(`artifacts.versionOf`,{current:A+1,total:k.length})}),(0,x.jsx)(g,{variant:`ghost`,size:`sm`,disabled:A===k.length-1,onClick:()=>T(k[A+1]),className:`h-8 w-8 p-0`,title:e(`artifacts.nextVersion`),children:(0,x.jsx)(oe,{className:`h-3.5 w-3.5 rtl:rotate-180`})})]}),Ee()&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(g,{variant:M===`preview`?`primary`:`ghost`,size:`sm`,onClick:()=>N(`preview`),className:`h-8 px-3 text-xs`,title:e(`artifacts.previewMode`),children:[(0,x.jsx)(ie,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.preview`)]}),(0,x.jsxs)(g,{variant:M===`code`?`primary`:`ghost`,size:`sm`,onClick:()=>N(`code`),className:`h-8 px-3 text-xs`,title:e(`artifacts.codeMode`),children:[(0,x.jsx)(s,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.code`)]})]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>_e(Y.content),className:`h-8 px-3 text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.copyContent`),children:he?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l,{className:`h-3.5 w-3.5 me-1.5 text-green-500`}),e(`artifacts.copied`)]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(ae,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.copyButton`)]})}),(0,x.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:ve,className:`h-8 px-3 text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.download`),children:[(0,x.jsx)(p,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.download`)]}),v(Y.type)&&(0,x.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:()=>Se(),className:`h-8 px-3 text-xs hover:bg-gray-100 dark:hover:bg-dark-200`,title:e(`artifacts.openInNewWindow`),children:[(0,x.jsx)(ne,{className:`h-3.5 w-3.5 me-1.5`}),e(`artifacts.open`)]})]})]}),Y.description&&(0,x.jsx)(`div`,{className:`px-4 py-3 border-b border-gray-100 dark:border-dark-200`,children:(0,x.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400`,children:Y.description})}),(0,x.jsx)(`div`,{className:`flex-1 p-4 overflow-hidden`,children:Te()}),(0,x.jsx)(`div`,{className:`px-4 py-2 border-t border-gray-100 dark:border-dark-200 bg-gray-50 dark:bg-dark-100/50`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsxs)(`div`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[e(`artifacts.created`),`:`,` `,new Date(Y.createdAt).toLocaleString()]}),!$&&(0,x.jsx)(`div`,{className:`text-xs text-gray-400 dark:text-dark-500`,children:e(`artifacts.dragEdgeToResize`)})]})})]})]});return(0,pe.createPortal)(Oe,document.body)};export{T as ArtifactSlideOutPanel};
@@ -1 +1 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{m as e,p as t}from"./markdown-core-BmPPZiuD.js";import{t as n}from"./utils-CuC1beTY.js";e();var r=t(),i=({variant:e=`primary`,size:t=`md`,loading:i=!1,disabled:a,children:o,className:s,...c})=>(0,r.jsxs)(`button`,{className:n(`group relative inline-flex select-none items-center justify-center rounded-xl border font-medium tracking-[-0.01em] transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas dark:focus-visible:ring-primary-400 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,{primary:`border-transparent bg-ink text-ink-inverse shadow-subtle hover:opacity-90`,secondary:`border-line bg-surface-raised text-ink shadow-subtle hover:border-line-strong hover:bg-surface-subtle`,outline:`border-line bg-transparent text-ink hover:border-line-strong hover:bg-surface-subtle`,ghost:`border-transparent bg-transparent text-ink-muted shadow-none hover:bg-surface-subtle hover:text-ink`,danger:`border-transparent bg-error-600 text-white shadow-subtle hover:bg-error-700 dark:bg-error-500 dark:text-ink-inverse dark:hover:bg-error-400`}[e],{sm:`h-8 px-3 text-sm gap-1.5`,md:`h-10 px-4 text-sm gap-2`,lg:`h-11 px-5 text-base gap-2.5`}[t],s),disabled:a||i,"aria-busy":i||void 0,...c,children:[i&&(0,r.jsxs)(`svg`,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,r.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,r.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}),o]});export{i as t};
1
+ import"./rolldown-runtime-hePW80VL.js";import{m as e,p as t}from"./markdown-core-BmPPZiuD.js";import{t as n}from"./utils-D9W1Lnkn.js";e();var r=t(),i=({variant:e=`primary`,size:t=`md`,loading:i=!1,disabled:a,children:o,className:s,...c})=>(0,r.jsxs)(`button`,{className:n(`group relative inline-flex select-none items-center justify-center rounded-xl border font-medium tracking-[-0.01em] transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas dark:focus-visible:ring-primary-400 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,{primary:`border-transparent bg-ink text-ink-inverse shadow-subtle hover:opacity-90`,secondary:`border-line bg-surface-raised text-ink shadow-subtle hover:border-line-strong hover:bg-surface-subtle`,outline:`border-line bg-transparent text-ink hover:border-line-strong hover:bg-surface-subtle`,ghost:`border-transparent bg-transparent text-ink-muted shadow-none hover:bg-surface-subtle hover:text-ink`,danger:`border-transparent bg-error-600 text-white shadow-subtle hover:bg-error-700 dark:bg-error-500 dark:text-ink-inverse dark:hover:bg-error-400`}[e],{sm:`h-8 px-3 text-sm gap-1.5`,md:`h-10 px-4 text-sm gap-2`,lg:`h-11 px-5 text-base gap-2.5`}[t],s),disabled:a||i,"aria-busy":i||void 0,...c,children:[i&&(0,r.jsxs)(`svg`,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,r.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,r.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]}),o]});export{i as t};