@chaibuilder/pages 0.16.9 → 0.16.10

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 (177) hide show
  1. package/dist/{2AITGKQY-BGZjtYdS.cjs → 2AITGKQY-C0A7leVc.cjs} +1 -1
  2. package/dist/{2AITGKQY-BmDJ4ubt.js → 2AITGKQY-LtoYzpXb.js} +2 -2
  3. package/dist/{NCMVHL6D-CRT9RlLF.cjs → NCMVHL6D-BbCiXTDR.cjs} +1 -1
  4. package/dist/{NCMVHL6D-Dk4_u4LD.js → NCMVHL6D-BqKNTZhH.js} +2 -2
  5. package/dist/{ZDWCUMSJ-Ktzz_Tsg.js → ZDWCUMSJ-CudD-G3A.js} +1 -1
  6. package/dist/{ZDWCUMSJ-DEHPTCDq.cjs → ZDWCUMSJ-DEjMuvHw.cjs} +1 -1
  7. package/dist/{_arrayEach-CvixaZ6g.cjs → _arrayEach-7nw56Qes.cjs} +1 -1
  8. package/dist/{_arrayEach-BoWUuJyH.js → _arrayEach-CBNlJl8q.js} +1 -1
  9. package/dist/{add-new-language-page-BLNVUYeo.js → add-new-language-page-C3R8vwOA.js} +2 -2
  10. package/dist/{add-new-language-page-jU1kF1AN.cjs → add-new-language-page-CTZglguY.cjs} +1 -1
  11. package/dist/{add-new-page-DKyY5ZY7.cjs → add-new-page-ByCsABU-.cjs} +1 -1
  12. package/dist/{add-new-page-X9ytZJiO.js → add-new-page-Dn-jphFf.js} +1 -1
  13. package/dist/{ai-panel-content-ChDHNrKg.js → ai-panel-content-CF7-wrq0.js} +17 -17
  14. package/dist/ai-panel-content-VYS5Bn3a.cjs +1 -0
  15. package/dist/{ai-panel-default-lang-CxmSDvNu.js → ai-panel-default-lang-C_zJzkZ4.js} +110 -104
  16. package/dist/ai-panel-default-lang-D5vpT3cL.cjs +3 -0
  17. package/dist/{ai-panel-other-lang-CicrT1I-.js → ai-panel-other-lang-5Hdkr4eJ.js} +19 -19
  18. package/dist/ai-panel-other-lang-BFnghH5Z.cjs +1 -0
  19. package/dist/{ai-prompt-input-L_bHFj7w.cjs → ai-prompt-input-BXp7SxcJ.cjs} +1 -1
  20. package/dist/{ai-prompt-input-BOAqFpAN.js → ai-prompt-input-CrBweB8X.js} +1 -1
  21. package/dist/{ai-translation-prompt-23g3VfWP.cjs → ai-translation-prompt-BYubvAxO.cjs} +1 -1
  22. package/dist/{ai-translation-prompt-DoeWqKDZ.js → ai-translation-prompt-E3TEDobP.js} +1 -1
  23. package/dist/{arc-CEYgkAY6.js → arc-CuYV2Z4i.js} +1 -1
  24. package/dist/{arc-DQcgp6fe.cjs → arc-Dzs-yn9V.cjs} +1 -1
  25. package/dist/{architecture-U656AL7Q-D9ThnYW7.js → architecture-U656AL7Q-BFW69Rn1.js} +1 -1
  26. package/dist/{architecture-U656AL7Q-DXHyXosc.cjs → architecture-U656AL7Q-C1RBosC-.cjs} +1 -1
  27. package/dist/{architectureDiagram-VXUJARFQ-xhCIZb18.js → architectureDiagram-VXUJARFQ-C7E-J7qp.js} +4 -4
  28. package/dist/{architectureDiagram-VXUJARFQ-DJkKSCT6.cjs → architectureDiagram-VXUJARFQ-i1olysFf.cjs} +1 -1
  29. package/dist/{blockDiagram-VD42YOAC-zvZU2M01.js → blockDiagram-VD42YOAC-8bGFphRU.js} +4 -4
  30. package/dist/{blockDiagram-VD42YOAC-DqXdnG8y.cjs → blockDiagram-VD42YOAC-DG8nN7FI.cjs} +1 -1
  31. package/dist/{c4Diagram-YG6GDRKO-BpDWqFJi.js → c4Diagram-YG6GDRKO-C5vTWKII.js} +2 -2
  32. package/dist/{c4Diagram-YG6GDRKO-COF9vwh9.cjs → c4Diagram-YG6GDRKO-ojLwrHAZ.cjs} +1 -1
  33. package/dist/{channel-DMpDH8Tt.js → channel-Cdlcq82Q.js} +1 -1
  34. package/dist/{channel-DshxF_w-.cjs → channel-D8SQrHOQ.cjs} +1 -1
  35. package/dist/{chunk-4BX2VUAB-DOrHz66s.cjs → chunk-4BX2VUAB-D0Nkkvke.cjs} +1 -1
  36. package/dist/{chunk-4BX2VUAB-DcXzX0k2.js → chunk-4BX2VUAB-kRXCJxGQ.js} +1 -1
  37. package/dist/{chunk-55IACEB6-MgFQOjd_.cjs → chunk-55IACEB6-Ya_-e5Gj.cjs} +1 -1
  38. package/dist/{chunk-55IACEB6-yEIZuruo.js → chunk-55IACEB6-xzVewFKl.js} +1 -1
  39. package/dist/{chunk-B4BG7PRW-Dw8okTHN.cjs → chunk-B4BG7PRW-C8Sj4Rta.cjs} +1 -1
  40. package/dist/{chunk-B4BG7PRW-Bm0X0FwP.js → chunk-B4BG7PRW-DG5qX3ch.js} +4 -4
  41. package/dist/{chunk-DI55MBZ5-CY8rQYfB.cjs → chunk-DI55MBZ5-C9He0Rku.cjs} +1 -1
  42. package/dist/{chunk-DI55MBZ5-Dzl4K5YZ.js → chunk-DI55MBZ5-CI_Ti_F2.js} +3 -3
  43. package/dist/{chunk-FMBD7UC4-DsnO3YB7.js → chunk-FMBD7UC4-9Wx_99-Q.js} +1 -1
  44. package/dist/{chunk-FMBD7UC4-DeDzgDPq.cjs → chunk-FMBD7UC4-Be12B01Q.cjs} +1 -1
  45. package/dist/{chunk-QN33PNHL-D0hZD6ce.cjs → chunk-QN33PNHL-B65aZfT8.cjs} +1 -1
  46. package/dist/{chunk-QN33PNHL-eCpJSQLd.js → chunk-QN33PNHL-qSV2Zj2E.js} +1 -1
  47. package/dist/{chunk-QZHKN3VN-0xh2Brzo.js → chunk-QZHKN3VN-Dcw61eWf.js} +1 -1
  48. package/dist/{chunk-QZHKN3VN-DPT45Qxb.cjs → chunk-QZHKN3VN-V8GIXVhC.cjs} +1 -1
  49. package/dist/{chunk-TZMSLE5B-B0DNnH2K.cjs → chunk-TZMSLE5B-BUsuXR8P.cjs} +1 -1
  50. package/dist/{chunk-TZMSLE5B-v44khzET.js → chunk-TZMSLE5B-De8BBIp6.js} +1 -1
  51. package/dist/{classDiagram-v2-WZHVMYZB-DZwYP3Mp.cjs → classDiagram-2ON5EDUG-DD8PWOat.cjs} +1 -1
  52. package/dist/{classDiagram-v2-WZHVMYZB-CatlwrWr.js → classDiagram-2ON5EDUG-DYXMSnp5.js} +2 -2
  53. package/dist/{classDiagram-2ON5EDUG-DZwYP3Mp.cjs → classDiagram-v2-WZHVMYZB-DD8PWOat.cjs} +1 -1
  54. package/dist/{classDiagram-2ON5EDUG-CatlwrWr.js → classDiagram-v2-WZHVMYZB-DYXMSnp5.js} +2 -2
  55. package/dist/{cose-bilkent-S5V4N54A-oJ7CCCne.cjs → cose-bilkent-S5V4N54A-BzynRFve.cjs} +1 -1
  56. package/dist/{cose-bilkent-S5V4N54A-CdqaV_In.js → cose-bilkent-S5V4N54A-C0LrMYq9.js} +2 -2
  57. package/dist/{dagre-6UL2VRFP-DwJsczXN.cjs → dagre-6UL2VRFP-CJe6baLS.cjs} +1 -1
  58. package/dist/{dagre-6UL2VRFP-ylnuUwh7.js → dagre-6UL2VRFP-DK7rwVEg.js} +1 -1
  59. package/dist/{delete-page-D8gUlElz.js → delete-page-BtWRzpTh.js} +1 -1
  60. package/dist/{delete-page-CSuwBSa6.cjs → delete-page-CecAr8Ev.cjs} +1 -1
  61. package/dist/{diagram-PSM6KHXK-me6JcFi2.js → diagram-PSM6KHXK-C_A00ng9.js} +4 -4
  62. package/dist/{diagram-PSM6KHXK-DPPOo04u.cjs → diagram-PSM6KHXK-X4v5dsQ4.cjs} +1 -1
  63. package/dist/{diagram-QEK2KX5R-atRnaXRv.cjs → diagram-QEK2KX5R-rhfU6qwd.cjs} +1 -1
  64. package/dist/{diagram-QEK2KX5R-CfDWc-r0.js → diagram-QEK2KX5R-tTChUtDg.js} +3 -3
  65. package/dist/{diagram-S2PKOQOG-DvQBNtA7.js → diagram-S2PKOQOG-CJixlBq7.js} +3 -3
  66. package/dist/{diagram-S2PKOQOG-BzM_Yydz.cjs → diagram-S2PKOQOG-XyZUZk_b.cjs} +1 -1
  67. package/dist/{digital-asset-manager-C-tiZy6C.js → digital-asset-manager-CyBlpHrq.js} +1 -1
  68. package/dist/{digital-asset-manager-B1NMros3.cjs → digital-asset-manager-Y8YMABE1.cjs} +1 -1
  69. package/dist/{duplicate-page-BgR_Z5mB.js → duplicate-page-3Dv56tPR.js} +2 -2
  70. package/dist/{duplicate-page-DfsShaR3.cjs → duplicate-page-nGQAYVQc.cjs} +1 -1
  71. package/dist/{dynamic-page-selector-B9LvdmAM.cjs → dynamic-page-selector-B9XaZMxt.cjs} +1 -1
  72. package/dist/{dynamic-page-selector-B_Il05Tb.js → dynamic-page-selector-BapENUmp.js} +1 -1
  73. package/dist/{erDiagram-Q2GNP2WA-BvcqZzam.js → erDiagram-Q2GNP2WA-B1QcX93p.js} +4 -4
  74. package/dist/{erDiagram-Q2GNP2WA-CIz-zXL5.cjs → erDiagram-Q2GNP2WA-Up8_IT91.cjs} +1 -1
  75. package/dist/{flowDiagram-NV44I4VS-H3UO6GU6.cjs → flowDiagram-NV44I4VS-BJffdKk6.cjs} +1 -1
  76. package/dist/{flowDiagram-NV44I4VS-DNDFiS4P.js → flowDiagram-NV44I4VS-Dq0-N_i3.js} +5 -5
  77. package/dist/{ganttDiagram-LVOFAZNH-3uLir5Ok.cjs → ganttDiagram-LVOFAZNH-CndRZUwp.cjs} +1 -1
  78. package/dist/{ganttDiagram-LVOFAZNH-CuEk_EPv.js → ganttDiagram-LVOFAZNH-DCuouHg6.js} +3 -3
  79. package/dist/{gitGraph-F6HP7TQM-DnzvXoTf.cjs → gitGraph-F6HP7TQM-1lOuaCHS.cjs} +1 -1
  80. package/dist/{gitGraph-F6HP7TQM-BNgutOCt.js → gitGraph-F6HP7TQM-Bwgh2Tgj.js} +1 -1
  81. package/dist/{gitGraphDiagram-NY62KEGX-DJ--wipu.js → gitGraphDiagram-NY62KEGX-BFpRv9B4.js} +4 -4
  82. package/dist/{gitGraphDiagram-NY62KEGX-CpjW-tAs.cjs → gitGraphDiagram-NY62KEGX-Cc8RVspd.cjs} +1 -1
  83. package/dist/{index-D_4YaLhN.cjs → index-C1bimRWu.cjs} +2 -2
  84. package/dist/{index-CSOKPmkj.js → index-C_34q9jG.js} +17 -17
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/{info-NVLQJR56-nlYJye66.cjs → info-NVLQJR56-C3piIB8L.cjs} +1 -1
  88. package/dist/info-NVLQJR56-DxpWS9Ek.js +5 -0
  89. package/dist/{infoDiagram-ER5ION4S-BYBSnMk9.cjs → infoDiagram-ER5ION4S-DqXS6eRb.cjs} +1 -1
  90. package/dist/{infoDiagram-ER5ION4S-D1ovR6Sb.js → infoDiagram-ER5ION4S-iBX13SKY.js} +2 -2
  91. package/dist/{journeyDiagram-XKPGCS4Q-aab6wkCY.js → journeyDiagram-XKPGCS4Q-CIELmZlO.js} +4 -4
  92. package/dist/{journeyDiagram-XKPGCS4Q-D-YRkdmZ.cjs → journeyDiagram-XKPGCS4Q-CJX0XVNj.cjs} +1 -1
  93. package/dist/{json-diff-viewer-BafhQd3C.cjs → json-diff-viewer-B9kQEwcr.cjs} +1 -1
  94. package/dist/{json-diff-viewer-eh2Twply.js → json-diff-viewer-D2tCblUU.js} +1 -1
  95. package/dist/{kanban-definition-3W4ZIXB7-D_bnY8Es.cjs → kanban-definition-3W4ZIXB7-DnhdFt_Y.cjs} +1 -1
  96. package/dist/{kanban-definition-3W4ZIXB7-BDK6FtYy.js → kanban-definition-3W4ZIXB7-WK7l1gdb.js} +2 -2
  97. package/dist/{lang-panel-koRXBdpN.cjs → lang-panel-ClCAoE4L.cjs} +1 -1
  98. package/dist/{lang-panel-Dha1mI9s.js → lang-panel-CsA6jzez.js} +2 -2
  99. package/dist/{linear-CBvDLesx.cjs → linear-CdbmJ0kA.cjs} +1 -1
  100. package/dist/{linear-DmFX6iHR.js → linear-CebAae2s.js} +1 -1
  101. package/dist/{mark-as-template-DojgcJFD.js → mark-as-template-BsOhlLYx.js} +1 -1
  102. package/dist/{mark-as-template-BHkftF1C.cjs → mark-as-template-DUeGBAgn.cjs} +1 -1
  103. package/dist/{mermaid-parser.core-Df9eyFSv.cjs → mermaid-parser.core-DKJdj2_U.cjs} +2 -2
  104. package/dist/{mermaid-parser.core-Crve7Cv1.js → mermaid-parser.core-GitSl6co.js} +9 -9
  105. package/dist/{mermaid.core-e6RNUZK7.js → mermaid.core-3NhAXOzj.js} +31 -31
  106. package/dist/{mermaid.core-DY8gIrXk.cjs → mermaid.core-Cop_RRH4.cjs} +4 -4
  107. package/dist/{mindmap-definition-VGOIOE7T-BqZKJ_7z.js → mindmap-definition-VGOIOE7T-BOk1rAbB.js} +3 -3
  108. package/dist/{mindmap-definition-VGOIOE7T-CFYCEGsR.cjs → mindmap-definition-VGOIOE7T-cJsasSc0.cjs} +1 -1
  109. package/dist/{no-language-page-content-ZlibO6-a.js → no-language-page-content-DveHrqZF.js} +1 -1
  110. package/dist/{no-language-page-content-BjlCydsa.cjs → no-language-page-content-KLiCVKWw.cjs} +1 -1
  111. package/dist/{packet-BFZMPI3H-CmnL1d8H.cjs → packet-BFZMPI3H-B0uDu6gg.cjs} +1 -1
  112. package/dist/{packet-BFZMPI3H-BNOgRfy4.js → packet-BFZMPI3H-tS-CKRal.js} +1 -1
  113. package/dist/{page-creator-CYxW-uMk.js → page-creator-Du1tv5PL.js} +2 -2
  114. package/dist/{page-creator-D-HTXuwL.cjs → page-creator-I5z6OA-y.cjs} +1 -1
  115. package/dist/{page-lock-request-DIqND4Zp.js → page-lock-request-C_FjXr4-.js} +1 -1
  116. package/dist/{page-lock-request-ggTN32LL.cjs → page-lock-request-DSCZ2b9Y.cjs} +1 -1
  117. package/dist/{page-locked-by-dialog-Dv1QMUs2.js → page-locked-by-dialog-DAJlxcUt.js} +1 -1
  118. package/dist/{page-locked-by-dialog-DF_r3NKB.cjs → page-locked-by-dialog-Daefw0-2.cjs} +1 -1
  119. package/dist/{page-manager-new-iuNdn54Y.js → page-manager-new-BNk_0XVK.js} +2 -2
  120. package/dist/{page-manager-new-B7nEY5DJ.cjs → page-manager-new-DmA0Ka0c.cjs} +1 -1
  121. package/dist/{page-manager-search-and-filter-BuQLf3EG.cjs → page-manager-search-and-filter-DkR8sFPh.cjs} +1 -1
  122. package/dist/{page-manager-search-and-filter-Dvt-nBOL.js → page-manager-search-and-filter-heV_U9x0.js} +1 -1
  123. package/dist/{page-revisions-content-CR_65Pri.cjs → page-revisions-content-BIhjzS21.cjs} +1 -1
  124. package/dist/{page-revisions-content-DH30uwKy.js → page-revisions-content-BVg59skx.js} +2 -2
  125. package/dist/pie-7BOR55EZ-CcDzfu0_.js +5 -0
  126. package/dist/{pie-7BOR55EZ-CM2pRchz.cjs → pie-7BOR55EZ-CqYqIXXG.cjs} +1 -1
  127. package/dist/{pieDiagram-ADFJNKIX-DhRe-2Yk.js → pieDiagram-ADFJNKIX-CFfE-HG7.js} +4 -4
  128. package/dist/{pieDiagram-ADFJNKIX-C_B1s9Ov.cjs → pieDiagram-ADFJNKIX-DWVdC3zW.cjs} +1 -1
  129. package/dist/{publish-pages-content-fwqyxl_3.js → publish-pages-content-BhJ_uRxQ.js} +2 -2
  130. package/dist/{publish-pages-content-DOniOjSV.cjs → publish-pages-content-CKydxoZ_.cjs} +1 -1
  131. package/dist/{quadrantDiagram-AYHSOK5B-DSaDCScU.js → quadrantDiagram-AYHSOK5B-6xSOcCxL.js} +2 -2
  132. package/dist/{quadrantDiagram-AYHSOK5B-CrS56DWV.cjs → quadrantDiagram-AYHSOK5B-J0R9fpox.cjs} +1 -1
  133. package/dist/radar-NHE76QYJ-C4G7hzu6.js +5 -0
  134. package/dist/{radar-NHE76QYJ-CPX8AaYO.cjs → radar-NHE76QYJ-EznHmPEg.cjs} +1 -1
  135. package/dist/{requirementDiagram-UZGBJVZJ-D60OatrS.cjs → requirementDiagram-UZGBJVZJ-DXq0f3Op.cjs} +1 -1
  136. package/dist/{requirementDiagram-UZGBJVZJ-CbpHc5TO.js → requirementDiagram-UZGBJVZJ-p2d3AnQ8.js} +3 -3
  137. package/dist/{sankeyDiagram-TZEHDZUN-DklD-Q91.cjs → sankeyDiagram-TZEHDZUN-CLBuuob-.cjs} +1 -1
  138. package/dist/{sankeyDiagram-TZEHDZUN-AFuyaZMZ.js → sankeyDiagram-TZEHDZUN-CbASga1e.js} +1 -1
  139. package/dist/{save-to-lib-DKP-iiLU.js → save-to-lib-Byfa7tCG.js} +1 -1
  140. package/dist/{save-to-lib-DmZbKkm9.cjs → save-to-lib-C3mx8iXu.cjs} +1 -1
  141. package/dist/{selected-block-display-BPkRbRtv.js → selected-block-display-CZ3zwgqL.js} +2 -2
  142. package/dist/{selected-block-display-CMhOKq0c.cjs → selected-block-display-GwQBADhp.cjs} +2 -2
  143. package/dist/{seo-panel-D1FyS42r.js → seo-panel-CrpYigIp.js} +1 -1
  144. package/dist/{seo-panel-l-VdkTzp.cjs → seo-panel-DxaEiunO.cjs} +1 -1
  145. package/dist/{sequenceDiagram-WL72ISMW-p_o77zn1.js → sequenceDiagram-WL72ISMW-3T2mzAhA.js} +3 -3
  146. package/dist/{sequenceDiagram-WL72ISMW-CotOH2Xj.cjs → sequenceDiagram-WL72ISMW-DmS_WEPR.cjs} +1 -1
  147. package/dist/server.cjs +1 -1
  148. package/dist/server.js +1 -1
  149. package/dist/{shared-json-ld-0VORoKPu.cjs → shared-json-ld-CcUhox6j.cjs} +1 -1
  150. package/dist/{shared-json-ld-jn36kQ1J.js → shared-json-ld-DczSLaqw.js} +1 -1
  151. package/dist/{slug-input-DPMG1pMZ.js → slug-input-CjagPxIn.js} +1 -1
  152. package/dist/{slug-input-CPHwulQv.cjs → slug-input-CsniBgYf.cjs} +1 -1
  153. package/dist/{stateDiagram-FKZM4ZOC-B1pfSzZB.cjs → stateDiagram-FKZM4ZOC-BmMX9umD.cjs} +1 -1
  154. package/dist/{stateDiagram-FKZM4ZOC-Ch8gd7OX.js → stateDiagram-FKZM4ZOC-D9lkyJcL.js} +2 -2
  155. package/dist/{stateDiagram-v2-4FDKWEC3-DCj4svbU.cjs → stateDiagram-v2-4FDKWEC3-BwQkMtRv.cjs} +1 -1
  156. package/dist/{stateDiagram-v2-4FDKWEC3-BDxmTUgh.js → stateDiagram-v2-4FDKWEC3-D0yq-_gB.js} +2 -2
  157. package/dist/{theme-panel-footer-DsZ67xQ8.cjs → theme-panel-footer-BYI0_a19.cjs} +1 -1
  158. package/dist/{theme-panel-footer-XREndTvO.js → theme-panel-footer-C-uSbeOf.js} +1 -1
  159. package/dist/{timeline-definition-IT6M3QCI-CK1EW7lG.cjs → timeline-definition-IT6M3QCI-Bi9IiYMF.cjs} +1 -1
  160. package/dist/{timeline-definition-IT6M3QCI-CmX-2kfr.js → timeline-definition-IT6M3QCI-LtkAohDp.js} +2 -2
  161. package/dist/{treemap-KMMF4GRG-D5Rm845j.cjs → treemap-KMMF4GRG-DAuFMsAI.cjs} +1 -1
  162. package/dist/{treemap-KMMF4GRG-B51FyMCU.js → treemap-KMMF4GRG-vy1iI8-N.js} +1 -1
  163. package/dist/{unmark-as-template-VHopisw3.js → unmark-as-template-CGKkAZPZ.js} +1 -1
  164. package/dist/{unmark-as-template-BB_2lvTh.cjs → unmark-as-template-GuUssCYI.cjs} +1 -1
  165. package/dist/{unpublish-page-DJKgb2OG.cjs → unpublish-page-D67IrGmd.cjs} +1 -1
  166. package/dist/{unpublish-page-Cq5OwCf-.js → unpublish-page-ow8e1CXO.js} +1 -1
  167. package/dist/{web-preview-CGX6_m7_.cjs → web-preview-Dm8A9E8S.cjs} +1 -1
  168. package/dist/{web-preview-BEYsnCo4.js → web-preview-NCfHy3pB.js} +1 -1
  169. package/dist/{xychartDiagram-PRI3JC2R-BXSS1azt.cjs → xychartDiagram-PRI3JC2R-d5V8_6ka.cjs} +1 -1
  170. package/dist/{xychartDiagram-PRI3JC2R-vt3IdmK_.js → xychartDiagram-PRI3JC2R-ggiHJXU7.js} +2 -2
  171. package/package.json +12 -12
  172. package/dist/ai-panel-content-Bi18WMi2.cjs +0 -1
  173. package/dist/ai-panel-default-lang-B6tYYmxI.cjs +0 -3
  174. package/dist/ai-panel-other-lang-B0umwiEm.cjs +0 -1
  175. package/dist/info-NVLQJR56-cQ8VboSE.js +0 -5
  176. package/dist/pie-7BOR55EZ-B4yrare5.js +0 -5
  177. package/dist/radar-NHE76QYJ-CN3oBECV.js +0 -5
