chaipro 0.1.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 (392) hide show
  1. package/README.md +36 -0
  2. package/dist/IconPicker-I7VNLYZ4.js +5 -0
  3. package/dist/actions-DM00SIUk.d.cts +899 -0
  4. package/dist/actions-DM00SIUk.d.ts +899 -0
  5. package/dist/actions-registery-SEJTZE5Q.js +1 -0
  6. package/dist/active-in-another-tab-SONDAONP.js +1 -0
  7. package/dist/add-new-language-page-TI6DUYYX.js +1 -0
  8. package/dist/add-new-page-LBHXICXO.js +1 -0
  9. package/dist/ai-block-floating-prompt-input-ESY5GQLZ.js +1 -0
  10. package/dist/ai-panel-content-62I6FDQF.css +1 -0
  11. package/dist/ai-panel-content-UZJZ463W.js +1 -0
  12. package/dist/ai-panel-default-lang-2ZXZYQRT.js +6 -0
  13. package/dist/ai-panel-default-lang-ETFOFFEF.css +1 -0
  14. package/dist/ai-panel-for-image-LADQP6VY.js +1 -0
  15. package/dist/ai-panel-other-lang-WDLC3M2M.js +1 -0
  16. package/dist/ai-panel-page-chat-7ZISZWY4.js +4 -0
  17. package/dist/ai-panel-page-chat-N4YFJGAM.css +1 -0
  18. package/dist/ai-prompt-input-CPT5ETQ4.js +1 -0
  19. package/dist/ai-theme-generator-7PS4BX52.js +1 -0
  20. package/dist/ai-translation-prompt-3VE2ECGR.js +1 -0
  21. package/dist/blocks-CMvgDlxw.d.ts +72 -0
  22. package/dist/blocks-CP-Pngaz.d.cts +72 -0
  23. package/dist/build-config-CCERdThN.d.ts +80 -0
  24. package/dist/build-config-DrerOPd9.d.cts +80 -0
  25. package/dist/builder.cjs +243 -0
  26. package/dist/builder.css +1 -0
  27. package/dist/builder.d.cts +352 -0
  28. package/dist/builder.d.ts +352 -0
  29. package/dist/builder.js +1 -0
  30. package/dist/chaibuilder-instance-DNz3Q-dY.d.cts +579 -0
  31. package/dist/chaibuilder-instance-qroszVwI.d.ts +579 -0
  32. package/dist/change-password-modal-NJL7ZLTY.js +1 -0
  33. package/dist/chunk-2AFM6557.js +3 -0
  34. package/dist/chunk-2N4IJZOR.js +1 -0
  35. package/dist/chunk-2NYUIXUX.js +1 -0
  36. package/dist/chunk-2PJZUYIZ.js +1 -0
  37. package/dist/chunk-32HH35VD.js +1 -0
  38. package/dist/chunk-346H4FEX.js +1 -0
  39. package/dist/chunk-34HIOUTE.js +1 -0
  40. package/dist/chunk-374QEK4F.js +1 -0
  41. package/dist/chunk-3E72DJSP.js +1 -0
  42. package/dist/chunk-3IT7IIAV.js +1 -0
  43. package/dist/chunk-3UEPBBE4.js +11 -0
  44. package/dist/chunk-3XSKJBPH.js +1 -0
  45. package/dist/chunk-45ELAD2J.js +1 -0
  46. package/dist/chunk-4JBHWPMO.js +1 -0
  47. package/dist/chunk-4P25MV5E.js +1 -0
  48. package/dist/chunk-4PQNBY3V.js +1 -0
  49. package/dist/chunk-4VNLL2IA.js +1 -0
  50. package/dist/chunk-55SU3QPU.js +1 -0
  51. package/dist/chunk-5ZC65NB6.js +1 -0
  52. package/dist/chunk-6M7V7BOM.js +1 -0
  53. package/dist/chunk-6TXCHU4K.js +1 -0
  54. package/dist/chunk-777N6WHB.js +1 -0
  55. package/dist/chunk-7C4EQOAR.js +12 -0
  56. package/dist/chunk-7EXZXKW2.js +1 -0
  57. package/dist/chunk-7QWMLDCG.js +1 -0
  58. package/dist/chunk-AOJE5WI3.js +1 -0
  59. package/dist/chunk-ATLMLDBS.js +1 -0
  60. package/dist/chunk-AVGF3YLU.js +17 -0
  61. package/dist/chunk-BQSLQHLD.js +1 -0
  62. package/dist/chunk-BWORNCTE.js +1 -0
  63. package/dist/chunk-BYGD5CDT.js +1 -0
  64. package/dist/chunk-CA5PVX24.js +1 -0
  65. package/dist/chunk-CFNOB42V.js +1 -0
  66. package/dist/chunk-CJP3BQH2.js +1 -0
  67. package/dist/chunk-CRJENCPR.js +1 -0
  68. package/dist/chunk-D5SKCKSB.js +1 -0
  69. package/dist/chunk-DZ72OHTD.js +1 -0
  70. package/dist/chunk-EPGOG22Q.js +0 -0
  71. package/dist/chunk-ERCY63ZW.js +1 -0
  72. package/dist/chunk-ESCX7KEH.js +1 -0
  73. package/dist/chunk-F2V4N3LT.js +156 -0
  74. package/dist/chunk-F7YMHPEA.js +1 -0
  75. package/dist/chunk-FERH2TPR.js +1 -0
  76. package/dist/chunk-FLSV2QGU.js +1 -0
  77. package/dist/chunk-FOKGOT6B.js +1 -0
  78. package/dist/chunk-GJOOCKUE.js +1 -0
  79. package/dist/chunk-HA7LF3RV.js +1 -0
  80. package/dist/chunk-HAKJOMCL.js +1 -0
  81. package/dist/chunk-HEKCKC7N.js +1 -0
  82. package/dist/chunk-HELRVKD2.js +3 -0
  83. package/dist/chunk-I7ODKVVX.js +1 -0
  84. package/dist/chunk-IAKCX2WB.js +1 -0
  85. package/dist/chunk-IB2C3TWH.js +1 -0
  86. package/dist/chunk-IH562KSP.js +1 -0
  87. package/dist/chunk-IP4JBQOX.js +1 -0
  88. package/dist/chunk-ITX7QWN6.js +1 -0
  89. package/dist/chunk-IUACZ3E6.js +6 -0
  90. package/dist/chunk-J7Q62EP7.js +1 -0
  91. package/dist/chunk-JBB5IJFA.js +1 -0
  92. package/dist/chunk-JPJRO4NU.js +1 -0
  93. package/dist/chunk-JUIS55JT.js +1 -0
  94. package/dist/chunk-JYBTQ3YX.js +5 -0
  95. package/dist/chunk-K5YWQY4U.js +1 -0
  96. package/dist/chunk-K6RHR4HT.js +1 -0
  97. package/dist/chunk-LNV5MRGV.js +1 -0
  98. package/dist/chunk-LRJREWRD.js +1 -0
  99. package/dist/chunk-LWYDGDPW.js +1 -0
  100. package/dist/chunk-MDMGXS5B.js +1 -0
  101. package/dist/chunk-MEROMQQX.js +1 -0
  102. package/dist/chunk-N7Z4RFFI.js +1 -0
  103. package/dist/chunk-NSQEQYEM.js +1 -0
  104. package/dist/chunk-OD3K76M6.js +1 -0
  105. package/dist/chunk-ODSL3KXG.js +1 -0
  106. package/dist/chunk-OJJDRACB.js +1 -0
  107. package/dist/chunk-ONSZ462E.js +1 -0
  108. package/dist/chunk-OQZ4EPOM.js +1 -0
  109. package/dist/chunk-OR7KKUYT.js +1 -0
  110. package/dist/chunk-OSGXFZTA.js +1 -0
  111. package/dist/chunk-PM3JNOZH.js +1 -0
  112. package/dist/chunk-PQHFT4TE.js +1 -0
  113. package/dist/chunk-QGVCH2NI.js +1 -0
  114. package/dist/chunk-QIGSSVEY.js +1 -0
  115. package/dist/chunk-R5ZTCDFD.js +1 -0
  116. package/dist/chunk-RBDZDQZR.js +1 -0
  117. package/dist/chunk-ROQRBSK6.js +1 -0
  118. package/dist/chunk-SSENH35Y.js +1 -0
  119. package/dist/chunk-SYPALJAE.js +1 -0
  120. package/dist/chunk-T2YYNX6Z.js +1 -0
  121. package/dist/chunk-T32TW3XV.js +1 -0
  122. package/dist/chunk-T56KQBE2.js +1 -0
  123. package/dist/chunk-TEL5ACJE.js +1 -0
  124. package/dist/chunk-TGJQC6VC.js +1 -0
  125. package/dist/chunk-TQ34DGOT.js +1 -0
  126. package/dist/chunk-TVF77C53.js +1 -0
  127. package/dist/chunk-UIDBBTCZ.js +3 -0
  128. package/dist/chunk-VKSRWZCO.js +1 -0
  129. package/dist/chunk-VL5WBPVV.js +1 -0
  130. package/dist/chunk-VUWHFLT7.js +22 -0
  131. package/dist/chunk-WEVKAJMV.js +1 -0
  132. package/dist/chunk-WHPIYGCY.js +1 -0
  133. package/dist/chunk-WNESLH23.js +1 -0
  134. package/dist/chunk-WOT6VMZA.js +1 -0
  135. package/dist/chunk-WSQ5SQBD.js +1 -0
  136. package/dist/chunk-XY4UJKHE.js +1 -0
  137. package/dist/chunk-Y2BHO7OO.js +1 -0
  138. package/dist/chunk-YDOQEFOK.js +1 -0
  139. package/dist/chunk-YEFMD4DS.js +1 -0
  140. package/dist/chunk-YQ5QQCRD.js +1 -0
  141. package/dist/chunk-YQPOFRXU.js +1 -0
  142. package/dist/chunk-YTPQSO7V.js +801 -0
  143. package/dist/chunk-ZAU65LBG.js +1 -0
  144. package/dist/chunk-ZRFCEMYU.js +1 -0
  145. package/dist/chunk-ZU2B5YT6.js +1 -0
  146. package/dist/chunk-ZXKKBKGV.js +1 -0
  147. package/dist/code-display-7346IUCO.js +1 -0
  148. package/dist/code-editor-UBGTTX2L.js +1 -0
  149. package/dist/components/ui/accordion.cjs +1 -0
  150. package/dist/components/ui/accordion.d.cts +9 -0
  151. package/dist/components/ui/accordion.d.ts +9 -0
  152. package/dist/components/ui/accordion.js +1 -0
  153. package/dist/components/ui/alert-dialog.cjs +1 -0
  154. package/dist/components/ui/alert-dialog.d.cts +23 -0
  155. package/dist/components/ui/alert-dialog.d.ts +23 -0
  156. package/dist/components/ui/alert-dialog.js +1 -0
  157. package/dist/components/ui/alert.cjs +1 -0
  158. package/dist/components/ui/alert.d.cts +11 -0
  159. package/dist/components/ui/alert.d.ts +11 -0
  160. package/dist/components/ui/alert.js +1 -0
  161. package/dist/components/ui/avatar.cjs +1 -0
  162. package/dist/components/ui/avatar.d.cts +8 -0
  163. package/dist/components/ui/avatar.d.ts +8 -0
  164. package/dist/components/ui/avatar.js +1 -0
  165. package/dist/components/ui/badge.cjs +1 -0
  166. package/dist/components/ui/badge.d.cts +13 -0
  167. package/dist/components/ui/badge.d.ts +13 -0
  168. package/dist/components/ui/badge.js +1 -0
  169. package/dist/components/ui/button.cjs +1 -0
  170. package/dist/components/ui/button.d.cts +15 -0
  171. package/dist/components/ui/button.d.ts +15 -0
  172. package/dist/components/ui/button.js +1 -0
  173. package/dist/components/ui/card.cjs +1 -0
  174. package/dist/components/ui/card.d.cts +10 -0
  175. package/dist/components/ui/card.d.ts +10 -0
  176. package/dist/components/ui/card.js +1 -0
  177. package/dist/components/ui/checkbox.cjs +1 -0
  178. package/dist/components/ui/checkbox.d.cts +6 -0
  179. package/dist/components/ui/checkbox.d.ts +6 -0
  180. package/dist/components/ui/checkbox.js +1 -0
  181. package/dist/components/ui/command.cjs +1 -0
  182. package/dist/components/ui/command.d.cts +83 -0
  183. package/dist/components/ui/command.d.ts +83 -0
  184. package/dist/components/ui/command.js +1 -0
  185. package/dist/components/ui/context-menu.cjs +1 -0
  186. package/dist/components/ui/context-menu.d.cts +30 -0
  187. package/dist/components/ui/context-menu.d.ts +30 -0
  188. package/dist/components/ui/context-menu.js +1 -0
  189. package/dist/components/ui/dialog.cjs +1 -0
  190. package/dist/components/ui/dialog.d.cts +22 -0
  191. package/dist/components/ui/dialog.d.ts +22 -0
  192. package/dist/components/ui/dialog.js +1 -0
  193. package/dist/components/ui/dropdown-menu.cjs +1 -0
  194. package/dist/components/ui/dropdown-menu.d.cts +30 -0
  195. package/dist/components/ui/dropdown-menu.d.ts +30 -0
  196. package/dist/components/ui/dropdown-menu.js +1 -0
  197. package/dist/components/ui/hover-card.cjs +1 -0
  198. package/dist/components/ui/hover-card.d.cts +8 -0
  199. package/dist/components/ui/hover-card.d.ts +8 -0
  200. package/dist/components/ui/hover-card.js +1 -0
  201. package/dist/components/ui/input.cjs +1 -0
  202. package/dist/components/ui/input.d.cts +5 -0
  203. package/dist/components/ui/input.d.ts +5 -0
  204. package/dist/components/ui/input.js +1 -0
  205. package/dist/components/ui/label.cjs +1 -0
  206. package/dist/components/ui/label.d.cts +8 -0
  207. package/dist/components/ui/label.d.ts +8 -0
  208. package/dist/components/ui/label.js +1 -0
  209. package/dist/components/ui/loader.cjs +1 -0
  210. package/dist/components/ui/loader.d.cts +12 -0
  211. package/dist/components/ui/loader.d.ts +12 -0
  212. package/dist/components/ui/loader.js +1 -0
  213. package/dist/components/ui/navigation-menu.cjs +1 -0
  214. package/dist/components/ui/navigation-menu.d.cts +15 -0
  215. package/dist/components/ui/navigation-menu.d.ts +15 -0
  216. package/dist/components/ui/navigation-menu.js +1 -0
  217. package/dist/components/ui/popover.cjs +1 -0
  218. package/dist/components/ui/popover.d.cts +9 -0
  219. package/dist/components/ui/popover.d.ts +9 -0
  220. package/dist/components/ui/popover.js +1 -0
  221. package/dist/components/ui/progress.cjs +1 -0
  222. package/dist/components/ui/progress.d.cts +8 -0
  223. package/dist/components/ui/progress.d.ts +8 -0
  224. package/dist/components/ui/progress.js +1 -0
  225. package/dist/components/ui/scroll-area.cjs +1 -0
  226. package/dist/components/ui/scroll-area.d.cts +7 -0
  227. package/dist/components/ui/scroll-area.d.ts +7 -0
  228. package/dist/components/ui/scroll-area.js +1 -0
  229. package/dist/components/ui/select.cjs +1 -0
  230. package/dist/components/ui/select.d.cts +15 -0
  231. package/dist/components/ui/select.d.ts +15 -0
  232. package/dist/components/ui/select.js +1 -0
  233. package/dist/components/ui/separator.cjs +1 -0
  234. package/dist/components/ui/separator.d.cts +6 -0
  235. package/dist/components/ui/separator.d.ts +6 -0
  236. package/dist/components/ui/separator.js +1 -0
  237. package/dist/components/ui/sheet.cjs +1 -0
  238. package/dist/components/ui/sheet.d.cts +29 -0
  239. package/dist/components/ui/sheet.d.ts +29 -0
  240. package/dist/components/ui/sheet.js +1 -0
  241. package/dist/components/ui/skeleton.cjs +1 -0
  242. package/dist/components/ui/skeleton.d.cts +5 -0
  243. package/dist/components/ui/skeleton.d.ts +5 -0
  244. package/dist/components/ui/skeleton.js +1 -0
  245. package/dist/components/ui/slider.cjs +1 -0
  246. package/dist/components/ui/slider.d.cts +6 -0
  247. package/dist/components/ui/slider.d.ts +6 -0
  248. package/dist/components/ui/slider.js +1 -0
  249. package/dist/components/ui/switch.cjs +1 -0
  250. package/dist/components/ui/switch.d.cts +9 -0
  251. package/dist/components/ui/switch.d.ts +9 -0
  252. package/dist/components/ui/switch.js +1 -0
  253. package/dist/components/ui/tabs.cjs +1 -0
  254. package/dist/components/ui/tabs.d.cts +9 -0
  255. package/dist/components/ui/tabs.d.ts +9 -0
  256. package/dist/components/ui/tabs.js +1 -0
  257. package/dist/components/ui/textarea.cjs +1 -0
  258. package/dist/components/ui/textarea.d.cts +5 -0
  259. package/dist/components/ui/textarea.d.ts +5 -0
  260. package/dist/components/ui/textarea.js +1 -0
  261. package/dist/components/ui/toggle.cjs +1 -0
  262. package/dist/components/ui/toggle.d.cts +15 -0
  263. package/dist/components/ui/toggle.d.ts +15 -0
  264. package/dist/components/ui/toggle.js +1 -0
  265. package/dist/components/ui/tooltip.cjs +1 -0
  266. package/dist/components/ui/tooltip.d.cts +9 -0
  267. package/dist/components/ui/tooltip.d.ts +9 -0
  268. package/dist/components/ui/tooltip.js +1 -0
  269. package/dist/config-registry-RSJCAKY5.js +1 -0
  270. package/dist/continue-editing-in-this-client-QBMOFRLL.js +1 -0
  271. package/dist/core-BNe4bA6z.d.cts +5455 -0
  272. package/dist/core-BNe4bA6z.d.ts +5455 -0
  273. package/dist/css-import-modal-NMFRQGCY.js +13 -0
  274. package/dist/db/better-sqlite3.cjs +1 -0
  275. package/dist/db/better-sqlite3.d.cts +16 -0
  276. package/dist/db/better-sqlite3.d.ts +16 -0
  277. package/dist/db/better-sqlite3.js +1 -0
  278. package/dist/db/d1.cjs +1 -0
  279. package/dist/db/d1.d.cts +17 -0
  280. package/dist/db/d1.d.ts +17 -0
  281. package/dist/db/d1.js +1 -0
  282. package/dist/db/libsql.cjs +1 -0
  283. package/dist/db/libsql.d.cts +23 -0
  284. package/dist/db/libsql.d.ts +23 -0
  285. package/dist/db/libsql.js +1 -0
  286. package/dist/db/node-pg.cjs +1 -0
  287. package/dist/db/node-pg.d.cts +21 -0
  288. package/dist/db/node-pg.d.ts +21 -0
  289. package/dist/db/node-pg.js +1 -0
  290. package/dist/db/postgres.cjs +1 -0
  291. package/dist/db/postgres.d.cts +28 -0
  292. package/dist/db/postgres.d.ts +28 -0
  293. package/dist/db/postgres.js +1 -0
  294. package/dist/delete-page-CGR6VXZC.css +1 -0
  295. package/dist/delete-page-FQYTEMBN.js +1 -0
  296. package/dist/digital-asset-manager-PIZMJEMX.js +1 -0
  297. package/dist/digital-asset-manager-PSTDGMY2.css +1 -0
  298. package/dist/dispatch-action-3IV56BNY.js +1 -0
  299. package/dist/duplicate-page-HPPMQRL3.js +1 -0
  300. package/dist/dynamic-page-selector-LFHJQLYY.js +1 -0
  301. package/dist/dynamic-page-selector-SXJQAIGL.css +1 -0
  302. package/dist/edit-url-panel-Q3NJCV55.js +1 -0
  303. package/dist/get-blocks-styles-SLZ5NDUF.js +1 -0
  304. package/dist/get-page-styles-Q4FWW5LX.js +1 -0
  305. package/dist/image-editor-PLXDYVKE.css +1 -0
  306. package/dist/image-editor-RSEHWRGV.js +1 -0
  307. package/dist/json-diff-viewer-FQYK2FUX.js +8 -0
  308. package/dist/lang-panel-57UGEL6B.css +1 -0
  309. package/dist/lang-panel-HH5LEOF4.js +1 -0
  310. package/dist/license-overlay-4Q525E53.js +1 -0
  311. package/dist/log-ai-request-LHPKU2C5.js +1 -0
  312. package/dist/manage-design-tokens-264H25A2.js +1 -0
  313. package/dist/manage-design-tokens-modal-OIWIZ53K.js +1 -0
  314. package/dist/mark-as-template-7TCCEMGC.js +1 -0
  315. package/dist/nested-path-selector-content-N4XN7QUS.js +1 -0
  316. package/dist/nextjs/render-client.cjs +1 -0
  317. package/dist/nextjs/render-client.css +1 -0
  318. package/dist/nextjs/render-client.d.cts +14 -0
  319. package/dist/nextjs/render-client.d.ts +14 -0
  320. package/dist/nextjs/render-client.js +1 -0
  321. package/dist/nextjs/render.cjs +829 -0
  322. package/dist/nextjs/render.d.cts +78 -0
  323. package/dist/nextjs/render.d.ts +78 -0
  324. package/dist/nextjs/render.js +1 -0
  325. package/dist/nextjs/server.cjs +807 -0
  326. package/dist/nextjs/server.d.cts +329 -0
  327. package/dist/nextjs/server.d.ts +329 -0
  328. package/dist/nextjs/server.js +1 -0
  329. package/dist/nextjs.cjs +1 -0
  330. package/dist/nextjs.d.cts +17 -0
  331. package/dist/nextjs.d.ts +17 -0
  332. package/dist/nextjs.js +1 -0
  333. package/dist/no-language-page-content-NQIROTIL.js +1 -0
  334. package/dist/no-language-page-dialog-CWG5PI7N.js +1 -0
  335. package/dist/page-creator-2L6L6EFV.js +1 -0
  336. package/dist/page-lock-7HMG34UJ.js +1 -0
  337. package/dist/page-locked-dialog-ACMWVAZX.js +1 -0
  338. package/dist/page-manager-new-SCZFNGKO.js +1 -0
  339. package/dist/page-manager-new-VWRASZTI.css +1 -0
  340. package/dist/page-manager-search-and-filter-7CHPYAPV.js +1 -0
  341. package/dist/page-manager-sheet-KZZBKQ6M.js +1 -0
  342. package/dist/page-manager-sheet-U5YEB5CS.css +1 -0
  343. package/dist/page-revisions-content-DHPEQ4CA.js +1 -0
  344. package/dist/page-revisions-trigger-XGC4HOTL.js +1 -0
  345. package/dist/pages-DlMX1Lj2.d.cts +21 -0
  346. package/dist/pages-Dol4CXrN.d.ts +21 -0
  347. package/dist/payload/builder.cjs +243 -0
  348. package/dist/payload/builder.css +1 -0
  349. package/dist/payload/builder.d.cts +13 -0
  350. package/dist/payload/builder.d.ts +13 -0
  351. package/dist/payload/builder.js +1 -0
  352. package/dist/payload.cjs +807 -0
  353. package/dist/payload.d.cts +603 -0
  354. package/dist/payload.d.ts +603 -0
  355. package/dist/payload.js +1 -0
  356. package/dist/preview-banner-SDDZGGRW.js +1 -0
  357. package/dist/publish-pages-content-3AZ45DYH.js +1 -0
  358. package/dist/registry.cjs +11 -0
  359. package/dist/registry.d.cts +74 -0
  360. package/dist/registry.d.ts +74 -0
  361. package/dist/registry.js +1 -0
  362. package/dist/relations-DDBTFCMR.js +1 -0
  363. package/dist/revalidate-G2DEOH4Z.js +1 -0
  364. package/dist/rte-widget-modal-7RXFEYHK.js +1 -0
  365. package/dist/save-to-lib-65EGTZE5.js +1 -0
  366. package/dist/schema-IVNMPI4V.js +1 -0
  367. package/dist/schema.sqlite-CYBLikNv.d.cts +5852 -0
  368. package/dist/schema.sqlite-CYBLikNv.d.ts +5852 -0
  369. package/dist/seo-panel-WQ47FNP4.css +1 -0
  370. package/dist/seo-panel-Z6OBXHQ4.js +2 -0
  371. package/dist/server-config-b29G6_aQ.d.cts +116 -0
  372. package/dist/server-config-oPlt3V1X.d.ts +116 -0
  373. package/dist/state-RAP56WXS.js +1 -0
  374. package/dist/take-over-request-EB464ZGU.js +1 -0
  375. package/dist/translation-warning-modal-EES6I2QV.js +1 -0
  376. package/dist/types.cjs +1 -0
  377. package/dist/types.d.cts +38 -0
  378. package/dist/types.d.ts +38 -0
  379. package/dist/types.js +1 -0
  380. package/dist/unmark-as-template-6STMTBP5.js +1 -0
  381. package/dist/unpublish-page-CE3CJK5C.js +1 -0
  382. package/dist/unpublished-partials-modal-OZBWBCLN.js +1 -0
  383. package/dist/utils.cjs +1 -0
  384. package/dist/utils.d.cts +168 -0
  385. package/dist/utils.d.ts +168 -0
  386. package/dist/utils.js +1 -0
  387. package/dist/web-blocks.cjs +1 -0
  388. package/dist/web-blocks.d.cts +3 -0
  389. package/dist/web-blocks.d.ts +3 -0
  390. package/dist/web-blocks.js +1 -0
  391. package/dist/web-preview-EIWOXGPY.js +1 -0
  392. package/package.json +322 -0
