@chaibuilder/sdk 4.0.0-beta.4 → 4.0.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -50
- package/dist/{2SSKDMRQ-Difo_1pg.js → 2SSKDMRQ-CdpXONNF.js} +3 -3
- package/dist/{2SSKDMRQ-CopJgtZb.cjs → 2SSKDMRQ-Dq_oq6gn.cjs} +1 -1
- package/dist/{AP7HFJJL-BPuPBqj4.js → AP7HFJJL-CZb0rAxI.js} +1 -1
- package/dist/{AP7HFJJL-DYxDgaOs.cjs → AP7HFJJL-Do14BULM.cjs} +1 -1
- package/dist/{IconPicker-B2-oriq2.js → IconPicker-CvZSjXc6.js} +2 -2
- package/dist/{IconPicker-C0oycHbs.cjs → IconPicker-DUN9bxmQ.cjs} +1 -1
- package/dist/STRINGS-BExFecZW.js +8 -0
- package/dist/STRINGS-FNnfjF5H.cjs +1 -0
- package/dist/{WDYDFRGG-DbejaRPK.cjs → WDYDFRGG-DfczfcZ8.cjs} +1 -1
- package/dist/{WDYDFRGG-KK8pkcW1.js → WDYDFRGG-Dxa2zFdt.js} +4 -4
- package/dist/{actions-registery-y_ENc8zj.js → actions-registery-CMKfEXxX.js} +3397 -3202
- package/dist/actions-registery-CqhNZFV3.cjs +481 -0
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.ts +0 -158
- package/dist/actions.js +3 -3
- package/dist/{active-in-another-tab-DkR2HWI4.js → active-in-another-tab-BREv3Xj8.js} +5 -5
- package/dist/{active-in-another-tab-Cu_ASKtx.cjs → active-in-another-tab-C9o276yY.cjs} +1 -1
- package/dist/{add-new-language-page-CBY0RR6q.js → add-new-language-page-C4PSVDV5.js} +4 -4
- package/dist/{add-new-language-page-BXuwluuU.cjs → add-new-language-page-jHLJjrl1.cjs} +1 -1
- package/dist/{add-new-page-C_PzKby8.cjs → add-new-page-BPPMxBYi.cjs} +1 -1
- package/dist/add-new-page-DomZuT16.js +31 -0
- package/dist/{ai-panel-content--YM01Aly.js → ai-panel-content-CsmUoTCg.js} +6 -6
- package/dist/{ai-panel-content-rRmJdH7L.cjs → ai-panel-content-DlS51Qef.cjs} +1 -1
- package/dist/ai-panel-default-lang-BRVlAMMU.js +317 -0
- package/dist/ai-panel-default-lang-DVKDEnbe.cjs +3 -0
- package/dist/ai-panel-other-lang-B-2xJz2W.cjs +1 -0
- package/dist/ai-panel-other-lang-BPVS6lO_.js +132 -0
- package/dist/{ai-prompt-input-DueQYNf-.js → ai-prompt-input-B0FMhaLB.js} +30 -34
- package/dist/{ai-prompt-input-N9PcYCFa.cjs → ai-prompt-input-CY2pBPzO.cjs} +1 -1
- package/dist/{ai-translation-prompt-B36F3d7K.js → ai-translation-prompt-6LlaU9LO.js} +2 -2
- package/dist/{ai-translation-prompt-IAdWMNZb.cjs → ai-translation-prompt-BwhKmgC3.cjs} +1 -1
- package/dist/apply-binding-BuwI_Uf5.cjs +41 -0
- package/dist/apply-binding-RQRSIe56.js +942 -0
- package/dist/change-password-modal-BlSTfit6.js +137 -0
- package/dist/change-password-modal-wbCcGfDM.cjs +1 -0
- package/dist/{code-display-DloSPyPr.cjs → code-display-BR-gij5j.cjs} +1 -1
- package/dist/{code-display-Ck81Id9K.js → code-display-DdWcOQ_i.js} +1 -1
- package/dist/code-editor-BC_saYAw.cjs +1 -0
- package/dist/code-editor-Be5VT6om.js +57 -0
- package/dist/{continue-editing-in-this-client-DmGFLHXw.cjs → continue-editing-in-this-client-Bs_3q1hH.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-Dm9cCj7K.js → continue-editing-in-this-client-Z1rBUPU8.js} +3 -3
- package/dist/core-czmLeR0h.cjs +1 -0
- package/dist/core-nSRy3D7z.js +54 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +285 -103
- package/dist/core.js +71 -42
- package/dist/{css-import-modal-9P_0uNa4.js → css-import-modal-DMZRgpy0.js} +8 -8
- package/dist/{css-import-modal-Rh1QAVxo.cjs → css-import-modal-QaTHJ7CT.cjs} +1 -1
- package/dist/delete-page-BoP3I06P.js +84 -0
- package/dist/delete-page-CjXYHAsS.cjs +1 -0
- package/dist/{design-token-usage-MNYsFlPG.js → design-token-usage-DFanW2r-.js} +26 -26
- package/dist/{design-token-usage-CXglXgcJ.cjs → design-token-usage-kEPgi-3C.cjs} +1 -1
- package/dist/{digital-asset-manager-CqCWBO0s.js → digital-asset-manager-BbI7Ye34.js} +6 -6
- package/dist/digital-asset-manager-N8tcW28y.cjs +1 -0
- package/dist/{duplicate-page-DzZByALW.cjs → duplicate-page-B-4nFU4j.cjs} +1 -1
- package/dist/{duplicate-page-BknLfqr0.js → duplicate-page-C6y7FdRQ.js} +7 -7
- package/dist/{dynamic-page-selector-WA007Sni.cjs → dynamic-page-selector-Cq4U-49i.cjs} +1 -1
- package/dist/{dynamic-page-selector-DoW7OyUB.js → dynamic-page-selector-DQCWphi0.js} +16 -16
- package/dist/fonts/bungee/Bungee-Regular.woff2 +0 -0
- package/dist/fonts/dm_sans/dm-sans-variable.woff2 +0 -0
- package/dist/fonts/geist/Geist-VariableFont_wght.ttf +0 -0
- package/dist/fonts/geist/Geist-VariableFont_wght.woff2 +0 -0
- package/dist/fonts/geist/geist-variable.woff2 +0 -0
- package/dist/fonts/geist-mono/GeistMono-VariableFont_wght.woff2 +0 -0
- package/dist/fonts/inter/inter-latin.woff2 +0 -0
- package/dist/fonts/inter/inter-variable.woff2 +1449 -0
- package/dist/fonts/lato/lato-variable.woff2 +0 -0
- package/dist/fonts/lavishly_yours/lavishly-yours.woff2 +11 -0
- package/dist/fonts/merriweather/merriweather-variable.woff2 +11 -0
- package/dist/fonts/montserrat/montserrat-variable.woff2 +0 -0
- package/dist/fonts/nunito_sans/nunito-sans-variable.woff2 +11 -0
- package/dist/fonts/open_sans/open-sans-variable.woff2 +0 -0
- package/dist/fonts/oswald/oswald-variable.woff2 +0 -0
- package/dist/fonts/playfair_display/playfair-display-variable.woff2 +11 -0
- package/dist/fonts/poppins/poppins-variable.woff2 +0 -0
- package/dist/fonts/raleway/raleway-variable.woff2 +0 -0
- package/dist/fonts/roboto/roboto-variable.woff2 +11 -0
- package/dist/fonts/source_sans_3/source-sans-3-variable.woff2 +11 -0
- package/dist/fonts/ubuntu/ubuntu-variable.woff2 +0 -0
- package/dist/fonts-B3UYxuJI.js +25 -0
- package/dist/fonts-D5fTqvSS.cjs +1 -0
- package/dist/{get-chai-builder-tailwind-config-BFePCEIS.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-BXf_xLHk.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +5 -5
- package/dist/{get-chai-builder-theme-BApShjRz.cjs → get-chai-builder-theme-B5RkBTsB.cjs} +1 -1
- package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-BpuwSLeS.js} +1 -1
- package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
- package/dist/image-compression-UaU7Bwqe.cjs +1 -0
- package/dist/{image-editor-CqwaVxO2.cjs → image-editor-565A0NpE.cjs} +1 -1
- package/dist/{image-editor-CQnNtak2.js → image-editor-Dz_HQ0I8.js} +1 -1
- package/dist/index-3pEi7VzS.cjs +5 -0
- package/dist/index-C3CV1lXL.cjs +160 -0
- package/dist/index-CDVuf3C1.js +5118 -0
- package/dist/{index-rAcNbjk_.js → index-wBr2Ml98.js} +6152 -6102
- package/dist/{json-diff-viewer-CLuUHiPU.cjs → json-diff-viewer-CMYFM6D6.cjs} +7 -7
- package/dist/{json-diff-viewer-CMvGUvJ2.js → json-diff-viewer-DG7a5-2B.js} +87 -85
- package/dist/{lang-panel-CnwTb05j.js → lang-panel-BvGiJJ8s.js} +26 -26
- package/dist/lang-panel-D97iJH-l.cjs +1 -0
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
- package/dist/library-blocks/bento/product-features/product-features.html +159 -0
- package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
- package/dist/library-blocks/blocks-list.json +149 -0
- package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
- package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
- package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
- package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
- package/dist/manage-design-tokens-4Gu6TMKZ.js +446 -0
- package/dist/manage-design-tokens-Do9Kptp3.cjs +1 -0
- package/dist/manage-design-tokens-modal-Btbdgoun.cjs +1 -0
- package/dist/manage-design-tokens-modal-CkyFE8NW.js +161 -0
- package/dist/{mark-as-template-DBLshWb5.js → mark-as-template-Djhnj93U.js} +11 -11
- package/dist/{mark-as-template-CpWEBJGd.cjs → mark-as-template-QPJ0DqxL.cjs} +1 -1
- package/dist/{nested-path-selector-content-C2sD9dkq.cjs → nested-path-selector-content-BcmSxXxL.cjs} +1 -1
- package/dist/{nested-path-selector-content-6OBJ8LG8.js → nested-path-selector-content-DkPIHcVj.js} +2 -2
- package/dist/{no-language-page-content-CzENgtnu.js → no-language-page-content-DTq-5StU.js} +9 -9
- package/dist/{no-language-page-content-BvPDdccK.cjs → no-language-page-content-ZQz4Kr0-.cjs} +1 -1
- package/dist/{no-language-page-dialog-CbYI2cVg.js → no-language-page-dialog-2rA-YBbC.js} +2 -2
- package/dist/{no-language-page-dialog-CgW4yJBC.cjs → no-language-page-dialog-BsLkwJID.cjs} +1 -1
- package/dist/{page-creator-Cc83uQqw.js → page-creator-Dzpc0_dN.js} +143 -143
- package/dist/page-creator-lcDUpPjh.cjs +1 -0
- package/dist/{page-lock-CT7SmQqp.cjs → page-lock-B2GU-1YM.cjs} +1 -1
- package/dist/{page-lock-BJUkyxdh.js → page-lock-ulFtdOkt.js} +2 -2
- package/dist/{page-locked-dialog-DsEbWRed.js → page-locked-dialog-B9VpkvhN.js} +22 -22
- package/dist/page-locked-dialog-CJ53Z6sQ.cjs +1 -0
- package/dist/page-manager-new-CkoS0B1i.cjs +1 -0
- package/dist/page-manager-new-OoC8W7Yn.js +408 -0
- package/dist/{page-manager-search-and-filter-Bfm0j1gg.cjs → page-manager-search-and-filter-BosoN3wg.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-zq-LfhQ1.js → page-manager-search-and-filter-JfSTGlvp.js} +30 -29
- package/dist/{page-revisions-content-D38G2tJM.js → page-revisions-content-DsFh5itr.js} +133 -122
- package/dist/page-revisions-content-Dtd-t1N3.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +330 -96
- package/dist/pages.js +23 -19
- package/dist/plugin-BSjgGgwo.js +248 -0
- package/dist/plugin-DHpuZZXz.cjs +22 -0
- package/dist/publish-pages-content-C7oS7pkz.cjs +1 -0
- package/dist/{publish-pages-content-CS7f41Ac.js → publish-pages-content-DJc7iu8d.js} +39 -39
- package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-D6GjnauV.js} +87 -87
- package/dist/register-chai-top-bar-DyW9GPzV.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +20 -18
- package/dist/render.js +133 -132
- package/dist/{rte-widget-modal-BKNx2wln.cjs → rte-widget-modal-BKQaoxh9.cjs} +1 -1
- package/dist/{rte-widget-modal-D6Zik0Ta.js → rte-widget-modal-BdBYmqgs.js} +10 -10
- package/dist/runtime-client.cjs +1 -0
- package/dist/runtime-client.d.ts +158 -0
- package/dist/runtime-client.js +32 -0
- package/dist/runtime.cjs +11 -1
- package/dist/runtime.d.ts +153 -270
- package/dist/runtime.js +107 -71
- package/dist/{save-to-lib-WwOzbgiF.js → save-to-lib-5nwSdZ9R.js} +153 -147
- package/dist/save-to-lib-D0WdH4lq.cjs +1 -0
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-B1SG_UXw.js → selected-block-display-D8ROZHHv.js} +12 -12
- package/dist/{selected-block-display-BOgnQRLF.cjs → selected-block-display-DjYeUPdU.cjs} +1 -1
- package/dist/{seo-panel-BkOgRoWd.js → seo-panel-BbyRNAEo.js} +27 -27
- package/dist/seo-panel-DRjSxmk5.cjs +2 -0
- package/dist/shared-json-ld-BbNLdzCO.cjs +1 -0
- package/dist/{shared-json-ld-uka9TOgA.js → shared-json-ld-EPbpTI9V.js} +88 -88
- package/dist/{slug-input-Cyd6NR6J.cjs → slug-input-CIzxXknM.cjs} +1 -1
- package/dist/{slug-input-DHLmUNrH.js → slug-input-DSbJecNr.js} +8 -8
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +45 -0
- package/dist/supabase-actions.js +380 -275
- package/dist/{take-over-request-Ca0X-qyf.js → take-over-request-BOGDk0H4.js} +13 -13
- package/dist/take-over-request-BXntCMdj.cjs +1 -0
- package/dist/{translation-warning-modal-pSZVKcNW.cjs → translation-warning-modal-DhJaOyLo.cjs} +1 -1
- package/dist/{translation-warning-modal-DrpFeI83.js → translation-warning-modal-reVr0L9e.js} +9 -9
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +756 -0
- package/dist/types.js +1 -0
- package/dist/{unmark-as-template-BMqgelv-.js → unmark-as-template-BM85Y7WK.js} +11 -11
- package/dist/{unmark-as-template-DF1Ms4VN.cjs → unmark-as-template-DOPyeU7R.cjs} +1 -1
- package/dist/unpublish-page-DHfds-1-.js +28 -0
- package/dist/{unpublish-page-Bsq2yEqQ.cjs → unpublish-page-Dz028Bzp.cjs} +1 -1
- package/dist/unpublished-partials-modal-BO5ZZdTw.js +52 -0
- package/dist/unpublished-partials-modal-CMqQa9-m.cjs +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +6 -6
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +360 -351
- package/dist/{web-preview-kres0aG7.cjs → web-preview-5MzixBt5.cjs} +1 -1
- package/dist/{web-preview-D6h1L2nV.js → web-preview-BNjG8s8A.js} +2 -2
- package/package.json +34 -35
- package/dist/actions-registery-JdxhXhT6.cjs +0 -418
- package/dist/add-new-page-DJLJFLAd.js +0 -31
- package/dist/ai-panel-default-lang-BZl0tPYo.js +0 -341
- package/dist/ai-panel-default-lang-D2zhXvKP.cjs +0 -3
- package/dist/ai-panel-other-lang-Bfjk2CYZ.js +0 -162
- package/dist/ai-panel-other-lang-Y4bEKHoG.cjs +0 -1
- package/dist/apply-binding-BvWfJCSZ.js +0 -841
- package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
- package/dist/code-editor-Bb7JumZy.js +0 -51
- package/dist/code-editor-DQB8lAOk.cjs +0 -1
- package/dist/core-Dr7QYemB.js +0 -56
- package/dist/core-Y0lXLwkq.cjs +0 -1
- package/dist/delete-design-token-BG8yHcS5.cjs +0 -1
- package/dist/delete-design-token-COvR4G1S.js +0 -40
- package/dist/delete-page-CNucxe4P.js +0 -71
- package/dist/delete-page-DAvEjHwF.cjs +0 -1
- package/dist/digital-asset-manager-CB5MRBcW.cjs +0 -1
- package/dist/fonts/GeistMonoVF.woff +0 -0
- package/dist/fonts/GeistVF.woff +0 -0
- package/dist/fonts-B-Xt29pe.cjs +0 -1
- package/dist/fonts-DRly3Wzd.js +0 -78
- package/dist/image-compression-DZ9WMmyn.cjs +0 -1
- package/dist/index-B-rSiAp_.cjs +0 -1
- package/dist/index-C0-pgg_p.cjs +0 -5
- package/dist/index-C99FhuF1.cjs +0 -160
- package/dist/index-Dno42B0a.js +0 -4734
- package/dist/index-Dxfyt4d4.js +0 -39
- package/dist/lang-panel-fDCYm5Jm.cjs +0 -1
- package/dist/manage-design-tokens-BsSZE9Vs.js +0 -241
- package/dist/manage-design-tokens-BvH5KTJX.cjs +0 -1
- package/dist/page-creator-g8GqgcKH.cjs +0 -1
- package/dist/page-locked-dialog-Co5b9XIZ.cjs +0 -1
- package/dist/page-manager-new-5rFP5DyQ.js +0 -395
- package/dist/page-manager-new-BOkJImo2.cjs +0 -1
- package/dist/page-revisions-content-ag-MHBGr.cjs +0 -1
- package/dist/plugin-BGlQf0iy.cjs +0 -22
- package/dist/plugin-C-ht41UZ.js +0 -245
- package/dist/publish-pages-content-BiX-GMLw.cjs +0 -1
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
- package/dist/save-to-lib-ffjCZYJ5.cjs +0 -1
- package/dist/seo-panel-FjS1UF_y.cjs +0 -2
- package/dist/shared-json-ld-yJkXjENy.cjs +0 -1
- package/dist/take-over-request-CmpJVe9T.cjs +0 -1
- package/dist/theme-panel-footer-BUXIu252.js +0 -26
- package/dist/theme-panel-footer-CKO9YYwZ.cjs +0 -1
- package/dist/unpublish-page-BJ0Bsvt2.js +0 -28
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
2
|
-
import { D as t, d as c, e as p, f as m, p as h } from "./index-rAcNbjk_.js";
|
|
3
|
-
import { Suspense as f, lazy as D } from "react";
|
|
4
|
-
import { useTranslation as u } from "react-i18next";
|
|
5
|
-
const x = D(() => import("./page-creator-Cc83uQqw.js")), C = ({
|
|
6
|
-
addEditPage: e,
|
|
7
|
-
setAddEditPage: s,
|
|
8
|
-
closePanel: l
|
|
9
|
-
}) => {
|
|
10
|
-
const { t: n } = u(), a = !!(e != null && e.id), i = !!e;
|
|
11
|
-
return /* @__PURE__ */ o(t, { open: i, onOpenChange: () => s(void 0), children: i && /* @__PURE__ */ r(c, { className: "sm:max-w-[425px]", children: [
|
|
12
|
-
/* @__PURE__ */ r(p, { children: [
|
|
13
|
-
/* @__PURE__ */ r(m, { children: [
|
|
14
|
-
n(a ? "Edit" : "Add New"),
|
|
15
|
-
" "
|
|
16
|
-
] }),
|
|
17
|
-
/* @__PURE__ */ o(h, { children: n(a ? "Update your page name" : "Enter details to create a new page") })
|
|
18
|
-
] }),
|
|
19
|
-
/* @__PURE__ */ o(f, { fallback: /* @__PURE__ */ o("div", { className: "min-h-40" }), children: /* @__PURE__ */ o(
|
|
20
|
-
x,
|
|
21
|
-
{
|
|
22
|
-
closePanel: l,
|
|
23
|
-
addEditPage: e,
|
|
24
|
-
close: () => s(void 0)
|
|
25
|
-
}
|
|
26
|
-
) })
|
|
27
|
-
] }) });
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
C as default
|
|
31
|
-
};
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { jsxs as D, Fragment as W, jsx as g } from "react/jsx-runtime";
|
|
2
|
-
import { a as _, ah as F, ai as $, aj as q, ak as V, al as K, am as j, an as U, ao as G, ap as z } from "./index-rAcNbjk_.js";
|
|
3
|
-
import { C as Q, a as J, b as X, R as Y, c as Z, d as tt, T as et, M as nt, e as rt, f as st, g as ot, S as at, h as it } from "./selected-block-display-B1SG_UXw.js";
|
|
4
|
-
import { Bot as ct } from "lucide-react";
|
|
5
|
-
import { useCallback as P, Fragment as lt, Suspense as ut, lazy as dt } from "react";
|
|
6
|
-
import { toast as ft } from "sonner";
|
|
7
|
-
import { g as mt } from "./models-D95ZYr_x.js";
|
|
8
|
-
import { find as pt } from "lodash-es";
|
|
9
|
-
import { g as L } from "./apply-binding-BvWfJCSZ.js";
|
|
10
|
-
import { useQueryClient as ht } from "@tanstack/react-query";
|
|
11
|
-
const O = (i, k) => {
|
|
12
|
-
const m = i.filter((h) => h._parent === k), S = m.map((h) => h._id), A = m.flatMap((h) => O(i, h._id));
|
|
13
|
-
return [...S, ...A];
|
|
14
|
-
}, gt = (i, k, m) => {
|
|
15
|
-
const S = pt(i, { _id: k });
|
|
16
|
-
if (!S) return i;
|
|
17
|
-
const A = i.findIndex((p) => p._id === k), h = O(i, k), v = /* @__PURE__ */ new Set([k, ...h]), l = i.filter((p) => !v.has(p._id)), T = new Set(m.map((p) => p._id)), E = m.map((p) => !p._parent || !T.has(p._parent) ? { ...p, _parent: S._parent } : p);
|
|
18
|
-
return [
|
|
19
|
-
...l.slice(0, A),
|
|
20
|
-
...E,
|
|
21
|
-
...l.slice(A)
|
|
22
|
-
];
|
|
23
|
-
}, At = () => {
|
|
24
|
-
const [, i] = _(), { setNewBlocks: k } = F(), { hasPermission: m } = $();
|
|
25
|
-
return P(
|
|
26
|
-
(S, A) => {
|
|
27
|
-
if (!m(q.EDIT_BLOCK)) return;
|
|
28
|
-
const h = V.get(K), v = S ? gt(h, S, A) : A;
|
|
29
|
-
k(v), A.length > 0 && setTimeout(() => i([A[0]._id]), 200);
|
|
30
|
-
},
|
|
31
|
-
[i, k, m]
|
|
32
|
-
);
|
|
33
|
-
}, kt = () => {
|
|
34
|
-
const { addPredefinedBlock: i } = j(), k = At(), m = U(), S = ht(), A = async (s, e) => {
|
|
35
|
-
if (!e) return;
|
|
36
|
-
const r = L(e);
|
|
37
|
-
await i(r, s.parentId, s.position);
|
|
38
|
-
}, h = async (s, e) => {
|
|
39
|
-
if (!s.blockId || !e) return;
|
|
40
|
-
const r = L(e);
|
|
41
|
-
await k(s.blockId, r);
|
|
42
|
-
}, v = async (s) => {
|
|
43
|
-
!s.ids || s.ids.length === 0 || await m(s.ids);
|
|
44
|
-
};
|
|
45
|
-
let l = null;
|
|
46
|
-
const T = (s, e) => {
|
|
47
|
-
const r = document.getElementById("canvas-iframe");
|
|
48
|
-
if (!r)
|
|
49
|
-
return null;
|
|
50
|
-
const u = r == null ? void 0 : r.contentDocument;
|
|
51
|
-
if (!u)
|
|
52
|
-
return null;
|
|
53
|
-
u.querySelectorAll("[data-stream-canvas]").forEach((f) => f.remove());
|
|
54
|
-
let n = null;
|
|
55
|
-
if (s && s !== "undefined" && (n = u.querySelector(`[data-block-id="${s}"]`)), n || (n = u.body), !n)
|
|
56
|
-
return null;
|
|
57
|
-
if (l = u.createElement("div"), l.setAttribute("data-stream-canvas", "true"), e !== void 0 && e >= 0 && n.children) {
|
|
58
|
-
const f = Math.min(e, n.children.length);
|
|
59
|
-
f < n.children.length ? n.insertBefore(l, n.children[f]) : n.appendChild(l);
|
|
60
|
-
} else
|
|
61
|
-
n.appendChild(l);
|
|
62
|
-
return l;
|
|
63
|
-
}, E = (s) => {
|
|
64
|
-
var n;
|
|
65
|
-
const e = document.getElementById("canvas-iframe");
|
|
66
|
-
if (!e)
|
|
67
|
-
return null;
|
|
68
|
-
const r = e == null ? void 0 : e.contentDocument;
|
|
69
|
-
if (!r)
|
|
70
|
-
return null;
|
|
71
|
-
r.querySelectorAll("[data-stream-canvas]").forEach((f) => f.remove());
|
|
72
|
-
const d = r.querySelector(`[data-block-id="${s}"]`);
|
|
73
|
-
return d ? (l = r.createElement("div"), l.setAttribute("data-stream-canvas", "true"), (n = d.parentNode) == null || n.insertBefore(l, d.nextSibling), d.style.display = "none", l) : null;
|
|
74
|
-
}, R = (s, e, r) => {
|
|
75
|
-
const u = T(e, r);
|
|
76
|
-
if (u) {
|
|
77
|
-
u.innerHTML = s;
|
|
78
|
-
const d = u.getBoundingClientRect(), n = document.getElementById("canvas-iframe"), f = n == null ? void 0 : n.contentWindow;
|
|
79
|
-
f && (d.top >= 0 && d.bottom <= f.innerHeight || u.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
80
|
-
}
|
|
81
|
-
}, p = (s, e) => {
|
|
82
|
-
const r = E(e);
|
|
83
|
-
r && (r.innerHTML = s);
|
|
84
|
-
}, M = (s) => {
|
|
85
|
-
const e = s.match(/^--ACTION=(.+)--$/);
|
|
86
|
-
if (!e) return null;
|
|
87
|
-
let u = e[1].replace(/--/g, "").split("|");
|
|
88
|
-
const n = { type: u[0] };
|
|
89
|
-
return u.forEach((f) => {
|
|
90
|
-
const t = f.trim();
|
|
91
|
-
if (t.startsWith("PARENT=")) {
|
|
92
|
-
const C = t.substring(7);
|
|
93
|
-
n.parentId = C === "undefined" ? void 0 : C;
|
|
94
|
-
} else t.startsWith("POS=") ? n.position = parseInt(t.substring(4)) : t.startsWith("ID=") ? n.blockId = t.substring(3) : t.startsWith("IDS=") && (n.ids = t.substring(4).split(",").map((C) => C.trim()));
|
|
95
|
-
}), n;
|
|
96
|
-
};
|
|
97
|
-
return P(
|
|
98
|
-
async (s, e) => {
|
|
99
|
-
const r = new TextDecoder();
|
|
100
|
-
let u = "", d = "", n = !1, f = null;
|
|
101
|
-
const t = {
|
|
102
|
-
isInAction: !1,
|
|
103
|
-
currentAction: null,
|
|
104
|
-
htmlBuffer: "",
|
|
105
|
-
isCapturingHtml: !1
|
|
106
|
-
}, C = async (I) => {
|
|
107
|
-
const o = I.trim();
|
|
108
|
-
if (o === "--START--") {
|
|
109
|
-
n = !0;
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (n) {
|
|
113
|
-
if (o === "--END--") {
|
|
114
|
-
t.currentAction && (t.htmlBuffer || t.currentAction.type === "REMOVE") && await b(t.currentAction, t.htmlBuffer), l && (l.remove(), l = null);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (o.startsWith("--THINKING=")) {
|
|
118
|
-
const a = o.substring(11);
|
|
119
|
-
e((c) => {
|
|
120
|
-
const y = [...c], B = y[y.length - 1];
|
|
121
|
-
if (B && B.role === "assistant" && B.isReasoning)
|
|
122
|
-
B.content = a, B.isStreaming = !1;
|
|
123
|
-
else {
|
|
124
|
-
const w = {
|
|
125
|
-
id: Date.now().toString(),
|
|
126
|
-
role: "assistant",
|
|
127
|
-
content: a,
|
|
128
|
-
isReasoning: !0,
|
|
129
|
-
isStreaming: !1
|
|
130
|
-
};
|
|
131
|
-
y.push(w);
|
|
132
|
-
}
|
|
133
|
-
return y;
|
|
134
|
-
});
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (o.startsWith("--TASK=")) {
|
|
138
|
-
const a = o.substring(7), c = `task-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, y = {
|
|
139
|
-
id: c,
|
|
140
|
-
role: "assistant",
|
|
141
|
-
content: a.replace(/--$/, ""),
|
|
142
|
-
isTask: !0,
|
|
143
|
-
isTaskLoading: !0,
|
|
144
|
-
isTaskCompleted: !1
|
|
145
|
-
};
|
|
146
|
-
f = c, e((B) => [...B, y]);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
if (o.startsWith("--MSG=")) {
|
|
150
|
-
const a = o.substring(6), c = {
|
|
151
|
-
id: Date.now().toString(),
|
|
152
|
-
role: "assistant",
|
|
153
|
-
content: a.replace(/--$/g, ""),
|
|
154
|
-
isReasoning: !1,
|
|
155
|
-
isStreaming: !1
|
|
156
|
-
};
|
|
157
|
-
e((y) => [...y, c]);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (o.startsWith("--ACTION=")) {
|
|
161
|
-
t.currentAction && (t.htmlBuffer || t.currentAction.type === "REMOVE") && await b(t.currentAction, t.htmlBuffer), t.currentAction = M(o), t.htmlBuffer = "", t.isInAction = !0;
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (o === "--ENDACTION--") {
|
|
165
|
-
t.currentAction && (t.htmlBuffer || t.currentAction.type === "REMOVE") && await b(t.currentAction, t.htmlBuffer), f && (e((a) => a.map((c) => c.isTask ? { ...c, isTaskCompleted: !0 } : c)), f = null), t.currentAction = null, t.htmlBuffer = "", t.isInAction = !1;
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (o === "--HTML--") {
|
|
169
|
-
t.isCapturingHtml = !0;
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (o === "--ENDHTML--") {
|
|
173
|
-
t.isCapturingHtml = !1;
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
if (o.startsWith("--HTML--") && o.includes("--ENDHTML--")) {
|
|
177
|
-
const a = o.match(/^--HTML--(.+?)--ENDHTML--$/);
|
|
178
|
-
if (a && t.currentAction) {
|
|
179
|
-
const c = a[1];
|
|
180
|
-
t.htmlBuffer += c, t.currentAction.type === "ADD" ? R(t.htmlBuffer, t.currentAction.parentId, t.currentAction.position) : t.currentAction.type === "EDIT" && t.currentAction.blockId && p(t.htmlBuffer, t.currentAction.blockId);
|
|
181
|
-
}
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
t.isCapturingHtml && t.currentAction && (t.htmlBuffer += I + `
|
|
185
|
-
`, t.currentAction.type === "ADD" ? R(t.htmlBuffer, t.currentAction.parentId, t.currentAction.position) : t.currentAction.type === "EDIT" && t.currentAction.blockId && p(t.htmlBuffer, t.currentAction.blockId));
|
|
186
|
-
}
|
|
187
|
-
}, b = async (I, o) => {
|
|
188
|
-
try {
|
|
189
|
-
switch (I.type) {
|
|
190
|
-
case "ADD":
|
|
191
|
-
await A(I, o);
|
|
192
|
-
break;
|
|
193
|
-
case "EDIT":
|
|
194
|
-
await h(I, o);
|
|
195
|
-
break;
|
|
196
|
-
case "REMOVE":
|
|
197
|
-
await v(I);
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
e((a) => a.filter((c) => !c.isTask));
|
|
201
|
-
} catch (a) {
|
|
202
|
-
console.log(a);
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
try {
|
|
206
|
-
for (; ; ) {
|
|
207
|
-
const { done: I, value: o } = await s.read();
|
|
208
|
-
if (I) break;
|
|
209
|
-
const a = r.decode(o, { stream: !0 });
|
|
210
|
-
u += a, d += a;
|
|
211
|
-
const c = d.split(`
|
|
212
|
-
`);
|
|
213
|
-
d = c.pop() || "";
|
|
214
|
-
for (const y of c)
|
|
215
|
-
await C(y);
|
|
216
|
-
}
|
|
217
|
-
d && await C(d), S.invalidateQueries({
|
|
218
|
-
queryKey: ["AI_USAGE"]
|
|
219
|
-
});
|
|
220
|
-
} catch (I) {
|
|
221
|
-
console.log(I);
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
[m]
|
|
225
|
-
);
|
|
226
|
-
}, It = dt(() => import("./ai-prompt-input-DueQYNf-.js")), Mt = ({
|
|
227
|
-
t: i,
|
|
228
|
-
fetch: k,
|
|
229
|
-
input: m,
|
|
230
|
-
messages: S,
|
|
231
|
-
setInput: A,
|
|
232
|
-
isLoading: h,
|
|
233
|
-
setMessages: v,
|
|
234
|
-
handleStop: l,
|
|
235
|
-
setIsLoading: T,
|
|
236
|
-
currentBlock: E,
|
|
237
|
-
fallbackLang: R,
|
|
238
|
-
setCurrentBlock: p,
|
|
239
|
-
setAbortController: M,
|
|
240
|
-
selectedModel: s = mt().id,
|
|
241
|
-
onModelChange: e
|
|
242
|
-
}) => {
|
|
243
|
-
const r = G(), [, u] = _(), d = z(), n = kt(), f = async (t, C, b, I) => {
|
|
244
|
-
var B;
|
|
245
|
-
if (!t || h) return;
|
|
246
|
-
p(r);
|
|
247
|
-
const o = d(r ? { blockId: r._id, additionalCoreBlocks: ["Icon"] } : { additionalCoreBlocks: ["Icon"] });
|
|
248
|
-
if (r && !o) {
|
|
249
|
-
ft.error(i("Something went wrong. Please try again."));
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
const a = {
|
|
253
|
-
id: Date.now().toString(),
|
|
254
|
-
role: "user",
|
|
255
|
-
content: it({
|
|
256
|
-
language: R,
|
|
257
|
-
userInput: C || t,
|
|
258
|
-
currentHtml: o
|
|
259
|
-
}),
|
|
260
|
-
userMessage: t
|
|
261
|
-
}, c = {
|
|
262
|
-
id: (Date.now() + 1).toString(),
|
|
263
|
-
role: "assistant",
|
|
264
|
-
content: "",
|
|
265
|
-
isReasoning: !0,
|
|
266
|
-
isStreaming: !0
|
|
267
|
-
};
|
|
268
|
-
v((w) => [...w, a, c]), T(!0);
|
|
269
|
-
const y = new AbortController();
|
|
270
|
-
M(y);
|
|
271
|
-
try {
|
|
272
|
-
const w = {
|
|
273
|
-
messages: [a].map((H) => ({
|
|
274
|
-
role: H.role,
|
|
275
|
-
content: H.content
|
|
276
|
-
})),
|
|
277
|
-
model: I || s
|
|
278
|
-
};
|
|
279
|
-
b && (w.image = b);
|
|
280
|
-
const x = await k({ body: { action: "ASK_AI", data: w }, streamResponse: !0 });
|
|
281
|
-
if (!x.ok)
|
|
282
|
-
throw new Error(i("Failed to get AI response"));
|
|
283
|
-
const N = (B = x.body) == null ? void 0 : B.getReader();
|
|
284
|
-
if (!N) throw new Error(i("Response body is not readable"));
|
|
285
|
-
await n(N, v);
|
|
286
|
-
} catch (w) {
|
|
287
|
-
if (w.name !== "AbortError") {
|
|
288
|
-
const x = {
|
|
289
|
-
id: (Date.now() + 1).toString(),
|
|
290
|
-
role: "assistant",
|
|
291
|
-
content: i("Sorry, I encountered an error. Please try again.")
|
|
292
|
-
};
|
|
293
|
-
v((N) => [...N, x]);
|
|
294
|
-
}
|
|
295
|
-
} finally {
|
|
296
|
-
A(""), T(!1), p(null), M(null);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
return /* @__PURE__ */ D(W, { children: [
|
|
300
|
-
/* @__PURE__ */ D(Q, { className: "no-scrollbar", children: [
|
|
301
|
-
/* @__PURE__ */ D(J, { className: "gap-2 px-0", children: [
|
|
302
|
-
S.length === 0 && /* @__PURE__ */ g(
|
|
303
|
-
X,
|
|
304
|
-
{
|
|
305
|
-
icon: /* @__PURE__ */ g(ct, { size: 48, className: "text-gray-300" }),
|
|
306
|
-
title: "Start a conversation",
|
|
307
|
-
description: i("Start a conversation with the AI assistant to add/edit current page")
|
|
308
|
-
}
|
|
309
|
-
),
|
|
310
|
-
S.map(
|
|
311
|
-
(t) => t.role !== "system" && /* @__PURE__ */ g(lt, { children: t.isReasoning ? /* @__PURE__ */ D(Y, { isStreaming: t.isStreaming, defaultOpen: !0, children: [
|
|
312
|
-
/* @__PURE__ */ g(Z, { className: "text-xs [&_p]:text-muted-foreground" }),
|
|
313
|
-
/* @__PURE__ */ g(tt, { className: "p-0 text-xs", children: t.content })
|
|
314
|
-
] }) : t.isTask && !t.isTaskCompleted ? /* @__PURE__ */ g(et, { content: t.content, isLoading: t.isTaskLoading }) : /* @__PURE__ */ g(nt, { from: t.role, children: /* @__PURE__ */ g(rt, { className: "p-0", children: t.role === "assistant" ? /* @__PURE__ */ g(st, { className: "p-0 text-xs", children: t.content }) : /* @__PURE__ */ g("div", { className: "p-0 text-xs", children: t.userMessage || t.content }) }) }) }, t.id)
|
|
315
|
-
)
|
|
316
|
-
] }),
|
|
317
|
-
/* @__PURE__ */ g(ot, {})
|
|
318
|
-
] }),
|
|
319
|
-
/* @__PURE__ */ D("div", { className: "border-gray-200 pb-2", children: [
|
|
320
|
-
/* @__PURE__ */ g(at, { onRemove: () => u([]), isLoading: h }),
|
|
321
|
-
/* @__PURE__ */ g(ut, { fallback: /* @__PURE__ */ g("div", { children: "Loading..." }), children: /* @__PURE__ */ g(
|
|
322
|
-
It,
|
|
323
|
-
{
|
|
324
|
-
input: m,
|
|
325
|
-
setInput: A,
|
|
326
|
-
onSend: f,
|
|
327
|
-
onStop: l,
|
|
328
|
-
isLoading: h,
|
|
329
|
-
selectedLang: "",
|
|
330
|
-
currentBlock: r || E,
|
|
331
|
-
disabled: (m == null ? void 0 : m.length) === 0,
|
|
332
|
-
selectedModel: s,
|
|
333
|
-
onModelChange: e
|
|
334
|
-
}
|
|
335
|
-
) })
|
|
336
|
-
] })
|
|
337
|
-
] });
|
|
338
|
-
};
|
|
339
|
-
export {
|
|
340
|
-
Mt as default
|
|
341
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),v=require("./index-C99FhuF1.cjs"),S=require("./selected-block-display-BOgnQRLF.cjs"),P=require("lucide-react"),j=require("react"),O=require("sonner"),W=require("./models-5gOsRC56.cjs"),F=require("lodash-es"),q=require("./apply-binding-IsUf6UWJ.cjs"),$=require("@tanstack/react-query"),_=(a,k)=>{const h=a.filter(p=>p._parent===k),I=h.map(p=>p._id),A=h.flatMap(p=>_(a,p._id));return[...I,...A]},V=(a,k,h)=>{const I=F.find(a,{_id:k});if(!I)return a;const A=a.findIndex(g=>g._id===k),p=_(a,k),C=new Set([k,...p]),u=a.filter(g=>!C.has(g._id)),w=new Set(h.map(g=>g._id)),R=h.map(g=>!g._parent||!w.has(g._parent)?{...g,_parent:I._parent}:g);return[...u.slice(0,A),...R,...u.slice(A)]},K=()=>{const[,a]=v.useSelectedBlockIds(),{setNewBlocks:k}=v.useBlocksStoreUndoableActions(),{hasPermission:h}=v.usePermissions();return j.useCallback((I,A)=>{if(!h(v.PERMISSIONS.EDIT_BLOCK))return;const p=v.builderStore.get(v.presentBlocksAtom),C=I?V(p,I,A):A;k(C),A.length>0&&setTimeout(()=>a([A[0]._id]),200)},[a,k,h])},U=()=>{const{addPredefinedBlock:a}=v.useAddBlock(),k=K(),h=v.useRemoveBlocks(),I=$.useQueryClient(),A=async(s,e)=>{if(!e)return;const r=q.getBlocksFromHTML(e);await a(r,s.parentId,s.position)},p=async(s,e)=>{if(!s.blockId||!e)return;const r=q.getBlocksFromHTML(e);await k(s.blockId,r)},C=async s=>{!s.ids||s.ids.length===0||await h(s.ids)};let u=null;const w=(s,e)=>{const r=document.getElementById("canvas-iframe");if(!r)return null;const d=r==null?void 0:r.contentDocument;if(!d)return null;d.querySelectorAll("[data-stream-canvas]").forEach(m=>m.remove());let n=null;if(s&&s!=="undefined"&&(n=d.querySelector(`[data-block-id="${s}"]`)),n||(n=d.body),!n)return null;if(u=d.createElement("div"),u.setAttribute("data-stream-canvas","true"),e!==void 0&&e>=0&&n.children){const m=Math.min(e,n.children.length);m<n.children.length?n.insertBefore(u,n.children[m]):n.appendChild(u)}else n.appendChild(u);return u},R=s=>{var n;const e=document.getElementById("canvas-iframe");if(!e)return null;const r=e==null?void 0:e.contentDocument;if(!r)return null;r.querySelectorAll("[data-stream-canvas]").forEach(m=>m.remove());const f=r.querySelector(`[data-block-id="${s}"]`);return f?(u=r.createElement("div"),u.setAttribute("data-stream-canvas","true"),(n=f.parentNode)==null||n.insertBefore(u,f.nextSibling),f.style.display="none",u):null},M=(s,e,r)=>{const d=w(e,r);if(d){d.innerHTML=s;const f=d.getBoundingClientRect(),n=document.getElementById("canvas-iframe"),m=n==null?void 0:n.contentWindow;m&&(f.top>=0&&f.bottom<=m.innerHeight||d.scrollIntoView({behavior:"smooth",block:"nearest"}))}},g=(s,e)=>{const r=R(e);r&&(r.innerHTML=s)},D=s=>{const e=s.match(/^--ACTION=(.+)--$/);if(!e)return null;let d=e[1].replace(/--/g,"").split("|");const n={type:d[0]};return d.forEach(m=>{const t=m.trim();if(t.startsWith("PARENT=")){const T=t.substring(7);n.parentId=T==="undefined"?void 0:T}else t.startsWith("POS=")?n.position=parseInt(t.substring(4)):t.startsWith("ID=")?n.blockId=t.substring(3):t.startsWith("IDS=")&&(n.ids=t.substring(4).split(",").map(T=>T.trim()))}),n};return j.useCallback(async(s,e)=>{const r=new TextDecoder;let d="",f="",n=!1,m=null;const t={isInAction:!1,currentAction:null,htmlBuffer:"",isCapturingHtml:!1},T=async y=>{const o=y.trim();if(o==="--START--"){n=!0;return}if(n){if(o==="--END--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),u&&(u.remove(),u=null);return}if(o.startsWith("--THINKING=")){const i=o.substring(11);e(l=>{const B=[...l],x=B[B.length-1];if(x&&x.role==="assistant"&&x.isReasoning)x.content=i,x.isStreaming=!1;else{const b={id:Date.now().toString(),role:"assistant",content:i,isReasoning:!0,isStreaming:!1};B.push(b)}return B});return}if(o.startsWith("--TASK=")){const i=o.substring(7),l=`task-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,B={id:l,role:"assistant",content:i.replace(/--$/,""),isTask:!0,isTaskLoading:!0,isTaskCompleted:!1};m=l,e(x=>[...x,B]);return}if(o.startsWith("--MSG=")){const i=o.substring(6),l={id:Date.now().toString(),role:"assistant",content:i.replace(/--$/g,""),isReasoning:!1,isStreaming:!1};e(B=>[...B,l]);return}if(o.startsWith("--ACTION=")){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),t.currentAction=D(o),t.htmlBuffer="",t.isInAction=!0;return}if(o==="--ENDACTION--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await E(t.currentAction,t.htmlBuffer),m&&(e(i=>i.map(l=>l.isTask?{...l,isTaskCompleted:!0}:l)),m=null),t.currentAction=null,t.htmlBuffer="",t.isInAction=!1;return}if(o==="--HTML--"){t.isCapturingHtml=!0;return}if(o==="--ENDHTML--"){t.isCapturingHtml=!1;return}if(o.startsWith("--HTML--")&&o.includes("--ENDHTML--")){const i=o.match(/^--HTML--(.+?)--ENDHTML--$/);if(i&&t.currentAction){const l=i[1];t.htmlBuffer+=l,t.currentAction.type==="ADD"?M(t.htmlBuffer,t.currentAction.parentId,t.currentAction.position):t.currentAction.type==="EDIT"&&t.currentAction.blockId&&g(t.htmlBuffer,t.currentAction.blockId)}return}t.isCapturingHtml&&t.currentAction&&(t.htmlBuffer+=y+`
|
|
2
|
-
`,t.currentAction.type==="ADD"?M(t.htmlBuffer,t.currentAction.parentId,t.currentAction.position):t.currentAction.type==="EDIT"&&t.currentAction.blockId&&g(t.htmlBuffer,t.currentAction.blockId))}},E=async(y,o)=>{try{switch(y.type){case"ADD":await A(y,o);break;case"EDIT":await p(y,o);break;case"REMOVE":await C(y);break}e(i=>i.filter(l=>!l.isTask))}catch(i){console.log(i)}};try{for(;;){const{done:y,value:o}=await s.read();if(y)break;const i=r.decode(o,{stream:!0});d+=i,f+=i;const l=f.split(`
|
|
3
|
-
`);f=l.pop()||"";for(const B of l)await T(B)}f&&await T(f),I.invalidateQueries({queryKey:["AI_USAGE"]})}catch(y){console.log(y)}},[h])},G=j.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-N9PcYCFa.cjs"))),Q=({t:a,fetch:k,input:h,messages:I,setInput:A,isLoading:p,setMessages:C,handleStop:u,setIsLoading:w,currentBlock:R,fallbackLang:M,setCurrentBlock:g,setAbortController:D,selectedModel:s=W.getDefaultModel().id,onModelChange:e})=>{const r=v.useSelectedBlock(),[,d]=v.useSelectedBlockIds(),f=v.useBlocksHtmlForAi(),n=U(),m=async(t,T,E,y)=>{var x;if(!t||p)return;g(r);const o=f(r?{blockId:r._id,additionalCoreBlocks:["Icon"]}:{additionalCoreBlocks:["Icon"]});if(r&&!o){O.toast.error(a("Something went wrong. Please try again."));return}const i={id:Date.now().toString(),role:"user",content:S.getUserPrompt({language:M,userInput:T||t,currentHtml:o}),userMessage:t},l={id:(Date.now()+1).toString(),role:"assistant",content:"",isReasoning:!0,isStreaming:!0};C(b=>[...b,i,l]),w(!0);const B=new AbortController;D(B);try{const b={messages:[i].map(L=>({role:L.role,content:L.content})),model:y||s};E&&(b.image=E);const N=await k({body:{action:"ASK_AI",data:b},streamResponse:!0});if(!N.ok)throw new Error(a("Failed to get AI response"));const H=(x=N.body)==null?void 0:x.getReader();if(!H)throw new Error(a("Response body is not readable"));await n(H,C)}catch(b){if(b.name!=="AbortError"){const N={id:(Date.now()+1).toString(),role:"assistant",content:a("Sorry, I encountered an error. Please try again.")};C(H=>[...H,N])}}finally{A(""),w(!1),g(null),D(null)}};return c.jsxs(c.Fragment,{children:[c.jsxs(S.Conversation,{className:"no-scrollbar",children:[c.jsxs(S.ConversationContent,{className:"gap-2 px-0",children:[I.length===0&&c.jsx(S.ConversationEmptyState,{icon:c.jsx(P.Bot,{size:48,className:"text-gray-300"}),title:"Start a conversation",description:a("Start a conversation with the AI assistant to add/edit current page")}),I.map(t=>t.role!=="system"&&c.jsx(j.Fragment,{children:t.isReasoning?c.jsxs(S.Reasoning,{isStreaming:t.isStreaming,defaultOpen:!0,children:[c.jsx(S.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),c.jsx(S.ReasoningContent,{className:"p-0 text-xs",children:t.content})]}):t.isTask&&!t.isTaskCompleted?c.jsx(S.TaskMessage,{content:t.content,isLoading:t.isTaskLoading}):c.jsx(S.Message,{from:t.role,children:c.jsx(S.MessageContent,{className:"p-0",children:t.role==="assistant"?c.jsx(S.MessageResponse,{className:"p-0 text-xs",children:t.content}):c.jsx("div",{className:"p-0 text-xs",children:t.userMessage||t.content})})})},t.id))]}),c.jsx(S.ConversationScrollButton,{})]}),c.jsxs("div",{className:"border-gray-200 pb-2",children:[c.jsx(S.SelectedBlockDisplay,{onRemove:()=>d([]),isLoading:p}),c.jsx(j.Suspense,{fallback:c.jsx("div",{children:"Loading..."}),children:c.jsx(G,{input:h,setInput:A,onSend:m,onStop:u,isLoading:p,selectedLang:"",currentBlock:r||R,disabled:(h==null?void 0:h.length)===0,selectedModel:s,onModelChange:e})})]})]})};exports.default=Q;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { jsxs as p, Fragment as H, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { ao as P, ad as Q, a as X, aq as Y } from "./index-rAcNbjk_.js";
|
|
3
|
-
import { compact as Z, pick as ee, each as te, get as v } from "lodash-es";
|
|
4
|
-
import { useCallback as ne, useRef as se, useEffect as oe, Suspense as M, lazy as E, Fragment as re } from "react";
|
|
5
|
-
import { e as ae } from "./core-Dr7QYemB.js";
|
|
6
|
-
import { C as ie, a as ce, b as le, R as de, c as ue, d as he, T as me, M as fe, e as pe, f as ge, S as ye, i as Se } from "./selected-block-display-B1SG_UXw.js";
|
|
7
|
-
import { Bot as Te } from "lucide-react";
|
|
8
|
-
import { useTranslation as ke } from "react-i18next";
|
|
9
|
-
import { g as Ne } from "./models-D95ZYr_x.js";
|
|
10
|
-
const O = (s, r) => {
|
|
11
|
-
const o = s.filter((n) => n._parent === r), i = o.flatMap((n) => O(s, n._id));
|
|
12
|
-
return [...o, ...i];
|
|
13
|
-
}, we = (s, r) => {
|
|
14
|
-
const o = r.find((n) => n._id === s);
|
|
15
|
-
if (!o) return [];
|
|
16
|
-
const i = O(r, s);
|
|
17
|
-
return [o, ...i];
|
|
18
|
-
}, Be = () => {
|
|
19
|
-
const s = P(), [r] = Q();
|
|
20
|
-
return ne(
|
|
21
|
-
(o = "") => {
|
|
22
|
-
const i = s != null && s._id ? we(s._id, r) : r;
|
|
23
|
-
return i ? Z(
|
|
24
|
-
i.map((n) => {
|
|
25
|
-
const d = ae(n._type);
|
|
26
|
-
if (!d) return null;
|
|
27
|
-
const u = (d == null ? void 0 : d.i18nProps) ?? [];
|
|
28
|
-
if (u.length === 0) return null;
|
|
29
|
-
const h = o === "ALL" ? Object.keys(n).filter((a) => u.find((g) => a.startsWith(g))) : u.map((a) => o ? `${a}-${o}` : a), c = ee(n, ["_id"]);
|
|
30
|
-
return te(h, (a) => {
|
|
31
|
-
c[a] = v(n, a, v(n, a.replace(`-${o}`, "")));
|
|
32
|
-
}), c;
|
|
33
|
-
})
|
|
34
|
-
) : [];
|
|
35
|
-
},
|
|
36
|
-
[s == null ? void 0 : s._id, r]
|
|
37
|
-
);
|
|
38
|
-
}, Re = E(() => import("./ai-translation-prompt-B36F3d7K.js")), xe = E(() => import("./ai-prompt-input-DueQYNf-.js")), De = ({
|
|
39
|
-
fetch: s,
|
|
40
|
-
input: r,
|
|
41
|
-
messages: o,
|
|
42
|
-
setInput: i,
|
|
43
|
-
isLoading: n,
|
|
44
|
-
handleStop: d,
|
|
45
|
-
setMessages: u,
|
|
46
|
-
setIsLoading: h,
|
|
47
|
-
selectedLang: c,
|
|
48
|
-
currentBlock: a,
|
|
49
|
-
fallbackLang: g,
|
|
50
|
-
abortController: y,
|
|
51
|
-
setAbortController: D,
|
|
52
|
-
setCurrentBlock: T,
|
|
53
|
-
selectedModel: k = Ne().id,
|
|
54
|
-
onModelChange: j
|
|
55
|
-
}) => {
|
|
56
|
-
const { t: l } = ke(), F = se(null), f = P(), [, I] = X(), N = Be(), $ = Y(), q = () => {
|
|
57
|
-
var e;
|
|
58
|
-
(e = F.current) == null || e.scrollIntoView({ behavior: "smooth" });
|
|
59
|
-
};
|
|
60
|
-
oe(() => {
|
|
61
|
-
q();
|
|
62
|
-
}, [o, n]);
|
|
63
|
-
const w = async (e, B, W) => {
|
|
64
|
-
var A;
|
|
65
|
-
f && T(f);
|
|
66
|
-
const R = (e == null ? void 0 : e.toLowerCase()) === "translate", x = {
|
|
67
|
-
id: Date.now().toString(),
|
|
68
|
-
role: "user",
|
|
69
|
-
content: Se({
|
|
70
|
-
fallbackLang: g,
|
|
71
|
-
userInput: B || e,
|
|
72
|
-
language: c,
|
|
73
|
-
blocks: R ? N() : N(c)
|
|
74
|
-
}),
|
|
75
|
-
userMessage: B || e || l("Translate the content")
|
|
76
|
-
}, z = {
|
|
77
|
-
id: (Date.now() + 1).toString(),
|
|
78
|
-
role: "assistant",
|
|
79
|
-
content: "Thinking...",
|
|
80
|
-
isReasoning: !0,
|
|
81
|
-
isStreaming: !0
|
|
82
|
-
};
|
|
83
|
-
h(!0);
|
|
84
|
-
const U = new AbortController();
|
|
85
|
-
D(U), u((_) => [..._, x, z]), h(!0);
|
|
86
|
-
try {
|
|
87
|
-
const b = await s({ body: { action: "ASK_AI", data: {
|
|
88
|
-
messages: [x],
|
|
89
|
-
initiator: R ? "TRANSLATE_CONTENT" : "UPDATE_CONTENT",
|
|
90
|
-
model: W || k
|
|
91
|
-
} }, streamResponse: !0 });
|
|
92
|
-
if (!b.ok)
|
|
93
|
-
throw new Error(l("Failed to get AI response"));
|
|
94
|
-
const C = (A = b.body) == null ? void 0 : A.getReader(), J = new TextDecoder();
|
|
95
|
-
let m = "";
|
|
96
|
-
if (!C) throw new Error(l("Response body is not readable"));
|
|
97
|
-
for (; ; ) {
|
|
98
|
-
const { done: L, value: V } = await C.read();
|
|
99
|
-
if (L)
|
|
100
|
-
break;
|
|
101
|
-
const G = J.decode(V, { stream: !0 });
|
|
102
|
-
m += G, u((S) => (S[S.length - 1].content = m, [...S]));
|
|
103
|
-
}
|
|
104
|
-
const K = JSON.parse(m == null ? void 0 : m.replace("```json", "").replace("```", ""));
|
|
105
|
-
$(K);
|
|
106
|
-
} catch {
|
|
107
|
-
y == null || y.abort();
|
|
108
|
-
} finally {
|
|
109
|
-
h(!1), i(""), T(null);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
return /* @__PURE__ */ p(H, { children: [
|
|
113
|
-
/* @__PURE__ */ t("div", { className: "py-2", children: /* @__PURE__ */ t(M, { fallback: /* @__PURE__ */ t("div", { children: l("Loading...") }), children: /* @__PURE__ */ t(
|
|
114
|
-
Re,
|
|
115
|
-
{
|
|
116
|
-
isLoading: n,
|
|
117
|
-
selectedBlock: f,
|
|
118
|
-
selectedLang: c,
|
|
119
|
-
onClick: w
|
|
120
|
-
}
|
|
121
|
-
) }) }),
|
|
122
|
-
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ p(ce, { className: "gap-4 px-0", children: [
|
|
123
|
-
o.length === 0 && /* @__PURE__ */ t(
|
|
124
|
-
le,
|
|
125
|
-
{
|
|
126
|
-
icon: /* @__PURE__ */ t(Te, { size: 48, className: "text-gray-300" }),
|
|
127
|
-
title: l("Start a conversation with the AI assistant to translate/edit your content"),
|
|
128
|
-
description: l(
|
|
129
|
-
"Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language."
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
),
|
|
133
|
-
o.map(
|
|
134
|
-
(e) => e.role !== "system" && /* @__PURE__ */ t(re, { children: e.isReasoning ? /* @__PURE__ */ p(de, { isStreaming: e.isStreaming, defaultOpen: !0, children: [
|
|
135
|
-
/* @__PURE__ */ t(ue, { className: "text-xs [&_p]:text-muted-foreground" }),
|
|
136
|
-
/* @__PURE__ */ t(he, { className: "p-0 text-xs", children: e.content })
|
|
137
|
-
] }) : e.isTask ? /* @__PURE__ */ t(me, { content: e.content, isLoading: e.isTaskLoading }) : /* @__PURE__ */ t(fe, { from: e.role, children: /* @__PURE__ */ t(pe, { className: "p-0", children: e.role === "assistant" ? /* @__PURE__ */ t(ge, { className: "p-0 text-xs", children: e.content }) : /* @__PURE__ */ t("div", { className: "p-0 text-xs", children: e.userMessage || e.content }) }) }) }, e.id)
|
|
138
|
-
)
|
|
139
|
-
] }) }),
|
|
140
|
-
/* @__PURE__ */ p("div", { className: "border-gray-200 pb-2", children: [
|
|
141
|
-
/* @__PURE__ */ t(ye, { onRemove: () => I([]), isLoading: n }),
|
|
142
|
-
/* @__PURE__ */ t(M, { fallback: /* @__PURE__ */ t("div", { children: l("Loading...") }), children: /* @__PURE__ */ t(
|
|
143
|
-
xe,
|
|
144
|
-
{
|
|
145
|
-
input: r,
|
|
146
|
-
setInput: i,
|
|
147
|
-
onSend: w,
|
|
148
|
-
onStop: d,
|
|
149
|
-
isLoading: n,
|
|
150
|
-
selectedLang: c,
|
|
151
|
-
currentBlock: f || a,
|
|
152
|
-
disabled: (r == null ? void 0 : r.length) === 0,
|
|
153
|
-
selectedModel: k,
|
|
154
|
-
onModelChange: j
|
|
155
|
-
}
|
|
156
|
-
) })
|
|
157
|
-
] })
|
|
158
|
-
] });
|
|
159
|
-
};
|
|
160
|
-
export {
|
|
161
|
-
De as default
|
|
162
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./index-C99FhuF1.cjs"),f=require("lodash-es"),l=require("react"),G=require("./core-Y0lXLwkq.cjs"),c=require("./selected-block-display-BOgnQRLF.cjs"),H=require("lucide-react"),Q=require("react-i18next"),X=require("./models-5gOsRC56.cjs"),C=(s,o)=>{const r=s.filter(n=>n._parent===o),i=r.flatMap(n=>C(s,n._id));return[...r,...i]},Y=(s,o)=>{const r=o.find(n=>n._id===s);if(!r)return[];const i=C(o,s);return[r,...i]},Z=()=>{const s=p.useSelectedBlock(),[o]=p.useBlocksStore();return l.useCallback((r="")=>{const i=s!=null&&s._id?Y(s._id,o):o;return i?f.compact(i.map(n=>{const h=G.getRegisteredChaiBlock(n._type);if(!h)return null;const x=(h==null?void 0:h.i18nProps)??[];if(x.length===0)return null;const g=r==="ALL"?Object.keys(n).filter(a=>x.find(S=>a.startsWith(S))):x.map(a=>r?`${a}-${r}`:a),d=f.pick(n,["_id"]);return f.each(g,a=>{d[a]=f.get(n,a,f.get(n,a.replace(`-${r}`,"")))}),d})):[]},[s==null?void 0:s._id,o])},ee=l.lazy(()=>Promise.resolve().then(()=>require("./ai-translation-prompt-IAdWMNZb.cjs"))),te=l.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-N9PcYCFa.cjs"))),ne=({fetch:s,input:o,messages:r,setInput:i,isLoading:n,handleStop:h,setMessages:x,setIsLoading:g,selectedLang:d,currentBlock:a,fallbackLang:S,abortController:k,setAbortController:E,setCurrentBlock:T,selectedModel:B=X.getDefaultModel().id,onModelChange:M})=>{const{t:u}=Q.useTranslation(),O=l.useRef(null),y=p.useSelectedBlock(),[,D]=p.useSelectedBlockIds(),R=Z(),I=p.useStreamMultipleBlocksProps(),F=()=>{var t;(t=O.current)==null||t.scrollIntoView({behavior:"smooth"})};l.useEffect(()=>{F()},[r,n]);const N=async(t,w,$)=>{var P;y&&T(y);const q=(t==null?void 0:t.toLowerCase())==="translate",v={id:Date.now().toString(),role:"user",content:c.getTranslationUserPrompt({fallbackLang:S,userInput:w||t,language:d,blocks:q?R():R(d)}),userMessage:w||t||u("Translate the content")},z={id:(Date.now()+1).toString(),role:"assistant",content:"Thinking...",isReasoning:!0,isStreaming:!0};g(!0);const W=new AbortController;E(W),x(b=>[...b,v,z]),g(!0);try{const A=await s({body:{action:"ASK_AI",data:{messages:[v],initiator:q?"TRANSLATE_CONTENT":"UPDATE_CONTENT",model:$||B}},streamResponse:!0});if(!A.ok)throw new Error(u("Failed to get AI response"));const _=(P=A.body)==null?void 0:P.getReader(),U=new TextDecoder;let j="";if(!_)throw new Error(u("Response body is not readable"));for(;;){const{done:K,value:L}=await _.read();if(K)break;const V=U.decode(L,{stream:!0});j+=V,x(m=>(m[m.length-1].content=j,[...m]))}const J=JSON.parse(j==null?void 0:j.replace("```json","").replace("```",""));I(J)}catch{k==null||k.abort()}finally{g(!1),i(""),T(null)}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(l.Suspense,{fallback:e.jsx("div",{children:u("Loading...")}),children:e.jsx(ee,{isLoading:n,selectedBlock:y,selectedLang:d,onClick:N})})}),e.jsx(c.Conversation,{children:e.jsxs(c.ConversationContent,{className:"gap-4 px-0",children:[r.length===0&&e.jsx(c.ConversationEmptyState,{icon:e.jsx(H.Bot,{size:48,className:"text-gray-300"}),title:u("Start a conversation with the AI assistant to translate/edit your content"),description:u("Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language.")}),r.map(t=>t.role!=="system"&&e.jsx(l.Fragment,{children:t.isReasoning?e.jsxs(c.Reasoning,{isStreaming:t.isStreaming,defaultOpen:!0,children:[e.jsx(c.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),e.jsx(c.ReasoningContent,{className:"p-0 text-xs",children:t.content})]}):t.isTask?e.jsx(c.TaskMessage,{content:t.content,isLoading:t.isTaskLoading}):e.jsx(c.Message,{from:t.role,children:e.jsx(c.MessageContent,{className:"p-0",children:t.role==="assistant"?e.jsx(c.MessageResponse,{className:"p-0 text-xs",children:t.content}):e.jsx("div",{className:"p-0 text-xs",children:t.userMessage||t.content})})})},t.id))]})}),e.jsxs("div",{className:"border-gray-200 pb-2",children:[e.jsx(c.SelectedBlockDisplay,{onRemove:()=>D([]),isLoading:n}),e.jsx(l.Suspense,{fallback:e.jsx("div",{children:u("Loading...")}),children:e.jsx(te,{input:o,setInput:i,onSend:N,onStop:h,isLoading:n,selectedLang:d,currentBlock:y||a,disabled:(o==null?void 0:o.length)===0,selectedModel:B,onModelChange:M})})]})]})};exports.default=ne;
|