@@ -1,6 +1,6 @@
1
- import { g as le } from "./chunk-55IACEB6-yEIZuruo.js";
2
- import { s as he } from "./chunk-QN33PNHL-eCpJSQLd.js";
3
- import { _ as l, l as C, d as X, E as j, i as F, aw as de, z as ge, A as ue, ae as pe, af as fe, ag as ye } from "./mermaid.core-e6RNUZK7.js";
1
+ import { g as le } from "./chunk-55IACEB6-xzVewFKl.js";
2
+ import { s as he } from "./chunk-QN33PNHL-qSV2Zj2E.js";
3
+ import { _ as l, l as C, d as X, E as j, i as F, aw as de, z as ge, A as ue, ae as pe, af as fe, ag as ye } from "./mermaid.core-3NhAXOzj.js";
4
4
  const E = [];
5
5
  for (let t = 0; t < 256; ++t)
6
6
  E.push((t + 256).toString(16).slice(1));
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("./chunk-55IACEB6-MgFQOjd_.cjs"),ae=require("./chunk-QN33PNHL-D0hZD6ce.cjs"),a=require("./mermaid.core-DY8gIrXk.cjs"),_=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function oe(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}let H;const ce=new Uint8Array(16);function le(){if(!H){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");H=crypto.getRandomValues.bind(crypto)}return H(ce)}const he=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Z={randomUUID:he};function de(t,e,i){var u;if(Z.randomUUID&&!e&&!t)return Z.randomUUID();t=t||{};const l=t.random??((u=t.rng)==null?void 0:u.call(t))??le();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,oe(l)}var $=function(){var t=a.__name(function(v,s,n,o){for(n=n||{},o=v.length;o--;n[v[o]]=s);return n},"o"),e=[1,4],i=[1,13],l=[1,12],u=[1,15],h=[1,16],p=[1,20],m=[1,19],E=[6,7,8],b=[1,26],y=[1,24],R=[1,25],N=[6,7,11],W=[1,6,13,15,16,19,22],X=[1,33],q=[1,34],w=[1,6,7,11,13,15,16,19,22],B={trace:a.__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:a.__name(function(s,n,o,c,g,r,A){var d=r.length-1;switch(g){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[d].id),c.addNode(r[d-1].length,r[d].id,r[d].descr,r[d].type);break;case 16:c.getLogger().trace("Icon: ",r[d]),c.decorateNode({icon:r[d]});break;case 17:case 21:c.decorateNode({class:r[d]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[d].id),c.addNode(0,r[d].id,r[d].descr,r[d].type);break;case 20:c.decorateNode({icon:r[d]});break;case 25:c.getLogger().trace("node found ..",r[d-2]),this.$={id:r[d-1],descr:r[d-1],type:c.getType(r[d-2],r[d])};break;case 26:this.$={id:r[d],descr:r[d],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[d-3]),this.$={id:r[d-3],descr:r[d-1],type:c.getType(r[d-2],r[d])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:i,7:[1,10],9:9,12:11,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:i,12:21,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},{6:i,9:22,12:11,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},{6:b,7:y,10:23,11:R},t(N,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:m}),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,23]),t(N,[2,24]),t(N,[2,26],{19:[1,30]}),{20:[1,31]},{6:b,7:y,10:32,11:R},{1:[2,7],6:i,12:21,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},t(W,[2,14],{7:X,11:q}),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),{20:[1,35]},{21:[1,36]},t(W,[2,13],{7:X,11:q}),t(w,[2,11]),t(w,[2,12]),{21:[1,37]},t(N,[2,25]),t(N,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:a.__name(function(s,n){if(n.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=n,o}},"parseError"),parse:a.__name(function(s){var n=this,o=[0],c=[],g=[null],r=[],A=this.table,d="",P=0,Y=0,te=2,Q=1,ne=r.slice.call(arguments,1),f=Object.create(this.lexer),T={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(T.yy[F]=this.yy[F]);f.setInput(s,T.yy),T.yy.lexer=f,T.yy.parser=this,typeof f.yylloc>"u"&&(f.yylloc={});var j=f.yylloc;r.push(j);var ie=f.options&&f.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function se(D){o.length=o.length-2*D,g.length=g.length-D,r.length=r.length-D}a.__name(se,"popStack");function J(){var D;return D=c.pop()||f.lex()||Q,typeof D!="number"&&(D instanceof Array&&(c=D,D=c.pop()),D=n.symbols_[D]||D),D}a.__name(J,"lex");for(var S,C,k,G,O={},M,L,K,V;;){if(C=o[o.length-1],this.defaultActions[C]?k=this.defaultActions[C]:((S===null||typeof S>"u")&&(S=J()),k=A[C]&&A[C][S]),typeof k>"u"||!k.length||!k[0]){var z="";V=[];for(M in A[C])this.terminals_[M]&&M>te&&V.push("'"+this.terminals_[M]+"'");f.showPosition?z="Parse error on line "+(P+1)+`:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("./chunk-55IACEB6-Ya_-e5Gj.cjs"),ae=require("./chunk-QN33PNHL-B65aZfT8.cjs"),a=require("./mermaid.core-Cop_RRH4.cjs"),_=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function oe(t,e=0){return(_[t[e+0]]+_[t[e+1]]+_[t[e+2]]+_[t[e+3]]+"-"+_[t[e+4]]+_[t[e+5]]+"-"+_[t[e+6]]+_[t[e+7]]+"-"+_[t[e+8]]+_[t[e+9]]+"-"+_[t[e+10]]+_[t[e+11]]+_[t[e+12]]+_[t[e+13]]+_[t[e+14]]+_[t[e+15]]).toLowerCase()}let H;const ce=new Uint8Array(16);function le(){if(!H){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");H=crypto.getRandomValues.bind(crypto)}return H(ce)}const he=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Z={randomUUID:he};function de(t,e,i){var u;if(Z.randomUUID&&!e&&!t)return Z.randomUUID();t=t||{};const l=t.random??((u=t.rng)==null?void 0:u.call(t))??le();if(l.length<16)throw new Error("Random bytes length must be >= 16");return l[6]=l[6]&15|64,l[8]=l[8]&63|128,oe(l)}var $=function(){var t=a.__name(function(v,s,n,o){for(n=n||{},o=v.length;o--;n[v[o]]=s);return n},"o"),e=[1,4],i=[1,13],l=[1,12],u=[1,15],h=[1,16],p=[1,20],m=[1,19],E=[6,7,8],b=[1,26],y=[1,24],R=[1,25],N=[6,7,11],W=[1,6,13,15,16,19,22],X=[1,33],q=[1,34],w=[1,6,7,11,13,15,16,19,22],B={trace:a.__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:a.__name(function(s,n,o,c,g,r,A){var d=r.length-1;switch(g){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[d].id),c.addNode(r[d-1].length,r[d].id,r[d].descr,r[d].type);break;case 16:c.getLogger().trace("Icon: ",r[d]),c.decorateNode({icon:r[d]});break;case 17:case 21:c.decorateNode({class:r[d]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[d].id),c.addNode(0,r[d].id,r[d].descr,r[d].type);break;case 20:c.decorateNode({icon:r[d]});break;case 25:c.getLogger().trace("node found ..",r[d-2]),this.$={id:r[d-1],descr:r[d-1],type:c.getType(r[d-2],r[d])};break;case 26:this.$={id:r[d],descr:r[d],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[d-3]),this.$={id:r[d-3],descr:r[d-1],type:c.getType(r[d-2],r[d])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:i,7:[1,10],9:9,12:11,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},t(E,[2,3]),{1:[2,2]},t(E,[2,4]),t(E,[2,5]),{1:[2,6],6:i,12:21,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},{6:i,9:22,12:11,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},{6:b,7:y,10:23,11:R},t(N,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:m}),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,23]),t(N,[2,24]),t(N,[2,26],{19:[1,30]}),{20:[1,31]},{6:b,7:y,10:32,11:R},{1:[2,7],6:i,12:21,13:l,14:14,15:u,16:h,17:17,18:18,19:p,22:m},t(W,[2,14],{7:X,11:q}),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),{20:[1,35]},{21:[1,36]},t(W,[2,13],{7:X,11:q}),t(w,[2,11]),t(w,[2,12]),{21:[1,37]},t(N,[2,25]),t(N,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:a.__name(function(s,n){if(n.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=n,o}},"parseError"),parse:a.__name(function(s){var n=this,o=[0],c=[],g=[null],r=[],A=this.table,d="",P=0,Y=0,te=2,Q=1,ne=r.slice.call(arguments,1),f=Object.create(this.lexer),T={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(T.yy[F]=this.yy[F]);f.setInput(s,T.yy),T.yy.lexer=f,T.yy.parser=this,typeof f.yylloc>"u"&&(f.yylloc={});var j=f.yylloc;r.push(j);var ie=f.options&&f.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function se(D){o.length=o.length-2*D,g.length=g.length-D,r.length=r.length-D}a.__name(se,"popStack");function J(){var D;return D=c.pop()||f.lex()||Q,typeof D!="number"&&(D instanceof Array&&(c=D,D=c.pop()),D=n.symbols_[D]||D),D}a.__name(J,"lex");for(var S,C,k,G,O={},M,L,K,V;;){if(C=o[o.length-1],this.defaultActions[C]?k=this.defaultActions[C]:((S===null||typeof S>"u")&&(S=J()),k=A[C]&&A[C][S]),typeof k>"u"||!k.length||!k[0]){var z="";V=[];for(M in A[C])this.terminals_[M]&&M>te&&V.push("'"+this.terminals_[M]+"'");f.showPosition?z="Parse error on line "+(P+1)+`:
2
2
  `+f.showPosition()+`
3
3
  Expecting `+V.join(", ")+", got '"+(this.terminals_[S]||S)+"'":z="Parse error on line "+(P+1)+": Unexpected "+(S==Q?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(z,{text:f.match,token:this.terminals_[S]||S,line:f.yylineno,loc:j,expected:V})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+S);switch(k[0]){case 1:o.push(S),g.push(f.yytext),r.push(f.yylloc),o.push(k[1]),S=null,Y=f.yyleng,d=f.yytext,P=f.yylineno,j=f.yylloc;break;case 2:if(L=this.productions_[k[1]][1],O.$=g[g.length-L],O._$={first_line:r[r.length-(L||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(L||1)].first_column,last_column:r[r.length-1].last_column},ie&&(O._$.range=[r[r.length-(L||1)].range[0],r[r.length-1].range[1]]),G=this.performAction.apply(O,[d,Y,P,T.yy,k[1],g,r].concat(ne)),typeof G<"u")return G;L&&(o=o.slice(0,-1*L*2),g=g.slice(0,-1*L),r=r.slice(0,-1*L)),o.push(this.productions_[k[1]][0]),g.push(O.$),r.push(O._$),K=A[o[o.length-2]][o[o.length-1]],o.push(K);break;case 3:return!0}}return!0},"parse")},ee=function(){var v={EOF:1,parseError:a.__name(function(n,o){if(this.yy.parser)this.yy.parser.parseError(n,o);else throw new Error(n)},"parseError"),setInput:a.__name(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a.__name(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:a.__name(function(s){var n=s.length,o=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var g=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===c.length?this.yylloc.first_column:0)+c[c.length-o.length].length-o[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[g[0],g[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:a.__name(function(){return this._more=!0,this},"more"),reject:a.__name(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a.__name(function(s){this.unput(this.match.slice(s))},"less"),pastInput:a.__name(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a.__name(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a.__name(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { i as h, j as u, L as w, B as p } from "./index-CSOKPmkj.js";
2
+ import { i as h, j as u, L as w, B as p } from "./index-C_34q9jG.js";
3
3
  import { useTranslation as f, useLanguages as P } from "@chaibuilder/sdk";
4
4
  import { Card as C, CardHeader as S, CardTitle as L, CardContent as x, CardFooter as N, Button as v } from "@chaibuilder/sdk/ui";
5
5
  import { get as B } from "lodash-es";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./index-D_4YaLhN.cjs"),i=require("@chaibuilder/sdk"),t=require("@chaibuilder/sdk/ui"),w=require("lodash-es"),x=require("lucide-react"),P=()=>{const{t:a}=i.useTranslation(),[l,g]=n.useSearchParams(),c=l.get("lang"),u=n.useIsLanguagePageCreated(c),{setSelectedLang:d}=i.useLanguages(),h=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),m=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",m),g(r),d(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(u)return null;const s=w.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(x.LockIcon,{className:"h-6 w-6 text-yellow-500"}),a("Page missing for"),' "',s,'" ',a("language"),"."]})}),e.jsx(t.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[a("Page is not available in the"),' "',s,'" ',a("language. Either create the page in the"),' "',s,'"',a("language or switch to the base language.")]})}),e.jsx(t.CardFooter,{children:e.jsx(t.Button,{onClick:h,className:"w-full",variant:"destructive",children:a("Switch to default language")})})]})})};exports.default=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("./index-C1bimRWu.cjs"),i=require("@chaibuilder/sdk"),t=require("@chaibuilder/sdk/ui"),w=require("lodash-es"),x=require("lucide-react"),P=()=>{const{t:a}=i.useTranslation(),[l,g]=n.useSearchParams(),c=l.get("lang"),u=n.useIsLanguagePageCreated(c),{setSelectedLang:d}=i.useLanguages(),h=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),m=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",m),g(r),d(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(u)return null;const s=w.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(x.LockIcon,{className:"h-6 w-6 text-yellow-500"}),a("Page missing for"),' "',s,'" ',a("language"),"."]})}),e.jsx(t.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[a("Page is not available in the"),' "',s,'" ',a("language. Either create the page in the"),' "',s,'"',a("language or switch to the base language.")]})}),e.jsx(t.CardFooter,{children:e.jsx(t.Button,{onClick:h,className:"w-full",variant:"destructive",children:a("Switch to default language")})})]})})};exports.default=P;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./mermaid-parser.core-Df9eyFSv.cjs");exports.PacketModule=e.PacketModule;exports.createPacketServices=e.createPacketServices;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./mermaid-parser.core-DKJdj2_U.cjs");exports.PacketModule=e.PacketModule;exports.createPacketServices=e.createPacketServices;
@@ -1,4 +1,4 @@
1
- import { P as c, a as r } from "./mermaid-parser.core-Crve7Cv1.js";
1
+ import { P as c, a as r } from "./mermaid-parser.core-GitSl6co.js";
2
2
  export {
3
3
  c as PacketModule,
4
4
  r as createPacketServices
@@ -1,11 +1,11 @@
1
1
  import { jsx as s, jsxs as n, Fragment as We } from "react/jsx-runtime";
2
2
  import { Input as M, CommandList as is, Label as I, Popover as ee, PopoverTrigger as se, Button as W, PopoverContent as le, Command as ne, CommandEmpty as ae, CommandGroup as G, CommandItem as R } from "@chaibuilder/sdk/ui";
3
3
  import { useState as y, useRef as os, useEffect as Be, useMemo as $ } from "react";
4
- import { r as te, S as cs, c as Oe } from "./slug-input-DPMG1pMZ.js";
4
+ import { r as te, S as cs, c as Oe } from "./slug-input-CjagPxIn.js";
5
5
  import { useChaiFeatureFlag as ye, usePermissions as us, useLanguages as ms } from "@chaibuilder/sdk";
6
6
  import { isEmpty as Ie, startCase as de, filter as hs, find as ge, groupBy as ps, pick as ds, set as P } from "lodash-es";
7
7
  import { ChevronDown as re, Search as ie, Check as U } from "lucide-react";
8
- import { al as Re, am as Ue, A as oe, h as fs, an as gs, b as ys, c as vs, d as Ns, as as bs, L as Ss } from "./index-CSOKPmkj.js";
8
+ import { al as Re, am as Ue, A as oe, h as fs, an as gs, b as ys, c as vs, d as Ns, as as bs, L as Ss } from "./index-C_34q9jG.js";
9
9
  import { useQuery as ze } from "@tanstack/react-query";
10
10
  import { toast as E } from "sonner";
11
11
  import { g as $e } from "./get-seo-defaults-9zHebckY.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("@chaibuilder/sdk/ui"),i=require("react"),$=require("./slug-input-CPHwulQv.cjs"),Y=require("@chaibuilder/sdk"),b=require("lodash-es"),C=require("lucide-react"),w=require("./index-D_4YaLhN.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:o}){const[f,m]=i.useState(null),h=i.useRef(null),[g,L]=i.useState(p+t);i.useEffect(()=>{L(p+t)},[t,p]);const B=v=>{const S=v.target.value;if(!S.startsWith(p)){const O=S.replace(p,""),R=p+O;L(R),c(O);return}const l=S.substring(p.length).replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),a=(l.match(/\./g)||[]).length,x=a<=1;a>1?m("Invalid slug. Only one dot (.) is allowed in the slug"):m(null),o&&o(x);const y=p+l;L(y),c(l)},N=()=>{if(h.current){const v=h.current;setTimeout(()=>{const S=p.length;v.setSelectionRange(S,S)},0)}},W=v=>{const S=v.currentTarget;(S.selectionStart||0)<=p.length&&setTimeout(()=>{const l=p.length;S.setSelectionRange(l,l)},0)};return e.jsx("div",{children:e.jsxs("div",{className:"relative",children:[e.jsxs("p",{className:"text-gray-500 text-xs mb-2",children:[`${p}`," is a dynamic segment of slug"]}),e.jsx(n.Input,{ref:h,value:g,onChange:B,onFocus:N,onClick:W,placeholder:j,className:f?"border-red-500":""}),f&&e.jsx("div",{className:"text-red-500 text-xs mt-1",children:f})]})})}const X=({children:t,onWheel:c,...j})=>{const p=o=>{try{o.preventDefault();const f=o.currentTarget;f.scrollTop+=o.deltaY}catch{o.preventDefault()}c&&c(o)};return e.jsx(n.CommandList,{...j,onWheel:p,children:t})},te=(...t)=>t.filter(Boolean).join(" ");function $e({pages:t,selectedParentId:c,onChange:j,className:p,id:o="parentPage",currentPage:f}){const[m,h]=i.useState(!1),[g,L]=i.useState(""),B=Y.useChaiFeatureFlag("enable-add-page-dropdown");B||(p="w-full rounded-md border border-gray-300 px-3 py-2");const N=i.useMemo(()=>!t||t.length===0?[]:t.filter(x=>!b.isEmpty(x.slug)).filter(x=>x.slug!=="/").sort((x,y)=>x.slug.localeCompare(y.slug)),[t]),W=i.useMemo(()=>{if(!g.trim())return N;const a=g.toLowerCase();return N.filter(x=>x.name.toLowerCase().includes(a)||x.slug.toLowerCase().includes(a))},[N,g]),v=a=>Math.max(0,(a.match(/\//g)||[]).length-1),S=a=>"    ".repeat(a),d=a=>{if(a==="/")return"/";const x=a.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 a=N.find(x=>x.id===c);return a?`${a.name} (${d(a.slug)})`:"None"};return e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:o,className:"text-sm",children:"Parent"}),B?e.jsxs(n.Popover,{open:m,onOpenChange:h,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{id:o,variant:"outline",role:"combobox",className:te("w-full justify-between",p),"data-testid":"parent-page-selector",children:[l(),e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search pages...",className:"h-8 pl-8 text-xs",value:g,onChange:a=>L(a.target.value)})]})})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No pages found."}),e.jsxs(n.CommandGroup,{children:[e.jsxs(n.CommandItem,{value:"none",onSelect:()=>{j(""),h(!1),L("")},className:"flex cursor-pointer items-center justify-between",children:[e.jsx("span",{children:"None"}),e.jsx(C.Check,{className:te("mr-2 h-4 w-4",c?"opacity-0":"opacity-100")})]}),W.map(a=>{const x=S(v(a.slug)),y=d(a.slug),O=e.jsxs("span",{className:"flex items-center text-sm",children:[x,a.name,e.jsxs("span",{className:"text-xs text-gray-500",children:[" (",y,")"]})]});return e.jsxs(n.CommandItem,{value:a.id,onSelect:()=>{j(a.id),h(!1),L("")},className:"flex cursor-pointer items-center justify-between whitespace-pre-wrap",children:[e.jsx("span",{children:O}),e.jsx(C.Check,{className:te("mr-2 h-4 w-4 shrink-0",c===a.id?"opacity-100":"opacity-0")})]},a.id)})]})]})]})})]}):e.jsxs("select",{id:o,value:c||"none",onChange:a=>j(a.target.value),className:p,"data-testid":"parent-page-selector",children:[e.jsx("option",{value:"none",children:"None"}),N.map(a=>{const x=v(a.slug),y=x>0?S(x):"",O=d(a.slug);return(f==null?void 0:f.id)===a.id||a.slug.startsWith(f==null?void 0:f.slug)?null:e.jsxs("option",{value:a.id,children:[y,a.name," (",O,")"]},a.id)})]})]})}const _e=(...t)=>t.filter(Boolean).join(" "),ze=({templates:t,selectedTemplateId:c,onSelectTemplate:j,isLoading:p=!1})=>{const[o,f]=i.useState(""),[m,h]=i.useState(!1),[g,L]=i.useState(""),B=Y.useChaiFeatureFlag("enable-add-page-dropdown");if(i.useEffect(()=>{if(c){const d=t.find(l=>l.id===c);f((d==null?void 0:d.preview)||"")}else 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 N={};t.forEach(d=>{const l=d.libraryName;N[l]||(N[l]=[]),N[l].push(d)});const W=Object.entries(N).reduce((d,[l,a])=>{const x=a.filter(y=>y.name.toLowerCase().includes(g.toLowerCase())||l.toLowerCase().includes(g.toLowerCase()));return x.length>0&&(d[l]=x),d},{}),v=t.find(d=>d.id===c),S=v?b.startCase(v.name):"No Template";return e.jsxs("div",{className:"space-y-4",children:[B?e.jsxs(n.Popover,{open:m,onOpenChange:h,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"outline",role:"combobox",className:"w-full justify-between",children:[S,e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search templates...",className:"h-8 pl-8 text-xs",value:g,onChange:d=>L(d.target.value)})]})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No templates found."}),Object.entries(W).map(([d,l])=>e.jsx(n.CommandGroup,{heading:d,children:l.map(a=>e.jsxs(n.CommandItem,{value:a.id,onSelect:()=>{j(a.id),h(!1),L("")},className:"flex cursor-pointer items-center justify-between",children:[b.startCase(a.name),e.jsx(C.Check,{className:_e("mr-2 h-4 w-4",c===a.id?"opacity-100":"opacity-0")})]},a.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(N).map(([d,l])=>e.jsx("optgroup",{label:d,children:l.map(a=>e.jsx("option",{value:a.id,children:b.startCase(a.name)},a.id))},d))]}),o&&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:o,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"})]})]})},Ve=()=>{const t=w.useApiUrl(),c=w.useFetch();return je.useQuery({queryKey:[w.ACTIONS.GET_LIBRARIES],staleTime:"static",queryFn:async()=>await c(t,{action:w.ACTIONS.GET_LIBRARIES})||[]})},Qe=t=>{const c=w.useApiUrl(),j=w.useFetch();return je.useQuery({queryKey:[w.ACTIONS.GET_TEMPLATES_BY_TYPE,t],staleTime:"static",enabled:!!t,queryFn:async()=>{const p=await j(c,{action:w.ACTIONS.GET_TEMPLATES_BY_TYPE,data:{pageType:t}});return(t?b.filter(p,{pageType:t}):p)||[]}})},Ye=t=>{const{data:c=[],isLoading:j}=Qe(t),{data:p=[],isLoading:o}=Ve(),f=i.useMemo(()=>j||o?[]:c.map(h=>{const g=b.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,o]),m=i.useMemo(()=>b.groupBy(f,"libraryName"),[f]);return{data:f,groupedData:m,isLoading:j||o}},U=(...t)=>t.filter(Boolean).join(" ");function He({addEditPage:t,close:c,closePanel:j}){var xe,ge;const{data:p}=w.usePageTypes(),o=i.useMemo(()=>p??[],[p]),f=w.useChangePage(),m=!!(t!=null&&t.id),{data:h}=w.useWebsitePages(),{mutate:g,isPending:L}=w.useCreatePage(),{mutate:B,isPending:N}=w.useUpdatePage(),[W,v]=i.useState(null),[S,d]=i.useState(!0),[l,a]=i.useState((t==null?void 0:t.pageType)??"page"),{hasPermission:x}=Y.usePermissions(),y=x(w.PAGES_PERMISSIONS.CHANGE_PAGE_TYPE),[O,R]=i.useState(!1),[ye,ve]=i.useState(""),{selectedLang:Se,fallbackLang:Ce}=Y.useLanguages(),ne=Se||Ce,[_,H]=i.useState(""),[ae,V]=i.useState(!1),le=i.useMemo(()=>{const s=o.find(u=>u.key===l);return(s==null?void 0:s.hasSlug)===!1},[l,o]),[T,Ne]=i.useState((t==null?void 0:t.parent)??""),[G,re]=i.useState((t==null?void 0:t.name)??""),[I,oe]=i.useState((t==null?void 0:t.dynamic)??!1),[F,Q]=i.useState(I?"":((t==null?void 0:t.slug)??"").split("/").pop()||""),[ie,ce]=i.useState((t==null?void 0:t.dynamicSlugCustom)??""),[ue,be]=i.useState(!0),[we,P]=i.useState(!1),[E,ke]=i.useState(""),{data:me,isLoading:Le}=Ye(l),z=L||N,he=Y.useChaiFeatureFlag("enable-add-page-dropdown"),ee=i.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=i.useMemo(()=>!m||!(t!=null&&t.id)||!h?!1:h.some(s=>s.parent===t.id),[m,t==null?void 0:t.id,h]),r=o.find(s=>s.key===l),M=s=>{if(m&&l!==s){ve(s),R(!0),H(""),V(!1);return}a(s),H(""),V(!1)},pe=()=>{a(ye),R(!1),oe(!1)},Ie=s=>{oe(s),s?Q(""):ce("")},Fe=s=>{if(Ne(s),s&&s!=="none"){const u=h==null?void 0:h.find(k=>k.id===s),q=(u==null?void 0:u.slug)||"";if(F.startsWith(q)){const k=F.slice(q.length).replace(/^\/+/,"");Q(k)}else Q(F.replace(/^\/+/,""))}else Q(F?`${F}`:"")},qe=s=>{ke(s)},Ae=()=>G.trim()?I&&!b.isEmpty(F)?(v("Slug must be empty when using dynamic slug"),!1):I&&!ue?(v("Dynamic slug is invalid"),!1):!0:(J.toast.error("Name is required"),!1),Be=()=>{const s={pageType:r==null?void 0:r.key,name:G,slug:"",hasSlug:!1};m?B({id:t==null?void 0:t.id,name:G},{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()&&!I)return v("Child page slug is required"),!1;const q=$.removeSlugExtension(u),k=$.combineParentChildSlugs(q,s);return Object.keys(w.LANGUAGES).some(Z=>k===`/${Z}`||(k==null?void 0:k.startsWith(`/${Z}/`)))?(v("Slugs cannot start with a language code for primary page"),!1):!0},We=(s,u)=>{const q=$.removeSlugExtension(u),k=$.combineParentChildSlugs(q,s),D={pageType:l,name:G,slug:k.replace(/\/$/,""),parent:T,dynamic:I,hasSlug:!0,template:E||void 0,tracking:{},seo:{},jsonLD:{}};if(I&&(D.dynamicSlugCustom=ie),m){const A=b.pick(D,["pageType","parent","name","slug","dynamic","dynamicSlugCustom"]);B({id:t==null?void 0:t.id,...A},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}})}else{const A=b.find(o,{key:l});A!=null&&A.trackingDefault&&(D.tracking=A.trackingDefault);const{seo:Z,jsonLD:Ge}=fe.getSeoDefaults(A,ne);b.set(D,"seo",Z),b.set(D,"jsonLD",Ge),g(D,{onSuccess:Me=>{c(),f(Me.page.id,j)}})}},Re=()=>{const s={pageType:l,name:G,slug:F===""?"/":`/${F.replace(/\/$/,"")}`,template:E||void 0,parent:null,tracking:{}};if(m)B({id:t==null?void 0:t.id,...s},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}});else{const u=b.find(o,{key:l});u!=null&&u.trackingDefault&&(s.tracking=u.trackingDefault);const{seo:q,jsonLD:k}=fe.getSeoDefaults(u,ne);b.set(s,"seo",q),b.set(s,"jsonLD",k),g(s,{onSuccess:D=>{var A;(A=D==null?void 0:D.page)!=null&&A.id&&f(D.page.id,j),c()}})}},de=s=>{if(s.preventDefault(),v(null),!!Ae()){if(!(r!=null&&r.hasSlug)){Be();return}if(T&&T!=="none"){const u=h==null?void 0:h.find(k=>k.id===T),q=(u==null?void 0:u.slug)||"";if(!Oe(F,q))return;We(F,q)}else Re()}},{pagesType:se,partialsType:K}=i.useMemo(()=>{const s=u=>_?u.name.toLowerCase().includes(_.toLowerCase())||u.key.toLowerCase().includes(_.toLowerCase()):!0;return{pagesType:o.filter(u=>u.hasSlug!==!1&&s(u)),partialsType:o.filter(u=>u.hasSlug===!1&&s(u))}},[o,_]);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(n.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(n.Popover,{open:ae,onOpenChange:V,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:U("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:_,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No page type found."}),m?le?e.jsx(n.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}):e.jsx(n.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("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(n.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}),K.length>0&&e.jsx(n.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("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=>M(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:o.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}):e.jsx("optgroup",{label:"Pages",children:o.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:o.filter(s=>s.hasSlug!==!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}),e.jsx("optgroup",{label:"Partials",children:o.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})]})}),O&&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(n.Button,{variant:"outline",size:"sm",onClick:()=>R(!1),children:"Cancel"}),e.jsx(n.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(n.Label,{className:"mb-1 block text-sm",children:"Template"}),e.jsx(ze,{templates:me,selectedTemplateId:E,onSelectTemplate:qe,isLoading:Le})]}),e.jsx($e,{pages:h,selectedParentId:T,onChange:Fe,currentPage:t}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(n.Input,{id:"name",value:G,onChange:s=>re(s.target.value),required:!0,"aria-required":"true",placeholder:"Enter page name"})]}),(r==null?void 0:r.dynamicSegments)&&T&&T!=="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:I,onChange:s=>Ie(s.target.checked),className:"rounded border-gray-300"}),e.jsx(n.Label,{htmlFor:"useDynamicSlug",className:"text-sm",children:"Use Dynamic Slug"})]}),I&&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)||!I)&&e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:"slug",className:"text-sm",children:"Slug"}),e.jsx($.SlugInput,{value:F,onChange:s=>{var u;Q(s),m&&s!==(((u=t==null?void 0:t.slug)==null?void 0:u.split("/").pop())||"")?P(!!(Te||De)):P(!1)},placeholder:T&&T!=="none"?"Enter page slug":l==="page"?"Leave empty for home page":"Required - e.g. your-slug",parentSlug:T&&T!=="none"?(ge=h==null?void 0:h.find(s=>s.id===T))==null?void 0:ge.slug:void 0,onValidationChange:d}),W&&e.jsx("p",{className:"text-xs text-red-500",children:W}),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(n.Button,{disabled:z||!S&&(!(r!=null&&r.dynamicSegments)||!I)||I&&!ue,type:"submit",className:"w-full",children:m?z?"Updating...":"Update page":z?"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(n.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(n.Popover,{open:ae,onOpenChange:V,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:U("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:_,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"max-h-[200px] overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No page type found."}),e.jsx(n.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>{M(s.key),V(!1)},className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("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=>M(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:o.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})}),O&&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(n.Button,{variant:"outline",size:"sm",onClick:()=>R(!1),children:"Cancel"}),e.jsx(n.Button,{variant:"default",size:"sm",onClick:pe,children:"Confirm"})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:(xe=o.find(s=>s.key===l))==null?void 0:xe.helpText})]}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(n.Input,{id:"name",value:G,onChange:s=>re(s.target.value),required:!0,"aria-required":"true"})]}),e.jsx(n.Button,{disabled:z,type:"submit",className:"w-full",children:m?z?"Updating...":"Update "+(r==null?void 0:r.name):z?"Creating...":"Create "+(r==null?void 0:r.name)})]})}exports.default=He;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("@chaibuilder/sdk/ui"),i=require("react"),$=require("./slug-input-CsniBgYf.cjs"),Y=require("@chaibuilder/sdk"),b=require("lodash-es"),C=require("lucide-react"),w=require("./index-C1bimRWu.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:o}){const[f,m]=i.useState(null),h=i.useRef(null),[g,L]=i.useState(p+t);i.useEffect(()=>{L(p+t)},[t,p]);const B=v=>{const S=v.target.value;if(!S.startsWith(p)){const O=S.replace(p,""),R=p+O;L(R),c(O);return}const l=S.substring(p.length).replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),a=(l.match(/\./g)||[]).length,x=a<=1;a>1?m("Invalid slug. Only one dot (.) is allowed in the slug"):m(null),o&&o(x);const y=p+l;L(y),c(l)},N=()=>{if(h.current){const v=h.current;setTimeout(()=>{const S=p.length;v.setSelectionRange(S,S)},0)}},W=v=>{const S=v.currentTarget;(S.selectionStart||0)<=p.length&&setTimeout(()=>{const l=p.length;S.setSelectionRange(l,l)},0)};return e.jsx("div",{children:e.jsxs("div",{className:"relative",children:[e.jsxs("p",{className:"text-gray-500 text-xs mb-2",children:[`${p}`," is a dynamic segment of slug"]}),e.jsx(n.Input,{ref:h,value:g,onChange:B,onFocus:N,onClick:W,placeholder:j,className:f?"border-red-500":""}),f&&e.jsx("div",{className:"text-red-500 text-xs mt-1",children:f})]})})}const X=({children:t,onWheel:c,...j})=>{const p=o=>{try{o.preventDefault();const f=o.currentTarget;f.scrollTop+=o.deltaY}catch{o.preventDefault()}c&&c(o)};return e.jsx(n.CommandList,{...j,onWheel:p,children:t})},te=(...t)=>t.filter(Boolean).join(" ");function $e({pages:t,selectedParentId:c,onChange:j,className:p,id:o="parentPage",currentPage:f}){const[m,h]=i.useState(!1),[g,L]=i.useState(""),B=Y.useChaiFeatureFlag("enable-add-page-dropdown");B||(p="w-full rounded-md border border-gray-300 px-3 py-2");const N=i.useMemo(()=>!t||t.length===0?[]:t.filter(x=>!b.isEmpty(x.slug)).filter(x=>x.slug!=="/").sort((x,y)=>x.slug.localeCompare(y.slug)),[t]),W=i.useMemo(()=>{if(!g.trim())return N;const a=g.toLowerCase();return N.filter(x=>x.name.toLowerCase().includes(a)||x.slug.toLowerCase().includes(a))},[N,g]),v=a=>Math.max(0,(a.match(/\//g)||[]).length-1),S=a=>"    ".repeat(a),d=a=>{if(a==="/")return"/";const x=a.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 a=N.find(x=>x.id===c);return a?`${a.name} (${d(a.slug)})`:"None"};return e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:o,className:"text-sm",children:"Parent"}),B?e.jsxs(n.Popover,{open:m,onOpenChange:h,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{id:o,variant:"outline",role:"combobox",className:te("w-full justify-between",p),"data-testid":"parent-page-selector",children:[l(),e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search pages...",className:"h-8 pl-8 text-xs",value:g,onChange:a=>L(a.target.value)})]})})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No pages found."}),e.jsxs(n.CommandGroup,{children:[e.jsxs(n.CommandItem,{value:"none",onSelect:()=>{j(""),h(!1),L("")},className:"flex cursor-pointer items-center justify-between",children:[e.jsx("span",{children:"None"}),e.jsx(C.Check,{className:te("mr-2 h-4 w-4",c?"opacity-0":"opacity-100")})]}),W.map(a=>{const x=S(v(a.slug)),y=d(a.slug),O=e.jsxs("span",{className:"flex items-center text-sm",children:[x,a.name,e.jsxs("span",{className:"text-xs text-gray-500",children:[" (",y,")"]})]});return e.jsxs(n.CommandItem,{value:a.id,onSelect:()=>{j(a.id),h(!1),L("")},className:"flex cursor-pointer items-center justify-between whitespace-pre-wrap",children:[e.jsx("span",{children:O}),e.jsx(C.Check,{className:te("mr-2 h-4 w-4 shrink-0",c===a.id?"opacity-100":"opacity-0")})]},a.id)})]})]})]})})]}):e.jsxs("select",{id:o,value:c||"none",onChange:a=>j(a.target.value),className:p,"data-testid":"parent-page-selector",children:[e.jsx("option",{value:"none",children:"None"}),N.map(a=>{const x=v(a.slug),y=x>0?S(x):"",O=d(a.slug);return(f==null?void 0:f.id)===a.id||a.slug.startsWith(f==null?void 0:f.slug)?null:e.jsxs("option",{value:a.id,children:[y,a.name," (",O,")"]},a.id)})]})]})}const _e=(...t)=>t.filter(Boolean).join(" "),ze=({templates:t,selectedTemplateId:c,onSelectTemplate:j,isLoading:p=!1})=>{const[o,f]=i.useState(""),[m,h]=i.useState(!1),[g,L]=i.useState(""),B=Y.useChaiFeatureFlag("enable-add-page-dropdown");if(i.useEffect(()=>{if(c){const d=t.find(l=>l.id===c);f((d==null?void 0:d.preview)||"")}else 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 N={};t.forEach(d=>{const l=d.libraryName;N[l]||(N[l]=[]),N[l].push(d)});const W=Object.entries(N).reduce((d,[l,a])=>{const x=a.filter(y=>y.name.toLowerCase().includes(g.toLowerCase())||l.toLowerCase().includes(g.toLowerCase()));return x.length>0&&(d[l]=x),d},{}),v=t.find(d=>d.id===c),S=v?b.startCase(v.name):"No Template";return e.jsxs("div",{className:"space-y-4",children:[B?e.jsxs(n.Popover,{open:m,onOpenChange:h,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"outline",role:"combobox",className:"w-full justify-between",children:[S,e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search templates...",className:"h-8 pl-8 text-xs",value:g,onChange:d=>L(d.target.value)})]})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No templates found."}),Object.entries(W).map(([d,l])=>e.jsx(n.CommandGroup,{heading:d,children:l.map(a=>e.jsxs(n.CommandItem,{value:a.id,onSelect:()=>{j(a.id),h(!1),L("")},className:"flex cursor-pointer items-center justify-between",children:[b.startCase(a.name),e.jsx(C.Check,{className:_e("mr-2 h-4 w-4",c===a.id?"opacity-100":"opacity-0")})]},a.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(N).map(([d,l])=>e.jsx("optgroup",{label:d,children:l.map(a=>e.jsx("option",{value:a.id,children:b.startCase(a.name)},a.id))},d))]}),o&&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:o,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"})]})]})},Ve=()=>{const t=w.useApiUrl(),c=w.useFetch();return je.useQuery({queryKey:[w.ACTIONS.GET_LIBRARIES],staleTime:"static",queryFn:async()=>await c(t,{action:w.ACTIONS.GET_LIBRARIES})||[]})},Qe=t=>{const c=w.useApiUrl(),j=w.useFetch();return je.useQuery({queryKey:[w.ACTIONS.GET_TEMPLATES_BY_TYPE,t],staleTime:"static",enabled:!!t,queryFn:async()=>{const p=await j(c,{action:w.ACTIONS.GET_TEMPLATES_BY_TYPE,data:{pageType:t}});return(t?b.filter(p,{pageType:t}):p)||[]}})},Ye=t=>{const{data:c=[],isLoading:j}=Qe(t),{data:p=[],isLoading:o}=Ve(),f=i.useMemo(()=>j||o?[]:c.map(h=>{const g=b.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,o]),m=i.useMemo(()=>b.groupBy(f,"libraryName"),[f]);return{data:f,groupedData:m,isLoading:j||o}},U=(...t)=>t.filter(Boolean).join(" ");function He({addEditPage:t,close:c,closePanel:j}){var xe,ge;const{data:p}=w.usePageTypes(),o=i.useMemo(()=>p??[],[p]),f=w.useChangePage(),m=!!(t!=null&&t.id),{data:h}=w.useWebsitePages(),{mutate:g,isPending:L}=w.useCreatePage(),{mutate:B,isPending:N}=w.useUpdatePage(),[W,v]=i.useState(null),[S,d]=i.useState(!0),[l,a]=i.useState((t==null?void 0:t.pageType)??"page"),{hasPermission:x}=Y.usePermissions(),y=x(w.PAGES_PERMISSIONS.CHANGE_PAGE_TYPE),[O,R]=i.useState(!1),[ye,ve]=i.useState(""),{selectedLang:Se,fallbackLang:Ce}=Y.useLanguages(),ne=Se||Ce,[_,H]=i.useState(""),[ae,V]=i.useState(!1),le=i.useMemo(()=>{const s=o.find(u=>u.key===l);return(s==null?void 0:s.hasSlug)===!1},[l,o]),[T,Ne]=i.useState((t==null?void 0:t.parent)??""),[G,re]=i.useState((t==null?void 0:t.name)??""),[I,oe]=i.useState((t==null?void 0:t.dynamic)??!1),[F,Q]=i.useState(I?"":((t==null?void 0:t.slug)??"").split("/").pop()||""),[ie,ce]=i.useState((t==null?void 0:t.dynamicSlugCustom)??""),[ue,be]=i.useState(!0),[we,P]=i.useState(!1),[E,ke]=i.useState(""),{data:me,isLoading:Le}=Ye(l),z=L||N,he=Y.useChaiFeatureFlag("enable-add-page-dropdown"),ee=i.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=i.useMemo(()=>!m||!(t!=null&&t.id)||!h?!1:h.some(s=>s.parent===t.id),[m,t==null?void 0:t.id,h]),r=o.find(s=>s.key===l),M=s=>{if(m&&l!==s){ve(s),R(!0),H(""),V(!1);return}a(s),H(""),V(!1)},pe=()=>{a(ye),R(!1),oe(!1)},Ie=s=>{oe(s),s?Q(""):ce("")},Fe=s=>{if(Ne(s),s&&s!=="none"){const u=h==null?void 0:h.find(k=>k.id===s),q=(u==null?void 0:u.slug)||"";if(F.startsWith(q)){const k=F.slice(q.length).replace(/^\/+/,"");Q(k)}else Q(F.replace(/^\/+/,""))}else Q(F?`${F}`:"")},qe=s=>{ke(s)},Ae=()=>G.trim()?I&&!b.isEmpty(F)?(v("Slug must be empty when using dynamic slug"),!1):I&&!ue?(v("Dynamic slug is invalid"),!1):!0:(J.toast.error("Name is required"),!1),Be=()=>{const s={pageType:r==null?void 0:r.key,name:G,slug:"",hasSlug:!1};m?B({id:t==null?void 0:t.id,name:G},{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()&&!I)return v("Child page slug is required"),!1;const q=$.removeSlugExtension(u),k=$.combineParentChildSlugs(q,s);return Object.keys(w.LANGUAGES).some(Z=>k===`/${Z}`||(k==null?void 0:k.startsWith(`/${Z}/`)))?(v("Slugs cannot start with a language code for primary page"),!1):!0},We=(s,u)=>{const q=$.removeSlugExtension(u),k=$.combineParentChildSlugs(q,s),D={pageType:l,name:G,slug:k.replace(/\/$/,""),parent:T,dynamic:I,hasSlug:!0,template:E||void 0,tracking:{},seo:{},jsonLD:{}};if(I&&(D.dynamicSlugCustom=ie),m){const A=b.pick(D,["pageType","parent","name","slug","dynamic","dynamicSlugCustom"]);B({id:t==null?void 0:t.id,...A},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}})}else{const A=b.find(o,{key:l});A!=null&&A.trackingDefault&&(D.tracking=A.trackingDefault);const{seo:Z,jsonLD:Ge}=fe.getSeoDefaults(A,ne);b.set(D,"seo",Z),b.set(D,"jsonLD",Ge),g(D,{onSuccess:Me=>{c(),f(Me.page.id,j)}})}},Re=()=>{const s={pageType:l,name:G,slug:F===""?"/":`/${F.replace(/\/$/,"")}`,template:E||void 0,parent:null,tracking:{}};if(m)B({id:t==null?void 0:t.id,...s},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}});else{const u=b.find(o,{key:l});u!=null&&u.trackingDefault&&(s.tracking=u.trackingDefault);const{seo:q,jsonLD:k}=fe.getSeoDefaults(u,ne);b.set(s,"seo",q),b.set(s,"jsonLD",k),g(s,{onSuccess:D=>{var A;(A=D==null?void 0:D.page)!=null&&A.id&&f(D.page.id,j),c()}})}},de=s=>{if(s.preventDefault(),v(null),!!Ae()){if(!(r!=null&&r.hasSlug)){Be();return}if(T&&T!=="none"){const u=h==null?void 0:h.find(k=>k.id===T),q=(u==null?void 0:u.slug)||"";if(!Oe(F,q))return;We(F,q)}else Re()}},{pagesType:se,partialsType:K}=i.useMemo(()=>{const s=u=>_?u.name.toLowerCase().includes(_.toLowerCase())||u.key.toLowerCase().includes(_.toLowerCase()):!0;return{pagesType:o.filter(u=>u.hasSlug!==!1&&s(u)),partialsType:o.filter(u=>u.hasSlug===!1&&s(u))}},[o,_]);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(n.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(n.Popover,{open:ae,onOpenChange:V,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:U("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:_,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No page type found."}),m?le?e.jsx(n.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}):e.jsx(n.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("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(n.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}),K.length>0&&e.jsx(n.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>M(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("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=>M(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:o.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}):e.jsx("optgroup",{label:"Pages",children:o.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:o.filter(s=>s.hasSlug!==!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}),e.jsx("optgroup",{label:"Partials",children:o.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})]})}),O&&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(n.Button,{variant:"outline",size:"sm",onClick:()=>R(!1),children:"Cancel"}),e.jsx(n.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(n.Label,{className:"mb-1 block text-sm",children:"Template"}),e.jsx(ze,{templates:me,selectedTemplateId:E,onSelectTemplate:qe,isLoading:Le})]}),e.jsx($e,{pages:h,selectedParentId:T,onChange:Fe,currentPage:t}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(n.Input,{id:"name",value:G,onChange:s=>re(s.target.value),required:!0,"aria-required":"true",placeholder:"Enter page name"})]}),(r==null?void 0:r.dynamicSegments)&&T&&T!=="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:I,onChange:s=>Ie(s.target.checked),className:"rounded border-gray-300"}),e.jsx(n.Label,{htmlFor:"useDynamicSlug",className:"text-sm",children:"Use Dynamic Slug"})]}),I&&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)||!I)&&e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:"slug",className:"text-sm",children:"Slug"}),e.jsx($.SlugInput,{value:F,onChange:s=>{var u;Q(s),m&&s!==(((u=t==null?void 0:t.slug)==null?void 0:u.split("/").pop())||"")?P(!!(Te||De)):P(!1)},placeholder:T&&T!=="none"?"Enter page slug":l==="page"?"Leave empty for home page":"Required - e.g. your-slug",parentSlug:T&&T!=="none"?(ge=h==null?void 0:h.find(s=>s.id===T))==null?void 0:ge.slug:void 0,onValidationChange:d}),W&&e.jsx("p",{className:"text-xs text-red-500",children:W}),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(n.Button,{disabled:z||!S&&(!(r!=null&&r.dynamicSegments)||!I)||I&&!ue,type:"submit",className:"w-full",children:m?z?"Updating...":"Update page":z?"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(n.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(n.Popover,{open:ae,onOpenChange:V,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:U("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(C.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(n.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(n.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(C.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(n.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:_,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"max-h-[200px] overflow-y-auto",children:[e.jsx(n.CommandEmpty,{children:"No page type found."}),e.jsx(n.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(n.CommandItem,{value:s.key,onSelect:()=>{M(s.key),V(!1)},className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(C.Check,{className:U("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=>M(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:o.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})}),O&&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(n.Button,{variant:"outline",size:"sm",onClick:()=>R(!1),children:"Cancel"}),e.jsx(n.Button,{variant:"default",size:"sm",onClick:pe,children:"Confirm"})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:(xe=o.find(s=>s.key===l))==null?void 0:xe.helpText})]}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(n.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(n.Input,{id:"name",value:G,onChange:s=>re(s.target.value),required:!0,"aria-required":"true"})]}),e.jsx(n.Button,{disabled:z,type:"submit",className:"w-full",children:m?z?"Updating...":"Update "+(r==null?void 0:r.name):z?"Creating...":"Create "+(r==null?void 0:r.name)})]})}exports.default=He;
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as r, Fragment as o } from "react/jsx-runtime";
2
- import { aj as w, ak as T, B as m } from "./index-CSOKPmkj.js";
2
+ import { aj as w, ak as T, B as m } from "./index-C_34q9jG.js";
3
3
  import { useTranslation as x } from "@chaibuilder/sdk";
4
4
  import { Card as b, CardHeader as v, CardTitle as y, CardContent as B, CardFooter as q, Button as u } from "@chaibuilder/sdk/ui";
5
5
  import { Loader as f, TableIcon as _, CheckCircle as j, Target as A, Edit as g, Check as I, X as O } from "lucide-react";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./index-D_4YaLhN.cjs"),C=require("@chaibuilder/sdk"),i=require("@chaibuilder/sdk/ui"),n=require("lucide-react"),x=require("react"),N=({userId:d})=>{const{data:r}=l.useChaiUserInfo(d);return(r==null?void 0:r.name)||"Unknown"},f=({isChecking:d,lockingStatus:r,onContinue:j})=>{const{t:s}=C.useTranslation(),[u,h]=x.useState(!1),c=r==="page_is_active_in_other_tab",a=(r==null?void 0:r.length)>0,{pageLock:t,acceptTakeOver:o,rejectTakeOver:m}=l.usePageLockRequestTakeOver(),g=()=>{h(!0),a||c?j():o(),setTimeout(()=>{h(!1)},3e3)};return x.useEffect(()=>{(t==null?void 0:t.requestedBy)==="ANOTHER_TAB"&&o()},[t,o]),(t==null?void 0:t.requestedBy)==="ANOTHER_TAB"?null:d?e.jsx(l.BlurContainer,{children:e.jsx(n.Loader,{className:"h-5 w-5 animate-spin text-primary"})}):e.jsx(l.BlurContainer,{children:e.jsxs(i.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(i.CardHeader,{className:"space-y-1",children:e.jsxs(i.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[u?e.jsx(n.Loader,{className:"h-6 w-6 animate-spin text-gray-500"}):c?e.jsx(n.TableIcon,{className:"h-6 w-6 text-green-500"}):a?e.jsx(n.CheckCircle,{className:"h-6 w-6 text-green-500"}):e.jsx(n.Target,{className:"h-6 w-6 text-green-500"}),s(c?"Page is active in other tab":a?"You can edit the page now.":"Page take over request")]})}),e.jsx(i.CardContent,{className:"grid gap-4",children:e.jsx("div",{children:c?e.jsxs("p",{children:[s("You are already editing this page in another tab. To continue editing here, click on"),' "',s("Continue editing here"),'".']}):a?e.jsx("p",{children:s("This page is released by other user you can continue editing now.")}):e.jsxs("p",{children:[e.jsxs("b",{children:[" ",e.jsx(N,{userId:t==null?void 0:t.requestedBy})]})," ",s("has requested to take over this page."),e.jsx("br",{})," ",s("If you accept, your unsaved changes will be saved.")]})})}),e.jsxs(i.CardFooter,{className:"flex items-center justify-end gap-2",children:[e.jsx(i.Button,{disabled:u,onClick:g,className:a?"":"bg-green-500 hover:bg-green-600",children:c?e.jsxs(e.Fragment,{children:[e.jsx(n.Edit,{className:"h-5 w-5"})," ",s("Continue editing here")]}):a?e.jsxs(e.Fragment,{children:[e.jsx(n.Edit,{className:"h-5 w-5"})," ",s("Continue to edit")]}):e.jsxs(e.Fragment,{children:[e.jsx(n.Check,{className:"h-5 w-5"})," ",s("Accept")]})}),!a&&e.jsxs(i.Button,{variant:"outline",onClick:m,children:[e.jsx(n.X,{className:"h-5 w-5"})," ",s("Reject")]})]})]})})};exports.default=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./index-C1bimRWu.cjs"),C=require("@chaibuilder/sdk"),i=require("@chaibuilder/sdk/ui"),n=require("lucide-react"),x=require("react"),N=({userId:d})=>{const{data:r}=l.useChaiUserInfo(d);return(r==null?void 0:r.name)||"Unknown"},f=({isChecking:d,lockingStatus:r,onContinue:j})=>{const{t:s}=C.useTranslation(),[u,h]=x.useState(!1),c=r==="page_is_active_in_other_tab",a=(r==null?void 0:r.length)>0,{pageLock:t,acceptTakeOver:o,rejectTakeOver:m}=l.usePageLockRequestTakeOver(),g=()=>{h(!0),a||c?j():o(),setTimeout(()=>{h(!1)},3e3)};return x.useEffect(()=>{(t==null?void 0:t.requestedBy)==="ANOTHER_TAB"&&o()},[t,o]),(t==null?void 0:t.requestedBy)==="ANOTHER_TAB"?null:d?e.jsx(l.BlurContainer,{children:e.jsx(n.Loader,{className:"h-5 w-5 animate-spin text-primary"})}):e.jsx(l.BlurContainer,{children:e.jsxs(i.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(i.CardHeader,{className:"space-y-1",children:e.jsxs(i.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[u?e.jsx(n.Loader,{className:"h-6 w-6 animate-spin text-gray-500"}):c?e.jsx(n.TableIcon,{className:"h-6 w-6 text-green-500"}):a?e.jsx(n.CheckCircle,{className:"h-6 w-6 text-green-500"}):e.jsx(n.Target,{className:"h-6 w-6 text-green-500"}),s(c?"Page is active in other tab":a?"You can edit the page now.":"Page take over request")]})}),e.jsx(i.CardContent,{className:"grid gap-4",children:e.jsx("div",{children:c?e.jsxs("p",{children:[s("You are already editing this page in another tab. To continue editing here, click on"),' "',s("Continue editing here"),'".']}):a?e.jsx("p",{children:s("This page is released by other user you can continue editing now.")}):e.jsxs("p",{children:[e.jsxs("b",{children:[" ",e.jsx(N,{userId:t==null?void 0:t.requestedBy})]})," ",s("has requested to take over this page."),e.jsx("br",{})," ",s("If you accept, your unsaved changes will be saved.")]})})}),e.jsxs(i.CardFooter,{className:"flex items-center justify-end gap-2",children:[e.jsx(i.Button,{disabled:u,onClick:g,className:a?"":"bg-green-500 hover:bg-green-600",children:c?e.jsxs(e.Fragment,{children:[e.jsx(n.Edit,{className:"h-5 w-5"})," ",s("Continue editing here")]}):a?e.jsxs(e.Fragment,{children:[e.jsx(n.Edit,{className:"h-5 w-5"})," ",s("Continue to edit")]}):e.jsxs(e.Fragment,{children:[e.jsx(n.Check,{className:"h-5 w-5"})," ",s("Accept")]})}),!a&&e.jsxs(i.Button,{variant:"outline",onClick:m,children:[e.jsx(n.X,{className:"h-5 w-5"})," ",s("Reject")]})]})]})})};exports.default=f;
