@chaibuilder/sdk 4.0.0-beta.4 → 4.0.0-beta.41

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 (266) hide show
  1. package/README.md +72 -50
  2. package/dist/{2SSKDMRQ-Difo_1pg.js → 2SSKDMRQ-CdpXONNF.js} +3 -3
  3. package/dist/{2SSKDMRQ-CopJgtZb.cjs → 2SSKDMRQ-Dq_oq6gn.cjs} +1 -1
  4. package/dist/{AP7HFJJL-BPuPBqj4.js → AP7HFJJL-CZb0rAxI.js} +1 -1
  5. package/dist/{AP7HFJJL-DYxDgaOs.cjs → AP7HFJJL-Do14BULM.cjs} +1 -1
  6. package/dist/{IconPicker-B2-oriq2.js → IconPicker-CvZSjXc6.js} +2 -2
  7. package/dist/{IconPicker-C0oycHbs.cjs → IconPicker-DUN9bxmQ.cjs} +1 -1
  8. package/dist/STRINGS-BExFecZW.js +8 -0
  9. package/dist/STRINGS-FNnfjF5H.cjs +1 -0
  10. package/dist/{WDYDFRGG-DbejaRPK.cjs → WDYDFRGG-DfczfcZ8.cjs} +1 -1
  11. package/dist/{WDYDFRGG-KK8pkcW1.js → WDYDFRGG-Dxa2zFdt.js} +4 -4
  12. package/dist/{actions-registery-y_ENc8zj.js → actions-registery-CMKfEXxX.js} +3397 -3202
  13. package/dist/actions-registery-CqhNZFV3.cjs +481 -0
  14. package/dist/actions.cjs +1 -1
  15. package/dist/actions.d.ts +0 -158
  16. package/dist/actions.js +3 -3
  17. package/dist/{active-in-another-tab-DkR2HWI4.js → active-in-another-tab-BREv3Xj8.js} +5 -5
  18. package/dist/{active-in-another-tab-Cu_ASKtx.cjs → active-in-another-tab-C9o276yY.cjs} +1 -1
  19. package/dist/{add-new-language-page-CBY0RR6q.js → add-new-language-page-C4PSVDV5.js} +4 -4
  20. package/dist/{add-new-language-page-BXuwluuU.cjs → add-new-language-page-jHLJjrl1.cjs} +1 -1
  21. package/dist/{add-new-page-C_PzKby8.cjs → add-new-page-BPPMxBYi.cjs} +1 -1
  22. package/dist/add-new-page-DomZuT16.js +31 -0
  23. package/dist/{ai-panel-content--YM01Aly.js → ai-panel-content-CsmUoTCg.js} +6 -6
  24. package/dist/{ai-panel-content-rRmJdH7L.cjs → ai-panel-content-DlS51Qef.cjs} +1 -1
  25. package/dist/ai-panel-default-lang-BRVlAMMU.js +317 -0
  26. package/dist/ai-panel-default-lang-DVKDEnbe.cjs +3 -0
  27. package/dist/ai-panel-other-lang-B-2xJz2W.cjs +1 -0
  28. package/dist/ai-panel-other-lang-BPVS6lO_.js +132 -0
  29. package/dist/{ai-prompt-input-DueQYNf-.js → ai-prompt-input-B0FMhaLB.js} +30 -34
  30. package/dist/{ai-prompt-input-N9PcYCFa.cjs → ai-prompt-input-CY2pBPzO.cjs} +1 -1
  31. package/dist/{ai-translation-prompt-B36F3d7K.js → ai-translation-prompt-6LlaU9LO.js} +2 -2
  32. package/dist/{ai-translation-prompt-IAdWMNZb.cjs → ai-translation-prompt-BwhKmgC3.cjs} +1 -1
  33. package/dist/apply-binding-BuwI_Uf5.cjs +41 -0
  34. package/dist/apply-binding-RQRSIe56.js +942 -0
  35. package/dist/change-password-modal-BlSTfit6.js +137 -0
  36. package/dist/change-password-modal-wbCcGfDM.cjs +1 -0
  37. package/dist/{code-display-DloSPyPr.cjs → code-display-BR-gij5j.cjs} +1 -1
  38. package/dist/{code-display-Ck81Id9K.js → code-display-DdWcOQ_i.js} +1 -1
  39. package/dist/code-editor-BC_saYAw.cjs +1 -0
  40. package/dist/code-editor-Be5VT6om.js +57 -0
  41. package/dist/{continue-editing-in-this-client-DmGFLHXw.cjs → continue-editing-in-this-client-Bs_3q1hH.cjs} +1 -1
  42. package/dist/{continue-editing-in-this-client-Dm9cCj7K.js → continue-editing-in-this-client-Z1rBUPU8.js} +3 -3
  43. package/dist/core-czmLeR0h.cjs +1 -0
  44. package/dist/core-nSRy3D7z.js +54 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +285 -103
  47. package/dist/core.js +71 -42
  48. package/dist/{css-import-modal-9P_0uNa4.js → css-import-modal-DMZRgpy0.js} +8 -8
  49. package/dist/{css-import-modal-Rh1QAVxo.cjs → css-import-modal-QaTHJ7CT.cjs} +1 -1
  50. package/dist/delete-page-BoP3I06P.js +84 -0
  51. package/dist/delete-page-CjXYHAsS.cjs +1 -0
  52. package/dist/{design-token-usage-MNYsFlPG.js → design-token-usage-DFanW2r-.js} +26 -26
  53. package/dist/{design-token-usage-CXglXgcJ.cjs → design-token-usage-kEPgi-3C.cjs} +1 -1
  54. package/dist/{digital-asset-manager-CqCWBO0s.js → digital-asset-manager-BbI7Ye34.js} +6 -6
  55. package/dist/digital-asset-manager-N8tcW28y.cjs +1 -0
  56. package/dist/{duplicate-page-DzZByALW.cjs → duplicate-page-B-4nFU4j.cjs} +1 -1
  57. package/dist/{duplicate-page-BknLfqr0.js → duplicate-page-C6y7FdRQ.js} +7 -7
  58. package/dist/{dynamic-page-selector-WA007Sni.cjs → dynamic-page-selector-Cq4U-49i.cjs} +1 -1
  59. package/dist/{dynamic-page-selector-DoW7OyUB.js → dynamic-page-selector-DQCWphi0.js} +16 -16
  60. package/dist/fonts/bungee/Bungee-Regular.woff2 +0 -0
  61. package/dist/fonts/dm_sans/dm-sans-variable.woff2 +0 -0
  62. package/dist/fonts/geist/Geist-VariableFont_wght.ttf +0 -0
  63. package/dist/fonts/geist/Geist-VariableFont_wght.woff2 +0 -0
  64. package/dist/fonts/geist/geist-variable.woff2 +0 -0
  65. package/dist/fonts/geist-mono/GeistMono-VariableFont_wght.woff2 +0 -0
  66. package/dist/fonts/inter/inter-latin.woff2 +0 -0
  67. package/dist/fonts/inter/inter-variable.woff2 +1449 -0
  68. package/dist/fonts/lato/lato-variable.woff2 +0 -0
  69. package/dist/fonts/lavishly_yours/lavishly-yours.woff2 +11 -0
  70. package/dist/fonts/merriweather/merriweather-variable.woff2 +11 -0
  71. package/dist/fonts/montserrat/montserrat-variable.woff2 +0 -0
  72. package/dist/fonts/nunito_sans/nunito-sans-variable.woff2 +11 -0
  73. package/dist/fonts/open_sans/open-sans-variable.woff2 +0 -0
  74. package/dist/fonts/oswald/oswald-variable.woff2 +0 -0
  75. package/dist/fonts/playfair_display/playfair-display-variable.woff2 +11 -0
  76. package/dist/fonts/poppins/poppins-variable.woff2 +0 -0
  77. package/dist/fonts/raleway/raleway-variable.woff2 +0 -0
  78. package/dist/fonts/roboto/roboto-variable.woff2 +11 -0
  79. package/dist/fonts/source_sans_3/source-sans-3-variable.woff2 +11 -0
  80. package/dist/fonts/ubuntu/ubuntu-variable.woff2 +0 -0
  81. package/dist/fonts-B3UYxuJI.js +25 -0
  82. package/dist/fonts-D5fTqvSS.cjs +1 -0
  83. package/dist/{get-chai-builder-tailwind-config-BFePCEIS.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
  84. package/dist/{get-chai-builder-tailwind-config-BXf_xLHk.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +5 -5
  85. package/dist/{get-chai-builder-theme-BApShjRz.cjs → get-chai-builder-theme-B5RkBTsB.cjs} +1 -1
  86. package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-BpuwSLeS.js} +1 -1
  87. package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
  88. package/dist/image-compression-UaU7Bwqe.cjs +1 -0
  89. package/dist/{image-editor-CqwaVxO2.cjs → image-editor-565A0NpE.cjs} +1 -1
  90. package/dist/{image-editor-CQnNtak2.js → image-editor-Dz_HQ0I8.js} +1 -1
  91. package/dist/index-3pEi7VzS.cjs +5 -0
  92. package/dist/index-C3CV1lXL.cjs +160 -0
  93. package/dist/index-CDVuf3C1.js +5118 -0
  94. package/dist/{index-rAcNbjk_.js → index-wBr2Ml98.js} +6152 -6102
  95. package/dist/{json-diff-viewer-CLuUHiPU.cjs → json-diff-viewer-CMYFM6D6.cjs} +7 -7
  96. package/dist/{json-diff-viewer-CMvGUvJ2.js → json-diff-viewer-DG7a5-2B.js} +87 -85
  97. package/dist/{lang-panel-CnwTb05j.js → lang-panel-BvGiJJ8s.js} +26 -26
  98. package/dist/lang-panel-D97iJH-l.cjs +1 -0
  99. package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
  100. package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
  101. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
  102. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
  103. package/dist/library-blocks/bento/product-features/product-features.html +159 -0
  104. package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
  105. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
  106. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
  107. package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
  108. package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
  109. package/dist/library-blocks/blocks-list.json +149 -0
  110. package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
  111. package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
  112. package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
  113. package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
  114. package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
  115. package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
  116. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
  117. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
  118. package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
  119. package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
  120. package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
  121. package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
  122. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
  123. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
  124. package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
  125. package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
  126. package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
  127. package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
  128. package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
  129. package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
  130. package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
  131. package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
  132. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
  133. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
  134. package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
  135. package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
  136. package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
  137. package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
  138. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
  139. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
  140. package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
  141. package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
  142. package/dist/manage-design-tokens-4Gu6TMKZ.js +446 -0
  143. package/dist/manage-design-tokens-Do9Kptp3.cjs +1 -0
  144. package/dist/manage-design-tokens-modal-Btbdgoun.cjs +1 -0
  145. package/dist/manage-design-tokens-modal-CkyFE8NW.js +161 -0
  146. package/dist/{mark-as-template-DBLshWb5.js → mark-as-template-Djhnj93U.js} +11 -11
  147. package/dist/{mark-as-template-CpWEBJGd.cjs → mark-as-template-QPJ0DqxL.cjs} +1 -1
  148. package/dist/{nested-path-selector-content-C2sD9dkq.cjs → nested-path-selector-content-BcmSxXxL.cjs} +1 -1
  149. package/dist/{nested-path-selector-content-6OBJ8LG8.js → nested-path-selector-content-DkPIHcVj.js} +2 -2
  150. package/dist/{no-language-page-content-CzENgtnu.js → no-language-page-content-DTq-5StU.js} +9 -9
  151. package/dist/{no-language-page-content-BvPDdccK.cjs → no-language-page-content-ZQz4Kr0-.cjs} +1 -1
  152. package/dist/{no-language-page-dialog-CbYI2cVg.js → no-language-page-dialog-2rA-YBbC.js} +2 -2
  153. package/dist/{no-language-page-dialog-CgW4yJBC.cjs → no-language-page-dialog-BsLkwJID.cjs} +1 -1
  154. package/dist/{page-creator-Cc83uQqw.js → page-creator-Dzpc0_dN.js} +143 -143
  155. package/dist/page-creator-lcDUpPjh.cjs +1 -0
  156. package/dist/{page-lock-CT7SmQqp.cjs → page-lock-B2GU-1YM.cjs} +1 -1
  157. package/dist/{page-lock-BJUkyxdh.js → page-lock-ulFtdOkt.js} +2 -2
  158. package/dist/{page-locked-dialog-DsEbWRed.js → page-locked-dialog-B9VpkvhN.js} +22 -22
  159. package/dist/page-locked-dialog-CJ53Z6sQ.cjs +1 -0
  160. package/dist/page-manager-new-CkoS0B1i.cjs +1 -0
  161. package/dist/page-manager-new-OoC8W7Yn.js +408 -0
  162. package/dist/{page-manager-search-and-filter-Bfm0j1gg.cjs → page-manager-search-and-filter-BosoN3wg.cjs} +1 -1
  163. package/dist/{page-manager-search-and-filter-zq-LfhQ1.js → page-manager-search-and-filter-JfSTGlvp.js} +30 -29
  164. package/dist/{page-revisions-content-D38G2tJM.js → page-revisions-content-DsFh5itr.js} +133 -122
  165. package/dist/page-revisions-content-Dtd-t1N3.cjs +1 -0
  166. package/dist/pages.cjs +1 -1
  167. package/dist/pages.d.ts +330 -96
  168. package/dist/pages.js +23 -19
  169. package/dist/plugin-BSjgGgwo.js +248 -0
  170. package/dist/plugin-DHpuZZXz.cjs +22 -0
  171. package/dist/publish-pages-content-C7oS7pkz.cjs +1 -0
  172. package/dist/{publish-pages-content-CS7f41Ac.js → publish-pages-content-DJc7iu8d.js} +39 -39
  173. package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-D6GjnauV.js} +87 -87
  174. package/dist/register-chai-top-bar-DyW9GPzV.cjs +1 -0
  175. package/dist/render.cjs +2 -2
  176. package/dist/render.d.ts +20 -18
  177. package/dist/render.js +133 -132
  178. package/dist/{rte-widget-modal-BKNx2wln.cjs → rte-widget-modal-BKQaoxh9.cjs} +1 -1
  179. package/dist/{rte-widget-modal-D6Zik0Ta.js → rte-widget-modal-BdBYmqgs.js} +10 -10
  180. package/dist/runtime-client.cjs +1 -0
  181. package/dist/runtime-client.d.ts +158 -0
  182. package/dist/runtime-client.js +32 -0
  183. package/dist/runtime.cjs +11 -1
  184. package/dist/runtime.d.ts +153 -270
  185. package/dist/runtime.js +107 -71
  186. package/dist/{save-to-lib-WwOzbgiF.js → save-to-lib-5nwSdZ9R.js} +153 -147
  187. package/dist/save-to-lib-D0WdH4lq.cjs +1 -0
  188. package/dist/sdk.css +1 -1
  189. package/dist/{selected-block-display-B1SG_UXw.js → selected-block-display-D8ROZHHv.js} +12 -12
  190. package/dist/{selected-block-display-BOgnQRLF.cjs → selected-block-display-DjYeUPdU.cjs} +1 -1
  191. package/dist/{seo-panel-BkOgRoWd.js → seo-panel-BbyRNAEo.js} +27 -27
  192. package/dist/seo-panel-DRjSxmk5.cjs +2 -0
  193. package/dist/shared-json-ld-BbNLdzCO.cjs +1 -0
  194. package/dist/{shared-json-ld-uka9TOgA.js → shared-json-ld-EPbpTI9V.js} +88 -88
  195. package/dist/{slug-input-Cyd6NR6J.cjs → slug-input-CIzxXknM.cjs} +1 -1
  196. package/dist/{slug-input-DHLmUNrH.js → slug-input-DSbJecNr.js} +8 -8
  197. package/dist/supabase-actions.cjs +1 -1
  198. package/dist/supabase-actions.d.ts +45 -0
  199. package/dist/supabase-actions.js +380 -275
  200. package/dist/{take-over-request-Ca0X-qyf.js → take-over-request-BOGDk0H4.js} +13 -13
  201. package/dist/take-over-request-BXntCMdj.cjs +1 -0
  202. package/dist/{translation-warning-modal-pSZVKcNW.cjs → translation-warning-modal-DhJaOyLo.cjs} +1 -1
  203. package/dist/{translation-warning-modal-DrpFeI83.js → translation-warning-modal-reVr0L9e.js} +9 -9
  204. package/dist/types.cjs +1 -0
  205. package/dist/types.d.ts +756 -0
  206. package/dist/types.js +1 -0
  207. package/dist/{unmark-as-template-BMqgelv-.js → unmark-as-template-BM85Y7WK.js} +11 -11
  208. package/dist/{unmark-as-template-DF1Ms4VN.cjs → unmark-as-template-DOPyeU7R.cjs} +1 -1
  209. package/dist/unpublish-page-DHfds-1-.js +28 -0
  210. package/dist/{unpublish-page-Bsq2yEqQ.cjs → unpublish-page-Dz028Bzp.cjs} +1 -1
  211. package/dist/unpublished-partials-modal-BO5ZZdTw.js +52 -0
  212. package/dist/unpublished-partials-modal-CMqQa9-m.cjs +1 -0
  213. package/dist/utils.cjs +1 -1
  214. package/dist/utils.d.ts +6 -6
  215. package/dist/utils.js +2 -2
  216. package/dist/web-blocks.cjs +1 -1
  217. package/dist/web-blocks.js +360 -351
  218. package/dist/{web-preview-kres0aG7.cjs → web-preview-5MzixBt5.cjs} +1 -1
  219. package/dist/{web-preview-D6h1L2nV.js → web-preview-BNjG8s8A.js} +2 -2
  220. package/package.json +34 -35
  221. package/dist/actions-registery-JdxhXhT6.cjs +0 -418
  222. package/dist/add-new-page-DJLJFLAd.js +0 -31
  223. package/dist/ai-panel-default-lang-BZl0tPYo.js +0 -341
  224. package/dist/ai-panel-default-lang-D2zhXvKP.cjs +0 -3
  225. package/dist/ai-panel-other-lang-Bfjk2CYZ.js +0 -162
  226. package/dist/ai-panel-other-lang-Y4bEKHoG.cjs +0 -1
  227. package/dist/apply-binding-BvWfJCSZ.js +0 -841
  228. package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
  229. package/dist/code-editor-Bb7JumZy.js +0 -51
  230. package/dist/code-editor-DQB8lAOk.cjs +0 -1
  231. package/dist/core-Dr7QYemB.js +0 -56
  232. package/dist/core-Y0lXLwkq.cjs +0 -1
  233. package/dist/delete-design-token-BG8yHcS5.cjs +0 -1
  234. package/dist/delete-design-token-COvR4G1S.js +0 -40
  235. package/dist/delete-page-CNucxe4P.js +0 -71
  236. package/dist/delete-page-DAvEjHwF.cjs +0 -1
  237. package/dist/digital-asset-manager-CB5MRBcW.cjs +0 -1
  238. package/dist/fonts/GeistMonoVF.woff +0 -0
  239. package/dist/fonts/GeistVF.woff +0 -0
  240. package/dist/fonts-B-Xt29pe.cjs +0 -1
  241. package/dist/fonts-DRly3Wzd.js +0 -78
  242. package/dist/image-compression-DZ9WMmyn.cjs +0 -1
  243. package/dist/index-B-rSiAp_.cjs +0 -1
  244. package/dist/index-C0-pgg_p.cjs +0 -5
  245. package/dist/index-C99FhuF1.cjs +0 -160
  246. package/dist/index-Dno42B0a.js +0 -4734
  247. package/dist/index-Dxfyt4d4.js +0 -39
  248. package/dist/lang-panel-fDCYm5Jm.cjs +0 -1
  249. package/dist/manage-design-tokens-BsSZE9Vs.js +0 -241
  250. package/dist/manage-design-tokens-BvH5KTJX.cjs +0 -1
  251. package/dist/page-creator-g8GqgcKH.cjs +0 -1
  252. package/dist/page-locked-dialog-Co5b9XIZ.cjs +0 -1
  253. package/dist/page-manager-new-5rFP5DyQ.js +0 -395
  254. package/dist/page-manager-new-BOkJImo2.cjs +0 -1
  255. package/dist/page-revisions-content-ag-MHBGr.cjs +0 -1
  256. package/dist/plugin-BGlQf0iy.cjs +0 -22
  257. package/dist/plugin-C-ht41UZ.js +0 -245
  258. package/dist/publish-pages-content-BiX-GMLw.cjs +0 -1
  259. package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
  260. package/dist/save-to-lib-ffjCZYJ5.cjs +0 -1
  261. package/dist/seo-panel-FjS1UF_y.cjs +0 -2
  262. package/dist/shared-json-ld-yJkXjENy.cjs +0 -1
  263. package/dist/take-over-request-CmpJVe9T.cjs +0 -1
  264. package/dist/theme-panel-footer-BUXIu252.js +0 -26
  265. package/dist/theme-panel-footer-CKO9YYwZ.cjs +0 -1
  266. package/dist/unpublish-page-BJ0Bsvt2.js +0 -28