@@ -0,0 +1 @@
1
+ import{atom as g,useAtom as m}from"jotai";var u=g({}),e=()=>m(u);import{get as A}from"lodash-es";import{useMemo as n}from"react";var t=(o,r)=>{let[s]=e();return n(()=>A(s,o,r),[s,o,r])},l="google/gemini-3-flash",b=(o,r)=>{let s=t("ai.actionModels",{});return n(()=>{let i=o.toUpperCase();for(let[p,c]of Object.entries(s))if(c.some(a=>a.toUpperCase()===i))return p;return r||l},[s,o,r])},C=()=>t("apiUrl","/chai/api"),O=()=>t("websocket",null);export{e as a,t as b,b as c,C as d,O as e};
@@ -0,0 +1 @@
1
+ import{b as Is}from"./chunk-34HIOUTE.js";import{a as Ps}from"./chunk-CA5PVX24.js";import{a as Hs}from"./chunk-MEROMQQX.js";import{a as Cs}from"./chunk-SYPALJAE.js";import{a as we,c as Ne,d as qn,e as Do,f as Qn,g as $n,i as Eo,j as Ro,l as Ot,m as hs,n as bs,o as Sr,p as xs,q as Ar,t as Os,u as Rs,v as Us,w as Fs}from"./chunk-F2V4N3LT.js";import{d as Ls}from"./chunk-R5ZTCDFD.js";import{a as mt}from"./chunk-ZU2B5YT6.js";import{b as dr,c as fr,d as Tr,e as Ns}from"./chunk-IUACZ3E6.js";import{a as Pr,b as ts,c as It,d as os}from"./chunk-5ZC65NB6.js";import{a as _t}from"./chunk-JBB5IJFA.js";import{a as vs}from"./chunk-IAKCX2WB.js";import{a as so}from"./chunk-ZXKKBKGV.js";import{a as Wo}from"./chunk-K5YWQY4U.js";import{b as Ho}from"./chunk-ATLMLDBS.js";import{a as Br}from"./chunk-ROQRBSK6.js";import{b as Bo}from"./chunk-D5SKCKSB.js";import{a as Yn,b as Uo}from"./chunk-2PJZUYIZ.js";import{C as xr,E as ct,a as Oe,j as br,p as Fn,u as Gn,v as Hn,w as Wn,z as Ye}from"./chunk-LNV5MRGV.js";import{a as Un}from"./chunk-7EXZXKW2.js";import{a as ks,b as ws,f as Go}from"./chunk-VL5WBPVV.js";import{a as So,b as hr,c as yr,h as $e}from"./chunk-GJOOCKUE.js";import{a as Rt}from"./chunk-FOKGOT6B.js";import{d as gr}from"./chunk-CJP3BQH2.js";import{a as Mn,b as _n,c as ur,d as Ln,f as ke,g as he,h as On,i as Rn}from"./chunk-PQHFT4TE.js";import{a as Jt,b as mr,c as Pt,e as pr,f as Dn,g as En}from"./chunk-YEFMD4DS.js";import{a as ht}from"./chunk-T2YYNX6Z.js";import{a as Tn,b as cr,c as Bn,d as Xt,e as ne}from"./chunk-AOJE5WI3.js";import{n as Nr}from"./chunk-LRJREWRD.js";import{H as dt,R as Te,U as Pn,Z as ge,ba as ae,c as mn,ca as In,d as pn,da as Sn,i as un,ia as Be,j as dn,ja as ft,k as fn,ka as gt,l as gn,m as hn,n as yn,o as bn,p as xn,q as vn,ua as No,va as Po,w as Cn,wa as oe,xa as Ce,y as wo}from"./chunk-2NYUIXUX.js";import{a as Ge}from"./chunk-WHPIYGCY.js";import{a as E}from"./chunk-WEVKAJMV.js";import{a as ss}from"./chunk-YQPOFRXU.js";import{a as Fo}from"./chunk-55SU3QPU.js";import{a as Io,b as lt,c as An,d as ee}from"./chunk-ZAU65LBG.js";import{a as vr}from"./chunk-IH562KSP.js";import{a as Vn,b as Kn,c as kr,d as wr}from"./chunk-FERH2TPR.js";import{a as Lt}from"./chunk-ODSL3KXG.js";import{b as an,c as ln,d as cn}from"./chunk-TVF77C53.js";import{a as $t,b as Yt,d as jt}from"./chunk-777N6WHB.js";import{a as rs}from"./chunk-OJJDRACB.js";import{a as ys}from"./chunk-N7Z4RFFI.js";import{a as eo,b as Zn,c as to,d as oo,g as ro,h as es,i as no}from"./chunk-WSQ5SQBD.js";import{a as Mt}from"./chunk-J7Q62EP7.js";import{a as Ss,b as As,e as Ts,g as Bs,h as Ds,i as Es,j as ao,m as Ms,n as _s}from"./chunk-I7ODKVVX.js";import{a as fe,f as Ae,g as qe,h as wt,i as Qe,j as it}from"./chunk-RBDZDQZR.js";import{a as Re,b as Ue,d as Mo,e as _o,g as Lo,h as Oo,i as Fe,j as O,k as Zt,m as je,n as Xe}from"./chunk-4VNLL2IA.js";import{a as jn,b as Xn,c as Jn}from"./chunk-FLSV2QGU.js";import{a as Ao}from"./chunk-2N4IJZOR.js";import{a as et}from"./chunk-4JBHWPMO.js";import{a as is,b as ls,e as cs,f as ms,g as ps,h as us,i as ds,j as fs,k as gs}from"./chunk-BWORNCTE.js";import{b}from"./chunk-3IT7IIAV.js";import{a as kt,b as Ke,c as Co}from"./chunk-IP4JBQOX.js";import{a as Gs}from"./chunk-BYGD5CDT.js";import{a as ie}from"./chunk-CRJENCPR.js";import{c as ns}from"./chunk-6M7V7BOM.js";import{c as as,j as Ir}from"./chunk-VUWHFLT7.js";import{a as Ze,b as To,d as Cr,e as zn}from"./chunk-OR7KKUYT.js";import{a as ko,c as Le}from"./chunk-VKSRWZCO.js";import{b as Nt,c as kn,f as lr,g as wn,j as Nn}from"./chunk-3UEPBBE4.js";import{noop as fd}from"lodash-es";import{Plus as gd}from"lucide-react";import{lazy as nr,startTransition as nn,Suspense as hd,useEffect as yo,useState as st}from"react";import{useTranslation as yd}from"react-i18next";import{toast as bd}from"sonner";import{useQueryClient as Ju}from"@tanstack/react-query";import{BookOpen as Zu,FileText as ed,Wand2Icon as Fi}from"lucide-react";import{useCallback as td,useEffect as od,useRef as Gi,useState as Qt}from"react";import{useTranslation as en}from"react-i18next";import{toast as ze}from"sonner";import{useQuery as Qi,useQueryClient as $i}from"@tanstack/react-query";var Dr=()=>{let[e]=ht(),t=e.get("page"),o=ee(),r=ne(),n=$i(),{data:a}=ke(),{data:s}=he(),l=mr(),i=Mn();return Qi({queryKey:[E.GET_PAGE_ALL_DATA,t,s==null?void 0:s.id,i],staleTime:1/0,gcTime:0,queryFn:async()=>{let g=await r(o,{action:E.GET_PAGE_ALL_DATA,data:{id:t,lang:(s==null?void 0:s.lang)||l,pageType:a==null?void 0:a.pageType,pageProps:{slug:(s==null?void 0:s.slug)+(i?`/${i}`:""),searchParams:{},pageType:s==null?void 0:s.pageType,fallbackLang:l,lastSaved:s==null?void 0:s.lastSaved,pageId:a==null?void 0:a.id,primaryPageId:(s==null?void 0:s.primaryPage)||(a==null?void 0:a.id),pageBaseSlug:s==null?void 0:s.slug,dynamic:a==null?void 0:a.dynamic,languagePageId:s==null?void 0:s.id,metadata:(a==null?void 0:a.metadata)||{}}}});return n.setQueryData([E.GET_BUILDER_PAGE_DATA,s==null?void 0:s.id,i],g.builderPageData),n.setQueryData([E.GET_LANGUAGE_PAGES,t],g.languagePages),n.setQueryData([E.GET_SITE_GLOBAL_DATA,(s==null?void 0:s.lang)||l],g.siteGlobalData),g},enabled:!!t&&!!(a!=null&&a.pageType)&&!!(s!=null&&s.id)})};import{useCallback as Yi}from"react";var Er=()=>{let e=Un();return Yi(({pageId:t})=>{e(t)},[e])};import{useQueryClient as Ws}from"@tanstack/react-query";import{useCallback as zs}from"react";var ji=()=>{let{savePageAsync:e}=Te(),t=Ws(),{isLocked:o}=$e();return zs(async()=>{o||await e(),t.invalidateQueries({queryKey:[E.GET_PAGE_ALL_DATA]}),t.invalidateQueries({queryKey:[E.GET_BUILDER_PAGE_DATA]})},[e,t,o])},Xi=()=>{let e=Ws();return zs(()=>{e.clear()},[e])};import{useMutation as Ji,useQueryClient as Zi}from"@tanstack/react-query";var el=()=>{let e=ee(),t=ne(),{data:o}=he(),r=Zi();return Ji({mutationFn:async n=>{if(!(o!=null&&o.id))throw new Error("No active page found");return await t(`${e}`,{action:E.UPDATE_PAGE_METADATA,data:{id:o.id,metadata:n}})},onSuccess:()=>{r.invalidateQueries({queryKey:[E.GET_BUILDER_PAGE_DATA]}),r.invalidateQueries({queryKey:[E.GET_LANGUAGE_PAGES]})},onError:()=>{console.error("Failed to update metadata")}})};import{QueryClient as Mu,QueryClientProvider as _u}from"@tanstack/react-query";import{useAtom as Lu}from"jotai";import{cloneDeep as Ou,get as qt,pick as Ru}from"lodash-es";import{lazy as Et,Suspense as _i,useEffect as or,useMemo as Kt,useRef as Uu,useState as Oi}from"react";import{ChevronRight as sa}from"lucide-react";import{useSetAtom as rl}from"jotai";import{get as Ks}from"lodash-es";import{File as nl,Hash as sl,MoreVertical as qs}from"lucide-react";import{lazy as At,Suspense as St,useState as Ut}from"react";import{jsx as Mr,jsxs as ol}from"react/jsx-runtime";var tl=({hasDynamicPage:e,isLangMissing:t=!1})=>Mr(kt,{children:ol("div",{className:"flex min-w-[300px] max-w-[400px] flex-col items-center justify-center rounded-lg border bg-surface p-4 shadow-lg",children:[Mr("h1",{className:"text-lg font-medium",children:t?"Language content missing":e?"Select a page":"No pages found"}),Mr("p",{className:"pt-2 text-center text-sm font-light text-muted-foreground",children:t?"No translated version found for the selected page. Choose a different page or create content in your CMS.":e?"Please select a page from the list in the top header. This will enable you to edit the page.":"Please add a new page"})]})}),Vs=tl;import{Fragment as fl,jsx as J,jsxs as zo}from"react/jsx-runtime";var al=At(()=>import("./add-new-page-LBHXICXO.js")),il=At(()=>import("./delete-page-FQYTEMBN.js")),ll=At(()=>import("./duplicate-page-HPPMQRL3.js")),cl=At(()=>import("./mark-as-template-7TCCEMGC.js")),ml=At(()=>import("./unmark-as-template-6STMTBP5.js")),pl=At(()=>import("./unpublish-page-CE3CJK5C.js")),ul=At(()=>import("./dynamic-page-selector-LFHJQLYY.js")),dl=()=>{var n;let{dynamicPage:e,allLangPages:t,isLangMissing:o}=_n(),r=((n=t==null?void 0:t.length)!=null?n:0)>0;return zo("div",{className:"relative",children:[(!e||o)&&J(Vs,{hasDynamicPage:r,isLangMissing:o}),J(St,{children:J(ul,{})})]})},Qs=()=>{var I;let[e,t]=Ut(null),[o,r]=Ut(null),[n,a]=Ut(null),[s,l]=Ut(null),[i,g]=Ut(null),[h,d]=Ut(null),{data:p,isFetching:y}=he(),{selectedLang:c,fallbackLang:N}=Ce(),{data:k}=ur(),D=k==null?void 0:k.find(u=>u.lang===c),{isLocked:_}=$e(),R=!(p!=null&&p.slug),U=rl(vs),W=Ks(p,"dynamic",!1);if(!p)return null;let z=u=>{c.length>0&&c!==N?U({edit:!0,id:u==null?void 0:u.id,primaryPage:u==null?void 0:u.primaryPage}):d(u)};return zo(fl,{children:[zo("div",{className:"flex items-center justify-between gap-1 rounded px-[2px] transition-colors duration-200",children:[!W&&J("p",{className:"flex h-7 max-w-[200px] items-center truncate rounded px-1 text-xs font-medium",children:y?J(Ke,{className:"h-4 w-4 text-muted-foreground"}):zo(b,{variant:"ghost",size:"sm",className:"px-0 hover:bg-transparent",children:[R?J(sl,{className:"!h-3.5 !w-3.5"}):J(nl,{className:"!h-3.5 !w-3.5"}),(I=Ks(D||p,"name"))!=null?I:""]})}),W&&J(dl,{}),!W&&(_?J(b,{variant:"ghost",size:"icon-xs",children:J(qs,{className:"!h-3.5 !w-3.5"})}):J(Cs,{page:p,setDuplicatePage:u=>g(u),setAddEditPage:u=>z(u),setUnpublishPage:u=>r(u),setDeletePage:u=>t(u),isLanguagePage:c.length>0&&c!==N,children:J(b,{variant:"ghost",size:"icon-xs",children:J(qs,{className:"!h-3.5 !w-3.5"})})}))]}),h&&J(St,{children:J(al,{closePanel:()=>d(null),editPage:()=>{},addEditPage:h,setAddEditPage:d})}),e&&J(St,{children:J(il,{page:e,onClose:()=>t(null)})}),o&&J(St,{children:J(pl,{page:o,onClose:()=>r(null)})}),n&&J(St,{children:J(cl,{page:n,onClose:()=>a(null)})}),s&&J(St,{children:J(ml,{page:s,onClose:()=>l(null)})}),i&&J(St,{children:J(ll,{page:i,onClose:()=>g(null),closePanel:()=>d(null)})})]})};import{compact as Zs,isEmpty as Il,upperCase as ea}from"lodash-es";import{CheckCircle as Sl,ChevronDown as Al,CirclePlay as Tl,ExternalLink as Bl,Eye as Dl,Layers as El,Palette as Ml,RotateCcw as _l,Save as Ll,Send as Ol,TriangleAlert as Rl}from"lucide-react";import{lazy as io,Suspense as Ft,useCallback as Gt,useEffect as Ul,useMemo as oa,useState as De}from"react";import{useTranslation as lo}from"react-i18next";import{ExclamationTriangleIcon as gl}from"@radix-ui/react-icons";import{ExternalLink as hl}from"lucide-react";import{useTranslation as Ys}from"react-i18next";import{jsx as tt,jsxs as He}from"react/jsx-runtime";var _r=({isOpen:e,onClose:t,onContinue:o,errors:r,actionLabel:n})=>{let{t:a}=Ys(),[,s]=ae(),l=oe("gotoPage",c=>{}),{selectedLang:i,fallbackLang:g}=Ce(),h=r.filter(c=>c.severity==="error"),d=r.filter(c=>c.severity==="warning"),p=c=>{c.blockId&&(s([c.blockId]),t())},y=c=>{c.partialBlockId&&(l({pageId:c.partialBlockId,lang:i||g}),t())};return tt(fe,{open:e,onOpenChange:c=>!c&&t(),children:He(Ae,{className:"sm:max-w-md",children:[He(qe,{children:[He(Qe,{className:"flex items-center gap-2",children:[tt(gl,{className:"h-5 w-5 text-orange-500"}),a("Page Validation Issues")]}),tt(it,{children:a("The following issues were found on this page. You can fix them or continue anyway.")})]}),He("div",{className:"max-h-64 space-y-2 overflow-y-auto",children:[h.length>0&&He("div",{className:"space-y-1",children:[He("h4",{className:"text-xs font-semibold text-red-600",children:[a("Errors")," (",h.length,")"]}),h.map(c=>tt($s,{error:c,onNavigate:p,onOpenPartial:y},c.id))]}),d.length>0&&He("div",{className:"space-y-1",children:[He("h4",{className:"text-xs font-semibold text-orange-600",children:[a("Warnings")," (",d.length,")"]}),d.map(c=>tt($s,{error:c,onNavigate:p,onOpenPartial:y},c.id))]})]}),He(wt,{className:"gap-2 sm:gap-0",children:[tt(b,{variant:"outline",size:"sm",onClick:t,children:a("Cancel")}),tt(b,{size:"sm",onClick:o,children:n})]})]})})},$s=({error:e,onNavigate:t,onOpenPartial:o})=>{let{t:r}=Ys(),n=e.severity==="error",a=!!e.partialBlockId;return He("div",{className:`rounded p-2 text-xs ${n?"border border-red-200 bg-red-50 text-red-700":"border border-orange-200 bg-orange-50 text-orange-700"}`,children:[tt("div",{className:"mb-1",children:e.message}),He("div",{className:"flex items-center gap-2",children:[e.blockId&&!a&&tt("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs font-medium underline hover:no-underline",children:r("Go to block")}),a&&He("button",{type:"button",onClick:()=>o(e),className:"inline-flex items-center gap-1 text-xs font-medium underline hover:no-underline",children:[tt(hl,{className:"h-3 w-3"}),r("Open partial block")]})]})]})};import{useAtom as Tt}from"jotai";var yt=()=>{let[e]=Tt(un),[t]=Tt(dn),[o]=Tt(fn),[r]=Tt(gn),[n]=Tt(hn),[a]=Tt(yn),[s]=Tt(bn);return{errors:e,isValid:t,hasErrors:o,hasWarnings:r,errorCount:n,warningCount:a,errorsByBlock:s,getBlockErrors:l=>s[l]||[],getErrorsBySeverity:l=>e.filter(i=>i.severity===l),getErrorMessages:()=>e.map(l=>l.message),getErrorMessagesBySeverity:l=>e.filter(i=>i.severity===l).map(i=>i.message),getAllErrorMessages:()=>({errors:e.filter(l=>l.severity==="error").map(l=>l.message),warnings:e.filter(l=>l.severity==="warning").map(l=>l.message)})}};import{lazy as yl,Suspense as bl}from"react";import{jsx as Vo}from"react/jsx-runtime";var xl=yl(()=>import("./publish-pages-content-3AZ45DYH.js"));function Lr({showModal:e=!1,onClose:t=()=>console.log("Cancelled")}){let{mutate:o,isPending:r}=Go();return Vo(fe,{open:e,onOpenChange:r?()=>{}:t,children:e&&Vo(bl,{fallback:Vo("div",{className:"h-96 w-96 animate-pulse bg-gray-100"}),children:Vo(xl,{onClose:t,isPending:r,publishPage:o})})})}import{compact as js,filter as vl,find as Cl,get as kl,isEmpty as wl,uniq as Nl}from"lodash-es";import{useCallback as Pl}from"react";var Xs=()=>{let[e]=Be(),{data:t}=Pt();return Pl(()=>{if(!t)return{ids:[],names:[],partialBlocksInfo:[]};let r=vl(e,i=>i._type==="PartialBlock"),n=Nl(js(r.map(i=>kl(i,"partialBlockId","")))),a=js(n.map(i=>{let g=Cl(t,{id:i});if(!g)return null;if(g.online){if(!wl(g.changes))return{id:g.id,name:g.name||g.slug||g.id,status:"unpublished_changes"}}else return{id:g.id,name:g.name||g.slug||g.id,status:"unpublished"};return null})),s=a.map(i=>i.id),l=a.map(i=>i.name);return{ids:s,names:l,partialBlocksInfo:a}},[e,t])};var Js=()=>{let{data:e,isLoading:t}=Jt(),o=e==null?void 0:e.appChanges,r=o==null?void 0:o.includes("THEME"),n=o==null?void 0:o.includes("DESIGN_TOKENS");return{hasUnpublishedSettings:r||n,hasUnpublishedTheme:r,hasUnpublishedDesignToken:n,isLoading:t}};import{Fragment as Ht,jsx as w,jsxs as pe}from"react/jsx-runtime";var Fl=io(()=>import("./unpublish-page-CE3CJK5C.js")),Gl=io(()=>import("./translation-warning-modal-EES6I2QV.js")),Hl=io(()=>import("./unpublished-partials-modal-OZBWBCLN.js")),ta=io(()=>import("./json-diff-viewer-FQYK2FUX.js")),Wl=io(()=>import("./page-revisions-trigger-XGC4HOTL.js")),zl=()=>{let{t:e}=lo(),t=Rn();return pe(Ht,{children:[w(Ge,{content:e("Open preview in new tab"),delayDuration:0,children:w("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:w(b,{variant:"ghost",size:"icon-sm",children:w(Tl,{className:"h-4 w-4"})})})}),w("div",{className:"h-4 w-px border-l bg-transparent"})]})},Vl=()=>{let{t:e}=lo(),[t,o]=gr();return pe(Ht,{children:[w(Ge,{content:e("Theme"),delayDuration:0,children:w(b,{variant:t==="theme"?"outline":"ghost",size:"icon-sm",onClick:()=>o(t==="theme"?"block":"theme"),children:w(Ml,{className:"h-4 w-4"})})}),w("div",{className:"h-4 w-px border-l bg-transparent"})]})},Kl=()=>{let{t:e}=lo(),[t,o]=De(!1),{isLocked:r}=$e(),{savePageAsync:n,saveState:a}=Te(),{errors:s,hasErrors:l,hasWarnings:i}=yt(),[g,h]=De(!1);Ul(()=>{let D=_=>{a==="UNSAVED"&&(_.preventDefault(),_.returnValue=!1)};return a==="UNSAVED"&&window.addEventListener("beforeunload",D),()=>{window.removeEventListener("beforeunload",D)}},[a]);let d=Gt(async()=>{if(!t){o(!0);try{await n()}finally{o(!1)}}},[n,t]),p=Gt(async()=>{if(l||i){h(!0);return}await d()},[l,i,d]),y=Gt(async()=>{h(!1),await d()},[d]),{buttonIcon:c,buttonClass:N,tooltipContent:k}=oa(()=>{switch(a){case"UNSAVED":return{tooltipContent:e("Save draft"),buttonIcon:w(Ll,{className:"h-4 w-4"}),buttonClass:"bg-accent"};case"SAVING":return{tooltipContent:e("Saving"),buttonIcon:w(Ke,{className:"h-4 w-4"}),buttonClass:""};case"SAVED":return{tooltipContent:e("Saved"),buttonIcon:w(Sl,{className:"h-4 w-4"}),buttonClass:"text-success bg-success/10 hover:bg-success/10 hover:text-success"}}},[a,e]);return r?null:pe(Ht,{children:[w(Ge,{content:k,children:w(b,{size:"icon-sm",variant:"ghost",onClick:p,className:`${N}`,children:c})}),w(_r,{isOpen:g,onClose:()=>h(!1),onContinue:y,errors:s,actionLabel:e("Save anyway")})]})},ql=()=>{let{t:e}=lo(),t=lt("flags.bulkPublish",!1),{selectedLang:o}=Ce(),{data:r}=he(),n=Xs(),[a,s]=De(!1),[,l]=De(!1),[i,g]=De(null),[h,d]=De(!1),{savePageAsync:p}=Te(),[y,c]=De(!1),{hasUnpublishedSettings:N,hasUnpublishedTheme:k,hasUnpublishedDesignToken:D}=Js(),[_,R]=De(!1),[U,W]=De([]),[z,I]=De([]),[u,H]=De(null),{errors:F,hasErrors:f,hasWarnings:P}=yt(),[m,T]=De(!1),C=ks(),[V,j]=De(!1),{data:M}=ke(),{mutate:le,isPending:K}=Go(),{needTranslations:Me}=Te(),B=Me(),{buttonText:v,buttonClassName:S,isPublished:X,hasUnpublishedChanges:me}=oa(()=>{let Se=M&&(M==null?void 0:M.online),at=!Il(M==null?void 0:M.changes),vo=Se?"hover:bg-success/80 bg-success":"",sn=e(Se?"Published":"Publish");return Se&&at&&(vo="hover:bg-blue-600 bg-blue-500",sn=e("Publish")),{buttonClassName:vo,isPublished:Se,hasUnpublishedChanges:at,buttonText:sn}},[M,e]),ve=Gt(Se=>{let{ids:at,partialBlocksInfo:vo}=n();at.length>0?(W(at),I(vo),R(!0)):le({ids:Zs(Se)},{onSuccess:()=>so("TOP_RIGHT")})},[n,le]),Ve=Gt(()=>{if(B){c(!0);return}ve([r==null?void 0:r.id,r==null?void 0:r.primaryPage])},[B,ve,r]),_e=async()=>{if(f||P){T(!0);return}Ve()},Ct=()=>{T(!1),Ve()},q=Se=>{let at=[r==null?void 0:r.id,r==null?void 0:r.primaryPage,...Array.isArray(Se)?Se:[]];le({ids:Zs(at)},{onSuccess:()=>so("TOP_RIGHT")})},ut=()=>{R(!1),q(U),W([]),I([])},sr=()=>{R(!1),W([]),I([])},ar=Gt((Se,at)=>{H({id:Se,name:at})},[]),ir=()=>{c(!1),ve([r==null?void 0:r.id,r==null?void 0:r.primaryPage])},xo=async()=>{c(!1),await p()};return pe(Ht,{children:[pe("div",{className:"flex pl-0.5",children:[pe(b,{size:"sm",onClick:_e,loading:K,disabled:K||!(M!=null&&M.id),className:`rounded-r-none duration-300 ${S}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[v,o?`(${ea(o)})`:""]}),pe(Re,{children:[w(Ue,{asChild:!0,children:pe(b,{size:"sm",disabled:K||!(M!=null&&M.id),className:`relative rounded-l-none border-l-[0.5px] border-border px-1.5 text-foreground ${N?"bg-muted/60 hover:bg-muted/90":S}`,children:[w(Al,{className:"h-3 w-3 text-current"}),N&&w("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-warning"})]})}),pe(Fe,{align:"end",className:"w-max",children:[w(je,{children:e("Page")}),X&&me&&pe(O,{onClick:()=>d(!0),className:"cursor-pointer text-xs",children:[w(Dl,{className:"h-3 w-3"}),e("View Unpublished changes")]}),!X&&pe(O,{disabled:K,className:"cursor-pointer text-xs",onClick:()=>ve([M==null?void 0:M.id]),children:[w(Ol,{className:"mr-0.5 h-3 w-3"}),e("Publish")," page"]}),t&&pe(O,{onClick:()=>s(!0),className:"cursor-pointer text-xs",children:[w(El,{className:"mr-0.5 h-3 w-3"}),e("Open publish menu")]}),X&&pe(O,{onClick:()=>g(r),className:"cursor-pointer text-xs",children:[w(Rl,{className:"mr-0.5 h-3 w-3"}),e("Unpublish")," page ",o?`(${ea(o)})`:""]}),N&&pe(Ht,{children:[w(Xe,{className:"bg-border"}),w(je,{children:e("Unpublished website settings")})]}),k&&w(O,{disabled:K,className:"cursor-pointer text-xs",onClick:()=>le({ids:["THEME"]},{onSuccess:()=>so("TOP_RIGHT")}),children:pe("span",{className:"flex h-full w-full items-center gap-2",children:[w("span",{className:"mt-0.5 h-1 w-1 animate-pulse rounded-full bg-orange-500"}),e("Publish")," theme"]})}),D&&w(O,{disabled:K,className:"cursor-pointer text-xs",onClick:()=>le({ids:["DESIGN_TOKENS"]},{onSuccess:()=>so("TOP_RIGHT")}),children:pe("span",{className:"flex h-full w-full items-center gap-2",children:[w("span",{className:"mt-0.5 h-1 w-1 animate-pulse rounded-full bg-orange-500"}),e("Publish")," design token"]})}),C&&pe(Ht,{children:[w(Xe,{className:"bg-border"}),w(je,{children:e("Revisions")}),pe(O,{disabled:K,className:"cursor-pointer text-xs",onClick:()=>j(!0),children:[w(_l,{className:"h-3 w-3"}),e("View revisions")]})]})]})]})]}),w(Lr,{showModal:a,onClose:()=>s(!1)}),i&&w(Ft,{children:w(Fl,{page:i,onClose:()=>g(null)})}),h&&w(Ft,{children:w(ta,{open:h,onOpenChange:d,compare:[{label:"live",uid:`live:${M==null?void 0:M.id}`,item:{}},{label:"draft",uid:`draft:${M==null?void 0:M.id}`,item:M}]})}),y&&w(Ft,{children:w(Gl,{isOpen:y,onClose:xo,onContinue:ir,isPending:K})}),_&&w(Ft,{children:w(Hl,{isOpen:_,onClose:sr,onContinue:ut,onViewChanges:ar,isPending:K,partialBlocksInfo:z})}),u&&w(Ft,{children:w(ta,{open:!!u,onOpenChange:Se=>{Se||(H(null),R(!0))},compare:[{label:"live",uid:`live:${u.id}`,item:{}},{label:"draft",uid:`draft:${u.id}`,item:{}}]})}),V&&w(Ft,{children:w(Wl,{isOpen:V,setIsOpen:j})}),w(_r,{isOpen:m,onClose:()=>T(!1),onContinue:Ct,errors:F,actionLabel:e("Publish anyway")})]})},Ql=()=>{let{t:e}=lo(),{data:t}=ke(),o=On();return(t==null?void 0:t.online)?w(Ge,{content:e("Open live page"),delayDuration:0,children:w("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:w(b,{variant:"ghost",size:"icon-sm",children:w(Bl,{className:"h-4 w-4"})})})}):null};function Or(){let{isLocked:e}=$e(),[t]=ht(),o=t.get("lang"),r=Ps(o);return e||!r?w("div",{}):pe("div",{className:"flex items-center justify-end gap-1",children:[w(Ho,{permission:ie["theme:edit"],children:w(Vl,{})}),w(zl,{}),w(Ho,{permission:ie["pages:update"],children:w(Kl,{})}),w(Ho,{permission:ie["pages:publish"],children:w(ql,{})}),w(Ql,{}),w(ct,{slotId:Oe.TOPBAR_RIGHT})]})}import{Files as $l}from"lucide-react";import{useTranslation as Yl}from"react-i18next";import{jsx as ra,jsxs as Xl}from"react/jsx-runtime";var jl=({children:e})=>{let{t}=Yl(),o=Is(),{savePage:r}=Te(),{isLocked:n}=$e();return ra(Ge,{content:t("Open pages manager"),onClick:()=>{n||r(),o(!0)},children:e||Xl(b,{variant:"ghost",size:"sm",children:[ra($l,{}),t("Pages")]})})},na=jl;import{Fragment as Zl,jsx as Pe,jsxs as Ko}from"react/jsx-runtime";var Jl=()=>{let{isFetching:e}=he(),{isFetching:t}=ke(),o=e||t,r=oe("flags.pagesManager",!0),{languages:n}=Ce(),a=n&&n.length>0;return Pe("div",{className:"relative flex items-center",children:Ko("div",{className:"flex items-center",children:[a&&Ko(Zl,{children:[Pe(Tr,{}),Pe(sa,{"data-testid":"pages-manager-chevron",className:"mx-px h-4 w-4 flex-shrink-0 text-foreground/60"})]}),r&&Pe("div",{className:Le("flex h-7 items-center",o&&"max-w-0 overflow-hidden opacity-0"),children:Pe(na,{})}),r&&Pe(sa,{"data-testid":"pages-manager-chevron",className:"mx-px h-4 w-4 flex-shrink-0 text-foreground/60"}),Pe("div",{className:Le("flex h-7 items-center",o&&"max-w-0 overflow-hidden opacity-0"),children:Pe(Qs,{})})]})})},aa=()=>Ko("div",{className:"grid h-full w-full grid-cols-3 py-1 items-center bg-background px-2",children:[Pe("div",{className:"flex justify-start",children:Pe(Ns,{})}),Ko("div",{className:"flex justify-center",children:[Pe(Jl,{}),Pe(ct,{slotId:Oe.TOPBAR_CENTER})]}),Pe("div",{className:"flex items-center justify-end",children:Pe(Or,{})})]});import{filter as ec,includes as tc,isEmpty as oc}from"lodash-es";import{useMemo as rc}from"react";var ia=e=>rc(()=>{if(!e||oc(e))return{blocks:[]};let t=ec(e,o=>!tc(o==null?void 0:o._type,"@chai/"));return{blocks:Nn(t)}},[e]);import{useMutation as nc}from"@tanstack/react-query";import{toast as sc}from"sonner";var la=()=>{let e=ee(),t=ne(),{handleQuerySync:o}=So();return nc({mutationFn:async r=>t(e,{action:E.UPDATE_WEBSITE_FIELDS,data:r}),onSuccess:(r,n)=>{o({type:"UPDATE_WEBSITE_DATA",data:n,sync:!0})},onError:r=>{sc.error("Failed to update website settings",{description:r.message})}})};import{useQuery as ac}from"@tanstack/react-query";import{noop as ic}from"lodash-es";import{toast as ca}from"sonner";var qo=(e=300)=>{let t=lt("onLogout",ic),o=lt("getAccessToken"),r=ee();return ac({queryKey:["check-user-access"],queryFn:async()=>{let n=await o(),a="check_user_access",s=await Tn(r+(a?`?action=${a}`:""),{action:"CHECK_USER_ACCESS"},{Authorization:`Bearer ${n}`}),l=await s.json();if(s.status===401||cr(l)&&l.error.status===401)throw ca.error("You do not have access to edit this website. Please contact administrator"),await t("UNAUTHORIZED"),new Error("Unauthorized");if(!s.ok||cr(l))throw ca.error("You do not have access to edit this website. Please contact administrator"),await t("UNAUTHORIZED"),new Error("Unauthorized");return Bn(l,s.status)},refetchInterval:e*1e3,refetchIntervalInBackground:!0,retry:!1})};import{useQueryClient as lc}from"@tanstack/react-query";import{get as cc}from"lodash-es";var ma=()=>{let e=ee(),t=ne(),[,o]=Ln(),r=lc(),{handleQuerySync:n}=So(),[a]=Io(),s=cc(a,"flags.draftsInRevisions",!1);return{onSave:async({page:i,blocks:g,needTranslations:h,partialIds:d,linkPageIds:p,designTokens:y})=>{try{let c=await t(e,{action:"UPDATE_PAGE",data:{id:i,blocks:g,needTranslations:h,partialIds:d,linkPageIds:p,designTokens:y,addInRevision:s}});return c.code==="PAGE_LOCKED"?!0:(o(N=>({...N,lastSaved:new Date().toISOString()})),r.invalidateQueries({queryKey:[E.GET_CHANGES],refetchType:"all"}),r.setQueryData([E.GET_LANGUAGE_PAGES,i],N=>N&&(N==null?void 0:N.map(k=>(k==null?void 0:k.id)===i?{...k,changes:["Page"]}:k))),n({type:"UPDATE_PAGE_DATA",data:{pageId:i,partialIds:d,linkPageIds:p,designTokens:y},sync:!0}),c)}catch(c){return console.error(c),new Error("Failed to save blocks")}}}};import{filter as mc,has as pc,isEmpty as uc,startCase as dc}from"lodash-es";import{useCallback as pa}from"react";var ua=()=>{let{data:e}=Pt(),t=ee(),o=ne();return{getPartialBlocks:pa(async()=>{var n,a;let r={};for(let s of e!=null?e:[])uc(s==null?void 0:s.slug)&&(r[s.id]={type:s.pageType,name:dc((n=s.name)!=null?n:s.slug),description:typeof((a=s.metadata)==null?void 0:a.description)=="string"?s.metadata.description:""});return r},[e]),getPartialBlockBlocks:pa(async r=>{if(!r)return[];try{let n=await o(t,{action:"GET_DRAFT_PAGE",data:{id:r,draft:!0,editor:!1,mergePartials:!0}});return mc(n.blocks,a=>pc(a,"_id"))}catch(n){return console.error(n),[]}},[o,t])}};import{Layers as xu,SquarePlus as vu}from"lucide-react";import{CardStackIcon as Jm,PlusIcon as Zm,StackIcon as ep}from"@radix-ui/react-icons";import{useDebouncedCallback as tp}from"@react-hookz/web";import{useAtom as ja}from"jotai";import{first as op,get as rp,isEmpty as Xa}from"lodash-es";import{ChevronsDownUp as np,ChevronsUpDown as sp}from"lucide-react";import{memo as ap,useCallback as We,useEffect as ip,useLayoutEffect as lp,useMemo as cp,useRef as Za,useState as Ja}from"react";import{Tree as mp}from"react-arborist";import{useTranslation as pp}from"react-i18next";import fc from"react";import{jsx as da,jsxs as hc}from"react/jsx-runtime";var gc={display:"flex",alignItems:"center",zIndex:1},fa=fc.memo(function({top:t,left:o,indent:r}){let n={position:"absolute",pointerEvents:"none",top:t-1+"px",left:"0px",right:0,paddingLeft:o+r+"px"};return hc("div",{style:{...gc,...n},children:[da("div",{className:"bg-success h-1 w-1 rounded-full"}),da("div",{className:"border-success h-[1px] flex-1 rounded-[1px] border-t"})]})});var ga=[{key:"ArrowDown",command:"selectNext"},{key:"ArrowUp",command:"selectPrev"},{key:"ArrowLeft",command:"selectParent",when:"isLeaf || isClosed"},{key:"ArrowLeft",command:"close",when:"isOpen"},{key:"ArrowRight",command:"open",when:"isClosed"},{key:"ArrowRight",command:"selectNext",when:"isOpen"},{key:"Home",command:"selectFirst"},{key:"End",command:"selectLast"}];function ha(e){e.firstNode&&e.select(e.firstNode.id)}function ya(e){e.lastNode&&e.select(e.lastNode.id)}function ba(e){let t=e.selectedNodes[0].next||e.firstNode;e.select(t.id)}function xa(e){let t=e.selectedNodes[0].prev||e.lastNode;e.select(t.id)}var va=(e,t)=>{let o=e.selectedNodes[0],r=(o==null?void 0:o.parent)||null;r&&t&&e.select(r.id)},Ca=(e,t)=>{let o=e.selectedNodes[0];o.isInternal&&t&&o.open()},ka=(e,t)=>{let o=e.selectedNodes[0];o.isInternal&&t&&o.close()};import{useAtom as yc}from"jotai";import{filter as Fr,find as wa,isEmpty as bc,noop as xc}from"lodash-es";import{useEffect as Rr,useMemo as vc,useRef as Cc,useState as Qo}from"react";import{useTranslation as kc}from"react-i18next";import{toast as Ur}from"sonner";import{jsx as ye,jsxs as pt}from"react/jsx-runtime";var Na=(e,t)=>{let o=Fr(e,{_parent:t});if(o.length===0)return[];let r=[...o];return o.forEach(n=>{r.push(...Na(e,n==null?void 0:n._id))}),r},Pa=()=>{let{t:e}=kc(),t=Wo(),[o,r]=yc(Po),[n]=Be(),{replaceBlocks:a}=ft(),{data:s}=pr(),{mutateAsync:l,isPending:i}=ws(),{savePageAsync:g}=Te(),h=oe("gotoPage",xc),[d,p]=Qo(""),[y,c]=Qo(""),[N,k]=Qo(""),[D,_]=Qo(null),R=vc(()=>Fr(s,I=>I.hasSlug===!1),[s]),U=Cc(null);Rr(()=>{if(!o.isOpen||!o.blockId||U.current===o.blockId)return;let I=wa(n,{_id:o.blockId});I&&(p(I._name||I._type||""),U.current=o.blockId)},[o.isOpen,o.blockId,n]),Rr(()=>{o.isOpen&&!bc(R)&&!N&&k(R[0].key)},[o.isOpen,R,N]);let W=()=>{r({isOpen:!1,blockId:null}),p(""),c(""),k(""),_(null),U.current=null};Rr(()=>{if(!D)return;(async()=>{await g(!0),Ur.success(e("Partial created successfully")),W(),h({pageId:D})})().catch(u=>console.error("Error saving partial block:",u))},[D]);let z=async()=>{var I;if(!d.trim()){Ur.error(e("Name is required"));return}if(!N){Ur.error(e("Page type is required"));return}try{await g(!0);let u=wa(n,{_id:o.blockId});if(!u)return;let H=[u,...Na(n,u._id)],F=H.map(P=>P._id===u._id?{...P,_parent:null}:{...P}),f=await l({name:d,description:y,pageType:N,slug:"",hasSlug:!1,blocks:F});if((I=f==null?void 0:f.page)!=null&&I.id){let P={_id:ko(),_type:"PartialBlock",_name:d,_parent:u._parent||null,partialBlockId:f.page.id},T=Fr(n,C=>u._parent?C._parent===u._parent:!C._parent).findIndex(C=>C._id===u._id);a(H,[P],u._parent||void 0,T),_(f.page.id)}}catch(u){console.error("Error creating partial block:",u)}};return ye(fe,{open:o.isOpen,onOpenChange:I=>!I&&W(),children:pt(Ae,{className:"sm:max-w-[425px]",children:[pt(qe,{children:[ye(Qe,{children:t}),ye(it,{className:"text-xs text-muted-foreground",children:e("Convert this section into a partial block that can be reused across pages.")})]}),pt("div",{className:"grid gap-3 py-3",children:[R.length>1?pt("div",{className:"grid gap-2",children:[ye(et,{htmlFor:"pageType",children:e("Type")}),pt(eo,{value:N,onValueChange:k,children:[ye(oo,{id:"pageType",children:ye(to,{placeholder:e("Select partial type")})}),ye(ro,{children:pt(Zn,{children:[ye(es,{children:e("Partials")}),R.map(I=>ye(no,{value:I.key,children:typeof I.name=="string"?I.name:I.key},I.key))]})})]})]}):null,pt("div",{className:"grid gap-2",children:[ye(et,{htmlFor:"name",children:e("Name")}),ye(Ao,{id:"name",value:d,onChange:I=>p(I.target.value),placeholder:e("Enter partial name")})]}),pt("div",{className:"grid gap-2",children:[ye(et,{htmlFor:"description",children:e("Description")}),ye(Lt,{id:"description",value:y,onChange:I=>c(I.target.value),rows:3,placeholder:e("Describe what this partial is for. Used by AI to understand when to use it.")})]})]}),pt(wt,{children:[ye(b,{variant:"outline",size:"sm",onClick:W,children:e("Cancel")}),ye(b,{size:"sm",onClick:z,loading:i||!!D,children:t})]})]})})};import{ChevronRightIcon as fm,ExclamationTriangleIcon as gm,EyeOpenIcon as hm,PlusIcon as ym}from"@radix-ui/react-icons";import{atom as bm,useAtom as Fa}from"jotai";import{get as zr,has as xm,isEmpty as vm,startCase as Cm}from"lodash-es";import{EyeOff as km}from"lucide-react";import{memo as wm,useCallback as Nm,useEffect as Ga,useMemo as Yo,useRef as Ha}from"react";import{useTranslation as Wa}from"react-i18next";import{BoxIcon as wc}from"@radix-ui/react-icons";import{get as Nc}from"lodash-es";import Pc from"react";import{jsx as Ic}from"react/jsx-runtime";var Ia="h-3 w-3 flex-shrink-0",co=e=>{let t=kn(),o=Nc(t,[e.type,"icon"]);return o?Pc.createElement(o,{className:Ia}):Ic(wc,{className:Ia})};import{CardStackIcon as Xc,CardStackPlusIcon as Jc,CopyIcon as Zc,EraserIcon as em,EyeClosedIcon as tm,EyeOpenIcon as om,Pencil2Icon as rm,ScissorsIcon as nm,TrashIcon as sm}from"@radix-ui/react-icons";import{useAtom as Ra}from"jotai";import{has as Ua,isEmpty as am}from"lodash-es";import{FrameIcon as im,SquarePlus as _a}from"lucide-react";import{useCallback as Wr,useMemo as lm}from"react";import{useTranslation as Wt}from"react-i18next";import{toast as Hr}from"sonner";import{useAtom as Sc}from"jotai";import{SquareLibrary as Ac}from"lucide-react";import{useTranslation as Tc}from"react-i18next";import{jsx as Bc,jsxs as Dc}from"react/jsx-runtime";var Sa=({MenuItem:e=O})=>{let t=ge(),{t:o}=Tc(),[,r]=Sc(No),n=Wn(),a=()=>{t&&r({isOpen:!0,blockId:t._id})};return n?Dc(e,{className:"flex items-center gap-x-2 text-xs",onClick:a,children:[Bc(Ac,{className:"h-4 w-4"})," ",t!=null&&t._libBlockId?o("Update library block"):o("Save to library")]}):null};import{LinkBreak2Icon as Ec}from"@radix-ui/react-icons";import{useTranslation as Mc}from"react-i18next";import{jsx as _c,jsxs as Lc}from"react/jsx-runtime";var Aa=({MenuItem:e=O})=>{let{t}=Mc(),o=ge(),r=gt();return Lc(e,{onClick:()=>{o&&r([o._id],{_libBlockId:null})},className:"flex items-center gap-x-2 text-xs",children:[_c(Ec,{className:"h-4 w-4"})," ",t("Unlink from library")]})};import{DownloadIcon as Oc}from"@radix-ui/react-icons";import{useTranslation as Rc}from"react-i18next";import{jsx as Uc,jsxs as Fc}from"react/jsx-runtime";var Gr=({MenuItem:e=O})=>{let{t}=Rc(),[o]=ae();return oe("flags.exportCode",!1)?Fc(e,{className:"flex items-center gap-x-2 text-xs",onClick:()=>Ne.publish(we.OPEN_EXPORT_CODE,o),children:[Uc(Oc,{})," ",t("Export")]}):null};import{PackageOpen as Gc}from"lucide-react";import{useCallback as Hc}from"react";import{useTranslation as Wc}from"react-i18next";import{jsx as Vc,jsxs as Kc}from"react/jsx-runtime";var zc=()=>{let e=ge(),[,t]=ae(),{setNewBlocks:o}=ft(),[r]=Be(),n=Hc(()=>{if(!e)return;let s=r.filter(d=>d._parent===e._id),l=e._parent,g=r.filter(d=>l?d._parent===l:!d._parent).findIndex(d=>d._id===e._id),h=[...r];if(s.length>0){let d=s.map(p=>p._id);for(let p=0;p<d.length;p++)h=Pn(h,d[p],l!=null?l:void 0,g+p)}h=In(h,[e._id]),o(h),s.length>0?setTimeout(()=>{t([s[0]._id])},100):t([])},[e,r,o,t]),a=!!e&&e._type==="Box";return{unwrapBlock:n,canUnwrap:a,shouldRender:a}},Ta=({MenuItem:e=O})=>{let{t}=Wc(),{unwrapBlock:o,shouldRender:r}=zc();return r?Kc(e,{onClick:o,className:"flex items-center gap-x-2 text-xs",children:[Vc(Gc,{className:"h-3.5 w-3.5"})," ",t("Unwrap")]}):null};import{BoxIcon as Ba,Link2Icon as Da}from"@radix-ui/react-icons";import{has as qc}from"lodash-es";import{Package as Ea}from"lucide-react";import{useCallback as Qc,useState as $c}from"react";import{useTranslation as Yc}from"react-i18next";import{jsx as bt,jsxs as ot}from"react/jsx-runtime";var jc=()=>{var d,p;let e=ge(),[,t]=ae(),{moveBlocks:o,addBlocks:r}=ft(),[n]=Be(),a=Qc(y=>{if(!e)return;let c=e._parent,k=n.filter(U=>c?U._parent===c:!U._parent).findIndex(U=>U._id===e._id),D=wn(y);qc(D,"content")&&(D.content="");let _=ko(),R={_id:_,_type:y,_parent:c!=null?c:null,_name:y,...D};r([R],c!=null?c:void 0,k!==-1?k:void 0),setTimeout(()=>{o([e._id],_,0),t([_])},100)},[r,o,e,n,t]),s=e!=null&&e._parent&&((d=n.find(y=>y._id===e._parent))==null?void 0:d._type)||"",l=!!e&&e._type!=="BODY",i=(p=e==null?void 0:e._type)!=null?p:"",g=l&&Ze("Box",i)&&Ze(s,"Box"),h=l&&Ze("Link",i)&&Ze(s,"Link");return{canWrapInBox:g,canWrapInLink:h,wrapInBlock:a,shouldRender:g||h}},Ma=({type:e})=>{let{t}=Yc(),[o,r]=$c(!1),{canWrapInBox:n,canWrapInLink:a,wrapInBlock:s,shouldRender:l}=jc();return l?e==="context"?bt("div",{onMouseLeave:()=>r(!1),onMouseEnter:()=>r(!0),children:ot(Ts,{open:o,children:[ot(Bs,{onClick:g=>{g.stopPropagation()},className:"flex cursor-pointer items-center gap-x-2 text-xs",children:[bt(Ea,{className:"h-3.5 w-3.5"})," ",t("Wrap In")]}),ot(Ds,{children:[n&&ot(ao,{onClick:()=>s("Box"),className:"flex cursor-pointer items-center gap-x-2 px-2 py-1 text-xs hover:bg-accent",children:[bt(Ba,{className:"h-3.5 w-3.5"})," ",t("Box")]}),a&&ot(ao,{onClick:()=>s("Link"),className:"flex cursor-pointer items-center gap-x-2 px-2 py-1 text-xs hover:bg-accent",children:[bt(Da,{className:"h-3.5 w-3.5"})," ",t("Link")]})]})]})}):ot(_o,{children:[ot(Lo,{className:"flex items-center gap-x-2 text-xs font-light",children:[bt(Ea,{className:"h-3.5 w-3.5"})," ",t("Wrap with")]}),bt(Mo,{children:ot(Oo,{className:"isolate w-32 rounded-md border-border text-xs shadow-lg",children:[n&&ot(O,{onClick:()=>s("Box"),className:"flex items-center gap-x-2 text-xs",children:[bt(Ba,{className:"h-3.5 w-3.5"})," ",t("Box")]}),a&&ot(O,{onClick:()=>s("Link"),className:"flex items-center gap-x-2 text-xs",children:[bt(Da,{className:"h-3.5 w-3.5"})," ",t("Link")]})]})})]}):null};import{Fragment as rt,jsx as L,jsxs as ce}from"react/jsx-runtime";var cm=({MenuItem:e=O})=>{let t=ge(),[,o]=Ra(Po),r=Wo();return(t==null?void 0:t._type)==="BODY"||(t==null?void 0:t._type)==="PartialBlock"?null:ce(e,{onClick:()=>o({isOpen:!0,blockId:(t==null?void 0:t._id)||null}),className:"flex items-center gap-x-2 text-xs",children:[L(im,{className:"h-3.5 w-3.5"})," ",r]})},La=({isFromBody:e=!1,MenuItem:t=O})=>{let[o]=Be(),[r]=ae(),{pasteBlocks:n}=Eo(),[,a,s]=Qn(),{t:l}=Wt(),i=ge(),g=oe("flags.copyPaste",!0),h=Wr(()=>{var y;let p=(e?(y=o==null?void 0:o.filter(c=>!(c!=null&&c._parent)))==null?void 0:y.map(c=>c==null?void 0:c._id):r).map(c=>{let N=o.find(k=>k._id===c);return{id:c,data:N}});s(p.map(c=>c.id))?Hr.warning("Partial blocks detected. Clone partial blocks?",{cancel:{label:l("No"),onClick:()=>{a(p.map(c=>c.id)),Hr.dismiss()}},action:{label:l("Yes"),onClick:()=>{a(p.map(c=>c.id),!0),Hr.dismiss()}},position:"top-center"}):a(p.map(c=>c.id))},[e,o,r,s,l,a]);return ce(rt,{children:[g&&ce(t,{disabled:i!=null&&i._type?!Cr(i._type):!0,onClick:h,className:"flex items-center gap-x-2 text-xs",children:[L(Zc,{})," ",l("Copy")]}),g&&ce(t,{className:"flex items-center gap-x-2 text-xs",onClick:()=>{n(r)},children:[L(Xc,{})," ",l("Paste")]})]})},mm=({MenuItem:e=O})=>{let[t]=ae(),[,o]=Do(),{t:r}=Wt(),n=oe("flags.copyPaste",!0);return L(rt,{children:n&&ce(e,{className:"flex items-center gap-x-2 text-xs",onClick:()=>o(t),children:[L(nm,{})," ",r("Cut")]})})},pm=({MenuItem:e=O})=>{let[t]=ae(),o=Sn(),r=ge(),{t:n}=Wt();return ce(e,{disabled:!zn(r==null?void 0:r._type),className:"flex items-center gap-x-2 text-xs",onClick:()=>o(t),children:[L(sm,{})," ",n("Remove")]})},um=({node:e,MenuItem:t=O})=>{let{t:o}=Wt();return ce(t,{onClick:r=>{r.stopPropagation(),setTimeout(()=>{e.edit()},200)},className:"flex items-center gap-x-2 text-xs",children:[L(rm,{className:"h-4 w-4"})," ",o("Rename")]})},dm=({MenuItem:e=O})=>{let{t}=Wt(),o=ge(),r=gt(),[n]=Ra(wo),a=Ua(o,"_show")?o._show:!0,s=!a,l=Wr(()=>{if(o){if(a&&n){let i=n.get(o._id);i!=null&&i.isOpen&&i.close()}r([o._id],{_show:!a})}},[o,a,r,n]);return L(e,{onClick:l,className:"flex items-center gap-x-2 text-xs",children:s?ce(rt,{children:[L(om,{className:"h-4 w-4"})," ",t("Show block")]}):ce(rt,{children:[L(tm,{className:"h-4 w-4"})," ",t("Hide block")]})})},Oa=({node:e,MenuItem:t=O,type:o})=>{let{t:r}=Wt(),[n,a]=ae(),s=$n(),l=ge(),{hasPermission:i}=dt(),{librarySite:g}=oe("flags",{librarySite:!1}),h=Wr(()=>{s(n)},[n,s]),d=lm(()=>Ua(l,"_libBlockId")&&!am(l._libBlockId),[l]);return e==="BODY"?L(rt,{children:i(ie["pages:update"])&&ce(rt,{children:[ce(t,{disabled:!1,className:"flex items-center gap-x-2 text-xs",onClick:p=>{p.stopPropagation(),a([]),Ne.publish(we.OPEN_ADD_BLOCK,l)},children:[L(_a,{className:"h-3.5 w-3.5"})," ",r("Add block")]}),i(ie["pages:update"])&&L(La,{isFromBody:!0,MenuItem:t}),L(Gr,{MenuItem:t}),L(t,{disabled:!1,onClick:p=>p.preventDefault(),className:"flex items-center gap-x-2 text-xs",children:L(hs,{children:ce("div",{className:"flex items-center gap-x-2 text-xs",children:[L(em,{})," ",r("Clear canvas")]})})}),L(ct,{slotId:Oe.AFTER_BODY_BLOCK_OPTIONS,context:{MenuItem:t}})]})}):ce(rt,{children:[i(ie["pages:update"])&&ce(rt,{children:[L(Ma,{type:o}),L(Ta,{MenuItem:t}),L(Xe,{})]}),L(cm,{MenuItem:t}),i(ie["library:create"])&&g&&L(Sa,{MenuItem:t}),L(dm,{MenuItem:t}),L(Xe,{}),i(ie["pages:update"])&&ce(rt,{children:[ce(t,{className:"flex items-center gap-x-2 text-xs",disabled:l!=null&&l._type?!To(l._type):!0,onClick:p=>{p.stopPropagation(),a([e.data._id]),Ne.publish(we.OPEN_ADD_BLOCK,e.data)},children:[L(_a,{className:"h-3.5 w-3.5"})," ",r("Add block")]}),ce(t,{disabled:l!=null&&l._type?!Cr(l._type):!0,className:"flex items-center gap-x-2 text-xs",onClick:p=>{p.stopPropagation(),h()},children:[L(Jc,{})," ",r("Duplicate")]})]}),L(um,{node:e,MenuItem:t}),i(ie["pages:update"])&&L(mm,{MenuItem:t}),i(ie["pages:update"])&&L(La,{MenuItem:t}),d&&g&&L(Aa,{MenuItem:t}),L(Gr,{MenuItem:t}),i(ie["pages:update"])&&L(pm,{MenuItem:t}),L(ct,{slotId:Oe.AFTER_BLOCK_OPTIONS,context:{MenuItem:t}})]})},$o=({children:e,id:t,node:o,type:r="option"})=>{let[,n]=ae();return r==="context"?ce(Ss,{children:[L(As,{className:"m-0 h-full p-0",children:e}),ce(Es,{children:[L(Ms,{className:"leading-none",children:"ACTIONS"}),L(_s,{}),L(Oa,{type:r,node:o,MenuItem:ao})]})]}):L(rt,{children:ce(Re,{onOpenChange:a=>{a&&n([t])},children:[L(Ue,{children:e}),L(Fe,{side:"bottom",align:"start",children:L(Oa,{node:o,type:r,MenuItem:O})})]})})};import{Fragment as Am,jsx as Q,jsxs as jo}from"react/jsx-runtime";var Pm=({node:e})=>{var o,r;let{t}=Wa();return Q("input",{autoFocus:!0,className:Ot("ml-1 !h-5 w-full rounded-none border border-primary bg-surface px-1 text-[11px] leading-tight outline-none",e.isSelected?"text-foreground":""),type:"text",defaultValue:((o=e.data)==null?void 0:o._name)||((r=e.data)==null?void 0:r._type),onFocus:n=>n.currentTarget.select(),onBlur:n=>e.submit(n.currentTarget.value),onKeyDown:n=>{n.key==="Enter"&&e.submit(n.currentTarget.value)},placeholder:t("Block name")})},Im=bm(null),Vr=e=>{var t;return e!=null&&e._name?e._name:(e==null?void 0:e._type)==="Box"&&(e!=null&&e.tag)&&(e==null?void 0:e.tag)!=="div"?Cm(e.tag):((t=e==null?void 0:e._type)==null?void 0:t.split("/").pop())||""},Sm=(e,t)=>e.length>t?e.substring(0,t)+"...":e,Kr=wm(({node:e,style:t,dragHandle:o})=>{var Me,B;let{t:r}=Wa(),n=gt(),[a]=Fa(Cn),s=Ha(null),l=Ha(null),{hasPermission:i}=dt();Ga(()=>{s.current=a},[a]);let g=e.children&&e.children.length>0,{highlightBlock:h,clearHighlight:d}=qn(),p=Ro(),{id:y,data:c,isSelected:N,willReceiveDrop:k,isDragging:D,isEditing:_,handleClick:R}=e,U=yt(),W=Yo(()=>U.getBlockErrors(y),[U,y]),z=zr(c,"_show",!0),I=v=>{v.stopPropagation(),!(!z&&!e.isOpen)&&e.toggle()},u=v=>{v.isInternal&&(l.current=v.isOpen,v.isOpen&&v.close())},H=v=>{v.isInternal&&l.current!==null&&(l.current?v.open():v.close(),l.current=null)},[F,f]=Fa(Im),P=()=>{var v,S;m(),(v=e.parent)!=null&&v.isSelected||f((S=e==null?void 0:e.parent)==null?void 0:S.id)},m=()=>{f(null)},T=v=>{m(),v.stopPropagation(),!e.isOpen&&z&&e.toggle(),R(v)};Ga(()=>{let v=setTimeout(()=>{k&&!e.isOpen&&!D&&z&&e.toggle()},500);return()=>clearTimeout(v)},[k,e,D,z]);let C=Nm((v,S)=>{var q;let X=s.current;if(!X)return;let me=X.contentDocument||((q=X.contentWindow)==null?void 0:q.document),ve=me==null?void 0:me.querySelector(`[data-block-id="${v}"]`);ve&&ve.setAttribute("data-drop",S);let Ve=ve.getBoundingClientRect(),_e=X.getBoundingClientRect();if(!(Ve.top>=_e.top&&Ve.left>=_e.left&&Ve.bottom<=_e.bottom&&Ve.right<=_e.right)&&(me!=null&&me.documentElement)){let ut=ve.offsetTop-_e.top;requestAnimationFrame(()=>{me!=null&&me.documentElement&&(me.documentElement.scrollTop=ut)})}},[]),V=v=>{m();let S=zr(e,"parent.id");S!=="__REACT_ARBORIST_INTERNAL_ROOT__"?Ne.publish(we.OPEN_ADD_BLOCK,{_id:S,position:v}):Ne.publish(we.OPEN_ADD_BLOCK,{position:v})},{librarySite:j}=oe("flags",{librarySite:!1}),M=Yo(()=>j&&xm(c,"_libBlockId")&&!vm(c._libBlockId)&&(i(ie["library:create"])||i(ie["library:update"])),[c,i,j]),le=Yo(()=>(c==null?void 0:c._type)==="PartialBlock"||(c==null?void 0:c._type)==="GlobalBlock",[c]),K=Yo(()=>({...t,width:"max-content",minWidth:"var(--tree-scroll-width, 100%)"}),[t]);return y===Nt?null:Q($o,{node:e,id:y,type:"context",children:Q("div",{ref:o,style:K,"data-node-id":y,className:Ot("relative flex h-full items-center justify-start py-1 pr-8 outline-none",N?"bg-primary/20":F?"":"hover:bg-accent"),onMouseEnter:()=>h(y),onMouseLeave:()=>d(),onClick:T,onDragStart:()=>u(e),onDragEnd:()=>H(e),onDragOver:v=>{v.preventDefault(),C(y,"yes")},onDragLeave:v=>{v.preventDefault(),C(y,"no")},onDrop:v=>{v.preventDefault(),C(y,"no")},children:jo("div",{className:"flex h-full w-full min-w-max items-center",children:[e.level>0&&Q("div",{className:"pointer-events-none absolute left-0 top-0 h-full",children:Array.from({length:e.level}).map((v,S)=>Q("div",{className:"absolute top-0 h-full border-l-[0.5px] border-border transition-colors duration-100 group-hover/parent:border-foreground/20",style:{left:`${S*14+10}px`}},S))}),i(ie["pages:update"])&&!p&&(e==null?void 0:e.rowIndex)!==null&&(e==null?void 0:e.rowIndex)!==void 0&&(e==null?void 0:e.rowIndex)>0&&(((Me=e.parent)==null?void 0:Me.isOpen)&&To(zr(e,"parent.data._type"))||((B=e==null?void 0:e.parent)==null?void 0:B.id)==="__REACT_ARBORIST_INTERNAL_ROOT__")&&Q("div",{className:"group absolute -top-0.5 left-0 h-1 w-full rounded opacity-0 transition-colors duration-100 ease-in-out hover:opacity-100",children:Q("div",{onClick:v=>{v.stopPropagation(),V(e.childIndex)},onMouseEnter:P,onMouseLeave:m,className:"h-0.5 w-full rounded bg-primary/80 opacity-0 delay-200 duration-200 group-hover:opacity-100",children:Q("div",{className:"absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer items-center justify-center rounded-full bg-primary/90 p-1 outline outline-2 outline-primary-foreground hover:bg-primary",children:Q(ym,{className:"h-2 w-2 stroke-[2] text-primary-foreground"})})})}),Q("div",{className:"absolute left-0 right-0 top-0 -z-10 h-full",children:Q("div",{className:Ot("h-full transition-colors",k&&Ze(c._type,"Icon")?"bg-success/20":"",(e==null?void 0:e.id)===F?"bg-secondary/10 dark:bg-info/10":"")})}),Q("div",{className:Ot("group/type-icon relative flex w-full items-center justify-between space-x-2 px-1 outline-none",D&&"opacity-20",z?"":"line-through opacity-50",M&&N&&"text-primary"),children:jo("div",{className:"flex items-center",children:[Q("div",{className:`flex h-4 w-4 shrink-0 rotate-0 transform items-center justify-center transition-transform duration-100 ${e.isOpen?"rotate-90":""} ${g?"cursor-pointer":""}`,children:g&&Q("button",{onClick:I,type:"button",children:Q(fm,{className:"h-3 w-3"})})}),jo("div",{className:Ot("flex w-full items-center leading-tight",M&&"text-orange/90",M&&N&&"text-orange",le&&"text-purple/90",le&&N&&"text-purple"),children:[Q("div",{children:W.length>0||z?jo(Am,{children:[W.length>0?Q("div",{className:"text-destructive group-hover/type-icon:hidden",children:Q(gm,{className:"h-3 w-3"})}):Q("div",{className:"group-hover/type-icon:hidden",children:Q(co,{type:c==null?void 0:c._type})}),Q("div",{className:"hidden delay-75 duration-200 group-hover/type-icon:block",children:Q(Ge,{content:r("It will hide block from canvas"),side:"right",children:Q(km,{onClick:v=>{v.stopPropagation(),n([y],{_show:!z}),e.isOpen&&e.toggle()},className:"h-3 w-3 cursor-pointer rounded bg-transparent hover:text-foreground"})})})]}):Q(Ge,{content:r("It will make block visible in canvas"),side:"right",children:Q(hm,{onClick:v=>{v.stopPropagation(),n([y],{_show:!z}),e.isOpen&&e.toggle()},className:"h-3 w-3 cursor-pointer rounded bg-transparent hover:text-foreground"})})}),_?Q(Pm,{node:e}):Q("div",{className:"ml-1.5 flex items-center gap-x-1 truncate text-[13px]",onDoubleClick:v=>{v.stopPropagation(),e.edit()},children:Q("span",{className:"font-light",title:Vr(c).length>26?Vr(c):"",children:Sm(Vr(c),26)})})]})]})})]})})})});Kr.displayName="Node";import{useAtom as Tm}from"jotai";import{filter as Bm,find as Dm,isEmpty as Em}from"lodash-es";import{useMemo as Mm}from"react";import{useTranslation as _m}from"react-i18next";import{jsx as Xo,jsxs as Lm}from"react/jsx-runtime";var Va=(e,t)=>{let o=Bm(e,{_parent:t});if(o.length===0)return[];let r=[...o];return o.forEach(n=>{r.push(...Va(e,n==null?void 0:n._id))}),r},za=Gn,Ka=()=>{let[e,t]=Tm(No),{t:o}=_m(),[r]=Be(),n=()=>t({isOpen:!1,blockId:null}),a=Mm(()=>{if(!e.blockId)return[];let s=Dm(r,{_id:e.blockId});return s==null||delete s._parent,[s,...Va(r,s==null?void 0:s._id)]},[e.blockId,r]);return Xo(fe,{open:e.isOpen,onOpenChange:s=>!s&&n(),children:Lm(Ae,{className:"p-4 sm:max-w-[450px]",children:[Xo(qe,{className:"pb-2",children:Xo(Qe,{children:o("Save to Library")})}),za&&!Em(e.blockId)&&Xo(za,{blockId:e.blockId,blocks:a,close:n})]})})};import{CardStackIcon as Om}from"@radix-ui/react-icons";import{PlusIcon as Rm}from"lucide-react";import{useEffect as Um}from"react";import{useTranslation as Fm}from"react-i18next";import{jsx as zt,jsxs as Jo}from"react/jsx-runtime";var qa=({parentContext:e,setParentContext:t})=>{let{t:o}=Fm(),{hasPermission:r}=dt(),{canPaste:n,pasteBlocks:a}=Eo(),s=oe("flags.copyPaste",!0);return Um(()=>{n("root")||t(null)},[n,t]),!e||!n("root")||!s?null:zt("div",{className:"absolute inset-0",children:Jo(Re,{open:!0,onOpenChange:()=>t(null),children:[zt(Ue,{className:"hidden"}),Jo(Fe,{className:"absolute w-28 p-1 text-xs",style:{top:e.y,left:e.x},children:[zt(je,{children:o("ACTIONS")}),zt(Xe,{}),r(ie["pages:update"])&&Jo(O,{className:"flex items-center gap-x-2 text-xs",onClick:()=>Ne.publish(we.OPEN_ADD_BLOCK,null),children:[zt(Rm,{className:"h-3.5 w-3.5"})," ",o("Add block")]}),Jo(O,{className:"flex items-center gap-x-2 text-xs",onClick:()=>{a("root"),t(null)},children:[zt(Om,{})," ",o("Paste")]})]})]})})};import{useDebouncedCallback as Km}from"@react-hookz/web";import{Filter as qm,X as Qm}from"lucide-react";import{useEffect as $a,useMemo as $m,useRef as Ym,useState as Bt}from"react";import{useTranslation as jm}from"react-i18next";var Gm=/<[^>]*>/g;function Hm(e,t,o){if(!o)return!1;let r=o(e._type);if(!(r!=null&&r.length))return!1;for(let[n,a]of Object.entries(e)){if(typeof a!="string"||!r.some(i=>n===i||n.startsWith(i+"-")))continue;if(a.replace(Gm," ").toLowerCase().includes(t))return!0}return!1}function Wm(e){return"_show"in e&&e._show!==!0}function zm(e){for(let[t,o]of Object.entries(e))if(!t.startsWith("_")){if(typeof o=="string"){if(Ir(o))return!0}else if(o!==null&&typeof o=="object"&&Ir(JSON.stringify(o)))return!0}return!1}function Vm(e){for(let[t,o]of Object.entries(e))if(t.endsWith("_attrs")&&o&&typeof o=="object"&&!Array.isArray(o)&&o["data-animation"])return!0;return!1}function Qa(e,{term:t,types:o,conditionalOnly:r,bindingsOnly:n,animationsOnly:a,fullBlocks:s,getContentProps:l}){if(!t.trim()&&o.length===0&&!r&&!n&&!a)return null;let i=t.toLowerCase(),g=[],h=d=>{var p,y,c;for(let N of d){let k=(p=s==null?void 0:s.get(N._id))!=null?p:N,D=!0,_=!0,R=!0,U=!0,W=!0;t.trim()&&(D=((y=N._name)==null?void 0:y.toLowerCase().includes(i))||((c=N._type)==null?void 0:c.toLowerCase().includes(i))||Hm(k,i,l)),o.length>0&&(_=o.includes(N._type)),r&&(R=Wm(k)),n&&(U=zm(k)),a&&(W=Vm(k)),D&&_&&R&&U&&W&&g.push(N),N.children&&h(N.children)}};return h(e),g}import{Fragment as Xm,jsx as se,jsxs as be}from"react/jsx-runtime";var Ya=({treeData:e})=>{let{t}=jm(),[o,r]=Bt(""),[n,a]=Bt(null),[s,l]=Bt([]),[i,g]=Bt(!1),[h,d]=Bt(!1),[p,y]=Bt(!1),[c,N]=ae(),[,k]=Bo(),D=Ym(null),[_,R]=Bt(80);$a(()=>{if(D.current){let u=D.current.firstElementChild;u&&R(u.getBoundingClientRect().height+u.offsetTop)}},[n]);let U=s.length>0||i||h||p,W=$m(()=>{let u=new Set,H=F=>{for(let f of F)f._type&&u.add(f._type),f.children&&H(f.children)};return H(e),Array.from(u).sort()},[e]),z=()=>{r(""),l([]),g(!1),d(!1),y(!1)},I=Km(({term:u,types:H,conditionalOnly:F,bindingsOnly:f,animationsOnly:P})=>{if(!u.trim()&&H.length===0&&!F&&!f&&!P){a(null);return}let m=new Map(vn().map(T=>[T._id,T]));a(Qa(e,{term:u,types:H,conditionalOnly:F,bindingsOnly:f,animationsOnly:P,fullBlocks:m,getContentProps:T=>{var C,V;return(V=(C=lr(T))==null?void 0:C.i18nProps)!=null?V:[]}}))},[e,a],300);return $a(()=>{I({term:o,types:s,conditionalOnly:i,bindingsOnly:h,animationsOnly:p})},[o,s,i,h,p,I]),be("div",{ref:D,children:[be("div",{className:"flex items-center gap-1 py-2",onClick:u=>u.stopPropagation(),children:[se(Rt,{value:o,setValue:r,autoComplete:"off"}),be(Re,{children:[se(Ue,{asChild:!0,children:be(b,{size:"icon-xs",variant:"outline","aria-label":t("FILTERS"),title:t("FILTERS"),className:Le("relative h-8 w-8",U&&"bg-accent"),children:[se(qm,{className:"h-4 w-4"}),U&&se("span",{className:"absolute right-1.5 top-1.5 flex h-2 w-2 rounded-full bg-primary"})]})}),be(Fe,{align:"start",className:"w-56",children:[se(je,{children:t("FILTERS")}),se(Xe,{}),be(_o,{children:[be(Lo,{children:[se("span",{children:t("Block types")}),s.length>0&&se("span",{className:"ml-auto flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] text-primary-foreground",children:s.length})]}),se(Mo,{children:be(Oo,{children:[se(je,{children:t("BLOCK TYPES")}),se("div",{className:"max-h-64 w-36 overflow-y-auto",children:W.map(u=>be(Zt,{className:"pl-2 pr-6 [&>span]:left-auto [&>span]:right-2",checked:s.includes(u),onCheckedChange:H=>{l(F=>H===!0?F.includes(u)?F:[...F,u]:F.filter(f=>f!==u))},children:[se(co,{type:u})," ",u]},u))})]})})]}),se(Zt,{className:"pl-2 pr-6 [&>span]:left-auto [&>span]:right-2",checked:i,onCheckedChange:u=>g(u===!0),children:t("Conditional")}),se(Zt,{className:"pl-2 pr-6 [&>span]:left-auto [&>span]:right-2",checked:h,onCheckedChange:u=>d(u===!0),children:t("Data binding")}),se(Zt,{className:"pl-2 pr-6 [&>span]:left-auto [&>span]:right-2",checked:p,onCheckedChange:u=>y(u===!0),children:t("Animations")}),U&&be(Xm,{children:[se(Xe,{}),se(O,{onClick:z,className:"text-destructive focus:bg-destructive/10 focus:text-destructive",children:t("Clear filters")})]})]})]})]}),n!==null&&be("div",{className:"absolute inset-x-0 bottom-0 z-50 flex flex-col border-t border-border bg-background py-2",style:{top:`${_}px`},onClick:u=>u.stopPropagation(),children:[be("div",{className:"mb-2 flex items-center justify-between text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:[be("span",{className:"pl-1",children:[t("Search results"),n.length>0?` (${n.length})`:""]}),be(b,{variant:"ghost",size:"xs",onClick:z,className:"text-[10px]",title:t("Clear filters"),children:[se(Qm,{className:"h-3 w-3"})," ",t("Clear filters")]})]}),n.length>0?se("div",{className:"flex flex-1 flex-col overflow-y-auto",style:{scrollbarGutter:"stable"},children:n.map(u=>be("button",{type:"button",onClick:()=>{k([]),N([u._id])},className:Le("flex w-full items-center justify-between space-x-2 rounded-sm px-1 py-1 text-left",c.includes(u._id)?"bg-primary/20":"hover:bg-accent/50 dark:hover:bg-accent"),children:[se("span",{className:"truncate text-xs",children:u._name||u._type}),se("span",{className:"h-max rounded bg-muted p-1 text-[9px] leading-none",children:u._type})]},u._id))}):se("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:t("No matching blocks")})]})]})};import{Fragment as gp,jsx as $,jsxs as xt}from"react/jsx-runtime";var up=()=>We((e,t)=>{let o=xn.get(mn),r=new Map(o.map(s=>[s._id,s])),n=op(e.map(s=>{var l;return(l=r.get(s))==null?void 0:l._type}));if(!t)return!!n;let a=r.get(t);return!a||!n?!1:Ze(a._type,n)},[]),dp=e=>{let t=Za(null),o=We(()=>{let n=document.querySelector('[role="tree"]');if(!n)return;let a=rp(n,"children[0].scrollWidth",0);n.style.setProperty("--tree-scroll-width",`${a}px`)},[]),r=We(()=>{t.current!==null&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(()=>{o(),t.current=null})},[o]);ip(()=>{o()},[e,o]),lp(()=>{let n=document.querySelector('[role="tree"]');if(!n)return;o();let a=new ResizeObserver(r);a.observe(n);let s=new MutationObserver(r);return s.observe(n,{childList:!0,subtree:!0}),()=>{t.current!==null&&cancelAnimationFrame(t.current),a.disconnect(),s.disconnect()}},[o,r])},fp=()=>{let[e]=ja(pn),[t,o]=ae(),[r]=Do(),n=gt(),[,a]=Bo(),{moveBlocks:s}=ft(),l=up(),i=Za(null),[,g]=ja(wo),{t:h}=pp(),[d,p]=Ja(!1);dp(e);let[y,c]=Ja(null),N=We(()=>{o([]),a([])},[o,a]),k=cp(()=>{let f=(m,T)=>m.filter(C=>!T.includes(C._id)).map(C=>({...C,children:C.children?f(C.children,T):[]}));return[...Xa(r)?e:f(e,r),{_type:Nt,_id:Nt,children:[]}]},[e,r]),D=We(({id:f,name:P,node:m})=>{n([f],{_name:P},m.data._name)},[n]),_=We(({dragIds:f,parentId:P,index:m})=>{l(f,P)&&s(f,P!=null?P:void 0,m)},[l,s]),R=We(f=>{if(f.length===0)return;let P=f[0]?f[0].id:"";a([]),o([P])},[a,o]),U=We(()=>{var f;if(i.current){let P=((f=i.current.visibleNodes)==null?void 0:f.some(m=>m.isOpen))||!1;p(P)}},[]),W=We(f=>{var T;f.preventDefault(),y&&c(null);let P=f.target,m=P.getAttribute("data-node-id")||((T=P.closest("[data-node-id]"))==null?void 0:T.getAttribute("data-node-id"));m?(a([]),o([m])):(a([]),o([]),c({x:f.clientX,y:f.clientY}))},[y,a,o]),z=tp(({parentNode:f,dragNodes:P})=>{var m;return(f==null?void 0:f.data._type)===Nt||!Ze(f==null?void 0:f.data._type,(m=P[0])==null?void 0:m.data._type)},[],300),I=We((f,P)=>{if(!f)return!0;let m={isLeaf:!P.isInternal,isClosed:!P.isOpen,isOpen:P.isOpen};try{let T=f;return Object.keys(m).forEach(C=>{let V=new RegExp(`\\b${C}\\b`,"g");T=T.replace(V,String(m[C]))}),new Function(`return ${T}`)()}catch(T){return console.warn("Invalid condition expression:",f),!1}},[]),u=We(f=>{if(!i.current)return;let P=i.current,m=P.selectedNodes[0];if(!m)return;o([m.id]),a([]);let T=!m.isInternal,C=!m.isOpen,V=m.isOpen,j=ga.find(M=>M.key===f.key&&(!M.when||I(M.when,m)));if(j)switch(f.preventDefault(),j.command){case"selectNext":ba(P);break;case"selectPrev":xa(P);break;case"selectParent":va(P,T||C);break;case"close":ka(P,V);break;case"open":Ca(P,C);break;case"selectFirst":ha(P);break;case"selectLast":ya(P);break;default:break}},[o,a,I]),H=We(f=>{i.current=f!=null?f:null,f&&g(f)},[g]),{hasPermission:F}=dt();return Xa(e)?$("div",{children:$("div",{className:"mt-10 flex h-full w-full items-center justify-center p-8",children:xt("div",{className:"flex flex-col items-center space-y-6 text-center",children:[$("div",{className:"rounded-full bg-accent p-6",children:$(ep,{className:"h-12 w-12 text-accent-foreground"})}),xt("div",{className:"space-y-2",children:[$("p",{children:h("This page is empty")}),$("p",{className:"max-w-sm text-xs text-muted-foreground",children:h("Get started by adding your first block to begin building your page")})]}),F(ie["pages:update"])&&xt(b,{onClick:()=>Ne.publish(we.OPEN_ADD_BLOCK),size:"sm",variant:"outline",className:"px-3",children:[$(Zm,{}),h("Add Block")]})]})})}):xt(gp,{children:[$("div",{className:Le("chai-outline group/parent parent-group flex h-full select-none flex-col space-y-1"),onClick:()=>N(),children:xt("div",{id:"outline-view",className:"no-scrollbar h-full overflow-hidden text-sm relative",onKeyDown:f=>{i.current&&!i.current.isEditing&&u(f)},children:[xt("div",{className:"flex items-center justify-between gap-x-1 text-sm text-muted-foreground",children:[$("h3",{className:"font-medium uppercase text-foreground",children:h("Outline")}),xt(an,{children:[$(ln,{asChild:!0,children:$(b,{className:"h-6 w-6 hover:bg-accent",onClick:()=>{var f,P;if(d){(f=i==null?void 0:i.current)==null||f.closeAll(),p(!1);let m=document.querySelector('[role="tree"]');if(!m)return;m.style.setProperty("--tree-scroll-width",`${m.clientWidth}px`)}else(P=i==null?void 0:i.current)==null||P.openAll(),p(!0)},variant:"ghost",size:"icon-sm",children:d?$(np,{className:"h-3 w-3"}):$(sp,{className:"h-3 w-3"})})}),$(cn,{className:"isolate z-[9999]",children:h(d?"Collapse all":"Expand all")})]})]}),$(ct,{slotId:Oe.BEFORE_OUTLINE}),$(Ya,{treeData:k.filter(f=>f._id!==Nt)}),$("div",{className:"mt-2",children:$($o,{node:"BODY",id:"BODY",type:"context",children:$("div",{role:"treeitem","aria-level":0,"aria-selected":!0,"aria-expanded":!1,onClick:()=>o([]),className:"flex min-h-[25px] items-center",children:$("div",{className:Le("group flex h-[25px] w-full cursor-pointer items-center justify-between space-x-px px-2 py-0 outline-none",t.length===0?"bg-primary/20":"hover:bg-accent"),children:xt("div",{className:"flex items-center",children:[$(Jm,{className:"h-3 w-3 flex-shrink-0 rotate-180"}),$("div",{className:"ml-1.5 flex items-center gap-x-1 truncate text-[13px] font-light",children:"Body"})]})})})})}),$(mp,{ref:H,height:window.innerHeight-120,className:"!h-full max-w-full !overflow-x-auto !overflow-y-auto pl-px [&_*]:outline-none",rowClassName:"flex items-center h-full w-full outline-none",selection:t[0]||"",onRename:D,openByDefault:!1,onMove:_,data:k,renderCursor:fa,onSelect:R,onToggle:U,childrenAccessor:f=>f.children,width:"100%",rowHeight:25,renderDragPreview:()=>null,indent:14,onContextMenu:W,disableDrop:z,idAccessor:"_id",children:Kr})]})}),$(Ka,{}),$(Pa,{}),$(qa,{parentContext:y,setParentContext:c})]})},qr=ap(fp);import{ArrowTopRightIcon as SC,ReloadIcon as AC,StopIcon as TC}from"@radix-ui/react-icons";import{first as DC}from"lodash-es";import{useEffect as MC,useRef as _C,useState as LC}from"react";import{useTranslation as RC}from"react-i18next";import{ArrowDownIcon as nC,ArrowUpIcon as sC,ChatBubbleIcon as aC,CheckIcon as iC,FaceIcon as lC,LoopIcon as cC,Pencil2Icon as mC,ShuffleIcon as pC}from"@radix-ui/react-icons";import{get as dC}from"lodash-es";import{useTranslation as gC}from"react-i18next";import{atom as yp,useAtom as Tv}from"jotai";import{cloneDeep as Dv,compact as Ev,filter as Mv,find as _v,flattenDeep as Lv,get as Ov,has as Rv,isEmpty as Uv,isString as Fv,noop as Gv,pick as Hv,startsWith as Wv}from"lodash-es";import{useCallback as Vv,useState as Kv}from"react";var tC=yp(!1);import{jsx as CC,jsxs as kC}from"react/jsx-runtime";import{jsx as qC,jsxs as QC}from"react/jsx-runtime";import{MoonIcon as XC,SunIcon as JC}from"@radix-ui/react-icons";import{jsx as ok,jsxs as rk}from"react/jsx-runtime";import{BrainCog as xp}from"lucide-react";import{lazy as vp}from"react";import{jsx as mo}from"react/jsx-runtime";var Cp=vp(()=>import("./ai-panel-content-UZJZ463W.js")),po="chai-chat-panel",kp=({className:e=""})=>mo(xp,{className:e}),wp=({isActive:e,show:t})=>oe("flags.ai",!1)?mo(b,{variant:"ghost",size:"icon",onClick:t,className:`h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:mo(kp,{})}):null,ei={id:po,label:"AI Assistant",button:wp,panel:()=>mo("div",{className:"h-full",children:mo(Cp,{})}),position:"top"};import{KeyboardIcon as ni}from"@radix-ui/react-icons";import{Fragment as Np}from"react";import{useTranslation as si}from"react-i18next";import{jsx as Je,jsxs as ri}from"react/jsx-runtime";var ti,oi,Pp=typeof navigator!="undefined"&&/Mac|iP(hone|od|ad)/.test((oi=(ti=navigator.userAgentData)==null?void 0:ti.platform)!=null?oi:navigator.platform),Dt=Pp?"\u2318":"Ctrl",ai="help",Ip=({isActive:e,show:t})=>{let{t:o}=si();return Je(b,{variant:"ghost",size:"icon",onClick:t,"aria-label":o("Keyboard shortcuts"),title:o("Keyboard shortcuts"),className:`h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:Je(ni,{className:"size-4"})})},Sp=({children:e})=>Je("kbd",{className:"inline-flex h-6 min-w-6 items-center justify-center rounded-md border border-border bg-muted px-1.5 font-sans text-[11px] font-medium leading-none text-foreground shadow-sm",children:e}),Ap=({keys:e,label:t})=>ri("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[Je("span",{className:"text-sm text-muted-foreground",children:t}),Je("span",{className:"flex shrink-0 items-center gap-1",children:e.map((o,r)=>ri(Np,{children:[r>0&&Je("span",{className:"text-[11px] text-muted-foreground/60",children:"+"}),Je(Sp,{children:o})]},r))})]}),Tp=()=>{let{t:e}=si(),t=[[{keys:[Dt,"Z"],label:e("Undo")},{keys:[Dt,"Shift","Z"],label:e("Redo")},{keys:[Dt,"D"],label:e("Duplicate")},{keys:[Dt,"C"],label:e("Copy")},{keys:[Dt,"X"],label:e("Cut")},{keys:[Dt,"V"],label:e("Paste")}],[{keys:[Dt,"S"],label:e("Save page")},{keys:["Esc"],label:e("Blur field / deselect blocks")},{keys:["Del"],label:e("Delete block")},{keys:["V / H"],label:e("Select / Hand tool")}]];return Je("div",{className:"grid grid-cols-1 gap-x-8 sm:grid-cols-2",children:t.map((o,r)=>Je("div",{className:"flex flex-col divide-y divide-border/60 sm:[&:not(:last-child)]:border-r sm:[&:not(:last-child)]:border-border sm:[&:not(:last-child)]:pr-8",children:o.map(n=>Je(Ap,{...n},n.label))},r))})},ii={button:Ip,label:"Keyboard shortcuts",position:"bottom",view:"modal",width:560,icon:Je(ni,{className:"size-4"}),panel:Tp};import{ImageIcon as ci,MoreVertical as Bp,Upload as Qr}from"lucide-react";import Dp,{Suspense as Ep,useCallback as Zo,useEffect as er,useMemo as Mp,useState as vt}from"react";import{useDropzone as _p}from"react-dropzone";import{useTranslation as mi}from"react-i18next";import{toast as $r}from"sonner";import{Fragment as Fp,jsx as G,jsxs as nt}from"react/jsx-runtime";var Lp=Dp.lazy(()=>import("./image-editor-RSEHWRGV.js")),pi="images",Op=25*1024*1024,li=30,Rp=({isActive:e,show:t})=>{let{t:o}=mi();return G(b,{variant:"ghost",size:"icon",onClick:t,"aria-label":o("Images"),title:o("Images"),className:`h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:G(ci,{className:"h-5 w-5"})})},Up=()=>{var K,Me;let{t:e}=mi(),[t,o]=vt(()=>localStorage.getItem("chai_optimize_images")!=="false");er(()=>{localStorage.setItem("chai_optimize_images",t.toString())},[t]);let[r,n]=vt(""),[a,s]=vt("");er(()=>{let B=setTimeout(()=>s(r),300);return()=>clearTimeout(B)},[r]);let[l,i]=vt(1),[g,h]=vt([]);er(()=>{i(1),h([])},[a]);let{data:d,isLoading:p,isFetching:y}=Fs({search:a.toLowerCase().trim(),page:l,limit:li});er(()=>{d!=null&&d.assets&&h(B=>{let v=new Map(B.map(S=>[S.id,S]));for(let S of d.assets)S.type==="image"&&v.set(S.id,S);return Array.from(v.values())})},[d]);let c=Mp(()=>g,[g]),k=((Me=(K=d==null?void 0:d.assets)==null?void 0:K.length)!=null?Me:0)===li,D=y&&l>1,{mutateAsync:_,isPending:R}=Os(),{mutateAsync:U}=Rs(),{mutateAsync:W}=Us(),[z,I]=vt([]),[u,H]=vt(null),[F,f]=vt(null),P=Zo(B=>{navigator.clipboard.writeText(B.url),$r.success(e("Asset URL copied to clipboard"))},[e]),m=Zo(async B=>{I(v=>[...v,B.id]);try{await U(B.id),h(v=>v.filter(S=>S.id!==B.id))}finally{I(v=>v.filter(S=>S!==B.id))}},[U]),T=Zo(async(B,v)=>{if(F)try{v?await _([{file:B,folderId:void 0,name:F.name,optimize:t}]):await W({id:F.id,file:B})}finally{f(null)}},[F,_,W,t]),C=Zo(async B=>{if(B.length===0)return;let v=[],S=0;for(let X of B)X.type.startsWith("image/")&&(X.size>Op?S++:v.push(X));if(S>0&&$r.error(e("Some files exceed the maximum size limit of 25MB.")),v.length===0){S===0&&$r.error(e("Invalid file type. Please upload an image."));return}try{let X=await Promise.all(v.map(async me=>{let ve=t?await Ls(me):me;return{file:await new Promise((_e,Ct)=>{let q=new FileReader;q.onload=()=>_e(q.result),q.onerror=()=>Ct(q.error),q.readAsDataURL(ve)}),folderId:void 0,name:me.name,optimize:t}}));await _(X),i(1),h([])}catch(X){}},[_,t,e]),{getRootProps:V,getInputProps:j,open:M,isDragActive:le}=_p({onDrop:C,accept:{"image/*":[]},multiple:!0,noClick:!0,noKeyboard:!0,disabled:R});return nt("div",{...V({className:"relative flex h-full flex-col gap-y-3 py-3"}),children:[G("input",{...j()}),nt("div",{className:"flex items-center justify-between gap-2",children:[nt("label",{className:"flex cursor-pointer items-center gap-1.5",children:[G(vr,{checked:t,onCheckedChange:o}),G("span",{className:"text-xs text-foreground",children:e("Optimize")})]}),nt(b,{variant:"outline",size:"sm",onClick:M,disabled:R,loading:R,children:[G(Qr,{className:"h-3.5 w-3.5"}),e("Upload")]})]}),G(Rt,{setValue:n,value:r,placeholder:e("Search images...")}),G("div",{className:"flex-1 overflow-y-auto",children:p&&l===1?G("div",{className:"grid grid-cols-2 gap-2 px-0",children:Array.from({length:8}).map((B,v)=>G("div",{className:"aspect-square animate-pulse bg-accent"},v))}):c.length===0&&!k?nt("div",{className:"flex h-full flex-col items-center justify-center gap-y-2 px-4 text-center",children:[G(Qr,{className:"h-8 w-8 text-muted-foreground"}),G("p",{className:"text-xs text-muted-foreground",children:a.length>0?e("No images found"):e("Drop images here or use the Upload button to add them.")})]}):nt(Fp,{children:[G("div",{className:"grid grid-cols-2 gap-2",children:c.map(B=>nt("div",{className:Le("group relative overflow-hidden border border-transparent transition-colors hover:border-foreground/20",z.includes(B.id)?"pointer-events-none opacity-50":""),children:[G(bs,{type:"Image",block:{image:B.url,alt:B.name,name:B.name},className:"block",children:G(Ge,{content:B.name,children:G("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden bg-muted",children:G(Fo,{src:B.thumbnailUrl||B.url,alt:B.name,className:"max-h-full max-w-full object-contain"})})})}),G("div",{className:"absolute right-1 top-1 opacity-0 transition-opacity group-hover:opacity-100 has-[[data-state=open]]:opacity-100",children:nt(Re,{children:[G(Ue,{asChild:!0,children:G(b,{variant:"secondary",size:"icon-sm","aria-label":e("More actions"),title:e("More actions"),className:"h-6 w-6 rounded-sm opacity-90 hover:opacity-100",children:G(Bp,{className:"h-3.5 w-3.5"})})}),nt(Fe,{align:"end",side:"bottom",className:"w-36",children:[G(je,{children:e("ACTIONS")}),G(O,{onClick:()=>P(B),children:e("Copy URL")}),G(O,{onClick:()=>H(B.id),children:e("View Details")}),G(O,{onClick:()=>f({id:B.id,url:B.url,name:B.name}),children:e("Edit Image")}),G(O,{onClick:()=>m(B),children:e("Delete")})]})]})})]},B.id))}),k&&G("div",{className:"pt-3",children:G(b,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(B=>B+1),disabled:D,loading:D,children:e("Load more")})})]})}),(le||R)&&nt("div",{className:Le("pointer-events-none absolute inset-2 z-50 flex flex-col items-center justify-center gap-y-2 rounded-lg border-2 border-dashed bg-background/90 text-center",le?"border-primary":"border-border"),children:[G(Qr,{className:"h-8 w-8 text-primary"}),G("p",{className:"text-sm font-medium text-foreground",children:e(R?"Uploading...":"Drop images to upload")})]}),G(xs,{mode:"image",assetId:u!=null?u:void 0,open:!!u,onOpenChange:B=>!B&&H(null),onSelect:()=>H(null)}),F&&G(Ep,{fallback:G(kt,{className:"top-0"}),children:G(Lp,{imageUrl:F.url,defaultSavedImageName:F.name,isEditing:!0,onSave:T,onClose:()=>f(null)})})]})},ui={button:Rp,label:"Images",position:"top",width:280,icon:G(ci,{className:"h-5 w-5"}),panel:Up};import{noop as Gp}from"lodash-es";import{AlertTriangle as Hp,CheckCircle2 as Wp,ExternalLink as di}from"lucide-react";import{useTranslation as zp}from"react-i18next";import{jsx as Ie,jsxs as Ee}from"react/jsx-runtime";var Yr="page-errors",Vp=({isActive:e,show:t})=>{let{errorCount:o,warningCount:r}=yt(),n=o+r;return Ee(b,{variant:"ghost",size:"icon",onClick:t,className:`relative h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:[Ie(Hp,{className:"h-5 w-5"}),n>0&&Ie("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-bold text-destructive-foreground",children:n>99?"99+":n})]})},Kp=()=>{let{errors:e,errorCount:t,warningCount:o}=yt(),[,r]=ae(),n=oe("gotoPage",Gp),{saveState:a}=Te(),{selectedLang:s,fallbackLang:l}=Ce(),{t:i}=zp(),g=(p,y)=>{if(y){if(a!=="SAVED")return;n({pageId:y,lang:s||l});return}p&&r([p])};if(e.length===0)return Ee("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[Ie(Wp,{className:"h-10 w-10 text-green-500"}),Ee("div",{children:[Ie("p",{className:"text-sm font-medium",children:i("No issues found")}),Ie("p",{className:"text-xs text-muted-foreground",children:i("This page has no validation errors or warnings.")})]})]});let h=e.filter(p=>p.severity==="error"),d=e.filter(p=>p.severity==="warning");return Ee("div",{className:"space-y-3",children:[Ee("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t>0&&Ee("span",{className:"text-red-500",children:[t," ",i(t===1?"error":"errors")]}),t>0&&o>0&&Ie("span",{children:"\xB7"}),o>0&&Ee("span",{className:"text-orange-500",children:[o," ",i(o===1?"warning":"warnings")]})]}),h.length>0&&Ie("div",{className:"space-y-1.5",children:h.map(p=>Ie("button",{type:"button","aria-label":`Navigate to error: ${p.message}`,className:"w-full cursor-pointer rounded-md border border-red-200 bg-red-50 p-2 text-left text-xs transition-colors hover:bg-red-100 dark:border-red-900 dark:bg-red-950/30 dark:hover:bg-red-950/50",onClick:()=>g(p.blockId,p.partialBlockId),children:Ee("div",{className:"flex items-start justify-between gap-1",children:[Ee("div",{className:"flex-1",children:[Ee("span",{className:"font-medium text-red-700 dark:text-red-400",children:[i("Error"),": "]}),Ie("span",{className:"text-red-600 dark:text-red-300",children:p.message})]}),p.partialBlockId?Ie(di,{className:"mt-0.5 h-3 w-3 shrink-0 text-red-400"}):null]})},p.id))}),d.length>0&&Ie("div",{className:"space-y-1.5",children:d.map(p=>Ie("button",{type:"button","aria-label":`Navigate to warning: ${p.message}`,className:"w-full cursor-pointer rounded-md border border-orange-200 bg-orange-50 p-2 text-left text-xs transition-colors hover:bg-orange-100 dark:border-orange-900 dark:bg-orange-950/30 dark:hover:bg-orange-950/50",onClick:()=>g(p.blockId,p.partialBlockId),children:Ee("div",{className:"flex items-start justify-between gap-1",children:[Ee("div",{className:"flex-1",children:[Ee("span",{className:"font-medium text-orange-700 dark:text-orange-400",children:[i("Warning"),": "]}),Ie("span",{className:"text-orange-600 dark:text-orange-300",children:p.message})]}),p.partialBlockId?Ie(di,{className:"mt-0.5 h-3 w-3 shrink-0 text-orange-400"}):null]})},p.id))})]})},fi={id:Yr,label:"Errors",panel:Kp,button:Vp,position:"top",width:280,view:"standard"};import{has as qp}from"lodash-es";import{lazy as Qp}from"react";import{jsx as uo,jsxs as jp}from"react/jsx-runtime";var $p=Qp(()=>import("./seo-panel-Z6OBXHQ4.js")),jr="seo",Yp=({isActive:e,show:t})=>{let{data:o}=ke(),r=Dn(o==null?void 0:o.pageType);return!qp(r,"hasSlug")||!r.hasSlug?null:uo(b,{variant:"ghost",size:"icon",onClick:t,className:`h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:jp("svg",{stroke:"currentColor",fill:"none",style:{height:"20px",width:"20px"},strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",children:[uo("path",{d:"M7 8h-3a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-3"}),uo("path",{d:"M14 16h-4v-8h4"}),uo("path",{d:"M11 12h2"}),uo("path",{d:"M17 8m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]})})},gi={id:jr,label:"SEO",panel:$p,button:Yp,position:"top",width:600,view:"modal"};import{Trash2 as iu}from"lucide-react";import{useTranslation as lu}from"react-i18next";import{format as Jp}from"date-fns";import{ChevronLeft as Zp,ChevronRight as eu,Eye as tu,File as ou,Image as ru,MoreHorizontal as nu}from"lucide-react";import{useState as tr}from"react";import{useTranslation as su}from"react-i18next";import{useMutation as hi,useQueryClient as yi}from"@tanstack/react-query";import{toast as fo}from"sonner";var bi=()=>{let e=ee(),t=yi(),o=ne();return hi({mutationFn:async r=>o(e,{action:E.RESTORE_TRASHED_ITEM,data:{id:r}}),onSuccess:r=>{t.invalidateQueries({queryKey:[E.GET_TRASHED_ITEMS]}),t.invalidateQueries({queryKey:[E.GET_WEBSITE_PAGES]}),t.invalidateQueries({queryKey:[E.GET_ASSETS]});let n=mt();fo.success(n.restoreAction+" successful"),r!=null&&r.resolvedConflict&&fo.info(`Restored with new slug: ${r.newSlug}`)},onError:r=>{fo.error(`Restore failed: ${r.message||"Unknown error"}`)}})},xi=()=>{let e=ee(),t=yi(),o=ne();return hi({mutationFn:async r=>o(e,{action:E.DELETE_PERMANENTLY,data:{id:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:[E.GET_TRASHED_ITEMS]}),fo.success(mt().deleteAction+" successful")},onError:r=>{fo.error(`Delete failed: ${r.message||"Unknown error"}`)}})};import{useQuery as Xp}from"@tanstack/react-query";var vi=({page:e=1,limit:t=20,search:o="",entityType:r=""})=>{let n=ee(),a=ne();return Xp({queryKey:[E.GET_TRASHED_ITEMS,e,t,o,r],queryFn:async()=>await a(n,{action:E.GET_TRASHED_ITEMS,data:{page:e,limit:t,search:o,entityType:r}}),refetchOnWindowFocus:!1,refetchOnMount:"always"})};import{jsx as x,jsxs as Y}from"react/jsx-runtime";var au=({userId:e})=>{let{data:t}=Br(e);return x("span",{title:(t==null?void 0:t.name)||(t==null?void 0:t.email)||e,children:(t==null?void 0:t.name)||(t==null?void 0:t.email)||e})},Ci=()=>{var I,u,H,F,f,P;let{t:e}=su(),t=mt(),[o,r]=tr(""),[n,a]=tr(1),[s,l]=tr(null),[i,g]=tr(null),h=20,{data:d,isLoading:p}=vi({page:n,limit:h,search:o}),y=(I=d==null?void 0:d.total)!=null?I:0,c=Math.max(1,Math.ceil(y/h)),{mutate:N,isPending:k}=bi(),{mutate:D,isPending:_}=xi(),R=()=>{i&&N(i.id,{onSuccess:()=>g(null)})},U=()=>{s&&D(s.id,{onSuccess:()=>l(null)})},W=m=>{r(m),a(1)},z=((H=(u=d==null?void 0:d.items)==null?void 0:u.length)!=null?H:0)>0;return Y("div",{className:"flex h-full flex-col",children:[x("div",{className:"flex items-center gap-4 pb-4",children:x("div",{className:"w-64",children:x(Rt,{value:o,setValue:W,placeholder:e(`Search ${t.panelLabel.toLowerCase()}...`)})})}),x(ys,{className:"min-h-[50vh] flex-1",children:p?x("div",{className:"w-full",children:Y("table",{className:"w-full table-fixed caption-bottom text-sm text-foreground",children:[x("thead",{children:Y("tr",{className:"border-b bg-accent/50 text-xs font-light",children:[x("th",{className:"w-[40%] rounded-tl-md p-2 text-left font-medium",children:e("Title")}),x("th",{className:"w-[15%] p-2 text-left font-medium",children:e("Type")}),x("th",{className:"w-[20%] p-2 text-left font-medium",children:e(t.byLabel)}),x("th",{className:"w-[20%] p-2 text-left font-medium",children:e(t.onLabel)}),x("th",{className:"w-[5%] rounded-tr-md p-2 text-left font-medium"})]})}),x("tbody",{children:Array.from({length:5}).map((m,T)=>Y("tr",{className:"border-b text-xs font-light",children:[x("td",{className:"p-2",children:x(Mt,{className:"h-4 w-3/4"})}),x("td",{className:"p-2",children:x(Mt,{className:"h-4 w-1/2"})}),x("td",{className:"p-2",children:x(Mt,{className:"h-4 w-1/2"})}),x("td",{className:"p-2",children:x(Mt,{className:"h-4 w-3/4"})}),x("td",{className:"p-2",children:x(Mt,{className:"ml-auto h-6 w-6 rounded-full"})})]},T))})]})}):z?x("div",{className:"w-full",children:Y("table",{className:"w-full table-fixed caption-bottom text-sm text-foreground",children:[x("thead",{className:"sticky top-0 z-10 bg-background",children:Y("tr",{className:"border-b bg-accent/50 text-xs font-light",children:[x("th",{className:"w-[40%] rounded-tl-md p-2 text-left font-medium",children:e("Title")}),x("th",{className:"w-[15%] p-2 text-left font-medium",children:e("Type")}),x("th",{className:"w-[20%] p-2 text-left font-medium",children:e(t.byLabel)}),x("th",{className:"w-[20%] p-2 text-left font-medium",children:e(t.onLabel)}),x("th",{className:"w-[5%] rounded-tr-md p-2 text-left font-medium"})]})}),x("tbody",{className:"[&_tr:last-child]:border-0",children:(F=d==null?void 0:d.items)==null?void 0:F.map(m=>{var T,C,V,j,M,le;return Y("tr",{className:"border-b text-xs font-light",children:[x("td",{className:"p-2",children:Y("div",{className:"flex items-center gap-x-2",children:[m.entityType==="page"&&x(ou,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),m.entityType==="asset"&&x(ru,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),Y("span",{className:"min-w-0 flex-1 cursor-default truncate",title:((T=m.metadata)==null?void 0:T.name)||m.name,children:[((C=m.metadata)==null?void 0:C.name)||m.name,m.entityType==="page"&&((V=m.metadata)==null?void 0:V.slug)&&Y("span",{className:"ml-1 text-muted-foreground",children:["(",m.metadata.slug,")"]})]}),m.entityType==="asset"&&((j=m.metadata)==null?void 0:j.url)&&Y($t,{children:[x(Yt,{asChild:!0,children:x(b,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",children:x(tu,{className:"h-3.5 w-3.5"})})}),x(jt,{className:"w-auto max-w-[300px] p-2",children:x(Fo,{src:m.metadata.url,alt:m.metadata.name||m.name,className:"max-h-[300px] max-w-[300px] rounded object-contain"})})]})]})}),Y("td",{className:"p-2 capitalize",children:[m.entityType==="page"?"Page":m.entityType,m.entityType==="page"&&((M=m==null?void 0:m.metadata)==null?void 0:M.pageType)&&m.metadata.pageType!=="page"&&Y("small",{className:"ml-1 italic text-muted-foreground",children:["(",(le=m==null?void 0:m.metadata)==null?void 0:le.pageType,")"]})]}),x("td",{className:"truncate whitespace-nowrap p-2",children:m.deletedBy?x(au,{userId:m.deletedBy}):"-"}),x("td",{className:"whitespace-nowrap p-2 font-extralight italic",children:Jp(new Date(m.deletedAt),"PPp")}),x("td",{className:"p-2",children:x("div",{className:"flex items-center justify-end gap-2",children:Y(Re,{children:[x(Ue,{asChild:!0,children:x(b,{variant:"ghost",size:"icon",disabled:k||_,children:x(nu,{className:"h-4 w-4"})})}),Y(Fe,{align:"end",children:[x(O,{onClick:()=>g(m),children:e("Restore")}),x(O,{onClick:()=>l(m),className:"text-destructive",children:e("Delete Permanently")})]})]})})})]},m.id)})})]})}):x("div",{className:"flex h-96 items-center justify-center p-8 text-sm text-muted-foreground",children:e(t.emptyMessage)})}),!p&&c>1&&Y("div",{className:"flex items-center justify-between border-t pt-3 text-xs text-muted-foreground",children:[Y("span",{children:[e("Page")," ",n," ",e("of")," ",c]}),Y("div",{className:"flex items-center gap-1",children:[x(b,{variant:"ghost",size:"icon",onClick:()=>a(m=>Math.max(1,m-1)),disabled:n<=1,children:x(Zp,{className:"h-4 w-4"})}),x(b,{variant:"ghost",size:"icon",onClick:()=>a(m=>Math.min(c,m+1)),disabled:n>=c,children:x(eu,{className:"h-4 w-4"})})]})]}),x(fe,{open:!!s,onOpenChange:m=>!m&&l(null),children:Y(Ae,{children:[Y(qe,{children:[x(Qe,{children:e(t.confirmDeleteTitle)}),x(it,{asChild:!0,children:Y("div",{className:"py-4 text-sm",children:[e("Are you sure you want to permanently delete")," ",x("span",{className:"font-semibold",children:((f=s==null?void 0:s.metadata)==null?void 0:f.name)||(s==null?void 0:s.name)}),"?"," ",e("This action cannot be undone.")]})})]}),Y(wt,{children:[x(b,{variant:"outline",onClick:()=>l(null),disabled:_,children:e("Cancel")}),x(b,{variant:"destructive",onClick:U,loading:_,children:e("Delete Permanently")})]})]})}),x(fe,{open:!!i,onOpenChange:m=>!m&&g(null),children:Y(Ae,{children:[Y(qe,{children:[x(Qe,{children:e("Restore Item")}),x(it,{asChild:!0,children:Y("div",{className:"py-4 text-sm",children:[e("Are you sure you want to restore")," ",x("span",{className:"font-semibold",children:((P=i==null?void 0:i.metadata)==null?void 0:P.name)||(i==null?void 0:i.name)}),"?"]})})]}),Y(wt,{children:[x(b,{variant:"outline",onClick:()=>g(null),disabled:k,children:e("Cancel")}),x(b,{onClick:R,loading:k,children:e("Restore")})]})]})})]})};import{jsx as Xr}from"react/jsx-runtime";var ki=()=>Xr("div",{className:"flex h-full flex-col overflow-hidden",children:Xr("div",{className:"flex-1 overflow-hidden",children:Xr(Ci,{})})});import{jsx as Jr}from"react/jsx-runtime";var wi=mt().panelId,cu=({isActive:e,show:t})=>{let{t:o}=lu(),r=mt(),n=lt("flags",{});return n!=null&&n.trash?Jr(b,{variant:"ghost",size:"icon",onClick:t,title:o(r.sidebarButton),className:`h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:Jr(iu,{className:"h-5 w-5"})}):null},Ni={button:cu,label:mt().panelLabel,position:"bottom",view:"modal",width:1100,panel:()=>Jr(ki,{})};import{isFunction as mu,noop as pu}from"lodash-es";import{CircleUser as uu}from"lucide-react";import{lazy as du,Suspense as fu,useState as gu}from"react";import{useTranslation as hu}from"react-i18next";import{jsx as de,jsxs as Vt}from"react/jsx-runtime";var yu=du(()=>import("./change-password-modal-NJL7ZLTY.js").then(e=>({default:e.ChangePasswordModal}))),Zr="user-info",bu=()=>{var s;let{t:e}=hu(),{user:t,logout:o}=hr(),r=lt("onLogout",pu),[n,a]=gu(!1);return t?Vt(jn,{children:[de(Xn,{asChild:!0,children:de(b,{variant:"ghost",size:"icon",className:"h-8 w-8 focus-within:bg-primary/30 hover:bg-primary/30 focus:bg-primary/30 active:bg-primary/30",children:de(uu,{className:"h-5 w-5"})})}),Vt(Jn,{className:"w-auto space-y-2 p-4",children:[de("div",{className:"text-sm font-medium",children:(s=t.name)!=null?s:t.email}),de("div",{className:"text-xs text-muted-foreground",children:t.email}),de(b,{variant:"outline",size:"sm",className:"w-full",onClick:()=>a(!0),children:e("Change Password")}),n&&de(fu,{fallback:de(fe,{open:n,onOpenChange:a,children:de(Ae,{className:"sm:max-w-[425px]",children:de("div",{className:"flex h-[340px] items-center justify-center",children:de(Ke,{})})})}),children:de(yu,{open:n,onOpenChange:a})}),Vt(is,{children:[de(ls,{asChild:!0,children:de(b,{variant:"outline",size:"sm",className:"w-full",children:e("Logout")})}),Vt(cs,{children:[Vt(ms,{children:[de(us,{children:e("Are you sure you want to logout?")}),de(ds,{children:e("You will be redirected to the login page.")})]}),Vt(ps,{children:[de(gs,{children:e("Cancel")}),de(fs,{onClick:()=>{o(),mu(r)&&r()},children:e("Logout")})]})]})]})]})]}):null},Pi={id:Zr,label:"User Info",button:bu,position:"bottom"};import{jsx as go}from"react/jsx-runtime";var Ii=280,Cu=({isActive:e,show:t})=>go(b,{variant:"ghost",size:"icon",onClick:t,className:`h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:go(xu,{className:"h-5 w-5"})}),ku=({isActive:e,show:t})=>Ro()&&go(b,{variant:"ghost",size:"icon",onClick:t,className:`h-8 w-8 ${e?"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground":""}`,children:go(vu,{className:"h-5 w-5"})}),Si=()=>{Ye(po,ei),Ye("add-block",{button:ku,label:"Add Blocks",position:"top",isInternal:!0,width:Ii,panel:()=>go(Sr,{showHeading:!1,fromSidebar:!0,parentId:void 0,position:-1})}),Ye("outline",{button:Cu,label:"",position:"top",isInternal:!0,width:Ii,panel:qr}),Ye(jr,gi),Ye(Yr,fi),Ye(Zr,Pi),Ye(It,os),Ye(wi,Ni),Ye(ai,ii),Ye(pi,ui)};var Ai=()=>{br("dynamic-page-selector",{description:"Dynamic page selector"}),br("enable-add-page-dropdown",{description:"Enable add page dropdown"})};import{useQuery as Pu}from"@tanstack/react-query";import{get as Ti,isArray as Iu}from"lodash-es";import{useQuery as wu,useQueryClient as Nu}from"@tanstack/react-query";var ho=()=>{let e=ne(),t=ee(),o=Nu();return wu({queryKey:[E.GET_WEBSITE_DATA],staleTime:300*1e3,queryFn:async()=>{let r=await e(t,{action:E.GET_WEBSITE_DATA});return o.setQueryData([E.GET_WEBSITE_DRAFT_SETTINGS],r.websiteSettings),o.setQueryData([E.GET_WEBSITE_PAGES],r.websitePages),o.setQueryData([E.GET_PAGE_TYPES],r.pageTypes),o.setQueryData([E.GET_LIBRARIES],r.libraries),o.setQueryData([E.GET_COLLECTIONS],r.collections),r}})};var Bi={async getUILibraryBlock(e,t,o){let r=await t(o,{action:"GET_LIBRARY_ITEM",data:{id:e.id}}),n=Ti(r,"html",""),a=Ti(r,"blocks",[]);return Iu(a)?a:await as(n)},async getUILibraryBlocks(e,t,o){return(await t(o,{action:"GET_LIBRARY_ITEMS",data:{id:e.id}})).map(n=>({...n}))}},Di=()=>{let e=ne(),t=ee(),{data:o}=ho(),r=o==null?void 0:o.libraries;return Pu({queryKey:[E.UI_LIBRARIES],staleTime:"static",queryFn:async()=>{let n=r.map(a=>({...a}));return n.forEach(a=>{Fn(a.id,{name:a.isSiteLibrary?a.name+" (Current Site) ":a.name,description:a.description,getBlocksList:s=>Bi.getUILibraryBlocks(s,e,t),getBlock:({block:s})=>Bi.getUILibraryBlock(s,e,t)})}),n}})};import{useMutation as Su,useQuery as fP}from"@tanstack/react-query";import{useMemo as Au,useRef as Tu}from"react";var Ei=()=>{let{data:e}=ke(),{data:t}=he(),{data:o}=Jt(),r=ee(),n=ne(),a=Au(()=>(o==null?void 0:o.fallbackLang)||"en",[o==null?void 0:o.fallbackLang]),s=Tu(new Map);return Su({mutationFn:async({block:l})=>{let i=l._id,g=(t==null?void 0:t.lang)||a,h=`${i}:${g}`;if(s.current.has(h))return s.current.get(h);let d=n(r,{action:E.GET_BLOCK_ASYNC_PROPS,data:{block:l,lang:g,pageProps:{slug:t==null?void 0:t.slug,searchParams:{},pageType:t==null?void 0:t.pageType,fallbackLang:a,lastSaved:t.lastSaved,pageId:e.id,primaryPageId:t.primaryPage||e.id,pageBaseSlug:t==null?void 0:t.slug,dynamic:e==null?void 0:e.dynamic,languagePageId:t.id}}});return s.current.set(h,d),d.finally(()=>{s.current.delete(h)}),d}})};import{isEmpty as Bu}from"lodash-es";import{useMemo as Du}from"react";function Eu(e){var o;let t={};for(let r of e)t[r.id]={name:r.name,isPartial:Bu(r.slug),partialBlocks:r.partialBlocks?r.partialBlocks.split("|").filter(Boolean):[],links:r.links?r.links.split("|").filter(Boolean):[],designTokens:(o=r.designTokens)!=null?o:{}};return t}var Mi=()=>{let{data:e}=Pt();return{data:Du(()=>Eu(e!=null?e:[]),[e])}};import{Fragment as Xu,jsx as re,jsxs as Ri}from"react/jsx-runtime";var Fu=Et(()=>import("./page-lock-7HMG34UJ.js")),Gu=Et(()=>import("./license-overlay-4Q525E53.js")),Hu=Et(()=>import("./no-language-page-dialog-CWG5PI7N.js")),Wu=Et(()=>import("./digital-asset-manager-PIZMJEMX.js")),zu=Et(()=>import("./save-to-lib-65EGTZE5.js")),Vu=Et(()=>import("./web-preview-EIWOXGPY.js")),Ku=Et(()=>import("./page-manager-sheet-KZZBKQ6M.js"));Ai();Gs();Si();xr(Oe.TOP_BAR,aa);xr(Oe.MEDIA_MANAGER,Wu);Hn(zu);var qu={role:"admin",permissions:null},Li=e=>{let{isLoading:t}=qo();return t?re(Co,{}):re(Qu,{...e})},Qu=e=>{let{data:t,isFetching:o,isError:r}=ho();return!t||o?re(Co,{}):r?Ri(kt,{className:"fixed inset-0 bg-surface text-foreground",children:[re("p",{children:"Failed to load website data"}),re(b,{onClick:()=>window.location.reload(),children:"Retry"})]}):re($u,{...e})},$u=({...e})=>{var S,X,me,ve,Ve,_e,Ct;let{data:t}=ho(),{data:o}=Mi(),{data:r}=Di(),{collections:n,pageTypes:a,websiteSettings:s}=t,l=Kt(()=>(s==null?void 0:s.fallbackLang)||"en",[s]),{data:i,isFetching:g}=qo(),h=i||qu,[d]=ht(),p=d.get("page"),{data:y}=ke(),{data:c,isFetching:N}=Dr(),{data:k}=fr(),{data:D}=dr(),{blocks:_}=ia((X=(S=c==null?void 0:c.draftPage)==null?void 0:S.blocks)!=null?X:[]),{pageStatus:R}=$e(),{mutateAsync:U}=Ei(),{onSave:W}=ma(),{getPartialBlocks:z,getPartialBlockBlocks:I}=ua(),{searchPages:u}=En(),{mutateAsync:H}=la(),F=Er(),[f,P]=Oi(!1),m=Uu([]),T=Kt(()=>qt(s,"theme",{})||{},[s]),C=Kt(()=>qt(s,"languages",[])||[],[s]),V=Kt(()=>qt(s,"designTokens",{})||{},[s]),j=R===yr.EDITING,M=R===yr.CHECKING,le=N||M,[,K]=_t();or(()=>{m.current=_},[_]),or(()=>{let q=Ne.subscribe(we.OPEN_AI_PANEL,()=>{K(po)});return()=>q()},[K]);let[Me]=Lu(Hs);or(()=>{let q=()=>{document.hidden?P(!0):P(!1)};return window.addEventListener("visibilitychange",q),()=>window.removeEventListener("visibilitychange",q)},[]);let B=Kt(()=>{let q={};return h&&(q.permissions=qt(h,"permissions",null),q.role=qt(h,"role","user")),q.pageExternalData={...D!=null?D:{},global:k!=null?k:{}},q},[h,D,k]),v=Kt(()=>r==null?void 0:r.some(q=>q.isSiteLibrary),[r]);return Ri(Xu,{children:[N&&re(kt,{children:re(Ke,{className:`transition-all ${g?"h-6 w-6":"h-5 w-5"}`})}),Me&&re(_i,{fallback:re("div",{className:"absolute inset-0 z-[999999] flex min-h-screen w-screen items-center justify-center bg-gray-100",children:re(Ke,{className:"h-6 w-6 text-primary"})}),children:re(Vu,{})}),re(Ar,{siteWideUsage:o!=null?o:{},flags:e.flags?{...e.flags,librarySite:v}:{librarySite:v},gotoPage:F,collections:n!=null?n:[],getBlockAsyncProps:U,themePresets:(me=e.themePresets)!=null?me:[],pageId:y==null?void 0:y.id,loading:le,fallbackLang:l,languages:C,brandingOptions:T,designTokens:V,translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSave:!f&&j&&((ve=e.autoSave)!=null?ve:!0),autoSaveActionsCount:(Ve=e.autoSaveActionsCount)!=null?Ve:10,onError:e.onError||console.error,getPartialBlockBlocks:I,getPartialBlocks:z,blocks:N?[]:_,theme:Ou(T),pageTypes:a,searchPageTypeItems:u,labels:e.labels,onSave:async({blocks:q,needTranslations:ut,partialIds:sr,linkPageIds:ar,designTokens:ir})=>{if(!p)return!0;m.current=q;let xo=[...q];return await W({page:p,blocks:xo,needTranslations:ut,partialIds:sr,linkPageIds:ar,designTokens:ir}),m.current=xo,!0},onSaveWebsiteData:async({type:q,data:ut})=>(q==="THEME"?await H({settings:{theme:ut}}):q==="DESIGN_TOKENS"&&await H({settings:{designTokens:ut}}),!0),...B,children:re(Fu,{isFetchingPageData:N})}),((Ct=(_e=e.flags)==null?void 0:_e.pagesManager)!=null?Ct:!0)&&re(Ku,{}),re("div",{children:re(Hu,{})}),re(_i,{fallback:null,children:re(Gu,{})})]})},Yu=new Mu({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnReconnect:!1,refetchOnMount:!1}}}),ju=e=>{let[,t]=Io(),[o,r]=Oi(!1);return or(()=>(t(Ru(e,["apiUrl","usersApiUrl","assetsApiUrl","getPreviewUrl","getLiveUrl","onLogout","getAccessToken","websocket","getLoggedInUser","flags","currentUser","ai","beforeRequest","dam","labels"])),setTimeout(()=>{r(!0)},200),()=>{r(!1),t({})}),[e,t]),o?qt(e,"hasReactQueryProvider",!1)===!0?re(Li,{...e}):re(_u,{client:Yu,children:re(Li,{...e})}):re(Co,{})};if(typeof window=="undefined")throw new Error("@chaibuilder/pro is not available on the server");import{jsx as A,jsxs as Z}from"react/jsx-runtime";var rd="e.g. TechFlow is a software company for project management. We help creative agencies collaborate faster with AI-driven scheduling...",nd="e.g. This is the Services page targeting 'custom web design' and 'responsive UI'. Goal is to showcase our design process...",sd=["Modern","Minimalist","Corporate","Elegant","Bold","Playful","Futuristic","Vintage","Luxury","Technical","Organic","Vibrant","Classic","Contemporary","Industrial","Artistic","Clean","Sophisticated","Creative","Professional","Trendy","Retro","Sleek","Warm","Cool","Dramatic","Subtle","Edgy","Refined","Dynamic"],ad=["Professional","Friendly","Informative","Persuasive","Humorous","Conversational","Authoritative","Casual","Formal","Enthusiastic","Empathetic","Confident","Inspiring","Educational","Witty","Serious"],id=({data:e,onChange:t,isEnhancing:o,onEnhance:r})=>{let{t:n}=en(),a=e.site||{},s=a.siteContext||"",l=Gi(null);return Z("div",{className:"space-y-1",children:[A("div",{className:"space-y-1",children:Z("p",{className:"rounded border border-border bg-accent/50 p-2 text-[11px] font-light leading-relaxed text-foreground/80",children:[A("span",{className:"font-semibold",children:n("Include: ")}),n("Business name & industry (e.g. TechFlow is a project management"),n("company"),A("br",{}),n("Target audience (e.g. creative agencies)"),A("br",{}),n("Unique value proposition (e.g. AI-driven scheduling)"),A("br",{}),n("Key products/services (e.g. AI-driven scheduling)")]})}),A("div",{className:"h-2"}),A(et,{htmlFor:"site-context-textarea",children:n("Enter Site Context:")}),Z("div",{className:"bg-surface overflow-hidden rounded-lg border border-border shadow-sm transition-all",children:[A(Lt,{id:"site-context-textarea",ref:l,value:s,onChange:i=>t({site:{...a,siteContext:i.target.value}}),placeholder:rd,className:"no-scrollbar min-h-[150px] resize-none border-0 text-xs shadow-none",disabled:o}),Z("div",{className:"flex items-center justify-start gap-3 px-3 py-2",children:[Z(b,{size:"xs",variant:"outline",onClick:r,loading:o,className:"h-6 px-3 font-light",disabled:o||!s.trim(),children:[A(Fi,{className:"text-orange !h-3 !w-3"}),n("Enhance with AI")]}),A(Nr,{textareaRef:l,onTranscriptionChange:i=>t({site:{...a,siteContext:i}}),disabled:o,"aria-label":n("Start voice input"),title:n("Start voice input")})]})]}),Z("div",{className:"grid grid-cols-2 gap-3",children:[Z("div",{className:"space-y-1",children:[A(et,{htmlFor:"look-select",children:n("Look")}),Z(eo,{value:a.look||"",onValueChange:i=>t({site:{...a,look:i}}),children:[A(oo,{id:"look-select",children:A(to,{placeholder:"Select look"})}),A(ro,{children:sd.map(i=>A(no,{value:i,children:i},i))})]})]}),Z("div",{className:"space-y-1",children:[A(et,{htmlFor:"tone-select",children:n("Tone")}),Z(eo,{value:a.tone||"",onValueChange:i=>t({site:{...a,tone:i}}),children:[A(oo,{id:"tone-select",children:A(to,{placeholder:"Select tone"})}),A(ro,{children:ad.map(i=>A(no,{value:i,children:i},i))})]})]})]}),Z("div",{className:"space-y-1 pt-2",children:[A(et,{htmlFor:"banned-words-input",children:n("Banned Words")}),A(Ao,{id:"banned-words-input",value:a.bannedWords||"",onChange:i=>t({site:{...a,bannedWords:i.target.value}}),placeholder:"e.g. word1, word2, word3"}),Z("p",{className:"mt-1 text-[10px] text-muted-foreground",children:[A("span",{className:"font-medium",children:"Note:"})," These words will be avoided by AI. Enter them as a comma-separated list."]})]})]})},ld=({data:e,onChange:t,isEnhancing:o,onEnhance:r})=>{let{t:n}=en(),a=e.page||{},s=a.pageContext||"",l=Gi(null);return Z("div",{className:"space-y-1",children:[A("div",{className:"space-y-1",children:Z("p",{className:"rounded border border-border bg-accent/50 p-2 text-[11px] font-light leading-relaxed text-foreground/80",children:[A("span",{className:"font-medium",children:n("Include: ")}),n("Page purpose (e.g. This is the Services page targeting "),A("code",{children:n("custom web design")}),"\xA0",")",A("br",{}),n("Target keywords (e.g. custom web design)"),A("br",{}),n("Primary H1 goal (e.g. Showcase our design process)")]})}),A("div",{className:"h-2"}),A(et,{htmlFor:"page-context-textarea",children:n("Enter Page Context:")}),Z("div",{className:"bg-surface overflow-hidden rounded-lg border border-border shadow-sm transition-all",children:[A(Lt,{id:"page-context-textarea",ref:l,value:s,onChange:i=>t({page:{...a,pageContext:i.target.value}}),placeholder:nd,className:"no-scrollbar min-h-[180px] resize-none border-0 text-xs shadow-none",disabled:o}),Z("div",{className:"flex items-center justify-start gap-3 px-3 py-2",children:[Z(b,{size:"xs",variant:"outline",onClick:r,loading:o,className:"h-6 px-3 font-light",disabled:o||!s.trim(),children:[A(Fi,{className:"text-orange !h-3 !w-3"}),n("Enhance with AI")]}),A(Nr,{textareaRef:l,onTranscriptionChange:i=>t({page:{...a,pageContext:i}}),disabled:o,"aria-label":n("Start voice input"),title:n("Start voice input")})]})]})]})},cd=({open:e,onOpenChange:t,defaultTab:o="page"})=>{let{data:r}=he(),n=Xt(),a=An("AI_ENHANCE_CONTEXT"),[,s]=_t(),{t:l}=en(),[i,g]=Qt(!1),[h,d]=Qt(!1),[p,y]=Qt(!1),[c,N]=Qt(o),[k,D]=Qt({site:{},page:{}}),[_,R]=Qt(null),U=_?JSON.stringify(k)!==JSON.stringify(_):!1,{data:W,isLoading:z}=Uo(),I=Ju();od(()=>{if(!e)return;let m=W||{site:{},page:{}};D(m),R(m),N(o)},[e,W,o]);let u=z&&e,H=td(m=>{D(T=>({...T,...m}))},[]),F=async()=>{var T;let m=((T=k.site)==null?void 0:T.siteContext)||"";if(!m.trim()){ze.error(l("Please enter some site context to enhance"));return}d(!0);try{let C=await n({body:{action:E.AI_ENHANCE_CONTEXT,data:{type:"site",content:m,model:a}}});C!=null&&C.enhancedContent?(D(V=>({...V,site:{...V.site||{},siteContext:C.enhancedContent}})),ze.success(l("Site context enhanced with AI!")),I.invalidateQueries({queryKey:[Pr]})):ze.error(l("AI enhancement failed. Please try again."))}catch(C){console.error("Enhance site error:",C),C!=null&&C.canBuyCredits?ze.error(A("p",{className:"font-medium",children:C.message||l("Failed to enhance with AI")}),{action:{label:"Buy Credits",onClick:()=>s(It)},duration:8e3}):ze.error((C==null?void 0:C.message)||"Failed to enhance with AI")}finally{d(!1)}},f=async()=>{var T;let m=((T=k.page)==null?void 0:T.pageContext)||"";if(!m.trim()){ze.error(l("Please enter some page context to enhance"));return}y(!0);try{let C=await n({body:{action:E.AI_ENHANCE_CONTEXT,data:{type:"page",content:m,siteContext:JSON.stringify(k.site),model:a}}});C!=null&&C.enhancedContent?(D(V=>({...V,page:{...V.page||{},pageContext:C.enhancedContent}})),ze.success(l("Page context enhanced with AI!")),I.invalidateQueries({queryKey:[Pr]})):ze.error(l("AI enhancement failed. Please try again."))}catch(C){console.error("Enhance page error:",C),C!=null&&C.canBuyCredits?ze.error(A("p",{className:"font-medium",children:C.message||"Failed to enhance with AI"}),{action:{label:"Buy Credits",onClick:()=>s(It)},duration:8e3}):ze.error((C==null?void 0:C.message)||l("Failed to enhance with AI"))}finally{y(!1)}},P=async()=>{g(!0);try{let m=k.site||{};if(await n({body:{action:E.AI_SAVE_CONTEXT,data:{type:"app",aiData:m}}}),r!=null&&r.id){let T=k.page||{};await n({body:{action:E.AI_SAVE_CONTEXT,data:{type:"page",pageId:r.id,aiData:T}}})}R({...k}),I.invalidateQueries({queryKey:[Yn,r==null?void 0:r.id]}),ze.success(l("AI context saved successfully!"))}catch(m){console.error("Save AI context error:",m),ze.error((m==null?void 0:m.message)||l("Failed to save AI context"))}finally{g(!1)}};return A(fe,{open:e,onOpenChange:t,children:Z(Ae,{className:"gap-0 overflow-hidden p-0 sm:max-w-[560px]","aria-describedby":"ai-context-description",children:[Z(qe,{className:"px-5 pb-2 pt-3",children:[A(Qe,{className:"py-0 text-sm leading-none",children:l("Manage Context")}),Z(it,{id:"ai-context-description",className:"py-0 text-xs leading-none text-muted-foreground",children:[l("Configure site and page context to help AI generate better, more"),"relevant content."]})]}),Z(Vn,{value:c,onValueChange:N,className:"flex-1 pt-1",children:[A("div",{className:"px-5",children:Z(Kn,{children:[Z(kr,{value:"page",className:"px-3",children:[A(ed,{className:"h-3.5 w-3.5"}),l("Current Page")]}),Z(kr,{value:"site",className:"px-3",children:[A(Zu,{className:"h-3.5 w-3.5"}),l("Website")]})]})}),Z("div",{className:"no-scrollbar relative max-h-[400px] min-h-[400px] overflow-y-auto px-5 py-4",children:[u?A("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center backdrop-blur-sm",children:A(Ke,{})}):null,A(wr,{value:"page",children:A(ld,{data:k,onChange:H,isEnhancing:p,onEnhance:f})}),A(wr,{value:"site",children:A(id,{data:k,onChange:H,isEnhancing:h,onEnhance:F})})]})]}),A("div",{className:"bg-surface flex justify-end border-t px-5 py-3",children:A(b,{size:"sm",loading:i,onClick:P,disabled:h||p||!U,className:"min-w-[80px]",children:l("Save")})})]})})},Hi=cd;var Wi="ai-conversations",tn=()=>({defaultLang:{chats:[]},imageGeneration:{chats:[]}}),zi=()=>{if(typeof window=="undefined")return tn();try{let e=sessionStorage.getItem(Wi);return e?JSON.parse(e):tn()}catch(e){return tn()}},Vi=e=>{var o;return((o=zi()[e])==null?void 0:o.chats)||[]},on=(e,t)=>{if(typeof window!="undefined")try{let o=zi();o[e]={chats:t},sessionStorage.setItem(Wi,JSON.stringify(o))}catch(o){}},rn=e=>{on(e,[])};import{ChevronDown as md,ChevronUp as pd,Sparkles as ud}from"lucide-react";import{useTranslation as dd}from"react-i18next";import{jsx as te,jsxs as ue}from"react/jsx-runtime";var Ki=e=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"});function rr({isExpanded:e=!1,onToggle:t,compactOnly:o=!1}={}){let{data:r}=ts(),[,n]=_t(),{t:a}=dd();if(!r)return null;let s=r.monthly.limit+r.addon.total,l=(r.monthly.used+r.addon.used).toFixed(2).replace(/\.00$/,""),i=s>0?Math.min(100,(r.monthly.used+r.addon.used)/s*100):0;return o?ue("button",{type:"button",onClick:()=>t==null?void 0:t(!e),className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground transition-colors hover:text-foreground",children:[ue("span",{children:[l," / ",s]}),e?te(pd,{className:"h-3 w-3"}):te(md,{className:"h-3 w-3"})]}):te("div",{className:"group rounded-md border bg-muted/10 p-2",children:ue("div",{className:"flex flex-col gap-2",children:[ue("div",{className:"flex items-center justify-between gap-2",children:[ue("div",{className:"flex items-center gap-2",children:[te(ud,{className:"h-3 w-3 text-primary"}),ue($t,{children:[te(Yt,{asChild:!0,children:ue("button",{type:"button",className:"cursor-pointer text-[10px] text-muted-foreground hover:text-foreground",children:[l," / ",s]})}),te(jt,{className:"w-56 p-3",side:"top",align:"start",children:ue("div",{className:"space-y-3",children:[ue("div",{className:"space-y-1",children:[ue("div",{className:"flex items-center justify-between text-[10px]",children:[te("span",{className:"font-medium text-foreground",children:r.billingPeriod?a("Monthly Credits"):a("Lifetime Credits")}),r.billingPeriod&&ue("span",{className:"text-muted-foreground",children:[Ki(r.billingPeriod.start)," - ",Ki(r.billingPeriod.end)]})]}),ue("div",{className:"flex items-center justify-between pt-1 text-[10px]",children:[te("span",{className:"text-muted-foreground",children:"Used"}),te("span",{className:"font-medium",children:r.monthly.used})]}),ue("div",{className:"flex items-center justify-between text-[10px]",children:[te("span",{className:"text-muted-foreground",children:"Remaining"}),te("span",{className:"text-success font-medium",children:r.monthly.remaining})]})]}),r.addon.total>0&&ue("div",{className:"space-y-1.5 border-t pt-1",children:[ue("div",{className:"flex items-center justify-between text-[10px]",children:[te("span",{className:"font-medium text-foreground",children:a("Add-on Credits")}),te("span",{className:"text-muted-foreground",children:a("Never expire")})]}),ue("div",{className:"flex items-center justify-between text-[10px]",children:[te("span",{className:"text-muted-foreground",children:a("Total purchased")}),te("span",{className:"font-medium",children:r.addon.total})]}),ue("div",{className:"flex items-center justify-between text-[10px]",children:[te("span",{className:"text-muted-foreground",children:"Used"}),te("span",{className:"font-medium",children:r.addon.used})]}),ue("div",{className:"flex items-center justify-between text-[10px]",children:[te("span",{className:"text-muted-foreground",children:a("Remaining")}),te("span",{className:"text-success font-medium",children:r.addon.remaining})]})]}),te("div",{className:"border-t pt-2",children:ue("div",{className:"flex items-center justify-between text-[10px] font-medium",children:[te("span",{className:"text-foreground",children:a("Total Available")}),te("span",{className:"text-success",children:r.totalAvailable})]})})]})})]})]}),r.canBuyCredits&&te(b,{variant:"link",size:"xs",onClick:()=>n(It),children:a("Buy Credits")})]}),te(rs,{value:i,className:"h-1"})]})})}import{Fragment as qi,jsx as xe,jsxs as bo}from"react/jsx-runtime";var xd=nr(()=>import("./ai-panel-default-lang-2ZXZYQRT.js")),vd=nr(()=>import("./ai-panel-page-chat-7ZISZWY4.js")),Cd=nr(()=>import("./ai-panel-other-lang-WDLC3M2M.js")),kd=nr(()=>import("./ai-panel-for-image-LADQP6VY.js")),wd=({type:e="default",updateLoadingState:t,onImageGenerate:o})=>{let{t:r}=yd(),[n,a]=st(""),[s,l]=st([]),[i,g]=st(!1),[h,d]=st(null),[p,y]=st(null),[c,N]=st(ns().id),[k,D]=st(!1),[_,R]=st(!1),{selectedLang:U,fallbackLang:W}=Ce(),z=oe("flags.aiCredits",!0),I=Xt(),[u]=ht(),H=u.get("page"),[F,f]=st(0),[P,m]=st(0),T=(s==null?void 0:s.filter(S=>S.role==="user").length)>=4,C=(s==null?void 0:s.filter(S=>S.role==="user").length)>=10,V=e==="floating",j=e==="generate-image",M=!V&&!j&&!U;yo(()=>{f(S=>S+1),m(0)},[H]);let le=!V&&!U&&(e==="default"||j),K=le?j?"imageGeneration":"defaultLang":null;yo(()=>{if(K)if(K==="defaultLang")rn(K),nn(()=>l([]));else{let S=Vi(K);S.length>0&&nn(()=>l(S))}},[K,H]),yo(()=>{if(K&&s.length>0){let S=s.filter(X=>!X.isStreaming).slice(-10);on(K,S)}},[s,K]),yo(()=>{le||nn(()=>l([]))},[U,H,le]);let Me=()=>{l([]),a(""),y(null),d(null),g(!1),M&&(f(S=>S+1),m(0)),K&&rn(K)},B=()=>{h&&(h.abort(),d(null)),g(!1),a(""),y(null),l(S=>{let X=S[S.length-1];return X&&X.role==="assistant"&&X.isReasoning&&X.isStreaming?S.slice(0,-1):S}),bd.info(r("Generation stopped"))};yo(()=>{t==null||t(i)},[i,t]);let v={t:r,fetch:I,input:n,messages:s,setInput:a,isLoading:i,handleStop:B,handleReset:Me,setMessages:l,setIsLoading:g,currentBlock:p,fallbackLang:W,abortController:h,isFloatingPanel:V,setCurrentBlock:y,setAbortController:d,forceNewConversation:C,isGenerateImagePanel:j,suggestNewConversation:T,selectedModel:c,onModelChange:N};return bo(qi,{children:[i&&!j&&xe("div",{className:"fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent"}),bo("div",{className:"flex h-full w-full flex-col",children:[!V&&bo(qi,{children:[bo("div",{className:j?"-mx-1 flex h-max items-center justify-between border-b bg-accent/10 px-2 pb-1":"relative h-0 max-h-0",children:[j&&xe("div",{className:"text-xs font-medium text-foreground",children:r("Generate image with AI")}),bo("div",{className:j?"space-x-2":"absolute -top-8 right-0 flex items-center justify-between gap-2",children:[z?xe(rr,{isExpanded:_,onToggle:R,compactOnly:!0}):null,xe(b,{variant:"outline",size:"icon-xs",className:`h-5 w-5 ${(M?P>0:(s==null?void 0:s.length)>0)?"":"pointer-events-none w-0 overflow-hidden opacity-0"}`,onClick:Me,disabled:i,children:xe(gd,{className:"!h-3 !w-3"})})]})]}),_&&z&&xe(rr,{}),xe(Hi,{open:k,onOpenChange:D})]}),xe(hd,{fallback:xe("div",{className:"flex h-full w-full items-center justify-center text-xs",children:"Loading AI Panel"}),children:j?xe(kd,{...v,selectedLang:"",onImageGenerate:o}):U?xe(Cd,{...v,selectedLang:U}):M?xe(vd,{t:r,isLoading:i,setIsLoading:g,selectedModel:c,onModelChange:N,onMessagesCountChange:m},F):xe(xd,{...v})})]})]})},Ui=({type:e,models:t,onAIEvent:o,onSuccess:r,onError:n,onComplete:a,context:s,updateLoadingState:l,onImageGenerate:i,...g})=>{var y;let{data:h}=Uo(),d=(y=s!=null?s:h)!=null?y:{},p={models:t,onAIEvent:o,onSuccess:r,onError:n,onComplete:a,context:d,...g};return xe(ss,{config:p,children:xe(wd,{type:e,updateLoadingState:l||fd,onImageGenerate:i})})},JS=Ui;export{Dr as a,Er as b,ji as c,Xi as d,el as e,Hi as f,Ui as g,JS as h,Mi as i,Or as j,Jl as k,qo as l,ju as m};
@@ -0,0 +1 @@
1
+ var e={sidebarButton:"Trash",panelTitle:"Trash",moveToAction:"Move to Trash",restoreAction:"Restore",deleteAction:"Delete Permanently",emptyMessage:"Trash is empty",confirmMoveTitle:"Move to Trash?",confirmDeleteTitle:"Delete Permanently?",panelId:"trash-panel",panelLabel:"Trash",byLabel:"Trashed by",onLabel:"Trashed on",warning:"Trashing"},t={...e};var r=()=>t;export{r as a};
@@ -0,0 +1 @@
1
+ var e={particleCount:350,spread:120,origin:{y:.6},angle:90},s={TOP_RIGHT:{angle:225,origin:{x:.9,y:0}},BOTTOM_RIGHT:{angle:100,origin:{x:.9,y:.9}}},c=async()=>{let{default:t}=await import("canvas-confetti");return t},r=t=>{let n=s[t];n||(n={});let i={...e,...n};c().then(o=>o(i))};export{r as a};
@@ -0,0 +1 @@
1
+ import{b as c}from"./chunk-3IT7IIAV.js";import"./chunk-IP4JBQOX.js";import"./chunk-LWYDGDPW.js";import"./chunk-WOT6VMZA.js";import C from"@monaco-editor/react";import{CheckIcon as v,CopyIcon as y,DownloadIcon as w}from"@radix-ui/react-icons";import{useState as p}from"react";import{useEffect as g,useState as b}from"react";var u=()=>{let[d,l]=b("light");return g(()=>{let t=window.document.documentElement,n=window.document.body,r=()=>{let o=t.classList.contains("dark")||n.classList.contains("dark");l(o?"dark":"light")};r();let e=new MutationObserver(o=>{o.forEach(a=>{a.attributeName==="class"&&r()})});return e.observe(t,{attributes:!0,attributeFilter:["class"]}),e.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>e.disconnect()},[]),{isDarkMode:d==="dark"}};import{jsx as s,jsxs as i}from"react/jsx-runtime";function k({code:d,onCopy:l,language:t="javascript",onDownload:n,downloadText:r="Download"}){let[e,o]=p(!1),[a,m]=p(d),{isDarkMode:f}=u();return i("div",{className:"flex flex-col gap-4",children:[s("div",{className:"h-[500px] max-h-full overflow-hidden rounded-md border py-2",children:s(C,{height:"100%",defaultLanguage:t,language:t,value:a,onChange:h=>m(h||""),theme:f?"vs-dark":"light",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"off",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",bracketPairColorization:{enabled:!0},suggest:{showKeywords:!1,showSnippets:!1}}})}),i("div",{className:"flex justify-end gap-2",children:[i(c,{type:"button",variant:"outline",onClick:()=>{l(a),o(!0),setTimeout(()=>{o(!1)},2e3)},children:[e?s(v,{className:"text-green-500"}):s(y,{})," ",e?"Copied":"Copy"]}),i(c,{type:"button",variant:"default",onClick:()=>{n(a)},children:[s(w,{})," ",r]})]})]})}export{k as default};
@@ -0,0 +1 @@
1
+ import{b as T,c as L}from"./chunk-7C4EQOAR.js";import{ba as b,ka as h,ma as v,xa as k}from"./chunk-2NYUIXUX.js";import{a as D}from"./chunk-ODSL3KXG.js";import{a as f,f as g,g as x,i as C}from"./chunk-RBDZDQZR.js";import{a as N}from"./chunk-T32TW3XV.js";import"./chunk-CRJENCPR.js";import"./chunk-ITX7QWN6.js";import"./chunk-LWYDGDPW.js";import"./chunk-VKSRWZCO.js";import"./chunk-3UEPBBE4.js";import"./chunk-WOT6VMZA.js";import{useThrottledCallback as B}from"@react-hookz/web";import{get as I}from"lodash-es";import{useCallback as S,useEffect as R,useMemo as U,useState as y}from"react";import{useTranslation as A}from"react-i18next";import{jsx as o,jsxs as c}from"react/jsx-runtime";var H=s=>{let t=document.createElement("div");return t.innerHTML=s,t.innerHTML};function G(){let{t:s}=A(),[t,E]=y(!1),[e,l]=L(),[a,M]=y((e==null?void 0:e.initialCode)||""),[m]=b(),p=h(),w=v(),{selectedLang:i}=k(),u=U(()=>I(N,i,i),[i]),P=B(r=>{if(!e)return;let n=H(r);w([e.blockId],{[e.blockProp]:n})},[],300),d=S(()=>{if(t&&e){let r=H(a);p([e.blockId],{[e.blockProp]:r})}},[t,e,a,p]);return R(()=>{e&&!m.includes(e.blockId)&&(d(),l(null))},[m,e,d,l]),o(f,{open:!0,onOpenChange:()=>{d(),l(null)},children:c(g,{className:"flex max-w-5xl flex-col gap-0 space-y-0 p-0",children:[o(x,{className:"shrink-0 border-b border-border px-4 py-2",children:o(C,{className:"flex items-center justify-between",children:c("div",{children:[o("h3",{className:"text-sm font-semibold",children:s("HTML Code Editor")}),c("div",{className:"flex items-center space-x-2 text-xs font-light text-muted-foreground",children:[u&&o("span",{className:"rounded bg-muted px-1.5 py-0.5",children:u}),o("span",{children:s("Scripts will be only executed in preview and live mode.")})]})]})})}),o("div",{className:"flex-1 overflow-hidden p-0 text-foreground",children:o(D,{value:e?T(a):"",onChange:r=>{let n=r.target.value;E(!0),M(n),P(n)},className:"min-h-[450px] border-none font-extralight",placeholder:"<!-- Enter your HTML code here -->"})})]})})}export{G as default};
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.create;var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var w=(e,o)=>{for(var t in o)a(e,t,{get:o[t],enumerable:!0})},s=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of u(o))!N.call(e,c)&&c!==t&&a(e,c,{get:()=>o[c],enumerable:!(n=y(o,c))||n.enumerable});return e};var f=(e,o,t)=>(t=e!=null?g(C(e)):{},s(o||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e)),x=e=>s(a({},"__esModule",{value:!0}),e);var I={};w(I,{Accordion:()=>h,AccordionContent:()=>R,AccordionItem:()=>A,AccordionTrigger:()=>P});module.exports=x(I);var i=f(require("@radix-ui/react-accordion"),1),v=require("@radix-ui/react-icons"),d=f(require("react"),1);var p=require("cnfast"),l=require("cnfast");function m(...e){return(0,l.twMerge)((0,p.clsx)(e))}var r=require("react/jsx-runtime"),h=i.Root,A=d.forwardRef(({className:e,...o},t)=>(0,r.jsx)(i.Item,{ref:t,className:m("border-b",e),...o}));A.displayName="AccordionItem";var P=d.forwardRef(({className:e,children:o,...t},n)=>(0,r.jsx)(i.Header,{className:"flex",children:(0,r.jsxs)(i.Trigger,{ref:n,className:m("flex flex-1 items-center justify-between py-4 text-left text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...t,children:[o,(0,r.jsx)(v.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));P.displayName=i.Trigger.displayName;var R=d.forwardRef(({className:e,children:o,...t},n)=>(0,r.jsx)(i.Content,{ref:n,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...t,children:(0,r.jsx)("div",{className:m("pb-4 pt-0",e),children:o})}));R.displayName=i.Content.displayName;0&&(module.exports={Accordion,AccordionContent,AccordionItem,AccordionTrigger});
@@ -0,0 +1,9 @@
1
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
+ import * as React from 'react';
3
+
4
+ declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
5
+ declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
+ declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+
9
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -0,0 +1,9 @@
1
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
+ import * as React from 'react';
3
+
4
+ declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
5
+ declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
+ declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+
9
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -0,0 +1 @@
1
+ import{a,b,c,d}from"../../chunk-3E72DJSP.js";import"../../chunk-LWYDGDPW.js";import"../../chunk-WOT6VMZA.js";export{a as Accordion,d as AccordionContent,b as AccordionItem,c as AccordionTrigger};
@@ -0,0 +1 @@
1
+ "use strict";var V=Object.create;var m=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var j=(e,t)=>{for(var i in t)m(e,i,{get:t[i],enumerable:!0})},x=(e,t,i,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _(t))!F.call(e,n)&&n!==i&&m(e,n,{get:()=>t[n],enumerable:!(d=W(t,n))||d.enumerable});return e};var g=(e,t,i)=>(i=e!=null?V(O(e)):{},x(t||!e||!e.__esModule?m(i,"default",{value:e,enumerable:!0}):i,e)),S=e=>x(m({},"__esModule",{value:!0}),e);var J={};j(J,{AlertDialog:()=>G,AlertDialogAction:()=>H,AlertDialogCancel:()=>B,AlertDialogContent:()=>z,AlertDialogDescription:()=>E,AlertDialogFooter:()=>T,AlertDialogHeader:()=>k,AlertDialogOverlay:()=>u,AlertDialogPortal:()=>w,AlertDialogTitle:()=>L,AlertDialogTrigger:()=>I});module.exports=S(J);var a=g(require("@radix-ui/react-alert-dialog"),1),l=g(require("react"),1);var h=require("@radix-ui/react-slot"),N=require("class-variance-authority"),C=g(require("react"),1);var D=require("lucide-react");var y=require("cnfast"),A=require("cnfast");function r(...e){return(0,A.twMerge)((0,y.clsx)(e))}var P=require("react/jsx-runtime");var R=({className:e=""})=>(0,P.jsx)(D.Loader,{className:r("h-5 w-5 animate-spin text-foreground/90",e)});var s=require("react/jsx-runtime"),c=(0,N.cva)("group/button cursor-pointer duration-300 inline-flex shrink-0 items-center justify-center rounded border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary hover:bg-primary/80 text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted/30 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-4 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),q=C.forwardRef(({className:e,variant:t,size:i,asChild:d=!1,loading:n=!1,children:p,disabled:M,...f},v)=>{let b=d?h.Slot:"button";return d?(0,s.jsx)(b,{className:r(c({variant:t,size:i,className:e})),ref:v,...f,children:p}):(0,s.jsxs)(b,{className:r(c({variant:t,size:i,className:e})),ref:v,disabled:M||n,...f,children:[n&&(0,s.jsx)(R,{className:"absolute h-4 w-4 text-primary-foreground"}),n?(0,s.jsx)("span",{className:"opacity-0",children:p}):p]})});q.displayName="Button";var o=require("react/jsx-runtime"),G=a.Root,I=a.Trigger,w=a.Portal,u=l.forwardRef(({className:e,...t},i)=>(0,o.jsx)(a.Overlay,{className:r("fixed inset-0 z-50 bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:i}));u.displayName=a.Overlay.displayName;var z=l.forwardRef(({className:e,...t},i)=>(0,o.jsxs)(w,{children:[(0,o.jsx)(u,{}),(0,o.jsx)(a.Content,{ref:i,className:r("bg-surface fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));z.displayName=a.Content.displayName;var k=({className:e,...t})=>(0,o.jsx)("div",{className:r("flex flex-col space-y-2 text-center sm:text-left",e),...t});k.displayName="AlertDialogHeader";var T=({className:e,...t})=>(0,o.jsx)("div",{className:r("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});T.displayName="AlertDialogFooter";var L=l.forwardRef(({className:e,...t},i)=>(0,o.jsx)(a.Title,{ref:i,className:r("text-lg font-semibold text-foreground",e),...t}));L.displayName=a.Title.displayName;var E=l.forwardRef(({className:e,...t},i)=>(0,o.jsx)(a.Description,{ref:i,className:r("text-sm text-muted-foreground",e),...t}));E.displayName=a.Description.displayName;var H=l.forwardRef(({className:e,...t},i)=>(0,o.jsx)(a.Action,{ref:i,className:r(c(),e),...t}));H.displayName=a.Action.displayName;var B=l.forwardRef(({className:e,...t},i)=>(0,o.jsx)(a.Cancel,{ref:i,className:r(c({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));B.displayName=a.Cancel.displayName;0&&(module.exports={AlertDialog,AlertDialogAction,AlertDialogCancel,AlertDialogContent,AlertDialogDescription,AlertDialogFooter,AlertDialogHeader,AlertDialogOverlay,AlertDialogPortal,AlertDialogTitle,AlertDialogTrigger});
@@ -0,0 +1,23 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
+ import * as React from 'react';
4
+
5
+ declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
6
+ declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
8
+ declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ declare const AlertDialogHeader: {
11
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
12
+ displayName: string;
13
+ };
14
+ declare const AlertDialogFooter: {
15
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
16
+ displayName: string;
17
+ };
18
+ declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
19
+ declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
20
+ declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
21
+ declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
22
+
23
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
@@ -0,0 +1,23 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
+ import * as React from 'react';
4
+
5
+ declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
6
+ declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
8
+ declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ declare const AlertDialogHeader: {
11
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
12
+ displayName: string;
13
+ };
14
+ declare const AlertDialogFooter: {
15
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
16
+ displayName: string;
17
+ };
18
+ declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
19
+ declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
20
+ declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
21
+ declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
22
+
23
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j,k}from"../../chunk-BWORNCTE.js";import"../../chunk-3IT7IIAV.js";import"../../chunk-IP4JBQOX.js";import"../../chunk-LWYDGDPW.js";import"../../chunk-WOT6VMZA.js";export{a as AlertDialog,j as AlertDialogAction,k as AlertDialogCancel,e as AlertDialogContent,i as AlertDialogDescription,g as AlertDialogFooter,f as AlertDialogHeader,d as AlertDialogOverlay,c as AlertDialogPortal,h as AlertDialogTitle,b as AlertDialogTrigger};
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var r in t)l(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of T(t))!M.call(e,a)&&a!==r&&l(e,a,{get:()=>t[a],enumerable:!(s=x(t,a))||s.enumerable});return e};var b=(e,t,r)=>(r=e!=null?g(H(e)):{},d(t||!e||!e.__esModule?l(r,"default",{value:e,enumerable:!0}):r,e)),A=e=>d(l({},"__esModule",{value:!0}),e);var y={};R(y,{Alert:()=>f,AlertDescription:()=>u,AlertTitle:()=>v});module.exports=A(y);var p=require("class-variance-authority"),o=b(require("react"),1);var c=require("cnfast"),m=require("cnfast");function i(...e){return(0,m.twMerge)((0,c.clsx)(e))}var n=require("react/jsx-runtime"),L=(0,p.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-surface text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),f=o.forwardRef(({className:e,variant:t,...r},s)=>(0,n.jsx)("div",{ref:s,role:"alert",className:i(L({variant:t}),e),...r}));f.displayName="Alert";var v=o.forwardRef(({className:e,...t},r)=>(0,n.jsx)("h5",{ref:r,className:i("mb-1 font-medium leading-none tracking-tight",e),...t}));v.displayName="AlertTitle";var u=o.forwardRef(({className:e,...t},r)=>(0,n.jsx)("div",{ref:r,className:i("text-sm [&_p]:leading-relaxed",e),...t}));u.displayName="AlertDescription";0&&(module.exports={Alert,AlertDescription,AlertTitle});
@@ -0,0 +1,11 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import * as React from 'react';
4
+
5
+ declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
6
+ variant?: "default" | "destructive" | null | undefined;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
9
+ declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
10
+
11
+ export { Alert, AlertDescription, AlertTitle };
@@ -0,0 +1,11 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import * as React from 'react';
4
+
5
+ declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
6
+ variant?: "default" | "destructive" | null | undefined;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
9
+ declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
10
+
11
+ export { Alert, AlertDescription, AlertTitle };
@@ -0,0 +1 @@
1
+ import{a,b,c}from"../../chunk-SSENH35Y.js";import"../../chunk-LWYDGDPW.js";import"../../chunk-WOT6VMZA.js";export{a as Alert,c as AlertDescription,b as AlertTitle};
@@ -0,0 +1 @@
1
+ "use strict";var A=Object.create;var o=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var w=(a,e)=>{for(var t in e)o(a,t,{get:e[t],enumerable:!0})},s=(a,e,t,v)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of y(e))!h.call(a,i)&&i!==t&&o(a,i,{get:()=>e[i],enumerable:!(v=P(e,i))||v.enumerable});return a};var c=(a,e,t)=>(t=a!=null?A(N(a)):{},s(e||!a||!a.__esModule?o(t,"default",{value:a,enumerable:!0}):t,a)),g=a=>s(o({},"__esModule",{value:!0}),a);var b={};w(b,{Avatar:()=>n,AvatarFallback:()=>d,AvatarImage:()=>u});module.exports=g(b);var r=c(require("@radix-ui/react-avatar"),1),l=c(require("react"),1);var p=require("cnfast"),R=require("cnfast");function m(...a){return(0,R.twMerge)((0,p.clsx)(a))}var f=require("react/jsx-runtime"),n=l.forwardRef(({className:a,...e},t)=>(0,f.jsx)(r.Root,{ref:t,className:m("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...e}));n.displayName=r.Root.displayName;var u=l.forwardRef(({className:a,...e},t)=>(0,f.jsx)(r.Image,{ref:t,className:m("aspect-square h-full w-full",a),...e}));u.displayName=r.Image.displayName;var d=l.forwardRef(({className:a,...e},t)=>(0,f.jsx)(r.Fallback,{ref:t,className:m("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...e}));d.displayName=r.Fallback.displayName;0&&(module.exports={Avatar,AvatarFallback,AvatarImage});
@@ -0,0 +1,8 @@
1
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
2
+ import * as React from 'react';
3
+
4
+ declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
5
+ declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
6
+ declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
7
+
8
+ export { Avatar, AvatarFallback, AvatarImage };
@@ -0,0 +1,8 @@
1
+ import * as AvatarPrimitive from '@radix-ui/react-avatar';
2
+ import * as React from 'react';
3
+
4
+ declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
5
+ declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
6
+ declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
7
+
8
+ export { Avatar, AvatarFallback, AvatarImage };
@@ -0,0 +1 @@
1
+ import{a as r}from"../../chunk-LWYDGDPW.js";import"../../chunk-WOT6VMZA.js";import*as a from"@radix-ui/react-avatar";import*as o from"react";import{jsx as m}from"react/jsx-runtime";var l=o.forwardRef(({className:e,...t},i)=>m(a.Root,{ref:i,className:r("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));l.displayName=a.Root.displayName;var f=o.forwardRef(({className:e,...t},i)=>m(a.Image,{ref:i,className:r("aspect-square h-full w-full",e),...t}));f.displayName=a.Image.displayName;var v=o.forwardRef(({className:e,...t},i)=>m(a.Fallback,{ref:i,className:r("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));v.displayName=a.Fallback.displayName;export{l as Avatar,v as AvatarFallback,f as AvatarImage};
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},l=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u(e))!b.call(r,o)&&o!==t&&a(r,o,{get:()=>e[o],enumerable:!(n=f(e,o))||n.enumerable});return r};var x=r=>l(a({},"__esModule",{value:!0}),r);var v={};m(v,{Badge:()=>y,badgeVariants:()=>c});module.exports=x(v);var p=require("class-variance-authority");var i=require("cnfast"),s=require("cnfast");function d(...r){return(0,s.twMerge)((0,i.clsx)(r))}var g=require("react/jsx-runtime"),c=(0,p.cva)("inline-flex leading-tight items-center gap-1 text-[11px] cursor-pointer rounded-md border px-2.5 py-0.5 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",active:"text-primary-foreground border-primary bg-primary px-2 py-px font-light",inactive:"text-foreground border-border bg-secondary hover:bg-accent px-2 py-px font-light"}},defaultVariants:{variant:"default"}});function y({className:r,variant:e,...t}){return(0,g.jsx)("div",{className:d(c({variant:e}),r),...t})}0&&(module.exports={Badge,badgeVariants});
@@ -0,0 +1,13 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import { VariantProps } from 'class-variance-authority';
4
+ import * as React from 'react';
5
+
6
+ declare const badgeVariants: (props?: ({
7
+ variant?: "default" | "outline" | "secondary" | "destructive" | "active" | "inactive" | null | undefined;
8
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
9
+ interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
10
+ }
11
+ declare function Badge({ className, variant, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
12
+
13
+ export { Badge, type BadgeProps, badgeVariants };
@@ -0,0 +1,13 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+ import { VariantProps } from 'class-variance-authority';
4
+ import * as React from 'react';
5
+
6
+ declare const badgeVariants: (props?: ({
7
+ variant?: "default" | "outline" | "secondary" | "destructive" | "active" | "inactive" | null | undefined;
8
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
9
+ interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
10
+ }
11
+ declare function Badge({ className, variant, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
12
+
13
+ export { Badge, type BadgeProps, badgeVariants };
@@ -0,0 +1 @@
1
+ import{a,b}from"../../chunk-TEL5ACJE.js";import"../../chunk-LWYDGDPW.js";import"../../chunk-WOT6VMZA.js";export{b as Badge,a as badgeVariants};
@@ -0,0 +1 @@
1
+ "use strict";var w=Object.create;var s=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var R=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},g=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of L(r))!C.call(e,a)&&a!==t&&s(e,a,{get:()=>r[a],enumerable:!(i=B(r,a))||i.enumerable});return e};var _=(e,r,t)=>(t=e!=null?w(V(e)):{},g(r||!e||!e.__esModule?s(t,"default",{value:e,enumerable:!0}):t,e)),M=e=>g(s({},"__esModule",{value:!0}),e);var P={};R(P,{Button:()=>z,buttonVariants:()=>u});module.exports=M(P);var h=require("@radix-ui/react-slot"),y=require("class-variance-authority"),k=_(require("react"),1);var v=require("lucide-react");var m=require("cnfast"),b=require("cnfast");function o(...e){return(0,b.twMerge)((0,m.clsx)(e))}var x=require("react/jsx-runtime");var f=({className:e=""})=>(0,x.jsx)(v.Loader,{className:o("h-5 w-5 animate-spin text-foreground/90",e)});var n=require("react/jsx-runtime"),u=(0,y.cva)("group/button cursor-pointer duration-300 inline-flex shrink-0 items-center justify-center rounded border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary hover:bg-primary/80 text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted/30 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-4 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),z=k.forwardRef(({className:e,variant:r,size:t,asChild:i=!1,loading:a=!1,children:d,disabled:N,...l},c)=>{let p=i?h.Slot:"button";return i?(0,n.jsx)(p,{className:o(u({variant:r,size:t,className:e})),ref:c,...l,children:d}):(0,n.jsxs)(p,{className:o(u({variant:r,size:t,className:e})),ref:c,disabled:N||a,...l,children:[a&&(0,n.jsx)(f,{className:"absolute h-4 w-4 text-primary-foreground"}),a?(0,n.jsx)("span",{className:"opacity-0",children:d}):d]})});z.displayName="Button";0&&(module.exports={Button,buttonVariants});
@@ -0,0 +1,15 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import * as React from 'react';
4
+
5
+ declare const buttonVariants: (props?: ({
6
+ variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
7
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
8
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
9
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
+ asChild?: boolean;
11
+ loading?: boolean;
12
+ }
13
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
14
+
15
+ export { Button, type ButtonProps, buttonVariants };