@chaibuilder/sdk 4.0.0-beta.4 → 4.0.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -50
- package/dist/{2SSKDMRQ-CopJgtZb.cjs → 2SSKDMRQ-D-2rSLsq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Difo_1pg.js → 2SSKDMRQ-DKit4bEt.js} +3 -3
- package/dist/{AP7HFJJL-BPuPBqj4.js → AP7HFJJL-BWruCozs.js} +1 -1
- package/dist/{AP7HFJJL-DYxDgaOs.cjs → AP7HFJJL-CAE2yHEv.cjs} +1 -1
- package/dist/{IconPicker-C0oycHbs.cjs → IconPicker-BCYCPK5M.cjs} +1 -1
- package/dist/{IconPicker-B2-oriq2.js → IconPicker-BOBnjfJc.js} +2 -2
- package/dist/STRINGS-BExFecZW.js +8 -0
- package/dist/STRINGS-FNnfjF5H.cjs +1 -0
- package/dist/{WDYDFRGG-DbejaRPK.cjs → WDYDFRGG-BNve1FlV.cjs} +1 -1
- package/dist/{WDYDFRGG-KK8pkcW1.js → WDYDFRGG-Bv40IVPG.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-Cu_ASKtx.cjs → active-in-another-tab-BPBvEwmD.cjs} +1 -1
- package/dist/{active-in-another-tab-DkR2HWI4.js → active-in-another-tab-C334yD2g.js} +5 -5
- package/dist/{add-new-language-page-BXuwluuU.cjs → add-new-language-page-BVME8b7v.cjs} +1 -1
- package/dist/{add-new-language-page-CBY0RR6q.js → add-new-language-page-DVL-HkWR.js} +4 -4
- package/dist/{add-new-page-C_PzKby8.cjs → add-new-page-BPysPck8.cjs} +1 -1
- package/dist/add-new-page-BQOsHkVl.js +31 -0
- package/dist/{ai-panel-content-rRmJdH7L.cjs → ai-panel-content-BsElc0Ke.cjs} +1 -1
- package/dist/{ai-panel-content--YM01Aly.js → ai-panel-content-BwX0YBGD.js} +6 -6
- package/dist/ai-panel-default-lang-BqhAu1iN.cjs +3 -0
- package/dist/ai-panel-default-lang-CYZuwSQn.js +317 -0
- package/dist/ai-panel-other-lang-CL83Mwha.js +132 -0
- package/dist/ai-panel-other-lang-CivH2s8Q.cjs +1 -0
- package/dist/{ai-prompt-input-N9PcYCFa.cjs → ai-prompt-input-BuP52voq.cjs} +1 -1
- package/dist/{ai-prompt-input-DueQYNf-.js → ai-prompt-input-C37B_jlE.js} +30 -34
- package/dist/{ai-translation-prompt-IAdWMNZb.cjs → ai-translation-prompt-CgZKlkF_.cjs} +1 -1
- package/dist/{ai-translation-prompt-B36F3d7K.js → ai-translation-prompt-V5PBEZRn.js} +2 -2
- package/dist/apply-binding-BuwI_Uf5.cjs +41 -0
- package/dist/apply-binding-RQRSIe56.js +942 -0
- package/dist/change-password-modal-AQU_GLqq.js +137 -0
- package/dist/change-password-modal-Chufk3yU.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-D-fpas30.js +57 -0
- package/dist/code-editor-gqdLU-rU.cjs +1 -0
- package/dist/{continue-editing-in-this-client-DmGFLHXw.cjs → continue-editing-in-this-client-BNEnV0hi.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-Dm9cCj7K.js → continue-editing-in-this-client-Dx3f64SH.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-Rh1QAVxo.cjs → css-import-modal-B2NoLsdZ.cjs} +1 -1
- package/dist/{css-import-modal-9P_0uNa4.js → css-import-modal-c_6VH1js.js} +8 -8
- package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
- package/dist/default-theme-options-saBIkWGT.js +248 -0
- package/dist/delete-page-B1R1w8O5.js +84 -0
- package/dist/delete-page-DbQDbCyB.cjs +1 -0
- package/dist/{design-token-usage-MNYsFlPG.js → design-token-usage-11kPk5n1.js} +26 -26
- package/dist/{design-token-usage-CXglXgcJ.cjs → design-token-usage-BBLfxzzo.cjs} +1 -1
- package/dist/digital-asset-manager-B0h5rUVQ.cjs +1 -0
- package/dist/{digital-asset-manager-CqCWBO0s.js → digital-asset-manager-BbEQ8cPb.js} +6 -6
- package/dist/{duplicate-page-BknLfqr0.js → duplicate-page-BY_Pcqbb.js} +7 -7
- package/dist/{duplicate-page-DzZByALW.cjs → duplicate-page-BaAzKbiX.cjs} +1 -1
- package/dist/{dynamic-page-selector-WA007Sni.cjs → dynamic-page-selector-DzH_gCQ4.cjs} +1 -1
- package/dist/{dynamic-page-selector-DoW7OyUB.js → dynamic-page-selector-bsaLGZkO.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-C_qofMh_.cjs +1 -0
- package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-CyOkIlte.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-Cfn290vp.cjs} +1 -1
- package/dist/{image-editor-CQnNtak2.js → image-editor-CyGqVNvX.js} +1 -1
- package/dist/index-BpVxZOd-.js +5082 -0
- package/dist/index-CQf0jL1k.cjs +5 -0
- package/dist/{index-rAcNbjk_.js → index-DpeytsiB.js} +6145 -6091
- package/dist/index-P-2SvZA9.cjs +160 -0
- package/dist/{json-diff-viewer-CLuUHiPU.cjs → json-diff-viewer-BBERGXdt.cjs} +7 -7
- package/dist/{json-diff-viewer-CMvGUvJ2.js → json-diff-viewer-C-bpInzt.js} +87 -85
- package/dist/{lang-panel-CnwTb05j.js → lang-panel-4Q_PTmKm.js} +26 -26
- package/dist/lang-panel-uI149Beq.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-B_-TrQgu.cjs +1 -0
- package/dist/manage-design-tokens-CHpHE-dx.js +446 -0
- package/dist/manage-design-tokens-modal-Bug5H8PT.cjs +1 -0
- package/dist/manage-design-tokens-modal-DO_tHkgp.js +161 -0
- package/dist/{mark-as-template-CpWEBJGd.cjs → mark-as-template-BEnMYTql.cjs} +1 -1
- package/dist/{mark-as-template-DBLshWb5.js → mark-as-template-Ca3QLzX4.js} +11 -11
- package/dist/{nested-path-selector-content-6OBJ8LG8.js → nested-path-selector-content-5gECLoRV.js} +2 -2
- package/dist/{nested-path-selector-content-C2sD9dkq.cjs → nested-path-selector-content-BHPOfftZ.cjs} +1 -1
- package/dist/{no-language-page-content-CzENgtnu.js → no-language-page-content-Bb3nUSLv.js} +9 -9
- package/dist/{no-language-page-content-BvPDdccK.cjs → no-language-page-content-CKxggLC_.cjs} +1 -1
- package/dist/{no-language-page-dialog-CbYI2cVg.js → no-language-page-dialog-BEVRCAhM.js} +2 -2
- package/dist/{no-language-page-dialog-CgW4yJBC.cjs → no-language-page-dialog-DMb5Z5on.cjs} +1 -1
- package/dist/page-creator-C_95U8kn.cjs +1 -0
- package/dist/{page-creator-Cc83uQqw.js → page-creator-DQRFXhNj.js} +143 -143
- package/dist/{page-lock-BJUkyxdh.js → page-lock-Be5wPHz5.js} +2 -2
- package/dist/{page-lock-CT7SmQqp.cjs → page-lock-DKWt66MX.cjs} +1 -1
- package/dist/page-locked-dialog-CWyZol0i.cjs +1 -0
- package/dist/{page-locked-dialog-DsEbWRed.js → page-locked-dialog-CkXpQUpO.js} +22 -22
- package/dist/page-manager-new-2gYNPR6y.js +408 -0
- package/dist/page-manager-new-Bt7rBO1J.cjs +1 -0
- package/dist/{page-manager-search-and-filter-zq-LfhQ1.js → page-manager-search-and-filter-BotSCoAo.js} +30 -29
- package/dist/{page-manager-search-and-filter-Bfm0j1gg.cjs → page-manager-search-and-filter-Dkwl089C.cjs} +1 -1
- package/dist/{page-revisions-content-D38G2tJM.js → page-revisions-content-OigWteYc.js} +133 -122
- package/dist/page-revisions-content-bQ32feXp.cjs +1 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +330 -96
- package/dist/pages.js +23 -19
- package/dist/{publish-pages-content-CS7f41Ac.js → publish-pages-content-2RcG3Ptp.js} +39 -39
- package/dist/publish-pages-content-Dtkal6ue.cjs +1 -0
- 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-CHxO3TQR.cjs} +1 -1
- package/dist/{rte-widget-modal-D6Zik0Ta.js → rte-widget-modal-DmQk0Lfj.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-BSsuvkZS.cjs +1 -0
- package/dist/{save-to-lib-WwOzbgiF.js → save-to-lib-CVqlFkRK.js} +153 -147
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-BOgnQRLF.cjs → selected-block-display-Cr7R1ojV.cjs} +1 -1
- package/dist/{selected-block-display-B1SG_UXw.js → selected-block-display-DngI-pF1.js} +12 -12
- package/dist/seo-panel-BMYdzcoJ.cjs +2 -0
- package/dist/{seo-panel-BkOgRoWd.js → seo-panel-CHkFLI5b.js} +27 -27
- package/dist/{shared-json-ld-uka9TOgA.js → shared-json-ld-BzjOUN-P.js} +88 -88
- package/dist/shared-json-ld-ClIZw1aA.cjs +1 -0
- package/dist/{slug-input-DHLmUNrH.js → slug-input-07EKw9U5.js} +8 -8
- package/dist/{slug-input-Cyd6NR6J.cjs → slug-input-DHVDl_Dv.cjs} +1 -1
- 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-BLdOZhUs.cjs +1 -0
- package/dist/{take-over-request-Ca0X-qyf.js → take-over-request-zqtItFSK.js} +13 -13
- package/dist/{translation-warning-modal-pSZVKcNW.cjs → translation-warning-modal-BxV_8mCE.cjs} +1 -1
- package/dist/{translation-warning-modal-DrpFeI83.js → translation-warning-modal-DnSd7lOJ.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-DF1Ms4VN.cjs → unmark-as-template-C4UkGyOP.cjs} +1 -1
- package/dist/{unmark-as-template-BMqgelv-.js → unmark-as-template-DIKZYr01.js} +11 -11
- package/dist/unpublish-page-CK0sAZcB.js +28 -0
- package/dist/{unpublish-page-Bsq2yEqQ.cjs → unpublish-page-DFXLzJbc.cjs} +1 -1
- package/dist/unpublished-partials-modal-BAr1SkEG.cjs +1 -0
- package/dist/unpublished-partials-modal-CDaOvXgp.js +52 -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-D6h1L2nV.js → web-preview-CRSjh2he.js} +2 -2
- package/dist/{web-preview-kres0aG7.cjs → web-preview-DA7_F3vv.cjs} +1 -1
- 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/get-chai-builder-theme-BApShjRz.cjs +0 -1
- 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
|
@@ -0,0 +1,942 @@
|
|
|
1
|
+
var Bt = Object.defineProperty;
|
|
2
|
+
var St = (t, s, e) => s in t ? Bt(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
|
+
var _ = (t, s, e) => St(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
+
import { S as w, D as ot, C as Nt } from "./STRINGS-BExFecZW.js";
|
|
5
|
+
import { g as Et, c as U } from "./common-functions-D2lMFR6K.js";
|
|
6
|
+
import { memoize as It, get as y, cloneDeep as Q, forEach as W, keys as V, isString as C, startsWith as $, isArray as q, isEmpty as v, includes as E, flatten as Ct, flatMapDeep as At, set as N, find as b, startCase as Wt, camelCase as lt, has as z, filter as ct, some as Lt, capitalize as Pt, compact as Ft, map as ht, trim as Rt, unset as G, each as Dt, last as jt } from "lodash-es";
|
|
7
|
+
import { parse as Mt, stringify as R } from "himalaya";
|
|
8
|
+
import { f as Ht, j as Ot } from "./core-nSRy3D7z.js";
|
|
9
|
+
import { twMerge as Vt } from "tailwind-merge";
|
|
10
|
+
const gt = (t) => {
|
|
11
|
+
if (t = t.replace(w, ""), !t) return { baseClasses: "", classes: "" };
|
|
12
|
+
const s = t.split(/,(?![^\[]*\])/);
|
|
13
|
+
if (s.length === 1)
|
|
14
|
+
return { baseClasses: "", classes: s[0].trim() };
|
|
15
|
+
const [e, ...a] = s;
|
|
16
|
+
return {
|
|
17
|
+
baseClasses: e.trim(),
|
|
18
|
+
classes: a.join(",").trim().replace(/ +(?= )/g, "")
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
import.meta.vitest && describe("getSplitChaiClasses", () => {
|
|
22
|
+
it("should return the base classes and the classes", () => {
|
|
23
|
+
const t = {
|
|
24
|
+
",styles-2": { baseClasses: "", classes: "styles-2" },
|
|
25
|
+
"styles-1,styles-2": { baseClasses: "styles-1", classes: "styles-2" },
|
|
26
|
+
",bg-[linear-gradient(-10deg,black,transparent_100%)]": {
|
|
27
|
+
baseClasses: "",
|
|
28
|
+
classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
|
|
29
|
+
},
|
|
30
|
+
"styles-1,bg-[linear-gradient(-10deg,black,transparent_100%)]": {
|
|
31
|
+
baseClasses: "styles-1",
|
|
32
|
+
classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
|
|
33
|
+
},
|
|
34
|
+
someclass: {
|
|
35
|
+
baseClasses: "",
|
|
36
|
+
classes: "someclass"
|
|
37
|
+
},
|
|
38
|
+
",bg-red-500 text-center font-bold": {
|
|
39
|
+
baseClasses: "",
|
|
40
|
+
classes: "bg-red-500 text-center font-bold"
|
|
41
|
+
},
|
|
42
|
+
"bg-[linear-gradient(-10deg,black,transparent_100%)], bg-[linear-gradient(-10deg,black,transparent_100%)]": {
|
|
43
|
+
baseClasses: "bg-[linear-gradient(-10deg,black,transparent_100%)]",
|
|
44
|
+
classes: "bg-[linear-gradient(-10deg,black,transparent_100%)]"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
for (const [s, e] of Object.entries(t)) {
|
|
48
|
+
const a = gt(`${w}${s}`);
|
|
49
|
+
expect(a).toEqual(e);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
function Ne(t, s, e) {
|
|
54
|
+
const a = y(e, "i18nProps", []);
|
|
55
|
+
if (v(s) || v(a)) return t;
|
|
56
|
+
const n = Q(t);
|
|
57
|
+
return W(V(n), (r) => {
|
|
58
|
+
if (E(a, r) && !v(s)) {
|
|
59
|
+
const o = y(n, r), i = y(n, `${r}-${s}`, "");
|
|
60
|
+
C(o) ? n[r] = C(i) && !v(i.trim()) && i.trimStart() || o : n[r] = v(i) ? o : i;
|
|
61
|
+
}
|
|
62
|
+
}), n;
|
|
63
|
+
}
|
|
64
|
+
const yt = (t, s) => {
|
|
65
|
+
const { baseClasses: e, classes: a } = gt(t), r = a.split(" ").filter((i) => i.startsWith(ot)).map((i) => {
|
|
66
|
+
var p;
|
|
67
|
+
return (p = s[i]) == null ? void 0 : p.value;
|
|
68
|
+
}), o = a.split(" ").filter((i) => !i.startsWith(ot)).join(" ");
|
|
69
|
+
return Vt.apply(null, [e, ...r, o]);
|
|
70
|
+
};
|
|
71
|
+
function qt(t, s) {
|
|
72
|
+
return y(t, `${s}_attrs`, {});
|
|
73
|
+
}
|
|
74
|
+
function Ee(t, s = !0, e = {}) {
|
|
75
|
+
const a = {};
|
|
76
|
+
return Object.keys(t).forEach((n) => {
|
|
77
|
+
if (C(t[n]) && t[n].startsWith(w)) {
|
|
78
|
+
const r = yt(t[n], e), o = qt(t, n);
|
|
79
|
+
a[n] = {
|
|
80
|
+
...!v(r) && { className: r },
|
|
81
|
+
...o,
|
|
82
|
+
...s ? {
|
|
83
|
+
"data-style-prop": n,
|
|
84
|
+
"data-block-parent": t._id,
|
|
85
|
+
"data-style-id": `${n}-${t._id}`
|
|
86
|
+
} : {}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}), a;
|
|
90
|
+
}
|
|
91
|
+
const Ie = It((t) => {
|
|
92
|
+
const s = Ht(t), e = y(s, "schema.properties", {});
|
|
93
|
+
return Object.fromEntries(Object.entries(e).filter(([, a]) => y(a, "runtime", !1)));
|
|
94
|
+
}), Ce = (t, s) => {
|
|
95
|
+
if (!q(t)) return t;
|
|
96
|
+
let e = t, a;
|
|
97
|
+
return typeof s.limit == "number" && s.limit > 0 && (a = s.limit), a !== void 0 && (e = e.slice(0, a)), e;
|
|
98
|
+
}, Ae = (t, s) => {
|
|
99
|
+
const e = Q(t);
|
|
100
|
+
return W(V(e), (a) => {
|
|
101
|
+
if (C(e[a]) && !$(a, "_")) {
|
|
102
|
+
let n = e[a];
|
|
103
|
+
a === "repeaterItems" && (e.repeaterItemsBinding = n);
|
|
104
|
+
const r = /\{\{(.*?)\}\}/g, o = n.match(r);
|
|
105
|
+
o && o.forEach((i) => {
|
|
106
|
+
let p = i.slice(2, -2);
|
|
107
|
+
const l = y(s, p, i);
|
|
108
|
+
n = q(l) ? l : n.replace(i, l);
|
|
109
|
+
}), e[a] = n;
|
|
110
|
+
}
|
|
111
|
+
}), e;
|
|
112
|
+
}, Ut = (t) => {
|
|
113
|
+
const s = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, e = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
|
|
114
|
+
return s.test(t) || e.test(t);
|
|
115
|
+
}, zt = (t) => {
|
|
116
|
+
if (v(t)) return t;
|
|
117
|
+
const s = /<video[^>]+src=['"]([^'">]+)['"]/, e = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = t.match(s), n = t.match(e), r = a ? a[1] : n ? n[1] : null, o = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, i = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
|
|
118
|
+
return r && (o.test(r) || i.test(r)) ? r : t;
|
|
119
|
+
}, ft = ["chai-name", "data-chai-name"], Gt = {
|
|
120
|
+
img: { alt: "alt", width: "width", height: "height", src: "image" },
|
|
121
|
+
video: {
|
|
122
|
+
src: "url",
|
|
123
|
+
autoplay: "controls.autoPlay",
|
|
124
|
+
muted: "controls.muted",
|
|
125
|
+
loop: "controls.loop",
|
|
126
|
+
controls: "controls.widgets"
|
|
127
|
+
},
|
|
128
|
+
a: {
|
|
129
|
+
href: "link.href",
|
|
130
|
+
target: "link.target",
|
|
131
|
+
type: ""
|
|
132
|
+
// @TODO: Detect here what to url, email, phone, elementId
|
|
133
|
+
},
|
|
134
|
+
input: {
|
|
135
|
+
placeholder: "placeholder",
|
|
136
|
+
required: "required",
|
|
137
|
+
type: "inputType",
|
|
138
|
+
name: "fieldName"
|
|
139
|
+
},
|
|
140
|
+
textarea: {
|
|
141
|
+
placeholder: "placeholder",
|
|
142
|
+
required: "required",
|
|
143
|
+
type: "inputType",
|
|
144
|
+
name: "fieldName"
|
|
145
|
+
},
|
|
146
|
+
select: {
|
|
147
|
+
placeholder: "placeholder",
|
|
148
|
+
required: "required",
|
|
149
|
+
multiple: "multiple",
|
|
150
|
+
name: "fieldName"
|
|
151
|
+
},
|
|
152
|
+
form: {
|
|
153
|
+
action: "action"
|
|
154
|
+
}
|
|
155
|
+
}, Xt = (t, s) => {
|
|
156
|
+
var e;
|
|
157
|
+
return ((e = t.children) == null ? void 0 : e.length) === 1 && E(
|
|
158
|
+
["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
|
|
159
|
+
s._type
|
|
160
|
+
);
|
|
161
|
+
}, X = (t) => t.map((s) => s.type === "text" ? y(s, "content", "") : v(s.children) ? "" : X(s.children || [])).join(""), O = (t) => t === null ? "" : t, mt = (t) => {
|
|
162
|
+
const s = Ft(ht(t.split(/\s+/), Rt)), e = b(s, (i) => /^w-/.test(i)), a = b(s, (i) => /^h-/.test(i));
|
|
163
|
+
if (!a || !e) return { height: "", width: "" };
|
|
164
|
+
const n = (i) => {
|
|
165
|
+
if (!i) return;
|
|
166
|
+
const p = i.match(/^[wh]-(?:\[(.*?)\]|(.+))$/);
|
|
167
|
+
if (!p) return;
|
|
168
|
+
if (p[1]) return p[1];
|
|
169
|
+
const l = p[2];
|
|
170
|
+
return /^\d+(\.\d+)?$/.test(l) ? `${Number(l) * 4}px` : l === "auto" || E(l, "%") ? l : "16px";
|
|
171
|
+
}, r = n(e), o = n(a);
|
|
172
|
+
return {
|
|
173
|
+
width: E(r, "px") ? r : "16px",
|
|
174
|
+
height: E(o, "px") ? o : "16px"
|
|
175
|
+
};
|
|
176
|
+
}, pt = (t) => {
|
|
177
|
+
if (t.tagName === "svg") return {};
|
|
178
|
+
const s = {}, e = Gt[t.tagName || ""] || {}, a = t.attributes || [];
|
|
179
|
+
return W(a, ({ key: n, value: r }) => {
|
|
180
|
+
var o;
|
|
181
|
+
if (!E(ft, n))
|
|
182
|
+
if (n === "bid" && (s._bid = O(r)), e[n]) {
|
|
183
|
+
if (t.tagName === "img" && n === "src" && !r.startsWith("http")) {
|
|
184
|
+
const i = b(t.attributes, { key: "width" }), p = b(t.attributes, { key: "height" });
|
|
185
|
+
i && p ? r = `https://picsum.photos/${i == null ? void 0 : i.value}x${p == null ? void 0 : p.value}` : r = "https://picsum.photos/150x150";
|
|
186
|
+
} else if (t.tagName === "a") {
|
|
187
|
+
const i = b(t.attributes, { key: "href" });
|
|
188
|
+
i && typeof (i == null ? void 0 : i.value) == "string" && ((o = i == null ? void 0 : i.value) != null && o.startsWith("pageType:")) && N(s, "link.type", "pageType");
|
|
189
|
+
}
|
|
190
|
+
N(s, e[n], O(r));
|
|
191
|
+
} else E(["style", "class", "srcset", "bid"], n) || (s.styles_attrs = s.styles_attrs || {}, $(n, "@") && (n = n.replace("@", "x-on:")), s.styles_attrs[`${n}`] = O(r));
|
|
192
|
+
}), delete s.class, s;
|
|
193
|
+
}, Yt = (t, s = "styles") => {
|
|
194
|
+
if (!t.attributes) return { [s]: `${w},` };
|
|
195
|
+
const e = b(t.attributes, { key: "class" });
|
|
196
|
+
if (e) {
|
|
197
|
+
const a = e.value;
|
|
198
|
+
return { [s]: `${w},${a}` };
|
|
199
|
+
}
|
|
200
|
+
return { [s]: `${w},` };
|
|
201
|
+
}, Zt = (t) => {
|
|
202
|
+
const s = y(t, "attributes", []), e = s.find((l) => l.key === "data-chai-richtext" || l.key === "chai-richtext"), a = s.find((l) => l.key === "data-chai-lightbox" || l.key === "chai-lightbox"), n = s.find((l) => l.key === "data-chai-dropdown" || l.key === "chai-dropdown"), r = s.find(
|
|
203
|
+
(l) => l.key === "data-chai-dropdown-button" || l.key === "chai-dropdown-button"
|
|
204
|
+
), o = s.find(
|
|
205
|
+
(l) => l.key === "data-chai-dropdown-content" || l.key === "chai-dropdown-content"
|
|
206
|
+
), i = s.find((l) => l.key === "class"), p = i && i.value.split(/\s+/).includes("rte");
|
|
207
|
+
if (n)
|
|
208
|
+
return { _type: "Dropdown" };
|
|
209
|
+
if (r)
|
|
210
|
+
return { _type: "DropdownButton" };
|
|
211
|
+
if (o)
|
|
212
|
+
return { _type: "DropdownContent" };
|
|
213
|
+
if (e || p)
|
|
214
|
+
return { _type: "Paragraph" };
|
|
215
|
+
if (a)
|
|
216
|
+
return { _type: "LightBoxLink" };
|
|
217
|
+
switch (t.tagName) {
|
|
218
|
+
// self closing tags
|
|
219
|
+
case "img":
|
|
220
|
+
return { _type: "Image" };
|
|
221
|
+
case "input":
|
|
222
|
+
return { _type: "Input", showLabel: !1 };
|
|
223
|
+
// showLabel: hiding default block label
|
|
224
|
+
case "hr":
|
|
225
|
+
return { _type: "Divider" };
|
|
226
|
+
case "br":
|
|
227
|
+
return { _type: "LineBreak" };
|
|
228
|
+
case "textarea":
|
|
229
|
+
return { _type: "TextArea", showLabel: !1 };
|
|
230
|
+
case "audio":
|
|
231
|
+
return { _type: "Audio" };
|
|
232
|
+
case "canvas":
|
|
233
|
+
return { _type: "Canvas" };
|
|
234
|
+
case "video":
|
|
235
|
+
case "iframe":
|
|
236
|
+
return { _type: "CustomHTML" };
|
|
237
|
+
case "svg":
|
|
238
|
+
return { _type: "Icon" };
|
|
239
|
+
// non self closing tags
|
|
240
|
+
// fixed structure
|
|
241
|
+
case "select":
|
|
242
|
+
return { _type: "Select", options: [] };
|
|
243
|
+
case "option":
|
|
244
|
+
return { _type: "Option" };
|
|
245
|
+
case "ul":
|
|
246
|
+
case "ol":
|
|
247
|
+
case "dl":
|
|
248
|
+
return {
|
|
249
|
+
_type: "List",
|
|
250
|
+
tag: t.tagName,
|
|
251
|
+
_listType: t.tagName === "ol" ? "list-decimal" : "list-none"
|
|
252
|
+
};
|
|
253
|
+
case "li":
|
|
254
|
+
case "dt":
|
|
255
|
+
return { _type: "ListItem", tag: t.tagName };
|
|
256
|
+
// non self closing tags
|
|
257
|
+
// free flow structure
|
|
258
|
+
case "span":
|
|
259
|
+
case "figcaption":
|
|
260
|
+
case "legend":
|
|
261
|
+
return { _type: "Span", tag: t.tagName };
|
|
262
|
+
case "p":
|
|
263
|
+
return { _type: "Paragraph", content: "" };
|
|
264
|
+
case "a":
|
|
265
|
+
return { _type: "Link" };
|
|
266
|
+
case "form":
|
|
267
|
+
return { _type: "Form" };
|
|
268
|
+
case "label":
|
|
269
|
+
return { _type: "Label" };
|
|
270
|
+
case "button":
|
|
271
|
+
return { _type: "Button" };
|
|
272
|
+
case "code":
|
|
273
|
+
return { _type: "Box", _name: "Code" };
|
|
274
|
+
case "h1":
|
|
275
|
+
case "h2":
|
|
276
|
+
case "h3":
|
|
277
|
+
case "h4":
|
|
278
|
+
case "h5":
|
|
279
|
+
case "h6":
|
|
280
|
+
return { _type: "Heading", tag: t.tagName };
|
|
281
|
+
case "table":
|
|
282
|
+
return { _type: "Table" };
|
|
283
|
+
case "tr":
|
|
284
|
+
return { _type: "TableRow" };
|
|
285
|
+
case "td":
|
|
286
|
+
case "th":
|
|
287
|
+
return { _type: "TableCell", tag: t.tagName };
|
|
288
|
+
case "thead":
|
|
289
|
+
return { _type: "TableHead" };
|
|
290
|
+
case "tbody":
|
|
291
|
+
return { _type: "TableBody" };
|
|
292
|
+
case "tfoot":
|
|
293
|
+
return { _type: "TableFooter" };
|
|
294
|
+
default: {
|
|
295
|
+
const l = y(t, "children", []).length > 0 ? "Box" : "EmptyBox";
|
|
296
|
+
return {
|
|
297
|
+
_type: l,
|
|
298
|
+
tag: t.tagName,
|
|
299
|
+
_name: l == "EmptyBox" || t.tagName === "div" ? l : Pt(t.tagName)
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}, Y = (t, s = null) => At(t, (e) => {
|
|
304
|
+
var A, x, I, B, L, tt, et, st, nt, at;
|
|
305
|
+
if (e.type === "comment") return [];
|
|
306
|
+
let a = { _id: Et() };
|
|
307
|
+
if (s && (a._parent = s.block._id), e.type === "text")
|
|
308
|
+
return v(y(e, "content", "")) ? [] : s && Xt(s.node, s.block) ? (N(s, "block.content", y(e, "content", "")), []) : { ...a, _type: "Text", content: y(e, "content", "") };
|
|
309
|
+
if ($(e.tagName, "chai-")) {
|
|
310
|
+
const c = e.attributes || [], u = b(c, { key: "chai-type" }), h = (u == null ? void 0 : u.value) || Wt(lt(e.tagName || "")).replace(/ /g, "").replace(/\s+/g, "");
|
|
311
|
+
a._type = h, W(c, ({ key: k, value: rt }) => {
|
|
312
|
+
if (k === "about-this-component" || k === "chai-type" || k === "can-move" || k === "can-delete") return;
|
|
313
|
+
if (k === "id") {
|
|
314
|
+
a._id = rt;
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const $t = $(k, "_") ? k : lt(k);
|
|
318
|
+
let P = O(rt);
|
|
319
|
+
typeof P == "string" && $(P, "#styles:") && (P = P.replace("#styles:", "#styles:,")), a[$t] = P;
|
|
320
|
+
});
|
|
321
|
+
const m = Y(e.children || [], { block: a, node: e });
|
|
322
|
+
return [a, ...m];
|
|
323
|
+
}
|
|
324
|
+
const n = y(e, "attributes", []), r = e.tagName === "p" || n.find((c) => c.key === "data-chai-richtext" || c.key === "chai-richtext"), o = n.find((c) => c.key === "class"), i = o && o.value.split(/\s+/).includes("rte"), p = n.find(
|
|
325
|
+
(c) => c.key === "data-chai-lightbox" || c.key === "chai-lightbox"
|
|
326
|
+
), l = n.find(
|
|
327
|
+
(c) => c.key === "data-chai-dropdown" || c.key === "chai-dropdown"
|
|
328
|
+
), f = n.find(
|
|
329
|
+
(c) => c.key === "data-chai-dropdown-button" || c.key === "chai-dropdown-button"
|
|
330
|
+
), d = n.find(
|
|
331
|
+
(c) => c.key === "data-chai-dropdown-content" || c.key === "chai-dropdown-content"
|
|
332
|
+
);
|
|
333
|
+
if (a = {
|
|
334
|
+
...a,
|
|
335
|
+
...Zt(e),
|
|
336
|
+
...pt(e),
|
|
337
|
+
...Yt(e)
|
|
338
|
+
}, e.attributes) {
|
|
339
|
+
const c = e.attributes.find((u) => E(ft, u.key));
|
|
340
|
+
c && (a._name = c.value);
|
|
341
|
+
}
|
|
342
|
+
if (r || i)
|
|
343
|
+
return a.content = `<p>${R(e.children || [])}</p>`, z(a, "styles_attrs.data-chai-richtext") && delete a.styles_attrs["data-chai-richtext"], z(a, "styles_attrs.chai-richtext") && delete a.styles_attrs["chai-richtext"], [a];
|
|
344
|
+
if (p) {
|
|
345
|
+
const c = [
|
|
346
|
+
"data-chai-lightbox",
|
|
347
|
+
"chai-lightbox",
|
|
348
|
+
"data-vbtype",
|
|
349
|
+
"data-autoplay",
|
|
350
|
+
"data-maxwidth",
|
|
351
|
+
"data-overlay",
|
|
352
|
+
"data-gall",
|
|
353
|
+
"href"
|
|
354
|
+
];
|
|
355
|
+
a = {
|
|
356
|
+
...a,
|
|
357
|
+
href: ((A = n.find((u) => u.key === "href")) == null ? void 0 : A.value) || "",
|
|
358
|
+
hrefType: ((x = n.find((u) => u.key === "data-vbtype")) == null ? void 0 : x.value) || "video",
|
|
359
|
+
autoplay: ((I = n.find((u) => u.key === "data-autoplay")) == null ? void 0 : I.value) === "true" ? "true" : "false",
|
|
360
|
+
maxWidth: ((L = (B = n.find((u) => u.key === "data-maxwidth")) == null ? void 0 : B.value) == null ? void 0 : L.replace("px", "")) || "",
|
|
361
|
+
backdropColor: ((tt = n.find((u) => u.key === "data-overlay")) == null ? void 0 : tt.value) || "",
|
|
362
|
+
galleryName: ((et = n.find((u) => u.key === "data-gall")) == null ? void 0 : et.value) || ""
|
|
363
|
+
}, W(c, (u) => {
|
|
364
|
+
z(a, `styles_attrs.${u}`) && delete a.styles_attrs[u];
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
if (l && (delete a.styles_attrs, a.showDropdown = !1), d && delete a.styles_attrs, f) {
|
|
368
|
+
delete a.styles_attrs;
|
|
369
|
+
const c = ct(e.children || [], (h) => (h == null ? void 0 : h.tagName) !== "span");
|
|
370
|
+
a.content = X(c);
|
|
371
|
+
const u = b(
|
|
372
|
+
e.children || [],
|
|
373
|
+
(h) => (h == null ? void 0 : h.tagName) === "span" && Lt(h.children || [], (m) => (m == null ? void 0 : m.tagName) === "svg")
|
|
374
|
+
);
|
|
375
|
+
if (u) {
|
|
376
|
+
const h = b(u.children || [], (m) => (m == null ? void 0 : m.tagName) === "svg");
|
|
377
|
+
if (h) {
|
|
378
|
+
a.icon = R([h]);
|
|
379
|
+
const { height: m, width: k } = Jt(h, "16px", "16px");
|
|
380
|
+
a.iconHeight = m, a.iconWidth = k;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return [a];
|
|
384
|
+
}
|
|
385
|
+
if (a._type === "Input") {
|
|
386
|
+
const c = a.inputType || "text";
|
|
387
|
+
c === "checkbox" ? N(a, "_type", "Checkbox") : c === "radio" && N(a, "_type", "Radio");
|
|
388
|
+
} else if (e.tagName === "video" || e.tagName === "iframe") {
|
|
389
|
+
const c = R([e]);
|
|
390
|
+
return Ut(c) && (N(a, "_type", "Video"), N(a, "url", zt(c)), N(a, "styles", `${w},`), N(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = c, [a];
|
|
391
|
+
} else if (e.tagName === "svg") {
|
|
392
|
+
const c = y(b(e.attributes, { key: "class" }), "value", ""), { height: u, width: h } = mt(c);
|
|
393
|
+
if (u && h)
|
|
394
|
+
a.styles = `${w}, ${U(`w-${h} h-${u}`, c)}`.trim(), a.height = u == null ? void 0 : u.replace("px", ""), a.width = h == null ? void 0 : h.replace("px", "");
|
|
395
|
+
else {
|
|
396
|
+
const m = (st = b(e.attributes, { key: "height" })) == null ? void 0 : st.value, k = (nt = b(e.attributes, { key: "width" })) == null ? void 0 : nt.value;
|
|
397
|
+
m && k ? (a.styles = `${w}, ${U(`w-[${k}px] h-[${m}px]`, c)}`.trim(), a.height = m, a.width = k) : a.styles = `${w}, ${U("w-full h-full", c)}`.trim();
|
|
398
|
+
}
|
|
399
|
+
return e.attributes = ct(e.attributes, (m) => !E(["style", "width", "height", "class"], m.key)), a.icon = R([e]), [a];
|
|
400
|
+
} else if (e.tagName == "option" && s && ((at = s.block) == null ? void 0 : at._type) === "Select")
|
|
401
|
+
return s.block.options.push({
|
|
402
|
+
label: X(e.children || []),
|
|
403
|
+
...pt(e)
|
|
404
|
+
}), [];
|
|
405
|
+
const g = Y(e.children || [], { block: a, node: e });
|
|
406
|
+
return [a, ...g];
|
|
407
|
+
}), Jt = (t, s, e) => {
|
|
408
|
+
var p, l;
|
|
409
|
+
const a = y(t, "attributes", []), { height: n, width: r } = mt(
|
|
410
|
+
y(b(a, { key: "class" }), "value", "")
|
|
411
|
+
);
|
|
412
|
+
if (n && r)
|
|
413
|
+
return {
|
|
414
|
+
height: `[${n}px]`,
|
|
415
|
+
width: `[${r}px]`
|
|
416
|
+
};
|
|
417
|
+
const o = (p = b(a, { key: "height" })) == null ? void 0 : p.value, i = (l = b(a, { key: "width" })) == null ? void 0 : l.value;
|
|
418
|
+
return {
|
|
419
|
+
height: o ? `[${o}px]` : e,
|
|
420
|
+
width: i ? `[${i}px]` : s
|
|
421
|
+
};
|
|
422
|
+
}, Qt = (t) => {
|
|
423
|
+
t = t.replace(/(\w+)=\\?"(.*?)\\?"/g, (a, n, r) => {
|
|
424
|
+
let o = r.replace(/\\"/g, '"');
|
|
425
|
+
return o = o.replace(/{([^}]+)}/g, (i) => i.replace(/"/g, '\\"')), `${n}="${o.replace(/\\"/g, '"')}"`;
|
|
426
|
+
}), t = t.replace(/\\n/g, " ").replace(/\\\\/g, "").replace(/\\([/<>])/g, "$1").replace(/\\./g, "").replace(/[\n\r\t\f\v]/g, " "), t = t.replace(/\$name="[^"]*"/g, "");
|
|
427
|
+
const s = t.match(/<body[^>]*>[\s\S]*?<\/body>/);
|
|
428
|
+
return (s && s.length > 0 ? s[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : t).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
|
|
429
|
+
}, Kt = (t, s) => b(t, { _id: s }), We = (t, s) => v(s) ? t.map((e) => (G(e, "_bid"), e)) : ht(t, (e) => {
|
|
430
|
+
const a = v(e._bid) ? void 0 : Kt(s, e._bid);
|
|
431
|
+
if (a) {
|
|
432
|
+
a._type === "Icon" && y(e, "icon", "").match(/chai-default-svg/) && delete e.icon;
|
|
433
|
+
const n = { ...a, ...e };
|
|
434
|
+
return G(n, "_bid"), n;
|
|
435
|
+
}
|
|
436
|
+
return G(e, "_bid"), e;
|
|
437
|
+
}), Le = (t) => {
|
|
438
|
+
const s = Mt(Qt(t));
|
|
439
|
+
if (v(t)) return [];
|
|
440
|
+
const e = Ct(Y(s));
|
|
441
|
+
return Ot(e);
|
|
442
|
+
}, T = (t, s) => t.map((e) => {
|
|
443
|
+
const a = V(e).filter((n) => C(e[n]) && e[n].startsWith(w));
|
|
444
|
+
return Dt(a, (n) => {
|
|
445
|
+
e[n] = `${w},${yt(e[n], s)}`;
|
|
446
|
+
}), e;
|
|
447
|
+
});
|
|
448
|
+
import.meta.vitest && describe("applyDesignTokens", () => {
|
|
449
|
+
const t = {
|
|
450
|
+
"dt#token1": { name: "primary-color", value: "bg-blue-500" },
|
|
451
|
+
"dt#token2": { name: "text-size", value: "text-lg" },
|
|
452
|
+
"dt#token3": { name: "spacing", value: "p-4" }
|
|
453
|
+
}, s = [
|
|
454
|
+
{
|
|
455
|
+
_id: "block1",
|
|
456
|
+
_type: "div",
|
|
457
|
+
styles: "#styles:,dt#token1 bg-white text-sm",
|
|
458
|
+
className: "#styles:,dt#token2 dt#token3",
|
|
459
|
+
otherProp: "not-a-style",
|
|
460
|
+
_name: "Test Block"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
_id: "block2",
|
|
464
|
+
_type: "button",
|
|
465
|
+
styles: "#styles:bg-red-500",
|
|
466
|
+
nonStringProp: 123,
|
|
467
|
+
_name: "Button Block"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
_id: "block3",
|
|
471
|
+
_type: "span",
|
|
472
|
+
noStyles: "regular-string",
|
|
473
|
+
_name: "No Styles Block"
|
|
474
|
+
}
|
|
475
|
+
];
|
|
476
|
+
it("should process blocks and replace style properties with generated class names", () => {
|
|
477
|
+
const e = T(s, t);
|
|
478
|
+
expect(e).toHaveLength(3), expect(e[0].styles).toBe("#styles:,bg-white text-sm"), expect(e[0].className).toBe("#styles:,text-lg p-4"), expect(e[0].otherProp).toBe("not-a-style"), expect(e[0]._id).toBe("block1"), expect(e[0]._type).toBe("div");
|
|
479
|
+
}), it("should handle blocks with no style properties", () => {
|
|
480
|
+
const e = T(s, t);
|
|
481
|
+
expect(e[2].noStyles).toBe("regular-string"), expect(e[2]._id).toBe("block3");
|
|
482
|
+
}), it("should handle empty blocks array", () => {
|
|
483
|
+
const e = T([], t);
|
|
484
|
+
expect(e).toEqual([]);
|
|
485
|
+
}), it("should handle empty design tokens", () => {
|
|
486
|
+
const e = T(s, {});
|
|
487
|
+
expect(e[0].styles).toBe("#styles:,bg-white text-sm");
|
|
488
|
+
}), it("should handle blocks with only style prefix", () => {
|
|
489
|
+
const a = T([
|
|
490
|
+
{
|
|
491
|
+
_id: "block1",
|
|
492
|
+
_type: "div",
|
|
493
|
+
styles: "#styles:",
|
|
494
|
+
_name: "Prefix Only"
|
|
495
|
+
}
|
|
496
|
+
], t);
|
|
497
|
+
expect(a[0].styles).toBe("#styles:,");
|
|
498
|
+
}), it("should handle blocks with multiple style properties", () => {
|
|
499
|
+
const a = T([
|
|
500
|
+
{
|
|
501
|
+
_id: "block1",
|
|
502
|
+
_type: "div",
|
|
503
|
+
styles: "#styles:bg-white dt#token1",
|
|
504
|
+
hoverStyles: "#styles:bg-gray-100 dt#token2",
|
|
505
|
+
focusStyles: "#styles:outline-none dt#token3",
|
|
506
|
+
_name: "Multi Style"
|
|
507
|
+
}
|
|
508
|
+
], t);
|
|
509
|
+
expect(a[0].styles).toBe("#styles:,bg-white"), expect(a[0].hoverStyles).toBe("#styles:,text-lg bg-gray-100"), expect(a[0].focusStyles).toBe("#styles:,p-4 outline-none");
|
|
510
|
+
}), it("should not modify non-string properties that start with #styles:", () => {
|
|
511
|
+
const a = T([
|
|
512
|
+
{
|
|
513
|
+
_id: "block1",
|
|
514
|
+
_type: "div",
|
|
515
|
+
styles: "#styles:bg-white",
|
|
516
|
+
objectStyles: { startsWith: "#styles:" },
|
|
517
|
+
arrayStyles: ["#styles:bg-red-500"],
|
|
518
|
+
_name: "Non String Styles"
|
|
519
|
+
}
|
|
520
|
+
], t);
|
|
521
|
+
expect(a[0].styles).toBe("#styles:,bg-white"), expect(a[0].objectStyles).toEqual({ startsWith: "#styles:" }), expect(a[0].arrayStyles).toEqual(["#styles:bg-red-500"]);
|
|
522
|
+
}), it("should handle undefined and null values", () => {
|
|
523
|
+
const a = T([
|
|
524
|
+
{
|
|
525
|
+
_id: "block1",
|
|
526
|
+
_type: "div",
|
|
527
|
+
styles: "#styles:bg-white",
|
|
528
|
+
nullStyles: null,
|
|
529
|
+
undefinedStyles: void 0,
|
|
530
|
+
_name: " Null Undefined"
|
|
531
|
+
}
|
|
532
|
+
], t);
|
|
533
|
+
expect(a[0].styles).toBe("#styles:,bg-white"), expect(a[0].nullStyles).toBeNull(), expect(a[0].undefinedStyles).toBeUndefined();
|
|
534
|
+
}), it("should preserve block structure and non-style properties", () => {
|
|
535
|
+
T(s, t).forEach((a, n) => {
|
|
536
|
+
expect(a._id).toBe(s[n]._id), expect(a._type).toBe(s[n]._type), expect(a._name).toBe(s[n]._name);
|
|
537
|
+
});
|
|
538
|
+
}), it("should handle complex design token values", () => {
|
|
539
|
+
const n = T([
|
|
540
|
+
{
|
|
541
|
+
_id: "block1",
|
|
542
|
+
_type: "div",
|
|
543
|
+
styles: "#styles:bg-white dt#complex1",
|
|
544
|
+
_name: "Complex Tokens"
|
|
545
|
+
}
|
|
546
|
+
], {
|
|
547
|
+
"dt#complex1": { name: "complex-token", value: "hover:bg-blue-600 focus:outline-none transition-colors" },
|
|
548
|
+
"dt#complex2": { name: "spacing-token", value: "px-6 py-3 m-2" }
|
|
549
|
+
});
|
|
550
|
+
expect(n[0].styles).toBe("#styles:,hover:bg-blue-600 focus:outline-none transition-colors bg-white");
|
|
551
|
+
}), it("should handle tokens with empty values", () => {
|
|
552
|
+
const n = T([
|
|
553
|
+
{
|
|
554
|
+
_id: "block1",
|
|
555
|
+
_type: "div",
|
|
556
|
+
styles: "#styles:bg-white dt#empty1 dt#valid1",
|
|
557
|
+
_name: "Empty Value Tokens"
|
|
558
|
+
}
|
|
559
|
+
], {
|
|
560
|
+
"dt#empty1": { name: "empty-token", value: "" },
|
|
561
|
+
"dt#valid1": { name: "valid-token", value: "bg-green-500" }
|
|
562
|
+
});
|
|
563
|
+
expect(n[0].styles).toBe("#styles:,bg-white");
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
const S = (t) => {
|
|
567
|
+
const s = jt(t);
|
|
568
|
+
return t.map((e) => {
|
|
569
|
+
const a = Object.keys(e);
|
|
570
|
+
for (let n = 0; n < a.length; n++)
|
|
571
|
+
if (C(e[a[n]]) && $(a[n], "content")) {
|
|
572
|
+
const r = e === s ? "" : " ";
|
|
573
|
+
e[a[n]] = `${e[a[n]].trim()}${r}`;
|
|
574
|
+
}
|
|
575
|
+
return e;
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
if (import.meta.vitest) {
|
|
579
|
+
const { describe: t, it: s, expect: e } = import.meta.vitest;
|
|
580
|
+
t("adjustSpacingInContentBlocks", () => {
|
|
581
|
+
s("should add space after content fields except for the last block", () => {
|
|
582
|
+
const n = S([
|
|
583
|
+
{ _id: "1", _type: "Text", content: "First" },
|
|
584
|
+
{ _id: "2", _type: "Text", content: "Second" },
|
|
585
|
+
{ _id: "3", _type: "Text", content: "Third" }
|
|
586
|
+
]);
|
|
587
|
+
e(n[0].content).toBe("First "), e(n[1].content).toBe("Second "), e(n[2].content).toBe("Third");
|
|
588
|
+
}), s("should trim whitespace from content before adding space", () => {
|
|
589
|
+
const n = S([
|
|
590
|
+
{ _id: "1", _type: "Text", content: " First " },
|
|
591
|
+
{ _id: "2", _type: "Text", content: " Second " }
|
|
592
|
+
]);
|
|
593
|
+
e(n[0].content).toBe("First "), e(n[1].content).toBe("Second");
|
|
594
|
+
}), s("should handle multiple content fields in a single block", () => {
|
|
595
|
+
const n = S([
|
|
596
|
+
{ _id: "1", _type: "Text", content: "Main", contentAlt: "Alt" },
|
|
597
|
+
{ _id: "2", _type: "Text", content: "Last", contentSecondary: "Secondary" }
|
|
598
|
+
]);
|
|
599
|
+
e(n[0].content).toBe("Main "), e(n[0].contentAlt).toBe("Alt "), e(n[1].content).toBe("Last"), e(n[1].contentSecondary).toBe("Secondary");
|
|
600
|
+
}), s("should only process fields that start with 'content'", () => {
|
|
601
|
+
const n = S([
|
|
602
|
+
{ _id: "1", _type: "Text", content: "Text", title: "Title", text: "Text" },
|
|
603
|
+
{ _id: "2", _type: "Text", content: "Last" }
|
|
604
|
+
]);
|
|
605
|
+
e(n[0].content).toBe("Text "), e(n[0].title).toBe("Title"), e(n[0].text).toBe("Text"), e(n[1].content).toBe("Last");
|
|
606
|
+
}), s("should handle empty array", () => {
|
|
607
|
+
const n = S([]);
|
|
608
|
+
e(n).toEqual([]);
|
|
609
|
+
}), s("should handle single block", () => {
|
|
610
|
+
const n = S([{ _id: "1", _type: "Text", content: "Only" }]);
|
|
611
|
+
e(n[0].content).toBe("Only");
|
|
612
|
+
}), s("should handle blocks without content fields", () => {
|
|
613
|
+
const n = S([
|
|
614
|
+
{ _id: "1", _type: "Container", title: "Title" },
|
|
615
|
+
{ _id: "2", _type: "Container", name: "Name" }
|
|
616
|
+
]);
|
|
617
|
+
e(n[0].title).toBe("Title"), e(n[1].name).toBe("Name");
|
|
618
|
+
}), s("should handle blocks with non-string content fields", () => {
|
|
619
|
+
const n = S([
|
|
620
|
+
{ _id: "1", _type: "Text", content: "Text", contentNum: 123 },
|
|
621
|
+
{ _id: "2", _type: "Text", content: "Last", contentBool: !0 }
|
|
622
|
+
]);
|
|
623
|
+
e(n[0].content).toBe("Text "), e(n[0].contentNum).toBe(123), e(n[1].content).toBe("Last"), e(n[1].contentBool).toBe(!0);
|
|
624
|
+
}), s("should handle empty string content", () => {
|
|
625
|
+
const n = S([
|
|
626
|
+
{ _id: "1", _type: "Text", content: "" },
|
|
627
|
+
{ _id: "2", _type: "Text", content: "Last" }
|
|
628
|
+
]);
|
|
629
|
+
e(n[0].content).toBe(" "), e(n[1].content).toBe("Last");
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
var K = class extends Error {
|
|
634
|
+
constructor(t) {
|
|
635
|
+
super(t), this.name = "Eta Error";
|
|
636
|
+
}
|
|
637
|
+
}, _t = class extends K {
|
|
638
|
+
constructor(t) {
|
|
639
|
+
super(t), this.name = "EtaParser Error";
|
|
640
|
+
}
|
|
641
|
+
}, te = class extends K {
|
|
642
|
+
constructor(t) {
|
|
643
|
+
super(t), this.name = "EtaRuntime Error";
|
|
644
|
+
}
|
|
645
|
+
}, ee = class extends K {
|
|
646
|
+
constructor(t) {
|
|
647
|
+
super(t), this.name = "EtaNameResolution Error";
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
function F(t, s, e) {
|
|
651
|
+
let a = s.slice(0, e).split(/\n/), n = a.length, r = a[n - 1].length + 1;
|
|
652
|
+
throw t += " at line " + n + " col " + r + `:
|
|
653
|
+
|
|
654
|
+
` + s.split(/\n/)[n - 1] + `
|
|
655
|
+
` + Array(r).join(" ") + "^", new _t(t);
|
|
656
|
+
}
|
|
657
|
+
function se(t, s, e, a) {
|
|
658
|
+
let n = s.split(`
|
|
659
|
+
`), r = Math.max(e - 3, 0), o = Math.min(n.length, e + 3), i = a, p = n.slice(r, o).map((f, d) => {
|
|
660
|
+
let g = d + r + 1;
|
|
661
|
+
return (g === e ? " >> " : " ") + g + "| " + f;
|
|
662
|
+
}).join(`
|
|
663
|
+
`), l = new te((i ? i + ":" + e + `
|
|
664
|
+
` : "line " + e + `
|
|
665
|
+
`) + p + `
|
|
666
|
+
|
|
667
|
+
` + t.message);
|
|
668
|
+
throw l.name = t.name, l.cause = t, l;
|
|
669
|
+
}
|
|
670
|
+
const ne = (async () => {
|
|
671
|
+
}).constructor;
|
|
672
|
+
function ae(t, s) {
|
|
673
|
+
let e = this.config, a = s != null && s.async ? ne : Function;
|
|
674
|
+
try {
|
|
675
|
+
return new a(e.varName, "options", this.compileToString.call(this, t, s));
|
|
676
|
+
} catch (n) {
|
|
677
|
+
throw n instanceof SyntaxError ? new _t(`Bad template syntax
|
|
678
|
+
|
|
679
|
+
` + n.message + `
|
|
680
|
+
` + Array(n.message.length + 1).join("=") + `
|
|
681
|
+
` + this.compileToString.call(this, t, s) + `
|
|
682
|
+
`) : n;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function re(t, s) {
|
|
686
|
+
let e = this.config, a = s == null ? void 0 : s.async, n = this.compileBody, r = this.parse.call(this, t), o = `${e.functionHeader}
|
|
687
|
+
let include = (__eta_t, __eta_d) => this.render(__eta_t, {...${e.varName}, ...(__eta_d ?? {})}, options);
|
|
688
|
+
let includeAsync = (__eta_t, __eta_d) => this.renderAsync(__eta_t, {...${e.varName}, ...(__eta_d ?? {})}, options);
|
|
689
|
+
|
|
690
|
+
let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${e.debug ? ', line: 1, templateStr: "' + t.replace(/\\|"/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n") + '"' : ""}};
|
|
691
|
+
|
|
692
|
+
function layout(path, data) {
|
|
693
|
+
__eta.layout = path;
|
|
694
|
+
__eta.layoutData = data;
|
|
695
|
+
}${e.debug ? "try {" : ""}${e.useWith ? "with(" + e.varName + "||{}){" : ""}
|
|
696
|
+
|
|
697
|
+
function ${e.outputFunctionName}(s){__eta.res+=s;}
|
|
698
|
+
|
|
699
|
+
${n.call(this, r)}
|
|
700
|
+
if (__eta.layout) {
|
|
701
|
+
__eta.res = ${a ? "await includeAsync" : "include"} (__eta.layout, {...${e.varName}, body: __eta.res, ...__eta.layoutData});
|
|
702
|
+
}
|
|
703
|
+
${e.useWith ? "}" : ""}${e.debug ? "} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }" : ""}
|
|
704
|
+
return __eta.res;
|
|
705
|
+
`;
|
|
706
|
+
if (e.plugins) for (let i = 0; i < e.plugins.length; i++) {
|
|
707
|
+
let p = e.plugins[i];
|
|
708
|
+
p.processFnString && (o = p.processFnString(o, e));
|
|
709
|
+
}
|
|
710
|
+
return o;
|
|
711
|
+
}
|
|
712
|
+
function ie(t) {
|
|
713
|
+
let s = this.config, e = 0, a = t.length, n = "";
|
|
714
|
+
for (; e < a; e++) {
|
|
715
|
+
let r = t[e];
|
|
716
|
+
if (typeof r == "string") n += "__eta.res+='" + r + `';
|
|
717
|
+
`;
|
|
718
|
+
else {
|
|
719
|
+
let o = r.t, i = r.val || "";
|
|
720
|
+
s.debug && (n += "__eta.line=" + r.lineNo + `
|
|
721
|
+
`), o === "r" ? (s.autoFilter && (i = "__eta.f(" + i + ")"), n += "__eta.res+=" + i + `;
|
|
722
|
+
`) : o === "i" ? (s.autoFilter && (i = "__eta.f(" + i + ")"), s.autoEscape && (i = "__eta.e(" + i + ")"), n += "__eta.res+=" + i + `;
|
|
723
|
+
`) : o === "e" && (n += i + `
|
|
724
|
+
`);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return n;
|
|
728
|
+
}
|
|
729
|
+
function oe(t, s, e, a) {
|
|
730
|
+
let n, r;
|
|
731
|
+
return Array.isArray(s.autoTrim) ? (n = s.autoTrim[1], r = s.autoTrim[0]) : n = r = s.autoTrim, (e || e === !1) && (n = e), (a || a === !1) && (r = a), !r && !n ? t : n === "slurp" && r === "slurp" ? t.trim() : (n === "_" || n === "slurp" ? t = t.trimStart() : (n === "-" || n === "nl") && (t = t.replace(/^(?:\r\n|\n|\r)/, "")), r === "_" || r === "slurp" ? t = t.trimEnd() : (r === "-" || r === "nl") && (t = t.replace(/(?:\r\n|\n|\r)$/, "")), t);
|
|
732
|
+
}
|
|
733
|
+
const le = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
734
|
+
function ce(t) {
|
|
735
|
+
return le[t];
|
|
736
|
+
}
|
|
737
|
+
function pe(t) {
|
|
738
|
+
let s = String(t);
|
|
739
|
+
return /[&<>"']/.test(s) ? s.replace(/[&<>"']/g, ce) : s;
|
|
740
|
+
}
|
|
741
|
+
const ut = { autoEscape: !0, autoFilter: !1, autoTrim: [!1, "nl"], cache: !1, cacheFilepaths: !0, debug: !1, escapeFunction: pe, filterFunction: (t) => String(t), outputFunctionName: "output", functionHeader: "", parse: { exec: "", interpolate: "=", raw: "~" }, plugins: [], rmWhitespace: !1, tags: ["<%", "%>"], useWith: !1, varName: "it", defaultExtension: ".eta" }, D = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g, j = /'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g, M = /"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;
|
|
742
|
+
function H(t) {
|
|
743
|
+
return t.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
744
|
+
}
|
|
745
|
+
function ue(t, s) {
|
|
746
|
+
return t.slice(0, s).split(`
|
|
747
|
+
`).length;
|
|
748
|
+
}
|
|
749
|
+
function de(t) {
|
|
750
|
+
let s = this.config, e = [], a = !1, n = 0, r = s.parse;
|
|
751
|
+
if (s.plugins) for (let d = 0; d < s.plugins.length; d++) {
|
|
752
|
+
let g = s.plugins[d];
|
|
753
|
+
g.processTemplate && (t = g.processTemplate(t, s));
|
|
754
|
+
}
|
|
755
|
+
s.rmWhitespace && (t = t.replace(/[\r\n]+/g, `
|
|
756
|
+
`).replace(/^\s+|\s+$/gm, "")), D.lastIndex = 0, j.lastIndex = 0, M.lastIndex = 0;
|
|
757
|
+
function o(d, g) {
|
|
758
|
+
d && (d = oe(d, s, a, g), d && (d = d.replace(/\\|'/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n"), e.push(d)));
|
|
759
|
+
}
|
|
760
|
+
let i = [r.exec, r.interpolate, r.raw].reduce((d, g) => d && g ? d + "|" + H(g) : g ? H(g) : d, ""), p = RegExp(H(s.tags[0]) + "(-|_)?\\s*(" + i + ")?\\s*", "g"), l = RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?" + H(s.tags[1]) + ")", "g"), f;
|
|
761
|
+
for (; f = p.exec(t); ) {
|
|
762
|
+
let d = t.slice(n, f.index);
|
|
763
|
+
n = f[0].length + f.index;
|
|
764
|
+
let g = f[1], A = f[2] || "";
|
|
765
|
+
o(d, g), l.lastIndex = n;
|
|
766
|
+
let x, I = !1;
|
|
767
|
+
for (; x = l.exec(t); ) if (x[1]) {
|
|
768
|
+
let B = t.slice(n, x.index);
|
|
769
|
+
p.lastIndex = n = l.lastIndex, a = x[2], I = { t: A === r.exec ? "e" : A === r.raw ? "r" : A === r.interpolate ? "i" : "", val: B };
|
|
770
|
+
break;
|
|
771
|
+
} else {
|
|
772
|
+
let B = x[0];
|
|
773
|
+
if (B === "/*") {
|
|
774
|
+
let L = t.indexOf("*/", l.lastIndex);
|
|
775
|
+
L === -1 && F("unclosed comment", t, x.index), l.lastIndex = L;
|
|
776
|
+
} else B === "'" ? (j.lastIndex = x.index, j.exec(t) ? l.lastIndex = j.lastIndex : F("unclosed string", t, x.index)) : B === '"' ? (M.lastIndex = x.index, M.exec(t) ? l.lastIndex = M.lastIndex : F("unclosed string", t, x.index)) : B === "`" && (D.lastIndex = x.index, D.exec(t) ? l.lastIndex = D.lastIndex : F("unclosed string", t, x.index));
|
|
777
|
+
}
|
|
778
|
+
I ? (s.debug && (I.lineNo = ue(t, f.index)), e.push(I)) : F("unclosed tag", t, f.index);
|
|
779
|
+
}
|
|
780
|
+
if (o(t.slice(n, t.length), !1), s.plugins) for (let d = 0; d < s.plugins.length; d++) {
|
|
781
|
+
let g = s.plugins[d];
|
|
782
|
+
g.processAST && (e = g.processAST(e, s));
|
|
783
|
+
}
|
|
784
|
+
return e;
|
|
785
|
+
}
|
|
786
|
+
function bt(t, s) {
|
|
787
|
+
let e = s != null && s.async ? this.templatesAsync : this.templatesSync;
|
|
788
|
+
if (this.resolvePath && this.readFile && !t.startsWith("@")) {
|
|
789
|
+
let a = s.filepath, n = e.get(a);
|
|
790
|
+
if (this.config.cache && n) return n;
|
|
791
|
+
{
|
|
792
|
+
let r = this.readFile(a), o = this.compile(r, s);
|
|
793
|
+
return this.config.cache && e.define(a, o), o;
|
|
794
|
+
}
|
|
795
|
+
} else {
|
|
796
|
+
let a = e.get(t);
|
|
797
|
+
if (a) return a;
|
|
798
|
+
throw new ee(`Failed to get template '${t}'`);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function xt(t, s, e) {
|
|
802
|
+
let a, n = { ...e, async: !1 };
|
|
803
|
+
return typeof t == "string" ? (this.resolvePath && this.readFile && !t.startsWith("@") && (n.filepath = this.resolvePath(t, n)), a = bt.call(this, t, n)) : a = t, a.call(this, s, n);
|
|
804
|
+
}
|
|
805
|
+
function kt(t, s, e) {
|
|
806
|
+
let a, n = { ...e, async: !0 };
|
|
807
|
+
typeof t == "string" ? (this.resolvePath && this.readFile && !t.startsWith("@") && (n.filepath = this.resolvePath(t, n)), a = bt.call(this, t, n)) : a = t;
|
|
808
|
+
let r = a.call(this, s, n);
|
|
809
|
+
return Promise.resolve(r);
|
|
810
|
+
}
|
|
811
|
+
function he(t, s) {
|
|
812
|
+
let e = this.compile(t, { async: !1 });
|
|
813
|
+
return xt.call(this, e, s);
|
|
814
|
+
}
|
|
815
|
+
function ge(t, s) {
|
|
816
|
+
let e = this.compile(t, { async: !0 });
|
|
817
|
+
return kt.call(this, e, s);
|
|
818
|
+
}
|
|
819
|
+
var dt = class {
|
|
820
|
+
constructor(t) {
|
|
821
|
+
this.cache = t;
|
|
822
|
+
}
|
|
823
|
+
define(t, s) {
|
|
824
|
+
this.cache[t] = s;
|
|
825
|
+
}
|
|
826
|
+
get(t) {
|
|
827
|
+
return this.cache[t];
|
|
828
|
+
}
|
|
829
|
+
remove(t) {
|
|
830
|
+
delete this.cache[t];
|
|
831
|
+
}
|
|
832
|
+
reset() {
|
|
833
|
+
this.cache = {};
|
|
834
|
+
}
|
|
835
|
+
load(t) {
|
|
836
|
+
this.cache = { ...this.cache, ...t };
|
|
837
|
+
}
|
|
838
|
+
}, ye = class {
|
|
839
|
+
constructor(t) {
|
|
840
|
+
_(this, "config");
|
|
841
|
+
_(this, "RuntimeErr", se);
|
|
842
|
+
_(this, "compile", ae);
|
|
843
|
+
_(this, "compileToString", re);
|
|
844
|
+
_(this, "compileBody", ie);
|
|
845
|
+
_(this, "parse", de);
|
|
846
|
+
_(this, "render", xt);
|
|
847
|
+
_(this, "renderAsync", kt);
|
|
848
|
+
_(this, "renderString", he);
|
|
849
|
+
_(this, "renderStringAsync", ge);
|
|
850
|
+
_(this, "filepathCache", {});
|
|
851
|
+
_(this, "templatesSync", new dt({}));
|
|
852
|
+
_(this, "templatesAsync", new dt({}));
|
|
853
|
+
_(this, "resolvePath", null);
|
|
854
|
+
_(this, "readFile", null);
|
|
855
|
+
t ? this.config = { ...ut, ...t } : this.config = { ...ut };
|
|
856
|
+
}
|
|
857
|
+
configure(t) {
|
|
858
|
+
this.config = { ...this.config, ...t };
|
|
859
|
+
}
|
|
860
|
+
withConfig(t) {
|
|
861
|
+
return { ...this, config: { ...this.config, ...t } };
|
|
862
|
+
}
|
|
863
|
+
loadTemplate(t, s, e) {
|
|
864
|
+
if (typeof s == "string") (e != null && e.async ? this.templatesAsync : this.templatesSync).define(t, this.compile(s, e));
|
|
865
|
+
else {
|
|
866
|
+
let a = this.templatesSync;
|
|
867
|
+
(s.constructor.name === "AsyncFunction" || e != null && e.async) && (a = this.templatesAsync), a.define(t, s);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}, fe = class extends ye {
|
|
871
|
+
};
|
|
872
|
+
const Z = /\{\{(.*?)\}\}/g, vt = /^[\w$][\w$.]*$/, me = new fe({
|
|
873
|
+
tags: ["{{", "}}"],
|
|
874
|
+
autoEscape: !0,
|
|
875
|
+
autoTrim: !1,
|
|
876
|
+
useWith: !0,
|
|
877
|
+
parse: { interpolate: "", exec: "~", raw: "~" },
|
|
878
|
+
functionHeader: 'const safeGet = (obj, path) => { const parts = path.split("."); let val = obj; for (const p of parts) { if (val == null) return undefined; val = val[p]; } return val; };'
|
|
879
|
+
}), wt = (t, s, e) => {
|
|
880
|
+
const a = e.slice(2, -2).trim();
|
|
881
|
+
return s !== -1 && $(t, "$index.") ? `${a}.${s}.${t.slice(7)}` : s !== -1 && $(t, "$index") ? `${a}.${s}` : t;
|
|
882
|
+
}, _e = (t, s, e) => {
|
|
883
|
+
if (s === -1 || !e) return t;
|
|
884
|
+
const a = e.slice(2, -2).trim();
|
|
885
|
+
return t.replace(/\$index\./g, `safeGet(it, "${a}.${s}").`).replace(/\$index/g, `safeGet(it, "${a}.${s}")`);
|
|
886
|
+
}, be = (t, s, e) => t.replace(Z, (a, n) => {
|
|
887
|
+
const r = n.trim();
|
|
888
|
+
return r ? vt.test(r) ? `{{safeGet(it, "${wt(r, s, e)}") ?? ""}}` : `{{${_e(r, s, e)}}}` : '{{""}}';
|
|
889
|
+
}), xe = (t, s, e, a) => {
|
|
890
|
+
try {
|
|
891
|
+
return me.renderString(be(t, e, a), s);
|
|
892
|
+
} catch {
|
|
893
|
+
return "";
|
|
894
|
+
}
|
|
895
|
+
}, Tt = (t, s, e, a, n) => {
|
|
896
|
+
Z.lastIndex = 0;
|
|
897
|
+
const r = t.match(Z);
|
|
898
|
+
if (!r) return t;
|
|
899
|
+
const o = n === "image" || n === "mobileImage";
|
|
900
|
+
for (const i of r) {
|
|
901
|
+
const p = i.slice(2, -2).trim();
|
|
902
|
+
if (!vt.test(p)) continue;
|
|
903
|
+
const l = wt(p, e, a), f = y(s, l);
|
|
904
|
+
if (q(f) || o && f !== void 0) return f;
|
|
905
|
+
}
|
|
906
|
+
return xe(t, s, e, a);
|
|
907
|
+
}, Pe = (t, s) => Tt(t, s, -1, ""), J = (t, s, { index: e, key: a }, n) => {
|
|
908
|
+
if (C(t))
|
|
909
|
+
return Tt(t, s, e, a, n);
|
|
910
|
+
if (q(t))
|
|
911
|
+
return t.map((r) => J(r, s, { index: e, key: a }, n));
|
|
912
|
+
if (t && typeof t == "object") {
|
|
913
|
+
const r = {};
|
|
914
|
+
return W(V(t), (o) => {
|
|
915
|
+
!$(o, "_") && o !== "$repeaterItemsKey" ? r[o] = J(
|
|
916
|
+
t[o],
|
|
917
|
+
s,
|
|
918
|
+
{ index: e, key: a },
|
|
919
|
+
o
|
|
920
|
+
) : r[o] = t[o];
|
|
921
|
+
}), r;
|
|
922
|
+
}
|
|
923
|
+
return t;
|
|
924
|
+
}, Fe = (t, s, { index: e, key: a }) => {
|
|
925
|
+
let n = Q(t);
|
|
926
|
+
return n.repeaterItems && (n.$repeaterItemsKey = n.repeaterItems, $(n.repeaterItems, `{{${Nt}`) && (n.$repeaterItemsKey = n.repeaterItems = `${n.repeaterItems.replace("}}", `/${n._id}}}`)}`), !v(n.repeaterItems) && n.pagination && (n.repeaterTotalItems = `${n.repeaterItems.replace("}}", `/${n._id}/totalItems}}`)}`)), J(n, s, { index: e, key: a });
|
|
927
|
+
};
|
|
928
|
+
export {
|
|
929
|
+
Fe as a,
|
|
930
|
+
Ne as b,
|
|
931
|
+
Ee as c,
|
|
932
|
+
Ie as d,
|
|
933
|
+
Ce as e,
|
|
934
|
+
S as f,
|
|
935
|
+
Le as g,
|
|
936
|
+
Ae as h,
|
|
937
|
+
T as i,
|
|
938
|
+
gt as j,
|
|
939
|
+
fe as k,
|
|
940
|
+
We as m,
|
|
941
|
+
Pe as r
|
|
942
|
+
};
|