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

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 (267) hide show
  1. package/README.md +72 -50
  2. package/dist/{2SSKDMRQ-CopJgtZb.cjs → 2SSKDMRQ-D-2rSLsq.cjs} +1 -1
  3. package/dist/{2SSKDMRQ-Difo_1pg.js → 2SSKDMRQ-DKit4bEt.js} +3 -3
  4. package/dist/{AP7HFJJL-BPuPBqj4.js → AP7HFJJL-BWruCozs.js} +1 -1
  5. package/dist/{AP7HFJJL-DYxDgaOs.cjs → AP7HFJJL-CAE2yHEv.cjs} +1 -1
  6. package/dist/{IconPicker-C0oycHbs.cjs → IconPicker-BCYCPK5M.cjs} +1 -1
  7. package/dist/{IconPicker-B2-oriq2.js → IconPicker-BOBnjfJc.js} +2 -2
  8. package/dist/STRINGS-BExFecZW.js +8 -0
  9. package/dist/STRINGS-FNnfjF5H.cjs +1 -0
  10. package/dist/{WDYDFRGG-DbejaRPK.cjs → WDYDFRGG-BNve1FlV.cjs} +1 -1
  11. package/dist/{WDYDFRGG-KK8pkcW1.js → WDYDFRGG-Bv40IVPG.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-Cu_ASKtx.cjs → active-in-another-tab-BPBvEwmD.cjs} +1 -1
  18. package/dist/{active-in-another-tab-DkR2HWI4.js → active-in-another-tab-C334yD2g.js} +5 -5
  19. package/dist/{add-new-language-page-BXuwluuU.cjs → add-new-language-page-BVME8b7v.cjs} +1 -1
  20. package/dist/{add-new-language-page-CBY0RR6q.js → add-new-language-page-DVL-HkWR.js} +4 -4
  21. package/dist/{add-new-page-C_PzKby8.cjs → add-new-page-BPysPck8.cjs} +1 -1
  22. package/dist/add-new-page-BQOsHkVl.js +31 -0
  23. package/dist/{ai-panel-content-rRmJdH7L.cjs → ai-panel-content-BsElc0Ke.cjs} +1 -1
  24. package/dist/{ai-panel-content--YM01Aly.js → ai-panel-content-BwX0YBGD.js} +6 -6
  25. package/dist/ai-panel-default-lang-BqhAu1iN.cjs +3 -0
  26. package/dist/ai-panel-default-lang-CYZuwSQn.js +317 -0
  27. package/dist/ai-panel-other-lang-CL83Mwha.js +132 -0
  28. package/dist/ai-panel-other-lang-CivH2s8Q.cjs +1 -0
  29. package/dist/{ai-prompt-input-N9PcYCFa.cjs → ai-prompt-input-BuP52voq.cjs} +1 -1
  30. package/dist/{ai-prompt-input-DueQYNf-.js → ai-prompt-input-C37B_jlE.js} +30 -34
  31. package/dist/{ai-translation-prompt-IAdWMNZb.cjs → ai-translation-prompt-CgZKlkF_.cjs} +1 -1
  32. package/dist/{ai-translation-prompt-B36F3d7K.js → ai-translation-prompt-V5PBEZRn.js} +2 -2
  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-AQU_GLqq.js +137 -0
  36. package/dist/change-password-modal-Chufk3yU.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-D-fpas30.js +57 -0
  40. package/dist/code-editor-gqdLU-rU.cjs +1 -0
  41. package/dist/{continue-editing-in-this-client-DmGFLHXw.cjs → continue-editing-in-this-client-BNEnV0hi.cjs} +1 -1
  42. package/dist/{continue-editing-in-this-client-Dm9cCj7K.js → continue-editing-in-this-client-Dx3f64SH.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-Rh1QAVxo.cjs → css-import-modal-B2NoLsdZ.cjs} +1 -1
  49. package/dist/{css-import-modal-9P_0uNa4.js → css-import-modal-c_6VH1js.js} +8 -8
  50. package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
  51. package/dist/default-theme-options-saBIkWGT.js +248 -0
  52. package/dist/delete-page-B1R1w8O5.js +84 -0
  53. package/dist/delete-page-DbQDbCyB.cjs +1 -0
  54. package/dist/{design-token-usage-MNYsFlPG.js → design-token-usage-11kPk5n1.js} +26 -26
  55. package/dist/{design-token-usage-CXglXgcJ.cjs → design-token-usage-BBLfxzzo.cjs} +1 -1
  56. package/dist/digital-asset-manager-B0h5rUVQ.cjs +1 -0
  57. package/dist/{digital-asset-manager-CqCWBO0s.js → digital-asset-manager-BbEQ8cPb.js} +6 -6
  58. package/dist/{duplicate-page-BknLfqr0.js → duplicate-page-BY_Pcqbb.js} +7 -7
  59. package/dist/{duplicate-page-DzZByALW.cjs → duplicate-page-BaAzKbiX.cjs} +1 -1
  60. package/dist/{dynamic-page-selector-WA007Sni.cjs → dynamic-page-selector-DzH_gCQ4.cjs} +1 -1
  61. package/dist/{dynamic-page-selector-DoW7OyUB.js → dynamic-page-selector-bsaLGZkO.js} +16 -16
  62. package/dist/fonts/bungee/Bungee-Regular.woff2 +0 -0
  63. package/dist/fonts/dm_sans/dm-sans-variable.woff2 +0 -0
  64. package/dist/fonts/geist/Geist-VariableFont_wght.ttf +0 -0
  65. package/dist/fonts/geist/Geist-VariableFont_wght.woff2 +0 -0
  66. package/dist/fonts/geist/geist-variable.woff2 +0 -0
  67. package/dist/fonts/geist-mono/GeistMono-VariableFont_wght.woff2 +0 -0
  68. package/dist/fonts/inter/inter-latin.woff2 +0 -0
  69. package/dist/fonts/inter/inter-variable.woff2 +1449 -0
  70. package/dist/fonts/lato/lato-variable.woff2 +0 -0
  71. package/dist/fonts/lavishly_yours/lavishly-yours.woff2 +11 -0
  72. package/dist/fonts/merriweather/merriweather-variable.woff2 +11 -0
  73. package/dist/fonts/montserrat/montserrat-variable.woff2 +0 -0
  74. package/dist/fonts/nunito_sans/nunito-sans-variable.woff2 +11 -0
  75. package/dist/fonts/open_sans/open-sans-variable.woff2 +0 -0
  76. package/dist/fonts/oswald/oswald-variable.woff2 +0 -0
  77. package/dist/fonts/playfair_display/playfair-display-variable.woff2 +11 -0
  78. package/dist/fonts/poppins/poppins-variable.woff2 +0 -0
  79. package/dist/fonts/raleway/raleway-variable.woff2 +0 -0
  80. package/dist/fonts/roboto/roboto-variable.woff2 +11 -0
  81. package/dist/fonts/source_sans_3/source-sans-3-variable.woff2 +11 -0
  82. package/dist/fonts/ubuntu/ubuntu-variable.woff2 +0 -0
  83. package/dist/fonts-B3UYxuJI.js +25 -0
  84. package/dist/fonts-D5fTqvSS.cjs +1 -0
  85. package/dist/{get-chai-builder-tailwind-config-BFePCEIS.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
  86. package/dist/{get-chai-builder-tailwind-config-BXf_xLHk.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +5 -5
  87. package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
  88. package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
  89. package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
  90. package/dist/image-compression-UaU7Bwqe.cjs +1 -0
  91. package/dist/{image-editor-CqwaVxO2.cjs → image-editor-Cfn290vp.cjs} +1 -1
  92. package/dist/{image-editor-CQnNtak2.js → image-editor-CyGqVNvX.js} +1 -1
  93. package/dist/index-BpVxZOd-.js +5082 -0
  94. package/dist/index-CQf0jL1k.cjs +5 -0
  95. package/dist/{index-rAcNbjk_.js → index-DpeytsiB.js} +6145 -6091
  96. package/dist/index-P-2SvZA9.cjs +160 -0
  97. package/dist/{json-diff-viewer-CLuUHiPU.cjs → json-diff-viewer-BBERGXdt.cjs} +7 -7
  98. package/dist/{json-diff-viewer-CMvGUvJ2.js → json-diff-viewer-C-bpInzt.js} +87 -85
  99. package/dist/{lang-panel-CnwTb05j.js → lang-panel-4Q_PTmKm.js} +26 -26
  100. package/dist/lang-panel-uI149Beq.cjs +1 -0
  101. package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
  102. package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
  103. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
  104. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
  105. package/dist/library-blocks/bento/product-features/product-features.html +159 -0
  106. package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
  107. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
  108. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
  109. package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
  110. package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
  111. package/dist/library-blocks/blocks-list.json +149 -0
  112. package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
  113. package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
  114. package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
  115. package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
  116. package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
  117. package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
  118. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
  119. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
  120. package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
  121. package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
  122. package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
  123. package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
  124. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
  125. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
  126. package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
  127. package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
  128. package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
  129. package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
  130. package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
  131. package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
  132. package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
  133. package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
  134. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
  135. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
  136. package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
  137. package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
  138. package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
  139. package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
  140. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
  141. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
  142. package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
  143. package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
  144. package/dist/manage-design-tokens-B_-TrQgu.cjs +1 -0
  145. package/dist/manage-design-tokens-CHpHE-dx.js +446 -0
  146. package/dist/manage-design-tokens-modal-Bug5H8PT.cjs +1 -0
  147. package/dist/manage-design-tokens-modal-DO_tHkgp.js +161 -0
  148. package/dist/{mark-as-template-CpWEBJGd.cjs → mark-as-template-BEnMYTql.cjs} +1 -1
  149. package/dist/{mark-as-template-DBLshWb5.js → mark-as-template-Ca3QLzX4.js} +11 -11
  150. package/dist/{nested-path-selector-content-6OBJ8LG8.js → nested-path-selector-content-5gECLoRV.js} +2 -2
  151. package/dist/{nested-path-selector-content-C2sD9dkq.cjs → nested-path-selector-content-BHPOfftZ.cjs} +1 -1
  152. package/dist/{no-language-page-content-CzENgtnu.js → no-language-page-content-Bb3nUSLv.js} +9 -9
  153. package/dist/{no-language-page-content-BvPDdccK.cjs → no-language-page-content-CKxggLC_.cjs} +1 -1
  154. package/dist/{no-language-page-dialog-CbYI2cVg.js → no-language-page-dialog-BEVRCAhM.js} +2 -2
  155. package/dist/{no-language-page-dialog-CgW4yJBC.cjs → no-language-page-dialog-DMb5Z5on.cjs} +1 -1
  156. package/dist/page-creator-C_95U8kn.cjs +1 -0
  157. package/dist/{page-creator-Cc83uQqw.js → page-creator-DQRFXhNj.js} +143 -143
  158. package/dist/{page-lock-BJUkyxdh.js → page-lock-Be5wPHz5.js} +2 -2
  159. package/dist/{page-lock-CT7SmQqp.cjs → page-lock-DKWt66MX.cjs} +1 -1
  160. package/dist/page-locked-dialog-CWyZol0i.cjs +1 -0
  161. package/dist/{page-locked-dialog-DsEbWRed.js → page-locked-dialog-CkXpQUpO.js} +22 -22
  162. package/dist/page-manager-new-2gYNPR6y.js +408 -0
  163. package/dist/page-manager-new-Bt7rBO1J.cjs +1 -0
  164. package/dist/{page-manager-search-and-filter-zq-LfhQ1.js → page-manager-search-and-filter-BotSCoAo.js} +30 -29
  165. package/dist/{page-manager-search-and-filter-Bfm0j1gg.cjs → page-manager-search-and-filter-Dkwl089C.cjs} +1 -1
  166. package/dist/{page-revisions-content-D38G2tJM.js → page-revisions-content-OigWteYc.js} +133 -122
  167. package/dist/page-revisions-content-bQ32feXp.cjs +1 -0
  168. package/dist/pages.cjs +1 -1
  169. package/dist/pages.d.ts +330 -96
  170. package/dist/pages.js +23 -19
  171. package/dist/{publish-pages-content-CS7f41Ac.js → publish-pages-content-2RcG3Ptp.js} +39 -39
  172. package/dist/publish-pages-content-Dtkal6ue.cjs +1 -0
  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-CHxO3TQR.cjs} +1 -1
  179. package/dist/{rte-widget-modal-D6Zik0Ta.js → rte-widget-modal-DmQk0Lfj.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-BSsuvkZS.cjs +1 -0
  187. package/dist/{save-to-lib-WwOzbgiF.js → save-to-lib-CVqlFkRK.js} +153 -147
  188. package/dist/sdk.css +1 -1
  189. package/dist/{selected-block-display-BOgnQRLF.cjs → selected-block-display-Cr7R1ojV.cjs} +1 -1
  190. package/dist/{selected-block-display-B1SG_UXw.js → selected-block-display-DngI-pF1.js} +12 -12
  191. package/dist/seo-panel-BMYdzcoJ.cjs +2 -0
  192. package/dist/{seo-panel-BkOgRoWd.js → seo-panel-CHkFLI5b.js} +27 -27
  193. package/dist/{shared-json-ld-uka9TOgA.js → shared-json-ld-BzjOUN-P.js} +88 -88
  194. package/dist/shared-json-ld-ClIZw1aA.cjs +1 -0
  195. package/dist/{slug-input-DHLmUNrH.js → slug-input-07EKw9U5.js} +8 -8
  196. package/dist/{slug-input-Cyd6NR6J.cjs → slug-input-DHVDl_Dv.cjs} +1 -1
  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-BLdOZhUs.cjs +1 -0
  201. package/dist/{take-over-request-Ca0X-qyf.js → take-over-request-zqtItFSK.js} +13 -13
  202. package/dist/{translation-warning-modal-pSZVKcNW.cjs → translation-warning-modal-BxV_8mCE.cjs} +1 -1
  203. package/dist/{translation-warning-modal-DrpFeI83.js → translation-warning-modal-DnSd7lOJ.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-DF1Ms4VN.cjs → unmark-as-template-C4UkGyOP.cjs} +1 -1
  208. package/dist/{unmark-as-template-BMqgelv-.js → unmark-as-template-DIKZYr01.js} +11 -11
  209. package/dist/unpublish-page-CK0sAZcB.js +28 -0
  210. package/dist/{unpublish-page-Bsq2yEqQ.cjs → unpublish-page-DFXLzJbc.cjs} +1 -1
  211. package/dist/unpublished-partials-modal-BAr1SkEG.cjs +1 -0
  212. package/dist/unpublished-partials-modal-CDaOvXgp.js +52 -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-D6h1L2nV.js → web-preview-CRSjh2he.js} +2 -2
  219. package/dist/{web-preview-kres0aG7.cjs → web-preview-DA7_F3vv.cjs} +1 -1
  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/get-chai-builder-theme-BApShjRz.cjs +0 -1
  243. package/dist/image-compression-DZ9WMmyn.cjs +0 -1
  244. package/dist/index-B-rSiAp_.cjs +0 -1
  245. package/dist/index-C0-pgg_p.cjs +0 -5
  246. package/dist/index-C99FhuF1.cjs +0 -160
  247. package/dist/index-Dno42B0a.js +0 -4734
  248. package/dist/index-Dxfyt4d4.js +0 -39
  249. package/dist/lang-panel-fDCYm5Jm.cjs +0 -1
  250. package/dist/manage-design-tokens-BsSZE9Vs.js +0 -241
  251. package/dist/manage-design-tokens-BvH5KTJX.cjs +0 -1
  252. package/dist/page-creator-g8GqgcKH.cjs +0 -1
  253. package/dist/page-locked-dialog-Co5b9XIZ.cjs +0 -1
  254. package/dist/page-manager-new-5rFP5DyQ.js +0 -395
  255. package/dist/page-manager-new-BOkJImo2.cjs +0 -1
  256. package/dist/page-revisions-content-ag-MHBGr.cjs +0 -1
  257. package/dist/plugin-BGlQf0iy.cjs +0 -22
  258. package/dist/plugin-C-ht41UZ.js +0 -245
  259. package/dist/publish-pages-content-BiX-GMLw.cjs +0 -1
  260. package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
  261. package/dist/save-to-lib-ffjCZYJ5.cjs +0 -1
  262. package/dist/seo-panel-FjS1UF_y.cjs +0 -2
  263. package/dist/shared-json-ld-yJkXjENy.cjs +0 -1
  264. package/dist/take-over-request-CmpJVe9T.cjs +0 -1
  265. package/dist/theme-panel-footer-BUXIu252.js +0 -26
  266. package/dist/theme-panel-footer-CKO9YYwZ.cjs +0 -1
  267. package/dist/unpublish-page-BJ0Bsvt2.js +0 -28
@@ -1,395 +0,0 @@
1
- import { jsxs as y, Fragment as z, jsx as t } from "react/jsx-runtime";
2
- import { n as ae } from "./index-rAcNbjk_.js";
3
- import { aA as ye, aB as be, ap as ge, k as ie, T as q, aQ as ke, L as we, m as Ne, g as ve, c as Se, av as Le, aR as Ae, aS as Q } from "./index-Dno42B0a.js";
4
- import { u as Y } from "./use-page-expand-manager-Cf4MUEJw.js";
5
- import { compact as ce, filter as B, isEmpty as S, uniqBy as Te, keyBy as de, mapValues as Ce, startCase as Ee, toLower as E, includes as D, get as R, find as $, map as Me } from "lodash-es";
6
- import { atom as Ie, useAtom as Ue, useSetAtom as $e } from "jotai";
7
- import { ExternalLink as Be, NotepadText as ze, MoreHorizontal as Fe, Lock as Oe, Edit as je, Plus as Ge, ChevronRight as Re, StarsIcon as De, Hash as We, File as ue } from "lucide-react";
8
- import { useRef as _e, useEffect as I, useMemo as V, useState as N, useCallback as oe, Suspense as C, lazy as M } from "react";
9
- import { useTranslation as He } from "react-i18next";
10
- import { B as qe } from "./register-chai-top-bar-ESJHs5s-.js";
11
- const le = (e, s) => !e || !Array.isArray(e) ? [] : S(s) ? e : ce(
12
- B(e, (r) => {
13
- const n = E(s);
14
- return D(E((r == null ? void 0 : r.name) || ""), n) || D(E((r == null ? void 0 : r.slug) || ""), n);
15
- })
16
- ), Qe = (e, s) => {
17
- const r = /* @__PURE__ */ new Set(), n = de(e, "id");
18
- return s.forEach((l) => {
19
- let a = l;
20
- for (; a.parent && n[a.parent]; )
21
- r.add(a.parent), a = n[a.parent];
22
- }), Array.from(r).map((l) => n[l]);
23
- }, X = (e, s, r) => S(s) ? e : e.map((n) => {
24
- if (!r(n.pageType))
25
- return {
26
- ...n,
27
- shouldExpandOnSearch: !0,
28
- children: n.children ? X(n.children, s, r) : []
29
- };
30
- const l = n.children && n.children.some(
31
- (a) => D(E(a.name || ""), E(s)) || D(E(a.slug || ""), E(s))
32
- );
33
- return {
34
- ...n,
35
- shouldExpandOnSearch: l,
36
- children: n.children ? X(n.children, s, r) : []
37
- };
38
- }), Ve = (e) => {
39
- if (!e || !e.length) return [];
40
- const s = {};
41
- e.forEach((n) => {
42
- s[n.id] = { ...n, children: [] };
43
- });
44
- const r = [];
45
- return Object.values(s).forEach((n) => {
46
- n.parent && s[n.parent] ? s[n.parent].children.push(n) : r.push(n);
47
- }), r;
48
- }, me = (e) => !e || !e.length ? [] : [...e].sort(
49
- (r, n) => (r.name || "").localeCompare(n.name || "")
50
- ).map((r) => ({
51
- ...r,
52
- children: r.children ? me(r.children) : []
53
- })), Xe = (e, s, r, n) => {
54
- if (!e || !e.length) return [];
55
- let l = e;
56
- if (r !== "all" && (l = ce(B(e, { pageType: r }))), S(s))
57
- l = le(l, s);
58
- else {
59
- const u = le(l, s), c = Qe(e, u);
60
- l = Te([...u, ...c], "id");
61
- }
62
- const a = me(Ve(l)), h = X(a, s, n), b = B(h, (u) => n(u.pageType)).sort((u, c) => (u.name || "").localeCompare(c.name || "")), i = B(h, (u) => !n(u.pageType));
63
- let f = [];
64
- if (r === "all") {
65
- const u = de(i, "pageType");
66
- f = Object.values(
67
- Ce(u, (c, p) => ({
68
- ...c,
69
- id: p,
70
- name: Ee(p),
71
- isPartialGroup: !0,
72
- children: h.filter((g) => g.pageType === p)
73
- }))
74
- );
75
- } else
76
- f = i.sort((u, c) => (u.name || "").localeCompare(c.name || ""));
77
- return [...b, ...f];
78
- }, Ye = Ie({
79
- pageId: null,
80
- position: { x: 0, y: 0 }
81
- }), Je = ({ pageId: e, children: s }) => {
82
- const [r, n] = Ue(Ye), l = _e(null), a = r.pageId === e;
83
- I(() => {
84
- const i = () => n({ pageId: null, position: { x: 0, y: 0 } });
85
- if (a)
86
- return document.addEventListener("click", i), () => document.removeEventListener("click", i);
87
- }, [a, n]);
88
- const h = (i) => {
89
- i.preventDefault(), i.stopPropagation(), n({ pageId: e, position: { x: i.clientX, y: i.clientY } });
90
- }, b = () => {
91
- const i = `${window.location.pathname}?page=${e}`;
92
- window.open(i, "_blank"), n({ pageId: null, position: { x: 0, y: 0 } });
93
- };
94
- return /* @__PURE__ */ y(z, { children: [
95
- /* @__PURE__ */ t("span", { onContextMenu: h, children: s }),
96
- a && /* @__PURE__ */ t(
97
- "div",
98
- {
99
- ref: l,
100
- className: "fixed z-[9999] max-w-[160px] rounded-md border border-gray-200 bg-white",
101
- style: { top: r.position.y, left: r.position.x },
102
- children: /* @__PURE__ */ t("div", { className: "", children: /* @__PURE__ */ y(
103
- qe,
104
- {
105
- variant: "ghost",
106
- onClick: b,
107
- className: "w-full px-2.5 py-1 text-start text-sm text-gray-700 hover:bg-gray-100",
108
- children: [
109
- /* @__PURE__ */ t(Be, { className: "h-4 w-4" }),
110
- "Open in new tab"
111
- ]
112
- }
113
- ) })
114
- }
115
- )
116
- ] });
117
- }, Ke = ({ page: e }) => {
118
- var n, l;
119
- const { isExpanded: s, toggleExpanded: r } = Y(e == null ? void 0 : e.id);
120
- return /* @__PURE__ */ t(
121
- "button",
122
- {
123
- onClick: (a) => {
124
- a.stopPropagation(), r();
125
- },
126
- disabled: !((n = e == null ? void 0 : e.children) != null && n.length),
127
- className: `flex h-[calc(100%-2px)] w-5 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-200 hover:px-1 hover:text-gray-500 ${(l = e == null ? void 0 : e.children) != null && l.length ? "hover:text-blue-400" : "opacity-0"}`,
128
- children: /* @__PURE__ */ t(
129
- Re,
130
- {
131
- size: 12,
132
- className: `stroke-[4] transition-transform duration-200 ${s ? "rotate-90" : ""}`
133
- }
134
- )
135
- }
136
- );
137
- }, Ze = ({ page: e, pageType: s }) => /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center gap-x-1", children: e.dynamic ? /* @__PURE__ */ t(De, { size: 12, className: "text-yellow-400" }) : s != null && s.icon ? /* @__PURE__ */ t(
138
- "div",
139
- {
140
- className: "flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",
141
- dangerouslySetInnerHTML: { __html: s.icon }
142
- }
143
- ) : s != null && s.hasSlug ? /* @__PURE__ */ t(ue, { size: 12, className: "stroke-[1] text-slate-500" }) : /* @__PURE__ */ t(We, { size: 12, className: "stroke-[1] text-slate-500" }) }), et = ({ isOnline: e }) => /* @__PURE__ */ t("div", { className: `h-2 w-2 rounded-full ${e ? "bg-green-300" : "bg-gray-300"}` }), tt = ({
144
- page: e,
145
- pageTypes: s,
146
- currentPage: r,
147
- onClickAction: n,
148
- languagePages: l,
149
- selectedLanguage: a,
150
- showUntranslatedPages: h
151
- }) => {
152
- const b = ye(), { pageToUser: i } = be(), f = R(i, [e == null ? void 0 : e.id, "userId"]), { data: u } = ge(f), c = u && b !== f ? u == null ? void 0 : u.name : null, p = ie(), g = r === e.id, W = !!e.isTemplate, P = V(() => $(s, { key: e.pageType }), [s, e.pageType]);
153
- let m = R(l, e == null ? void 0 : e.id);
154
- m = R(m, "lang") === a ? m : null;
155
- const L = a === p || !!m, A = (m == null ? void 0 : m.name) || (e == null ? void 0 : e.name) || "No name";
156
- let k = (m == null ? void 0 : m.slug) || (e == null ? void 0 : e.slug) || "";
157
- const F = k + (e != null && e.dynamic ? `/${P == null ? void 0 : P.dynamicSlug}` : "") + (e != null && e.dynamicSlugCustom ? `${e.dynamicSlugCustom}` : "");
158
- if (k.startsWith("/") && !h) {
159
- const d = k.split("/").pop();
160
- k = k.endsWith(d) && e.dynamic ? "" : `/${d}`;
161
- }
162
- const O = V(() => {
163
- const d = "flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]", T = `${g ? "border-primary/30 bg-primary/5" : "border-transparent hover:border-gray-200 hover:bg-gray-100"}`;
164
- return L ? `${d} ${T} ${c ? "opacity-60" : ""}` : `${d} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`;
165
- }, [L, g, c]);
166
- return /* @__PURE__ */ y("div", { className: "group relative", children: [
167
- /* @__PURE__ */ t(Je, { pageId: e.id, children: /* @__PURE__ */ y(
168
- "div",
169
- {
170
- onClick: () => !e.isPartialGroup && L && n("select", e == null ? void 0 : e.id),
171
- className: O,
172
- children: [
173
- /* @__PURE__ */ t(Ke, { page: e }),
174
- !e.isPartialGroup && /* @__PURE__ */ t(et, { isOnline: m ? m.online : e.online }),
175
- !e.isPartialGroup && /* @__PURE__ */ t(Ze, { page: e, pageType: P }),
176
- /* @__PURE__ */ t(q, { content: A, side: "top", showTooltip: A.length > 35, children: /* @__PURE__ */ t("span", { className: "max-w-[40%] truncate font-medium text-black", children: A }) }),
177
- (k || e.dynamic) && /* @__PURE__ */ t(q, { content: F, side: "top", showTooltip: !0, children: /* @__PURE__ */ y("span", { className: "max-w-[40%] truncate font-mono text-xs text-muted-foreground", children: [
178
- k,
179
- e.dynamic && (P == null ? void 0 : P.dynamicSlug) && /* @__PURE__ */ y("span", { className: "text-xs text-gray-500", children: [
180
- "/",
181
- P == null ? void 0 : P.dynamicSlug,
182
- e.dynamicSlugCustom
183
- ] })
184
- ] }) }),
185
- W && /* @__PURE__ */ t(q, { content: "Template", side: "top", children: /* @__PURE__ */ t("span", { className: "text-blue-500", children: /* @__PURE__ */ t(ze, { size: 16 }) }) }),
186
- !e.isPartialGroup && L && !c ? /* @__PURE__ */ t("div", { className: "duration absolute right-0.5 top-[3px]", children: /* @__PURE__ */ t(
187
- ke,
188
- {
189
- isLanguagePage: !!m,
190
- page: m || e,
191
- setDuplicatePage: (d) => n("duplicate", d),
192
- setAddEditPage: (d) => n("edit", m || d),
193
- setUnpublishPage: (d) => n("unpublish", d),
194
- setDeletePage: (d) => n("delete", m || d),
195
- setMarkAsTemplate: (d) => n("markAsTemplate", d),
196
- setUnmarkAsTemplate: (d) => n("unmarkAsTemplate", d),
197
- children: /* @__PURE__ */ t("div", { className: "m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white", children: /* @__PURE__ */ t(Fe, { className: "h-4 w-4", onClick: (d) => d.stopPropagation() }) })
198
- }
199
- ) }) : c ? /* @__PURE__ */ t("span", { className: "duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500", children: /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5 fill-red-200 text-red-500" }) }) : null
200
- ]
201
- }
202
- ) }),
203
- /* @__PURE__ */ t(z, { children: c && /* @__PURE__ */ y("button", { className: "absolute right-px top-1/2 flex h-6 -translate-y-1/2 items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100", children: [
204
- /* @__PURE__ */ t(je, { size: 12, className: "stroke-[3]" }),
205
- " ",
206
- /* @__PURE__ */ t("span", { className: "font-medium", children: c }),
207
- " is editing this page"
208
- ] }) }),
209
- /* @__PURE__ */ t(z, { children: !L && !e.isPartialGroup && !c && /* @__PURE__ */ y(
210
- "button",
211
- {
212
- onClick: (d) => {
213
- d.stopPropagation(), n("addLanguagePage", { language: a, page: e });
214
- },
215
- className: "absolute left-1/2 top-1 flex -translate-x-1/2 items-center gap-x-1 rounded bg-blue-500 px-2 py-0.5 text-xs text-white opacity-0 duration-200 hover:bg-blue-700 group-hover:opacity-100",
216
- children: [
217
- /* @__PURE__ */ t(Ge, { size: 12, className: "stroke-[3]" }),
218
- " ",
219
- /* @__PURE__ */ y("span", { className: "text-[10px]", children: [
220
- "Add ",
221
- R(we, a),
222
- " Page"
223
- ] })
224
- ]
225
- }
226
- ) })
227
- ] });
228
- }, he = ({
229
- pages: e,
230
- tier: s,
231
- pageTypes: r,
232
- currentPage: n,
233
- onClickAction: l,
234
- languagePages: a,
235
- selectedLanguage: h,
236
- showUntranslatedPages: b
237
- }) => {
238
- const { expandedPages: i } = Y();
239
- return /* @__PURE__ */ t("div", { className: "space-y-0.5", style: { paddingLeft: `${s * 10}px` }, children: e.map((f) => /* @__PURE__ */ y(z, { children: [
240
- /* @__PURE__ */ t(
241
- tt,
242
- {
243
- page: f,
244
- pageTypes: r,
245
- currentPage: n,
246
- onClickAction: l,
247
- languagePages: a,
248
- selectedLanguage: h,
249
- showUntranslatedPages: b
250
- }
251
- ),
252
- f.children && f.children.length > 0 && (i == null ? void 0 : i.includes(f.id)) && /* @__PURE__ */ t(
253
- he,
254
- {
255
- pages: f.children,
256
- tier: s + 1,
257
- pageTypes: r,
258
- currentPage: n,
259
- onClickAction: l,
260
- languagePages: a,
261
- selectedLanguage: h,
262
- showUntranslatedPages: b
263
- }
264
- )
265
- ] }, f.id)) });
266
- }, nt = M(() => import("./page-manager-search-and-filter-zq-LfhQ1.js")), st = M(() => import("./add-new-page-DJLJFLAd.js")), rt = M(() => import("./delete-page-CNucxe4P.js")), at = M(() => import("./duplicate-page-BknLfqr0.js")), ot = M(() => import("./mark-as-template-DBLshWb5.js")), lt = M(() => import("./unmark-as-template-BMqgelv-.js")), it = M(() => import("./unpublish-page-BJ0Bsvt2.js")), bt = ({ close: e }) => {
267
- const { t: s } = He(), { languages: r, setSelectedLang: n } = ae(), { data: l } = Ne(), { data: a, isFetching: h } = ve(), [b, i] = Se(), { updateForSelectedPage: f, expandPagesOnSearch: u } = Y(null), c = ie(), p = b.get("page"), [g, W] = N(""), [P, m] = N(null), [L, A] = N(null), [k, F] = N(null), [O, d] = N(null), [T, _] = N(""), [J, K] = N(null), [Z, ee] = N(null), [w, fe] = N(c), [xe, pe] = N(!1), te = $e(Le), j = xe && w !== c, { data: U, isFetching: Pe } = Ae(w), ne = oe(
268
- (x) => {
269
- var o;
270
- return (o = $(l, { key: x })) == null ? void 0 : o.hasSlug;
271
- },
272
- [l]
273
- ), v = V(() => a ? j ? B(a, (x) => !(U != null && U[x.id])) : Xe(a, g, T, ne) : [], [a, ne, g, T, U, j]);
274
- I(() => {
275
- n(c);
276
- }, [c, n]), I(() => {
277
- if (!S(T)) return;
278
- const x = sessionStorage.getItem("pageTypeFilter") || "all";
279
- !S(l) && x && ($(l, { key: x }) ? _(x) : _("all"));
280
- }, [l, T]), I(() => {
281
- if (p && !h && !$(a, { id: p })) {
282
- const o = $(a, { slug: "/" });
283
- if (o) {
284
- const G = new URLSearchParams({ page: o.id });
285
- Q(G, i);
286
- } else
287
- Q(new URLSearchParams({}), i, !0);
288
- }
289
- }, [a, p, h, i]), I(() => {
290
- p && !h && !S(v) && f(v, p);
291
- }, [p, h, v, f]), I(() => {
292
- !S(g) && !S(v) && u(v);
293
- }, [g, v, u]);
294
- const { setSelectedLang: H } = ae(), se = oe(
295
- (x) => {
296
- const o = new URLSearchParams({ page: x });
297
- w !== c ? (o.set("lang", w), H(w)) : H(""), Q(o, i), e();
298
- },
299
- [e, i, H, w, c]
300
- ), re = (x, o) => {
301
- var G;
302
- if (o)
303
- switch (x) {
304
- case "add":
305
- A(o);
306
- break;
307
- case "select":
308
- se(o);
309
- break;
310
- case "edit":
311
- w !== c ? te({
312
- edit: !0,
313
- id: o == null ? void 0 : o.id,
314
- primaryPage: o == null ? void 0 : o.primaryPage
315
- }) : A(o);
316
- break;
317
- case "delete":
318
- m(o);
319
- break;
320
- case "unpublish":
321
- F(o);
322
- break;
323
- case "markAsTemplate":
324
- d(o);
325
- break;
326
- case "unmarkAsTemplate":
327
- ee(o);
328
- break;
329
- case "duplicate":
330
- K(o);
331
- break;
332
- case "addLanguagePage":
333
- te({
334
- edit: !1,
335
- primaryPage: ((G = o == null ? void 0 : o.page) == null ? void 0 : G.id) || "",
336
- preselectedLang: (o == null ? void 0 : o.language) || w
337
- });
338
- break;
339
- }
340
- };
341
- return /* @__PURE__ */ y(z, { children: [
342
- /* @__PURE__ */ y("div", { className: "flex h-full flex-col justify-between", children: [
343
- /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(
344
- nt,
345
- {
346
- pages: v,
347
- search: g,
348
- setSearch: W,
349
- languages: [c, ...r],
350
- selectedLanguage: w,
351
- setSelectedLanguage: fe,
352
- selectedPageType: T,
353
- setSelectedPageType: _,
354
- onAddPage: (x) => re("add", x),
355
- showUntranslatedPages: j,
356
- setShowUntranslatedPages: pe
357
- }
358
- ) }),
359
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-4 pb-6 pt-2", children: h || Pe ? /* @__PURE__ */ t("div", { className: "space-y-2", children: Me([...Array(15).keys()], (x) => /* @__PURE__ */ t("div", { className: "h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200" }, x)) }) : S(v) ? /* @__PURE__ */ y("div", { className: "flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500", children: [
360
- /* @__PURE__ */ t(ue, { className: "h-6 w-6 stroke-[1]" }),
361
- s("Empty List!"),
362
- /* @__PURE__ */ t("span", { className: "font-light", children: s("Add new page to start") })
363
- ] }) : /* @__PURE__ */ t(
364
- he,
365
- {
366
- tier: 0,
367
- pages: v,
368
- pageTypes: l,
369
- currentPage: p || "",
370
- onClickAction: re,
371
- languagePages: U,
372
- selectedLanguage: w,
373
- showUntranslatedPages: j
374
- }
375
- ) })
376
- ] }),
377
- L && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(
378
- st,
379
- {
380
- closePanel: e,
381
- editPage: se,
382
- addEditPage: L,
383
- setAddEditPage: A
384
- }
385
- ) }),
386
- P && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(rt, { page: P, onClose: () => m(null) }) }),
387
- k && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(it, { page: k, onClose: () => F(null) }) }),
388
- O && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(ot, { page: O, onClose: () => d(null) }) }),
389
- Z && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(lt, { page: Z, onClose: () => ee(null) }) }),
390
- J && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(at, { page: J, onClose: () => K(null), closePanel: e }) })
391
- ] });
392
- };
393
- export {
394
- bt as default
395
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),X=require("./index-C99FhuF1.cjs"),f=require("./index-C0-pgg_p.cjs"),B=require("./use-page-expand-manager-B6XTvk0E.cjs"),r=require("lodash-es"),O=require("jotai"),b=require("lucide-react"),l=require("react"),ne=require("react-i18next"),re=require("./register-chai-top-bar-BqwKw4uy.cjs"),Y=(e,n)=>!e||!Array.isArray(e)?[]:r.isEmpty(n)?e:r.compact(r.filter(e,a=>{const s=r.toLower(n);return r.includes(r.toLower((a==null?void 0:a.name)||""),s)||r.includes(r.toLower((a==null?void 0:a.slug)||""),s)})),ae=(e,n)=>{const a=new Set,s=r.keyBy(e,"id");return n.forEach(c=>{let o=c;for(;o.parent&&s[o.parent];)a.add(o.parent),o=s[o.parent]}),Array.from(a).map(c=>s[c])},$=(e,n,a)=>r.isEmpty(n)?e:e.map(s=>{if(!a(s.pageType))return{...s,shouldExpandOnSearch:!0,children:s.children?$(s.children,n,a):[]};const c=s.children&&s.children.some(o=>r.includes(r.toLower(o.name||""),r.toLower(n))||r.includes(r.toLower(o.slug||""),r.toLower(n)));return{...s,shouldExpandOnSearch:c,children:s.children?$(s.children,n,a):[]}}),le=e=>{if(!e||!e.length)return[];const n={};e.forEach(s=>{n[s.id]={...s,children:[]}});const a=[];return Object.values(n).forEach(s=>{s.parent&&n[s.parent]?n[s.parent].children.push(s):a.push(s)}),a},J=e=>!e||!e.length?[]:[...e].sort((a,s)=>(a.name||"").localeCompare(s.name||"")).map(a=>({...a,children:a.children?J(a.children):[]})),oe=(e,n,a,s)=>{if(!e||!e.length)return[];let c=e;if(a!=="all"&&(c=r.compact(r.filter(e,{pageType:a}))),r.isEmpty(n))c=Y(c,n);else{const x=Y(c,n),u=ae(e,x);c=r.uniqBy([...x,...u],"id")}const o=J(le(c)),p=$(o,n,s),v=r.filter(p,x=>s(x.pageType)).sort((x,u)=>(x.name||"").localeCompare(u.name||"")),d=r.filter(p,x=>!s(x.pageType));let y=[];if(a==="all"){const x=r.keyBy(d,"pageType");y=Object.values(r.mapValues(x,(u,g)=>({...u,id:g,name:r.startCase(g),isPartialGroup:!0,children:p.filter(w=>w.pageType===g)})))}else y=d.sort((x,u)=>(x.name||"").localeCompare(u.name||""));return[...v,...y]},ie=O.atom({pageId:null,position:{x:0,y:0}}),ce=({pageId:e,children:n})=>{const[a,s]=O.useAtom(ie),c=l.useRef(null),o=a.pageId===e;l.useEffect(()=>{const d=()=>s({pageId:null,position:{x:0,y:0}});if(o)return document.addEventListener("click",d),()=>document.removeEventListener("click",d)},[o,s]);const p=d=>{d.preventDefault(),d.stopPropagation(),s({pageId:e,position:{x:d.clientX,y:d.clientY}})},v=()=>{const d=`${window.location.pathname}?page=${e}`;window.open(d,"_blank"),s({pageId:null,position:{x:0,y:0}})};return t.jsxs(t.Fragment,{children:[t.jsx("span",{onContextMenu:p,children:n}),o&&t.jsx("div",{ref:c,className:"fixed z-[9999] max-w-[160px] rounded-md border border-gray-200 bg-white",style:{top:a.position.y,left:a.position.x},children:t.jsx("div",{className:"",children:t.jsxs(re.Button,{variant:"ghost",onClick:v,className:"w-full px-2.5 py-1 text-start text-sm text-gray-700 hover:bg-gray-100",children:[t.jsx(b.ExternalLink,{className:"h-4 w-4"}),"Open in new tab"]})})})]})},de=({page:e})=>{var s,c;const{isExpanded:n,toggleExpanded:a}=B.usePageExpandManager(e==null?void 0:e.id);return t.jsx("button",{onClick:o=>{o.stopPropagation(),a()},disabled:!((s=e==null?void 0:e.children)!=null&&s.length),className:`flex h-[calc(100%-2px)] w-5 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-200 hover:px-1 hover:text-gray-500 ${(c=e==null?void 0:e.children)!=null&&c.length?"hover:text-blue-400":"opacity-0"}`,children:t.jsx(b.ChevronRight,{size:12,className:`stroke-[4] transition-transform duration-200 ${n?"rotate-90":""}`})})},ue=({page:e,pageType:n})=>t.jsx("div",{className:"flex h-full items-center justify-center gap-x-1",children:e.dynamic?t.jsx(b.StarsIcon,{size:12,className:"text-yellow-400"}):n!=null&&n.icon?t.jsx("div",{className:"flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",dangerouslySetInnerHTML:{__html:n.icon}}):n!=null&&n.hasSlug?t.jsx(b.File,{size:12,className:"stroke-[1] text-slate-500"}):t.jsx(b.Hash,{size:12,className:"stroke-[1] text-slate-500"})}),me=({isOnline:e})=>t.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-300":"bg-gray-300"}`}),xe=({page:e,pageTypes:n,currentPage:a,onClickAction:s,languagePages:c,selectedLanguage:o,showUntranslatedPages:p})=>{const v=f.useUserId(),{pageToUser:d}=f.usePageToUser(),y=r.get(d,[e==null?void 0:e.id,"userId"]),{data:x}=f.useChaiUserInfo(y),u=x&&v!==y?x==null?void 0:x.name:null,g=f.useFallbackLang(),w=a===e.id,I=!!e.isTemplate,j=l.useMemo(()=>r.find(n,{key:e.pageType}),[n,e.pageType]);let h=r.get(c,e==null?void 0:e.id);h=r.get(h,"lang")===o?h:null;const E=o===g||!!h,L=(h==null?void 0:h.name)||(e==null?void 0:e.name)||"No name";let k=(h==null?void 0:h.slug)||(e==null?void 0:e.slug)||"";const C=k+(e!=null&&e.dynamic?`/${j==null?void 0:j.dynamicSlug}`:"")+(e!=null&&e.dynamicSlugCustom?`${e.dynamicSlugCustom}`:"");if(k.startsWith("/")&&!p){const m=k.split("/").pop();k=k.endsWith(m)&&e.dynamic?"":`/${m}`}const M=l.useMemo(()=>{const m="flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]",T=`${w?"border-primary/30 bg-primary/5":"border-transparent hover:border-gray-200 hover:bg-gray-100"}`;return E?`${m} ${T} ${u?"opacity-60":""}`:`${m} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`},[E,w,u]);return t.jsxs("div",{className:"group relative",children:[t.jsx(ce,{pageId:e.id,children:t.jsxs("div",{onClick:()=>!e.isPartialGroup&&E&&s("select",e==null?void 0:e.id),className:M,children:[t.jsx(de,{page:e}),!e.isPartialGroup&&t.jsx(me,{isOnline:h?h.online:e.online}),!e.isPartialGroup&&t.jsx(ue,{page:e,pageType:j}),t.jsx(f.Tooltip,{content:L,side:"top",showTooltip:L.length>35,children:t.jsx("span",{className:"max-w-[40%] truncate font-medium text-black",children:L})}),(k||e.dynamic)&&t.jsx(f.Tooltip,{content:C,side:"top",showTooltip:!0,children:t.jsxs("span",{className:"max-w-[40%] truncate font-mono text-xs text-muted-foreground",children:[k,e.dynamic&&(j==null?void 0:j.dynamicSlug)&&t.jsxs("span",{className:"text-xs text-gray-500",children:["/",j==null?void 0:j.dynamicSlug,e.dynamicSlugCustom]})]})}),I&&t.jsx(f.Tooltip,{content:"Template",side:"top",children:t.jsx("span",{className:"text-blue-500",children:t.jsx(b.NotepadText,{size:16})})}),!e.isPartialGroup&&E&&!u?t.jsx("div",{className:"duration absolute right-0.5 top-[3px]",children:t.jsx(f.PageActionsDropdown,{isLanguagePage:!!h,page:h||e,setDuplicatePage:m=>s("duplicate",m),setAddEditPage:m=>s("edit",h||m),setUnpublishPage:m=>s("unpublish",m),setDeletePage:m=>s("delete",h||m),setMarkAsTemplate:m=>s("markAsTemplate",m),setUnmarkAsTemplate:m=>s("unmarkAsTemplate",m),children:t.jsx("div",{className:"m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white",children:t.jsx(b.MoreHorizontal,{className:"h-4 w-4",onClick:m=>m.stopPropagation()})})})}):u?t.jsx("span",{className:"duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:t.jsx(b.Lock,{className:"h-3.5 w-3.5 fill-red-200 text-red-500"})}):null]})}),t.jsx(t.Fragment,{children:u&&t.jsxs("button",{className:"absolute right-px top-1/2 flex h-6 -translate-y-1/2 items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[t.jsx(b.Edit,{size:12,className:"stroke-[3]"})," ",t.jsx("span",{className:"font-medium",children:u})," is editing this page"]})}),t.jsx(t.Fragment,{children:!E&&!e.isPartialGroup&&!u&&t.jsxs("button",{onClick:m=>{m.stopPropagation(),s("addLanguagePage",{language:o,page:e})},className:"absolute left-1/2 top-1 flex -translate-x-1/2 items-center gap-x-1 rounded bg-blue-500 px-2 py-0.5 text-xs text-white opacity-0 duration-200 hover:bg-blue-700 group-hover:opacity-100",children:[t.jsx(b.Plus,{size:12,className:"stroke-[3]"})," ",t.jsxs("span",{className:"text-[10px]",children:["Add ",r.get(f.LANGUAGES,o)," Page"]})]})})]})},K=({pages:e,tier:n,pageTypes:a,currentPage:s,onClickAction:c,languagePages:o,selectedLanguage:p,showUntranslatedPages:v})=>{const{expandedPages:d}=B.usePageExpandManager();return t.jsx("div",{className:"space-y-0.5",style:{paddingLeft:`${n*10}px`},children:e.map(y=>t.jsxs(t.Fragment,{children:[t.jsx(xe,{page:y,pageTypes:a,currentPage:s,onClickAction:c,languagePages:o,selectedLanguage:p,showUntranslatedPages:v}),y.children&&y.children.length>0&&(d==null?void 0:d.includes(y.id))&&t.jsx(K,{pages:y.children,tier:n+1,pageTypes:a,currentPage:s,onClickAction:c,languagePages:o,selectedLanguage:p,showUntranslatedPages:v})]},y.id))})},he=l.lazy(()=>Promise.resolve().then(()=>require("./page-manager-search-and-filter-Bfm0j1gg.cjs"))),fe=l.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-C_PzKby8.cjs"))),pe=l.lazy(()=>Promise.resolve().then(()=>require("./delete-page-DAvEjHwF.cjs"))),ye=l.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-DzZByALW.cjs"))),Pe=l.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-CpWEBJGd.cjs"))),ge=l.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-DF1Ms4VN.cjs"))),je=l.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-Bsq2yEqQ.cjs"))),be=({close:e})=>{const{t:n}=ne.useTranslation(),{languages:a,setSelectedLang:s}=X.useLanguages(),{data:c}=f.usePageTypes(),{data:o,isFetching:p}=f.useWebsitePages(),[v,d]=f.useSearchParams(),{updateForSelectedPage:y,expandPagesOnSearch:x}=B.usePageExpandManager(null),u=f.useFallbackLang(),g=v.get("page"),[w,I]=l.useState(""),[j,h]=l.useState(null),[E,L]=l.useState(null),[k,C]=l.useState(null),[M,m]=l.useState(null),[T,F]=l.useState(""),[R,G]=l.useState(null),[D,W]=l.useState(null),[S,Z]=l.useState(u),[ee,te]=l.useState(!1),_=O.useSetAtom(f.addNewLangAtom),q=ee&&S!==u,{data:A,isFetching:se}=f.useWebsiteLanguagePages(S),H=l.useCallback(P=>{var i;return(i=r.find(c,{key:P}))==null?void 0:i.hasSlug},[c]),N=l.useMemo(()=>o?q?r.filter(o,P=>!(A!=null&&A[P.id])):oe(o,w,T,H):[],[o,H,w,T,A,q]);l.useEffect(()=>{s(u)},[u,s]),l.useEffect(()=>{if(!r.isEmpty(T))return;const P=sessionStorage.getItem("pageTypeFilter")||"all";!r.isEmpty(c)&&P&&(r.find(c,{key:P})?F(P):F("all"))},[c,T]),l.useEffect(()=>{if(g&&!p&&!r.find(o,{id:g})){const i=r.find(o,{slug:"/"});if(i){const z=new URLSearchParams({page:i.id});f.navigateToPage(z,d)}else f.navigateToPage(new URLSearchParams({}),d,!0)}},[o,g,p,d]),l.useEffect(()=>{g&&!p&&!r.isEmpty(N)&&y(N,g)},[g,p,N,y]),l.useEffect(()=>{!r.isEmpty(w)&&!r.isEmpty(N)&&x(N)},[w,N,x]);const{setSelectedLang:U}=X.useLanguages(),Q=l.useCallback(P=>{const i=new URLSearchParams({page:P});S!==u?(i.set("lang",S),U(S)):U(""),f.navigateToPage(i,d),e()},[e,d,U,S,u]),V=(P,i)=>{var z;if(i)switch(P){case"add":L(i);break;case"select":Q(i);break;case"edit":S!==u?_({edit:!0,id:i==null?void 0:i.id,primaryPage:i==null?void 0:i.primaryPage}):L(i);break;case"delete":h(i);break;case"unpublish":C(i);break;case"markAsTemplate":m(i);break;case"unmarkAsTemplate":W(i);break;case"duplicate":G(i);break;case"addLanguagePage":_({edit:!1,primaryPage:((z=i==null?void 0:i.page)==null?void 0:z.id)||"",preselectedLang:(i==null?void 0:i.language)||S});break}};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col justify-between",children:[t.jsx(l.Suspense,{children:t.jsx(he,{pages:N,search:w,setSearch:I,languages:[u,...a],selectedLanguage:S,setSelectedLanguage:Z,selectedPageType:T,setSelectedPageType:F,onAddPage:P=>V("add",P),showUntranslatedPages:q,setShowUntranslatedPages:te})}),t.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-6 pt-2",children:p||se?t.jsx("div",{className:"space-y-2",children:r.map([...Array(15).keys()],P=>t.jsx("div",{className:"h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200"},P))}):r.isEmpty(N)?t.jsxs("div",{className:"flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500",children:[t.jsx(b.File,{className:"h-6 w-6 stroke-[1]"}),n("Empty List!"),t.jsx("span",{className:"font-light",children:n("Add new page to start")})]}):t.jsx(K,{tier:0,pages:N,pageTypes:c,currentPage:g||"",onClickAction:V,languagePages:A,selectedLanguage:S,showUntranslatedPages:q})})]}),E&&t.jsx(l.Suspense,{children:t.jsx(fe,{closePanel:e,editPage:Q,addEditPage:E,setAddEditPage:L})}),j&&t.jsx(l.Suspense,{children:t.jsx(pe,{page:j,onClose:()=>h(null)})}),k&&t.jsx(l.Suspense,{children:t.jsx(je,{page:k,onClose:()=>C(null)})}),M&&t.jsx(l.Suspense,{children:t.jsx(Pe,{page:M,onClose:()=>m(null)})}),D&&t.jsx(l.Suspense,{children:t.jsx(ge,{page:D,onClose:()=>W(null)})}),R&&t.jsx(l.Suspense,{children:t.jsx(ye,{page:R,onClose:()=>G(null),closePanel:e})})]})};exports.default=be;
@@ -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"),l=require("./index-C99FhuF1.cjs"),d=require("./index-C0-pgg_p.cjs"),y=require("@tanstack/react-query"),v=require("date-fns"),B=require("lodash-es"),p=require("lucide-react"),g=require("react");function L(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const S=L(g);function Q(s){const n=d.useApiUrl(),t=d.useFetch();return y.useQuery({queryKey:[d.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:d.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const z=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async a=>await n(s,{action:d.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:a}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async({revisionId:a,discardCurrent:r})=>await n(s,{action:d.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:a,discardCurrent:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=g.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-CLuUHiPU.cjs"))),b=({tag:s})=>s==="draft"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(p.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(p.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=d.useChaiCurrentPage(),{saveState:a}=l.useSavePage(),[r]=d.usePageEditInfo();if(!t)return null;const c=!!s.find(u=>{var i;return(i=u==null?void 0:u.uid)==null?void 0:i.startsWith("draft:")}),x=s.length>=2&&!c,m=a==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(b,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!B.isEmpty(r.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",v.formatDistanceToNow(new Date(r.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(b,{tag:"unsaved"}):null})]}),e.jsx(A,{checked:c,disabled:x,onChange:()=>{n(c?s.filter(u=>u.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(l.Skeleton,{className:"h-4 w-3/4"}),e.jsx(l.Skeleton,{className:"h-3 w-1/2"}),e.jsx(l.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(l.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function O({revision:s,isLatest:n,onRestore:t,onDelete:a,revisionNumber:r,compare:c,setCompare:x,pageId:m}){const{data:u}=d.useChaiUserInfo(s.currentEditor),i=(u==null?void 0:u.name)||"Unknown",f=!!c.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),w=c.length>=2&&!f;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(b,{tag:n?"live":`#${r}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:i})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(b,{tag:"published"}):e.jsx(b,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:v.format(s.createdAt,"MMM d, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(d.PermissionChecker,{permissions:[d.PAGES_PERMISSIONS.RESTORE_REVISION,d.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:a})})}),e.jsx(A,{checked:f,disabled:w,onChange:()=>{x(f?c.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...c,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${r}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function W({compare:s,setCompare:n,pageId:t}){const[a,r]=g.useState(!1),[c,x]=s;if(s.length===0)return null;const m=({tab:u})=>e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(b,{tag:u.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.filter(i=>i.uid!==u.uid)),"aria-label":"Remove selection 1",children:e.jsx(p.X,{className:"h-3 w-3"})})]});return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),c&&e.jsx(m,{tab:c}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),x?e.jsx(m,{tab:x}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>r(!0),disabled:s.length<2,children:[e.jsx(p.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),a&&(s==null?void 0:s.length)>1&&t&&e.jsx(g.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:a,onOpenChange:r,compare:s})})]})}function A({checked:s,disabled:n,onChange:t,label:a="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:a})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(l.DropdownMenu,{children:[e.jsx(l.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(p.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(l.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(l.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(p.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(l.DropdownMenuSeparator,{}),e.jsxs(l.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(p.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:a,isRestoring:r}){const{data:c}=d.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),x=(c==null?void 0:c.name)||"Unknown";return t?e.jsx(l.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(l.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{children:"Restore Revision"}),e.jsxs(l.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",v.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",x]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(l.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>a(!1),disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(N.Button,{variant:"default",className:"sm:flex-1",onClick:()=>a(!0),disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:a,isDeleting:r}){const{data:c}=d.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),x=(c==null?void 0:c.name)||"Unknown";return t?e.jsx(l.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(l.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{children:"Delete Revision"}),e.jsxs(l.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",v.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",x]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(l.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:r,children:"Cancel"}),e.jsx(N.Button,{variant:"destructive",className:"sm:flex-1",onClick:a,disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var R,I;const[n,t]=S.useState([]),[a,r]=S.useState(null),[c,x]=S.useState(!1),[m,u]=S.useState(!1),{data:i}=d.useChaiCurrentPage(),{data:f,isFetching:w,error:h,refetch:j}=Q(i==null?void 0:i.id),{mutate:T,isPending:M}=z(),{mutate:k,isPending:F}=H(),_=y.useQueryClient(),{selectedLang:P,fallbackLang:q}=l.useLanguages(),U=P||q;g.useEffect(()=>{g.startTransition(()=>t([]))},[i==null?void 0:i.id]);const G=o=>{a&&k({revisionId:a.uid,discardCurrent:o},{onSuccess:()=>{x(!1),r(null),_.invalidateQueries({queryKey:[d.ACTIONS.GET_DRAFT_PAGE]})}})},C=o=>{r(o),x(!0)},E=o=>{r(o),u(!0)},V=()=>{a&&T(a.uid,{onSuccess:()=>{u(!1),r(null)}})};return g.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(l.SheetHeader,{children:[e.jsx(l.SheetTitle,{children:"Revision History"}),(i==null?void 0:i.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",v.format(new Date(i.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),w?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:i==null?void 0:i.id}),e.jsx(J,{compare:n,setCompare:t}),(R=f==null?void 0:f.filter(o=>o.uid==="current"))==null?void 0:R.map((o,D)=>e.jsx(O,{pageId:i==null?void 0:i.id,revision:o,isLatest:!0,onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:D,compare:n,setCompare:t},o.uid)),e.jsx(l.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:(I=f==null?void 0:f.filter(o=>o.uid!=="current"))==null?void 0:I.map((o,D)=>e.jsx(O,{pageId:i==null?void 0:i.id,revision:o,isLatest:o.uid==="current",onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:D+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:c,onOpenChange:x,revision:a,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:u,revision:a,onDelete:V,isDeleting:M})]})}exports.default=ee;
@@ -1,22 +0,0 @@
1
- "use strict";const a=require("lodash-es"),h=require("./fonts-B-Xt29pe.cjs"),b=require("./_commonjsHelpers-DwGv2jUC.cjs"),B={fontFamily:{"font-heading":"Inter","font-body":"Inter"},borderRadius:"10px",colors:[{group:"Body",items:{background:["#FFFFFF","#121212"],foreground:["#121212","#FFFFFF"]}},{group:"Primary",items:{primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"]}},{group:"Secondary",items:{secondary:["#F3F4F6","#374151"],"secondary-foreground":["#1F2937","#F9FAFB"]}},{group:"Border, Input & Ring",items:{border:["#E5E7EB","#374151"],input:["#E5E7EB","#374151"],ring:["#2563EB","#3B82F6"]}},{group:"Card",items:{card:["#FFFFFF","#1F2937"],"card-foreground":["#121212","#FFFFFF"]}},{group:"Popover",items:{popover:["#FFFFFF","#1F2937"],"popover-foreground":["#121212","#FFFFFF"]}},{group:"Muted",items:{muted:["#F3F4F6","#374151"],"muted-foreground":["#6B7280","#9CA3AF"]}},{group:"Accent",items:{accent:["#F3F4F6","#374151"],"accent-foreground":["#1F2937","#FFFFFF"]}},{group:"Destructive",items:{destructive:["#DC2626","#EF4444"],"destructive-foreground":["#FFFFFF","#FFFFFF"]}}]},v={fontFamily:{heading:"Inter",body:"Inter"},borderRadius:"6px",colors:{background:["#FFFFFF","#09090B"],foreground:["#09090B","#FFFFFF"],primary:["#2563EB","#3B82F6"],"primary-foreground":["#FFFFFF","#FFFFFF"],secondary:["#F4F4F5","#27272A"],"secondary-foreground":["#09090B","#FFFFFF"],muted:["#F4F4F5","#27272A"],"muted-foreground":["#71717A","#A1A1AA"],accent:["#F4F4F5","#27272A"],"accent-foreground":["#09090B","#FFFFFF"],destructive:["#EF4444","#7F1D1D"],"destructive-foreground":["#FFFFFF","#FFFFFF"],border:["#E4E4E7","#27272A"],input:["#E4E4E7","#27272A"],ring:["#2563EB","#3B82F6"],card:["#FFFFFF","#09090B"],"card-foreground":["#09090B","#FFFFFF"],popover:["#FFFFFF","#09090B"],"popover-foreground":["#09090B","#FFFFFF"]}},_=e=>({fontFamily:e.fontFamily?a.keys(e.fontFamily).reduce((r,n)=>({...r,[n.replace("font-","")]:`var(--${n})`}),{}):{},borderRadius:e.borderRadius?{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}:{},colors:e.colors?a.flatten(e.colors.map(r=>Object.entries(r.items))).reduce((r,[n])=>({...r,[n]:`hsl(var(--${n}))`}),{}):{}});function m(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=parseInt(t[1],16),n=parseInt(t[2],16),F=parseInt(t[3],16);r/=255,n/=255,F/=255;const o=Math.max(r,n,F),u=Math.min(r,n,F);let i=0,l=0;const g=(o+u)/2;if(o==u)i=l=0;else{const s=o-u;switch(l=g>.5?s/(2-o-u):s/(o+u),o){case r:i=(n-F)/s+(n<F?6:0);break;case n:i=(F-r)/s+2;break;case F:i=(r-n)/s+4;break}i/=6}return`${Math.round(i*360)} ${Math.round(l*100)}% ${Math.round(g*100)}%`}const E=e=>{const r=h.getAllRegisteredFonts().find(n=>n.family===e);return`"${e}", ${a.get(r,"fallback","")}`},C=e=>`:root {
2
- ${e.fontFamily&&Object.entries(e.fontFamily).map(([t,r])=>`--font-${t}: ${E(r)};`).join(`
3
- `)}
4
- ${e.borderRadius&&`--radius: ${e.borderRadius};`}
5
- ${e.colors&&Object.entries(e.colors).map(([t,r])=>`--${t}: ${m(r[0])};`).join(`
6
- `)}
7
- }
8
- .dark {
9
- ${e.colors&&Object.entries(e.colors).map(([t,r])=>`--${t}: ${m(r[1])};`).join(`
10
- `)}
11
- }`,P=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(t=>`<link rel="stylesheet" href="${t.url}" />`).join(`
12
- `),A=e=>!e||e.length===0?[]:a.uniqBy(e,"family").map(t=>t.url),j=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(t=>`@import url("${t.url}");`).join(`
13
- `),q=e=>!e||e.length===0?"":a.uniqBy(e,"family").map(t=>t.src.map(r=>`@font-face {
14
- font-family: "${t.family}";
15
- src: url("${r.url}") format("${r.format}");
16
- font-display: swap;
17
- ${r.fontWeight?`font-weight: ${r.fontWeight};`:""}
18
- ${r.fontStyle?`font-style: ${r.fontStyle};`:""}
19
- ${r.fontStretch?`font-stretch: ${r.fontStretch};`:""}
20
- }`).join(`
21
- `)).join(`
22
- `);var d={},c={},p;function M(){return p||(p=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});function t(n,F){return{handler:n,config:F}}t.withOptions=function(n,F=()=>({})){const o=function(u){return{__options:u,handler:n(u),config:F(u)}};return o.__isOptionsFunction=!0,o.__pluginFunction=n,o.__configFunction=F,o};const r=t})(c)),c}var y;function k(){return y||(y=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});const t=r(M());function r(F){return F&&F.__esModule?F:{default:F}}const n=t.default})(d)),d}var f,$;function R(){if($)return f;$=1;let e=k();return f=(e.__esModule?e:{default:e}).default,f}var I=R();const O=b.getDefaultExportFromCjs(I);exports.defaultThemeOptions=B;exports.defaultThemeValues=v;exports.getChaiThemeCssVariables=C;exports.getChaiThemeOptions=_;exports.getThemeCustomFontFace=q;exports.getThemeFontsCSSImport=j;exports.getThemeFontsLinkMarkup=P;exports.getThemeFontsUrls=A;exports.plugin=O;