@@ -4,7 +4,7 @@ import { Card as x, CardHeader as h, CardTitle as N, CardContent as g, Skeleton
4
4
  import { formatDistanceToNow as k } from "date-fns";
5
5
  import { LockKeyhole as y, UserIcon as v, Info as C, KeyIcon as T } from "lucide-react";
6
6
  import { useState as B } from "react";
7
- import { B as D } from "./index-CSOKPmkj.js";
7
+ import { B as D } from "./index-C_34q9jG.js";
8
8
  function O({
9
9
  avatar: l,
10
10
  name: s,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("@chaibuilder/sdk"),t=require("@chaibuilder/sdk/ui"),j=require("date-fns"),a=require("lucide-react"),p=require("react"),f=require("./index-D_4YaLhN.cjs");function g({avatar:l,name:d,email:n,lastSaved:c,onTakeOver:x,isRequestRejected:i,isFetchingUserInfo:r}){const{t:s}=h.useTranslation(),[o,u]=p.useState(!1),m=()=>{u(!0),setTimeout(()=>{u(!1)},15e3),x()};return e.jsx(f.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(a.LockKeyhole,{className:"h-8 w-8 rounded-md bg-sky-500/20 p-1.5 text-sky-500"}),s("Page is locked for editing")]})}),e.jsx(t.CardContent,{className:"w-md grid w-full pt-2",children:e.jsxs("div",{children:[e.jsxs("div",{className:"relative mx-auto flex w-96 items-center space-x-4 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:s("Locked By")}),l&&!r?e.jsx("img",{src:l,alt:d,className:"h-14 w-14 rounded-full border border-gray-300"}):e.jsx(a.UserIcon,{className:"h-14 w-14 flex-shrink-0 rounded-full bg-gradient-to-br from-purple-400 to-pink-500 p-2 text-white"}),e.jsxs("div",{className:r?"space-y-1.5":"space-y-0",children:[r?e.jsx(t.Skeleton,{className:"h-4 w-40 rounded"}):e.jsx("span",{className:"truncate font-medium text-black",children:d}),n&&!r?e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:n}):e.jsx(t.Skeleton,{className:"h-4 w-60 rounded"}),c&&!r?e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s("Last saved"),":"," ",j.formatDistanceToNow(new Date(c),{addSuffix:!0})]}):e.jsx(t.Skeleton,{className:"h-4 w-40 rounded"})]})]}),e.jsx("div",{className:"mt-4 text-sm",children:e.jsxs("p",{className:"py-4 text-center text-gray-600",children:[s("This page is currently being edited by")," ",e.jsx("span",{className:"font-bold",children:d}),".",e.jsx("br",{}),e.jsx("br",{})," ",s("You can either wait until they finish editing or request to take over the page.")]})}),i&&e.jsxs("div",{className:"mt-4 flex w-full items-center justify-center gap-x-2 rounded border border-red-500 bg-red-50 p-2 text-center font-medium text-red-500",children:[e.jsx(a.Info,{className:"h-5 w-5"})," ",s("Page take over request is rejected")]})]})}),e.jsx(t.CardFooter,{children:e.jsxs(t.Button,{disabled:o,onClick:m,className:"w-full",variant:"destructive",children:[e.jsx(a.KeyIcon,{className:"h-5 w-5"}),s(o?"Page take is requested.":i?"Request take over again":"Request take over")]})})]})})}exports.default=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("@chaibuilder/sdk"),t=require("@chaibuilder/sdk/ui"),j=require("date-fns"),a=require("lucide-react"),p=require("react"),f=require("./index-C1bimRWu.cjs");function g({avatar:l,name:d,email:n,lastSaved:c,onTakeOver:x,isRequestRejected:i,isFetchingUserInfo:r}){const{t:s}=h.useTranslation(),[o,u]=p.useState(!1),m=()=>{u(!0),setTimeout(()=>{u(!1)},15e3),x()};return e.jsx(f.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(a.LockKeyhole,{className:"h-8 w-8 rounded-md bg-sky-500/20 p-1.5 text-sky-500"}),s("Page is locked for editing")]})}),e.jsx(t.CardContent,{className:"w-md grid w-full pt-2",children:e.jsxs("div",{children:[e.jsxs("div",{className:"relative mx-auto flex w-96 items-center space-x-4 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:s("Locked By")}),l&&!r?e.jsx("img",{src:l,alt:d,className:"h-14 w-14 rounded-full border border-gray-300"}):e.jsx(a.UserIcon,{className:"h-14 w-14 flex-shrink-0 rounded-full bg-gradient-to-br from-purple-400 to-pink-500 p-2 text-white"}),e.jsxs("div",{className:r?"space-y-1.5":"space-y-0",children:[r?e.jsx(t.Skeleton,{className:"h-4 w-40 rounded"}):e.jsx("span",{className:"truncate font-medium text-black",children:d}),n&&!r?e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:n}):e.jsx(t.Skeleton,{className:"h-4 w-60 rounded"}),c&&!r?e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s("Last saved"),":"," ",j.formatDistanceToNow(new Date(c),{addSuffix:!0})]}):e.jsx(t.Skeleton,{className:"h-4 w-40 rounded"})]})]}),e.jsx("div",{className:"mt-4 text-sm",children:e.jsxs("p",{className:"py-4 text-center text-gray-600",children:[s("This page is currently being edited by")," ",e.jsx("span",{className:"font-bold",children:d}),".",e.jsx("br",{}),e.jsx("br",{})," ",s("You can either wait until they finish editing or request to take over the page.")]})}),i&&e.jsxs("div",{className:"mt-4 flex w-full items-center justify-center gap-x-2 rounded border border-red-500 bg-red-50 p-2 text-center font-medium text-red-500",children:[e.jsx(a.Info,{className:"h-5 w-5"})," ",s("Page take over request is rejected")]})]})}),e.jsx(t.CardFooter,{children:e.jsxs(t.Button,{disabled:o,onClick:m,className:"w-full",variant:"destructive",children:[e.jsx(a.KeyIcon,{className:"h-5 w-5"}),s(o?"Page take is requested.":i?"Request take over again":"Request take over")]})})]})})}exports.default=g;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as y, jsx as t, Fragment as O } from "react/jsx-runtime";