@@ -1,39 +0,0 @@
1
- import { keys as c, intersection as t, get as d, each as g, isEmpty as l, omit as h } from "lodash-es";
2
- const i = "#styles:", y = (e) => {
3
- const n = ["_type", "_id", "_parent", "_bindings", "_name"], o = ["$loading", "blockProps", "inBuilder", "lang", "draft", "pageProps", "pageData", "children"], r = c(e.properties);
4
- if (t(r, n).length > 0)
5
- throw new Error(`Reserved props are not allowed: ${t(r, n).join(", ")}`);
6
- if (t(r, o).length > 0)
7
- throw new Error(`Runtime props are not allowed in schema: ${t(r, o).join(", ")}`);
8
- const s = d(e, "properties", {}), u = {};
9
- return g(s, (a, p) => {
10
- l(a.ui) || (u[p] = { ...a.ui }, delete s[p].ui);
11
- }), {
12
- schema: l(s) ? {} : { ...h(e, ["ui"]) },
13
- uiSchema: { ...d(e, "ui", {}), ...u }
14
- };
15
- }, P = (e = "") => ({
16
- type: "string",
17
- styles: !0,
18
- default: `${i},${e}`,
19
- ui: { "ui:widget": "hidden" }
20
- }), w = (e = "") => ({
21
- type: "string",
22
- styles: !0,
23
- default: `${i},${e}`,
24
- ui: { "ui:widget": "hidden" }
25
- }), $ = (e) => (console.warn("runtimeProp is deprecated, use builderProp instead"), {
26
- runtime: !0,
27
- ...e
28
- }), f = (e) => ({
29
- builderProp: !0,
30
- ...e
31
- }), _ = (e) => `${i},${e}`;
32
- export {
33
- P as S,
34
- $ as a,
35
- f as b,
36
- _ as d,
37
- y as r,
38
- w as s
39
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-BqwKw4uy.cjs"),a=require("./index-C99FhuF1.cjs"),n=require("./index-C0-pgg_p.cjs"),r=require("lodash-es"),j=require("lucide-react"),c=require("react"),I=require("react-i18next"),L=require("sonner"),k=require("jotai"),M=({page:s,onClose:p})=>{const{t:l}=I.useTranslation(),[o,P]=c.useState(s.slug||""),{mutate:y,isPending:f}=n.useChangeSlug(),{data:i}=n.usePageTypes(),d=r.find(i,{key:s==null?void 0:s.pageType}),E=h=>{if(h.preventDefault(),!(s!=null&&s.primaryPage)&&Object.keys(n.LANGUAGES).some(S=>o===`/${S}`||r.startsWith(o,`/${S}/`))){L.toast.error(l("Error"),{description:l("Slugs cannot start with a language code for primary page")});return}y({...s,slug:o},{onSuccess:p})},m=(s==null?void 0:s.lang)||"";return e.jsx(a.Dialog,{open:!!s,onOpenChange:p,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:l("Change Slug")}),e.jsx(a.DialogDescription,{className:"text-xs",children:e.jsxs(N.Alert,{variant:"destructive",className:"mt-2",children:[e.jsx(j.AlertCircle,{className:"h-4 w-4"}),l("Changing the slug may have impact on your SEO. Please proceed with caution.")]})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-4 py-4 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{children:[e.jsxs("span",{children:[l("Type"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(d==null?void 0:d.name)||(s==null?void 0:s.pageType)]})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[l("Name"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",s.name]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(a.Label,{htmlFor:"slug",className:"text-right",children:[l("Slug")," ",e.jsxs("small",{className:"font-light text-gray-500",children:[l("Slug should start with")," /",m]})]}),e.jsx(N.Input,{id:"slug",value:o,onChange:h=>{const x=h.target.value;r.startsWith(x,`/${m}`)&&P(x)},className:"col-span-3",required:!0,pattern:"^/.*",title:l("Slug must start with /"),placeholder:l("Enter page slug")})]})]}),e.jsx(a.DialogFooter,{children:e.jsx(N.Button,{type:"submit",disabled:f||!r.startsWith(o,`/${m}`)||r.isEqual(s==null?void 0:s.slug,o),children:l(f?"Changing...":"Change Slug")})})]})]})})},T=c.lazy(()=>Promise.resolve().then(()=>require("./delete-page-DAvEjHwF.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-Bsq2yEqQ.cjs"))),_=()=>{const{t:s}=I.useTranslation(),p=k.useSetAtom(n.addNewLangAtom),{selectedLang:l,fallbackLang:o,setSelectedLang:P}=a.useLanguages(),{data:y,isFetching:f}=n.useLanguagePages(),{data:i}=n.useChaiCurrentPage(),{data:d}=n.usePageTypes(),E=c.useMemo(()=>{const t=d==null?void 0:d.find(g=>g.key===(i==null?void 0:i.pageType));return i!=null&&i.dynamic?t==null?void 0:t.dynamicSlug:""},[d,i==null?void 0:i.pageType,i==null?void 0:i.dynamic]),[m,h]=c.useState(null),[x,C]=c.useState(null),[S,A]=c.useState(null),{data:b}=n.useWebsiteSetting(),D=r.filter(r.get(b,"languages")||["en"],t=>!r.find(y,{lang:t})&&t!==r.get(b,"fallbackLang"));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("ul",{className:"space-y-2",children:f?e.jsxs("div",{className:"w-full space-y-3 py-4",children:[e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"})]}):r.map(y,t=>{const g=t.lang,v=t.slug,w=!t.primaryPage,G=g===l;return e.jsxs(e.Fragment,{children:[e.jsxs("li",{className:`flex w-full cursor-pointer items-center justify-between rounded p-2 text-slate-500 ${G?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>P(g),children:[e.jsxs("div",{className:"flex-1 gap-x-3",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-[13px] text-slate-800",children:[e.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.get(n.LANGUAGES,w?o:g,g)]}),e.jsxs("div",{children:[v&&e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Slug: ",e.jsx("b",{className:"font-mono font-medium",children:E?`${v}/${E}`:v})]}),e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Name:",e.jsxs("b",{className:"font-medium",children:[" ",t.name," "]})]})]})]}),w?e.jsxs("div",{className:"flex items-center gap-x-1 text-[11px] text-orange-500",children:[e.jsx(j.StarIcon,{fill:"orange",className:"h-3 w-3"}),e.jsx("b",{children:" Primary"})]}):e.jsx("div",{className:"flex items-center gap-x-3",children:e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE,n.PAGES_PERMISSIONS.DELETE_PAGE,n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,onClick:u=>u.stopPropagation(),children:e.jsx(N.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(j.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"z-[9999] text-sm",children:[e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),p({edit:!0,id:t.id,primaryPage:t.primaryPage})},children:[e.jsx(j.PencilIcon,{className:"size-3"}),s("Edit")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:(t==null?void 0:t.online)&&e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),C(t)},children:[e.jsx(j.Power,{className:"size-3"}),s("Unpublish")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.DELETE_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),h(t)},children:[e.jsx(j.TrashIcon,{className:"size-3"}),s("Delete")]})})]})]})})})]},t.id),e.jsx("div",{className:"h-1 w-full border-b"})]})})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.ADD_PAGE],children:e.jsx("div",{className:"flex w-full justify-center",children:e.jsx(N.Button,{variant:"default",size:"sm",disabled:r.isEmpty(D),onClick:()=>{p({primaryPage:i==null?void 0:i.id,edit:!1})},children:s("Add new language page")})})}),m&&e.jsx(c.Suspense,{children:e.jsx(T,{page:m,onClose:()=>h(null)})}),x&&e.jsx(c.Suspense,{children:e.jsx(q,{page:x,onClose:()=>C(null)})}),S&&e.jsx(c.Suspense,{children:e.jsx(M,{page:S,onClose:()=>A(null)})})]})};exports.default=_;
@@ -1,241 +0,0 @@
1
- import { jsx as e, jsxs as a, Fragment as Q } from "react/jsx-runtime";
2
- import { z, B as u } from "./register-chai-top-bar-ESJHs5s-.js";
3
- import { a0 as _, a1 as H, a2 as K, L as X, a3 as q, a4 as J, a5 as Y } from "./index-rAcNbjk_.js";
4
- import { D as ee } from "./apply-binding-BvWfJCSZ.js";
5
- import { MagnifyingGlassIcon as L, PlusIcon as O, TokensIcon as te, ArrowLeftIcon as ne, EyeOpenIcon as se, Pencil1Icon as re, TrashIcon as ae } from "@radix-ui/react-icons";
6
- import { useAtom as oe } from "jotai";
7
- import { nanoid as ie } from "nanoid";
8
- import { useState as g, useRef as le, useMemo as ce, useEffect as de, useCallback as me, Suspense as R, lazy as M } from "react";
9
- import { useTranslation as ue } from "react-i18next";
10
- import { toast as N } from "sonner";
11
- import { twMerge as he } from "tailwind-merge";
12
- const S = (n) => {
13
- const s = n.trim();
14
- return s.length === 0 || s.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(s);
15
- }, fe = (n, s, o, d = !1, i) => {
16
- const m = n.trim();
17
- return m.length === 0 ? "" : m.length > 25 ? o("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m) ? Object.entries(s).find(
18
- ([l, v]) => v.name === m && (!d || l !== i)
19
- ) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
20
- }, xe = (n) => n.replace(/\s+/g, "-"), ge = M(() => import("./delete-design-token-COvR4G1S.js")), pe = M(() => import("./design-token-usage-MNYsFlPG.js")), ve = ({ tokenId: n, token: s, isDisabled: o, onEdit: d, onDelete: i }) => /* @__PURE__ */ a("div", { className: "group relative flex items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 hover:bg-muted/90", children: [
21
- /* @__PURE__ */ a("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
22
- /* @__PURE__ */ e("div", { className: "text-xs font-semibold", children: s.name }),
23
- /* @__PURE__ */ e("div", { className: "w-full max-w-52 truncate text-[10px] font-light", children: s.value })
24
- ] }),
25
- /* @__PURE__ */ a("div", { className: "absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100", children: [
26
- /* @__PURE__ */ e(R, { fallback: null, children: /* @__PURE__ */ e(pe, { tokenId: n, tokenName: s.name, children: /* @__PURE__ */ e(
27
- u,
28
- {
29
- variant: "ghost",
30
- size: "sm",
31
- className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
32
- children: /* @__PURE__ */ e(se, { className: "h-3 w-3" })
33
- }
34
- ) }) }),
35
- /* @__PURE__ */ e(
36
- u,
37
- {
38
- variant: "ghost",
39
- size: "sm",
40
- onClick: () => d(n),
41
- disabled: o,
42
- className: "h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",
43
- children: /* @__PURE__ */ e(re, { className: "h-3 w-3" })
44
- }
45
- ),
46
- /* @__PURE__ */ e(R, { fallback: null, children: /* @__PURE__ */ e(ge, { tokenName: s.name, tokenValue: s.value, onDelete: () => i(n), children: /* @__PURE__ */ e(
47
- u,
48
- {
49
- variant: "ghost",
50
- size: "sm",
51
- disabled: o,
52
- className: "h-6 w-6 rounded-full p-0 hover:bg-destructive/10",
53
- children: /* @__PURE__ */ e(ae, { className: "h-3 w-3 text-destructive" })
54
- }
55
- ) }) })
56
- ] })
57
- ] }), Le = ({}) => {
58
- const { t: n } = ue(), [s, o] = oe(_), d = H(), [i, m] = g("view"), [p, k] = g(null), [l, v] = g(""), [h, b] = g(""), [T, y] = g(""), [w, P] = g(""), [B, C] = g(!1), f = le(null), D = ce(() => Object.entries(s).filter(
59
- ([, t]) => t.name.toLowerCase().includes(w.toLowerCase()) || t.value.toLowerCase().includes(w.toLowerCase())
60
- ), [s, w]);
61
- de(() => () => {
62
- f.current && clearTimeout(f.current);
63
- }, []);
64
- const j = me(
65
- (t, r) => {
66
- !p || i !== "edit" || !t.trim() || !r.trim() || !S(t) || Object.entries(s).find(
67
- ([x, U]) => U.name === t.trim() && x !== p
68
- ) || (C(!0), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
69
- const x = {
70
- ...s,
71
- [p]: {
72
- name: t.trim(),
73
- value: r.trim()
74
- }
75
- };
76
- o(x), d(), C(!1);
77
- }, 250));
78
- },
79
- [p, i, s, o, d]
80
- ), F = () => {
81
- if (!l.trim() || !h.trim()) {
82
- N.error(n("Please fill in both token name and classes"));
83
- return;
84
- }
85
- if (!S(l)) {
86
- N.error(n("Invalid design token name format"));
87
- return;
88
- }
89
- if (Object.values(s).find((x) => x.name === l.trim())) {
90
- N.error(n("Token already exists"));
91
- return;
92
- }
93
- const r = `${ee}${ie(12)}`, c = {
94
- ...s,
95
- [r]: {
96
- name: l.trim(),
97
- value: h.trim()
98
- }
99
- };
100
- o(c), d(), N.success(n("Token added successfully")), A();
101
- }, V = (t) => {
102
- const r = { ...s };
103
- delete r[t], o(r), d(), N.success(n("Token deleted successfully"));
104
- }, W = (t) => {
105
- const r = s[t];
106
- r && (k(t), v(r.name), b(r.value), y(""), m("edit"));
107
- }, E = () => {
108
- k(null), v(""), b(""), y(""), m("add");
109
- }, A = () => {
110
- f.current && clearTimeout(f.current), k(null), v(""), b(""), y(""), C(!1), m("view");
111
- }, Z = (t) => {
112
- const r = xe(t);
113
- v(r);
114
- const c = fe(r, s, n, i === "edit", p || void 0);
115
- y(c), i === "edit" && !c && j(r, h);
116
- }, I = (t) => {
117
- b(t), i === "edit" && !T && l.trim() && j(l, t);
118
- }, $ = (t) => {
119
- const r = J(Y(he(h, t)));
120
- I(r);
121
- }, G = (t) => {
122
- const r = h.split(" ").filter((c) => c !== t).join(" ");
123
- I(r);
124
- };
125
- return /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: i === "view" ? /* @__PURE__ */ a(Q, { children: [
126
- Object.entries(s).length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-x-2", children: [
127
- /* @__PURE__ */ a("div", { className: "relative flex-1", children: [
128
- /* @__PURE__ */ e(L, { className: "absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground" }),
129
- /* @__PURE__ */ e(
130
- z,
131
- {
132
- placeholder: n("Search tokens"),
133
- value: w,
134
- onChange: (t) => P(t.target.value),
135
- className: "h-6 pl-7 text-xs"
136
- }
137
- )
138
- ] }),
139
- /* @__PURE__ */ a(
140
- u,
141
- {
142
- variant: "outline",
143
- onClick: E,
144
- size: "sm",
145
- className: "h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",
146
- children: [
147
- /* @__PURE__ */ e(O, { className: "h-3 w-3" }),
148
- n("Add")
149
- ]
150
- }
151
- )
152
- ] }),
153
- /* @__PURE__ */ e("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ e(K, { className: "h-full flex-1", children: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
154
- Object.entries(s).length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
155
- /* @__PURE__ */ e("div", { className: "mb-2 text-3xl", children: /* @__PURE__ */ e(te, { className: "h-12 w-12 text-muted-foreground" }) }),
156
- /* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No design tokens yet") }),
157
- /* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("Create reusable design tokens to streamline your styling") }),
158
- /* @__PURE__ */ a(u, { variant: "default", onClick: E, size: "sm", className: "mt-4 h-7 text-xs leading-tight", children: [
159
- /* @__PURE__ */ e(O, { className: "mr-1 h-3 w-3" }),
160
- n("Add first design token")
161
- ] })
162
- ] }) : D.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8", children: [
163
- /* @__PURE__ */ e("div", { className: "mb-2", children: /* @__PURE__ */ e(L, { className: "h-10 w-10 text-muted-foreground" }) }),
164
- /* @__PURE__ */ e("p", { className: "mb-1 text-sm font-medium text-foreground", children: n("No tokens found") }),
165
- /* @__PURE__ */ e("p", { className: "text-center text-xs text-muted-foreground", children: n("No design tokens match your search") })
166
- ] }) : D.map(([t, r]) => /* @__PURE__ */ e(
167
- ve,
168
- {
169
- token: r,
170
- tokenId: t,
171
- onEdit: W,
172
- onDelete: V,
173
- isDisabled: !1
174
- },
175
- t
176
- )),
177
- /* @__PURE__ */ e("div", { className: "h-44" })
178
- ] }) }) })
179
- ] }) : (() => {
180
- const t = i === "edit", r = n(t ? "Edit Design Token" : "Add Design Token"), c = n(t ? "Update design token. Auto-saved." : "Create a reusable design token");
181
- return /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
182
- /* @__PURE__ */ a("div", { className: "mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5", children: [
183
- /* @__PURE__ */ e(
184
- u,
185
- {
186
- variant: "ghost",
187
- size: "sm",
188
- onClick: A,
189
- className: "h-6 w-6 rounded-full p-0 hover:bg-muted",
190
- children: /* @__PURE__ */ e(ne, { className: "h-3 w-3" })
191
- }
192
- ),
193
- /* @__PURE__ */ a("div", { className: "flex-1", children: [
194
- /* @__PURE__ */ e("h3", { className: "text-xs font-semibold text-foreground", children: r }),
195
- /* @__PURE__ */ e("p", { className: "text-[10px] text-muted-foreground", children: c })
196
- ] }),
197
- t && B && /* @__PURE__ */ e("div", { className: "flex items-center gap-1 text-[10px] text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-primary" }) })
198
- ] }),
199
- /* @__PURE__ */ a("div", { className: "flex-1 space-y-3 overflow-y-auto", children: [
200
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
201
- /* @__PURE__ */ e(X, { htmlFor: "token-name", className: "text-xs font-medium", children: n("Token Name") }),
202
- /* @__PURE__ */ e(
203
- z,
204
- {
205
- id: "token-name",
206
- placeholder: "Button-Primary",
207
- value: l,
208
- onChange: (x) => Z(x.target.value),
209
- className: "h-7 text-xs"
210
- }
211
- ),
212
- T ? /* @__PURE__ */ e("span", { className: "text-[10px] text-destructive", children: T }) : /* @__PURE__ */ e("span", { className: "text-[10px] font-light text-muted-foreground", children: n("Button-Primary, Card-Header, Text-Large etc.") })
213
- ] }),
214
- /* @__PURE__ */ e(
215
- q,
216
- {
217
- from: "designToken",
218
- classFromProps: h,
219
- onAddNew: $,
220
- onRemove: G
221
- }
222
- ),
223
- !t && /* @__PURE__ */ a("div", { className: "mt-3 flex items-center justify-end gap-2 pt-3", children: [
224
- /* @__PURE__ */ e(u, { variant: "outline", onClick: A, className: "h-7 text-xs", children: n("Cancel") }),
225
- /* @__PURE__ */ e(
226
- u,
227
- {
228
- onClick: F,
229
- disabled: !l.trim() || !h.trim() || !!T,
230
- className: "h-7 text-xs",
231
- children: n("Add Token")
232
- }
233
- )
234
- ] })
235
- ] })
236
- ] });
237
- })() });
238
- };
239
- export {
240
- Le as default
241
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./register-chai-top-bar-BqwKw4uy.cjs"),v=require("./index-C99FhuF1.cjs"),Z=require("./apply-binding-IsUf6UWJ.cjs"),u=require("@radix-ui/react-icons"),$=require("jotai"),U=require("nanoid"),a=require("react"),Q=require("react-i18next"),p=require("sonner"),_=require("tailwind-merge"),q=t=>{const n=t.trim();return n.length===0||n.length>25?!1:/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(n)},H=(t,n,o,m=!1,i)=>{const x=t.trim();return x.length===0?"":x.length>25?o("Token name must be 25 characters or less"):/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(x)?Object.entries(n).find(([l,N])=>N.name===x&&(!m||l!==i))?o("Token name already exists"):"":o("Only alphanumeric characters and hyphens allowed")},K=t=>t.replace(/\s+/g,"-"),X=a.lazy(()=>Promise.resolve().then(()=>require("./delete-design-token-BG8yHcS5.cjs"))),J=a.lazy(()=>Promise.resolve().then(()=>require("./design-token-usage-CXglXgcJ.cjs"))),Y=({tokenId:t,token:n,isDisabled:o,onEdit:m,onDelete:i})=>e.jsxs("div",{className:"group relative flex items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 hover:bg-muted/90",children:[e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:"text-xs font-semibold",children:n.name}),e.jsx("div",{className:"w-full max-w-52 truncate text-[10px] font-light",children:n.value})]}),e.jsxs("div",{className:"absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:[e.jsx(a.Suspense,{fallback:null,children:e.jsx(J,{tokenId:t,tokenName:n.name,children:e.jsx(c.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(u.EyeOpenIcon,{className:"h-3 w-3"})})})}),e.jsx(c.Button,{variant:"ghost",size:"sm",onClick:()=>m(t),disabled:o,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(u.Pencil1Icon,{className:"h-3 w-3"})}),e.jsx(a.Suspense,{fallback:null,children:e.jsx(X,{tokenName:n.name,tokenValue:n.value,onDelete:()=>i(t),children:e.jsx(c.Button,{variant:"ghost",size:"sm",disabled:o,className:"h-6 w-6 rounded-full p-0 hover:bg-destructive/10",children:e.jsx(u.TrashIcon,{className:"h-3 w-3 text-destructive"})})})})]})]}),ee=({})=>{const{t}=Q.useTranslation(),[n,o]=$.useAtom(v.chaiDesignTokensAtom),m=v.useIncrementActionsCount(),[i,x]=a.useState("view"),[j,k]=a.useState(null),[l,N]=a.useState(""),[h,b]=a.useState(""),[T,y]=a.useState(""),[w,E]=a.useState(""),[z,C]=a.useState(!1),f=a.useRef(null),I=a.useMemo(()=>Object.entries(n).filter(([,s])=>s.name.toLowerCase().includes(w.toLowerCase())||s.value.toLowerCase().includes(w.toLowerCase())),[n,w]);a.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const S=a.useCallback((s,r)=>{!j||i!=="edit"||!s.trim()||!r.trim()||!q(s)||Object.entries(n).find(([g,W])=>W.name===s.trim()&&g!==j)||(C(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{const g={...n,[j]:{name:s.trim(),value:r.trim()}};o(g),m(),C(!1)},250))},[j,i,n,o,m]),M=()=>{if(!l.trim()||!h.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!q(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.values(n).find(g=>g.name===l.trim())){p.toast.error(t("Token already exists"));return}const r=`${Z.DESIGN_TOKEN_PREFIX}${U.nanoid(12)}`,d={...n,[r]:{name:l.trim(),value:h.trim()}};o(d),m(),p.toast.success(t("Token added successfully")),A()},P=s=>{const r={...n};delete r[s],o(r),m(),p.toast.success(t("Token deleted successfully"))},R=s=>{const r=n[s];r&&(k(s),N(r.name),b(r.value),y(""),x("edit"))},B=()=>{k(null),N(""),b(""),y(""),x("add")},A=()=>{f.current&&clearTimeout(f.current),k(null),N(""),b(""),y(""),C(!1),x("view")},O=s=>{const r=K(s);N(r);const d=H(r,n,t,i==="edit",j||void 0);y(d),i==="edit"&&!d&&S(r,h)},D=s=>{b(s),i==="edit"&&!T&&l.trim()&&S(l,s)},L=s=>{const r=v.orderClassesByBreakpoint(v.removeDuplicateClasses(_.twMerge(h,s)));D(r)},F=s=>{const r=h.split(" ").filter(d=>d!==s).join(" ");D(r)},G=()=>{const s=i==="edit",r=t(s?"Edit Design Token":"Add Design Token"),d=t(s?"Update design token. Auto-saved.":"Create a reusable design token");return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5",children:[e.jsx(c.Button,{variant:"ghost",size:"sm",onClick:A,className:"h-6 w-6 rounded-full p-0 hover:bg-muted",children:e.jsx(u.ArrowLeftIcon,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xs font-semibold text-foreground",children:r}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:d})]}),s&&z&&e.jsx("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary"})})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(v.Label,{htmlFor:"token-name",className:"text-xs font-medium",children:t("Token Name")}),e.jsx(c.Input,{id:"token-name",placeholder:"Button-Primary",value:l,onChange:g=>O(g.target.value),className:"h-7 text-xs"}),T?e.jsx("span",{className:"text-[10px] text-destructive",children:T}):e.jsx("span",{className:"text-[10px] font-light text-muted-foreground",children:t("Button-Primary, Card-Header, Text-Large etc.")})]}),e.jsx(v.ManualClasses,{from:"designToken",classFromProps:h,onAddNew:L,onRemove:F}),!s&&e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 pt-3",children:[e.jsx(c.Button,{variant:"outline",onClick:A,className:"h-7 text-xs",children:t("Cancel")}),e.jsx(c.Button,{onClick:M,disabled:!l.trim()||!h.trim()||!!T,className:"h-7 text-xs",children:t("Add Token")})]})]})]})},V=()=>e.jsxs(e.Fragment,{children:[Object.entries(n).length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(u.MagnifyingGlassIcon,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx(c.Input,{placeholder:t("Search tokens"),value:w,onChange:s=>E(s.target.value),className:"h-6 pl-7 text-xs"})]}),e.jsxs(c.Button,{variant:"outline",onClick:B,size:"sm",className:"h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",children:[e.jsx(u.PlusIcon,{className:"h-3 w-3"}),t("Add")]})]}),e.jsx("div",{className:"no-scrollbar flex flex-1 flex-col overflow-hidden pt-2",children:e.jsx(v.ScrollArea,{className:"h-full flex-1",children:e.jsxs("div",{className:"space-y-1",children:[Object.entries(n).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2 text-3xl",children:e.jsx(u.TokensIcon,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No design tokens yet")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("Create reusable design tokens to streamline your styling")}),e.jsxs(c.Button,{variant:"default",onClick:B,size:"sm",className:"mt-4 h-7 text-xs leading-tight",children:[e.jsx(u.PlusIcon,{className:"mr-1 h-3 w-3"}),t("Add first design token")]})]}):I.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx(u.MagnifyingGlassIcon,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No tokens found")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("No design tokens match your search")})]}):I.map(([s,r])=>e.jsx(Y,{token:r,tokenId:s,onEdit:R,onDelete:P,isDisabled:!1},s)),e.jsx("div",{className:"h-44"})]})})})]});return e.jsx("div",{className:"flex h-full w-full flex-col",children:i==="view"?V():G()})};exports.default=ee;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./register-chai-top-bar-BqwKw4uy.cjs"),a=require("./index-C99FhuF1.cjs"),w=require("lodash-es"),o=require("react"),_=require("./slug-input-Cyd6NR6J.cjs"),N=require("lucide-react"),k=require("./index-C0-pgg_p.cjs"),je=require("@tanstack/react-query"),J=require("sonner"),fe=require("./get-seo-defaults-Cw7vFt-B.cjs");function Ue({value:t,onChange:c,placeholder:j="Enter custom slug part",dynamicPattern:p,onValidationChange:i}){const[f,m]=o.useState(null),h=o.useRef(null),[g,T]=o.useState(p+t);o.useEffect(()=>{T(p+t)},[t,p]);const O=S=>{const C=S.target.value;if(!C.startsWith(p)){const W=C.replace(p,""),G=p+W;T(G),c(W);return}const l=C.substring(p.length).replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),n=(l.match(/\./g)||[]).length,x=n<=1;n>1?m("Invalid slug. Only one dot (.) is allowed in the slug"):m(null),i&&i(x);const y=p+l;T(y),c(l)},b=()=>{if(h.current){const S=h.current;setTimeout(()=>{const C=p.length;S.setSelectionRange(C,C)},0)}},R=S=>{const C=S.currentTarget;(C.selectionStart||0)<=p.length&&setTimeout(()=>{const l=p.length;C.setSelectionRange(l,l)},0)};return e.jsx("div",{children:e.jsxs("div",{className:"relative",children:[e.jsxs("p",{className:"mb-2 text-xs text-gray-500",children:[`${p}`," is a dynamic segment of slug"]}),e.jsx(v.Input,{ref:h,value:g,onChange:O,onFocus:b,onClick:R,placeholder:j,className:f?"border-red-500":""}),f&&e.jsx("div",{className:"mt-1 text-xs text-red-500",children:f})]})})}const X=({children:t,onWheel:c,...j})=>{const p=i=>{try{i.preventDefault();const f=i.currentTarget;f.scrollTop+=i.deltaY}catch{i.preventDefault()}c&&c(i)};return e.jsx(a.CommandList,{...j,onWheel:p,children:t})},te=(...t)=>t.filter(Boolean).join(" ");function ze({pages:t,selectedParentId:c,onChange:j,className:p,id:i="parentPage",currentPage:f}){const[m,h]=o.useState(!1),[g,T]=o.useState(""),O=v.useChaiFeatureFlag("enable-add-page-dropdown");O||(p="w-full rounded-md border border-gray-300 px-3 py-2");const b=o.useMemo(()=>!t||t.length===0?[]:t.filter(x=>!w.isEmpty(x.slug)).filter(x=>x.slug!=="/").sort((x,y)=>x.slug.localeCompare(y.slug)),[t]),R=o.useMemo(()=>{if(!g.trim())return b;const n=g.toLowerCase();return b.filter(x=>x.name.toLowerCase().includes(n)||x.slug.toLowerCase().includes(n))},[b,g]),S=n=>Math.max(0,(n.match(/\//g)||[]).length-1),C=n=>"    ".repeat(n),d=n=>{if(n==="/")return"/";const x=n.split("/").filter(Boolean);if(x.length<=1){const y=x[0]||"";return`/${_.removeSlugExtension(y)}`}return`/${_.removeSlugExtension(x[x.length-1])}`},l=()=>{if(!c||c==="none")return"None";const n=b.find(x=>x.id===c);return n?`${n.name} (${d(n.slug)})`:"None"};return e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:i,className:"text-sm",children:"Parent"}),O?e.jsxs(a.Popover,{open:m,onOpenChange:h,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{id:i,variant:"outline",role:"combobox",className:te("w-full justify-between",p),"data-testid":"parent-page-selector",children:[l(),e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"relative border-none py-2",children:e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search pages...",className:"h-8 pl-8 text-xs",value:g,onChange:n=>T(n.target.value)})]})})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No pages found."}),e.jsxs(a.CommandGroup,{children:[e.jsxs(a.CommandItem,{value:"none",onSelect:()=>{j(""),h(!1),T("")},className:"flex cursor-pointer items-center justify-between",children:[e.jsx("span",{children:"None"}),e.jsx(N.Check,{className:te("mr-2 h-4 w-4",c?"opacity-0":"opacity-100")})]}),R.map(n=>{const x=C(S(n.slug)),y=d(n.slug),W=e.jsxs("span",{className:"flex items-center text-sm",children:[x,n.name,e.jsxs("span",{className:"text-xs text-gray-500",children:[" (",y,")"]})]});return e.jsxs(a.CommandItem,{value:n.id,onSelect:()=>{j(n.id),h(!1),T("")},className:"flex cursor-pointer items-center justify-between whitespace-pre-wrap",children:[e.jsx("span",{children:W}),e.jsx(N.Check,{className:te("mr-2 h-4 w-4 shrink-0",c===n.id?"opacity-100":"opacity-0")})]},n.id)})]})]})]})})]}):e.jsxs("select",{id:i,value:c||"none",onChange:n=>j(n.target.value),className:p,"data-testid":"parent-page-selector",children:[e.jsx("option",{value:"none",children:"None"}),b.map(n=>{const x=S(n.slug),y=x>0?C(x):"",W=d(n.slug);return(f==null?void 0:f.id)===n.id||n.slug.startsWith(f==null?void 0:f.slug)?null:e.jsxs("option",{value:n.id,children:[y,n.name," (",W,")"]},n.id)})]})]})}const _e=(...t)=>t.filter(Boolean).join(" "),Ve=({templates:t,selectedTemplateId:c,onSelectTemplate:j,isLoading:p=!1})=>{const[i,f]=o.useState(""),[m,h]=o.useState(!1),[g,T]=o.useState(""),O=v.useChaiFeatureFlag("enable-add-page-dropdown");if(o.useEffect(()=>{if(c){const d=t.find(l=>l.id===c);o.startTransition(()=>f((d==null?void 0:d.preview)||""))}else o.startTransition(()=>f(""))},[c,t]),p)return e.jsx("div",{className:"flex h-fit items-center justify-center text-sm text-gray-500",children:"Loading templates..."});if(t.length===0)return null;const b={};t.forEach(d=>{const l=d.libraryName;b[l]||(b[l]=[]),b[l].push(d)});const R=Object.entries(b).reduce((d,[l,n])=>{const x=n.filter(y=>y.name.toLowerCase().includes(g.toLowerCase())||l.toLowerCase().includes(g.toLowerCase()));return x.length>0&&(d[l]=x),d},{}),S=t.find(d=>d.id===c),C=S?w.startCase(S.name):"No Template";return e.jsxs("div",{className:"space-y-4",children:[O?e.jsxs(a.Popover,{open:m,onOpenChange:h,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{variant:"outline",role:"combobox",className:"w-full justify-between",children:[C,e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search templates...",className:"h-8 pl-8 text-xs",value:g,onChange:d=>T(d.target.value)})]})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No templates found."}),Object.entries(R).map(([d,l])=>e.jsx(a.CommandGroup,{heading:d,children:l.map(n=>e.jsxs(a.CommandItem,{value:n.id,onSelect:()=>{j(n.id),h(!1),T("")},className:"flex cursor-pointer items-center justify-between",children:[w.startCase(n.name),e.jsx(N.Check,{className:_e("mr-2 h-4 w-4",c===n.id?"opacity-100":"opacity-0")})]},n.id))},d))]})]})})]}):e.jsxs("select",{className:"w-full rounded-md border border-gray-300 px-3 py-2",value:c,onChange:d=>j(d.target.value),children:[e.jsx("option",{value:"",children:"No Template"}),Object.entries(b).map(([d,l])=>e.jsx("optgroup",{label:d,children:l.map(n=>e.jsx("option",{value:n.id,children:w.startCase(n.name)},n.id))},d))]}),i&&e.jsxs("div",{className:"mt-3 overflow-hidden rounded border",children:[e.jsx("div",{className:"max-h-[200px] overflow-auto",children:e.jsx("img",{src:i,alt:"Template Preview",className:"w-full object-contain"})}),e.jsx("div",{className:"border-t bg-gray-50 p-2 text-xs text-gray-500",children:"Template preview"})]})]})},$e=()=>{const t=k.useApiUrl(),c=k.useFetch();return je.useQuery({queryKey:[k.ACTIONS.GET_LIBRARIES],staleTime:"static",queryFn:async()=>await c(t,{action:k.ACTIONS.GET_LIBRARIES})||[]})},Qe=t=>{const c=k.useApiUrl(),j=k.useFetch();return je.useQuery({queryKey:[k.ACTIONS.GET_TEMPLATES_BY_TYPE,t],staleTime:"static",enabled:!!t,queryFn:async()=>{const p=await j(c,{action:k.ACTIONS.GET_TEMPLATES_BY_TYPE,data:{pageType:t}});return(t?w.filter(p,{pageType:t}):p)||[]}})},Ye=t=>{const{data:c=[],isLoading:j}=Qe(t),{data:p=[],isLoading:i}=$e(),f=o.useMemo(()=>j||i?[]:c.map(h=>{const g=w.find(p,{id:h.library});return{...h,libraryName:(g==null?void 0:g.type)!=="shared"?"Site Library":(g==null?void 0:g.name)+" Library",libraryType:g==null?void 0:g.type}}),[c,p,j,i]),m=o.useMemo(()=>w.groupBy(f,"libraryName"),[f]);return{data:f,groupedData:m,isLoading:j||i}},z=(...t)=>t.filter(Boolean).join(" ");function He({addEditPage:t,close:c,closePanel:j}){var xe,ge;const{data:p}=k.usePageTypes(),i=o.useMemo(()=>p??[],[p]),f=k.useChangePage(),m=!!(t!=null&&t.id),{data:h}=k.useWebsitePages(),{mutate:g,isPending:T}=k.useCreatePage(),{mutate:O,isPending:b}=k.useUpdatePage(),[R,S]=o.useState(null),[C,d]=o.useState(!0),[l,n]=o.useState((t==null?void 0:t.pageType)??"page"),{hasPermission:x}=a.usePermissions(),y=x(k.PAGES_PERMISSIONS.CHANGE_PAGE_TYPE),[W,G]=o.useState(!1),[ye,ve]=o.useState(""),{selectedLang:Se,fallbackLang:Ce}=a.useLanguages(),ne=Se||Ce,[V,H]=o.useState(""),[ae,Q]=o.useState(!1),le=o.useMemo(()=>{const s=i.find(u=>u.key===l);return(s==null?void 0:s.hasSlug)===!1},[l,i]),[D,Ne]=o.useState((t==null?void 0:t.parent)??""),[M,re]=o.useState((t==null?void 0:t.name)??""),[F,oe]=o.useState((t==null?void 0:t.dynamic)??!1),[B,Y]=o.useState(F?"":((t==null?void 0:t.slug)??"").split("/").pop()||""),[ie,ce]=o.useState((t==null?void 0:t.dynamicSlugCustom)??""),[ue,be]=o.useState(!0),[we,P]=o.useState(!1),[E,ke]=o.useState(""),{data:me,isLoading:Le}=Ye(l),$=T||b,he=v.useChaiFeatureFlag("enable-add-page-dropdown"),ee=o.useMemo(()=>!m||!(t!=null&&t.id)||!h?null:h.find(s=>s.id===t.id),[m,t==null?void 0:t.id,h]),Te=(ee==null?void 0:ee.online)||!1,De=o.useMemo(()=>!m||!(t!=null&&t.id)||!h?!1:h.some(s=>s.parent===t.id),[m,t==null?void 0:t.id,h]),r=i.find(s=>s.key===l),U=s=>{if(m&&l!==s){ve(s),G(!0),H(""),Q(!1);return}n(s),H(""),Q(!1)},pe=()=>{n(ye),G(!1),oe(!1)},Ie=s=>{oe(s),s?Y(""):ce("")},Fe=s=>{if(Ne(s),s&&s!=="none"){const u=h==null?void 0:h.find(L=>L.id===s),q=(u==null?void 0:u.slug)||"";if(B.startsWith(q)){const L=B.slice(q.length).replace(/^\/+/,"");Y(L)}else Y(B.replace(/^\/+/,""))}else Y(B?`${B}`:"")},Be=s=>{ke(s)},qe=()=>M.trim()?F&&!w.isEmpty(B)?(S("Slug must be empty when using dynamic slug"),!1):F&&!ue?(S("Dynamic slug is invalid"),!1):!0:(J.toast.error("Name is required"),!1),Ae=()=>{const s={pageType:r==null?void 0:r.key,name:M,slug:"",hasSlug:!1};m?O({id:t==null?void 0:t.id,name:M},{onSuccess:()=>{J.toast.success((r==null?void 0:r.name)+" updated successfully"),c()}}):g(s,{onSuccess:u=>{c(),f(u.page.id,j)}})},Oe=(s,u)=>{if(!s.trim()&&!F)return S("Child page slug is required"),!1;const q=_.removeSlugExtension(u),L=_.combineParentChildSlugs(q,s);return Object.keys(k.LANGUAGES).some(Z=>L===`/${Z}`||(L==null?void 0:L.startsWith(`/${Z}/`)))?(S("Slugs cannot start with a language code for primary page"),!1):!0},We=(s,u)=>{const q=_.removeSlugExtension(u),L=_.combineParentChildSlugs(q,s),I={pageType:l,name:M,slug:L.replace(/\/$/,""),parent:D,dynamic:F,hasSlug:!0,template:E||void 0,tracking:{},seo:{},jsonLD:{}};if(F&&(I.dynamicSlugCustom=ie),m){const A=w.pick(I,["pageType","parent","name","slug","dynamic","dynamicSlugCustom"]);O({id:t==null?void 0:t.id,...A},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}})}else{const A=w.find(i,{key:l});A!=null&&A.trackingDefault&&(I.tracking=A.trackingDefault);const{seo:Z,jsonLD:Ge}=fe.getSeoDefaults(A,ne);w.set(I,"seo",Z),w.set(I,"jsonLD",Ge),g(I,{onSuccess:Me=>{c(),f(Me.page.id,j)}})}},Re=()=>{const s={pageType:l,name:M,slug:B===""?"/":`/${B.replace(/\/$/,"")}`,template:E||void 0,parent:null,tracking:{}};if(m)O({id:t==null?void 0:t.id,...s},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}});else{const u=w.find(i,{key:l});u!=null&&u.trackingDefault&&(s.tracking=u.trackingDefault);const{seo:q,jsonLD:L}=fe.getSeoDefaults(u,ne);w.set(s,"seo",q),w.set(s,"jsonLD",L),g(s,{onSuccess:I=>{var A;(A=I==null?void 0:I.page)!=null&&A.id&&f(I.page.id,j),c()}})}},de=s=>{if(s.preventDefault(),S(null),!!qe()){if(!(r!=null&&r.hasSlug)){Ae();return}if(D&&D!=="none"){const u=h==null?void 0:h.find(L=>L.id===D),q=(u==null?void 0:u.slug)||"";if(!Oe(B,q))return;We(B,q)}else Re()}},{pagesType:se,partialsType:K}=o.useMemo(()=>{const s=u=>V?u.name.toLowerCase().includes(V.toLowerCase())||u.key.toLowerCase().includes(V.toLowerCase()):!0;return{pagesType:i.filter(u=>u.hasSlug!==!1&&s(u)),partialsType:i.filter(u=>u.hasSlug===!1&&s(u))}},[i,V]);return r!=null&&r.hasSlug?e.jsxs("form",{onSubmit:de,className:"mx-auto w-full max-w-md space-y-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(a.Popover,{open:ae,onOpenChange:Q,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:z("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:V,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No page type found."}),m?le?e.jsx(a.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}):e.jsx(a.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}):e.jsxs(e.Fragment,{children:[se.length>0&&e.jsx(a.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}),K.length>0&&e.jsx(a.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))})]})]})]})})]}):e.jsx("select",{id:"pageType",value:l,disabled:m&&!y,onChange:s=>U(s.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${m&&!y?"cursor-not-allowed text-gray-500":""}`,children:m?le?e.jsx("optgroup",{label:"Partials",children:i.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}):e.jsx("optgroup",{label:"Pages",children:i.filter(s=>s.hasSlug!==!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}):e.jsxs(e.Fragment,{children:[e.jsx("optgroup",{label:"Pages",children:i.filter(s=>s.hasSlug!==!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}),e.jsx("optgroup",{label:"Partials",children:i.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})]})}),W&&e.jsxs("div",{className:"mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3",children:[e.jsx("p",{className:"text-sm text-yellow-800",children:"Changing the page type may impact the page data. Are you sure you want to proceed?"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(v.Button,{variant:"outline",size:"sm",onClick:()=>G(!1),children:"Cancel"}),e.jsx(v.Button,{variant:"default",size:"sm",onClick:pe,children:"Confirm"})]})]})]}),!m&&(r==null?void 0:r.hasSlug)&&me.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"mb-1 block text-sm",children:"Template"}),e.jsx(Ve,{templates:me,selectedTemplateId:E,onSelectTemplate:Be,isLoading:Le})]}),e.jsx(ze,{pages:h,selectedParentId:D,onChange:Fe,currentPage:t}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(v.Input,{id:"name",value:M,onChange:s=>re(s.target.value),required:!0,"aria-required":"true",placeholder:"Enter page name"})]}),(r==null?void 0:r.dynamicSegments)&&D&&D!=="none"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"useDynamicSlug",checked:F,onChange:s=>Ie(s.target.checked),className:"rounded border-gray-300"}),e.jsx(a.Label,{htmlFor:"useDynamicSlug",className:"text-sm",children:"Use Dynamic Slug"})]}),F&&e.jsx("div",{className:"space-y-2",children:e.jsx("div",{className:"space-y-0.5",children:e.jsx(Ue,{value:ie,onChange:ce,dynamicPattern:(r==null?void 0:r.dynamicSlug)||"{{id}}",placeholder:"Enter custom slug part (optional)",onValidationChange:be})})})]}),(!(r!=null&&r.dynamicSegments)||!F)&&e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"slug",className:"text-sm",children:"Slug"}),e.jsx(_.SlugInput,{value:B,onChange:s=>{var u;Y(s),m&&s!==(((u=t==null?void 0:t.slug)==null?void 0:u.split("/").pop())||"")?P(!!(Te||De)):P(!1)},placeholder:D&&D!=="none"?"Enter page slug":l==="page"?"Leave empty for home page":"Required - e.g. your-slug",parentSlug:D&&D!=="none"?(ge=h==null?void 0:h.find(s=>s.id===D))==null?void 0:ge.slug:void 0,onValidationChange:d}),R&&e.jsx("p",{className:"text-xs text-red-500",children:R}),we&&e.jsx("div",{className:"mt-4 rounded-md border border-amber-200 bg-amber-50 p-3",children:e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-amber-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-amber-800",children:"Slug Change Warning"}),e.jsx("div",{className:"mt-1 text-sm text-amber-700",children:e.jsx("p",{children:"The previous URL and any child pages will become inaccessible. You may want to set up a redirect to avoid broken links."})})]})]})})]}),e.jsx(v.Button,{disabled:$||!C&&(!(r!=null&&r.dynamicSegments)||!F)||F&&!ue,type:"submit",className:"w-full",children:m?$?"Updating...":"Update page":$?"Creating...":"Create Page"})]}):e.jsxs("form",{onSubmit:de,className:"mx-auto w-full max-w-md space-y-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(a.Popover,{open:ae,onOpenChange:Q,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:z("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:V,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"max-h-[200px] overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No page type found."}),e.jsx(a.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>{U(s.key),Q(!1)},className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))})]})]})})]}):e.jsx("select",{id:"pageType",value:l,disabled:m&&!y,onChange:s=>U(s.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${m&&!y?"cursor-not-allowed text-gray-500":""}`,children:e.jsx("optgroup",{label:"Partials",children:i.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})}),W&&e.jsxs("div",{className:"mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3",children:[e.jsx("p",{className:"text-sm text-yellow-800",children:"Changing the page type may impact the page data. Are you sure you want to proceed?"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(v.Button,{variant:"outline",size:"sm",onClick:()=>G(!1),children:"Cancel"}),e.jsx(v.Button,{variant:"default",size:"sm",onClick:pe,children:"Confirm"})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:(xe=i.find(s=>s.key===l))==null?void 0:xe.helpText})]}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(v.Input,{id:"name",value:M,onChange:s=>re(s.target.value),required:!0,"aria-required":"true"})]}),e.jsx(v.Button,{disabled:$,type:"submit",className:"w-full",children:m?$?"Updating...":"Update "+(r==null?void 0:r.name):$?"Creating...":"Create "+(r==null?void 0:r.name)})]})}exports.default=He;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./index-C99FhuF1.cjs"),p=require("./register-chai-top-bar-BqwKw4uy.cjs"),t=require("./index-C0-pgg_p.cjs"),c=require("lucide-react"),d=require("react"),O=require("react-i18next"),_=()=>{const m=t.useCurrentPageOwner(),f=t.useSendRealtimeEvent(),{setPageStatus:j}=t.usePageLockStatus(),{data:s,isFetching:v}=t.useChaiUserInfo((m==null?void 0:m.userId)||""),{pageLockMeta:o,setPageLockMeta:g}=t.usePageLockMeta(),{t:r}=O.useTranslation(),[u,i]=d.useState(""),[a,N]=d.useState({}),[T,k]=d.useState(!1),l=d.useRef(null);d.useEffect(()=>{o!=null&&o.type&&(l.current&&clearTimeout(l.current),d.startTransition(()=>{N(o),g({}),i("")}))},[o,g]);const b=()=>{u!==t.EVENT.TAKE_OVER_REQUEST&&(i(t.EVENT.TAKE_OVER_REQUEST),f(t.EVENT.TAKE_OVER_REQUEST),l.current=setTimeout(()=>i(""),2e4))},R=()=>{u!==t.EVENT.FORCE_TAKE_OVER_REQUEST&&(i(t.EVENT.FORCE_TAKE_OVER_REQUEST),f(t.EVENT.FORCE_TAKE_OVER_REQUEST),j(t.PAGE_STATUS.CHECKING),l.current=setTimeout(()=>i(""),2e4))},y=()=>{N({}),l.current&&clearTimeout(l.current),i("")},x=v?"Loading...":(s==null?void 0:s.name)||"Current editor",h=u===t.EVENT.TAKE_OVER_REQUEST,E=u===t.EVENT.FORCE_TAKE_OVER_REQUEST;return e.jsx(t.BlurContainer,{children:e.jsxs(n.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(n.CardHeader,{className:"space-y-1 border-b pb-3",children:e.jsxs(n.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(c.LockKeyhole,{className:"h-8 w-8 rounded-md bg-sky-500/20 p-1.5 text-sky-500"}),e.jsx("span",{children:r("Page Locked for Editing")})]})}),e.jsxs(n.CardContent,{className:"space-y-4 p-4",children:[e.jsxs("div",{className:"relative rounded-md border border-green-500 px-2 pb-2 pt-4",children:[e.jsx("div",{className:"absolute -top-2.5 left-3 w-max rounded-full bg-green-500 px-3 py-1 text-xs font-medium leading-3 text-white",children:"Current Editor"}),e.jsxs("div",{className:"flex items-center space-x-4 p-1",children:[s!=null&&s.avatar?e.jsx("img",{src:s.avatar,alt:s.name,className:"h-12 w-12 flex-shrink-0 rounded-full bg-black p-3 text-white"}):e.jsx(c.UserIcon,{className:"h-12 w-12 flex-shrink-0 rounded-full bg-black p-3 text-white"}),e.jsxs("div",{className:"flex-1 space-y-0",children:[e.jsx("div",{className:"truncate font-medium leading-tight text-black",children:x}),(s==null?void 0:s.email)&&e.jsx("p",{className:"truncate text-sm leading-tight text-muted-foreground",children:s.email})]})]})]}),((a==null?void 0:a.type)===t.EVENT.TAKE_OVER_REJECTED||(a==null?void 0:a.type)===t.EVENT.FORCE_TAKE_OVER_REQUEST)&&e.jsx("section",{className:"space-y-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-x-2 rounded border border-red-500 bg-red-500/10 py-2 pl-3 pr-2 text-sm font-medium text-red-500",children:[e.jsxs("div",{className:"flex items-start gap-x-2",children:[e.jsx(c.AlertCircleIcon,{className:"mt-px flex h-4 w-4 shrink-0"}),e.jsxs("div",{className:"font-light leading-tight",children:[e.jsx("span",{className:"font-medium",children:(s==null?void 0:s.name)||"The current editor"}),(a==null?void 0:a.type)===t.EVENT.TAKE_OVER_REJECTED?" rejected your take over request.":" forcefully took over this page."]})]}),e.jsx(p.Button,{size:"icon",variant:"ghost",onClick:y,className:"flex-shrink-0",children:e.jsx(c.X,{className:"h-4 w-4"})})]})})]}),e.jsx(n.CardFooter,{className:"flex flex-col gap-3 border-t pt-3",children:e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r("Take Over Options")}),e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3",children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("p",{className:"text-sm font-medium",children:r("Take Over Request:")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r("Send a request to {{currentEditorName}} asking them to release the page. They can accept or decline your request.",{currentEditorName:x})})]}),e.jsxs(p.Button,{disabled:h,variant:"default",onClick:b,className:"mt-3 w-full gap-2",children:[e.jsx(c.Edit,{className:"h-4 w-4"}),h?"Take over request sent":"Send Take Over Request"]}),h&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:r("Request sent. If no response, try again or use force take over.")})]}),e.jsx(n.Accordion,{type:"single",collapsible:!0,className:"w-full",children:e.jsxs(n.AccordionItem,{value:"force-takeover",className:"rounded-md border border-destructive/40 bg-destructive/5",children:[e.jsx(n.AccordionTrigger,{className:"px-3 py-2 hover:no-underline",children:e.jsx("div",{className:"flex items-center gap-2 text-left",children:e.jsxs("div",{children:[e.jsxs("p",{className:"flex items-center gap-x-2 text-sm font-medium text-destructive",children:[e.jsx(c.ShieldAlert,{className:"h-4 w-4 text-destructive"}),r("Force Take Over")]}),e.jsx("p",{className:"pl-6 text-xs font-normal leading-tight text-muted-foreground",children:r("Immediately take control (use with caution)")})]})})}),e.jsx(n.AccordionContent,{className:"px-3 pb-3",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-background p-2",children:[e.jsx("input",{type:"checkbox",id:"force-takeover",checked:T,onChange:C=>k(C.target.checked),className:"mt-0.5 h-4 w-4 rounded border-gray-300"}),e.jsx("label",{htmlFor:"force-takeover",className:"flex-1 text-xs text-muted-foreground",children:r("I understand this will immediately close the editor for {{currentEditorName}}. I am using this option with caution.",{currentEditorName:x})})]}),e.jsxs(p.Button,{disabled:!T||E,variant:"destructive",onClick:R,className:"w-full gap-2",children:[e.jsx(c.ShieldAlert,{className:"h-4 w-4"}),r(E?"Take over page...":"Force Take Over")]}),E&&e.jsx("p",{className:"text-xs text-muted-foreground",children:r("Attempting to forcefully take over this page. Please wait while we update the editing session.")})]})})]})})]})})]})})};exports.default=_;