2
- import { au as be, f as ie, aj as ye, T as _, aD as ge, L as ke, h as Ne, b as we, i as ve, ap as Se, aE as Ae, aF as q } from "./index-CSOKPmkj.js";
2
+ import { au as be, f as ie, aj as ye, T as _, aD as ge, L as ke, h as Ne, b as we, i as ve, ap as Se, aE as Ae, aF as q } from "./index-C_34q9jG.js";
3
3
  import { u as K } from "./use-page-expand-manager-D6T75I11.js";
4
4
  import { compact as ce, filter as j, isEmpty as S, uniqBy as Le, keyBy as de, mapValues as Te, startCase as Ee, toLower as T, includes as R, find as M, get as Q, map as Ce } from "lodash-es";
5
5
  import { useTranslation as Ue, useLanguages as ae } from "@chaibuilder/sdk";
@@ -222,7 +222,7 @@ const oe = (e, n) => !e || !Array.isArray(e) ? [] : S(n) ? e : ce(
222
222
  }
223
223
  )
224
224
  ] }, m.id)) });
225
- }, Ve = E(() => import("./page-manager-search-and-filter-Dvt-nBOL.js")), Je = E(() => import("./add-new-page-X9ytZJiO.js")), Ke = E(() => import("./delete-page-D8gUlElz.js")), Xe = E(() => import("./duplicate-page-BgR_Z5mB.js")), Ye = E(() => import("./mark-as-template-DojgcJFD.js")), Ze = E(() => import("./unmark-as-template-VHopisw3.js")), et = E(() => import("./unpublish-page-Cq5OwCf-.js")), ct = ({ close: e }) => {
225
+ }, Ve = E(() => import("./page-manager-search-and-filter-heV_U9x0.js")), Je = E(() => import("./add-new-page-Dn-jphFf.js")), Ke = E(() => import("./delete-page-BtWRzpTh.js")), Xe = E(() => import("./duplicate-page-3Dv56tPR.js")), Ye = E(() => import("./mark-as-template-BsOhlLYx.js")), Ze = E(() => import("./unmark-as-template-CGKkAZPZ.js")), et = E(() => import("./unpublish-page-ow8e1CXO.js")), ct = ({ close: e }) => {
226
226
  const { t: n } = Ue(), { languages: r, setSelectedLang: s } = ae(), { data: o } = Ne(), { data: l, isFetching: f } = we(), [g, P] = ve(), { updateForSelectedPage: m, expandPagesOnSearch: u } = K(null), i = ie(), x = g.get("page"), [p, w] = N(""), [d, A] = N(null), [C, b] = N(null), [z, B] = N(null), [c, I] = N(null), [U, W] = N(""), [X, Y] = N(null), [Z, ee] = N(null), [k, fe] = N(i), [Pe, xe] = N(!1), [, te] = $e(Se), G = Pe && k !== i, { data: $, isFetching: pe } = Ae(k), se = le(
227
227
  (h) => {
228
228
  var a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),x=require("./index-D_4YaLhN.cjs"),G=require("./use-page-expand-manager-B5Y2KS1c.cjs"),n=require("lodash-es"),B=require("@chaibuilder/sdk"),te=require("jotai"),v=require("lucide-react"),l=require("react"),J=(e,r)=>!e||!Array.isArray(e)?[]:n.isEmpty(r)?e:n.compact(n.filter(e,a=>{const t=n.toLower(r);return n.includes(n.toLower((a==null?void 0:a.name)||""),t)||n.includes(n.toLower((a==null?void 0:a.slug)||""),t)})),ne=(e,r)=>{const a=new Set,t=n.keyBy(e,"id");return r.forEach(c=>{let o=c;for(;o.parent&&t[o.parent];)a.add(o.parent),o=t[o.parent]}),Array.from(a).map(c=>t[c])},I=(e,r,a)=>n.isEmpty(r)?e:e.map(t=>{if(!a(t.pageType))return{...t,shouldExpandOnSearch:!0,children:t.children?I(t.children,r,a):[]};const c=t.children&&t.children.some(o=>n.includes(n.toLower(o.name||""),n.toLower(r))||n.includes(n.toLower(o.slug||""),n.toLower(r)));return{...t,shouldExpandOnSearch:c,children:t.children?I(t.children,r,a):[]}}),re=e=>{if(!e||!e.length)return[];const r={};e.forEach(t=>{r[t.id]={...t,children:[]}});const a=[];return Object.values(r).forEach(t=>{t.parent&&r[t.parent]?r[t.parent].children.push(t):a.push(t)}),a},K=e=>!e||!e.length?[]:[...e].sort((a,t)=>(a.name||"").localeCompare(t.name||"")).map(a=>({...a,children:a.children?K(a.children):[]})),ae=(e,r,a,t)=>{if(!e||!e.length)return[];let c=e;if(a!=="all"&&(c=n.compact(n.filter(e,{pageType:a}))),n.isEmpty(r))c=J(c,r);else{const h=J(c,r),d=ne(e,h);c=n.uniqBy([...h,...d],"id")}const o=K(re(c)),y=I(o,r,t),S=n.filter(y,h=>t(h.pageType)).sort((h,d)=>(h.name||"").localeCompare(d.name||"")),p=n.filter(y,h=>!t(h.pageType));let f=[];if(a==="all"){const h=n.keyBy(p,"pageType");f=Object.values(n.mapValues(h,(d,j)=>({...d,id:j,name:n.startCase(j),isPartialGroup:!0,children:y.filter(b=>b.pageType===j)})))}else f=p.sort((h,d)=>(h.name||"").localeCompare(d.name||""));return[...S,...f]},le=({page:e})=>{var t,c;const{isExpanded:r,toggleExpanded:a}=G.usePageExpandManager(e==null?void 0:e.id);return s.jsx("button",{onClick:o=>{o.stopPropagation(),a()},disabled:!((t=e==null?void 0:e.children)!=null&&t.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:s.jsx(v.ChevronRight,{size:12,className:`stroke-[4] transition-transform duration-200 ${r?"rotate-90":""}`})})},ie=({page:e,pageType:r})=>s.jsx("div",{className:"flex h-full items-center justify-center gap-x-1",children:e.dynamic?s.jsx(v.StarsIcon,{size:12,className:"text-yellow-400"}):r!=null&&r.icon?s.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:r.icon}}):r!=null&&r.hasSlug?s.jsx(v.File,{size:12,className:"stroke-[1] text-slate-500"}):s.jsx(v.Hash,{size:12,className:"stroke-[1] text-slate-500"})}),oe=({isOnline:e})=>s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-300":"bg-gray-300"}`}),ce=({page:e,pageTypes:r,currentPage:a,onClickAction:t,languagePages:c,selectedLanguage:o,showUntranslatedPages:y})=>{const[S]=x.usePageUserMapping(),p=x.useFallbackLang(),f=a===e.id,h=!!e.isTemplate,d=l.useMemo(()=>n.find(r,{key:e.pageType}),[r,e.pageType]),j=S==null?void 0:S[e.id],{data:b}=x.useChaiUserInfo(j),w=b?b==null?void 0:b.name:null;let m=n.get(c,e==null?void 0:e.id);m=n.get(m,"lang")===o?m:null;const E=o===p||!!m,L=(m==null?void 0:m.name)||(e==null?void 0:e.name)||"No name";let g=(m==null?void 0:m.slug)||(e==null?void 0:e.slug)||"";const C=g+(e!=null&&e.dynamic?`/${d==null?void 0:d.dynamicSlug}`:"")+(e!=null&&e.dynamicSlugCustom?`${e.dynamicSlugCustom}`:"");if(g.startsWith("/")&&!y){const u=g.split("/").pop();g=g.endsWith(u)&&e.dynamic?"":`/${u}`}const q=l.useMemo(()=>{const u="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]",M=`${f?"border-primary/30 bg-primary/5":"border-transparent hover:border-gray-200 hover:bg-gray-100"}`;return E?`${u} ${M} ${w?"opacity-60":""}`:`${u} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`},[E,f,w]);return s.jsxs("div",{className:"group relative",children:[s.jsxs("div",{onClick:()=>!e.isPartialGroup&&E&&t("select",e==null?void 0:e.id),className:q,children:[s.jsx(le,{page:e}),!e.isPartialGroup&&s.jsx(oe,{isOnline:m?m.online:e.online}),!e.isPartialGroup&&s.jsx(ie,{page:e,pageType:d}),s.jsx(x.Tooltip,{content:L,side:"top",showTooltip:L.length>35,children:s.jsx("span",{className:"max-w-[40%] truncate font-medium text-black",children:L})}),(g||e.dynamic)&&s.jsx(x.Tooltip,{content:C,side:"top",showTooltip:!0,children:s.jsxs("span",{className:"max-w-[40%] truncate font-mono text-xs text-muted-foreground",children:[g,e.dynamic&&(d==null?void 0:d.dynamicSlug)&&s.jsxs("span",{className:"text-xs text-gray-500",children:["/",d==null?void 0:d.dynamicSlug,e.dynamicSlugCustom]})]})}),h&&s.jsx(x.Tooltip,{content:"Template",side:"top",children:s.jsx("span",{className:"text-blue-500",children:s.jsx(v.NotepadText,{size:16})})}),!e.isPartialGroup&&E&&!w?s.jsx("div",{className:"duration absolute right-0.5 top-[3px]",children:s.jsx(x.PageActionsDropdown,{isLanguagePage:!!m,page:m||e,setDuplicatePage:u=>t("duplicate",u),setAddEditPage:u=>t("edit",m||u),setUnpublishPage:u=>t("unpublish",u),setDeletePage:u=>t("delete",m||u),setMarkAsTemplate:u=>t("markAsTemplate",u),setUnmarkAsTemplate:u=>t("unmarkAsTemplate",u),children:s.jsx("div",{className:"m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white",children:s.jsx(v.MoreHorizontal,{className:"h-4 w-4",onClick:u=>u.stopPropagation()})})})}):w?s.jsx("span",{className:"duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:s.jsx(v.Lock,{className:"h-3.5 w-3.5 fill-red-200 text-red-500"})}):null]}),s.jsx(s.Fragment,{children:w&&s.jsxs("button",{className:"absolute right-0 top-0 flex h-full 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:[s.jsx(v.Edit,{size:12,className:"stroke-[3]"})," ",s.jsx("span",{className:"font-medium",children:w})," is editing this page"]})}),s.jsx(s.Fragment,{children:!E&&!e.isPartialGroup&&!w&&s.jsxs("button",{onClick:u=>{u.stopPropagation(),t("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:[s.jsx(v.Plus,{size:12,className:"stroke-[3]"})," ",s.jsxs("span",{className:"text-[10px]",children:["Add ",n.get(x.LANGUAGES,o)," Page"]})]})})]})},X=({pages:e,tier:r,pageTypes:a,currentPage:t,onClickAction:c,languagePages:o,selectedLanguage:y,showUntranslatedPages:S})=>{const{expandedPages:p}=G.usePageExpandManager();return s.jsx("div",{className:"space-y-0.5",style:{paddingLeft:`${r*10}px`},children:e.map(f=>s.jsxs(s.Fragment,{children:[s.jsx(ce,{page:f,pageTypes:a,currentPage:t,onClickAction:c,languagePages:o,selectedLanguage:y,showUntranslatedPages:S}),f.children&&f.children.length>0&&(p==null?void 0:p.includes(f.id))&&s.jsx(X,{pages:f.children,tier:r+1,pageTypes:a,currentPage:t,onClickAction:c,languagePages:o,selectedLanguage:y,showUntranslatedPages:S})]},f.id))})},de=l.lazy(()=>Promise.resolve().then(()=>require("./page-manager-search-and-filter-BuQLf3EG.cjs"))),ue=l.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-DKyY5ZY7.cjs"))),me=l.lazy(()=>Promise.resolve().then(()=>require("./delete-page-CSuwBSa6.cjs"))),he=l.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-DfsShaR3.cjs"))),xe=l.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-BHkftF1C.cjs"))),fe=l.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-BB_2lvTh.cjs"))),Pe=l.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-DJKgb2OG.cjs"))),ye=({close:e})=>{const{t:r}=B.useTranslation(),{languages:a,setSelectedLang:t}=B.useLanguages(),{data:c}=x.usePageTypes(),{data:o,isFetching:y}=x.useWebsitePages(),[S,p]=x.useSearchParams(),{updateForSelectedPage:f,expandPagesOnSearch:h}=G.usePageExpandManager(null),d=x.useFallbackLang(),j=S.get("page"),[b,w]=l.useState(""),[m,E]=l.useState(null),[L,g]=l.useState(null),[C,q]=l.useState(null),[u,M]=l.useState(null),[T,U]=l.useState(""),[O,R]=l.useState(null),[D,W]=l.useState(null),[k,Y]=l.useState(d),[Z,ee]=l.useState(!1),[,_]=te.useAtom(x.addNewLangAtom),z=Z&&k!==d,{data:A,isFetching:se}=x.useWebsiteLanguagePages(k),H=l.useCallback(P=>{var i;return(i=n.find(c,{key:P}))==null?void 0:i.hasSlug},[c]),N=l.useMemo(()=>o?z?n.filter(o,P=>!(A!=null&&A[P.id])):ae(o,b,T,H):[],[o,H,b,T,A,z]);l.useEffect(()=>{t(d)},[d,t]),l.useEffect(()=>{if(!n.isEmpty(T))return;const P=sessionStorage.getItem("pageTypeFilter")||"all";!n.isEmpty(c)&&P&&(n.find(c,{key:P})?U(P):U("all"))},[c,T]),l.useEffect(()=>{if(j&&!y&&!n.find(o,{id:j})){const i=n.find(o,{slug:"/"});if(i){const F=new URLSearchParams({page:i.id});x.navigateToPage(F,p)}else x.navigateToPage(new URLSearchParams({}),p,!0)}},[o,j,y,p]),l.useEffect(()=>{j&&!y&&!n.isEmpty(N)&&f(N,j)},[j,y,N,f]),l.useEffect(()=>{!n.isEmpty(b)&&!n.isEmpty(N)&&h(N)},[b,N,h]);const{setSelectedLang:$}=B.useLanguages(),Q=l.useCallback(P=>{const i=new URLSearchParams({page:P});k!==d?(i.set("lang",k),$(k)):$(""),x.navigateToPage(i,p),e()},[e,p,$,k,d]),V=(P,i)=>{var F;if(i)switch(P){case"add":g(i);break;case"select":Q(i);break;case"edit":k!==d?_({edit:!0,id:i==null?void 0:i.id,primaryPage:i==null?void 0:i.primaryPage}):g(i);break;case"delete":E(i);break;case"unpublish":q(i);break;case"markAsTemplate":M(i);break;case"unmarkAsTemplate":W(i);break;case"duplicate":R(i);break;case"addLanguagePage":_({edit:!1,primaryPage:((F=i==null?void 0:i.page)==null?void 0:F.id)||"",preselectedLang:(i==null?void 0:i.language)||k});break}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-full flex-col justify-between",children:[s.jsx(l.Suspense,{children:s.jsx(de,{pages:N,search:b,setSearch:w,languages:[d,...a],selectedLanguage:k,setSelectedLanguage:Y,selectedPageType:T,setSelectedPageType:U,onAddPage:P=>V("add",P),showUntranslatedPages:z,setShowUntranslatedPages:ee})}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-6 pt-2",children:y||se?s.jsx("div",{className:"space-y-2",children:n.map([...Array(15).keys()],P=>s.jsx("div",{className:"h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200"},P))}):n.isEmpty(N)?s.jsxs("div",{className:"flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500",children:[s.jsx(v.File,{className:"h-6 w-6 stroke-[1]"}),r("Empty List!"),s.jsx("span",{className:"font-light",children:r("Add new page to start")})]}):s.jsx(X,{tier:0,pages:N,pageTypes:c,currentPage:j||"",onClickAction:V,languagePages:A,selectedLanguage:k,showUntranslatedPages:z})})]}),L&&s.jsx(l.Suspense,{children:s.jsx(ue,{closePanel:e,editPage:Q,addEditPage:L,setAddEditPage:g})}),m&&s.jsx(l.Suspense,{children:s.jsx(me,{page:m,onClose:()=>E(null)})}),C&&s.jsx(l.Suspense,{children:s.jsx(Pe,{page:C,onClose:()=>q(null)})}),u&&s.jsx(l.Suspense,{children:s.jsx(xe,{page:u,onClose:()=>M(null)})}),D&&s.jsx(l.Suspense,{children:s.jsx(fe,{page:D,onClose:()=>W(null)})}),O&&s.jsx(l.Suspense,{children:s.jsx(he,{page:O,onClose:()=>R(null),closePanel:e})})]})};exports.default=ye;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),x=require("./index-C1bimRWu.cjs"),G=require("./use-page-expand-manager-B5Y2KS1c.cjs"),n=require("lodash-es"),B=require("@chaibuilder/sdk"),te=require("jotai"),v=require("lucide-react"),l=require("react"),J=(e,r)=>!e||!Array.isArray(e)?[]:n.isEmpty(r)?e:n.compact(n.filter(e,a=>{const t=n.toLower(r);return n.includes(n.toLower((a==null?void 0:a.name)||""),t)||n.includes(n.toLower((a==null?void 0:a.slug)||""),t)})),ne=(e,r)=>{const a=new Set,t=n.keyBy(e,"id");return r.forEach(c=>{let o=c;for(;o.parent&&t[o.parent];)a.add(o.parent),o=t[o.parent]}),Array.from(a).map(c=>t[c])},I=(e,r,a)=>n.isEmpty(r)?e:e.map(t=>{if(!a(t.pageType))return{...t,shouldExpandOnSearch:!0,children:t.children?I(t.children,r,a):[]};const c=t.children&&t.children.some(o=>n.includes(n.toLower(o.name||""),n.toLower(r))||n.includes(n.toLower(o.slug||""),n.toLower(r)));return{...t,shouldExpandOnSearch:c,children:t.children?I(t.children,r,a):[]}}),re=e=>{if(!e||!e.length)return[];const r={};e.forEach(t=>{r[t.id]={...t,children:[]}});const a=[];return Object.values(r).forEach(t=>{t.parent&&r[t.parent]?r[t.parent].children.push(t):a.push(t)}),a},K=e=>!e||!e.length?[]:[...e].sort((a,t)=>(a.name||"").localeCompare(t.name||"")).map(a=>({...a,children:a.children?K(a.children):[]})),ae=(e,r,a,t)=>{if(!e||!e.length)return[];let c=e;if(a!=="all"&&(c=n.compact(n.filter(e,{pageType:a}))),n.isEmpty(r))c=J(c,r);else{const h=J(c,r),d=ne(e,h);c=n.uniqBy([...h,...d],"id")}const o=K(re(c)),y=I(o,r,t),S=n.filter(y,h=>t(h.pageType)).sort((h,d)=>(h.name||"").localeCompare(d.name||"")),p=n.filter(y,h=>!t(h.pageType));let f=[];if(a==="all"){const h=n.keyBy(p,"pageType");f=Object.values(n.mapValues(h,(d,j)=>({...d,id:j,name:n.startCase(j),isPartialGroup:!0,children:y.filter(b=>b.pageType===j)})))}else f=p.sort((h,d)=>(h.name||"").localeCompare(d.name||""));return[...S,...f]},le=({page:e})=>{var t,c;const{isExpanded:r,toggleExpanded:a}=G.usePageExpandManager(e==null?void 0:e.id);return s.jsx("button",{onClick:o=>{o.stopPropagation(),a()},disabled:!((t=e==null?void 0:e.children)!=null&&t.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:s.jsx(v.ChevronRight,{size:12,className:`stroke-[4] transition-transform duration-200 ${r?"rotate-90":""}`})})},ie=({page:e,pageType:r})=>s.jsx("div",{className:"flex h-full items-center justify-center gap-x-1",children:e.dynamic?s.jsx(v.StarsIcon,{size:12,className:"text-yellow-400"}):r!=null&&r.icon?s.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:r.icon}}):r!=null&&r.hasSlug?s.jsx(v.File,{size:12,className:"stroke-[1] text-slate-500"}):s.jsx(v.Hash,{size:12,className:"stroke-[1] text-slate-500"})}),oe=({isOnline:e})=>s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-300":"bg-gray-300"}`}),ce=({page:e,pageTypes:r,currentPage:a,onClickAction:t,languagePages:c,selectedLanguage:o,showUntranslatedPages:y})=>{const[S]=x.usePageUserMapping(),p=x.useFallbackLang(),f=a===e.id,h=!!e.isTemplate,d=l.useMemo(()=>n.find(r,{key:e.pageType}),[r,e.pageType]),j=S==null?void 0:S[e.id],{data:b}=x.useChaiUserInfo(j),w=b?b==null?void 0:b.name:null;let m=n.get(c,e==null?void 0:e.id);m=n.get(m,"lang")===o?m:null;const E=o===p||!!m,L=(m==null?void 0:m.name)||(e==null?void 0:e.name)||"No name";let g=(m==null?void 0:m.slug)||(e==null?void 0:e.slug)||"";const C=g+(e!=null&&e.dynamic?`/${d==null?void 0:d.dynamicSlug}`:"")+(e!=null&&e.dynamicSlugCustom?`${e.dynamicSlugCustom}`:"");if(g.startsWith("/")&&!y){const u=g.split("/").pop();g=g.endsWith(u)&&e.dynamic?"":`/${u}`}const q=l.useMemo(()=>{const u="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]",M=`${f?"border-primary/30 bg-primary/5":"border-transparent hover:border-gray-200 hover:bg-gray-100"}`;return E?`${u} ${M} ${w?"opacity-60":""}`:`${u} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`},[E,f,w]);return s.jsxs("div",{className:"group relative",children:[s.jsxs("div",{onClick:()=>!e.isPartialGroup&&E&&t("select",e==null?void 0:e.id),className:q,children:[s.jsx(le,{page:e}),!e.isPartialGroup&&s.jsx(oe,{isOnline:m?m.online:e.online}),!e.isPartialGroup&&s.jsx(ie,{page:e,pageType:d}),s.jsx(x.Tooltip,{content:L,side:"top",showTooltip:L.length>35,children:s.jsx("span",{className:"max-w-[40%] truncate font-medium text-black",children:L})}),(g||e.dynamic)&&s.jsx(x.Tooltip,{content:C,side:"top",showTooltip:!0,children:s.jsxs("span",{className:"max-w-[40%] truncate font-mono text-xs text-muted-foreground",children:[g,e.dynamic&&(d==null?void 0:d.dynamicSlug)&&s.jsxs("span",{className:"text-xs text-gray-500",children:["/",d==null?void 0:d.dynamicSlug,e.dynamicSlugCustom]})]})}),h&&s.jsx(x.Tooltip,{content:"Template",side:"top",children:s.jsx("span",{className:"text-blue-500",children:s.jsx(v.NotepadText,{size:16})})}),!e.isPartialGroup&&E&&!w?s.jsx("div",{className:"duration absolute right-0.5 top-[3px]",children:s.jsx(x.PageActionsDropdown,{isLanguagePage:!!m,page:m||e,setDuplicatePage:u=>t("duplicate",u),setAddEditPage:u=>t("edit",m||u),setUnpublishPage:u=>t("unpublish",u),setDeletePage:u=>t("delete",m||u),setMarkAsTemplate:u=>t("markAsTemplate",u),setUnmarkAsTemplate:u=>t("unmarkAsTemplate",u),children:s.jsx("div",{className:"m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white",children:s.jsx(v.MoreHorizontal,{className:"h-4 w-4",onClick:u=>u.stopPropagation()})})})}):w?s.jsx("span",{className:"duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:s.jsx(v.Lock,{className:"h-3.5 w-3.5 fill-red-200 text-red-500"})}):null]}),s.jsx(s.Fragment,{children:w&&s.jsxs("button",{className:"absolute right-0 top-0 flex h-full 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:[s.jsx(v.Edit,{size:12,className:"stroke-[3]"})," ",s.jsx("span",{className:"font-medium",children:w})," is editing this page"]})}),s.jsx(s.Fragment,{children:!E&&!e.isPartialGroup&&!w&&s.jsxs("button",{onClick:u=>{u.stopPropagation(),t("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:[s.jsx(v.Plus,{size:12,className:"stroke-[3]"})," ",s.jsxs("span",{className:"text-[10px]",children:["Add ",n.get(x.LANGUAGES,o)," Page"]})]})})]})},X=({pages:e,tier:r,pageTypes:a,currentPage:t,onClickAction:c,languagePages:o,selectedLanguage:y,showUntranslatedPages:S})=>{const{expandedPages:p}=G.usePageExpandManager();return s.jsx("div",{className:"space-y-0.5",style:{paddingLeft:`${r*10}px`},children:e.map(f=>s.jsxs(s.Fragment,{children:[s.jsx(ce,{page:f,pageTypes:a,currentPage:t,onClickAction:c,languagePages:o,selectedLanguage:y,showUntranslatedPages:S}),f.children&&f.children.length>0&&(p==null?void 0:p.includes(f.id))&&s.jsx(X,{pages:f.children,tier:r+1,pageTypes:a,currentPage:t,onClickAction:c,languagePages:o,selectedLanguage:y,showUntranslatedPages:S})]},f.id))})},de=l.lazy(()=>Promise.resolve().then(()=>require("./page-manager-search-and-filter-DkR8sFPh.cjs"))),ue=l.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-ByCsABU-.cjs"))),me=l.lazy(()=>Promise.resolve().then(()=>require("./delete-page-CecAr8Ev.cjs"))),he=l.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-nGQAYVQc.cjs"))),xe=l.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-DUeGBAgn.cjs"))),fe=l.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-GuUssCYI.cjs"))),Pe=l.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-D67IrGmd.cjs"))),ye=({close:e})=>{const{t:r}=B.useTranslation(),{languages:a,setSelectedLang:t}=B.useLanguages(),{data:c}=x.usePageTypes(),{data:o,isFetching:y}=x.useWebsitePages(),[S,p]=x.useSearchParams(),{updateForSelectedPage:f,expandPagesOnSearch:h}=G.usePageExpandManager(null),d=x.useFallbackLang(),j=S.get("page"),[b,w]=l.useState(""),[m,E]=l.useState(null),[L,g]=l.useState(null),[C,q]=l.useState(null),[u,M]=l.useState(null),[T,U]=l.useState(""),[O,R]=l.useState(null),[D,W]=l.useState(null),[k,Y]=l.useState(d),[Z,ee]=l.useState(!1),[,_]=te.useAtom(x.addNewLangAtom),z=Z&&k!==d,{data:A,isFetching:se}=x.useWebsiteLanguagePages(k),H=l.useCallback(P=>{var i;return(i=n.find(c,{key:P}))==null?void 0:i.hasSlug},[c]),N=l.useMemo(()=>o?z?n.filter(o,P=>!(A!=null&&A[P.id])):ae(o,b,T,H):[],[o,H,b,T,A,z]);l.useEffect(()=>{t(d)},[d,t]),l.useEffect(()=>{if(!n.isEmpty(T))return;const P=sessionStorage.getItem("pageTypeFilter")||"all";!n.isEmpty(c)&&P&&(n.find(c,{key:P})?U(P):U("all"))},[c,T]),l.useEffect(()=>{if(j&&!y&&!n.find(o,{id:j})){const i=n.find(o,{slug:"/"});if(i){const F=new URLSearchParams({page:i.id});x.navigateToPage(F,p)}else x.navigateToPage(new URLSearchParams({}),p,!0)}},[o,j,y,p]),l.useEffect(()=>{j&&!y&&!n.isEmpty(N)&&f(N,j)},[j,y,N,f]),l.useEffect(()=>{!n.isEmpty(b)&&!n.isEmpty(N)&&h(N)},[b,N,h]);const{setSelectedLang:$}=B.useLanguages(),Q=l.useCallback(P=>{const i=new URLSearchParams({page:P});k!==d?(i.set("lang",k),$(k)):$(""),x.navigateToPage(i,p),e()},[e,p,$,k,d]),V=(P,i)=>{var F;if(i)switch(P){case"add":g(i);break;case"select":Q(i);break;case"edit":k!==d?_({edit:!0,id:i==null?void 0:i.id,primaryPage:i==null?void 0:i.primaryPage}):g(i);break;case"delete":E(i);break;case"unpublish":q(i);break;case"markAsTemplate":M(i);break;case"unmarkAsTemplate":W(i);break;case"duplicate":R(i);break;case"addLanguagePage":_({edit:!1,primaryPage:((F=i==null?void 0:i.page)==null?void 0:F.id)||"",preselectedLang:(i==null?void 0:i.language)||k});break}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-full flex-col justify-between",children:[s.jsx(l.Suspense,{children:s.jsx(de,{pages:N,search:b,setSearch:w,languages:[d,...a],selectedLanguage:k,setSelectedLanguage:Y,selectedPageType:T,setSelectedPageType:U,onAddPage:P=>V("add",P),showUntranslatedPages:z,setShowUntranslatedPages:ee})}),s.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-6 pt-2",children:y||se?s.jsx("div",{className:"space-y-2",children:n.map([...Array(15).keys()],P=>s.jsx("div",{className:"h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200"},P))}):n.isEmpty(N)?s.jsxs("div",{className:"flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500",children:[s.jsx(v.File,{className:"h-6 w-6 stroke-[1]"}),r("Empty List!"),s.jsx("span",{className:"font-light",children:r("Add new page to start")})]}):s.jsx(X,{tier:0,pages:N,pageTypes:c,currentPage:j||"",onClickAction:V,languagePages:A,selectedLanguage:k,showUntranslatedPages:z})})]}),L&&s.jsx(l.Suspense,{children:s.jsx(ue,{closePanel:e,editPage:Q,addEditPage:L,setAddEditPage:g})}),m&&s.jsx(l.Suspense,{children:s.jsx(me,{page:m,onClose:()=>E(null)})}),C&&s.jsx(l.Suspense,{children:s.jsx(Pe,{page:C,onClose:()=>q(null)})}),u&&s.jsx(l.Suspense,{children:s.jsx(xe,{page:u,onClose:()=>M(null)})}),D&&s.jsx(l.Suspense,{children:s.jsx(fe,{page:D,onClose:()=>W(null)})}),O&&s.jsx(l.Suspense,{children:s.jsx(he,{page:O,onClose:()=>R(null),closePanel:e})})]})};exports.default=ye;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("./index-D_4YaLhN.cjs"),N=require("./use-page-expand-manager-B5Y2KS1c.cjs"),m=require("@chaibuilder/sdk"),s=require("@chaibuilder/sdk/ui"),w=require("@tanstack/react-query"),r=require("lodash-es"),d=require("lucide-react"),C=require("react"),S=({selectedPageType:l,setSelectedPageType:i})=>{const{t:a}=m.useTranslation(),[n,o]=C.useState(""),{data:c}=j.usePageTypes(),h=t=>{if(!n)return!0;const x=n.toLowerCase(),p=g=>String(r.get(t,g,"")).toLowerCase().includes(x);return p("name")||p("key")},u=c.find(t=>t.key===l);return e.jsxs(s.Select,{onValueChange:i,value:l,children:[e.jsx(s.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(u==null?void 0:u.name)||a("All")}),e.jsx(d.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(s.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(d.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(s.Input,{placeholder:a("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:n,onChange:t=>o(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(s.SelectItem,{value:"all",children:a("All")}),!r.isEmpty(r.filter(c,t=>t.hasSlug&&h(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Pages")}),r.map([...r.filter(c,t=>t.hasSlug&&h(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),!r.isEmpty(r.filter(c,t=>!t.hasSlug&&h(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Partials")}),r.map([...r.filter(c,t=>!t.hasSlug&&h(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),r.isEmpty(r.filter(c,h))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:a("No matching page types found")})]})]})},k=({search:l,setSearch:i})=>{const{t:a}=m.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:a("Search Pages")}),e.jsx(d.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(s.Input,{id:"page-search-input",placeholder:a("Search pages"),value:l,onChange:n=>i(n.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off"})]})},T=({pages:l})=>{const{t:i}=m.useTranslation(),{expandAll:a,collapseAll:n,expandedPages:o}=N.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"icon",onClick:()=>a(l),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsUpDown,{})})}),e.jsx(s.TooltipContent,{children:i("Expand All")})]}),e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{disabled:o.length===0,variant:"outline",size:"icon",onClick:()=>n(),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsDownUp,{})})}),e.jsx(s.TooltipContent,{children:i("Collapse All")})]})]})},y=({languages:l,selectedLanguage:i,setSelectedLanguage:a})=>{const n=j.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(o=>e.jsxs(s.Button,{variant:i===o?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${i===o?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>a(o.toLowerCase()),children:[o===n&&e.jsx(d.Star,{size:4,className:`p-0.5 ${i===n?"fill-white":"fill-black"}`}),j.LANGUAGES[o]||""]},o))})},v=()=>{const{t:l}=m.useTranslation(),i=w.useQueryClient();return e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:()=>i.invalidateQueries({queryKey:[j.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(d.RefreshCw,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},A=({pages:l,search:i,setSearch:a,languages:n,onAddPage:o,selectedLanguage:c,setSelectedLanguage:h,selectedPageType:u,setSelectedPageType:t,showUntranslatedPages:x,setShowUntranslatedPages:p})=>{const{t:g}=m.useTranslation(),f=n.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(S,{selectedPageType:u,setSelectedPageType:t}),e.jsx(k,{search:i,setSearch:a}),e.jsx(T,{pages:l}),e.jsxs(s.Button,{variant:"default",onClick:o,className:"rounded px-3 font-normal",children:[e.jsx(d.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:g("Add Page")})]}),!f&&e.jsx(v,{})]}),f?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(y,{languages:n,selectedLanguage:c,setSelectedLanguage:b=>{h(b),p(x&&(n==null?void 0:n[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(n==null?void 0:n[0])!==c&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",onClick:()=>p(!x),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:x?e.jsx(d.FilterXIcon,{}):e.jsx(d.Filter,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:g("Toggle Untranslated Pages")})]}),e.jsx(v,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=y;exports.default=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("./index-C1bimRWu.cjs"),N=require("./use-page-expand-manager-B5Y2KS1c.cjs"),m=require("@chaibuilder/sdk"),s=require("@chaibuilder/sdk/ui"),w=require("@tanstack/react-query"),r=require("lodash-es"),d=require("lucide-react"),C=require("react"),S=({selectedPageType:l,setSelectedPageType:i})=>{const{t:a}=m.useTranslation(),[n,o]=C.useState(""),{data:c}=j.usePageTypes(),h=t=>{if(!n)return!0;const x=n.toLowerCase(),p=g=>String(r.get(t,g,"")).toLowerCase().includes(x);return p("name")||p("key")},u=c.find(t=>t.key===l);return e.jsxs(s.Select,{onValueChange:i,value:l,children:[e.jsx(s.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(u==null?void 0:u.name)||a("All")}),e.jsx(d.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(s.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(d.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(s.Input,{placeholder:a("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:n,onChange:t=>o(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(s.SelectItem,{value:"all",children:a("All")}),!r.isEmpty(r.filter(c,t=>t.hasSlug&&h(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Pages")}),r.map([...r.filter(c,t=>t.hasSlug&&h(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),!r.isEmpty(r.filter(c,t=>!t.hasSlug&&h(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Partials")}),r.map([...r.filter(c,t=>!t.hasSlug&&h(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),r.isEmpty(r.filter(c,h))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:a("No matching page types found")})]})]})},k=({search:l,setSearch:i})=>{const{t:a}=m.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:a("Search Pages")}),e.jsx(d.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(s.Input,{id:"page-search-input",placeholder:a("Search pages"),value:l,onChange:n=>i(n.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off"})]})},T=({pages:l})=>{const{t:i}=m.useTranslation(),{expandAll:a,collapseAll:n,expandedPages:o}=N.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"icon",onClick:()=>a(l),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsUpDown,{})})}),e.jsx(s.TooltipContent,{children:i("Expand All")})]}),e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{disabled:o.length===0,variant:"outline",size:"icon",onClick:()=>n(),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsDownUp,{})})}),e.jsx(s.TooltipContent,{children:i("Collapse All")})]})]})},y=({languages:l,selectedLanguage:i,setSelectedLanguage:a})=>{const n=j.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(o=>e.jsxs(s.Button,{variant:i===o?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${i===o?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>a(o.toLowerCase()),children:[o===n&&e.jsx(d.Star,{size:4,className:`p-0.5 ${i===n?"fill-white":"fill-black"}`}),j.LANGUAGES[o]||""]},o))})},v=()=>{const{t:l}=m.useTranslation(),i=w.useQueryClient();return e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:()=>i.invalidateQueries({queryKey:[j.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(d.RefreshCw,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},A=({pages:l,search:i,setSearch:a,languages:n,onAddPage:o,selectedLanguage:c,setSelectedLanguage:h,selectedPageType:u,setSelectedPageType:t,showUntranslatedPages:x,setShowUntranslatedPages:p})=>{const{t:g}=m.useTranslation(),f=n.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(S,{selectedPageType:u,setSelectedPageType:t}),e.jsx(k,{search:i,setSearch:a}),e.jsx(T,{pages:l}),e.jsxs(s.Button,{variant:"default",onClick:o,className:"rounded px-3 font-normal",children:[e.jsx(d.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:g("Add Page")})]}),!f&&e.jsx(v,{})]}),f?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(y,{languages:n,selectedLanguage:c,setSelectedLanguage:b=>{h(b),p(x&&(n==null?void 0:n[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(n==null?void 0:n[0])!==c&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",onClick:()=>p(!x),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:x?e.jsx(d.FilterXIcon,{}):e.jsx(d.Filter,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:g("Toggle Untranslated Pages")})]}),e.jsx(v,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=y;exports.default=A;
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as n, Fragment as k } from "react/jsx-runtime";
2
- import { f as F, L as I, h as z, A as j } from "./index-CSOKPmkj.js";
2
+ import { f as F, L as I, h as z, A as j } from "./index-C_34q9jG.js";
3
3
  import { u as T } from "./use-page-expand-manager-D6T75I11.js";
4
4
  import { useTranslation as f } from "@chaibuilder/sdk";
5
5
  import { Button as m, Tooltip as g, TooltipTrigger as b, TooltipContent as y, Select as $, SelectTrigger as G, SelectContent as D, Input as E, SelectItem as N } from "@chaibuilder/sdk/ui";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./index-D_4YaLhN.cjs"),N=require("@tanstack/react-query"),O=require("@chaibuilder/sdk"),a=require("@chaibuilder/sdk/ui"),y=require("date-fns"),L=require("lodash-es"),p=require("lucide-react"),b=require("react");function Q(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,l.get?l:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const v=Q(b);function z(s){const n=d.useApiUrl(),t=d.useFetch();return N.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 B=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async l=>await n(s,{action:d.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:l}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async({revisionId:l,discardCurrent:r})=>await n(s,{action:d.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:l,discardCurrent:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=b.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-BafhQd3C.cjs"))),g=({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.useCurrentPage(),{saveState:l}=O.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=l==="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(g,{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:!L.isEmpty(r.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",y.formatDistanceToNow(new Date(r.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(g,{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(a.Skeleton,{className:"h-4 w-3/4"}),e.jsx(a.Skeleton,{className:"h-3 w-1/2"}),e.jsx(a.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(a.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:l,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}),S=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(g,{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(g,{tag:"published"}):e.jsx(g,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:y.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:l})})}),e.jsx(A,{checked:f,disabled:S,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[l,r]=b.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(g,{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(a.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(a.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"})]})]}),l&&(s==null?void 0:s.length)>1&&t&&e.jsx(b.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:l,onOpenChange:r,compare:s})})]})}function A({checked:s,disabled:n,onChange:t,label:l="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:l})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(a.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(a.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(a.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(a.DropdownMenuSeparator,{}),e.jsxs(a.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:l,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(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Restore Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",y.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(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>l(!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(a.Button,{variant:"default",className:"sm:flex-1",onClick:()=>l(!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:l,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(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Delete Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",y.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(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:r,children:"Cancel"}),e.jsx(a.Button,{variant:"destructive",className:"sm:flex-1",onClick:l,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 E,R;const[n,t]=v.useState([]),[l,r]=v.useState(null),[c,x]=v.useState(!1),[m,u]=v.useState(!1),{data:i}=d.useCurrentPage(),{data:f,isFetching:S,error:h,refetch:j}=z(i==null?void 0:i.id),{mutate:k,isPending:M}=B(),{mutate:T,isPending:_}=H(),F=N.useQueryClient(),{selectedLang:P,fallbackLang:q}=O.useLanguages(),U=P||q;b.useEffect(()=>t([]),[i==null?void 0:i.id]);const G=o=>{l&&T({revisionId:l.uid,discardCurrent:o},{onSuccess:()=>{x(!1),r(null),F.invalidateQueries({queryKey:[d.ACTIONS.GET_DRAFT_PAGE]})}})},D=o=>{r(o),x(!0)},C=o=>{r(o),u(!0)},V=()=>{l&&k(l.uid,{onSuccess:()=>{u(!1),r(null)}})};return b.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(a.SheetHeader,{children:[e.jsx(a.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 ",y.format(new Date(i.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),S?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}),(E=f==null?void 0:f.filter(o=>o.uid==="current"))==null?void 0:E.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:!0,onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w,compare:n,setCompare:t},o.uid)),e.jsx(a.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:(R=f==null?void 0:f.filter(o=>o.uid!=="current"))==null?void 0:R.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:o.uid==="current",onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:c,onOpenChange:x,revision:l,onRestore:G,isRestoring:_}),e.jsx(Z,{open:m,onOpenChange:u,revision:l,onDelete:V,isDeleting:M})]})}exports.default=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./index-C1bimRWu.cjs"),N=require("@tanstack/react-query"),O=require("@chaibuilder/sdk"),a=require("@chaibuilder/sdk/ui"),y=require("date-fns"),L=require("lodash-es"),p=require("lucide-react"),b=require("react");function Q(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,l.get?l:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const v=Q(b);function z(s){const n=d.useApiUrl(),t=d.useFetch();return N.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 B=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async l=>await n(s,{action:d.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:l}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async({revisionId:l,discardCurrent:r})=>await n(s,{action:d.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:l,discardCurrent:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=b.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-B9kQEwcr.cjs"))),g=({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.useCurrentPage(),{saveState:l}=O.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=l==="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(g,{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:!L.isEmpty(r.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",y.formatDistanceToNow(new Date(r.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(g,{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(a.Skeleton,{className:"h-4 w-3/4"}),e.jsx(a.Skeleton,{className:"h-3 w-1/2"}),e.jsx(a.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(a.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:l,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}),S=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(g,{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(g,{tag:"published"}):e.jsx(g,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:y.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:l})})}),e.jsx(A,{checked:f,disabled:S,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[l,r]=b.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(g,{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(a.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(a.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"})]})]}),l&&(s==null?void 0:s.length)>1&&t&&e.jsx(b.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:l,onOpenChange:r,compare:s})})]})}function A({checked:s,disabled:n,onChange:t,label:l="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:l})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(a.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(a.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(a.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(a.DropdownMenuSeparator,{}),e.jsxs(a.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:l,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(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Restore Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",y.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(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>l(!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(a.Button,{variant:"default",className:"sm:flex-1",onClick:()=>l(!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:l,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(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Delete Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",y.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(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:r,children:"Cancel"}),e.jsx(a.Button,{variant:"destructive",className:"sm:flex-1",onClick:l,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 E,R;const[n,t]=v.useState([]),[l,r]=v.useState(null),[c,x]=v.useState(!1),[m,u]=v.useState(!1),{data:i}=d.useCurrentPage(),{data:f,isFetching:S,error:h,refetch:j}=z(i==null?void 0:i.id),{mutate:k,isPending:M}=B(),{mutate:T,isPending:_}=H(),F=N.useQueryClient(),{selectedLang:P,fallbackLang:q}=O.useLanguages(),U=P||q;b.useEffect(()=>t([]),[i==null?void 0:i.id]);const G=o=>{l&&T({revisionId:l.uid,discardCurrent:o},{onSuccess:()=>{x(!1),r(null),F.invalidateQueries({queryKey:[d.ACTIONS.GET_DRAFT_PAGE]})}})},D=o=>{r(o),x(!0)},C=o=>{r(o),u(!0)},V=()=>{l&&k(l.uid,{onSuccess:()=>{u(!1),r(null)}})};return b.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(a.SheetHeader,{children:[e.jsx(a.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 ",y.format(new Date(i.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),S?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}),(E=f==null?void 0:f.filter(o=>o.uid==="current"))==null?void 0:E.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:!0,onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w,compare:n,setCompare:t},o.uid)),e.jsx(a.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:(R=f==null?void 0:f.filter(o=>o.uid!=="current"))==null?void 0:R.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:o.uid==="current",onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:c,onOpenChange:x,revision:l,onRestore:G,isRestoring:_}),e.jsx(Z,{open:m,onOpenChange:u,revision:l,onDelete:V,isDeleting:M})]})}exports.default=ee;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as n, Fragment as p, jsx as e } from "react/jsx-runtime";
2
- import { al as C, am as A, A as b, aq as j, at as le, aj as I, ar as R, as as w } from "./index-CSOKPmkj.js";
2
+ import { al as C, am as A, A as b, aq as j, at as le, aj as I, ar as R, as as w } from "./index-C_34q9jG.js";
3
3
  import { useQuery as re, useQueryClient as O, useMutation as q } from "@tanstack/react-query";
4
4
  import { useLanguages as ie, useSavePage as de } from "@chaibuilder/sdk";
5
5
  import { SheetHeader as ce, SheetTitle as oe, ScrollArea as ue, Skeleton as y, Button as g, DropdownMenu as me, DropdownMenuTrigger as he, DropdownMenuContent as fe, DropdownMenuItem as U, DropdownMenuSeparator as pe, Dialog as G, DialogContent as L, DialogHeader as P, DialogTitle as $, DialogDescription as z, DialogFooter as H } from "@chaibuilder/sdk/ui";
@@ -46,7 +46,7 @@ const Ae = () => {
46
46
  });
47
47
  }
48
48
  });
49
- }, Oe = Se(() => import("./json-diff-viewer-eh2Twply.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ n("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: [
49
+ }, Oe = Se(() => import("./json-diff-viewer-D2tCblUU.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ n("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: [
50
50
  /* @__PURE__ */ n("span", { className: "relative flex h-2 w-2", children: [
51
51
  /* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
52
52
  /* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
@@ -0,0 +1,5 @@
1
+ import { b as a, d as i } from "./mermaid-parser.core-GitSl6co.js";
2
+ export {
3
+ a as PieModule,
4
+ i as createPieServices
5
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./mermaid-parser.core-Df9eyFSv.cjs");exports.PieModule=e.PieModule;exports.createPieServices=e.createPieServices;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./mermaid-parser.core-DKJdj2_U.cjs");exports.PieModule=e.PieModule;exports.createPieServices=e.createPieServices;
@@ -1,7 +1,7 @@
1
- import { Y as S, P as F, av as K, E as Y, o as Z, p as q, s as H, g as J, c as Q, b as X, _ as g, l as z, v as ee, d as te, F as ae, K as re, a6 as ne, k as ie } from "./mermaid.core-e6RNUZK7.js";
2
- import { p as se } from "./chunk-4BX2VUAB-DcXzX0k2.js";
3
- import { p as le } from "./mermaid-parser.core-Crve7Cv1.js";
4
- import { d as I } from "./arc-CEYgkAY6.js";
1
+ import { Y as S, P as F, av as K, E as Y, o as Z, p as q, s as H, g as J, c as Q, b as X, _ as g, l as z, v as ee, d as te, F as ae, K as re, a6 as ne, k as ie } from "./mermaid.core-3NhAXOzj.js";
2
+ import { p as se } from "./chunk-4BX2VUAB-kRXCJxGQ.js";
3
+ import { p as le } from "./mermaid-parser.core-GitSl6co.js";
4
+ import { d as I } from "./arc-CuYV2Z4i.js";
5
5
  import { o as oe } from "./ordinal-DfAQgscy.js";
6
6
  function ce(e, a) {
7
7
  return a < e ? -1 : a > e ? 1 : a >= e ? 0 : NaN;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./mermaid.core-DY8gIrXk.cjs"),B=require("./chunk-4BX2VUAB-DOrHz66s.cjs"),V=require("./mermaid-parser.core-Df9eyFSv.cjs"),N=require("./arc-DQcgp6fe.cjs"),U=require("./ordinal-CagbB1m8.cjs");function j(e,r){return r<e?-1:r>e?1:r>=e?0:NaN}function X(e){return e}function Z(){var e=X,r=j,f=null,S=t.constant(0),s=t.constant(t.tau),c=t.constant(0);function o(a){var i,u=(a=t.array(a)).length,g,y,h=0,d=new Array(u),l=new Array(u),v=+S.apply(this,arguments),A=Math.min(t.tau,Math.max(-t.tau,s.apply(this,arguments)-v)),m,w=Math.min(Math.abs(A)/u,c.apply(this,arguments)),_=w*(A<0?-1:1),p;for(i=0;i<u;++i)(p=l[d[i]=i]=+e(a[i],i,a))>0&&(h+=p);for(r!=null?d.sort(function(x,D){return r(l[x],l[D])}):f!=null&&d.sort(function(x,D){return f(a[x],a[D])}),i=0,y=h?(A-u*_)/h:0;i<u;++i,v=m)g=d[i],p=l[g],m=v+(p>0?p*y:0)+_,l[g]={data:a[g],index:i,value:p,startAngle:v,endAngle:m,padAngle:w};return l}return o.value=function(a){return arguments.length?(e=typeof a=="function"?a:t.constant(+a),o):e},o.sortValues=function(a){return arguments.length?(r=a,f=null,o):r},o.sort=function(a){return arguments.length?(f=a,r=null,o):f},o.startAngle=function(a){return arguments.length?(S=typeof a=="function"?a:t.constant(+a),o):S},o.endAngle=function(a){return arguments.length?(s=typeof a=="function"?a:t.constant(+a),o):s},o.padAngle=function(a){return arguments.length?(c=typeof a=="function"?a:t.constant(+a),o):c},o}var O=t.defaultConfig_default.pie,E={sections:new Map,showData:!1,config:O},T=E.sections,M=E.showData,H=structuredClone(O),J=t.__name(()=>structuredClone(H),"getConfig"),K=t.__name(()=>{T=new Map,M=E.showData,t.clear()},"clear"),Q=t.__name(({label:e,value:r})=>{if(r<0)throw new Error(`"${e}" has invalid value: ${r}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(e)||(T.set(e,r),t.log.debug(`added new section: ${e}, with value: ${r}`))},"addSection"),Y=t.__name(()=>T,"getSections"),ee=t.__name(e=>{M=e},"setShowData"),te=t.__name(()=>M,"getShowData"),W={getConfig:J,clear:K,setDiagramTitle:t.setDiagramTitle,getDiagramTitle:t.getDiagramTitle,setAccTitle:t.setAccTitle,getAccTitle:t.getAccTitle,setAccDescription:t.setAccDescription,getAccDescription:t.getAccDescription,addSection:Q,getSections:Y,setShowData:ee,getShowData:te},ae=t.__name((e,r)=>{B.populateCommonDb(e,r),r.setShowData(e.showData),e.sections.map(r.addSection)},"populateDb"),re={parse:t.__name(async e=>{const r=await V.parse("pie",e);t.log.debug(r),ae(r,W)},"parse")},ne=t.__name(e=>`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./mermaid.core-Cop_RRH4.cjs"),B=require("./chunk-4BX2VUAB-D0Nkkvke.cjs"),V=require("./mermaid-parser.core-DKJdj2_U.cjs"),N=require("./arc-Dzs-yn9V.cjs"),U=require("./ordinal-CagbB1m8.cjs");function j(e,r){return r<e?-1:r>e?1:r>=e?0:NaN}function X(e){return e}function Z(){var e=X,r=j,f=null,S=t.constant(0),s=t.constant(t.tau),c=t.constant(0);function o(a){var i,u=(a=t.array(a)).length,g,y,h=0,d=new Array(u),l=new Array(u),v=+S.apply(this,arguments),A=Math.min(t.tau,Math.max(-t.tau,s.apply(this,arguments)-v)),m,w=Math.min(Math.abs(A)/u,c.apply(this,arguments)),_=w*(A<0?-1:1),p;for(i=0;i<u;++i)(p=l[d[i]=i]=+e(a[i],i,a))>0&&(h+=p);for(r!=null?d.sort(function(x,D){return r(l[x],l[D])}):f!=null&&d.sort(function(x,D){return f(a[x],a[D])}),i=0,y=h?(A-u*_)/h:0;i<u;++i,v=m)g=d[i],p=l[g],m=v+(p>0?p*y:0)+_,l[g]={data:a[g],index:i,value:p,startAngle:v,endAngle:m,padAngle:w};return l}return o.value=function(a){return arguments.length?(e=typeof a=="function"?a:t.constant(+a),o):e},o.sortValues=function(a){return arguments.length?(r=a,f=null,o):r},o.sort=function(a){return arguments.length?(f=a,r=null,o):f},o.startAngle=function(a){return arguments.length?(S=typeof a=="function"?a:t.constant(+a),o):S},o.endAngle=function(a){return arguments.length?(s=typeof a=="function"?a:t.constant(+a),o):s},o.padAngle=function(a){return arguments.length?(c=typeof a=="function"?a:t.constant(+a),o):c},o}var O=t.defaultConfig_default.pie,E={sections:new Map,showData:!1,config:O},T=E.sections,M=E.showData,H=structuredClone(O),J=t.__name(()=>structuredClone(H),"getConfig"),K=t.__name(()=>{T=new Map,M=E.showData,t.clear()},"clear"),Q=t.__name(({label:e,value:r})=>{if(r<0)throw new Error(`"${e}" has invalid value: ${r}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(e)||(T.set(e,r),t.log.debug(`added new section: ${e}, with value: ${r}`))},"addSection"),Y=t.__name(()=>T,"getSections"),ee=t.__name(e=>{M=e},"setShowData"),te=t.__name(()=>M,"getShowData"),W={getConfig:J,clear:K,setDiagramTitle:t.setDiagramTitle,getDiagramTitle:t.getDiagramTitle,setAccTitle:t.setAccTitle,getAccTitle:t.getAccTitle,setAccDescription:t.setAccDescription,getAccDescription:t.getAccDescription,addSection:Q,getSections:Y,setShowData:ee,getShowData:te},ae=t.__name((e,r)=>{B.populateCommonDb(e,r),r.setShowData(e.showData),e.sections.map(r.addSection)},"populateDb"),re={parse:t.__name(async e=>{const r=await V.parse("pie",e);t.log.debug(r),ae(r,W)},"parse")},ne=t.__name(e=>`
2
2
  .pieCircle{
3
3
  stroke: ${e.pieStrokeColor};
4
4
  stroke-width : ${e.pieStrokeWidth};
@@ -1,6 +1,6 @@
1
1
  import { jsxs as n, jsx as t, Fragment as H } from "react/jsx-runtime";
2
- import { LanguageSelector as z } from "./page-manager-search-and-filter-Dvt-nBOL.js";
3
- import { al as R, am as _, A as L, au as $, f as K, h as Q, aj as J, T as A, t as V } from "./index-CSOKPmkj.js";
2
+ import { LanguageSelector as z } from "./page-manager-search-and-filter-heV_U9x0.js";
3
+ import { al as R, am as _, A as L, au as $, f as K, h as Q, aj as J, T as A, t as V } from "./index-C_34q9jG.js";
4
4
  import { useQuery as W } from "@tanstack/react-query";
5
5
  import { DialogContent as X, DialogHeader as Y, DialogTitle as Z, DialogDescription as ee, DialogFooter as te, Button as F } from "@chaibuilder/sdk/ui";
6
6
  import { find as G, filter as a, map as y, includes as P, orderBy as b, isEmpty as se, first as le, uniq as U, concat as ne } from "lodash-es";