@alfadocs/ui-kit 1.149.1 → 1.151.0
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/dist/_chunks/{address-autocomplete-_LeOFdM7.js → address-autocomplete-Bt1nwxyn.js} +2 -2
- package/dist/_chunks/{address-fields-C4khof4C.js → address-fields-COumFRSX.js} +2 -2
- package/dist/_chunks/{agenda-tray-NgxPuAAz.js → agenda-tray-CmfcYQhc.js} +2 -2
- package/dist/_chunks/{ai-summary-panel-Cdsve-XN.js → ai-summary-panel-DyAHCqaj.js} +4 -4
- package/dist/_chunks/{alia-sidebar-Bjuxk8mU.js → alia-sidebar-BqZjnVoF.js} +2 -2
- package/dist/_chunks/{anamnesis-card-G0qzw0Oi.js → anamnesis-card-CoiG7vDj.js} +2 -2
- package/dist/_chunks/{anamnesis-summary-rows-QCv6zW-J.js → anamnesis-summary-rows-CFpaA1GP.js} +4 -4
- package/dist/_chunks/{app-frame-DUPEwu4E.js → app-frame-XEjLsLGY.js} +2 -2
- package/dist/_chunks/{appointment-card-HOZrABrQ.js → appointment-card-BPZggqck.js} +2 -2
- package/dist/_chunks/{appointment-details-panel.history-BxNqcA-r.js → appointment-details-panel.history-FSsTXj1t.js} +84 -71
- package/dist/_chunks/{appointment-details-panel.identity--_j07UG1.js → appointment-details-panel.identity-9hRo85Lx.js} +91 -79
- package/dist/_chunks/appointment-peek-CmQM4wvx.js +223 -0
- package/dist/_chunks/{appointment-timeline-CuZW-CGT.js → appointment-timeline-COfoHpoJ.js} +4 -4
- package/dist/_chunks/{appointment-tray-CFCxukwq.js → appointment-tray-BlKwDJKi.js} +3 -3
- package/dist/_chunks/{balance-badge-cell-BPz9bQAB.js → balance-badge-cell-OghXENKK.js} +4 -4
- package/dist/_chunks/{bill-line-table-B8Cc2pTH.js → bill-line-table-DxV5_Dmq.js} +2 -2
- package/dist/_chunks/{calendar-appointment-editor-dialog-fQleWmJE.js → calendar-appointment-editor-dialog-BPAfWtm9.js} +590 -583
- package/dist/_chunks/{calendar-editor-discard-host-DWS_kM-a.js → calendar-editor-discard-host-BudLsUZO.js} +5 -5
- package/dist/_chunks/{calendar-waiting-list-panel-BKBHfBpn.js → calendar-waiting-list-panel-DukgSOPH.js} +9 -9
- package/dist/_chunks/{calendar-workspace.model-4zmA3BFE.js → calendar-workspace.model-BulUpy0I.js} +2 -2
- package/dist/_chunks/{calendar.sheets-lgAqJB34.js → calendar.sheets-OmTiQdCg.js} +11 -11
- package/dist/_chunks/{calls-panel-BTTfHnPD.js → calls-panel-eohONLia.js} +5 -5
- package/dist/_chunks/{care-plan-card-2U2LuIJD.js → care-plan-card-DJXNWjKB.js} +3 -3
- package/dist/_chunks/{care-plan-entry-card-CUAlQv1c.js → care-plan-entry-card-W5QvNv8m.js} +2 -2
- package/dist/_chunks/code-BfU9G1ZM.js +15 -0
- package/dist/_chunks/{communications-panel-DDzUyoHi.js → communications-panel-CqiFs8BH.js} +4 -4
- package/dist/_chunks/{connection-status-Bi6KPTlh.js → connection-status-C13KmOPL.js} +2 -2
- package/dist/_chunks/control-room-rail-BmpTKtL1.js +456 -0
- package/dist/_chunks/{data-grid-CkzbCZSo.js → data-grid-DTAwrOiq.js} +3 -3
- package/dist/_chunks/{data-table-DFAYYsSc.js → data-table-CgpHO6EZ.js} +2 -2
- package/dist/_chunks/{default-tabs-C45FVzsG.js → default-tabs-CZaDDf1G.js} +4 -4
- package/dist/_chunks/{description-list-DA4TgL_I.js → description-list-DaldSpGy.js} +29 -26
- package/dist/_chunks/dev-bypass-button-DFcNpCQj.js +24 -0
- package/dist/_chunks/{document-preview-oSuJsJ3k.js → document-preview-TbwhY_eK.js} +4 -4
- package/dist/_chunks/{editable-currency-cell-renderer-DXJI0fnU.js → editable-currency-cell-renderer-a3CrwNKm.js} +143 -168
- package/dist/_chunks/{editable-description-BsSjLnSx.js → editable-description-B2F54K4T.js} +34 -33
- package/dist/_chunks/{empty-state-5REM7oDM.js → empty-state-qHtpcasr.js} +65 -77
- package/dist/_chunks/{entity-summary-CZmGcWi2.js → entity-summary-BNnTP1F6.js} +62 -50
- package/dist/_chunks/{error-boundary-BQ5mRqEd.js → error-boundary-BDS1XStO.js} +2 -2
- package/dist/_chunks/{error-page-CdNGIezW.js → error-page-3gWV-Vmj.js} +2 -2
- package/dist/_chunks/{error-page-illustration-BdJLuMdV.js → error-page-illustration-CJCjLk_-.js} +125 -149
- package/dist/_chunks/{face-scheme-BC2whb1S.js → face-scheme-DRYGaszs.js} +255 -264
- package/dist/_chunks/feature-preview-switch-B_8JTya_.js +75 -0
- package/dist/_chunks/{file-manager-Cp3Z4VvM.js → file-manager-DMvYx-Gq.js} +165 -180
- package/dist/_chunks/folder-DvNxod7_.js +36 -0
- package/dist/_chunks/{heatmap-DvsZ-mcL.js → heatmap-BZNkPkDD.js} +4 -4
- package/dist/_chunks/{help-me-write-templates-DlA54nu5.js → help-me-write-templates-VnvlK87x.js} +3 -3
- package/dist/_chunks/{info-tip-cCppV1fD.js → info-tip-DkVISvo-.js} +2 -2
- package/dist/_chunks/{invoice-upload-list-BReimsvV.js → invoice-upload-list-DutydbjC.js} +3 -3
- package/dist/_chunks/{link-cell-renderer-CWLArl5e.js → link-cell-renderer-DTunki79.js} +3 -3
- package/dist/_chunks/{login-dev-card-DqUNJcd7.js → login-dev-card-CQz9yhrU.js} +2 -2
- package/dist/_chunks/{map-view-n6GiDRWM.js → map-view-B67HXWPR.js} +2 -2
- package/dist/_chunks/mark-adrift-LBqHvZwv.js +42 -0
- package/dist/_chunks/{marketplace-app-shell-CGA-R-zt.js → marketplace-app-shell-CclaaAvb.js} +3 -3
- package/dist/_chunks/message-square-warning-DsGGfd0K.js +22 -0
- package/dist/_chunks/{message-tray-Dx2HPcKB.js → message-tray-DysT-DPS.js} +2 -2
- package/dist/_chunks/{note-timeline-BbjHMhkL.js → note-timeline-CS5j2OKD.js} +86 -77
- package/dist/_chunks/notebook-text-spVSekMN.js +21 -0
- package/dist/_chunks/{notes-panel-Cw06dLDm.js → notes-panel-d0I3hOEY.js} +363 -341
- package/dist/_chunks/{notification-tray-BnC5OItw.js → notification-tray-CjGDlwLg.js} +2 -2
- package/dist/_chunks/{optical-prescription-DZvauMiM.js → optical-prescription-CAnXavjq.js} +3 -3
- package/dist/_chunks/{panel-header-CbtlTe85.js → panel-header-DTc5OFUg.js} +78 -66
- package/dist/_chunks/panel-right-CnMHSvLU.js +15 -0
- package/dist/_chunks/{panel-subview-DjBwNV16.js → panel-subview-B5hnQwfQ.js} +3 -3
- package/dist/_chunks/{patient-account-settings-Do0QbDJe.js → patient-account-settings-DQx_9CYV.js} +3 -3
- package/dist/_chunks/{patient-check-in-resume-Bxy1_Pfo.js → patient-check-in-resume-BOHcm9hT.js} +6 -6
- package/dist/_chunks/{patient-details-Cj3dp9GB.js → patient-details-wFIzTz7N.js} +4 -4
- package/dist/_chunks/{patient-field-row-DDjsUsc_.js → patient-field-row-BDgfYLgz.js} +202 -201
- package/dist/_chunks/{patient-summary-card-roM9Esfb.js → patient-summary-card-ZunOre3Q.js} +158 -164
- package/dist/_chunks/{payment-request-card-C9VglWsV.js → payment-request-card-BSSfKrcc.js} +3 -3
- package/dist/_chunks/{portal-details-CKF4yFHs.js → portal-details-R-lwrisO.js} +4 -4
- package/dist/_chunks/{portal-documents-DvpAwmSI.js → portal-documents-C6XlWpEl.js} +3 -3
- package/dist/_chunks/{portal-parts-Cvu4PfIY.js → portal-parts-DlvSUZFX.js} +3 -3
- package/dist/_chunks/{practice-results-D0TAgL8v.js → practice-results-CqoB5YAv.js} +5 -5
- package/dist/_chunks/{prescription-history-CQuJmd4H.js → prescription-history-CxBM3gnm.js} +4 -4
- package/dist/_chunks/{privacy-mask-zVh0ntm0.js → privacy-mask-CaLBAxzj.js} +3 -3
- package/dist/_chunks/{product-hub-panel-NVpRuJeW.js → product-hub-panel-RJzrDcGp.js} +3 -3
- package/dist/_chunks/{public-header.agent-Dzo6ujrE.js → public-header.agent-B2CqVq4s.js} +2 -2
- package/dist/_chunks/{radiograph-panel.agent-BUZPsuSP.js → radiograph-panel.agent-kgCmmgZk.js} +4 -4
- package/dist/_chunks/{registration-form-AtRCt8n5.js → registration-form-Dbe1sFZb.js} +2 -2
- package/dist/_chunks/{registry-connection-panel-ACOsXu3F.js → registry-connection-panel-BkPPA3Fj.js} +4 -4
- package/dist/_chunks/{reserved.agent-DjvapRF1.js → reserved.agent-C-sMq0pb.js} +5 -5
- package/dist/_chunks/{reviews-panel-Cw5ygAxs.js → reviews-panel-jIz5aP2X.js} +4 -4
- package/dist/_chunks/rich-text-editor-DTadvKa7.js +4716 -0
- package/dist/_chunks/{scroll-area-CY5SLYNw.js → scroll-area-RQtcKkHf.js} +84 -79
- package/dist/_chunks/{sheet-CZDjW9Q-.js → sheet-1LXzej6Q.js} +2 -2
- package/dist/_chunks/{sidebar-D5DFYN5K.js → sidebar-BV9JCgS4.js} +2 -2
- package/dist/_chunks/{signed-out-frame-CC25CgKo.js → signed-out-frame-CKA8SSbU.js} +2 -2
- package/dist/_chunks/{signing-end-screen-Bq6tkFE6.js → signing-end-screen-HXkalppf.js} +2 -2
- package/dist/_chunks/{slot-grid-khIpy8Gx.js → slot-grid-DdqeF6PW.js} +2 -2
- package/dist/_chunks/{sync-tray-BQD-HuA4.js → sync-tray-CSVGzuur.js} +2 -2
- package/dist/_chunks/{task-editor-C-4I2sBa.js → task-editor-aXjGMwYA.js} +6 -6
- package/dist/_chunks/{task-tray-CxxcGGgx.js → task-tray-C48Vq8nt.js} +2 -2
- package/dist/_chunks/{tasks-panel-BDPQPOP6.js → tasks-panel-BdxHb-fX.js} +3 -3
- package/dist/_chunks/text-area-DbxGkpzE.js +269 -0
- package/dist/_chunks/{tool-rail-DjPEiBa2.js → tool-rail-B4p6MmxA.js} +383 -363
- package/dist/_chunks/{toolbar-B9oh9XY9.js → toolbar-B2JJ_XDT.js} +2 -2
- package/dist/_chunks/tooth-chip-DOv925IH.js +41 -0
- package/dist/_chunks/{transaction-chip-CkYd-3ky.js → transaction-chip-6jToArJn.js} +45 -43
- package/dist/_chunks/{transcript-panel-Wr8e4Zgi.js → transcript-panel-Dc0fK4WO.js} +2 -2
- package/dist/_chunks/{treatment-receipt-BZzwvsnY.js → treatment-receipt-CZQV1NkJ.js} +59 -62
- package/dist/_chunks/use-appointment-details-read-BR3TQOHx.js +2091 -0
- package/dist/_chunks/user-round-DZxRG9zq.js +15 -0
- package/dist/_chunks/{week-availability-D0tTll4q.js → week-availability-D00rMjsX.js} +2 -2
- package/dist/_chunks/{workflow-map-F7OThorL.js → workflow-map-DLUTUZ27.js} +2 -2
- package/dist/agent-catalog.json +15 -1
- package/dist/appointment-editor-panel/index.js +4 -4
- package/dist/booking-tools-data/index.js +1 -1
- package/dist/browser-support.js +1 -1
- package/dist/calendar-action-buttons/index.js +1 -1
- package/dist/components/_shared/appointment-format.d.ts +4 -0
- package/dist/components/_shared/mark-adrift.d.ts +12 -0
- package/dist/components/_shared/patient-field-row.d.ts +5 -1
- package/dist/components/_shared/safe-html.d.ts +6 -0
- package/dist/components/_shared/tooth-chip.d.ts +21 -0
- package/dist/components/address-autocomplete/index.js +1 -1
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/ai-summary-panel/index.js +1 -1
- package/dist/components/anamnesis-card/index.js +1 -1
- package/dist/components/app-frame/index.js +1 -1
- package/dist/components/appointment-card/index.js +2 -2
- package/dist/components/appointment-details-panel/appointment-details-panel.d.ts +12 -2
- package/dist/components/appointment-details-panel/appointment-details-panel.sections.d.ts +3 -1
- package/dist/components/appointment-details-panel/appointment-details-panel.types.d.ts +12 -2
- package/dist/components/appointment-details-panel/description-length.d.ts +18 -0
- package/dist/components/appointment-details-panel/index.d.ts +1 -0
- package/dist/components/appointment-details-panel/index.js +7 -6
- package/dist/components/appointment-peek/appointment-peek.d.ts +45 -1
- package/dist/components/appointment-peek/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/bill-line-table/index.js +1 -1
- package/dist/components/bill-table/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calls-panel/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/communications-panel/index.js +1 -1
- package/dist/components/connection-status/index.js +1 -1
- package/dist/components/control-room-rail/control-room-rail.d.ts +24 -0
- package/dist/components/control-room-rail/index.js +1 -1
- package/dist/components/data-grid/index.js +2 -2
- package/dist/components/data-table/index.js +3 -3
- package/dist/components/description-list/index.js +1 -1
- package/dist/components/dev-bypass-button/index.js +1 -1
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/editable-description/editable-description.d.ts +7 -0
- package/dist/components/editable-description/index.js +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/entity-summary/index.js +1 -1
- package/dist/components/error-boundary/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/feature-preview-switch/feature-preview-switch.d.ts +55 -0
- package/dist/components/feature-preview-switch/index.d.ts +2 -0
- package/dist/components/feature-preview-switch/index.js +5 -0
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/heatmap/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/info-tip/index.js +1 -1
- package/dist/components/invoice-upload-list/index.js +1 -1
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/note-timeline/index.js +1 -1
- package/dist/components/note-timeline/note-timeline.d.ts +8 -0
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/notes-panel/notes-panel.d.ts +33 -2
- package/dist/components/notification-tray/index.js +1 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/panel-header/index.js +1 -1
- package/dist/components/panel-header/panel-header.d.ts +8 -0
- package/dist/components/panel-subview/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-summary-card/patient-summary-card.d.ts +9 -0
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/product-hub-tray/index.js +1 -1
- package/dist/components/public-header/index.js +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/registry-connection-panel/index.js +1 -1
- package/dist/components/reviews-panel/index.js +1 -1
- package/dist/components/rich-text-editor/editor-toolbar.d.ts +18 -5
- package/dist/components/rich-text-editor/index.d.ts +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/link-bar.d.ts +8 -0
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +25 -3
- package/dist/components/scroll-area/index.js +1 -1
- package/dist/components/scroll-area/scroll-area.d.ts +6 -0
- package/dist/components/sheet/index.js +1 -1
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/slot-grid/index.js +1 -1
- package/dist/components/sync-tray/index.js +1 -1
- package/dist/components/task-editor/index.js +1 -1
- package/dist/components/task-tray/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/components/text-area/index.js +1 -1
- package/dist/components/text-area/text-area.d.ts +15 -0
- package/dist/components/tool-rail/index.js +1 -1
- package/dist/components/tool-rail/tool-rail.d.ts +23 -1
- package/dist/components/transaction-chip/index.js +1 -1
- package/dist/components/transaction-chip/transaction-chip.d.ts +7 -0
- package/dist/components/transcript-panel/index.js +1 -1
- package/dist/components/treatment-receipt/index.js +1 -1
- package/dist/components/treatment-receipt/treatment-receipt.d.ts +6 -1
- package/dist/components/week-availability/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/find-free-slots-panel/index.js +1 -1
- package/dist/host-compat.css +4 -1
- package/dist/host-legacy.css +63 -4
- package/dist/i18n/locales/ar.d.ts +18 -0
- package/dist/i18n/locales/ar.js +18 -3
- package/dist/i18n/locales/de.d.ts +18 -0
- package/dist/i18n/locales/de.js +18 -3
- package/dist/i18n/locales/el.d.ts +18 -0
- package/dist/i18n/locales/el.js +21 -3
- package/dist/i18n/locales/en.d.ts +18 -0
- package/dist/i18n/locales/en.js +21 -3
- package/dist/i18n/locales/es.d.ts +18 -0
- package/dist/i18n/locales/es.js +21 -3
- package/dist/i18n/locales/fr.d.ts +18 -0
- package/dist/i18n/locales/fr.js +21 -3
- package/dist/i18n/locales/hi.d.ts +18 -0
- package/dist/i18n/locales/hi.js +18 -3
- package/dist/i18n/locales/it.d.ts +28 -10
- package/dist/i18n/locales/it.js +31 -13
- package/dist/i18n/locales/ja.d.ts +18 -0
- package/dist/i18n/locales/ja.js +18 -3
- package/dist/i18n/locales/nl.d.ts +18 -0
- package/dist/i18n/locales/nl.js +18 -3
- package/dist/i18n/locales/pl.d.ts +18 -0
- package/dist/i18n/locales/pl.js +21 -3
- package/dist/i18n/locales/pt.d.ts +18 -0
- package/dist/i18n/locales/pt.js +21 -3
- package/dist/i18n/locales/ro.d.ts +18 -0
- package/dist/i18n/locales/ro.js +21 -3
- package/dist/i18n/locales/ru.d.ts +18 -0
- package/dist/i18n/locales/ru.js +18 -3
- package/dist/i18n/locales/sq.d.ts +18 -0
- package/dist/i18n/locales/sq.js +21 -3
- package/dist/i18n/locales/sv.d.ts +18 -0
- package/dist/i18n/locales/sv.js +18 -3
- package/dist/i18n/locales/tr.d.ts +18 -0
- package/dist/i18n/locales/tr.js +18 -3
- package/dist/i18n/locales/zh.d.ts +18 -0
- package/dist/i18n/locales/zh.js +18 -3
- package/dist/index.js +820 -817
- package/dist/locales/ar.json +21 -3
- package/dist/locales/de.json +21 -3
- package/dist/locales/el.json +21 -3
- package/dist/locales/en.json +21 -3
- package/dist/locales/es.json +21 -3
- package/dist/locales/fr.json +21 -3
- package/dist/locales/hi.json +21 -3
- package/dist/locales/it.json +31 -13
- package/dist/locales/ja.json +21 -3
- package/dist/locales/nl.json +21 -3
- package/dist/locales/pl.json +21 -3
- package/dist/locales/pt.json +21 -3
- package/dist/locales/ro.json +21 -3
- package/dist/locales/ru.json +21 -3
- package/dist/locales/sq.json +21 -3
- package/dist/locales/sv.json +21 -3
- package/dist/locales/tr.json +21 -3
- package/dist/locales/zh.json +21 -3
- package/dist/online-bookings-panel/index.js +2 -2
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/calendar/index.js +4 -4
- package/dist/patterns/error-page/index.js +2 -2
- package/dist/patterns/help-me-write-templates/index.js +1 -1
- package/dist/patterns/login-form/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/patient-account-settings/index.js +1 -1
- package/dist/patterns/patient-check-in/index.js +1 -1
- package/dist/patterns/patient-portal/index.js +2 -2
- package/dist/patterns/prescription/index.js +1 -1
- package/dist/patterns/registration-form/index.js +1 -1
- package/dist/patterns/signed-out-frame/index.js +1 -1
- package/dist/patterns/signing/index.js +1 -1
- package/dist/redactor.css +9 -0
- package/dist/safe-html/index.js +33 -19
- package/dist/tokens.css +61 -52
- package/dist/waiting-list-panel/index.js +3 -3
- package/package.json +5 -1
- package/dist/_chunks/appointment-peek-B3raO90X.js +0 -123
- package/dist/_chunks/contact-round-DiSvB3LP.js +0 -18
- package/dist/_chunks/control-room-rail-BQvaYowi.js +0 -416
- package/dist/_chunks/dev-bypass-button-BzfYGPuf.js +0 -33
- package/dist/_chunks/folder-BghC8_S2.js +0 -20
- package/dist/_chunks/rich-text-editor-eGdYDPK2.js +0 -4405
- package/dist/_chunks/text-area-COMVJ1yE.js +0 -258
- package/dist/_chunks/use-appointment-details-read-Bl1DHXQ2.js +0 -1998
- /package/dist/{patterns → components}/_shared/mark-pieces.d.ts +0 -0
|
@@ -0,0 +1,4716 @@
|
|
|
1
|
+
import { jsx as t, jsxs as C, Fragment as Ze } from "react/jsx-runtime";
|
|
2
|
+
import { useId as Qe, useState as A, useRef as k, useEffect as $, useCallback as x, useLayoutEffect as po, Fragment as Bt, forwardRef as ki, useMemo as Ct, useImperativeHandle as xi } from "react";
|
|
3
|
+
import { c as Et } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as de } from "react-i18next";
|
|
5
|
+
import { SafeHtml as Ci, sanitiseHtml as Ai } from "../safe-html/index.js";
|
|
6
|
+
import { a as Ni, c as Ti, d as Ei, b as bo } from "./ai-fab-pill-BOu96kCx.js";
|
|
7
|
+
import { u as Mi } from "./registry-DvAUVLHh.js";
|
|
8
|
+
import { u as zi } from "./use-ai-sparkle-Cf4yVTLB.js";
|
|
9
|
+
import { S as tr } from "./spinner-CoflYlEx.js";
|
|
10
|
+
import { A as Ri } from "./ai-sparkle-D23NT8Z_.js";
|
|
11
|
+
import { B as $e } from "./button-Dp4j9ygh.js";
|
|
12
|
+
import { I as te } from "./icon-button-u9VMQn3x.js";
|
|
13
|
+
import { A as Si } from "./ai-permission-notice-C_YB3MBA.js";
|
|
14
|
+
import { T as Li } from "./text-area-DbxGkpzE.js";
|
|
15
|
+
import { E as Kn } from "./editor-overlay-jc9HUeQ2.js";
|
|
16
|
+
import { A as _i } from "./ai-credits-exhausted-notice-DCq27xy2.js";
|
|
17
|
+
import { u as Ii } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
18
|
+
import { X as Hi } from "./x-B5YnXwCz.js";
|
|
19
|
+
import { R as $i } from "./rotate-ccw-BBQnIVTr.js";
|
|
20
|
+
import { C as Oi } from "./check-DrFSN__t.js";
|
|
21
|
+
import { L as Wn } from "./loader-circle-BECIU_8N.js";
|
|
22
|
+
import { S as Dt } from "./square-DASBRZ0U.js";
|
|
23
|
+
import { M as Xn } from "./mic-CUklMZGF.js";
|
|
24
|
+
import { S as Di } from "./send-C5kDJ-Mz.js";
|
|
25
|
+
import { D as U } from "./dropdown-menu-Bm1KALnk.js";
|
|
26
|
+
import * as dn from "@radix-ui/react-popover";
|
|
27
|
+
import { u as qi, f as Pi } from "./non-modal-tab-exit-DqJao_E-.js";
|
|
28
|
+
import { V as vo } from "./variables-menu-C4NcClKi.js";
|
|
29
|
+
import { a as nr } from "./tooltip-uEBdD1-5.js";
|
|
30
|
+
import { P as fe } from "./popover-C9O7my6h.js";
|
|
31
|
+
import { D as be } from "./dialog-239Geb7Z.js";
|
|
32
|
+
import { C as rr } from "./color-picker-5FKOk_z1.js";
|
|
33
|
+
import { S as gn } from "./state-backed-text-input-DVETOhSS.js";
|
|
34
|
+
import { C as Bi } from "./checkbox-DV4sNDeB.js";
|
|
35
|
+
import { F as Fi } from "./file-upload-DQc0LsBM.js";
|
|
36
|
+
import { c as O } from "./createLucideIcon-DhHxpK9K.js";
|
|
37
|
+
import { E as ji } from "./ellipsis-dRo9ouSU.js";
|
|
38
|
+
import { C as or } from "./chevron-down-DWE7GSq9.js";
|
|
39
|
+
import { P as Gi } from "./plus-DzMQ_c6b.js";
|
|
40
|
+
import { S as Vi } from "./settings-d25ju_6L.js";
|
|
41
|
+
import { P as Ki } from "./panel-right-CnMHSvLU.js";
|
|
42
|
+
import { M as Wi } from "./minus-BQDHq1c1.js";
|
|
43
|
+
import { U as Xi } from "./undo-2-EBxWjj1W.js";
|
|
44
|
+
import { C as Ui } from "./code-BfU9G1ZM.js";
|
|
45
|
+
import { T as Zi } from "./trash-2-uumy3fy1.js";
|
|
46
|
+
import { H as Qi } from "./highlighter-DSkckT2Q.js";
|
|
47
|
+
import { I as Yi } from "./image-B_5MNK0x.js";
|
|
48
|
+
import { u as Ji, w as At } from "./ai-credits-notice-B6buIgmV.js";
|
|
49
|
+
/**
|
|
50
|
+
* @license lucide-react v1.22.0 - ISC
|
|
51
|
+
*
|
|
52
|
+
* This source code is licensed under the ISC license.
|
|
53
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
+
*/
|
|
55
|
+
const ea = [
|
|
56
|
+
["path", { d: "m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16", key: "xik6mr" }],
|
|
57
|
+
["path", { d: "M15.697 14h5.606", key: "1stdlc" }],
|
|
58
|
+
["path", { d: "m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16", key: "d5nyq2" }],
|
|
59
|
+
["path", { d: "M3.304 13h6.392", key: "1q3zxz" }]
|
|
60
|
+
], ta = O("a-large-small", ea);
|
|
61
|
+
/**
|
|
62
|
+
* @license lucide-react v1.22.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/
|
|
67
|
+
const na = [
|
|
68
|
+
["path", { d: "M4 20h16", key: "14thso" }],
|
|
69
|
+
["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
|
|
70
|
+
["path", { d: "M8 12h8", key: "1wcyev" }]
|
|
71
|
+
], ra = O("baseline", na);
|
|
72
|
+
/**
|
|
73
|
+
* @license lucide-react v1.22.0 - ISC
|
|
74
|
+
*
|
|
75
|
+
* This source code is licensed under the ISC license.
|
|
76
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
+
*/
|
|
78
|
+
const oa = [
|
|
79
|
+
["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
|
|
80
|
+
["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
|
|
81
|
+
["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
|
|
82
|
+
], ia = O("between-horizontal-end", oa);
|
|
83
|
+
/**
|
|
84
|
+
* @license lucide-react v1.22.0 - ISC
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the ISC license.
|
|
87
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/
|
|
89
|
+
const aa = [
|
|
90
|
+
["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
|
|
91
|
+
["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
|
|
92
|
+
["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
|
|
93
|
+
], sa = O("between-horizontal-start", aa);
|
|
94
|
+
/**
|
|
95
|
+
* @license lucide-react v1.22.0 - ISC
|
|
96
|
+
*
|
|
97
|
+
* This source code is licensed under the ISC license.
|
|
98
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
+
*/
|
|
100
|
+
const la = [
|
|
101
|
+
["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
|
|
102
|
+
["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
|
|
103
|
+
["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
|
|
104
|
+
], ca = O("between-vertical-end", la);
|
|
105
|
+
/**
|
|
106
|
+
* @license lucide-react v1.22.0 - ISC
|
|
107
|
+
*
|
|
108
|
+
* This source code is licensed under the ISC license.
|
|
109
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
+
*/
|
|
111
|
+
const da = [
|
|
112
|
+
["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
|
|
113
|
+
["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
|
|
114
|
+
["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
|
|
115
|
+
], ua = O("between-vertical-start", da);
|
|
116
|
+
/**
|
|
117
|
+
* @license lucide-react v1.22.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/
|
|
122
|
+
const ma = [
|
|
123
|
+
[
|
|
124
|
+
"path",
|
|
125
|
+
{
|
|
126
|
+
d: "M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",
|
|
127
|
+
key: "1ah6g2"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
["rect", { x: "14", y: "2", width: "8", height: "8", rx: "1", key: "88lufb" }]
|
|
131
|
+
], Un = O("blocks", ma);
|
|
132
|
+
/**
|
|
133
|
+
* @license lucide-react v1.22.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/
|
|
138
|
+
const fa = [
|
|
139
|
+
[
|
|
140
|
+
"path",
|
|
141
|
+
{ d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
|
|
142
|
+
]
|
|
143
|
+
], ha = O("bold", fa);
|
|
144
|
+
/**
|
|
145
|
+
* @license lucide-react v1.22.0 - ISC
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the ISC license.
|
|
148
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
+
*/
|
|
150
|
+
const ga = [
|
|
151
|
+
[
|
|
152
|
+
"path",
|
|
153
|
+
{ d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
"path",
|
|
157
|
+
{
|
|
158
|
+
d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
|
|
159
|
+
key: "e1hn23"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
], pa = O("braces", ga);
|
|
163
|
+
/**
|
|
164
|
+
* @license lucide-react v1.22.0 - ISC
|
|
165
|
+
*
|
|
166
|
+
* This source code is licensed under the ISC license.
|
|
167
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
+
*/
|
|
169
|
+
const ba = [
|
|
170
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
171
|
+
["path", { d: "M12 3v18", key: "108xh3" }]
|
|
172
|
+
], va = O("columns-2", ba);
|
|
173
|
+
/**
|
|
174
|
+
* @license lucide-react v1.22.0 - ISC
|
|
175
|
+
*
|
|
176
|
+
* This source code is licensed under the ISC license.
|
|
177
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
+
*/
|
|
179
|
+
const ya = [
|
|
180
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
181
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
182
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
183
|
+
["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
|
|
184
|
+
], wa = O("heading-2", ya);
|
|
185
|
+
/**
|
|
186
|
+
* @license lucide-react v1.22.0 - ISC
|
|
187
|
+
*
|
|
188
|
+
* This source code is licensed under the ISC license.
|
|
189
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
+
*/
|
|
191
|
+
const ka = [
|
|
192
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
193
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
194
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
195
|
+
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
|
196
|
+
], xa = O("heading-1", ka);
|
|
197
|
+
/**
|
|
198
|
+
* @license lucide-react v1.22.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/
|
|
203
|
+
const Ca = [
|
|
204
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
205
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
206
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
207
|
+
["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
|
|
208
|
+
["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
|
|
209
|
+
], Aa = O("heading-3", Ca);
|
|
210
|
+
/**
|
|
211
|
+
* @license lucide-react v1.22.0 - ISC
|
|
212
|
+
*
|
|
213
|
+
* This source code is licensed under the ISC license.
|
|
214
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
+
*/
|
|
216
|
+
const Na = [
|
|
217
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
218
|
+
["path", { d: "M17 10v3a1 1 0 0 0 1 1h3", key: "tj5zdr" }],
|
|
219
|
+
["path", { d: "M21 10v8", key: "1kdml4" }],
|
|
220
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
221
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }]
|
|
222
|
+
], Ta = O("heading-4", Na);
|
|
223
|
+
/**
|
|
224
|
+
* @license lucide-react v1.22.0 - ISC
|
|
225
|
+
*
|
|
226
|
+
* This source code is licensed under the ISC license.
|
|
227
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
228
|
+
*/
|
|
229
|
+
const Ea = [
|
|
230
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
231
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
232
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
233
|
+
["path", { d: "M17 13v-3h4", key: "1nvgqp" }],
|
|
234
|
+
[
|
|
235
|
+
"path",
|
|
236
|
+
{ d: "M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17", key: "2nebdn" }
|
|
237
|
+
]
|
|
238
|
+
], Ma = O("heading-5", Ea);
|
|
239
|
+
/**
|
|
240
|
+
* @license lucide-react v1.22.0 - ISC
|
|
241
|
+
*
|
|
242
|
+
* This source code is licensed under the ISC license.
|
|
243
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
+
*/
|
|
245
|
+
const za = [
|
|
246
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
|
247
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
|
248
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
|
249
|
+
["circle", { cx: "19", cy: "16", r: "2", key: "15mx69" }],
|
|
250
|
+
["path", { d: "M20 10c-2 2-3 3.5-3 6", key: "f35dl0" }]
|
|
251
|
+
], Ra = O("heading-6", za);
|
|
252
|
+
/**
|
|
253
|
+
* @license lucide-react v1.22.0 - ISC
|
|
254
|
+
*
|
|
255
|
+
* This source code is licensed under the ISC license.
|
|
256
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
257
|
+
*/
|
|
258
|
+
const Sa = [
|
|
259
|
+
["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
|
|
260
|
+
["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
|
|
261
|
+
["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
|
|
262
|
+
], La = O("italic", Sa);
|
|
263
|
+
/**
|
|
264
|
+
* @license lucide-react v1.22.0 - ISC
|
|
265
|
+
*
|
|
266
|
+
* This source code is licensed under the ISC license.
|
|
267
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
268
|
+
*/
|
|
269
|
+
const _a = [
|
|
270
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
271
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
272
|
+
], Ia = O("link", _a);
|
|
273
|
+
/**
|
|
274
|
+
* @license lucide-react v1.22.0 - ISC
|
|
275
|
+
*
|
|
276
|
+
* This source code is licensed under the ISC license.
|
|
277
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
+
*/
|
|
279
|
+
const Ha = [
|
|
280
|
+
["path", { d: "M21 5H11", key: "us1j55" }],
|
|
281
|
+
["path", { d: "M21 12H11", key: "wd7e0v" }],
|
|
282
|
+
["path", { d: "M21 19H11", key: "saa85w" }],
|
|
283
|
+
["path", { d: "m7 8-4 4 4 4", key: "o5hrat" }]
|
|
284
|
+
], $a = O("list-indent-decrease", Ha);
|
|
285
|
+
/**
|
|
286
|
+
* @license lucide-react v1.22.0 - ISC
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the ISC license.
|
|
289
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/
|
|
291
|
+
const Oa = [
|
|
292
|
+
["path", { d: "M21 5H11", key: "us1j55" }],
|
|
293
|
+
["path", { d: "M21 12H11", key: "wd7e0v" }],
|
|
294
|
+
["path", { d: "M21 19H11", key: "saa85w" }],
|
|
295
|
+
["path", { d: "m3 8 4 4-4 4", key: "1a3j6y" }]
|
|
296
|
+
], Da = O("list-indent-increase", Oa);
|
|
297
|
+
/**
|
|
298
|
+
* @license lucide-react v1.22.0 - ISC
|
|
299
|
+
*
|
|
300
|
+
* This source code is licensed under the ISC license.
|
|
301
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
302
|
+
*/
|
|
303
|
+
const qa = [
|
|
304
|
+
["path", { d: "M11 5h10", key: "1cz7ny" }],
|
|
305
|
+
["path", { d: "M11 12h10", key: "1438ji" }],
|
|
306
|
+
["path", { d: "M11 19h10", key: "11t30w" }],
|
|
307
|
+
["path", { d: "M4 4h1v5", key: "10yrso" }],
|
|
308
|
+
["path", { d: "M4 9h2", key: "r1h2o0" }],
|
|
309
|
+
["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
|
|
310
|
+
], Pa = O("list-ordered", qa);
|
|
311
|
+
/**
|
|
312
|
+
* @license lucide-react v1.22.0 - ISC
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the ISC license.
|
|
315
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
+
*/
|
|
317
|
+
const Ba = [
|
|
318
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
319
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
320
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
321
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
322
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
323
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
324
|
+
], Fa = O("list", Ba);
|
|
325
|
+
/**
|
|
326
|
+
* @license lucide-react v1.22.0 - ISC
|
|
327
|
+
*
|
|
328
|
+
* This source code is licensed under the ISC license.
|
|
329
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
+
*/
|
|
331
|
+
const ja = [
|
|
332
|
+
["path", { d: "M11 7 6 2", key: "1jwth8" }],
|
|
333
|
+
["path", { d: "M18.992 12H2.041", key: "xw1gg" }],
|
|
334
|
+
[
|
|
335
|
+
"path",
|
|
336
|
+
{
|
|
337
|
+
d: "M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595",
|
|
338
|
+
key: "1nkol4"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
[
|
|
342
|
+
"path",
|
|
343
|
+
{
|
|
344
|
+
d: "m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33",
|
|
345
|
+
key: "1nk1rd"
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
], Ga = O("paint-bucket", ja);
|
|
349
|
+
/**
|
|
350
|
+
* @license lucide-react v1.22.0 - ISC
|
|
351
|
+
*
|
|
352
|
+
* This source code is licensed under the ISC license.
|
|
353
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
354
|
+
*/
|
|
355
|
+
const Va = [
|
|
356
|
+
["rect", { width: "16", height: "6", x: "2", y: "2", rx: "2", key: "jcyz7m" }],
|
|
357
|
+
["path", { d: "M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2", key: "1b9h7c" }],
|
|
358
|
+
["rect", { width: "4", height: "6", x: "8", y: "16", rx: "1", key: "d6e7yl" }]
|
|
359
|
+
], Ka = O("paint-roller", Va);
|
|
360
|
+
/**
|
|
361
|
+
* @license lucide-react v1.22.0 - ISC
|
|
362
|
+
*
|
|
363
|
+
* This source code is licensed under the ISC license.
|
|
364
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
+
*/
|
|
366
|
+
const Wa = [
|
|
367
|
+
[
|
|
368
|
+
"path",
|
|
369
|
+
{
|
|
370
|
+
d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
|
|
371
|
+
key: "e79jfc"
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
|
|
375
|
+
["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
|
|
376
|
+
["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
|
|
377
|
+
["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
|
|
378
|
+
], Xa = O("palette", Wa);
|
|
379
|
+
/**
|
|
380
|
+
* @license lucide-react v1.22.0 - ISC
|
|
381
|
+
*
|
|
382
|
+
* This source code is licensed under the ISC license.
|
|
383
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
384
|
+
*/
|
|
385
|
+
const Ua = [
|
|
386
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
387
|
+
["path", { d: "M9 3v18", key: "fh3hqa" }]
|
|
388
|
+
], Za = O("panel-left", Ua);
|
|
389
|
+
/**
|
|
390
|
+
* @license lucide-react v1.22.0 - ISC
|
|
391
|
+
*
|
|
392
|
+
* This source code is licensed under the ISC license.
|
|
393
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
394
|
+
*/
|
|
395
|
+
const Qa = [
|
|
396
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
397
|
+
["path", { d: "M14 9h1", key: "l0svgy" }],
|
|
398
|
+
["path", { d: "M19 9h2", key: "te2zfg" }],
|
|
399
|
+
["path", { d: "M3 9h2", key: "1h4ldw" }],
|
|
400
|
+
["path", { d: "M9 9h1", key: "15jzuz" }]
|
|
401
|
+
], Ya = O("panel-top-dashed", Qa);
|
|
402
|
+
/**
|
|
403
|
+
* @license lucide-react v1.22.0 - ISC
|
|
404
|
+
*
|
|
405
|
+
* This source code is licensed under the ISC license.
|
|
406
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
407
|
+
*/
|
|
408
|
+
const Ja = [
|
|
409
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
410
|
+
["path", { d: "M3 9h18", key: "1pudct" }]
|
|
411
|
+
], es = O("panel-top", Ja);
|
|
412
|
+
/**
|
|
413
|
+
* @license lucide-react v1.22.0 - ISC
|
|
414
|
+
*
|
|
415
|
+
* This source code is licensed under the ISC license.
|
|
416
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
417
|
+
*/
|
|
418
|
+
const ts = [
|
|
419
|
+
["path", { d: "M10 3H8", key: "mzdi2d" }],
|
|
420
|
+
["path", { d: "m15.007 5.008 3.987 3.986", key: "1scubj" }],
|
|
421
|
+
["path", { d: "M20 15v4", key: "nmhudv" }],
|
|
422
|
+
[
|
|
423
|
+
"path",
|
|
424
|
+
{
|
|
425
|
+
d: "M21.174 6.813a2.82 2.82 0 0 0-3.986-3.987L3.842 16.175a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
426
|
+
key: "fs0856"
|
|
427
|
+
}
|
|
428
|
+
],
|
|
429
|
+
["path", { d: "M22 17h-4", key: "1sj068" }],
|
|
430
|
+
["path", { d: "M4 5v4", key: "13jjxc" }],
|
|
431
|
+
["path", { d: "M6 7H2", key: "8zbtv0" }],
|
|
432
|
+
["path", { d: "M9 2v2", key: "165o2o" }]
|
|
433
|
+
], Zr = O("pencil-sparkles", ts);
|
|
434
|
+
/**
|
|
435
|
+
* @license lucide-react v1.22.0 - ISC
|
|
436
|
+
*
|
|
437
|
+
* This source code is licensed under the ISC license.
|
|
438
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
439
|
+
*/
|
|
440
|
+
const ns = [
|
|
441
|
+
["path", { d: "M13 4v16", key: "8vvj80" }],
|
|
442
|
+
["path", { d: "M17 4v16", key: "7dpous" }],
|
|
443
|
+
["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
|
|
444
|
+
], rs = O("pilcrow", ns);
|
|
445
|
+
/**
|
|
446
|
+
* @license lucide-react v1.22.0 - ISC
|
|
447
|
+
*
|
|
448
|
+
* This source code is licensed under the ISC license.
|
|
449
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
450
|
+
*/
|
|
451
|
+
const os = [
|
|
452
|
+
[
|
|
453
|
+
"path",
|
|
454
|
+
{
|
|
455
|
+
d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
456
|
+
key: "rib7q0"
|
|
457
|
+
}
|
|
458
|
+
],
|
|
459
|
+
[
|
|
460
|
+
"path",
|
|
461
|
+
{
|
|
462
|
+
d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
|
|
463
|
+
key: "1ymkrd"
|
|
464
|
+
}
|
|
465
|
+
]
|
|
466
|
+
], is = O("quote", os);
|
|
467
|
+
/**
|
|
468
|
+
* @license lucide-react v1.22.0 - ISC
|
|
469
|
+
*
|
|
470
|
+
* This source code is licensed under the ISC license.
|
|
471
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
472
|
+
*/
|
|
473
|
+
const as = [
|
|
474
|
+
["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
|
|
475
|
+
["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
|
|
476
|
+
], ss = O("redo-2", as);
|
|
477
|
+
/**
|
|
478
|
+
* @license lucide-react v1.22.0 - ISC
|
|
479
|
+
*
|
|
480
|
+
* This source code is licensed under the ISC license.
|
|
481
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
482
|
+
*/
|
|
483
|
+
const ls = [
|
|
484
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
485
|
+
["path", { d: "M3 12h18", key: "1i2n21" }]
|
|
486
|
+
], cs = O("rows-2", ls);
|
|
487
|
+
/**
|
|
488
|
+
* @license lucide-react v1.22.0 - ISC
|
|
489
|
+
*
|
|
490
|
+
* This source code is licensed under the ISC license.
|
|
491
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
492
|
+
*/
|
|
493
|
+
const ds = [
|
|
494
|
+
["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
|
|
495
|
+
["path", { d: "M8 12h8", key: "1wcyev" }],
|
|
496
|
+
["path", { d: "m16 20 2 2 4-4", key: "13tcca" }]
|
|
497
|
+
], Qr = O("spell-check", ds);
|
|
498
|
+
/**
|
|
499
|
+
* @license lucide-react v1.22.0 - ISC
|
|
500
|
+
*
|
|
501
|
+
* This source code is licensed under the ISC license.
|
|
502
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
503
|
+
*/
|
|
504
|
+
const us = [
|
|
505
|
+
["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
|
|
506
|
+
["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
|
|
507
|
+
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
|
|
508
|
+
], ms = O("strikethrough", us);
|
|
509
|
+
/**
|
|
510
|
+
* @license lucide-react v1.22.0 - ISC
|
|
511
|
+
*
|
|
512
|
+
* This source code is licensed under the ISC license.
|
|
513
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
514
|
+
*/
|
|
515
|
+
const fs = [
|
|
516
|
+
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
517
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
518
|
+
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
519
|
+
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
520
|
+
], hs = O("table", fs);
|
|
521
|
+
/**
|
|
522
|
+
* @license lucide-react v1.22.0 - ISC
|
|
523
|
+
*
|
|
524
|
+
* This source code is licensed under the ISC license.
|
|
525
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
526
|
+
*/
|
|
527
|
+
const gs = [
|
|
528
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
529
|
+
["path", { d: "M17 12H7", key: "16if0g" }],
|
|
530
|
+
["path", { d: "M19 19H5", key: "vjpgq2" }]
|
|
531
|
+
], yo = O("text-align-center", gs);
|
|
532
|
+
/**
|
|
533
|
+
* @license lucide-react v1.22.0 - ISC
|
|
534
|
+
*
|
|
535
|
+
* This source code is licensed under the ISC license.
|
|
536
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
537
|
+
*/
|
|
538
|
+
const ps = [
|
|
539
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
540
|
+
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
541
|
+
["path", { d: "M21 19H7", key: "4cu937" }]
|
|
542
|
+
], wo = O("text-align-end", ps);
|
|
543
|
+
/**
|
|
544
|
+
* @license lucide-react v1.22.0 - ISC
|
|
545
|
+
*
|
|
546
|
+
* This source code is licensed under the ISC license.
|
|
547
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
548
|
+
*/
|
|
549
|
+
const bs = [
|
|
550
|
+
["path", { d: "M3 5h18", key: "1u36vt" }],
|
|
551
|
+
["path", { d: "M3 12h18", key: "1i2n21" }],
|
|
552
|
+
["path", { d: "M3 19h18", key: "awlh7x" }]
|
|
553
|
+
], vs = O("text-align-justify", bs);
|
|
554
|
+
/**
|
|
555
|
+
* @license lucide-react v1.22.0 - ISC
|
|
556
|
+
*
|
|
557
|
+
* This source code is licensed under the ISC license.
|
|
558
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
559
|
+
*/
|
|
560
|
+
const ys = [
|
|
561
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
562
|
+
["path", { d: "M15 12H3", key: "6jk70r" }],
|
|
563
|
+
["path", { d: "M17 19H3", key: "z6ezky" }]
|
|
564
|
+
], ko = O("text-align-start", ys);
|
|
565
|
+
/**
|
|
566
|
+
* @license lucide-react v1.22.0 - ISC
|
|
567
|
+
*
|
|
568
|
+
* This source code is licensed under the ISC license.
|
|
569
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
570
|
+
*/
|
|
571
|
+
const ws = [
|
|
572
|
+
["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
|
|
573
|
+
["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
|
|
574
|
+
["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
|
|
575
|
+
], Zn = O("toy-brick", ws);
|
|
576
|
+
/**
|
|
577
|
+
* @license lucide-react v1.22.0 - ISC
|
|
578
|
+
*
|
|
579
|
+
* This source code is licensed under the ISC license.
|
|
580
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
581
|
+
*/
|
|
582
|
+
const ks = [
|
|
583
|
+
["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
|
|
584
|
+
["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
|
|
585
|
+
], xs = O("underline", ks);
|
|
586
|
+
/**
|
|
587
|
+
* @license lucide-react v1.22.0 - ISC
|
|
588
|
+
*
|
|
589
|
+
* This source code is licensed under the ISC license.
|
|
590
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
591
|
+
*/
|
|
592
|
+
const Cs = [
|
|
593
|
+
[
|
|
594
|
+
"path",
|
|
595
|
+
{
|
|
596
|
+
d: "m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",
|
|
597
|
+
key: "ul74o6"
|
|
598
|
+
}
|
|
599
|
+
],
|
|
600
|
+
["path", { d: "m14 7 3 3", key: "1r5n42" }],
|
|
601
|
+
["path", { d: "M5 6v4", key: "ilb8ba" }],
|
|
602
|
+
["path", { d: "M19 14v4", key: "blhpug" }],
|
|
603
|
+
["path", { d: "M10 2v2", key: "7u0qdc" }],
|
|
604
|
+
["path", { d: "M7 8H3", key: "zfb6yr" }],
|
|
605
|
+
["path", { d: "M21 16h-4", key: "1cnmox" }],
|
|
606
|
+
["path", { d: "M11 3H9", key: "1obp7u" }]
|
|
607
|
+
], Yr = O("wand-sparkles", Cs), As = /^(https?:\/\/|mailto:|tel:|\/(?![/\\]))/i, Jr = "http://www.w3.org/2000/svg", Ns = [
|
|
608
|
+
"M15 3h6v6",
|
|
609
|
+
"M10 14 21 3",
|
|
610
|
+
"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
|
|
611
|
+
];
|
|
612
|
+
function Ts(n) {
|
|
613
|
+
const i = n.createElementNS(Jr, "svg");
|
|
614
|
+
i.setAttribute("viewBox", "0 0 24 24"), i.setAttribute("fill", "none"), i.setAttribute("stroke", "currentColor"), i.setAttribute("stroke-width", "2"), i.setAttribute("stroke-linecap", "round"), i.setAttribute("stroke-linejoin", "round"), i.setAttribute("aria-hidden", "true");
|
|
615
|
+
for (const s of Ns) {
|
|
616
|
+
const l = n.createElementNS(Jr, "path");
|
|
617
|
+
l.setAttribute("d", s), i.appendChild(l);
|
|
618
|
+
}
|
|
619
|
+
return i;
|
|
620
|
+
}
|
|
621
|
+
function Es(n, i) {
|
|
622
|
+
const s = n == null ? void 0 : n.querySelector("a:first-child");
|
|
623
|
+
if (!s || s.dataset.linkBar === "visit") return;
|
|
624
|
+
const l = (s.getAttribute("href") ?? "").trim();
|
|
625
|
+
if (l !== "#") {
|
|
626
|
+
if (!As.test(l)) {
|
|
627
|
+
s.remove();
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
s.dataset.linkBar = "visit", s.textContent = i, s.appendChild(Ts(s.ownerDocument)), s.title = l, s.target = "_blank", s.rel = "noopener noreferrer";
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function eo(n) {
|
|
634
|
+
return {
|
|
635
|
+
format: n("editor.vendor.format"),
|
|
636
|
+
image: n("editor.vendor.image"),
|
|
637
|
+
file: n("editor.vendor.file"),
|
|
638
|
+
link: n("editor.vendor.link"),
|
|
639
|
+
bold: n("editor.bold"),
|
|
640
|
+
italic: n("editor.italic"),
|
|
641
|
+
deleted: n("editor.strike"),
|
|
642
|
+
underline: n("editor.underline"),
|
|
643
|
+
superscript: n("editor.vendor.superscript"),
|
|
644
|
+
subscript: n("editor.vendor.subscript"),
|
|
645
|
+
"bold-abbr": n("editor.vendor.boldAbbr"),
|
|
646
|
+
"italic-abbr": n("editor.vendor.italicAbbr"),
|
|
647
|
+
"deleted-abbr": n("editor.vendor.deletedAbbr"),
|
|
648
|
+
"underline-abbr": n("editor.vendor.underlineAbbr"),
|
|
649
|
+
"superscript-abbr": n("editor.vendor.superscriptAbbr"),
|
|
650
|
+
"subscript-abbr": n("editor.vendor.subscriptAbbr"),
|
|
651
|
+
lists: n("editor.vendor.lists"),
|
|
652
|
+
"link-insert": n("editor.link.insert"),
|
|
653
|
+
"link-edit": n("editor.link.edit"),
|
|
654
|
+
"link-in-new-tab": n("editor.vendor.linkInNewTab"),
|
|
655
|
+
unlink: n("editor.vendor.unlink"),
|
|
656
|
+
cancel: n("common.cancel"),
|
|
657
|
+
close: n("common.close"),
|
|
658
|
+
insert: n("editor.link.insertAction"),
|
|
659
|
+
save: n("common.save"),
|
|
660
|
+
delete: n("common.delete"),
|
|
661
|
+
text: n("editor.vendor.text"),
|
|
662
|
+
edit: n("editor.vendor.edit"),
|
|
663
|
+
title: n("editor.image.alt"),
|
|
664
|
+
paragraph: n("editor.vendor.paragraph"),
|
|
665
|
+
quote: n("editor.quote"),
|
|
666
|
+
code: n("editor.vendor.code"),
|
|
667
|
+
heading1: n("editor.vendor.heading1"),
|
|
668
|
+
heading2: n("editor.heading2"),
|
|
669
|
+
heading3: n("editor.heading3"),
|
|
670
|
+
heading4: n("editor.vendor.heading4"),
|
|
671
|
+
heading5: n("editor.vendor.heading5"),
|
|
672
|
+
heading6: n("editor.vendor.heading6"),
|
|
673
|
+
filename: n("editor.vendor.filename"),
|
|
674
|
+
optional: n("common.optional"),
|
|
675
|
+
unorderedlist: n("editor.vendor.unorderedlist"),
|
|
676
|
+
orderedlist: n("editor.vendor.orderedlist"),
|
|
677
|
+
outdent: n("editor.vendor.outdent"),
|
|
678
|
+
indent: n("editor.vendor.indent"),
|
|
679
|
+
horizontalrule: n("editor.vendor.horizontalrule"),
|
|
680
|
+
upload: n("editor.image.upload"),
|
|
681
|
+
"upload-label": n("editor.vendor.uploadLabel"),
|
|
682
|
+
"accessibility-help-label": n("editor.regionLabel"),
|
|
683
|
+
caption: n("editor.vendor.caption"),
|
|
684
|
+
bulletslist: n("editor.vendor.bulletslist"),
|
|
685
|
+
numberslist: n("editor.vendor.numberslist"),
|
|
686
|
+
"image-position": n("editor.vendor.imagePosition"),
|
|
687
|
+
none: n("editor.vendor.none"),
|
|
688
|
+
left: n("editor.vendor.left"),
|
|
689
|
+
right: n("editor.vendor.right"),
|
|
690
|
+
center: n("editor.vendor.center"),
|
|
691
|
+
undo: n("editor.undo"),
|
|
692
|
+
redo: n("editor.redo"),
|
|
693
|
+
size: n("editor.vendor.fontSize"),
|
|
694
|
+
"remove-size": n("editor.vendor.removeSize"),
|
|
695
|
+
fontcolor: n("editor.textColor"),
|
|
696
|
+
highlight: n("editor.highlightColor"),
|
|
697
|
+
table: n("editor.vendor.table"),
|
|
698
|
+
"insert-table": n("editor.table.insert"),
|
|
699
|
+
"insert-row-above": n("editor.table.rowAbove"),
|
|
700
|
+
"insert-row-below": n("editor.table.rowBelow"),
|
|
701
|
+
"insert-column-left": n("editor.table.columnLeft"),
|
|
702
|
+
"insert-column-right": n("editor.table.columnRight"),
|
|
703
|
+
"add-head": n("editor.table.addHeader"),
|
|
704
|
+
"delete-head": n("editor.table.deleteHeader"),
|
|
705
|
+
"delete-column": n("editor.table.deleteColumn"),
|
|
706
|
+
"delete-row": n("editor.table.deleteRow"),
|
|
707
|
+
"delete-table": n("editor.table.deleteTable")
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
const Ms = {
|
|
711
|
+
id: "rich-text-editor",
|
|
712
|
+
capabilities: ["edit_inline"],
|
|
713
|
+
state: {
|
|
714
|
+
html: {
|
|
715
|
+
type: "string",
|
|
716
|
+
descriptionKey: "ui.agent.richTextEditor.state.html",
|
|
717
|
+
description: "Sanitised HTML representation of the editor content.",
|
|
718
|
+
read: (n) => n.getHTML()
|
|
719
|
+
},
|
|
720
|
+
text: {
|
|
721
|
+
type: "string",
|
|
722
|
+
descriptionKey: "ui.agent.richTextEditor.state.text",
|
|
723
|
+
description: "Plain-text content of the editor (tags stripped).",
|
|
724
|
+
read: (n) => n.getText()
|
|
725
|
+
},
|
|
726
|
+
markdown: {
|
|
727
|
+
type: "string",
|
|
728
|
+
descriptionKey: "ui.agent.richTextEditor.state.markdown",
|
|
729
|
+
description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
|
|
730
|
+
read: (n) => n.getMarkdown()
|
|
731
|
+
},
|
|
732
|
+
aiBusy: {
|
|
733
|
+
type: "boolean",
|
|
734
|
+
descriptionKey: "ui.agent.richTextEditor.state.aiBusy",
|
|
735
|
+
description: "True while a one-shot AI action (a practice template, spelling or auto-format) is rewriting the note. Read `html` once it is false.",
|
|
736
|
+
read: (n) => n.isAiBusy()
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
// Image wrap/align/resize are intentionally NOT agent actions — they target
|
|
740
|
+
// the ephemeral click-selected image the handle can't address. Agents emit
|
|
741
|
+
// `<img class="wysiwyg-img-*" style="width:N%">` via set_content instead.
|
|
742
|
+
actions: {
|
|
743
|
+
set_content: {
|
|
744
|
+
// Replaces the whole document — discards whatever the user had typed.
|
|
745
|
+
safety: "destructive",
|
|
746
|
+
argsType: "{ html: string }",
|
|
747
|
+
argsSchema: {
|
|
748
|
+
type: "object",
|
|
749
|
+
properties: {
|
|
750
|
+
html: {
|
|
751
|
+
type: "string",
|
|
752
|
+
description: "Replacement HTML (sanitised via DOMPurify)."
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
required: ["html"]
|
|
756
|
+
},
|
|
757
|
+
idempotent: !0,
|
|
758
|
+
descriptionKey: "ui.agent.richTextEditor.actions.setContent",
|
|
759
|
+
description: "Replace the editor content. Loses unsaved input.",
|
|
760
|
+
invoke: (n, i) => {
|
|
761
|
+
n.setContent(i.html);
|
|
762
|
+
}
|
|
763
|
+
},
|
|
764
|
+
insert_at_cursor: {
|
|
765
|
+
// Reversible via the editor's own undo stack — write, not destructive.
|
|
766
|
+
safety: "write",
|
|
767
|
+
argsType: "{ content: string; asHtml?: boolean }",
|
|
768
|
+
argsSchema: {
|
|
769
|
+
type: "object",
|
|
770
|
+
properties: {
|
|
771
|
+
content: {
|
|
772
|
+
type: "string",
|
|
773
|
+
description: "Content to insert at the caret."
|
|
774
|
+
},
|
|
775
|
+
asHtml: {
|
|
776
|
+
type: "boolean",
|
|
777
|
+
description: "Treat content as HTML (sanitised). Pass false for plain text. Defaults to true."
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
required: ["content"]
|
|
781
|
+
},
|
|
782
|
+
descriptionKey: "ui.agent.richTextEditor.actions.insertAtCursor",
|
|
783
|
+
description: "Insert content at the caret (replacing any selection). HTML is sanitised; pass asHtml:false for plain text. Seam for merge/template variables and AI-generated drafts.",
|
|
784
|
+
examples: [
|
|
785
|
+
{
|
|
786
|
+
args: { content: "{{patient.firstName}}", asHtml: !1 },
|
|
787
|
+
note: "Insert a merge variable as plain text."
|
|
788
|
+
}
|
|
789
|
+
],
|
|
790
|
+
invoke: (n, i) => {
|
|
791
|
+
n.insertAtCursor(i.content, { asHtml: i.asHtml });
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
apply_format: {
|
|
795
|
+
// Reversible via undo — write, not destructive.
|
|
796
|
+
safety: "write",
|
|
797
|
+
argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
|
|
798
|
+
argsSchema: {
|
|
799
|
+
type: "object",
|
|
800
|
+
properties: {
|
|
801
|
+
format: {
|
|
802
|
+
type: "string",
|
|
803
|
+
enum: [
|
|
804
|
+
"bold",
|
|
805
|
+
"italic",
|
|
806
|
+
"strikethrough",
|
|
807
|
+
"bulletedList",
|
|
808
|
+
"numberedList",
|
|
809
|
+
"heading",
|
|
810
|
+
"quote",
|
|
811
|
+
"paragraph"
|
|
812
|
+
],
|
|
813
|
+
description: "Block or inline format to toggle/apply."
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
required: ["format"]
|
|
817
|
+
},
|
|
818
|
+
descriptionKey: "ui.agent.richTextEditor.actions.applyFormat",
|
|
819
|
+
description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
|
|
820
|
+
examples: [{ args: { format: "bold" }, note: "Bold the selection." }],
|
|
821
|
+
invoke: (n, i) => {
|
|
822
|
+
n.applyFormat(i.format);
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
clear: {
|
|
826
|
+
// Empties the document — loses unsaved input.
|
|
827
|
+
safety: "destructive",
|
|
828
|
+
idempotent: !0,
|
|
829
|
+
descriptionKey: "ui.agent.richTextEditor.actions.clear",
|
|
830
|
+
description: "Empty the editor. Loses unsaved input.",
|
|
831
|
+
invoke: (n) => {
|
|
832
|
+
n.clear();
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
focus: {
|
|
836
|
+
safety: "read",
|
|
837
|
+
idempotent: !0,
|
|
838
|
+
descriptionKey: "ui.agent.richTextEditor.actions.focus",
|
|
839
|
+
description: "Move keyboard focus to the editor surface.",
|
|
840
|
+
invoke: (n) => {
|
|
841
|
+
n.focus();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
domHooks: {
|
|
846
|
+
root: { attr: "data-component", value: "rich-text-editor" },
|
|
847
|
+
instanceId: {
|
|
848
|
+
attr: "data-component-id",
|
|
849
|
+
sourceProp: "id",
|
|
850
|
+
description: "Sourced from the id prop."
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}, zs = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", Nt = "ds:!size-[var(--min-target-size)]", Rs = 384, Ss = "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", Fn = Et("ds:flex ds:gap-[var(--spacing-sm)]", {
|
|
854
|
+
variants: { stacked: { true: "ds:flex-col", false: "ds:items-center" } }
|
|
855
|
+
}), jn = Et("ds:min-w-0", {
|
|
856
|
+
variants: { stacked: { true: "", false: "ds:flex-1" } }
|
|
857
|
+
}), to = Et(
|
|
858
|
+
"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
|
|
859
|
+
{ variants: { stacked: { true: "ds:justify-end", false: "" } } }
|
|
860
|
+
), Ls = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", _s = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]";
|
|
861
|
+
function xo({ id: n }) {
|
|
862
|
+
const { t: i } = de("ui");
|
|
863
|
+
return /* @__PURE__ */ t(
|
|
864
|
+
"p",
|
|
865
|
+
{
|
|
866
|
+
"data-component": "editor-request-error",
|
|
867
|
+
id: n,
|
|
868
|
+
role: "alert",
|
|
869
|
+
className: _s,
|
|
870
|
+
children: i("editor.ai.error")
|
|
871
|
+
}
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
const no = [
|
|
875
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
876
|
+
"ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
|
|
877
|
+
"ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
|
|
878
|
+
"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]",
|
|
879
|
+
// The preview renders arbitrary model-generated rich text, and the
|
|
880
|
+
// `rich-text` SafeHtml profile allows ul/ol/li. Inside a
|
|
881
|
+
// [data-component] preflight's list reset still applies and the host
|
|
882
|
+
// undo deliberately does not reach, so markers and indent have to be
|
|
883
|
+
// asked for explicitly — otherwise a generated bullet list previews as
|
|
884
|
+
// flush, marker-less lines.
|
|
885
|
+
"ds:[&_ul]:list-disc ds:[&_ol]:list-decimal",
|
|
886
|
+
"ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ol]:ps-[var(--spacing-md)]"
|
|
887
|
+
].join(" ");
|
|
888
|
+
function ro(n, i) {
|
|
889
|
+
return i ? n ? /\s$/.test(n) ? `${n}${i}` : `${n} ${i}` : i : n;
|
|
890
|
+
}
|
|
891
|
+
function oo(n) {
|
|
892
|
+
return typeof n == "object" && n !== null && "name" in n && n.name === "AiCreditsExhaustedError";
|
|
893
|
+
}
|
|
894
|
+
function Is({
|
|
895
|
+
open: n,
|
|
896
|
+
onClose: i,
|
|
897
|
+
onRequestAiDraft: s,
|
|
898
|
+
onInsert: l,
|
|
899
|
+
onCreditsExhausted: f,
|
|
900
|
+
creditsExhausted: y = !1,
|
|
901
|
+
previewAsHtml: w = !0,
|
|
902
|
+
privacyNotice: g,
|
|
903
|
+
onDictate: b
|
|
904
|
+
}) {
|
|
905
|
+
const { t: p } = de("ui"), N = Qe(), E = Qe(), [_, I] = A(""), [Z, h] = A(!1), [m, v] = A(!1), [B, D] = A(!1), F = k(f);
|
|
906
|
+
$(() => {
|
|
907
|
+
F.current = f;
|
|
908
|
+
}, [f]);
|
|
909
|
+
const [ee, j] = A(null), V = k(null), [X, M] = A(!1), [Ee, ne] = A("listening"), [ge, J] = A(""), [ie, pe] = A(""), z = k(null), ze = k(null), re = x((S = !1) => {
|
|
910
|
+
var P;
|
|
911
|
+
ze.current && (ze.current.keepLate = S), (P = z.current) == null || P.abort();
|
|
912
|
+
}, []), Ie = x(() => {
|
|
913
|
+
if (!b) return;
|
|
914
|
+
const S = new AbortController();
|
|
915
|
+
z.current = S;
|
|
916
|
+
const P = { keepLate: !1 };
|
|
917
|
+
ze.current = P;
|
|
918
|
+
let ce = !1;
|
|
919
|
+
const oe = () => !ce && (!S.signal.aborted || P.keepLate);
|
|
920
|
+
M(!0), ne("listening"), J(""), pe(p("editor.ai.listening")), b({
|
|
921
|
+
signal: S.signal,
|
|
922
|
+
onStatus: (se) => {
|
|
923
|
+
oe() && (ne(se), pe(
|
|
924
|
+
p(se === "connecting" ? "voiceControl.status.starting" : "editor.ai.listening")
|
|
925
|
+
));
|
|
926
|
+
},
|
|
927
|
+
onPartialTranscript: (se) => {
|
|
928
|
+
oe() && J(se);
|
|
929
|
+
},
|
|
930
|
+
onFinalTranscript: (se) => {
|
|
931
|
+
if (!oe()) return;
|
|
932
|
+
const q = se.trim();
|
|
933
|
+
J(""), q && (I((Be) => ro(Be, q)), pe(q));
|
|
934
|
+
}
|
|
935
|
+
}).catch((se) => {
|
|
936
|
+
var q;
|
|
937
|
+
S.signal.aborted || !oo(se) || (D(!0), (q = F.current) == null || q.call(F));
|
|
938
|
+
}).finally(() => {
|
|
939
|
+
ce = !0, J(""), z.current === S && (z.current = null, ze.current = null, M(!1), pe(""));
|
|
940
|
+
});
|
|
941
|
+
}, [b, p]), ue = x(() => {
|
|
942
|
+
X ? re(!0) : Ie();
|
|
943
|
+
}, [X, Ie, re]);
|
|
944
|
+
$(() => {
|
|
945
|
+
var S, P;
|
|
946
|
+
n ? (I(""), h(!1), v(!1), D(!1), j(null), J(""), pe("")) : ((S = V.current) == null || S.abort(), V.current = null, (P = z.current) == null || P.abort());
|
|
947
|
+
}, [n]), $(
|
|
948
|
+
() => () => {
|
|
949
|
+
var S, P;
|
|
950
|
+
(S = V.current) == null || S.abort(), (P = z.current) == null || P.abort();
|
|
951
|
+
},
|
|
952
|
+
[]
|
|
953
|
+
);
|
|
954
|
+
const Re = x(() => {
|
|
955
|
+
var ce;
|
|
956
|
+
const S = _.trim();
|
|
957
|
+
if (!S || Z) return;
|
|
958
|
+
re(), (ce = V.current) == null || ce.abort();
|
|
959
|
+
const P = new AbortController();
|
|
960
|
+
V.current = P, v(!1), h(!0), s({ prompt: S, signal: P.signal }).then((oe) => {
|
|
961
|
+
P.signal.aborted || (j(oe), h(!1));
|
|
962
|
+
}).catch((oe) => {
|
|
963
|
+
var se;
|
|
964
|
+
if (!(P.signal.aborted || oe && typeof oe == "object" && "name" in oe && oe.name === "AbortError")) {
|
|
965
|
+
if (h(!1), oo(oe)) {
|
|
966
|
+
D(!0), (se = F.current) == null || se.call(F);
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
v(!0);
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
}, [_, Z, s, re]), Pe = x(() => {
|
|
973
|
+
ee != null && (l(ee), i());
|
|
974
|
+
}, [ee, l, i]), ve = k(null), [me, Ye] = A(!1);
|
|
975
|
+
Ii(() => {
|
|
976
|
+
const S = ve.current;
|
|
977
|
+
if (!n || !S) return;
|
|
978
|
+
const P = () => {
|
|
979
|
+
const oe = S.clientWidth;
|
|
980
|
+
Ye(oe > 0 && oe < Rs);
|
|
981
|
+
};
|
|
982
|
+
if (P(), typeof ResizeObserver > "u") return;
|
|
983
|
+
const ce = new ResizeObserver(P);
|
|
984
|
+
return ce.observe(S), () => ce.disconnect();
|
|
985
|
+
}, [n]);
|
|
986
|
+
const Je = k(null), H = ee != null, K = B || y, W = X && Ee === "connecting", ae = X ? ro(_, ge) : _;
|
|
987
|
+
$(() => {
|
|
988
|
+
var S;
|
|
989
|
+
B && ((S = Je.current) == null || S.focus());
|
|
990
|
+
}, [B]);
|
|
991
|
+
const R = me ? null : /* @__PURE__ */ t(
|
|
992
|
+
te,
|
|
993
|
+
{
|
|
994
|
+
size: "md",
|
|
995
|
+
intent: "outline",
|
|
996
|
+
className: Nt,
|
|
997
|
+
icon: /* @__PURE__ */ t(Hi, {}),
|
|
998
|
+
"aria-label": p("common.close"),
|
|
999
|
+
onClick: i
|
|
1000
|
+
}
|
|
1001
|
+
);
|
|
1002
|
+
return /* @__PURE__ */ t(
|
|
1003
|
+
Kn,
|
|
1004
|
+
{
|
|
1005
|
+
open: n,
|
|
1006
|
+
onClose: i,
|
|
1007
|
+
title: me ? p("editor.ai.dialogTitle") : void 0,
|
|
1008
|
+
ariaLabel: p("editor.ai.dialogTitle"),
|
|
1009
|
+
children: /* @__PURE__ */ t("div", { ref: ve, className: Ss, children: K ? /* @__PURE__ */ C("div", { className: Fn({ stacked: me }), children: [
|
|
1010
|
+
R,
|
|
1011
|
+
/* @__PURE__ */ t("div", { className: jn({ stacked: me }), children: /* @__PURE__ */ t(
|
|
1012
|
+
_i,
|
|
1013
|
+
{
|
|
1014
|
+
ref: Je,
|
|
1015
|
+
tabIndex: -1,
|
|
1016
|
+
headingLevel: 2,
|
|
1017
|
+
announce: "assertive"
|
|
1018
|
+
}
|
|
1019
|
+
) })
|
|
1020
|
+
] }) : H ? /* @__PURE__ */ C("div", { className: Fn({ stacked: me }), children: [
|
|
1021
|
+
R,
|
|
1022
|
+
/* @__PURE__ */ t("div", { className: jn({ stacked: me }), children: w ? /* @__PURE__ */ t(
|
|
1023
|
+
Ci,
|
|
1024
|
+
{
|
|
1025
|
+
html: ee,
|
|
1026
|
+
profile: "rich-text",
|
|
1027
|
+
className: no,
|
|
1028
|
+
tabIndex: 0,
|
|
1029
|
+
"aria-label": p("editor.ai.dialogTitle")
|
|
1030
|
+
}
|
|
1031
|
+
) : (
|
|
1032
|
+
// Focusable so a keyboard user can scroll a long draft preview
|
|
1033
|
+
// (mirrors the SafeHtml preview branch above). The lint rule's
|
|
1034
|
+
// tabIndex allowlist doesn't cover a scrollable, non-interactive
|
|
1035
|
+
// text region.
|
|
1036
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
1037
|
+
/* @__PURE__ */ t("p", { className: no, tabIndex: 0, children: ee })
|
|
1038
|
+
) }),
|
|
1039
|
+
/* @__PURE__ */ C("div", { className: to({ stacked: me }), children: [
|
|
1040
|
+
/* @__PURE__ */ t(
|
|
1041
|
+
te,
|
|
1042
|
+
{
|
|
1043
|
+
size: "md",
|
|
1044
|
+
intent: "outline",
|
|
1045
|
+
className: `${Nt} ds:rounded-full`,
|
|
1046
|
+
icon: /* @__PURE__ */ t($i, {}),
|
|
1047
|
+
"aria-label": p("editor.ai.retry"),
|
|
1048
|
+
onClick: () => j(null)
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ t(
|
|
1052
|
+
te,
|
|
1053
|
+
{
|
|
1054
|
+
size: "md",
|
|
1055
|
+
intent: "primary",
|
|
1056
|
+
className: `${Nt} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
|
|
1057
|
+
icon: /* @__PURE__ */ t(Oi, {}),
|
|
1058
|
+
"aria-label": p("common.confirm"),
|
|
1059
|
+
onClick: Pe
|
|
1060
|
+
}
|
|
1061
|
+
)
|
|
1062
|
+
] })
|
|
1063
|
+
] }) : /* @__PURE__ */ C(Ze, { children: [
|
|
1064
|
+
/* @__PURE__ */ C("div", { className: Fn({ stacked: me }), children: [
|
|
1065
|
+
R,
|
|
1066
|
+
/* @__PURE__ */ t("div", { className: jn({ stacked: me }), children: /* @__PURE__ */ t(
|
|
1067
|
+
Li,
|
|
1068
|
+
{
|
|
1069
|
+
id: N,
|
|
1070
|
+
size: "md",
|
|
1071
|
+
value: ae,
|
|
1072
|
+
onChange: (S) => I(S.target.value),
|
|
1073
|
+
placeholder: p(X ? W ? "voiceControl.status.starting" : "editor.ai.listening" : "editor.ai.promptPlaceholder"),
|
|
1074
|
+
"aria-label": p("editor.ai.promptLabel"),
|
|
1075
|
+
autoResize: !0,
|
|
1076
|
+
minRows: 1,
|
|
1077
|
+
maxRows: 3,
|
|
1078
|
+
readOnly: X,
|
|
1079
|
+
tone: m ? "error" : "default",
|
|
1080
|
+
"aria-describedby": m ? E : void 0
|
|
1081
|
+
}
|
|
1082
|
+
) }),
|
|
1083
|
+
/* @__PURE__ */ C("div", { className: to({ stacked: me }), children: [
|
|
1084
|
+
b ? /* @__PURE__ */ t(
|
|
1085
|
+
te,
|
|
1086
|
+
{
|
|
1087
|
+
size: "md",
|
|
1088
|
+
intent: "outline",
|
|
1089
|
+
className: X && !W ? `${Nt} ${zs}` : Nt,
|
|
1090
|
+
icon: W ? /* @__PURE__ */ t(Wn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : X ? /* @__PURE__ */ t(Dt, { className: "ds:fill-current" }) : /* @__PURE__ */ t(Xn, {}),
|
|
1091
|
+
"aria-pressed": X,
|
|
1092
|
+
"aria-label": p(X ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
1093
|
+
onClick: ue
|
|
1094
|
+
}
|
|
1095
|
+
) : null,
|
|
1096
|
+
/* @__PURE__ */ t(
|
|
1097
|
+
te,
|
|
1098
|
+
{
|
|
1099
|
+
size: "md",
|
|
1100
|
+
intent: "primary",
|
|
1101
|
+
icon: Z ? /* @__PURE__ */ t(tr, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ t(Di, {}),
|
|
1102
|
+
className: `${Nt} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
|
|
1103
|
+
disabled: Z || !_.trim(),
|
|
1104
|
+
"aria-busy": Z || void 0,
|
|
1105
|
+
"aria-label": p("editor.ai.generate"),
|
|
1106
|
+
onClick: Re
|
|
1107
|
+
}
|
|
1108
|
+
)
|
|
1109
|
+
] })
|
|
1110
|
+
] }),
|
|
1111
|
+
b ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: ie }) : null,
|
|
1112
|
+
m ? /* @__PURE__ */ t(xo, { id: E }) : g ? /* @__PURE__ */ t("p", { className: Ls, children: g }) : null
|
|
1113
|
+
] }) })
|
|
1114
|
+
}
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
function Co(n, i) {
|
|
1118
|
+
return n(i, { nsSeparator: !1, defaultValue: i });
|
|
1119
|
+
}
|
|
1120
|
+
const Hs = [
|
|
1121
|
+
"undo",
|
|
1122
|
+
"redo",
|
|
1123
|
+
"format",
|
|
1124
|
+
"bold",
|
|
1125
|
+
"italic",
|
|
1126
|
+
"underline",
|
|
1127
|
+
"strike",
|
|
1128
|
+
"fontSize",
|
|
1129
|
+
"color",
|
|
1130
|
+
"highlight",
|
|
1131
|
+
"align",
|
|
1132
|
+
"ul",
|
|
1133
|
+
"ol",
|
|
1134
|
+
"outdent",
|
|
1135
|
+
"indent",
|
|
1136
|
+
"link",
|
|
1137
|
+
"image",
|
|
1138
|
+
"table",
|
|
1139
|
+
"line"
|
|
1140
|
+
], Ao = {
|
|
1141
|
+
// Redactor's own history. AI rewrites push onto it too (see
|
|
1142
|
+
// `pushUndoState` in rich-text-editor.tsx), so Undo steps back over them.
|
|
1143
|
+
undo: {
|
|
1144
|
+
id: "undo",
|
|
1145
|
+
icon: /* @__PURE__ */ t(Xi, {}),
|
|
1146
|
+
label: ["editor.undo", "Undo"],
|
|
1147
|
+
command: ["module.buffer.undo"]
|
|
1148
|
+
},
|
|
1149
|
+
redo: {
|
|
1150
|
+
id: "redo",
|
|
1151
|
+
icon: /* @__PURE__ */ t(ss, {}),
|
|
1152
|
+
label: ["editor.redo", "Redo"],
|
|
1153
|
+
command: ["module.buffer.redo"]
|
|
1154
|
+
},
|
|
1155
|
+
bold: {
|
|
1156
|
+
id: "bold",
|
|
1157
|
+
icon: /* @__PURE__ */ t(ha, {}),
|
|
1158
|
+
label: ["editor.bold", "Bold"],
|
|
1159
|
+
command: ["module.inline.format", { tag: "b" }],
|
|
1160
|
+
toggle: "bold"
|
|
1161
|
+
},
|
|
1162
|
+
italic: {
|
|
1163
|
+
id: "italic",
|
|
1164
|
+
icon: /* @__PURE__ */ t(La, {}),
|
|
1165
|
+
label: ["editor.italic", "Italic"],
|
|
1166
|
+
command: ["module.inline.format", { tag: "i" }],
|
|
1167
|
+
toggle: "italic"
|
|
1168
|
+
},
|
|
1169
|
+
underline: {
|
|
1170
|
+
id: "underline",
|
|
1171
|
+
icon: /* @__PURE__ */ t(xs, {}),
|
|
1172
|
+
label: ["editor.underline", "Underline"],
|
|
1173
|
+
command: ["module.inline.format", { tag: "u" }],
|
|
1174
|
+
toggle: "underline"
|
|
1175
|
+
},
|
|
1176
|
+
strike: {
|
|
1177
|
+
id: "strike",
|
|
1178
|
+
icon: /* @__PURE__ */ t(ms, {}),
|
|
1179
|
+
label: ["editor.strike", "Strikethrough"],
|
|
1180
|
+
command: ["module.inline.format", { tag: "del" }],
|
|
1181
|
+
toggle: "strike"
|
|
1182
|
+
},
|
|
1183
|
+
ul: {
|
|
1184
|
+
id: "ul",
|
|
1185
|
+
icon: /* @__PURE__ */ t(Fa, {}),
|
|
1186
|
+
label: ["editor.list.bullet", "Bulleted list"],
|
|
1187
|
+
command: ["module.list.toggle", "ul"],
|
|
1188
|
+
toggle: "ul"
|
|
1189
|
+
},
|
|
1190
|
+
ol: {
|
|
1191
|
+
id: "ol",
|
|
1192
|
+
icon: /* @__PURE__ */ t(Pa, {}),
|
|
1193
|
+
label: ["editor.list.ordered", "Numbered list"],
|
|
1194
|
+
command: ["module.list.toggle", "ol"],
|
|
1195
|
+
toggle: "ol"
|
|
1196
|
+
},
|
|
1197
|
+
// Redactor's own list commands. They only act inside a list, so the
|
|
1198
|
+
// buttons are off elsewhere, as Redactor's `observe: 'list'` does. The
|
|
1199
|
+
// icons point along the writing direction, so they flip in RTL.
|
|
1200
|
+
outdent: {
|
|
1201
|
+
id: "outdent",
|
|
1202
|
+
icon: /* @__PURE__ */ t($a, { className: "ds:rtl:-scale-x-100" }),
|
|
1203
|
+
label: ["editor.list.outdent", "Decrease indent"],
|
|
1204
|
+
command: ["module.list.outdent"],
|
|
1205
|
+
needs: ["ul", "ol"]
|
|
1206
|
+
},
|
|
1207
|
+
indent: {
|
|
1208
|
+
id: "indent",
|
|
1209
|
+
icon: /* @__PURE__ */ t(Da, { className: "ds:rtl:-scale-x-100" }),
|
|
1210
|
+
label: ["editor.list.indent", "Increase indent"],
|
|
1211
|
+
command: ["module.list.indent"],
|
|
1212
|
+
needs: ["ul", "ol"]
|
|
1213
|
+
},
|
|
1214
|
+
line: {
|
|
1215
|
+
id: "line",
|
|
1216
|
+
icon: /* @__PURE__ */ t(Wi, {}),
|
|
1217
|
+
label: ["editor.line", "Horizontal line"],
|
|
1218
|
+
command: ["module.line.insert"]
|
|
1219
|
+
}
|
|
1220
|
+
}, $s = [10, 11, 12, 14, 16, 18, 20, 24, 28, 30], Gn = [
|
|
1221
|
+
{
|
|
1222
|
+
id: "paragraph",
|
|
1223
|
+
tag: "p",
|
|
1224
|
+
icon: /* @__PURE__ */ t(rs, {}),
|
|
1225
|
+
label: ["editor.paragraph", "Paragraph"]
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
id: "h1",
|
|
1229
|
+
tag: "h1",
|
|
1230
|
+
icon: /* @__PURE__ */ t(xa, {}),
|
|
1231
|
+
label: ["editor.heading1", "Heading 1"],
|
|
1232
|
+
full: !0
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
id: "h2",
|
|
1236
|
+
tag: "h2",
|
|
1237
|
+
icon: /* @__PURE__ */ t(wa, {}),
|
|
1238
|
+
label: ["editor.heading2", "Heading 2"]
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
id: "h3",
|
|
1242
|
+
tag: "h3",
|
|
1243
|
+
icon: /* @__PURE__ */ t(Aa, {}),
|
|
1244
|
+
label: ["editor.heading3", "Heading 3"]
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
id: "h4",
|
|
1248
|
+
tag: "h4",
|
|
1249
|
+
icon: /* @__PURE__ */ t(Ta, {}),
|
|
1250
|
+
label: ["editor.heading4", "Heading 4"],
|
|
1251
|
+
full: !0
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
id: "h5",
|
|
1255
|
+
tag: "h5",
|
|
1256
|
+
icon: /* @__PURE__ */ t(Ma, {}),
|
|
1257
|
+
label: ["editor.heading5", "Heading 5"],
|
|
1258
|
+
full: !0
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
id: "h6",
|
|
1262
|
+
tag: "h6",
|
|
1263
|
+
icon: /* @__PURE__ */ t(Ra, {}),
|
|
1264
|
+
label: ["editor.heading6", "Heading 6"],
|
|
1265
|
+
full: !0
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
id: "quote",
|
|
1269
|
+
tag: "blockquote",
|
|
1270
|
+
icon: /* @__PURE__ */ t(is, {}),
|
|
1271
|
+
label: ["editor.quote", "Quote"]
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
id: "code",
|
|
1275
|
+
tag: "pre",
|
|
1276
|
+
icon: /* @__PURE__ */ t(Ui, {}),
|
|
1277
|
+
label: ["editor.code", "Code"],
|
|
1278
|
+
full: !0
|
|
1279
|
+
}
|
|
1280
|
+
], un = [
|
|
1281
|
+
{
|
|
1282
|
+
id: "left",
|
|
1283
|
+
icon: /* @__PURE__ */ t(ko, {}),
|
|
1284
|
+
label: ["editor.align.left", "Align left"]
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
id: "center",
|
|
1288
|
+
icon: /* @__PURE__ */ t(yo, {}),
|
|
1289
|
+
label: ["editor.align.center", "Align centre"]
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
id: "right",
|
|
1293
|
+
icon: /* @__PURE__ */ t(wo, {}),
|
|
1294
|
+
label: ["editor.align.right", "Align right"]
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
id: "justify",
|
|
1298
|
+
icon: /* @__PURE__ */ t(vs, {}),
|
|
1299
|
+
label: ["editor.align.justify", "Justify"]
|
|
1300
|
+
}
|
|
1301
|
+
], Qn = [
|
|
1302
|
+
"p",
|
|
1303
|
+
"div",
|
|
1304
|
+
"blockquote",
|
|
1305
|
+
"pre",
|
|
1306
|
+
"h1",
|
|
1307
|
+
"h2",
|
|
1308
|
+
"h3",
|
|
1309
|
+
"h4",
|
|
1310
|
+
"h5",
|
|
1311
|
+
"h6",
|
|
1312
|
+
"li"
|
|
1313
|
+
], Os = {
|
|
1314
|
+
minimal: ["bold", "italic", "underline", "link"],
|
|
1315
|
+
standard: [
|
|
1316
|
+
"undo",
|
|
1317
|
+
"redo",
|
|
1318
|
+
"format",
|
|
1319
|
+
"bold",
|
|
1320
|
+
"italic",
|
|
1321
|
+
"underline",
|
|
1322
|
+
"strike",
|
|
1323
|
+
"align",
|
|
1324
|
+
"ul",
|
|
1325
|
+
"ol",
|
|
1326
|
+
"link"
|
|
1327
|
+
],
|
|
1328
|
+
// Every tool: platform's `RedactorWysiwyg` set. A host that wants fewer
|
|
1329
|
+
// picks `custom`. Image and table still need what makes them work (an
|
|
1330
|
+
// upload, the engine's table plugin).
|
|
1331
|
+
full: [...Hs]
|
|
1332
|
+
}, No = [
|
|
1333
|
+
{
|
|
1334
|
+
id: "rowAbove",
|
|
1335
|
+
command: "plugin.table.addRowAbove",
|
|
1336
|
+
icon: /* @__PURE__ */ t(sa, {}),
|
|
1337
|
+
label: ["editor.table.rowAbove", "Add row above"]
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
id: "rowBelow",
|
|
1341
|
+
command: "plugin.table.addRowBelow",
|
|
1342
|
+
icon: /* @__PURE__ */ t(ia, {}),
|
|
1343
|
+
label: ["editor.table.rowBelow", "Add row below"]
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
id: "colLeft",
|
|
1347
|
+
command: "plugin.table.addColumnLeft",
|
|
1348
|
+
icon: /* @__PURE__ */ t(ua, {}),
|
|
1349
|
+
label: ["editor.table.columnLeft", "Add column left"]
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
id: "colRight",
|
|
1353
|
+
command: "plugin.table.addColumnRight",
|
|
1354
|
+
icon: /* @__PURE__ */ t(ca, {}),
|
|
1355
|
+
label: ["editor.table.columnRight", "Add column right"]
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
id: "addHead",
|
|
1359
|
+
command: "plugin.table.addHead",
|
|
1360
|
+
icon: /* @__PURE__ */ t(es, {}),
|
|
1361
|
+
label: ["editor.table.addHeader", "Add header row"]
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
id: "deleteHead",
|
|
1365
|
+
command: "plugin.table.deleteHead",
|
|
1366
|
+
icon: /* @__PURE__ */ t(Ya, {}),
|
|
1367
|
+
label: ["editor.table.deleteHeader", "Remove header row"]
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
id: "deleteRow",
|
|
1371
|
+
command: "plugin.table.deleteRow",
|
|
1372
|
+
icon: /* @__PURE__ */ t(cs, {}),
|
|
1373
|
+
label: ["editor.table.deleteRow", "Delete row"]
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
id: "deleteColumn",
|
|
1377
|
+
command: "plugin.table.deleteColumn",
|
|
1378
|
+
icon: /* @__PURE__ */ t(va, {}),
|
|
1379
|
+
label: ["editor.table.deleteColumn", "Delete column"]
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
id: "deleteTable",
|
|
1383
|
+
command: "plugin.table.deleteTable",
|
|
1384
|
+
icon: /* @__PURE__ */ t(Zi, {}),
|
|
1385
|
+
label: ["editor.table.deleteTable", "Delete table"]
|
|
1386
|
+
}
|
|
1387
|
+
], mn = 6, To = "ds:[&_[data-intent=ghost]:hover]:bg-[color-mix(in_srgb,var(--accent)_12%,transparent)] ds:[&_[data-intent=ghost]:hover]:text-[color:var(--accent)]", Ds = Et(
|
|
1388
|
+
[
|
|
1389
|
+
"ds:@container/toolbar",
|
|
1390
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
1391
|
+
"ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
|
|
1392
|
+
"ds:shadow-[var(--shadow-md)]",
|
|
1393
|
+
To
|
|
1394
|
+
].join(" ")
|
|
1395
|
+
), qs = "ds:flex ds:flex-nowrap ds:items-center ds:gap-[var(--spacing-xs)] ds:min-w-0", io = "__more", Ps = 44, bn = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", qt = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
|
|
1396
|
+
function pn(n) {
|
|
1397
|
+
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1398
|
+
}
|
|
1399
|
+
function Bs(n) {
|
|
1400
|
+
const i = n.trim();
|
|
1401
|
+
return i && (/^([^\s/:@]+\.[^\s/:@]+|localhost):\d+([/?#]|$)/i.test(i) ? `https://${i}` : /^[a-z][a-z0-9+.-]*:/i.test(i) || /^[/#?]/.test(i) || i.startsWith("[[") ? i : /^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(i) ? `mailto:${i}` : `https://${i}`);
|
|
1402
|
+
}
|
|
1403
|
+
function Fs({
|
|
1404
|
+
variables: n,
|
|
1405
|
+
recentVariableTokens: i,
|
|
1406
|
+
insertVariable: s,
|
|
1407
|
+
saveSelection: l
|
|
1408
|
+
}) {
|
|
1409
|
+
const { t: f } = de("ui"), [y, w] = A(!1), [g, b] = A(""), p = k(null), N = k(!1), E = qi(!0, {
|
|
1410
|
+
getAnchor: Pi,
|
|
1411
|
+
onReturnToTrigger: () => w(!1)
|
|
1412
|
+
}), _ = n;
|
|
1413
|
+
return /* @__PURE__ */ C(
|
|
1414
|
+
dn.Root,
|
|
1415
|
+
{
|
|
1416
|
+
open: y,
|
|
1417
|
+
onOpenChange: (I) => {
|
|
1418
|
+
I && l(), w(I), I && b("");
|
|
1419
|
+
},
|
|
1420
|
+
children: [
|
|
1421
|
+
/* @__PURE__ */ t(dn.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1422
|
+
te,
|
|
1423
|
+
{
|
|
1424
|
+
ref: p,
|
|
1425
|
+
size: "sm",
|
|
1426
|
+
intent: "ghost",
|
|
1427
|
+
icon: /* @__PURE__ */ t(pa, {}),
|
|
1428
|
+
"aria-label": f("editor.insertVariable", "Insert variable")
|
|
1429
|
+
}
|
|
1430
|
+
) }),
|
|
1431
|
+
/* @__PURE__ */ t(dn.Portal, { children: /* @__PURE__ */ t(
|
|
1432
|
+
dn.Content,
|
|
1433
|
+
{
|
|
1434
|
+
align: "start",
|
|
1435
|
+
sideOffset: 4,
|
|
1436
|
+
className: "ds:z-[var(--z-popover)]",
|
|
1437
|
+
onKeyDown: E,
|
|
1438
|
+
onCloseAutoFocus: (I) => {
|
|
1439
|
+
N.current && (I.preventDefault(), N.current = !1);
|
|
1440
|
+
},
|
|
1441
|
+
children: /* @__PURE__ */ t(
|
|
1442
|
+
vo,
|
|
1443
|
+
{
|
|
1444
|
+
variables: _,
|
|
1445
|
+
recentTokens: i,
|
|
1446
|
+
query: g,
|
|
1447
|
+
onQueryChange: b,
|
|
1448
|
+
searchFocusable: !0,
|
|
1449
|
+
"aria-label": f("editor.insertVariable", "Insert variable"),
|
|
1450
|
+
onSelect: (I) => {
|
|
1451
|
+
N.current = !0, s(I.token), w(!1);
|
|
1452
|
+
},
|
|
1453
|
+
onClose: () => w(!1)
|
|
1454
|
+
}
|
|
1455
|
+
)
|
|
1456
|
+
}
|
|
1457
|
+
) })
|
|
1458
|
+
]
|
|
1459
|
+
}
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
function js({
|
|
1463
|
+
run: n,
|
|
1464
|
+
active: i,
|
|
1465
|
+
full: s,
|
|
1466
|
+
onTriggerDown: l
|
|
1467
|
+
}) {
|
|
1468
|
+
const { t: f } = de("ui"), y = Gn.find((g) => i.has(g.id)) ?? Gn[0], w = Gn.filter((g) => s || !g.full);
|
|
1469
|
+
return /* @__PURE__ */ C(U.Root, { children: [
|
|
1470
|
+
/* @__PURE__ */ t(U.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1471
|
+
$e,
|
|
1472
|
+
{
|
|
1473
|
+
size: "sm",
|
|
1474
|
+
intent: "ghost",
|
|
1475
|
+
startIcon: y.icon,
|
|
1476
|
+
endIcon: /* @__PURE__ */ t(or, {}),
|
|
1477
|
+
"aria-label": `${f("editor.format", "Paragraph style")}: ${f(
|
|
1478
|
+
y.label[0],
|
|
1479
|
+
y.label[1]
|
|
1480
|
+
)}`,
|
|
1481
|
+
onMouseDown: l,
|
|
1482
|
+
children: /* @__PURE__ */ t("span", { className: "ds:hidden ds:@[448px]/toolbar:inline", children: f(y.label[0], y.label[1]) })
|
|
1483
|
+
}
|
|
1484
|
+
) }),
|
|
1485
|
+
/* @__PURE__ */ t(U.Content, { align: "start", children: w.map((g) => /* @__PURE__ */ t(
|
|
1486
|
+
U.Item,
|
|
1487
|
+
{
|
|
1488
|
+
startIcon: g.icon,
|
|
1489
|
+
onSelect: () => n("module.block.format", { tag: g.tag }),
|
|
1490
|
+
children: f(g.label[0], g.label[1])
|
|
1491
|
+
},
|
|
1492
|
+
g.id
|
|
1493
|
+
)) })
|
|
1494
|
+
] });
|
|
1495
|
+
}
|
|
1496
|
+
function Gs({
|
|
1497
|
+
run: n,
|
|
1498
|
+
active: i,
|
|
1499
|
+
onTriggerDown: s
|
|
1500
|
+
}) {
|
|
1501
|
+
const { t: l } = de("ui"), f = k(null), [y, w] = A(!1);
|
|
1502
|
+
po(() => {
|
|
1503
|
+
const E = f.current;
|
|
1504
|
+
E && w(getComputedStyle(E).direction === "rtl");
|
|
1505
|
+
}, []);
|
|
1506
|
+
const g = y ? "right" : "left", b = un.find((E) => i.has(`align-${E.id}`)) ?? un.find((E) => E.id === g) ?? un[0], p = (E) => {
|
|
1507
|
+
E === g ? n("module.block.remove", { style: "text-align" }, Qn) : n("module.block.add", { style: { "text-align": E } }, Qn), E === g || E === "justify" ? n("module.block.remove", { style: "list-style-position" }, ["li"]) : n("module.block.add", { style: { "list-style-position": "inside" } }, [
|
|
1508
|
+
"li"
|
|
1509
|
+
]);
|
|
1510
|
+
}, N = `${l("editor.align.label", "Text alignment")}: ${l(
|
|
1511
|
+
b.label[0],
|
|
1512
|
+
b.label[1]
|
|
1513
|
+
)}`;
|
|
1514
|
+
return /* @__PURE__ */ C(U.Root, { children: [
|
|
1515
|
+
/* @__PURE__ */ t(U.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1516
|
+
$e,
|
|
1517
|
+
{
|
|
1518
|
+
ref: f,
|
|
1519
|
+
size: "sm",
|
|
1520
|
+
intent: "ghost",
|
|
1521
|
+
startIcon: b.icon,
|
|
1522
|
+
endIcon: /* @__PURE__ */ t(or, {}),
|
|
1523
|
+
"aria-label": N,
|
|
1524
|
+
onMouseDown: s
|
|
1525
|
+
}
|
|
1526
|
+
) }),
|
|
1527
|
+
/* @__PURE__ */ t(U.Content, { align: "start", children: /* @__PURE__ */ t(U.RadioGroup, { value: b.id, onValueChange: p, children: un.map((E) => /* @__PURE__ */ t(U.RadioItem, { value: E.id, children: l(E.label[0], E.label[1]) }, E.id)) }) })
|
|
1528
|
+
] });
|
|
1529
|
+
}
|
|
1530
|
+
function Vs({
|
|
1531
|
+
insertHtml: n,
|
|
1532
|
+
saveSelection: i,
|
|
1533
|
+
restoreSelection: s,
|
|
1534
|
+
getSelectedText: l
|
|
1535
|
+
}) {
|
|
1536
|
+
const { t: f } = de("ui"), [y, w] = A(!1), [g, b] = A(""), [p, N] = A(""), [E, _] = A(!1), I = Qe(), Z = Qe(), h = () => {
|
|
1537
|
+
b(""), N(""), _(!1);
|
|
1538
|
+
}, m = () => {
|
|
1539
|
+
const v = g.trim();
|
|
1540
|
+
if (!v) return;
|
|
1541
|
+
const B = Bs(v), D = p.trim() || v, F = E ? ' target="_blank" rel="noopener noreferrer"' : "", ee = `<a href="${pn(B)}"${F}>${pn(D)}</a>`;
|
|
1542
|
+
w(!1), h(), window.requestAnimationFrame(() => {
|
|
1543
|
+
s(), n(ee);
|
|
1544
|
+
});
|
|
1545
|
+
};
|
|
1546
|
+
return /* @__PURE__ */ C(be.Root, { open: y, onOpenChange: w, children: [
|
|
1547
|
+
/* @__PURE__ */ t(be.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1548
|
+
te,
|
|
1549
|
+
{
|
|
1550
|
+
size: "sm",
|
|
1551
|
+
intent: "ghost",
|
|
1552
|
+
icon: /* @__PURE__ */ t(Ia, {}),
|
|
1553
|
+
"aria-label": f("editor.link.insert", "Insert link"),
|
|
1554
|
+
onMouseDown: () => {
|
|
1555
|
+
i(), N(l());
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
) }),
|
|
1559
|
+
/* @__PURE__ */ C(be.Content, { children: [
|
|
1560
|
+
/* @__PURE__ */ t(be.Header, { children: /* @__PURE__ */ t(be.Title, { children: f("editor.link.insert", "Insert link") }) }),
|
|
1561
|
+
/* @__PURE__ */ C(be.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
1562
|
+
/* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1563
|
+
/* @__PURE__ */ t("label", { htmlFor: I, className: qt, children: f("editor.link.url", "URL") }),
|
|
1564
|
+
/* @__PURE__ */ t(
|
|
1565
|
+
gn,
|
|
1566
|
+
{
|
|
1567
|
+
id: I,
|
|
1568
|
+
type: "url",
|
|
1569
|
+
value: g,
|
|
1570
|
+
onChange: (v) => b(v.target.value),
|
|
1571
|
+
placeholder: "https://…"
|
|
1572
|
+
}
|
|
1573
|
+
)
|
|
1574
|
+
] }),
|
|
1575
|
+
/* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1576
|
+
/* @__PURE__ */ t("label", { htmlFor: Z, className: qt, children: f("editor.link.text", "Text to display") }),
|
|
1577
|
+
/* @__PURE__ */ t(
|
|
1578
|
+
gn,
|
|
1579
|
+
{
|
|
1580
|
+
id: Z,
|
|
1581
|
+
value: p,
|
|
1582
|
+
onChange: (v) => N(v.target.value),
|
|
1583
|
+
placeholder: f("editor.link.textPlaceholder", "Link text")
|
|
1584
|
+
}
|
|
1585
|
+
)
|
|
1586
|
+
] }),
|
|
1587
|
+
/* @__PURE__ */ t(
|
|
1588
|
+
Bi,
|
|
1589
|
+
{
|
|
1590
|
+
checked: E,
|
|
1591
|
+
onCheckedChange: (v) => _(v === !0),
|
|
1592
|
+
label: f("editor.link.newTab", "Open in new tab")
|
|
1593
|
+
}
|
|
1594
|
+
)
|
|
1595
|
+
] }),
|
|
1596
|
+
/* @__PURE__ */ C(be.Footer, { children: [
|
|
1597
|
+
/* @__PURE__ */ t(be.Close, { asChild: !0, children: /* @__PURE__ */ t($e, { intent: "secondary", children: f("common.cancel") }) }),
|
|
1598
|
+
/* @__PURE__ */ t($e, { onClick: m, disabled: !g.trim(), children: f("editor.link.insertAction", "Insert") })
|
|
1599
|
+
] })
|
|
1600
|
+
] })
|
|
1601
|
+
] });
|
|
1602
|
+
}
|
|
1603
|
+
function Ks({
|
|
1604
|
+
insertHtml: n,
|
|
1605
|
+
saveSelection: i,
|
|
1606
|
+
restoreSelection: s,
|
|
1607
|
+
uploadImage: l
|
|
1608
|
+
}) {
|
|
1609
|
+
const { t: f } = de("ui"), [y, w] = A(!1), [g, b] = A(""), [p, N] = A(""), E = Qe(), _ = Qe(), I = (h, m) => {
|
|
1610
|
+
const v = `<img src="${pn(h)}" alt="${pn(m)}" loading="lazy">`;
|
|
1611
|
+
w(!1), b(""), N(""), window.requestAnimationFrame(() => {
|
|
1612
|
+
s(), n(v);
|
|
1613
|
+
});
|
|
1614
|
+
}, Z = () => {
|
|
1615
|
+
const h = g.trim();
|
|
1616
|
+
h && I(h, p.trim());
|
|
1617
|
+
};
|
|
1618
|
+
return /* @__PURE__ */ C(be.Root, { open: y, onOpenChange: w, children: [
|
|
1619
|
+
/* @__PURE__ */ t(be.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1620
|
+
te,
|
|
1621
|
+
{
|
|
1622
|
+
size: "sm",
|
|
1623
|
+
intent: "ghost",
|
|
1624
|
+
icon: /* @__PURE__ */ t(Yi, {}),
|
|
1625
|
+
"aria-label": f("editor.image.insert", "Insert image"),
|
|
1626
|
+
onMouseDown: () => i()
|
|
1627
|
+
}
|
|
1628
|
+
) }),
|
|
1629
|
+
/* @__PURE__ */ C(be.Content, { children: [
|
|
1630
|
+
/* @__PURE__ */ t(be.Header, { children: /* @__PURE__ */ t(be.Title, { children: f("editor.image.insert", "Insert image") }) }),
|
|
1631
|
+
/* @__PURE__ */ C(be.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
1632
|
+
l ? /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1633
|
+
/* @__PURE__ */ t("span", { className: qt, children: f("editor.image.upload", "Upload") }),
|
|
1634
|
+
/* @__PURE__ */ t(
|
|
1635
|
+
Fi,
|
|
1636
|
+
{
|
|
1637
|
+
variant: "dropzone",
|
|
1638
|
+
accept: {
|
|
1639
|
+
"image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
|
|
1640
|
+
},
|
|
1641
|
+
maxFiles: 1,
|
|
1642
|
+
onUpload: async (h, { signal: m }) => {
|
|
1643
|
+
const v = await l(h, m);
|
|
1644
|
+
I(v, h.name);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
),
|
|
1648
|
+
/* @__PURE__ */ t("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: f("editor.image.orUrl", "Or paste an image URL") })
|
|
1649
|
+
] }) : null,
|
|
1650
|
+
/* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1651
|
+
/* @__PURE__ */ t("label", { htmlFor: E, className: qt, children: f("editor.image.url", "Image URL") }),
|
|
1652
|
+
/* @__PURE__ */ t(
|
|
1653
|
+
gn,
|
|
1654
|
+
{
|
|
1655
|
+
id: E,
|
|
1656
|
+
type: "url",
|
|
1657
|
+
value: g,
|
|
1658
|
+
onChange: (h) => b(h.target.value),
|
|
1659
|
+
placeholder: "https://…"
|
|
1660
|
+
}
|
|
1661
|
+
)
|
|
1662
|
+
] }),
|
|
1663
|
+
/* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
1664
|
+
/* @__PURE__ */ t("label", { htmlFor: _, className: qt, children: f("editor.image.alt", "Alt text") }),
|
|
1665
|
+
/* @__PURE__ */ t(
|
|
1666
|
+
gn,
|
|
1667
|
+
{
|
|
1668
|
+
id: _,
|
|
1669
|
+
value: p,
|
|
1670
|
+
onChange: (h) => N(h.target.value),
|
|
1671
|
+
placeholder: f(
|
|
1672
|
+
"editor.image.altPlaceholder",
|
|
1673
|
+
"Describe the image"
|
|
1674
|
+
)
|
|
1675
|
+
}
|
|
1676
|
+
)
|
|
1677
|
+
] })
|
|
1678
|
+
] }),
|
|
1679
|
+
/* @__PURE__ */ C(be.Footer, { children: [
|
|
1680
|
+
/* @__PURE__ */ t(be.Close, { asChild: !0, children: /* @__PURE__ */ t($e, { intent: "secondary", children: f("common.cancel") }) }),
|
|
1681
|
+
/* @__PURE__ */ t($e, { onClick: Z, disabled: !g.trim(), children: f("editor.image.insertAction", "Insert") })
|
|
1682
|
+
] })
|
|
1683
|
+
] })
|
|
1684
|
+
] });
|
|
1685
|
+
}
|
|
1686
|
+
function Ws({
|
|
1687
|
+
run: n,
|
|
1688
|
+
onTriggerDown: i
|
|
1689
|
+
}) {
|
|
1690
|
+
const { t: s } = de("ui");
|
|
1691
|
+
return /* @__PURE__ */ C(U.Root, { children: [
|
|
1692
|
+
/* @__PURE__ */ t(U.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1693
|
+
te,
|
|
1694
|
+
{
|
|
1695
|
+
size: "sm",
|
|
1696
|
+
intent: "ghost",
|
|
1697
|
+
icon: /* @__PURE__ */ t(ta, {}),
|
|
1698
|
+
"aria-label": s("editor.fontSize.label", "Font size"),
|
|
1699
|
+
onMouseDown: i
|
|
1700
|
+
}
|
|
1701
|
+
) }),
|
|
1702
|
+
/* @__PURE__ */ C(U.Content, { align: "start", children: [
|
|
1703
|
+
$s.map((l) => /* @__PURE__ */ t(
|
|
1704
|
+
U.Item,
|
|
1705
|
+
{
|
|
1706
|
+
onSelect: () => n("module.inline.format", {
|
|
1707
|
+
tag: "span",
|
|
1708
|
+
style: { "font-size": `${l}px` },
|
|
1709
|
+
type: "toggle"
|
|
1710
|
+
}),
|
|
1711
|
+
children: `${l}px`
|
|
1712
|
+
},
|
|
1713
|
+
l
|
|
1714
|
+
)),
|
|
1715
|
+
/* @__PURE__ */ t(U.Separator, {}),
|
|
1716
|
+
/* @__PURE__ */ t(
|
|
1717
|
+
U.Item,
|
|
1718
|
+
{
|
|
1719
|
+
onSelect: () => n("module.inline.remove", { style: "font-size" }),
|
|
1720
|
+
children: s("editor.fontSize.reset", "Reset font size")
|
|
1721
|
+
}
|
|
1722
|
+
)
|
|
1723
|
+
] })
|
|
1724
|
+
] });
|
|
1725
|
+
}
|
|
1726
|
+
function Xs({
|
|
1727
|
+
run: n,
|
|
1728
|
+
saveSelection: i,
|
|
1729
|
+
restoreSelection: s
|
|
1730
|
+
}) {
|
|
1731
|
+
const { t: l } = de("ui"), [f, y] = A("#1f2a5c"), w = (b) => {
|
|
1732
|
+
y(b), s(), n("module.inline.format", {
|
|
1733
|
+
tag: "span",
|
|
1734
|
+
style: { color: b },
|
|
1735
|
+
type: "toggle"
|
|
1736
|
+
});
|
|
1737
|
+
}, g = () => {
|
|
1738
|
+
s(), n("module.inline.remove", { style: "color" });
|
|
1739
|
+
};
|
|
1740
|
+
return /* @__PURE__ */ C(fe, { onOpenChange: (b) => b && i(), children: [
|
|
1741
|
+
/* @__PURE__ */ t(fe.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1742
|
+
te,
|
|
1743
|
+
{
|
|
1744
|
+
size: "sm",
|
|
1745
|
+
intent: "ghost",
|
|
1746
|
+
icon: /* @__PURE__ */ t(Xa, {}),
|
|
1747
|
+
"aria-label": l("editor.textColor", "Text colour"),
|
|
1748
|
+
onMouseDown: (b) => {
|
|
1749
|
+
b.preventDefault(), i();
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
) }),
|
|
1753
|
+
/* @__PURE__ */ C(
|
|
1754
|
+
fe.Content,
|
|
1755
|
+
{
|
|
1756
|
+
side: "bottom",
|
|
1757
|
+
align: "start",
|
|
1758
|
+
"aria-label": l("editor.textColor", "Text colour"),
|
|
1759
|
+
children: [
|
|
1760
|
+
/* @__PURE__ */ t(fe.Heading, { children: l("editor.textColor", "Text colour") }),
|
|
1761
|
+
/* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
|
|
1762
|
+
rr,
|
|
1763
|
+
{
|
|
1764
|
+
variant: "inline",
|
|
1765
|
+
size: "sm",
|
|
1766
|
+
value: f,
|
|
1767
|
+
onChange: w
|
|
1768
|
+
}
|
|
1769
|
+
) }),
|
|
1770
|
+
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t($e, { size: "sm", intent: "secondary", onClick: g, children: l("editor.color.remove", "Remove colour") }) })
|
|
1771
|
+
]
|
|
1772
|
+
}
|
|
1773
|
+
)
|
|
1774
|
+
] });
|
|
1775
|
+
}
|
|
1776
|
+
function Us({
|
|
1777
|
+
run: n,
|
|
1778
|
+
saveSelection: i,
|
|
1779
|
+
restoreSelection: s
|
|
1780
|
+
}) {
|
|
1781
|
+
const { t: l } = de("ui"), [f, y] = A("#fff3a3"), w = (b) => {
|
|
1782
|
+
y(b), s(), n("module.inline.format", {
|
|
1783
|
+
tag: "span",
|
|
1784
|
+
style: { "background-color": b },
|
|
1785
|
+
type: "toggle"
|
|
1786
|
+
});
|
|
1787
|
+
}, g = () => {
|
|
1788
|
+
s(), n("module.inline.remove", { style: "background-color" });
|
|
1789
|
+
};
|
|
1790
|
+
return /* @__PURE__ */ C(fe, { onOpenChange: (b) => b && i(), children: [
|
|
1791
|
+
/* @__PURE__ */ t(fe.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1792
|
+
te,
|
|
1793
|
+
{
|
|
1794
|
+
size: "sm",
|
|
1795
|
+
intent: "ghost",
|
|
1796
|
+
icon: /* @__PURE__ */ t(Qi, {}),
|
|
1797
|
+
"aria-label": l("editor.highlightColor", "Highlight"),
|
|
1798
|
+
onMouseDown: (b) => {
|
|
1799
|
+
b.preventDefault(), i();
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
) }),
|
|
1803
|
+
/* @__PURE__ */ C(
|
|
1804
|
+
fe.Content,
|
|
1805
|
+
{
|
|
1806
|
+
side: "bottom",
|
|
1807
|
+
align: "start",
|
|
1808
|
+
"aria-label": l("editor.highlightColor", "Highlight"),
|
|
1809
|
+
children: [
|
|
1810
|
+
/* @__PURE__ */ t(fe.Heading, { children: l("editor.highlightColor", "Highlight") }),
|
|
1811
|
+
/* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
|
|
1812
|
+
rr,
|
|
1813
|
+
{
|
|
1814
|
+
variant: "inline",
|
|
1815
|
+
size: "sm",
|
|
1816
|
+
value: f,
|
|
1817
|
+
onChange: w
|
|
1818
|
+
}
|
|
1819
|
+
) }),
|
|
1820
|
+
/* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t($e, { size: "sm", intent: "secondary", onClick: g, children: l("editor.highlight.remove", "Remove highlight") }) })
|
|
1821
|
+
]
|
|
1822
|
+
}
|
|
1823
|
+
)
|
|
1824
|
+
] });
|
|
1825
|
+
}
|
|
1826
|
+
function Zs(n, i) {
|
|
1827
|
+
const s = Array.from({ length: i }, () => "<td><br></td>").join("");
|
|
1828
|
+
return `<table><tbody>${Array.from({ length: n }, () => `<tr>${s}</tr>`).join("")}</tbody></table>`;
|
|
1829
|
+
}
|
|
1830
|
+
function Qs({
|
|
1831
|
+
run: n,
|
|
1832
|
+
insertTable: i,
|
|
1833
|
+
active: s
|
|
1834
|
+
}) {
|
|
1835
|
+
const { t: l } = de("ui"), [f, y] = A({ r: 0, c: 0 }), [w, g] = A(!1), b = s.has("table") || w, p = /* @__PURE__ */ t(
|
|
1836
|
+
te,
|
|
1837
|
+
{
|
|
1838
|
+
size: "sm",
|
|
1839
|
+
intent: "ghost",
|
|
1840
|
+
icon: /* @__PURE__ */ t(hs, {}),
|
|
1841
|
+
"aria-label": l("editor.table.insert", "Insert table"),
|
|
1842
|
+
onMouseDown: (N) => N.preventDefault()
|
|
1843
|
+
}
|
|
1844
|
+
);
|
|
1845
|
+
return b ? /* @__PURE__ */ C(U.Root, { open: w, onOpenChange: g, children: [
|
|
1846
|
+
/* @__PURE__ */ t(U.Trigger, { asChild: !0, children: p }),
|
|
1847
|
+
/* @__PURE__ */ t(U.Content, { side: "bottom", align: "start", children: No.map((N) => /* @__PURE__ */ t(
|
|
1848
|
+
U.Item,
|
|
1849
|
+
{
|
|
1850
|
+
startIcon: N.icon,
|
|
1851
|
+
onSelect: () => n(N.command),
|
|
1852
|
+
children: l(N.label[0], N.label[1])
|
|
1853
|
+
},
|
|
1854
|
+
N.id
|
|
1855
|
+
)) })
|
|
1856
|
+
] }) : /* @__PURE__ */ C(fe, { onOpenChange: (N) => !N && y({ r: 0, c: 0 }), children: [
|
|
1857
|
+
/* @__PURE__ */ t(fe.Trigger, { asChild: !0, children: p }),
|
|
1858
|
+
/* @__PURE__ */ C(fe.Content, { side: "bottom", align: "start", children: [
|
|
1859
|
+
/* @__PURE__ */ t(fe.Heading, { children: l("editor.table.insert", "Insert table") }),
|
|
1860
|
+
/* @__PURE__ */ t(
|
|
1861
|
+
"div",
|
|
1862
|
+
{
|
|
1863
|
+
role: "group",
|
|
1864
|
+
"aria-label": l("editor.table.sizePicker", "Table size"),
|
|
1865
|
+
className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
|
|
1866
|
+
onMouseLeave: () => y({ r: 0, c: 0 }),
|
|
1867
|
+
children: Array.from({ length: mn * mn }, (N, E) => {
|
|
1868
|
+
const _ = Math.floor(E / mn) + 1, I = E % mn + 1, Z = _ <= f.r && I <= f.c;
|
|
1869
|
+
return /* @__PURE__ */ t(
|
|
1870
|
+
"button",
|
|
1871
|
+
{
|
|
1872
|
+
type: "button",
|
|
1873
|
+
"aria-label": l("editor.table.sizeCell", "{{r}}×{{c}}", {
|
|
1874
|
+
r: _,
|
|
1875
|
+
c: I
|
|
1876
|
+
}),
|
|
1877
|
+
onMouseEnter: () => y({ r: _, c: I }),
|
|
1878
|
+
onClick: () => i(Zs(_, I)),
|
|
1879
|
+
className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${Z ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
|
|
1880
|
+
},
|
|
1881
|
+
E
|
|
1882
|
+
);
|
|
1883
|
+
})
|
|
1884
|
+
}
|
|
1885
|
+
),
|
|
1886
|
+
/* @__PURE__ */ t("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: f.r > 0 ? l("editor.table.sizeCell", "{{r}}×{{c}}", {
|
|
1887
|
+
r: f.r,
|
|
1888
|
+
c: f.c
|
|
1889
|
+
}) : l("editor.table.sizeHint", "Pick a size") })
|
|
1890
|
+
] })
|
|
1891
|
+
] });
|
|
1892
|
+
}
|
|
1893
|
+
const Ys = Object.fromEntries(No.map((n) => [n.id, n])), Js = [
|
|
1894
|
+
"ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
|
|
1895
|
+
"ds:[inset-block-start:var(--rte-tt-top)] ds:[inset-inline-start:var(--rte-tt-start)]",
|
|
1896
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
1897
|
+
"ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
|
|
1898
|
+
].join(" "), el = "#fde68a";
|
|
1899
|
+
function ao({
|
|
1900
|
+
scope: n,
|
|
1901
|
+
icon: i,
|
|
1902
|
+
label: s,
|
|
1903
|
+
onOpenChange: l,
|
|
1904
|
+
saveTableCell: f,
|
|
1905
|
+
applyTableBackground: y
|
|
1906
|
+
}) {
|
|
1907
|
+
const { t: w } = de("ui"), [g, b] = A(el);
|
|
1908
|
+
return /* @__PURE__ */ C(
|
|
1909
|
+
fe,
|
|
1910
|
+
{
|
|
1911
|
+
onOpenChange: (p) => {
|
|
1912
|
+
l(p), p && f();
|
|
1913
|
+
},
|
|
1914
|
+
children: [
|
|
1915
|
+
/* @__PURE__ */ t(fe.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1916
|
+
te,
|
|
1917
|
+
{
|
|
1918
|
+
size: "sm",
|
|
1919
|
+
intent: "ghost",
|
|
1920
|
+
icon: i,
|
|
1921
|
+
tooltip: s,
|
|
1922
|
+
onMouseDown: (p) => p.preventDefault()
|
|
1923
|
+
}
|
|
1924
|
+
) }),
|
|
1925
|
+
/* @__PURE__ */ C(fe.Content, { side: "bottom", align: "center", "aria-label": s, children: [
|
|
1926
|
+
/* @__PURE__ */ t(
|
|
1927
|
+
rr,
|
|
1928
|
+
{
|
|
1929
|
+
variant: "inline",
|
|
1930
|
+
size: "sm",
|
|
1931
|
+
value: g,
|
|
1932
|
+
onChange: (p) => {
|
|
1933
|
+
b(p), y(n, p);
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
),
|
|
1937
|
+
/* @__PURE__ */ t(
|
|
1938
|
+
$e,
|
|
1939
|
+
{
|
|
1940
|
+
size: "sm",
|
|
1941
|
+
intent: "ghost",
|
|
1942
|
+
className: "ds:mt-[var(--spacing-xs)] ds:w-full",
|
|
1943
|
+
onClick: () => y(n, null),
|
|
1944
|
+
children: w("editor.table.clearColor", "Clear colour")
|
|
1945
|
+
}
|
|
1946
|
+
)
|
|
1947
|
+
] })
|
|
1948
|
+
]
|
|
1949
|
+
}
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
function tl({
|
|
1953
|
+
active: n,
|
|
1954
|
+
run: i,
|
|
1955
|
+
areaRef: s,
|
|
1956
|
+
getActiveTableEl: l,
|
|
1957
|
+
enableColor: f = !1,
|
|
1958
|
+
saveTableCell: y,
|
|
1959
|
+
applyTableBackground: w
|
|
1960
|
+
}) {
|
|
1961
|
+
const { t: g } = de("ui"), b = n.has("table"), [p, N] = A(null), E = k(0), [_, I] = A(!1), Z = x((m) => {
|
|
1962
|
+
E.current = Math.max(
|
|
1963
|
+
0,
|
|
1964
|
+
E.current + (m ? 1 : -1)
|
|
1965
|
+
), I(E.current > 0);
|
|
1966
|
+
}, []);
|
|
1967
|
+
if ($(() => {
|
|
1968
|
+
if (_) return;
|
|
1969
|
+
if (!b || typeof window > "u") {
|
|
1970
|
+
N(null);
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1973
|
+
const m = () => {
|
|
1974
|
+
const F = s.current, ee = l();
|
|
1975
|
+
if (!F || !ee) {
|
|
1976
|
+
N(null);
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
const j = F.getBoundingClientRect(), V = ee.getBoundingClientRect(), X = getComputedStyle(F).direction === "rtl", M = Math.max(0, V.top - j.top - 44), Ee = X ? j.right - V.right + V.width / 2 : V.left - j.left + V.width / 2;
|
|
1980
|
+
N({ top: M, start: Math.max(0, Ee), rtl: X });
|
|
1981
|
+
};
|
|
1982
|
+
m();
|
|
1983
|
+
const v = new ResizeObserver(m), B = s.current, D = l();
|
|
1984
|
+
return B && v.observe(B), D && v.observe(D), window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
|
|
1985
|
+
v.disconnect(), window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
|
|
1986
|
+
};
|
|
1987
|
+
}, [b, _, s, l]), !b && !_ || !p) return null;
|
|
1988
|
+
const h = [
|
|
1989
|
+
["rowAbove", "rowBelow"],
|
|
1990
|
+
["colLeft", "colRight"],
|
|
1991
|
+
["addHead"],
|
|
1992
|
+
...f ? ["colour"] : [],
|
|
1993
|
+
["deleteRow", "deleteColumn"],
|
|
1994
|
+
["deleteTable"]
|
|
1995
|
+
];
|
|
1996
|
+
return (
|
|
1997
|
+
// Tooltips disambiguate the icon-only ops on hover (and provide each
|
|
1998
|
+
// button's accessible name via IconButton's `tooltip` prop). Radix Tooltip
|
|
1999
|
+
// needs a provider ancestor, so scope one to the bar.
|
|
2000
|
+
/* @__PURE__ */ t(nr, { children: /* @__PURE__ */ t(
|
|
2001
|
+
"div",
|
|
2002
|
+
{
|
|
2003
|
+
role: "group",
|
|
2004
|
+
"aria-label": g("editor.table.toolbar", "Table tools"),
|
|
2005
|
+
className: `${Js} ${p.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
|
|
2006
|
+
style: {
|
|
2007
|
+
"--rte-tt-top": `${p.top}px`,
|
|
2008
|
+
"--rte-tt-start": `${p.start}px`
|
|
2009
|
+
},
|
|
2010
|
+
children: h.map((m, v) => /* @__PURE__ */ C(Bt, { children: [
|
|
2011
|
+
v > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: bn }) : null,
|
|
2012
|
+
m === "colour" ? /* @__PURE__ */ C(Ze, { children: [
|
|
2013
|
+
/* @__PURE__ */ t(
|
|
2014
|
+
ao,
|
|
2015
|
+
{
|
|
2016
|
+
scope: "cell",
|
|
2017
|
+
icon: /* @__PURE__ */ t(Ga, {}),
|
|
2018
|
+
label: g("editor.table.cellColor", "Cell colour"),
|
|
2019
|
+
onOpenChange: Z,
|
|
2020
|
+
saveTableCell: y,
|
|
2021
|
+
applyTableBackground: w
|
|
2022
|
+
}
|
|
2023
|
+
),
|
|
2024
|
+
/* @__PURE__ */ t(
|
|
2025
|
+
ao,
|
|
2026
|
+
{
|
|
2027
|
+
scope: "row",
|
|
2028
|
+
icon: /* @__PURE__ */ t(Ka, {}),
|
|
2029
|
+
label: g("editor.table.rowColor", "Row colour"),
|
|
2030
|
+
onOpenChange: Z,
|
|
2031
|
+
saveTableCell: y,
|
|
2032
|
+
applyTableBackground: w
|
|
2033
|
+
}
|
|
2034
|
+
)
|
|
2035
|
+
] }) : m.map((B) => {
|
|
2036
|
+
const D = Ys[B];
|
|
2037
|
+
return /* @__PURE__ */ t(
|
|
2038
|
+
te,
|
|
2039
|
+
{
|
|
2040
|
+
size: "sm",
|
|
2041
|
+
intent: "ghost",
|
|
2042
|
+
icon: D.icon,
|
|
2043
|
+
tooltip: g(D.label[0], D.label[1]),
|
|
2044
|
+
onMouseDown: (F) => F.preventDefault(),
|
|
2045
|
+
onClick: () => i(D.command)
|
|
2046
|
+
},
|
|
2047
|
+
B
|
|
2048
|
+
);
|
|
2049
|
+
})
|
|
2050
|
+
] }, m === "colour" ? "colour" : m[0]))
|
|
2051
|
+
}
|
|
2052
|
+
) })
|
|
2053
|
+
);
|
|
2054
|
+
}
|
|
2055
|
+
const Yn = [
|
|
2056
|
+
"wysiwyg-img-inline",
|
|
2057
|
+
"wysiwyg-img-wrap-left",
|
|
2058
|
+
"wysiwyg-img-wrap-right"
|
|
2059
|
+
], Eo = [
|
|
2060
|
+
"wysiwyg-img-align-left",
|
|
2061
|
+
"wysiwyg-img-align-center",
|
|
2062
|
+
"wysiwyg-img-align-right"
|
|
2063
|
+
];
|
|
2064
|
+
function so(n, i) {
|
|
2065
|
+
return i.find((s) => n.classList.contains(s)) ?? "";
|
|
2066
|
+
}
|
|
2067
|
+
function nl(n) {
|
|
2068
|
+
const i = n.closest(".redactor-in"), s = i instanceof HTMLElement ? i.clientWidth : 0, l = n.getBoundingClientRect().width;
|
|
2069
|
+
return s <= 0 || l <= 0 ? Pt : Math.round(Math.min(Pt, l / s * 100));
|
|
2070
|
+
}
|
|
2071
|
+
const Jn = 10, Pt = 100, rl = 5, ol = 10, lo = (n) => Math.min(Pt, Math.max(Jn, Math.round(n))), il = [
|
|
2072
|
+
{
|
|
2073
|
+
id: "wysiwyg-img-inline",
|
|
2074
|
+
icon: /* @__PURE__ */ t(ra, {}),
|
|
2075
|
+
label: ["editor.image.inline", "Inline with text"]
|
|
2076
|
+
},
|
|
2077
|
+
{
|
|
2078
|
+
id: "wysiwyg-img-wrap-left",
|
|
2079
|
+
icon: /* @__PURE__ */ t(Za, {}),
|
|
2080
|
+
label: ["editor.image.wrapLeft", "Wrap left"]
|
|
2081
|
+
},
|
|
2082
|
+
{
|
|
2083
|
+
id: "wysiwyg-img-wrap-right",
|
|
2084
|
+
icon: /* @__PURE__ */ t(Ki, {}),
|
|
2085
|
+
label: ["editor.image.wrapRight", "Wrap right"]
|
|
2086
|
+
}
|
|
2087
|
+
], al = [
|
|
2088
|
+
{
|
|
2089
|
+
id: "wysiwyg-img-align-left",
|
|
2090
|
+
icon: /* @__PURE__ */ t(ko, {}),
|
|
2091
|
+
label: ["editor.image.alignLeft", "Align left"]
|
|
2092
|
+
},
|
|
2093
|
+
{
|
|
2094
|
+
id: "wysiwyg-img-align-center",
|
|
2095
|
+
icon: /* @__PURE__ */ t(yo, {}),
|
|
2096
|
+
label: ["editor.image.alignCenter", "Align centre"]
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
id: "wysiwyg-img-align-right",
|
|
2100
|
+
icon: /* @__PURE__ */ t(wo, {}),
|
|
2101
|
+
label: ["editor.image.alignRight", "Align right"]
|
|
2102
|
+
}
|
|
2103
|
+
], sl = [
|
|
2104
|
+
{
|
|
2105
|
+
id: "tl",
|
|
2106
|
+
pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
|
|
2107
|
+
cursor: "ds:cursor-nwse-resize",
|
|
2108
|
+
sign: -1,
|
|
2109
|
+
labelKey: "editor.image.resizeTopStart",
|
|
2110
|
+
labelFallback: "Resize image, top-start corner"
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
id: "tr",
|
|
2114
|
+
pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
|
|
2115
|
+
cursor: "ds:cursor-nesw-resize",
|
|
2116
|
+
sign: 1,
|
|
2117
|
+
labelKey: "editor.image.resizeTopEnd",
|
|
2118
|
+
labelFallback: "Resize image, top-end corner"
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
id: "bl",
|
|
2122
|
+
pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
|
|
2123
|
+
cursor: "ds:cursor-nesw-resize",
|
|
2124
|
+
sign: -1,
|
|
2125
|
+
labelKey: "editor.image.resizeBottomStart",
|
|
2126
|
+
labelFallback: "Resize image, bottom-start corner"
|
|
2127
|
+
},
|
|
2128
|
+
{
|
|
2129
|
+
id: "br",
|
|
2130
|
+
pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
|
|
2131
|
+
cursor: "ds:cursor-nwse-resize",
|
|
2132
|
+
sign: 1,
|
|
2133
|
+
labelKey: "editor.image.resizeBottomEnd",
|
|
2134
|
+
labelFallback: "Resize image, bottom-end corner"
|
|
2135
|
+
}
|
|
2136
|
+
], ll = [
|
|
2137
|
+
"ds:absolute ds:z-20 ds:pointer-events-none",
|
|
2138
|
+
"ds:[inset-block-start:var(--rte-img-top)] ds:[inset-inline-start:var(--rte-img-start)]",
|
|
2139
|
+
"ds:[inline-size:var(--rte-img-width)] ds:[block-size:var(--rte-img-height)]",
|
|
2140
|
+
"ds:rounded-[var(--radius-2xs)]",
|
|
2141
|
+
"ds:[outline-style:solid] ds:[outline-width:var(--border-width-md)]",
|
|
2142
|
+
"ds:[outline-color:var(--accent)] ds:[outline-offset:var(--focus-ring-offset)]"
|
|
2143
|
+
].join(" "), cl = [
|
|
2144
|
+
"ds:absolute ds:pointer-events-auto ds:touch-none",
|
|
2145
|
+
"ds:[inline-size:var(--spacing-md)] ds:[block-size:var(--spacing-md)]",
|
|
2146
|
+
"ds:rounded-[var(--radius-2xs)] ds:shadow-[var(--shadow-sm)]",
|
|
2147
|
+
"ds:bg-[var(--accent)] ds:border ds:border-[color:var(--background)]",
|
|
2148
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
2149
|
+
"ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)]",
|
|
2150
|
+
"ds:focus-visible:[outline-offset:var(--focus-ring-offset)]",
|
|
2151
|
+
"ds:forced-colors:bg-[CanvasText]"
|
|
2152
|
+
].join(" "), dl = [
|
|
2153
|
+
"ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
|
|
2154
|
+
"ds:[inset-block-start:var(--rte-img-bar-top)] ds:[inset-inline-start:var(--rte-img-center)]",
|
|
2155
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
2156
|
+
"ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
|
|
2157
|
+
].join(" ");
|
|
2158
|
+
function ul({
|
|
2159
|
+
areaRef: n,
|
|
2160
|
+
activeImageEl: i,
|
|
2161
|
+
applyImageClass: s,
|
|
2162
|
+
setImageWidth: l
|
|
2163
|
+
}) {
|
|
2164
|
+
const { t: f } = de("ui"), [y, w] = A(null), g = k(null);
|
|
2165
|
+
$(() => {
|
|
2166
|
+
if (!i || typeof window > "u") {
|
|
2167
|
+
w(null);
|
|
2168
|
+
return;
|
|
2169
|
+
}
|
|
2170
|
+
const h = () => {
|
|
2171
|
+
const F = n.current;
|
|
2172
|
+
if (!F) {
|
|
2173
|
+
w(null);
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
const ee = F.getBoundingClientRect(), j = i.getBoundingClientRect(), V = getComputedStyle(F).direction === "rtl", X = j.top - ee.top, M = V ? ee.right - j.right : j.left - ee.left, Ee = M + j.width / 2, ne = Math.max(0, X - 44);
|
|
2177
|
+
w({
|
|
2178
|
+
top: X,
|
|
2179
|
+
start: Math.max(0, M),
|
|
2180
|
+
width: j.width,
|
|
2181
|
+
height: j.height,
|
|
2182
|
+
center: Math.max(0, Ee),
|
|
2183
|
+
barTop: ne,
|
|
2184
|
+
pct: nl(i),
|
|
2185
|
+
rtl: V
|
|
2186
|
+
});
|
|
2187
|
+
};
|
|
2188
|
+
h();
|
|
2189
|
+
const m = new ResizeObserver(h);
|
|
2190
|
+
m.observe(i);
|
|
2191
|
+
const v = n.current;
|
|
2192
|
+
v && m.observe(v);
|
|
2193
|
+
const B = i.closest(".redactor-in");
|
|
2194
|
+
let D = null;
|
|
2195
|
+
return B && (D = new MutationObserver(h), D.observe(B, {
|
|
2196
|
+
subtree: !0,
|
|
2197
|
+
childList: !0,
|
|
2198
|
+
characterData: !0,
|
|
2199
|
+
attributes: !0,
|
|
2200
|
+
attributeFilter: ["class", "style", "width", "height", "src"]
|
|
2201
|
+
})), window.addEventListener("scroll", h, !0), window.addEventListener("resize", h), () => {
|
|
2202
|
+
m.disconnect(), D == null || D.disconnect(), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", h);
|
|
2203
|
+
};
|
|
2204
|
+
}, [i, n]);
|
|
2205
|
+
const b = x(
|
|
2206
|
+
(h) => (m) => {
|
|
2207
|
+
!m.isPrimary || !y || (m.preventDefault(), m.currentTarget.setPointerCapture(m.pointerId), g.current = {
|
|
2208
|
+
pointerId: m.pointerId,
|
|
2209
|
+
startX: m.clientX,
|
|
2210
|
+
startPct: y.pct,
|
|
2211
|
+
sign: h.sign * (y.rtl ? -1 : 1)
|
|
2212
|
+
});
|
|
2213
|
+
},
|
|
2214
|
+
[y]
|
|
2215
|
+
), p = x(
|
|
2216
|
+
(h) => {
|
|
2217
|
+
const m = g.current;
|
|
2218
|
+
if (!m || h.pointerId !== m.pointerId || !i) return;
|
|
2219
|
+
const v = i.closest(".redactor-in"), B = v instanceof HTMLElement ? v.clientWidth : 0;
|
|
2220
|
+
if (B <= 0) return;
|
|
2221
|
+
const D = m.sign * (h.clientX - m.startX) / B * 100;
|
|
2222
|
+
l(lo(m.startPct + D));
|
|
2223
|
+
},
|
|
2224
|
+
[i, l]
|
|
2225
|
+
), N = x(
|
|
2226
|
+
(h) => {
|
|
2227
|
+
const m = g.current;
|
|
2228
|
+
!m || h.pointerId !== m.pointerId || (h.currentTarget.releasePointerCapture(h.pointerId), g.current = null);
|
|
2229
|
+
},
|
|
2230
|
+
[]
|
|
2231
|
+
), E = x(
|
|
2232
|
+
(h) => {
|
|
2233
|
+
if (!y) return;
|
|
2234
|
+
let m = null;
|
|
2235
|
+
const v = h.shiftKey ? ol : rl;
|
|
2236
|
+
switch (h.key) {
|
|
2237
|
+
// Up / right always grow; down / left always shrink — independent of
|
|
2238
|
+
// which corner has focus, so the gesture reads the same everywhere.
|
|
2239
|
+
case "ArrowRight":
|
|
2240
|
+
case "ArrowUp":
|
|
2241
|
+
m = y.pct + v;
|
|
2242
|
+
break;
|
|
2243
|
+
case "ArrowLeft":
|
|
2244
|
+
case "ArrowDown":
|
|
2245
|
+
m = y.pct - v;
|
|
2246
|
+
break;
|
|
2247
|
+
case "Home":
|
|
2248
|
+
m = Jn;
|
|
2249
|
+
break;
|
|
2250
|
+
case "End":
|
|
2251
|
+
m = Pt;
|
|
2252
|
+
break;
|
|
2253
|
+
default:
|
|
2254
|
+
return;
|
|
2255
|
+
}
|
|
2256
|
+
h.preventDefault(), l(lo(m));
|
|
2257
|
+
},
|
|
2258
|
+
[y, l]
|
|
2259
|
+
);
|
|
2260
|
+
if (!i || !y) return null;
|
|
2261
|
+
const _ = so(i, Yn), I = so(i, Eo), Z = f("editor.image.widthAnnounce", {
|
|
2262
|
+
width: y.pct,
|
|
2263
|
+
defaultValue: "{{width}} percent"
|
|
2264
|
+
});
|
|
2265
|
+
return /* @__PURE__ */ C(Ze, { children: [
|
|
2266
|
+
/* @__PURE__ */ t(
|
|
2267
|
+
"div",
|
|
2268
|
+
{
|
|
2269
|
+
className: ll,
|
|
2270
|
+
style: {
|
|
2271
|
+
"--rte-img-top": `${y.top}px`,
|
|
2272
|
+
"--rte-img-start": `${y.start}px`,
|
|
2273
|
+
"--rte-img-width": `${y.width}px`,
|
|
2274
|
+
"--rte-img-height": `${y.height}px`
|
|
2275
|
+
},
|
|
2276
|
+
children: sl.map((h) => /* @__PURE__ */ t(
|
|
2277
|
+
"div",
|
|
2278
|
+
{
|
|
2279
|
+
role: "slider",
|
|
2280
|
+
tabIndex: 0,
|
|
2281
|
+
"aria-label": f(h.labelKey, h.labelFallback),
|
|
2282
|
+
"aria-orientation": "horizontal",
|
|
2283
|
+
"aria-valuemin": Jn,
|
|
2284
|
+
"aria-valuemax": Pt,
|
|
2285
|
+
"aria-valuenow": y.pct,
|
|
2286
|
+
"aria-valuetext": Z,
|
|
2287
|
+
className: `${cl} ${h.pos} ${h.cursor}`,
|
|
2288
|
+
onPointerDown: b(h),
|
|
2289
|
+
onPointerMove: p,
|
|
2290
|
+
onPointerUp: N,
|
|
2291
|
+
onPointerCancel: N,
|
|
2292
|
+
onKeyDown: E
|
|
2293
|
+
},
|
|
2294
|
+
h.id
|
|
2295
|
+
))
|
|
2296
|
+
}
|
|
2297
|
+
),
|
|
2298
|
+
/* @__PURE__ */ t(nr, { children: /* @__PURE__ */ t(
|
|
2299
|
+
"div",
|
|
2300
|
+
{
|
|
2301
|
+
role: "group",
|
|
2302
|
+
"aria-label": f("editor.image.toolbar", "Image tools"),
|
|
2303
|
+
className: `${dl} ${y.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
|
|
2304
|
+
style: {
|
|
2305
|
+
"--rte-img-bar-top": `${y.barTop}px`,
|
|
2306
|
+
"--rte-img-center": `${y.center}px`
|
|
2307
|
+
},
|
|
2308
|
+
children: [il, al].map((h, m) => /* @__PURE__ */ C(Bt, { children: [
|
|
2309
|
+
m > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: bn }) : null,
|
|
2310
|
+
h.map((v) => {
|
|
2311
|
+
const B = m === 0 ? _ === v.id : I === v.id;
|
|
2312
|
+
return /* @__PURE__ */ t(
|
|
2313
|
+
te,
|
|
2314
|
+
{
|
|
2315
|
+
size: "sm",
|
|
2316
|
+
intent: "ghost",
|
|
2317
|
+
icon: v.icon,
|
|
2318
|
+
"aria-pressed": B,
|
|
2319
|
+
tooltip: f(v.label[0], v.label[1]),
|
|
2320
|
+
onMouseDown: (D) => D.preventDefault(),
|
|
2321
|
+
onClick: () => s(v.id)
|
|
2322
|
+
},
|
|
2323
|
+
v.id
|
|
2324
|
+
);
|
|
2325
|
+
})
|
|
2326
|
+
] }, m === 0 ? "flow" : "align"))
|
|
2327
|
+
}
|
|
2328
|
+
) })
|
|
2329
|
+
] });
|
|
2330
|
+
}
|
|
2331
|
+
function ml({
|
|
2332
|
+
templates: n,
|
|
2333
|
+
onPick: i,
|
|
2334
|
+
onManage: s,
|
|
2335
|
+
noteEmpty: l,
|
|
2336
|
+
onOpenChange: f,
|
|
2337
|
+
trigger: y,
|
|
2338
|
+
side: w = "top"
|
|
2339
|
+
}) {
|
|
2340
|
+
const { t: g } = de("ui"), b = Qe();
|
|
2341
|
+
return /* @__PURE__ */ C(U.Root, { onOpenChange: f, children: [
|
|
2342
|
+
/* @__PURE__ */ t(U.Trigger, { asChild: !0, children: y }),
|
|
2343
|
+
/* @__PURE__ */ C(U.Content, { side: w, align: "end", sideOffset: 8, children: [
|
|
2344
|
+
/* @__PURE__ */ t(U.Label, { children: n.length > 0 ? g("editor.ai.templatesGroup") : g("editor.ai.noTemplates") }),
|
|
2345
|
+
n.map((p) => /* @__PURE__ */ t(
|
|
2346
|
+
U.Item,
|
|
2347
|
+
{
|
|
2348
|
+
startIcon: /* @__PURE__ */ t(Un, {}),
|
|
2349
|
+
description: p.description || void 0,
|
|
2350
|
+
"aria-disabled": l || void 0,
|
|
2351
|
+
"aria-describedby": l ? b : void 0,
|
|
2352
|
+
className: "ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed",
|
|
2353
|
+
onSelect: (N) => {
|
|
2354
|
+
if (l) {
|
|
2355
|
+
N.preventDefault();
|
|
2356
|
+
return;
|
|
2357
|
+
}
|
|
2358
|
+
i(p);
|
|
2359
|
+
},
|
|
2360
|
+
children: p.name
|
|
2361
|
+
},
|
|
2362
|
+
p.id
|
|
2363
|
+
)),
|
|
2364
|
+
l && n.length > 0 ? /* @__PURE__ */ t(
|
|
2365
|
+
"p",
|
|
2366
|
+
{
|
|
2367
|
+
id: b,
|
|
2368
|
+
className: "ds:m-0 ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-[length:var(--font-size-xs)] ds:text-[color:var(--muted-foreground)]",
|
|
2369
|
+
children: g("editor.ai.templatesNoteEmpty")
|
|
2370
|
+
}
|
|
2371
|
+
) : null,
|
|
2372
|
+
s && n.length === 0 ? /* @__PURE__ */ t(
|
|
2373
|
+
U.Item,
|
|
2374
|
+
{
|
|
2375
|
+
startIcon: /* @__PURE__ */ t(Gi, {}),
|
|
2376
|
+
onSelect: () => s("create"),
|
|
2377
|
+
children: g("editor.ai.createFirstTemplate")
|
|
2378
|
+
}
|
|
2379
|
+
) : null,
|
|
2380
|
+
s && n.length > 0 ? /* @__PURE__ */ C(Ze, { children: [
|
|
2381
|
+
/* @__PURE__ */ t(U.Separator, {}),
|
|
2382
|
+
/* @__PURE__ */ t(
|
|
2383
|
+
U.Item,
|
|
2384
|
+
{
|
|
2385
|
+
startIcon: /* @__PURE__ */ t(Vi, {}),
|
|
2386
|
+
onSelect: () => s("list"),
|
|
2387
|
+
children: g("editor.ai.manageTemplates")
|
|
2388
|
+
}
|
|
2389
|
+
)
|
|
2390
|
+
] }) : null
|
|
2391
|
+
] })
|
|
2392
|
+
] });
|
|
2393
|
+
}
|
|
2394
|
+
const fl = [
|
|
2395
|
+
"ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
|
|
2396
|
+
"ds:[inset-block-start:var(--rte-sel-top)] ds:[inset-inline-start:var(--rte-sel-start)]",
|
|
2397
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
2398
|
+
"ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]",
|
|
2399
|
+
To
|
|
2400
|
+
].join(" "), hl = ["bold", "italic", "underline", "strike"];
|
|
2401
|
+
function gl({
|
|
2402
|
+
active: n,
|
|
2403
|
+
run: i,
|
|
2404
|
+
areaRef: s,
|
|
2405
|
+
getEditorRoot: l,
|
|
2406
|
+
suppressed: f = !1,
|
|
2407
|
+
holdOpen: y = !1,
|
|
2408
|
+
children: w
|
|
2409
|
+
}) {
|
|
2410
|
+
const { t: g } = de("ui"), b = k(null), [p, N] = A(null), E = k(y);
|
|
2411
|
+
return $(() => {
|
|
2412
|
+
E.current = y;
|
|
2413
|
+
}, [y]), $(() => {
|
|
2414
|
+
if (f || typeof window > "u") {
|
|
2415
|
+
N(null);
|
|
2416
|
+
return;
|
|
2417
|
+
}
|
|
2418
|
+
let _ = !1, I = 0, Z = !1, h = !1;
|
|
2419
|
+
const m = () => {
|
|
2420
|
+
Z = !1, N(null);
|
|
2421
|
+
}, v = () => {
|
|
2422
|
+
var ue;
|
|
2423
|
+
if (E.current || _) return;
|
|
2424
|
+
if (h) {
|
|
2425
|
+
m();
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2428
|
+
const V = s.current, X = l(), M = window.getSelection();
|
|
2429
|
+
if (!V || !X || !M || M.rangeCount === 0 || M.isCollapsed || !V.contains(document.activeElement)) {
|
|
2430
|
+
m();
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
const Ee = M.getRangeAt(0);
|
|
2434
|
+
if (!X.contains(Ee.commonAncestorContainer)) {
|
|
2435
|
+
m();
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
if (!Ee.toString().trim()) {
|
|
2439
|
+
m();
|
|
2440
|
+
return;
|
|
2441
|
+
}
|
|
2442
|
+
const ne = V.getBoundingClientRect(), ge = Ee.getBoundingClientRect(), J = getComputedStyle(V).direction === "rtl", ie = ge.top - ne.top - 48, pe = ie >= 0 ? ie : ge.bottom - ne.top + 8, z = ((ue = b.current) == null ? void 0 : ue.offsetWidth) ?? 0, ze = J ? ne.right - ge.right + ge.width / 2 : ge.left - ne.left + ge.width / 2, re = z / 2, Ie = Math.min(
|
|
2443
|
+
Math.max(ze, re),
|
|
2444
|
+
Math.max(re, ne.width - re)
|
|
2445
|
+
);
|
|
2446
|
+
N({ top: pe, start: Ie, rtl: J }), z === 0 && !Z && (Z = !0, I = requestAnimationFrame(v));
|
|
2447
|
+
}, B = () => {
|
|
2448
|
+
cancelAnimationFrame(I), I = requestAnimationFrame(v);
|
|
2449
|
+
}, D = (V) => {
|
|
2450
|
+
const X = l();
|
|
2451
|
+
X && V.target instanceof Node && X.contains(V.target) && (_ = !0, m());
|
|
2452
|
+
}, F = () => {
|
|
2453
|
+
_ && (_ = !1, B());
|
|
2454
|
+
}, ee = (V) => {
|
|
2455
|
+
if (V.key !== "Escape") return;
|
|
2456
|
+
const X = s.current;
|
|
2457
|
+
!X || !X.contains(document.activeElement) || (h = !0, m());
|
|
2458
|
+
}, j = () => {
|
|
2459
|
+
h = !1, B();
|
|
2460
|
+
};
|
|
2461
|
+
return document.addEventListener("selectionchange", j), document.addEventListener("focusin", B), document.addEventListener("keydown", ee, !0), document.addEventListener("pointerdown", D, !0), document.addEventListener("pointerup", F, !0), document.addEventListener("pointercancel", F, !0), window.addEventListener("scroll", B, !0), window.addEventListener("resize", B), B(), () => {
|
|
2462
|
+
cancelAnimationFrame(I), document.removeEventListener("selectionchange", j), document.removeEventListener("focusin", B), document.removeEventListener("keydown", ee, !0), document.removeEventListener("pointerdown", D, !0), document.removeEventListener("pointerup", F, !0), document.removeEventListener("pointercancel", F, !0), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", B);
|
|
2463
|
+
};
|
|
2464
|
+
}, [f, s, l]), f || !p ? null : /* @__PURE__ */ t(nr, { children: /* @__PURE__ */ C(
|
|
2465
|
+
"div",
|
|
2466
|
+
{
|
|
2467
|
+
ref: b,
|
|
2468
|
+
role: "group",
|
|
2469
|
+
"aria-label": g("editor.ai.selectionTools"),
|
|
2470
|
+
"data-component-part": "selection-toolbar",
|
|
2471
|
+
className: `${fl} ${p.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
|
|
2472
|
+
style: {
|
|
2473
|
+
"--rte-sel-top": `${p.top}px`,
|
|
2474
|
+
"--rte-sel-start": `${p.start}px`
|
|
2475
|
+
},
|
|
2476
|
+
children: [
|
|
2477
|
+
hl.map((_) => {
|
|
2478
|
+
const I = Ao[_];
|
|
2479
|
+
return /* @__PURE__ */ t(
|
|
2480
|
+
te,
|
|
2481
|
+
{
|
|
2482
|
+
size: "sm",
|
|
2483
|
+
intent: "ghost",
|
|
2484
|
+
icon: I.icon,
|
|
2485
|
+
tooltip: g(I.label[0], I.label[1]),
|
|
2486
|
+
"aria-pressed": I.toggle ? n.has(I.toggle) : void 0,
|
|
2487
|
+
onMouseDown: (Z) => Z.preventDefault(),
|
|
2488
|
+
onClick: () => i(...I.command)
|
|
2489
|
+
},
|
|
2490
|
+
_
|
|
2491
|
+
);
|
|
2492
|
+
}),
|
|
2493
|
+
w ? /* @__PURE__ */ C(Ze, { children: [
|
|
2494
|
+
/* @__PURE__ */ t("span", { "aria-hidden": "true", className: bn }),
|
|
2495
|
+
w
|
|
2496
|
+
] }) : null
|
|
2497
|
+
]
|
|
2498
|
+
}
|
|
2499
|
+
) });
|
|
2500
|
+
}
|
|
2501
|
+
function pl({
|
|
2502
|
+
run: n,
|
|
2503
|
+
active: i,
|
|
2504
|
+
preset: s,
|
|
2505
|
+
tools: l,
|
|
2506
|
+
insertHtml: f,
|
|
2507
|
+
insertTable: y,
|
|
2508
|
+
saveSelection: w,
|
|
2509
|
+
restoreSelection: g,
|
|
2510
|
+
getSelectedText: b,
|
|
2511
|
+
uploadImage: p,
|
|
2512
|
+
enableColor: N = !1,
|
|
2513
|
+
enableFontSize: E = !1,
|
|
2514
|
+
enableImage: _ = !1,
|
|
2515
|
+
enableTable: I = !1,
|
|
2516
|
+
showExtensions: Z = !1,
|
|
2517
|
+
extensionControl: h,
|
|
2518
|
+
variables: m,
|
|
2519
|
+
recentVariableTokens: v,
|
|
2520
|
+
insertVariable: B
|
|
2521
|
+
}) {
|
|
2522
|
+
const { t: D } = de("ui"), F = (K) => K.preventDefault(), ee = s === "custom" ? l ?? [] : Os[s], j = (K) => ee.includes(K), V = s !== "custom", X = j("fontSize") || V && E, M = j("color") || V && N, Ee = j("highlight") || V && N, ne = _ && (V || j("image")), ge = I && (V || j("table")), J = (K) => {
|
|
2523
|
+
if (!j(K)) return null;
|
|
2524
|
+
const W = Ao[K], ae = W.needs ? !W.needs.some((R) => i.has(R)) : !1;
|
|
2525
|
+
return /* @__PURE__ */ t(
|
|
2526
|
+
te,
|
|
2527
|
+
{
|
|
2528
|
+
size: "sm",
|
|
2529
|
+
intent: "ghost",
|
|
2530
|
+
icon: W.icon,
|
|
2531
|
+
"aria-label": D(W.label[0], W.label[1]),
|
|
2532
|
+
"aria-pressed": W.toggle ? i.has(W.toggle) : void 0,
|
|
2533
|
+
"aria-disabled": ae || void 0,
|
|
2534
|
+
onMouseDown: F,
|
|
2535
|
+
onClick: () => {
|
|
2536
|
+
ae || n(...W.command);
|
|
2537
|
+
}
|
|
2538
|
+
},
|
|
2539
|
+
W.id
|
|
2540
|
+
);
|
|
2541
|
+
}, ie = () => /* @__PURE__ */ t("span", { "aria-hidden": "true", className: bn }), pe = [], z = (K, W, ae) => {
|
|
2542
|
+
ae && pe.push({ id: W, group: K, node: ae });
|
|
2543
|
+
};
|
|
2544
|
+
z("history", "undo", J("undo")), z("history", "redo", J("redo")), z(
|
|
2545
|
+
"style",
|
|
2546
|
+
"format",
|
|
2547
|
+
j("format") ? /* @__PURE__ */ t(
|
|
2548
|
+
js,
|
|
2549
|
+
{
|
|
2550
|
+
run: n,
|
|
2551
|
+
active: i,
|
|
2552
|
+
full: s === "full" || s === "custom",
|
|
2553
|
+
onTriggerDown: F
|
|
2554
|
+
}
|
|
2555
|
+
) : null
|
|
2556
|
+
), z("inline", "bold", J("bold")), z("inline", "italic", J("italic")), z("inline", "underline", J("underline")), z("inline", "strike", J("strike")), z(
|
|
2557
|
+
"inline",
|
|
2558
|
+
"font-size",
|
|
2559
|
+
X ? /* @__PURE__ */ t(Ws, { run: n, onTriggerDown: F }) : null
|
|
2560
|
+
), z(
|
|
2561
|
+
"inline",
|
|
2562
|
+
"colour",
|
|
2563
|
+
M ? /* @__PURE__ */ t(
|
|
2564
|
+
Xs,
|
|
2565
|
+
{
|
|
2566
|
+
run: n,
|
|
2567
|
+
saveSelection: w,
|
|
2568
|
+
restoreSelection: g
|
|
2569
|
+
}
|
|
2570
|
+
) : null
|
|
2571
|
+
), z(
|
|
2572
|
+
"inline",
|
|
2573
|
+
"highlight",
|
|
2574
|
+
Ee ? /* @__PURE__ */ t(
|
|
2575
|
+
Us,
|
|
2576
|
+
{
|
|
2577
|
+
run: n,
|
|
2578
|
+
saveSelection: w,
|
|
2579
|
+
restoreSelection: g
|
|
2580
|
+
}
|
|
2581
|
+
) : null
|
|
2582
|
+
), z(
|
|
2583
|
+
"align",
|
|
2584
|
+
"align",
|
|
2585
|
+
j("align") ? /* @__PURE__ */ t(Gs, { run: n, active: i, onTriggerDown: F }) : null
|
|
2586
|
+
), z("lists", "ul", J("ul")), z("lists", "ol", J("ol")), z("lists", "outdent", J("outdent")), z("lists", "indent", J("indent")), z(
|
|
2587
|
+
"insert",
|
|
2588
|
+
"link",
|
|
2589
|
+
j("link") ? /* @__PURE__ */ t(
|
|
2590
|
+
Vs,
|
|
2591
|
+
{
|
|
2592
|
+
insertHtml: f,
|
|
2593
|
+
saveSelection: w,
|
|
2594
|
+
restoreSelection: g,
|
|
2595
|
+
getSelectedText: b
|
|
2596
|
+
}
|
|
2597
|
+
) : null
|
|
2598
|
+
), z(
|
|
2599
|
+
"insert",
|
|
2600
|
+
"image",
|
|
2601
|
+
ne ? /* @__PURE__ */ t(
|
|
2602
|
+
Ks,
|
|
2603
|
+
{
|
|
2604
|
+
insertHtml: f,
|
|
2605
|
+
saveSelection: w,
|
|
2606
|
+
restoreSelection: g,
|
|
2607
|
+
uploadImage: p
|
|
2608
|
+
}
|
|
2609
|
+
) : null
|
|
2610
|
+
), z(
|
|
2611
|
+
"insert",
|
|
2612
|
+
"table",
|
|
2613
|
+
ge ? /* @__PURE__ */ t(Qs, { run: n, insertTable: y, active: i }) : null
|
|
2614
|
+
), z("insert", "line", J("line")), z(
|
|
2615
|
+
"insert",
|
|
2616
|
+
"variables",
|
|
2617
|
+
m && m.length > 0 && B ? /* @__PURE__ */ t(
|
|
2618
|
+
Fs,
|
|
2619
|
+
{
|
|
2620
|
+
variables: m,
|
|
2621
|
+
recentVariableTokens: v,
|
|
2622
|
+
insertVariable: B,
|
|
2623
|
+
saveSelection: w
|
|
2624
|
+
}
|
|
2625
|
+
) : null
|
|
2626
|
+
), z(
|
|
2627
|
+
"extensions",
|
|
2628
|
+
"extensions",
|
|
2629
|
+
h || (Z ? /* @__PURE__ */ t(
|
|
2630
|
+
te,
|
|
2631
|
+
{
|
|
2632
|
+
size: "sm",
|
|
2633
|
+
intent: "ghost",
|
|
2634
|
+
icon: /* @__PURE__ */ t(Zn, {}),
|
|
2635
|
+
"aria-label": D("editor.extensions", "Editor extensions"),
|
|
2636
|
+
disabled: !0,
|
|
2637
|
+
onMouseDown: F
|
|
2638
|
+
}
|
|
2639
|
+
) : null)
|
|
2640
|
+
);
|
|
2641
|
+
const [ze, re] = A(Number.POSITIVE_INFINITY), Ie = k(null), ue = k(/* @__PURE__ */ new Map()), Re = pe.map((K) => K.id).join(" "), Pe = k(Re);
|
|
2642
|
+
Pe.current = Re;
|
|
2643
|
+
const ve = x(() => {
|
|
2644
|
+
const K = Ie.current;
|
|
2645
|
+
if (!K) return;
|
|
2646
|
+
const W = K.clientWidth;
|
|
2647
|
+
if (W <= 0) return;
|
|
2648
|
+
K.querySelectorAll(":scope > [data-toolbar-item]").forEach((q) => {
|
|
2649
|
+
ue.current.set(q.dataset.toolbarItem, q.offsetWidth);
|
|
2650
|
+
});
|
|
2651
|
+
const ae = Pe.current ? Pe.current.split(" ") : [];
|
|
2652
|
+
if (ae.some((q) => !ue.current.has(q))) {
|
|
2653
|
+
re(Number.POSITIVE_INFINITY);
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
const R = Number.parseFloat(getComputedStyle(K).columnGap) || 0, S = ae.map((q) => ue.current.get(q) ?? 0);
|
|
2657
|
+
if (S.reduce((q, Be) => q + Be, 0) + R * Math.max(0, ae.length - 1) <= W) {
|
|
2658
|
+
re(ae.length);
|
|
2659
|
+
return;
|
|
2660
|
+
}
|
|
2661
|
+
let oe = ue.current.get(io) ?? Ps, se = 0;
|
|
2662
|
+
for (const q of S) {
|
|
2663
|
+
if (oe + R + q > W) break;
|
|
2664
|
+
oe += R + q, se += 1;
|
|
2665
|
+
}
|
|
2666
|
+
re(se);
|
|
2667
|
+
}, []);
|
|
2668
|
+
po(ve, [ve, Re, ze]), $(() => {
|
|
2669
|
+
const K = Ie.current;
|
|
2670
|
+
if (!K || typeof ResizeObserver > "u") return;
|
|
2671
|
+
const W = new ResizeObserver(() => ve());
|
|
2672
|
+
return W.observe(K), () => W.disconnect();
|
|
2673
|
+
}, [ve]);
|
|
2674
|
+
const me = pe.slice(0, ze), Ye = pe.slice(ze), Je = (K, W) => W > 0 && K[W - 1].group !== K[W].group, H = "ds:inline-flex ds:shrink-0 ds:items-center ds:gap-[var(--spacing-xs)]";
|
|
2675
|
+
return (
|
|
2676
|
+
// Outer element is the query container + visual chrome; the flex row is an
|
|
2677
|
+
// inner child so `container-type` never lands on the flex parent (which
|
|
2678
|
+
// would blockify the inline controls).
|
|
2679
|
+
/* @__PURE__ */ t("div", { className: Ds(), "data-component": "editor-toolbar", children: /* @__PURE__ */ C(
|
|
2680
|
+
"div",
|
|
2681
|
+
{
|
|
2682
|
+
ref: Ie,
|
|
2683
|
+
role: "group",
|
|
2684
|
+
"aria-label": D("editor.toolbarLabel"),
|
|
2685
|
+
className: qs,
|
|
2686
|
+
children: [
|
|
2687
|
+
me.map((K, W) => /* @__PURE__ */ C(
|
|
2688
|
+
"span",
|
|
2689
|
+
{
|
|
2690
|
+
"data-toolbar-item": K.id,
|
|
2691
|
+
className: H,
|
|
2692
|
+
children: [
|
|
2693
|
+
Je(me, W) ? /* @__PURE__ */ t(ie, {}) : null,
|
|
2694
|
+
K.node
|
|
2695
|
+
]
|
|
2696
|
+
},
|
|
2697
|
+
K.id
|
|
2698
|
+
)),
|
|
2699
|
+
Ye.length > 0 ? /* @__PURE__ */ C("span", { "data-toolbar-item": io, className: H, children: [
|
|
2700
|
+
me.length > 0 ? /* @__PURE__ */ t(ie, {}) : null,
|
|
2701
|
+
/* @__PURE__ */ C(fe, { children: [
|
|
2702
|
+
/* @__PURE__ */ t(fe.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2703
|
+
te,
|
|
2704
|
+
{
|
|
2705
|
+
size: "sm",
|
|
2706
|
+
intent: "ghost",
|
|
2707
|
+
icon: /* @__PURE__ */ t(ji, {}),
|
|
2708
|
+
"aria-label": D("editor.more", "More options"),
|
|
2709
|
+
onMouseDown: F
|
|
2710
|
+
}
|
|
2711
|
+
) }),
|
|
2712
|
+
/* @__PURE__ */ t(
|
|
2713
|
+
fe.Content,
|
|
2714
|
+
{
|
|
2715
|
+
side: "bottom",
|
|
2716
|
+
align: "end",
|
|
2717
|
+
"aria-label": D("editor.more", "More options"),
|
|
2718
|
+
children: /* @__PURE__ */ t("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: Ye.map((K, W) => /* @__PURE__ */ C(Bt, { children: [
|
|
2719
|
+
Je(Ye, W) ? /* @__PURE__ */ t(ie, {}) : null,
|
|
2720
|
+
K.node
|
|
2721
|
+
] }, K.id)) })
|
|
2722
|
+
}
|
|
2723
|
+
)
|
|
2724
|
+
] })
|
|
2725
|
+
] }) : null
|
|
2726
|
+
]
|
|
2727
|
+
}
|
|
2728
|
+
) })
|
|
2729
|
+
);
|
|
2730
|
+
}
|
|
2731
|
+
function He(n) {
|
|
2732
|
+
return Ai(n, "rich-text");
|
|
2733
|
+
}
|
|
2734
|
+
function fn(n = "") {
|
|
2735
|
+
const i = String(n).trim();
|
|
2736
|
+
if (i === "" || i === "<p><br></p>" || i === "<p> </p>")
|
|
2737
|
+
return "";
|
|
2738
|
+
const s = i.replace(/<br\s*\/?>/gi, "").replace(/ /gi, "").replace(/<[^>]+>/g, "").trim();
|
|
2739
|
+
return s === "" && /<img\b[^>]*>/i.test(i) ? i : s === "" ? "" : i;
|
|
2740
|
+
}
|
|
2741
|
+
function co(n) {
|
|
2742
|
+
return n.replace(
|
|
2743
|
+
/<img(?![^>]*\sloading=)([^>]*)>/gi,
|
|
2744
|
+
'<img loading="lazy"$1>'
|
|
2745
|
+
);
|
|
2746
|
+
}
|
|
2747
|
+
const bl = Qn.join(", "), vl = 10, Vn = /^[A-Za-z0-9_]+$/, Mo = /\[\[([A-Za-z0-9_]+)\]\]/g, er = "rte-variable-invalid", yl = new RegExp(
|
|
2748
|
+
`\\s*\\b${er}\\b`,
|
|
2749
|
+
"g"
|
|
2750
|
+
);
|
|
2751
|
+
function uo(n) {
|
|
2752
|
+
const i = n.includes("data-rte-interim") ? n.replace(/<span\b[^>]*\bdata-rte-interim\b[^>]*>[^<]*<\/span>/g, "") : n;
|
|
2753
|
+
return i.includes('data-redactor-type="variable"') ? i.replace(
|
|
2754
|
+
/<span\b[^>]*data-redactor-type="variable"[^>]*>/g,
|
|
2755
|
+
(s) => s.replace(/\s(?:data-label|title)="[^"]*"/g, "").replace(yl, "").replace(/\sclass=""/g, "")
|
|
2756
|
+
) : i;
|
|
2757
|
+
}
|
|
2758
|
+
function wl(n) {
|
|
2759
|
+
const i = n.replace(/<[^>]*>/g, " ");
|
|
2760
|
+
return Array.from(i.matchAll(Mo), (s) => s[1]);
|
|
2761
|
+
}
|
|
2762
|
+
function mo(n) {
|
|
2763
|
+
return typeof n == "object" && n !== null && "name" in n && n.name === "AiCreditsExhaustedError";
|
|
2764
|
+
}
|
|
2765
|
+
function kl(n) {
|
|
2766
|
+
return typeof n == "object" && n !== null && "name" in n && n.name === "AbortError";
|
|
2767
|
+
}
|
|
2768
|
+
function xl(n) {
|
|
2769
|
+
const i = document.createElement("template");
|
|
2770
|
+
return i.content.appendChild(n), i.innerHTML;
|
|
2771
|
+
}
|
|
2772
|
+
function fo(n) {
|
|
2773
|
+
const i = document.createElement("template");
|
|
2774
|
+
return i.innerHTML = n, (i.content.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
2775
|
+
}
|
|
2776
|
+
function ho(n) {
|
|
2777
|
+
return n.replace(/<[^>]*>/g, "").replace(/ /gi, "").replace(/[\s\u200B\uFEFF]+/g, "");
|
|
2778
|
+
}
|
|
2779
|
+
function Cl(n) {
|
|
2780
|
+
const i = window.getSelection();
|
|
2781
|
+
if (!i || i.rangeCount === 0) return null;
|
|
2782
|
+
const s = i.getRangeAt(0);
|
|
2783
|
+
if (!n.contains(s.startContainer)) return null;
|
|
2784
|
+
const l = document.createRange();
|
|
2785
|
+
return l.selectNodeContents(n), l.setEnd(s.startContainer, s.startOffset), l.toString().length;
|
|
2786
|
+
}
|
|
2787
|
+
function Al(n, i) {
|
|
2788
|
+
var y;
|
|
2789
|
+
const s = window.getSelection();
|
|
2790
|
+
if (!s) return;
|
|
2791
|
+
const l = document.createTreeWalker(n, NodeFilter.SHOW_TEXT);
|
|
2792
|
+
let f = 0;
|
|
2793
|
+
for (let w = l.nextNode(); w; w = l.nextNode()) {
|
|
2794
|
+
const g = w;
|
|
2795
|
+
if (f + g.data.length >= i) {
|
|
2796
|
+
const b = document.createRange(), p = (y = g.parentElement) == null ? void 0 : y.closest(
|
|
2797
|
+
'[data-redactor-type="variable"]'
|
|
2798
|
+
);
|
|
2799
|
+
p ? b.setStartAfter(p) : b.setStart(g, i - f), b.collapse(!0), s.removeAllRanges(), s.addRange(b);
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
f += g.data.length;
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
function go(n) {
|
|
2806
|
+
return `<span data-redactor-type="variable">[[${n}]]</span>`;
|
|
2807
|
+
}
|
|
2808
|
+
function Tt(n, i) {
|
|
2809
|
+
var w;
|
|
2810
|
+
if (i.size === 0 || !n.includes("[[") || typeof DOMParser > "u")
|
|
2811
|
+
return n;
|
|
2812
|
+
const s = new DOMParser().parseFromString(
|
|
2813
|
+
`<body>${n}</body>`,
|
|
2814
|
+
"text/html"
|
|
2815
|
+
), l = s.createTreeWalker(s.body, NodeFilter.SHOW_TEXT), f = [];
|
|
2816
|
+
for (let g = l.nextNode(); g; g = l.nextNode()) {
|
|
2817
|
+
const b = g;
|
|
2818
|
+
(w = b.parentElement) != null && w.closest('[data-redactor-type="variable"]') || b.data.includes("[[") && f.push(b);
|
|
2819
|
+
}
|
|
2820
|
+
let y = !1;
|
|
2821
|
+
for (const g of f) {
|
|
2822
|
+
const b = s.createDocumentFragment();
|
|
2823
|
+
let p = 0;
|
|
2824
|
+
for (const N of g.data.matchAll(Mo)) {
|
|
2825
|
+
const E = i.get(N[1].toLowerCase());
|
|
2826
|
+
if (!E || N.index === void 0) continue;
|
|
2827
|
+
b.append(g.data.slice(p, N.index));
|
|
2828
|
+
const _ = s.createElement("span");
|
|
2829
|
+
_.setAttribute("data-redactor-type", "variable"), _.textContent = `[[${E}]]`, b.append(_), p = N.index + N[0].length;
|
|
2830
|
+
}
|
|
2831
|
+
p !== 0 && (b.append(g.data.slice(p)), g.replaceWith(b), y = !0);
|
|
2832
|
+
}
|
|
2833
|
+
return y ? s.body.innerHTML : n;
|
|
2834
|
+
}
|
|
2835
|
+
function Nl(n) {
|
|
2836
|
+
if (!n || typeof n != "object") return;
|
|
2837
|
+
const i = n, s = (l) => {
|
|
2838
|
+
if (l && typeof l == "object" && "url" in l) {
|
|
2839
|
+
const f = l.url;
|
|
2840
|
+
return typeof f == "string" ? f : void 0;
|
|
2841
|
+
}
|
|
2842
|
+
};
|
|
2843
|
+
return typeof i.url == "string" ? i.url : s(i.file) ?? s(i.data) ?? Object.values(i).map(s).find(Boolean);
|
|
2844
|
+
}
|
|
2845
|
+
function Tl(n) {
|
|
2846
|
+
if (n) return n;
|
|
2847
|
+
if (typeof window > "u") return null;
|
|
2848
|
+
const i = window;
|
|
2849
|
+
return i.$R ?? i.Redactor ?? null;
|
|
2850
|
+
}
|
|
2851
|
+
const El = {
|
|
2852
|
+
bold: ["module.inline.format", { tag: "b" }],
|
|
2853
|
+
italic: ["module.inline.format", { tag: "i" }],
|
|
2854
|
+
strikethrough: ["module.inline.format", { tag: "del" }],
|
|
2855
|
+
bulletedList: ["module.list.toggle", "ul"],
|
|
2856
|
+
numberedList: ["module.list.toggle", "ol"],
|
|
2857
|
+
heading: ["module.block.format", { tag: "h2" }],
|
|
2858
|
+
quote: ["module.block.format", { tag: "blockquote" }],
|
|
2859
|
+
paragraph: ["module.block.format", { tag: "p" }]
|
|
2860
|
+
}, Ml = {
|
|
2861
|
+
zh: "zh_cn",
|
|
2862
|
+
pt: "pt_br"
|
|
2863
|
+
};
|
|
2864
|
+
function zl(n) {
|
|
2865
|
+
const i = n.split("-")[0];
|
|
2866
|
+
return Ml[i] ?? i ?? "en";
|
|
2867
|
+
}
|
|
2868
|
+
const Rl = Et(
|
|
2869
|
+
"redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
|
|
2870
|
+
), Sl = [
|
|
2871
|
+
"ds:absolute ds:z-30",
|
|
2872
|
+
"ds:[inset-inline-start:var(--rte-typeahead-x)] ds:[inset-block-start:var(--rte-typeahead-y)]"
|
|
2873
|
+
].join(" "), Ll = Et(
|
|
2874
|
+
[
|
|
2875
|
+
"ds:block ds:[inline-size:100%]",
|
|
2876
|
+
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--control-border)]",
|
|
2877
|
+
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
2878
|
+
"ds:shadow-[var(--shadow-md)]",
|
|
2879
|
+
"ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
|
|
2880
|
+
"ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
|
|
2881
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
2882
|
+
"ds:focus-visible:outline-solid",
|
|
2883
|
+
"ds:focus-visible:outline-[var(--ring)]",
|
|
2884
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
2885
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
2886
|
+
].join(" ")
|
|
2887
|
+
), _l = bo({ recording: !1 }), Il = bo({ recording: !0 });
|
|
2888
|
+
function hn(n, i) {
|
|
2889
|
+
return i ? { "aria-label": n } : { tooltip: n };
|
|
2890
|
+
}
|
|
2891
|
+
const zo = ["kit", "marketplace"];
|
|
2892
|
+
function Hl({
|
|
2893
|
+
groupedExtensions: n,
|
|
2894
|
+
showExtensionGroups: i,
|
|
2895
|
+
extensionPending: s,
|
|
2896
|
+
extensionSession: l,
|
|
2897
|
+
extensionError: f,
|
|
2898
|
+
openExtension: y,
|
|
2899
|
+
closeExtension: w,
|
|
2900
|
+
saveSelection: g,
|
|
2901
|
+
closeSignal: b,
|
|
2902
|
+
restoreFocusOnCloseRef: p
|
|
2903
|
+
}) {
|
|
2904
|
+
const { t: N } = de("ui"), [E, _] = A(!1), I = k(null), Z = k(!1);
|
|
2905
|
+
return $(() => {
|
|
2906
|
+
_(!1);
|
|
2907
|
+
}, [b]), $(() => {
|
|
2908
|
+
Z.current && !l && (Z.current = !1, p.current && window.requestAnimationFrame(() => {
|
|
2909
|
+
var h;
|
|
2910
|
+
return (h = I.current) == null ? void 0 : h.focus();
|
|
2911
|
+
}));
|
|
2912
|
+
}, [l, p]), /* @__PURE__ */ C(
|
|
2913
|
+
U.Root,
|
|
2914
|
+
{
|
|
2915
|
+
open: E,
|
|
2916
|
+
onOpenChange: (h) => {
|
|
2917
|
+
h ? (g(), _(!0)) : (_(!1), s && w());
|
|
2918
|
+
},
|
|
2919
|
+
children: [
|
|
2920
|
+
/* @__PURE__ */ t(U.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2921
|
+
te,
|
|
2922
|
+
{
|
|
2923
|
+
ref: I,
|
|
2924
|
+
"data-component-part": "extensions-trigger",
|
|
2925
|
+
size: "sm",
|
|
2926
|
+
intent: "ghost",
|
|
2927
|
+
icon: /* @__PURE__ */ t(Zn, {}),
|
|
2928
|
+
"aria-label": N("editor.extensions"),
|
|
2929
|
+
onPointerDown: () => g()
|
|
2930
|
+
}
|
|
2931
|
+
) }),
|
|
2932
|
+
/* @__PURE__ */ t(
|
|
2933
|
+
U.Content,
|
|
2934
|
+
{
|
|
2935
|
+
align: "end",
|
|
2936
|
+
onCloseAutoFocus: (h) => {
|
|
2937
|
+
(l == null ? void 0 : l.extension.kind) === "panel" && !f && h.preventDefault();
|
|
2938
|
+
},
|
|
2939
|
+
children: n.map(
|
|
2940
|
+
(h, m) => h.length > 0 ? /* @__PURE__ */ C(Bt, { children: [
|
|
2941
|
+
i ? /* @__PURE__ */ t(U.Label, { children: N(
|
|
2942
|
+
m === 0 ? "editor.extensionsKit" : "editor.extensionsMarketplace"
|
|
2943
|
+
) }) : null,
|
|
2944
|
+
h.map((v) => {
|
|
2945
|
+
var B;
|
|
2946
|
+
return /* @__PURE__ */ C(
|
|
2947
|
+
U.Item,
|
|
2948
|
+
{
|
|
2949
|
+
"data-extension-id": v.id,
|
|
2950
|
+
disabled: s && (l == null ? void 0 : l.extension.id) !== v.id,
|
|
2951
|
+
"aria-busy": s && (l == null ? void 0 : l.extension.id) === v.id || void 0,
|
|
2952
|
+
onSelect: (D) => {
|
|
2953
|
+
v.kind === "action" && D.preventDefault(), Z.current = !0, y(v);
|
|
2954
|
+
},
|
|
2955
|
+
children: [
|
|
2956
|
+
s && (l == null ? void 0 : l.extension.id) === v.id ? /* @__PURE__ */ t(tr, { size: "sm" }) : v.icon ?? /* @__PURE__ */ t(Zn, {}),
|
|
2957
|
+
/* @__PURE__ */ C("span", { className: "ds:flex ds:min-w-0 ds:flex-col ds:text-start", children: [
|
|
2958
|
+
/* @__PURE__ */ t("span", { children: Co(N, v.label) }),
|
|
2959
|
+
v.description ? /* @__PURE__ */ t("span", { className: "type-meta ds:text-muted-foreground", children: v.description }) : null,
|
|
2960
|
+
((B = v.source) == null ? void 0 : B.kind) === "marketplace" ? /* @__PURE__ */ C("span", { className: "type-meta ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-muted-foreground", children: [
|
|
2961
|
+
v.source.appIconUrl ? /* @__PURE__ */ t(
|
|
2962
|
+
"img",
|
|
2963
|
+
{
|
|
2964
|
+
src: v.source.appIconUrl,
|
|
2965
|
+
alt: "",
|
|
2966
|
+
className: "ds:size-[var(--spacing-md)]"
|
|
2967
|
+
}
|
|
2968
|
+
) : null,
|
|
2969
|
+
v.source.appName
|
|
2970
|
+
] }) : null
|
|
2971
|
+
] })
|
|
2972
|
+
]
|
|
2973
|
+
},
|
|
2974
|
+
v.id
|
|
2975
|
+
);
|
|
2976
|
+
})
|
|
2977
|
+
] }, zo[m]) : null
|
|
2978
|
+
)
|
|
2979
|
+
}
|
|
2980
|
+
)
|
|
2981
|
+
]
|
|
2982
|
+
}
|
|
2983
|
+
);
|
|
2984
|
+
}
|
|
2985
|
+
const $l = ki(
|
|
2986
|
+
({
|
|
2987
|
+
id: n,
|
|
2988
|
+
defaultValue: i,
|
|
2989
|
+
value: s,
|
|
2990
|
+
onChange: l,
|
|
2991
|
+
toolbar: f = "standard",
|
|
2992
|
+
placeholder: y,
|
|
2993
|
+
readOnly: w = !1,
|
|
2994
|
+
ariaLabel: g,
|
|
2995
|
+
minHeight: b,
|
|
2996
|
+
showExtensions: p,
|
|
2997
|
+
extensions: N,
|
|
2998
|
+
extensionContext: E,
|
|
2999
|
+
onExtensionRun: _,
|
|
3000
|
+
className: I,
|
|
3001
|
+
redactor: Z,
|
|
3002
|
+
options: h,
|
|
3003
|
+
plugins: m,
|
|
3004
|
+
tools: v,
|
|
3005
|
+
lang: B,
|
|
3006
|
+
imageUploadUrl: D,
|
|
3007
|
+
onUploadImage: F,
|
|
3008
|
+
onKeyDown: ee,
|
|
3009
|
+
onRequestAiDraft: j,
|
|
3010
|
+
aiDraftFormat: V = "html",
|
|
3011
|
+
aiPrivacyNotice: X,
|
|
3012
|
+
aiConsent: M,
|
|
3013
|
+
aiConsentHeadingLevel: Ee,
|
|
3014
|
+
onDictate: ne,
|
|
3015
|
+
onProofread: ge,
|
|
3016
|
+
onAutoFormat: J,
|
|
3017
|
+
aiTemplates: ie,
|
|
3018
|
+
onAiApplied: pe,
|
|
3019
|
+
aiSparkle: z = !0,
|
|
3020
|
+
selectionToolbar: ze,
|
|
3021
|
+
variables: re,
|
|
3022
|
+
recentVariableTokens: Ie,
|
|
3023
|
+
onVariableInserted: ue,
|
|
3024
|
+
validateVariable: Re,
|
|
3025
|
+
onVariableValidityChange: Pe,
|
|
3026
|
+
renderHelpMeWrite: ve,
|
|
3027
|
+
onAiCreditsExhausted: me,
|
|
3028
|
+
aiCreditsNotice: Ye
|
|
3029
|
+
}, Je) => {
|
|
3030
|
+
var Xr, Ur;
|
|
3031
|
+
const { t: H, i18n: K } = de("ui"), W = Qe(), ae = Ct(
|
|
3032
|
+
() => `rte-${W.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
3033
|
+
[W]
|
|
3034
|
+
), R = `#${ae}`, S = k(null), P = k(null), ce = k(null), oe = k(!1), se = k(w), q = k(null), Be = k(null), [xe, ir] = A(!1), ar = (m == null ? void 0 : m.includes("table")) ?? !1, sr = f === "full" || f === "custom" && ((v == null ? void 0 : v.includes("table")) ?? !1), [Ro, So] = A(!1), lr = ar || sr && Ro, Lo = ((m == null ? void 0 : m.includes("fontcolor")) ?? !1) || f === "full" || f === "custom" && ((v == null ? void 0 : v.includes("color")) ?? !1), [et, Xe] = A(!1), [Se, cr] = A(null), [vn, dr] = A(!1), [yn, wn] = A(!1), Mt = k(null), Ft = k(_);
|
|
3035
|
+
Ft.current = _;
|
|
3036
|
+
const tt = k(null), [_o, Io] = A(0), ur = k(!0), kn = x((e = !0) => {
|
|
3037
|
+
ur.current = e, Io((r) => r + 1);
|
|
3038
|
+
}, []), xn = x(() => {
|
|
3039
|
+
var e, r;
|
|
3040
|
+
(e = Mt.current) == null || e.abort(), Mt.current = null, (r = tt.current) == null || r.call(tt, { status: "aborted" }), cr(null), wn(!1), dr(!1);
|
|
3041
|
+
}, []), Fe = x(
|
|
3042
|
+
(e = !0) => {
|
|
3043
|
+
xn(), kn(e);
|
|
3044
|
+
},
|
|
3045
|
+
[xn, kn]
|
|
3046
|
+
);
|
|
3047
|
+
$(
|
|
3048
|
+
() => () => {
|
|
3049
|
+
var e, r;
|
|
3050
|
+
(e = Mt.current) == null || e.abort(), (r = tt.current) == null || r.call(tt, { status: "aborted" });
|
|
3051
|
+
},
|
|
3052
|
+
[]
|
|
3053
|
+
);
|
|
3054
|
+
const [Ho, $o] = A(""), [Oo, Do] = A(
|
|
3055
|
+
"document"
|
|
3056
|
+
), [mr, zt] = A(!1);
|
|
3057
|
+
$(() => {
|
|
3058
|
+
et || zt(!1);
|
|
3059
|
+
}, [et]);
|
|
3060
|
+
const Oe = k(me), Cn = k(ve), An = k(!!j);
|
|
3061
|
+
$(() => {
|
|
3062
|
+
Oe.current = me, Cn.current = ve, An.current = !!j;
|
|
3063
|
+
}, [me, ve, j]);
|
|
3064
|
+
const jt = k(null), Ce = Ct(
|
|
3065
|
+
() => new Map(
|
|
3066
|
+
(re ?? []).map((e) => e.token).filter((e) => Vn.test(e)).map((e) => [e.toLowerCase(), e])
|
|
3067
|
+
),
|
|
3068
|
+
[re]
|
|
3069
|
+
), fr = Ct(
|
|
3070
|
+
() => new Map(
|
|
3071
|
+
(re ?? []).map(
|
|
3072
|
+
(e) => [e.token.toLowerCase(), e.label]
|
|
3073
|
+
)
|
|
3074
|
+
),
|
|
3075
|
+
[re]
|
|
3076
|
+
), ft = k(Ce);
|
|
3077
|
+
$(() => {
|
|
3078
|
+
ft.current = Ce;
|
|
3079
|
+
}, [Ce]);
|
|
3080
|
+
const hr = Ct(
|
|
3081
|
+
() => (re ?? []).filter((e) => Vn.test(e.token)),
|
|
3082
|
+
[re]
|
|
3083
|
+
), Nn = k(Re);
|
|
3084
|
+
$(() => {
|
|
3085
|
+
Nn.current = Re;
|
|
3086
|
+
}, [Re]);
|
|
3087
|
+
const Tn = Re !== void 0, En = x(
|
|
3088
|
+
(e) => Tn && Nn.current ? Nn.current(e) : Ce.has(e.toLowerCase()),
|
|
3089
|
+
[Tn, Ce]
|
|
3090
|
+
), ht = Ce.size > 0 || Tn, [gt, gr] = A([]), nt = k(Pe);
|
|
3091
|
+
$(() => {
|
|
3092
|
+
nt.current = Pe;
|
|
3093
|
+
}, [Pe]);
|
|
3094
|
+
const je = k(() => {
|
|
3095
|
+
}), [Mn, qo] = A(
|
|
3096
|
+
() => /* @__PURE__ */ new Set()
|
|
3097
|
+
), Gt = k(null), [Po, Bo] = A(
|
|
3098
|
+
null
|
|
3099
|
+
), Vt = x((e) => {
|
|
3100
|
+
Gt.current = e, Bo(e);
|
|
3101
|
+
}, []), Rt = k(null), Kt = k(null), Ae = k(l), Wt = k(ee), zn = H("editor.visitLink"), pr = k(zn);
|
|
3102
|
+
$(() => {
|
|
3103
|
+
pr.current = zn;
|
|
3104
|
+
}, [zn]), $(() => {
|
|
3105
|
+
Ae.current = l, Wt.current = ee;
|
|
3106
|
+
}, [l, ee]);
|
|
3107
|
+
const Fo = k(
|
|
3108
|
+
(() => {
|
|
3109
|
+
const e = s ?? i ?? "";
|
|
3110
|
+
return e ? He(e) : "";
|
|
3111
|
+
})()
|
|
3112
|
+
), ye = x(() => {
|
|
3113
|
+
var r;
|
|
3114
|
+
const e = P.current;
|
|
3115
|
+
if (e)
|
|
3116
|
+
try {
|
|
3117
|
+
const o = e(R, "source.getCode");
|
|
3118
|
+
if (typeof o == "string") return uo(o);
|
|
3119
|
+
} catch {
|
|
3120
|
+
}
|
|
3121
|
+
return ((r = S.current) == null ? void 0 : r.value) ?? "";
|
|
3122
|
+
}, [R]);
|
|
3123
|
+
$(() => {
|
|
3124
|
+
je.current = () => {
|
|
3125
|
+
var o;
|
|
3126
|
+
if (!ht) {
|
|
3127
|
+
gr((a) => a.length ? [] : a);
|
|
3128
|
+
return;
|
|
3129
|
+
}
|
|
3130
|
+
const e = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in");
|
|
3131
|
+
e == null || e.querySelectorAll('[data-redactor-type="variable"]').forEach((a) => {
|
|
3132
|
+
const d = /^\[\[([A-Za-z0-9_]+)\]\]$/.exec(
|
|
3133
|
+
a.textContent ?? ""
|
|
3134
|
+
), c = !d || !En(d[1]);
|
|
3135
|
+
a.classList.contains(er) !== c && a.classList.toggle(er, c);
|
|
3136
|
+
const u = d ? fr.get(d[1].toLowerCase()) ?? d[1] : a.textContent ?? "";
|
|
3137
|
+
a.getAttribute("data-label") !== u && a.setAttribute("data-label", u);
|
|
3138
|
+
const T = a.textContent ?? "";
|
|
3139
|
+
a.getAttribute("title") !== T && a.setAttribute("title", T);
|
|
3140
|
+
});
|
|
3141
|
+
const r = Array.from(
|
|
3142
|
+
new Set(
|
|
3143
|
+
wl(ye()).filter(
|
|
3144
|
+
(a) => !En(a)
|
|
3145
|
+
)
|
|
3146
|
+
)
|
|
3147
|
+
);
|
|
3148
|
+
gr(
|
|
3149
|
+
(a) => a.length === r.length && a.every((d, c) => d === r[c]) ? a : r
|
|
3150
|
+
);
|
|
3151
|
+
}, je.current();
|
|
3152
|
+
}, [ht, En, fr, ye]), $(() => {
|
|
3153
|
+
var o;
|
|
3154
|
+
const r = ((o = q.current) == null ? void 0 : o.querySelector(".redactor-in")) ?? S.current;
|
|
3155
|
+
r && (gt.length > 0 ? (r.setAttribute("aria-invalid", "true"), r.setAttribute("aria-describedby", `${ae}-variables-error`)) : (r.removeAttribute("aria-invalid"), r.removeAttribute("aria-describedby")));
|
|
3156
|
+
}, [gt, ae, xe]);
|
|
3157
|
+
const Rn = k(!1);
|
|
3158
|
+
$(() => {
|
|
3159
|
+
var e, r;
|
|
3160
|
+
ht ? (Rn.current = !0, (e = nt.current) == null || e.call(nt, gt)) : Rn.current && (Rn.current = !1, (r = nt.current) == null || r.call(nt, []));
|
|
3161
|
+
}, [gt, ht]), $(() => {
|
|
3162
|
+
Re && je.current();
|
|
3163
|
+
}, [Re]);
|
|
3164
|
+
const we = x(
|
|
3165
|
+
(e, ...r) => {
|
|
3166
|
+
const o = P.current;
|
|
3167
|
+
if (!o) return !1;
|
|
3168
|
+
const a = se.current;
|
|
3169
|
+
if (a)
|
|
3170
|
+
try {
|
|
3171
|
+
o(R, "disableReadOnly");
|
|
3172
|
+
} catch {
|
|
3173
|
+
}
|
|
3174
|
+
try {
|
|
3175
|
+
return o(R, e, ...r), !0;
|
|
3176
|
+
} catch {
|
|
3177
|
+
return !1;
|
|
3178
|
+
} finally {
|
|
3179
|
+
if (a)
|
|
3180
|
+
try {
|
|
3181
|
+
o(R, "enableReadOnly");
|
|
3182
|
+
} catch {
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
},
|
|
3186
|
+
[R]
|
|
3187
|
+
), ke = x(
|
|
3188
|
+
(e, r) => {
|
|
3189
|
+
var G;
|
|
3190
|
+
const o = (r == null ? void 0 : r.asHtml) ?? !0, a = o ? He(e) : e;
|
|
3191
|
+
if (we(o ? "insertion.insertHtml" : "insertion.insertText", a)) return;
|
|
3192
|
+
const c = S.current;
|
|
3193
|
+
if (!c) return;
|
|
3194
|
+
const u = c.selectionStart ?? c.value.length, T = c.selectionEnd ?? c.value.length;
|
|
3195
|
+
c.value = c.value.slice(0, u) + a + c.value.slice(T);
|
|
3196
|
+
const L = u + a.length;
|
|
3197
|
+
try {
|
|
3198
|
+
c.setSelectionRange(L, L);
|
|
3199
|
+
} catch {
|
|
3200
|
+
}
|
|
3201
|
+
(G = Ae.current) == null || G.call(Ae, { html: He(c.value), markdown: "" });
|
|
3202
|
+
},
|
|
3203
|
+
[we]
|
|
3204
|
+
), Le = k(null), Ne = x(() => {
|
|
3205
|
+
var a;
|
|
3206
|
+
const e = (a = q.current) == null ? void 0 : a.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null, o = /* @__PURE__ */ new Set();
|
|
3207
|
+
if (e && r && r.anchorNode && e.contains(r.anchorNode) && typeof document.queryCommandState == "function") {
|
|
3208
|
+
r.rangeCount > 0 && (Le.current = r.getRangeAt(0).cloneRange());
|
|
3209
|
+
try {
|
|
3210
|
+
document.queryCommandState("bold") && o.add("bold"), document.queryCommandState("italic") && o.add("italic"), document.queryCommandState("underline") && o.add("underline"), document.queryCommandState("strikeThrough") && o.add("strike"), document.queryCommandState("insertUnorderedList") && o.add("ul"), document.queryCommandState("insertOrderedList") && o.add("ol");
|
|
3211
|
+
const d = String(
|
|
3212
|
+
document.queryCommandValue("formatBlock") || ""
|
|
3213
|
+
).toLowerCase();
|
|
3214
|
+
/^h[1-6]$/.test(d) ? (o.add("heading"), o.add(d)) : d === "blockquote" ? o.add("quote") : d === "pre" ? o.add("code") : o.add("paragraph");
|
|
3215
|
+
const c = r.anchorNode.nodeType === Node.TEXT_NODE ? r.anchorNode.parentElement : r.anchorNode;
|
|
3216
|
+
c && e.contains(c) && c.closest("table") && o.add("table");
|
|
3217
|
+
const u = c == null ? void 0 : c.closest(
|
|
3218
|
+
"p, div, blockquote, pre, h1, h2, h3, h4, h5, h6, li, td, th"
|
|
3219
|
+
);
|
|
3220
|
+
if (u && e.contains(u) && u !== e) {
|
|
3221
|
+
const T = getComputedStyle(u), L = T.direction === "rtl", G = T.textAlign.replace(/^-webkit-/, ""), Y = L ? "right" : "left", le = L ? "left" : "right", Q = ["left", "center", "right", "justify"].includes(G) ? G : G === "end" ? le : Y;
|
|
3222
|
+
o.add(`align-${Q}`);
|
|
3223
|
+
}
|
|
3224
|
+
} catch {
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
qo(
|
|
3228
|
+
(d) => d.size === o.size && [...o].every((c) => d.has(c)) ? d : o
|
|
3229
|
+
);
|
|
3230
|
+
}, []), rt = x(
|
|
3231
|
+
(e, ...r) => {
|
|
3232
|
+
we(e, ...r), typeof window < "u" ? window.requestAnimationFrame(() => Ne()) : Ne();
|
|
3233
|
+
},
|
|
3234
|
+
[we, Ne]
|
|
3235
|
+
);
|
|
3236
|
+
$(() => {
|
|
3237
|
+
const e = q.current;
|
|
3238
|
+
if (!e) return;
|
|
3239
|
+
const r = {
|
|
3240
|
+
b: ["module.inline.format", { tag: "b" }],
|
|
3241
|
+
i: ["module.inline.format", { tag: "i" }],
|
|
3242
|
+
u: ["module.inline.format", { tag: "u" }]
|
|
3243
|
+
}, o = (a) => {
|
|
3244
|
+
if (!(a.metaKey || a.ctrlKey) || a.altKey || a.shiftKey || a.isComposing) return;
|
|
3245
|
+
const d = r[a.key.toLowerCase()];
|
|
3246
|
+
if (!d) return;
|
|
3247
|
+
const c = e.querySelector(".redactor-in");
|
|
3248
|
+
!c || !(a.target instanceof Node) || !c.contains(a.target) || se.current || (a.preventDefault(), a.stopImmediatePropagation(), rt(...d));
|
|
3249
|
+
};
|
|
3250
|
+
return e.addEventListener("keydown", o, !0), () => e.removeEventListener("keydown", o, !0);
|
|
3251
|
+
}, [rt]), $(() => {
|
|
3252
|
+
const e = q.current;
|
|
3253
|
+
if (!e) return;
|
|
3254
|
+
let r;
|
|
3255
|
+
const o = (d) => {
|
|
3256
|
+
var L;
|
|
3257
|
+
const c = (L = window.getSelection()) == null ? void 0 : L.anchorNode;
|
|
3258
|
+
if (!c) return null;
|
|
3259
|
+
const u = c.nodeType === Node.TEXT_NODE ? c.parentElement : c, T = (u == null ? void 0 : u.closest(bl)) ?? null;
|
|
3260
|
+
return T && T !== d && d.contains(T) ? T : null;
|
|
3261
|
+
}, a = (d) => {
|
|
3262
|
+
if (d.key !== "Enter" || d.shiftKey || d.isComposing)
|
|
3263
|
+
return;
|
|
3264
|
+
const c = e.querySelector(".redactor-in");
|
|
3265
|
+
if (!c || !(d.target instanceof Node) || !c.contains(d.target) || se.current)
|
|
3266
|
+
return;
|
|
3267
|
+
const u = o(c), T = u == null ? void 0 : u.style.textAlign;
|
|
3268
|
+
if (!u || !T) return;
|
|
3269
|
+
const L = u.tagName === "LI" ? u.style.listStylePosition : "";
|
|
3270
|
+
clearTimeout(r), r = setTimeout(() => {
|
|
3271
|
+
const G = o(c);
|
|
3272
|
+
if (!G || G === u || G.style.textAlign) return;
|
|
3273
|
+
G.style.textAlign = T, L && G.tagName === "LI" && (G.style.listStylePosition = L);
|
|
3274
|
+
const Y = P.current;
|
|
3275
|
+
if (Y)
|
|
3276
|
+
try {
|
|
3277
|
+
Y(R, "broadcast", "hardsync");
|
|
3278
|
+
} catch {
|
|
3279
|
+
}
|
|
3280
|
+
Ne();
|
|
3281
|
+
}, vl);
|
|
3282
|
+
};
|
|
3283
|
+
return e.addEventListener("keydown", a, !0), () => {
|
|
3284
|
+
clearTimeout(r), e.removeEventListener("keydown", a, !0);
|
|
3285
|
+
};
|
|
3286
|
+
}, [R, Ne]);
|
|
3287
|
+
const ot = x(
|
|
3288
|
+
(e) => {
|
|
3289
|
+
ke(e, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => Ne());
|
|
3290
|
+
},
|
|
3291
|
+
[ke, Ne]
|
|
3292
|
+
), [pt, Sn] = A(null), Xt = k(null), Ln = `${ae}-variables`, br = k(null), [_n, jo] = A(void 0), De = x(() => {
|
|
3293
|
+
Xt.current = null, Sn(null);
|
|
3294
|
+
}, []), Ut = x(
|
|
3295
|
+
(e, r) => {
|
|
3296
|
+
const o = window.getSelection();
|
|
3297
|
+
if (!o) return;
|
|
3298
|
+
const a = document.createRange();
|
|
3299
|
+
a.setStart(r.node, r.start), a.setEnd(r.node, r.end), o.removeAllRanges(), o.addRange(a), ot(go(e)), window.requestAnimationFrame(() => je.current());
|
|
3300
|
+
},
|
|
3301
|
+
[ot]
|
|
3302
|
+
);
|
|
3303
|
+
$(() => {
|
|
3304
|
+
const e = q.current;
|
|
3305
|
+
if (!e || !ht) return;
|
|
3306
|
+
const r = () => {
|
|
3307
|
+
var We;
|
|
3308
|
+
const d = e.querySelector(".redactor-in"), c = window.getSelection();
|
|
3309
|
+
if (!d || !c || c.rangeCount === 0 || !c.isCollapsed) {
|
|
3310
|
+
De();
|
|
3311
|
+
return;
|
|
3312
|
+
}
|
|
3313
|
+
const { startContainer: u, startOffset: T } = c.getRangeAt(0);
|
|
3314
|
+
if (u.nodeType !== Node.TEXT_NODE || !d.contains(u) || (((We = u.parentElement) == null ? void 0 : We.closest(
|
|
3315
|
+
'[data-redactor-type="variable"]'
|
|
3316
|
+
)) ?? null) !== null) {
|
|
3317
|
+
De();
|
|
3318
|
+
return;
|
|
3319
|
+
}
|
|
3320
|
+
const L = u, G = L.data.slice(0, T), Y = /\[\[([A-Za-z0-9_]+)\]\]$/.exec(G);
|
|
3321
|
+
if (Y) {
|
|
3322
|
+
De(), Ut(
|
|
3323
|
+
Ce.get(Y[1].toLowerCase()) ?? Y[1],
|
|
3324
|
+
{ node: L, start: T - Y[0].length, end: T }
|
|
3325
|
+
);
|
|
3326
|
+
return;
|
|
3327
|
+
}
|
|
3328
|
+
const le = /\[\[([A-Za-z0-9_ ]{0,40})$/.exec(G), Q = Be.current;
|
|
3329
|
+
if (!le || !Q || (re ?? []).length === 0) {
|
|
3330
|
+
De();
|
|
3331
|
+
return;
|
|
3332
|
+
}
|
|
3333
|
+
const he = {
|
|
3334
|
+
node: L,
|
|
3335
|
+
start: T - le[0].length,
|
|
3336
|
+
end: T
|
|
3337
|
+
};
|
|
3338
|
+
Xt.current = he;
|
|
3339
|
+
const Ke = document.createRange();
|
|
3340
|
+
Ke.setStart(L, he.start), Ke.setEnd(L, he.end);
|
|
3341
|
+
const mt = Ke.getBoundingClientRect(), Ot = Q.getBoundingClientRect(), Bn = getComputedStyle(Q).direction === "rtl";
|
|
3342
|
+
Sn({
|
|
3343
|
+
query: le[1],
|
|
3344
|
+
left: Bn ? Ot.right - mt.right : mt.left - Ot.left,
|
|
3345
|
+
top: mt.bottom - Ot.top + 4
|
|
3346
|
+
});
|
|
3347
|
+
}, o = (d) => {
|
|
3348
|
+
var u;
|
|
3349
|
+
if (!Xt.current || !["ArrowDown", "ArrowUp", "Home", "End", "Enter", "Escape"].includes(
|
|
3350
|
+
d.key
|
|
3351
|
+
))
|
|
3352
|
+
return;
|
|
3353
|
+
(((u = br.current) == null ? void 0 : u.handleKeyDown(d)) ?? !1) && (d.preventDefault(), d.stopImmediatePropagation());
|
|
3354
|
+
}, a = () => De();
|
|
3355
|
+
return e.addEventListener("input", r), e.addEventListener("keydown", o, !0), e.addEventListener("focusout", a), () => {
|
|
3356
|
+
e.removeEventListener("input", r), e.removeEventListener("keydown", o, !0), e.removeEventListener("focusout", a);
|
|
3357
|
+
};
|
|
3358
|
+
}, [
|
|
3359
|
+
ht,
|
|
3360
|
+
Ce,
|
|
3361
|
+
re,
|
|
3362
|
+
Ut,
|
|
3363
|
+
De
|
|
3364
|
+
]), $(() => {
|
|
3365
|
+
var r;
|
|
3366
|
+
const e = (r = q.current) == null ? void 0 : r.querySelector(".redactor-in");
|
|
3367
|
+
e && (pt ? (e.setAttribute("aria-expanded", "true"), e.setAttribute("aria-controls", `${Ln}-list`), _n ? e.setAttribute("aria-activedescendant", _n) : e.removeAttribute("aria-activedescendant")) : (e.removeAttribute("aria-expanded"), e.removeAttribute("aria-controls"), e.removeAttribute("aria-activedescendant")));
|
|
3368
|
+
}, [pt, Ln, _n]);
|
|
3369
|
+
const Go = x(
|
|
3370
|
+
(e) => {
|
|
3371
|
+
const r = Xt.current;
|
|
3372
|
+
De(), r && Ut(e.token, r), ue == null || ue(e.token);
|
|
3373
|
+
},
|
|
3374
|
+
[De, Ut, ue]
|
|
3375
|
+
), Vo = x(() => {
|
|
3376
|
+
De();
|
|
3377
|
+
}, [De]), Ko = x((e) => {
|
|
3378
|
+
Sn((r) => r && { ...r, query: e });
|
|
3379
|
+
}, []), bt = x(() => {
|
|
3380
|
+
var r;
|
|
3381
|
+
if (typeof window < "u") {
|
|
3382
|
+
const o = (r = q.current) == null ? void 0 : r.querySelector(".redactor-in"), a = window.getSelection();
|
|
3383
|
+
o && a && a.rangeCount > 0 && a.anchorNode && o.contains(a.anchorNode) && (Le.current = a.getRangeAt(0).cloneRange());
|
|
3384
|
+
}
|
|
3385
|
+
const e = P.current;
|
|
3386
|
+
if (e)
|
|
3387
|
+
try {
|
|
3388
|
+
e(R, "selection.save");
|
|
3389
|
+
} catch {
|
|
3390
|
+
}
|
|
3391
|
+
}, [R]), Me = x(() => {
|
|
3392
|
+
const e = P.current;
|
|
3393
|
+
if (!e) return;
|
|
3394
|
+
const r = Le.current;
|
|
3395
|
+
try {
|
|
3396
|
+
e(R, "editor.focus");
|
|
3397
|
+
} catch {
|
|
3398
|
+
}
|
|
3399
|
+
if (r && typeof window < "u") {
|
|
3400
|
+
const o = window.getSelection();
|
|
3401
|
+
if (o)
|
|
3402
|
+
try {
|
|
3403
|
+
o.removeAllRanges(), o.addRange(r);
|
|
3404
|
+
return;
|
|
3405
|
+
} catch {
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
try {
|
|
3409
|
+
e(R, "selection.restore");
|
|
3410
|
+
} catch {
|
|
3411
|
+
}
|
|
3412
|
+
}, [R]), Wo = x(() => {
|
|
3413
|
+
var o;
|
|
3414
|
+
if (typeof window > "u") return "";
|
|
3415
|
+
const e = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in"), r = window.getSelection();
|
|
3416
|
+
return !e || !r || !r.anchorNode || !e.contains(r.anchorNode) ? "" : r.toString();
|
|
3417
|
+
}, []), Xo = x(() => {
|
|
3418
|
+
var d;
|
|
3419
|
+
if (typeof window > "u") return null;
|
|
3420
|
+
const e = (d = q.current) == null ? void 0 : d.querySelector(".redactor-in"), r = window.getSelection();
|
|
3421
|
+
if (!e || !r || r.rangeCount === 0) return null;
|
|
3422
|
+
const o = r.anchorNode, a = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
|
|
3423
|
+
return !a || !e.contains(a) ? null : a.closest("table");
|
|
3424
|
+
}, []), vr = k(null), Zt = x(() => {
|
|
3425
|
+
var d;
|
|
3426
|
+
if (typeof window > "u") return null;
|
|
3427
|
+
const e = (d = q.current) == null ? void 0 : d.querySelector(".redactor-in"), r = window.getSelection();
|
|
3428
|
+
if (!e || !r || r.rangeCount === 0) return null;
|
|
3429
|
+
const o = r.anchorNode, a = o && o.nodeType === Node.TEXT_NODE ? o.parentElement : o;
|
|
3430
|
+
return !a || !e.contains(a) ? null : a.closest("td,th");
|
|
3431
|
+
}, []), Uo = x(() => {
|
|
3432
|
+
vr.current = Zt();
|
|
3433
|
+
}, [Zt]), Zo = x(
|
|
3434
|
+
(e, r) => {
|
|
3435
|
+
var c;
|
|
3436
|
+
const o = vr.current ?? Zt();
|
|
3437
|
+
if (!o) return;
|
|
3438
|
+
const a = e === "row" ? Array.from(((c = o.closest("tr")) == null ? void 0 : c.children) ?? [o]).filter(
|
|
3439
|
+
(u) => u instanceof HTMLElement && (u.tagName === "TD" || u.tagName === "TH")
|
|
3440
|
+
) : [o], d = P.current;
|
|
3441
|
+
if (d)
|
|
3442
|
+
try {
|
|
3443
|
+
d(R, "module.buffer.trigger");
|
|
3444
|
+
} catch {
|
|
3445
|
+
}
|
|
3446
|
+
for (const u of a)
|
|
3447
|
+
r ? u.style.setProperty("background-color", r) : u.style.removeProperty("background-color");
|
|
3448
|
+
if (d)
|
|
3449
|
+
try {
|
|
3450
|
+
d(R, "broadcast", "hardsync");
|
|
3451
|
+
} catch {
|
|
3452
|
+
}
|
|
3453
|
+
typeof window < "u" && window.requestAnimationFrame(() => Ne());
|
|
3454
|
+
},
|
|
3455
|
+
[Zt, R, Ne]
|
|
3456
|
+
);
|
|
3457
|
+
$(() => {
|
|
3458
|
+
const e = q.current;
|
|
3459
|
+
if (typeof window > "u" || !e) return;
|
|
3460
|
+
const r = (d) => {
|
|
3461
|
+
const c = e.querySelector(".redactor-in"), u = d.target;
|
|
3462
|
+
if (!c || !(u instanceof Node) || !c.contains(u))
|
|
3463
|
+
return;
|
|
3464
|
+
const T = u instanceof Element ? u.closest("img") : null;
|
|
3465
|
+
Vt(T && c.contains(T) ? T : null);
|
|
3466
|
+
}, o = (d) => {
|
|
3467
|
+
d.key === "Escape" && Gt.current && Vt(null);
|
|
3468
|
+
}, a = (d) => {
|
|
3469
|
+
const c = d.relatedTarget;
|
|
3470
|
+
(!(c instanceof Node) || !e.contains(c)) && Vt(null);
|
|
3471
|
+
};
|
|
3472
|
+
return e.addEventListener("click", r), e.addEventListener("keydown", o), e.addEventListener("focusout", a), () => {
|
|
3473
|
+
e.removeEventListener("click", r), e.removeEventListener("keydown", o), e.removeEventListener("focusout", a);
|
|
3474
|
+
};
|
|
3475
|
+
}, [Vt]);
|
|
3476
|
+
const Qo = x(
|
|
3477
|
+
(e) => {
|
|
3478
|
+
const r = Gt.current;
|
|
3479
|
+
if (!r) return;
|
|
3480
|
+
const o = Yn.includes(
|
|
3481
|
+
e
|
|
3482
|
+
) ? Yn : Eo, a = P.current;
|
|
3483
|
+
if (a)
|
|
3484
|
+
try {
|
|
3485
|
+
a(R, "module.buffer.trigger");
|
|
3486
|
+
} catch {
|
|
3487
|
+
}
|
|
3488
|
+
for (const d of o) r.classList.remove(d);
|
|
3489
|
+
if (r.classList.add(e), a)
|
|
3490
|
+
try {
|
|
3491
|
+
a(R, "broadcast", "hardsync");
|
|
3492
|
+
} catch {
|
|
3493
|
+
}
|
|
3494
|
+
typeof window < "u" && window.requestAnimationFrame(() => Ne());
|
|
3495
|
+
},
|
|
3496
|
+
[R, Ne]
|
|
3497
|
+
), Yo = x(
|
|
3498
|
+
(e) => {
|
|
3499
|
+
const r = Gt.current;
|
|
3500
|
+
if (!r) return;
|
|
3501
|
+
const o = P.current;
|
|
3502
|
+
if (o)
|
|
3503
|
+
try {
|
|
3504
|
+
o(R, "module.buffer.trigger");
|
|
3505
|
+
} catch {
|
|
3506
|
+
}
|
|
3507
|
+
if (r.style.setProperty("width", `${e}%`), o)
|
|
3508
|
+
try {
|
|
3509
|
+
o(R, "broadcast", "hardsync");
|
|
3510
|
+
} catch {
|
|
3511
|
+
}
|
|
3512
|
+
typeof window < "u" && window.requestAnimationFrame(() => Ne());
|
|
3513
|
+
},
|
|
3514
|
+
[R, Ne]
|
|
3515
|
+
), Jo = x(
|
|
3516
|
+
(e) => {
|
|
3517
|
+
var o;
|
|
3518
|
+
const r = P.current;
|
|
3519
|
+
if (r && typeof window < "u") {
|
|
3520
|
+
const a = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in"), d = window.getSelection(), c = d == null ? void 0 : d.anchorNode, u = c && c.nodeType === Node.TEXT_NODE ? c.parentElement : c, T = u && (a != null && a.contains(u)) ? u.closest("ul,ol") : null;
|
|
3521
|
+
if (T)
|
|
3522
|
+
try {
|
|
3523
|
+
r(R, "caret.setAfter", T);
|
|
3524
|
+
} catch {
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
ot(e), typeof window < "u" && window.requestAnimationFrame(() => {
|
|
3528
|
+
var d;
|
|
3529
|
+
const a = (d = q.current) == null ? void 0 : d.querySelector(".redactor-in");
|
|
3530
|
+
a == null || a.querySelectorAll("table td, table th").forEach((c) => {
|
|
3531
|
+
let u = c.lastChild;
|
|
3532
|
+
for (; u && u.nodeType === Node.TEXT_NODE && !(u.textContent ?? "").trim(); ) {
|
|
3533
|
+
const T = u.previousSibling;
|
|
3534
|
+
c.removeChild(u), u = T;
|
|
3535
|
+
}
|
|
3536
|
+
});
|
|
3537
|
+
});
|
|
3538
|
+
},
|
|
3539
|
+
[ot, R]
|
|
3540
|
+
), yr = x(
|
|
3541
|
+
async (e, r) => {
|
|
3542
|
+
if (F) return F(e, r);
|
|
3543
|
+
if (!D) throw new Error("No image upload URL configured.");
|
|
3544
|
+
const o = new FormData();
|
|
3545
|
+
o.append("file", e);
|
|
3546
|
+
const a = await fetch(D, {
|
|
3547
|
+
method: "POST",
|
|
3548
|
+
body: o,
|
|
3549
|
+
credentials: "same-origin",
|
|
3550
|
+
signal: r
|
|
3551
|
+
});
|
|
3552
|
+
if (!a.ok) throw new Error(`Image upload failed (${a.status}).`);
|
|
3553
|
+
const d = Nl(await a.json());
|
|
3554
|
+
if (!d) throw new Error("Image upload response contained no URL.");
|
|
3555
|
+
return d;
|
|
3556
|
+
},
|
|
3557
|
+
[D, F]
|
|
3558
|
+
), it = zi({ enabled: z }), {
|
|
3559
|
+
start: vt,
|
|
3560
|
+
land: Ge,
|
|
3561
|
+
reset: yt
|
|
3562
|
+
} = it, St = k(null), wt = k(null), [Te, wr] = A(!1), [ei, kr] = A("listening"), [ti, xr] = A(!1), [ni, Lt] = A(""), kt = x(() => {
|
|
3563
|
+
const e = wt.current;
|
|
3564
|
+
e != null && e.parentNode && e.parentNode.removeChild(e), wt.current = null;
|
|
3565
|
+
}, []), xt = k(""), Qt = x((e) => {
|
|
3566
|
+
var c, u;
|
|
3567
|
+
const r = (c = q.current) == null ? void 0 : c.querySelector(
|
|
3568
|
+
".redactor-in"
|
|
3569
|
+
);
|
|
3570
|
+
if (!r) return;
|
|
3571
|
+
let o = wt.current;
|
|
3572
|
+
if (!o || !r.contains(o)) {
|
|
3573
|
+
o = document.createElement("span"), o.setAttribute("data-rte-interim", ""), o.setAttribute("contenteditable", "false");
|
|
3574
|
+
const T = window.getSelection();
|
|
3575
|
+
if (T && T.rangeCount > 0 && r.contains(T.anchorNode)) {
|
|
3576
|
+
const L = T.getRangeAt(0).cloneRange();
|
|
3577
|
+
L.collapse(!1), L.insertNode(o);
|
|
3578
|
+
} else {
|
|
3579
|
+
const L = r.lastElementChild;
|
|
3580
|
+
L !== null && L.tagName === "P" && L === r.firstElementChild && (L.textContent ?? "").replace(/[\ufeff\s]/g, "") === "" && Array.from(L.children).every((Y) => Y.tagName === "BR") ? ((u = L.lastChild) == null ? void 0 : u.nodeName) === "BR" ? L.insertBefore(o, L.lastChild) : L.appendChild(o) : r.appendChild(o);
|
|
3581
|
+
}
|
|
3582
|
+
wt.current = o;
|
|
3583
|
+
}
|
|
3584
|
+
xt.current ? o.setAttribute("data-hint", xt.current) : o.removeAttribute("data-hint");
|
|
3585
|
+
const a = o.previousSibling, d = (a == null ? void 0 : a.nodeType) === Node.TEXT_NODE ? a.data.replace(/\ufeff/g, "").slice(-1) : "";
|
|
3586
|
+
o.toggleAttribute("data-gap", /\S/.test(d) && d !== " "), o.textContent = e;
|
|
3587
|
+
}, []), Cr = x(
|
|
3588
|
+
(e) => {
|
|
3589
|
+
var r;
|
|
3590
|
+
xt.current = e, Qt(((r = wt.current) == null ? void 0 : r.textContent) ?? "");
|
|
3591
|
+
},
|
|
3592
|
+
[Qt]
|
|
3593
|
+
), Yt = k(null), Jt = x(
|
|
3594
|
+
(e = !1) => {
|
|
3595
|
+
var o;
|
|
3596
|
+
Yt.current && (Yt.current.keepLate = e), (o = St.current) == null || o.abort(), xt.current = "";
|
|
3597
|
+
const r = wt.current;
|
|
3598
|
+
r && !r.textContent ? kt() : r == null || r.removeAttribute("data-hint");
|
|
3599
|
+
},
|
|
3600
|
+
[kt]
|
|
3601
|
+
), Ar = x(() => {
|
|
3602
|
+
var c;
|
|
3603
|
+
if (typeof window > "u") return !1;
|
|
3604
|
+
const e = window.getSelection(), r = (c = q.current) == null ? void 0 : c.querySelector(".redactor-in");
|
|
3605
|
+
if (!e || e.rangeCount === 0 || !r) return !1;
|
|
3606
|
+
const { startContainer: o, startOffset: a } = e.getRangeAt(0);
|
|
3607
|
+
if (!r.contains(o) || o.nodeType !== Node.TEXT_NODE || a === 0)
|
|
3608
|
+
return !1;
|
|
3609
|
+
const d = o.data.charAt(a - 1);
|
|
3610
|
+
return /\S/.test(d) && d !== " ";
|
|
3611
|
+
}, []), _e = M !== void 0 && !M.granted, en = k(null), tn = x(() => {
|
|
3612
|
+
if (!ne || _e) return;
|
|
3613
|
+
const e = new AbortController();
|
|
3614
|
+
St.current = e;
|
|
3615
|
+
const r = { keepLate: !1 };
|
|
3616
|
+
Yt.current = r;
|
|
3617
|
+
let o = !1;
|
|
3618
|
+
const a = () => !o && (!e.signal.aborted || r.keepLate);
|
|
3619
|
+
xr(!1), wr(!0), kr("listening"), Lt(H("editor.ai.listening")), z && vt(), kt();
|
|
3620
|
+
const d = (c) => {
|
|
3621
|
+
if (en.current) {
|
|
3622
|
+
xt.current = "";
|
|
3623
|
+
return;
|
|
3624
|
+
}
|
|
3625
|
+
Cr(c);
|
|
3626
|
+
};
|
|
3627
|
+
d(H("editor.ai.listening")), ne({
|
|
3628
|
+
signal: e.signal,
|
|
3629
|
+
onStatus: (c) => {
|
|
3630
|
+
if (!a()) return;
|
|
3631
|
+
const u = H(c === "connecting" ? "voiceControl.status.starting" : "editor.ai.listening");
|
|
3632
|
+
kr(c), Lt(u), d(u);
|
|
3633
|
+
},
|
|
3634
|
+
// Interim text shows live in the editor (grey + caret); each final
|
|
3635
|
+
// replaces it with committed text at the caret.
|
|
3636
|
+
onPartialTranscript: (c) => {
|
|
3637
|
+
a() && Qt(c);
|
|
3638
|
+
},
|
|
3639
|
+
onFinalTranscript: (c) => {
|
|
3640
|
+
if (!a()) return;
|
|
3641
|
+
kt();
|
|
3642
|
+
const u = c.trim();
|
|
3643
|
+
if (u) {
|
|
3644
|
+
const T = en.current;
|
|
3645
|
+
if (T) {
|
|
3646
|
+
en.current = null, Le.current = T, Me(), ke(`${u} `, { asHtml: !1 }), z && Ge(), Lt(u);
|
|
3647
|
+
return;
|
|
3648
|
+
}
|
|
3649
|
+
if (Ar()) {
|
|
3650
|
+
const L = window.getSelection(), G = L == null ? void 0 : L.getRangeAt(0);
|
|
3651
|
+
if (L && G) {
|
|
3652
|
+
const Y = G.startContainer, le = G.startOffset;
|
|
3653
|
+
Y.insertData(le, " ");
|
|
3654
|
+
const Q = document.createRange();
|
|
3655
|
+
Q.setStart(Y, le + 1), Q.collapse(!0), L.removeAllRanges(), L.addRange(Q);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
ke(`${u} `, { asHtml: !1 }), z && Ge(), Lt(u);
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
}).catch((c) => {
|
|
3662
|
+
var u;
|
|
3663
|
+
if (!(e.signal.aborted || c && typeof c == "object" && "name" in c && c.name === "AbortError")) {
|
|
3664
|
+
if (mo(c) && ((u = Oe.current) == null || u.call(Oe), Cn.current || An.current)) {
|
|
3665
|
+
zt(!0), Xe(!0);
|
|
3666
|
+
return;
|
|
3667
|
+
}
|
|
3668
|
+
xr(!0);
|
|
3669
|
+
}
|
|
3670
|
+
}).finally(() => {
|
|
3671
|
+
o = !0, xt.current = "", kt(), St.current === e && (St.current = null, Yt.current = null, wr(!1), Lt(""), z && !Ve.current && yt());
|
|
3672
|
+
});
|
|
3673
|
+
}, [
|
|
3674
|
+
ne,
|
|
3675
|
+
_e,
|
|
3676
|
+
ke,
|
|
3677
|
+
Me,
|
|
3678
|
+
kt,
|
|
3679
|
+
Qt,
|
|
3680
|
+
Cr,
|
|
3681
|
+
Ar,
|
|
3682
|
+
z,
|
|
3683
|
+
vt,
|
|
3684
|
+
Ge,
|
|
3685
|
+
yt,
|
|
3686
|
+
H
|
|
3687
|
+
]);
|
|
3688
|
+
$(() => () => {
|
|
3689
|
+
var e;
|
|
3690
|
+
return (e = St.current) == null ? void 0 : e.abort();
|
|
3691
|
+
}, []);
|
|
3692
|
+
const [nn, _t] = A(null), at = k(null), rn = k(null), [ri, Nr] = A(!1), oi = ((M == null ? void 0 : M.pending) ?? !1) || ri, on = k(!1), In = x(() => {
|
|
3693
|
+
at.current = null, rn.current = null, on.current = !1, _t(null);
|
|
3694
|
+
}, []), ii = x(() => {
|
|
3695
|
+
var r;
|
|
3696
|
+
on.current = !0;
|
|
3697
|
+
const e = (r = M == null ? void 0 : M.onGrant) == null ? void 0 : r.call(M);
|
|
3698
|
+
e && typeof e.then == "function" && (Nr(!0), Promise.resolve(e).catch(() => {
|
|
3699
|
+
}).finally(() => Nr(!1)));
|
|
3700
|
+
}, [M]), Tr = k((M == null ? void 0 : M.granted) ?? !0);
|
|
3701
|
+
$(() => {
|
|
3702
|
+
const e = Tr.current;
|
|
3703
|
+
if (Tr.current = (M == null ? void 0 : M.granted) ?? !0, !e && (M != null && M.granted) && at.current) {
|
|
3704
|
+
const r = at.current, o = on.current;
|
|
3705
|
+
at.current = null, on.current = !1, _t(null);
|
|
3706
|
+
const a = rn.current;
|
|
3707
|
+
if (rn.current = null, !o) return;
|
|
3708
|
+
r === "write" ? Xe(!0) : r === "action" ? a == null || a() : (Me(), tn());
|
|
3709
|
+
}
|
|
3710
|
+
}, [M == null ? void 0 : M.granted, Me, tn]), $(() => {
|
|
3711
|
+
_e && (Xe(!1), Te && Jt());
|
|
3712
|
+
}, [_e, Te, Jt]);
|
|
3713
|
+
const Er = x(
|
|
3714
|
+
(e = "document") => {
|
|
3715
|
+
if (Te) {
|
|
3716
|
+
Jt(!0);
|
|
3717
|
+
return;
|
|
3718
|
+
}
|
|
3719
|
+
bt();
|
|
3720
|
+
const r = Le.current;
|
|
3721
|
+
if (en.current = e === "selection" && r && !r.collapsed ? r.cloneRange() : null, _e) {
|
|
3722
|
+
at.current = "dictate", _t("dictate");
|
|
3723
|
+
return;
|
|
3724
|
+
}
|
|
3725
|
+
tn();
|
|
3726
|
+
},
|
|
3727
|
+
[Te, Jt, _e, bt, tn]
|
|
3728
|
+
), Mr = x(
|
|
3729
|
+
(e = "document") => {
|
|
3730
|
+
bt();
|
|
3731
|
+
const r = Le.current, o = r ? r.cloneRange() : null, a = e === "selection" && !!(o && !o.collapsed);
|
|
3732
|
+
if (o && !a && o.collapse(!1), jt.current = o, Do(a ? "selection" : "document"), $o(a && o ? o.toString() : ""), _e) {
|
|
3733
|
+
at.current = "write", _t("write");
|
|
3734
|
+
return;
|
|
3735
|
+
}
|
|
3736
|
+
Xe(!0);
|
|
3737
|
+
},
|
|
3738
|
+
[bt, _e]
|
|
3739
|
+
), zr = Ct(() => M != null && M.granted ? /* @__PURE__ */ C(Ze, { children: [
|
|
3740
|
+
H(
|
|
3741
|
+
"editor.ai.consentRecorded",
|
|
3742
|
+
"AI assistance consent has been recorded."
|
|
3743
|
+
),
|
|
3744
|
+
X ? /* @__PURE__ */ C(Ze, { children: [
|
|
3745
|
+
" ",
|
|
3746
|
+
X
|
|
3747
|
+
] }) : null
|
|
3748
|
+
] }) : X, [M, X, H]), [st, Hn] = A(null), [ai, an] = A(!1), [Rr, Sr] = A(!1), [si, lt] = A(""), Lr = k(null), Ve = k(null), sn = k(pe);
|
|
3749
|
+
$(() => {
|
|
3750
|
+
sn.current = pe;
|
|
3751
|
+
}, [pe]), $(() => {
|
|
3752
|
+
z && (!Te && st === null || it.state === null && vt());
|
|
3753
|
+
}, [z, Te, st, it.state, vt]);
|
|
3754
|
+
const It = (e) => e.preventDefault(), _r = x(
|
|
3755
|
+
(e) => {
|
|
3756
|
+
var o;
|
|
3757
|
+
const r = P.current;
|
|
3758
|
+
if (r)
|
|
3759
|
+
try {
|
|
3760
|
+
const a = r(R);
|
|
3761
|
+
(o = a == null ? void 0 : a.broadcast) == null || o.call(a, "state", !1, e);
|
|
3762
|
+
} catch {
|
|
3763
|
+
}
|
|
3764
|
+
},
|
|
3765
|
+
[R]
|
|
3766
|
+
), Ir = k(!1), ct = x(
|
|
3767
|
+
(e) => {
|
|
3768
|
+
const r = P.current;
|
|
3769
|
+
if (!r || Ir.current === e) return;
|
|
3770
|
+
Ir.current = e;
|
|
3771
|
+
const o = e || w;
|
|
3772
|
+
se.current = o;
|
|
3773
|
+
try {
|
|
3774
|
+
r(R, o ? "enableReadOnly" : "disableReadOnly");
|
|
3775
|
+
} catch {
|
|
3776
|
+
}
|
|
3777
|
+
},
|
|
3778
|
+
[R, w]
|
|
3779
|
+
), $n = x(
|
|
3780
|
+
(e) => {
|
|
3781
|
+
var o;
|
|
3782
|
+
const r = Tt(
|
|
3783
|
+
He(e),
|
|
3784
|
+
ft.current
|
|
3785
|
+
);
|
|
3786
|
+
!we("source.setCode", r) && S.current && (S.current.value = r), (o = Ae.current) == null || o.call(Ae, { html: r, markdown: "" });
|
|
3787
|
+
},
|
|
3788
|
+
[we]
|
|
3789
|
+
), dt = x(
|
|
3790
|
+
(e) => {
|
|
3791
|
+
var d;
|
|
3792
|
+
const r = (d = q.current) == null ? void 0 : d.querySelector(".redactor-in"), o = typeof window < "u" ? window.getSelection() : null;
|
|
3793
|
+
if (e === "selection" && r && o && o.rangeCount > 0 && !o.isCollapsed) {
|
|
3794
|
+
const c = o.getRangeAt(0);
|
|
3795
|
+
if (r.contains(c.commonAncestorContainer)) {
|
|
3796
|
+
const u = c.toString();
|
|
3797
|
+
if (u.trim())
|
|
3798
|
+
return {
|
|
3799
|
+
scope: "selection",
|
|
3800
|
+
range: c.cloneRange(),
|
|
3801
|
+
html: xl(c.cloneContents()),
|
|
3802
|
+
text: u
|
|
3803
|
+
};
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
const a = ye();
|
|
3807
|
+
return { scope: "document", range: null, html: a, text: fo(a) };
|
|
3808
|
+
},
|
|
3809
|
+
[ye]
|
|
3810
|
+
), On = x(
|
|
3811
|
+
(e, r, o, a) => {
|
|
3812
|
+
if (Ve.current || !o.text.trim()) return;
|
|
3813
|
+
const d = new AbortController();
|
|
3814
|
+
Ve.current = d, Hn(e), Sr(!1), Lr.current = e, lt(H("editor.ai.generating")), an(!1), z && vt();
|
|
3815
|
+
const c = ye();
|
|
3816
|
+
ct(!0), Promise.resolve(
|
|
3817
|
+
r({
|
|
3818
|
+
html: o.html,
|
|
3819
|
+
text: o.text,
|
|
3820
|
+
scope: o.scope,
|
|
3821
|
+
signal: d.signal
|
|
3822
|
+
})
|
|
3823
|
+
).then((u) => {
|
|
3824
|
+
var L;
|
|
3825
|
+
if (d.signal.aborted) return;
|
|
3826
|
+
ct(!1);
|
|
3827
|
+
const T = String(u ?? "");
|
|
3828
|
+
if (ye() !== c) {
|
|
3829
|
+
Sr(!0), lt("");
|
|
3830
|
+
return;
|
|
3831
|
+
}
|
|
3832
|
+
if (!fo(T)) {
|
|
3833
|
+
an(!0), lt("");
|
|
3834
|
+
return;
|
|
3835
|
+
}
|
|
3836
|
+
if (_r(c), o.scope === "selection" && o.range) {
|
|
3837
|
+
if (!o.range.startContainer.isConnected) {
|
|
3838
|
+
an(!0), lt("");
|
|
3839
|
+
return;
|
|
3840
|
+
}
|
|
3841
|
+
Le.current = o.range, Me();
|
|
3842
|
+
const G = Tt(
|
|
3843
|
+
He(T),
|
|
3844
|
+
ft.current
|
|
3845
|
+
);
|
|
3846
|
+
we("insertion.insertHtml", G) || ke(T, { asHtml: !0 });
|
|
3847
|
+
} else
|
|
3848
|
+
$n(T);
|
|
3849
|
+
z && Ge(), lt(H("editor.ai.actionDone")), (L = sn.current) == null || L.call(sn, {
|
|
3850
|
+
action: e,
|
|
3851
|
+
template: a,
|
|
3852
|
+
scope: o.scope,
|
|
3853
|
+
previousHtml: c,
|
|
3854
|
+
undo: () => $n(c)
|
|
3855
|
+
});
|
|
3856
|
+
}).catch((u) => {
|
|
3857
|
+
var T;
|
|
3858
|
+
if (ct(!1), !(d.signal.aborted || kl(u))) {
|
|
3859
|
+
if (mo(u) && ((T = Oe.current) == null || T.call(Oe), Cn.current || An.current)) {
|
|
3860
|
+
zt(!0), Xe(!0);
|
|
3861
|
+
return;
|
|
3862
|
+
}
|
|
3863
|
+
an(!0), lt("");
|
|
3864
|
+
}
|
|
3865
|
+
}).finally(() => {
|
|
3866
|
+
Ve.current === d && (Ve.current = null, ct(!1), Hn(null), yt());
|
|
3867
|
+
});
|
|
3868
|
+
},
|
|
3869
|
+
[
|
|
3870
|
+
z,
|
|
3871
|
+
vt,
|
|
3872
|
+
Ge,
|
|
3873
|
+
yt,
|
|
3874
|
+
ct,
|
|
3875
|
+
ye,
|
|
3876
|
+
Me,
|
|
3877
|
+
we,
|
|
3878
|
+
ke,
|
|
3879
|
+
$n,
|
|
3880
|
+
_r,
|
|
3881
|
+
H
|
|
3882
|
+
]
|
|
3883
|
+
), Ht = x(
|
|
3884
|
+
(e, r, o, a) => {
|
|
3885
|
+
if (_e) {
|
|
3886
|
+
rn.current = () => On(e, r, o, a), at.current = "action", _t("action");
|
|
3887
|
+
return;
|
|
3888
|
+
}
|
|
3889
|
+
On(e, r, o, a);
|
|
3890
|
+
},
|
|
3891
|
+
[_e, On]
|
|
3892
|
+
), Hr = x(
|
|
3893
|
+
(e, r) => {
|
|
3894
|
+
const o = ie == null ? void 0 : ie.onRun;
|
|
3895
|
+
o && Ht(
|
|
3896
|
+
"template",
|
|
3897
|
+
(a) => o({ ...a, template: e }),
|
|
3898
|
+
r,
|
|
3899
|
+
e
|
|
3900
|
+
);
|
|
3901
|
+
},
|
|
3902
|
+
[ie, Ht]
|
|
3903
|
+
), $r = x(() => {
|
|
3904
|
+
var e;
|
|
3905
|
+
(e = Ve.current) == null || e.abort(), Ve.current = null, ct(!1), Hn(null), lt(""), yt();
|
|
3906
|
+
}, [ct, yt]), Or = k(null);
|
|
3907
|
+
$(() => {
|
|
3908
|
+
const e = st ?? Lr.current;
|
|
3909
|
+
if (!e) return;
|
|
3910
|
+
const r = e === "template" ? "ai-templates" : `ai-${e}`, o = requestAnimationFrame(() => {
|
|
3911
|
+
var d, c;
|
|
3912
|
+
const a = document.activeElement;
|
|
3913
|
+
a && a !== document.body && a.isConnected || (c = (d = Or.current) == null ? void 0 : d.querySelector(`[data-component-part="${r}"]`)) == null || c.focus();
|
|
3914
|
+
});
|
|
3915
|
+
return () => cancelAnimationFrame(o);
|
|
3916
|
+
}, [st]), $(() => () => {
|
|
3917
|
+
var e;
|
|
3918
|
+
return (e = Ve.current) == null ? void 0 : e.abort();
|
|
3919
|
+
}, []), $(() => {
|
|
3920
|
+
var L;
|
|
3921
|
+
const e = S.current;
|
|
3922
|
+
if (!e) return;
|
|
3923
|
+
e.value = Fo.current, je.current();
|
|
3924
|
+
const r = Tl(Z);
|
|
3925
|
+
if (!r) {
|
|
3926
|
+
ir(!0);
|
|
3927
|
+
return;
|
|
3928
|
+
}
|
|
3929
|
+
if (P.current = r, e.value = Tt(e.value, ft.current), B === void 0 && (h == null ? void 0 : h.lang) === void 0 && r.addLang && r.lang) {
|
|
3930
|
+
const G = `alfadocs-${ae}`;
|
|
3931
|
+
r.addLang(G, eo(H)), ce.current = G;
|
|
3932
|
+
}
|
|
3933
|
+
const o = sr && !ar && ((L = r.plugins) == null ? void 0 : L.table) !== void 0;
|
|
3934
|
+
So(o);
|
|
3935
|
+
const a = o ? [...m ?? [], "table"] : m ?? [], d = {
|
|
3936
|
+
lang: ce.current ?? B ?? zl(K.language || "en"),
|
|
3937
|
+
// The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
|
|
3938
|
+
// via the command API, so Redactor's native toolbar is suppressed.
|
|
3939
|
+
toolbar: !1,
|
|
3940
|
+
plugins: a,
|
|
3941
|
+
placeholder: y ?? H("editor.placeholder"),
|
|
3942
|
+
toolbarFixed: !1,
|
|
3943
|
+
// Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
|
|
3944
|
+
shortcodes: !1,
|
|
3945
|
+
// The kit owns image editing: ImageFloatingToolbar provides DS-native,
|
|
3946
|
+
// keyboard-accessible resize + wrap/align, so Redactor's own image
|
|
3947
|
+
// popup AND its single-handle drag-resizer are both disabled to avoid a
|
|
3948
|
+
// second, untokenised, mouse-only UI competing with ours.
|
|
3949
|
+
imageEditable: !1,
|
|
3950
|
+
imageResizable: !1
|
|
3951
|
+
}, c = D ? { imageUpload: D } : {}, u = (h == null ? void 0 : h.callbacks) ?? {}, T = {
|
|
3952
|
+
...d,
|
|
3953
|
+
...c,
|
|
3954
|
+
...h ?? {},
|
|
3955
|
+
// Re-pin safety-critical keys LAST so consumer `options` can't override
|
|
3956
|
+
// the sanitising change handler or re-enable Redactor's native image UI
|
|
3957
|
+
// (the kit's ImageFloatingToolbar replaces both — see kitDefaults above).
|
|
3958
|
+
imageEditable: !1,
|
|
3959
|
+
imageResizable: !1,
|
|
3960
|
+
callbacks: {
|
|
3961
|
+
...u,
|
|
3962
|
+
changed(G) {
|
|
3963
|
+
je.current();
|
|
3964
|
+
const Y = fn(
|
|
3965
|
+
co(uo(G))
|
|
3966
|
+
), le = He(Y), Q = qr.current;
|
|
3967
|
+
if (Q && Date.now() < Q.until && ho(le) === Q.text) {
|
|
3968
|
+
Kt.current = le;
|
|
3969
|
+
return;
|
|
3970
|
+
}
|
|
3971
|
+
le !== Kt.current && (Kt.current = le, oe.current = !0, Ae.current && (Rt.current && clearTimeout(Rt.current), Rt.current = setTimeout(() => {
|
|
3972
|
+
var he;
|
|
3973
|
+
(he = Ae.current) == null || he.call(Ae, { html: le, markdown: "" });
|
|
3974
|
+
}, 100)));
|
|
3975
|
+
},
|
|
3976
|
+
keydown(G) {
|
|
3977
|
+
var Y;
|
|
3978
|
+
(Y = Wt.current) == null || Y.call(Wt, G);
|
|
3979
|
+
},
|
|
3980
|
+
observe() {
|
|
3981
|
+
Ne();
|
|
3982
|
+
},
|
|
3983
|
+
/* Redactor has just filled the bar over a link (its modules run
|
|
3984
|
+
before this callback): the address becomes "Visit link". */
|
|
3985
|
+
contextbar(G, Y) {
|
|
3986
|
+
var he, Ke;
|
|
3987
|
+
const le = u.contextbar;
|
|
3988
|
+
typeof le == "function" && le(G, Y);
|
|
3989
|
+
const Q = (Ke = (he = Y == null ? void 0 : Y.$contextbar) == null ? void 0 : he.get) == null ? void 0 : Ke.call(he);
|
|
3990
|
+
Q instanceof HTMLElement && Es(Q, pr.current);
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
};
|
|
3994
|
+
try {
|
|
3995
|
+
if (r(R, T), Kt.current = He(
|
|
3996
|
+
fn(co(ye()))
|
|
3997
|
+
), je.current(), w)
|
|
3998
|
+
try {
|
|
3999
|
+
r(R, "enableReadOnly");
|
|
4000
|
+
} catch {
|
|
4001
|
+
}
|
|
4002
|
+
} catch {
|
|
4003
|
+
ce.current && r.lang && delete r.lang[ce.current], ce.current = null, P.current = null, ir(!0);
|
|
4004
|
+
}
|
|
4005
|
+
return () => {
|
|
4006
|
+
Rt.current && clearTimeout(Rt.current);
|
|
4007
|
+
try {
|
|
4008
|
+
r(R, "destroy");
|
|
4009
|
+
} catch {
|
|
4010
|
+
}
|
|
4011
|
+
ce.current && r.lang && delete r.lang[ce.current], ce.current = null, P.current = null;
|
|
4012
|
+
};
|
|
4013
|
+
}, []), $(() => {
|
|
4014
|
+
const e = P.current, r = ce.current;
|
|
4015
|
+
if (!(!(e != null && e.addLang) || !r)) {
|
|
4016
|
+
e.addLang(r, eo(H));
|
|
4017
|
+
try {
|
|
4018
|
+
e(R, "lang.rebuild", r);
|
|
4019
|
+
} catch {
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
}, [H, K.language, R]);
|
|
4023
|
+
const Dr = k(Ce), qr = k(
|
|
4024
|
+
null
|
|
4025
|
+
);
|
|
4026
|
+
$(() => {
|
|
4027
|
+
var o, a;
|
|
4028
|
+
if (Dr.current === Ce || (Dr.current = Ce, !P.current || Ce.size === 0)) return;
|
|
4029
|
+
const e = ye(), r = Tt(e, Ce);
|
|
4030
|
+
if (r !== e) {
|
|
4031
|
+
const d = (o = q.current) == null ? void 0 : o.querySelector(".redactor-in"), u = d != null && d.contains(document.activeElement) && d ? Cl(d) : null;
|
|
4032
|
+
qr.current = {
|
|
4033
|
+
text: ho(e),
|
|
4034
|
+
until: Date.now() + 1e3
|
|
4035
|
+
}, we("source.setCode", r);
|
|
4036
|
+
const T = (a = q.current) == null ? void 0 : a.querySelector(".redactor-in");
|
|
4037
|
+
u !== null && T && Al(T, u);
|
|
4038
|
+
}
|
|
4039
|
+
window.requestAnimationFrame(() => je.current());
|
|
4040
|
+
}, [Ce, ye, we]), $(() => {
|
|
4041
|
+
if (!P.current || s === void 0) return;
|
|
4042
|
+
if (oe.current) {
|
|
4043
|
+
oe.current = !1;
|
|
4044
|
+
return;
|
|
4045
|
+
}
|
|
4046
|
+
const e = Tt(
|
|
4047
|
+
He(fn(s)),
|
|
4048
|
+
ft.current
|
|
4049
|
+
);
|
|
4050
|
+
fn(ye()) !== e && we("source.setCode", e);
|
|
4051
|
+
}, [s, ye, we]), $(() => {
|
|
4052
|
+
se.current = w;
|
|
4053
|
+
const e = P.current;
|
|
4054
|
+
if (e)
|
|
4055
|
+
try {
|
|
4056
|
+
e(R, w ? "enableReadOnly" : "disableReadOnly");
|
|
4057
|
+
} catch {
|
|
4058
|
+
}
|
|
4059
|
+
}, [w, R]), $(() => {
|
|
4060
|
+
if (!xe || s === void 0) return;
|
|
4061
|
+
const e = S.current;
|
|
4062
|
+
if (!e) return;
|
|
4063
|
+
const r = He(s);
|
|
4064
|
+
e.value !== r && document.activeElement !== e && (e.value = r);
|
|
4065
|
+
}, [xe, s]);
|
|
4066
|
+
const Ue = Ct(
|
|
4067
|
+
() => ({
|
|
4068
|
+
getHTML() {
|
|
4069
|
+
return ye();
|
|
4070
|
+
},
|
|
4071
|
+
getText() {
|
|
4072
|
+
return ye().replace(/<[^>]*>/g, " ").replace(/ /gi, " ").replace(/\s+/g, " ").trim();
|
|
4073
|
+
},
|
|
4074
|
+
getMarkdown() {
|
|
4075
|
+
return "";
|
|
4076
|
+
},
|
|
4077
|
+
isAiBusy() {
|
|
4078
|
+
return Ve.current !== null;
|
|
4079
|
+
},
|
|
4080
|
+
setContent(e) {
|
|
4081
|
+
const r = He(e);
|
|
4082
|
+
we(
|
|
4083
|
+
"source.setCode",
|
|
4084
|
+
Tt(r, ft.current)
|
|
4085
|
+
) || S.current && (S.current.value = r);
|
|
4086
|
+
},
|
|
4087
|
+
insertAtCursor: ke,
|
|
4088
|
+
applyFormat(e) {
|
|
4089
|
+
const r = El[e];
|
|
4090
|
+
r && rt(...r);
|
|
4091
|
+
},
|
|
4092
|
+
focus() {
|
|
4093
|
+
var r;
|
|
4094
|
+
const e = P.current;
|
|
4095
|
+
if (e)
|
|
4096
|
+
try {
|
|
4097
|
+
e(R, "editor.focus");
|
|
4098
|
+
return;
|
|
4099
|
+
} catch {
|
|
4100
|
+
}
|
|
4101
|
+
(r = S.current) == null || r.focus();
|
|
4102
|
+
},
|
|
4103
|
+
clear() {
|
|
4104
|
+
we("source.setCode", "") || S.current && (S.current.value = "");
|
|
4105
|
+
}
|
|
4106
|
+
}),
|
|
4107
|
+
[R, ye, we, ke, rt]
|
|
4108
|
+
);
|
|
4109
|
+
xi(Je, () => Ue, [Ue]), Mi(Ms, Ue, n);
|
|
4110
|
+
const li = x(
|
|
4111
|
+
(e) => {
|
|
4112
|
+
var r;
|
|
4113
|
+
je.current(), (r = Ae.current) == null || r.call(Ae, {
|
|
4114
|
+
html: He(e.target.value),
|
|
4115
|
+
markdown: ""
|
|
4116
|
+
});
|
|
4117
|
+
},
|
|
4118
|
+
[]
|
|
4119
|
+
), ln = g ?? H("editor.regionLabel"), Dn = h == null ? void 0 : h.placeholder, $t = typeof Dn == "string" || Dn === !1 ? Dn : y ?? H("editor.placeholder");
|
|
4120
|
+
$(() => {
|
|
4121
|
+
var a;
|
|
4122
|
+
if (xe) return;
|
|
4123
|
+
const e = (a = q.current) == null ? void 0 : a.querySelector(".redactor-in");
|
|
4124
|
+
if (!e) return;
|
|
4125
|
+
const r = () => {
|
|
4126
|
+
e.getAttribute("role") !== "textbox" && e.setAttribute("role", "textbox"), e.getAttribute("aria-multiline") !== "true" && e.setAttribute("aria-multiline", "true"), e.getAttribute("aria-label") !== ln && e.setAttribute("aria-label", ln), $t === !1 ? e.hasAttribute("placeholder") && e.removeAttribute("placeholder") : e.getAttribute("placeholder") !== $t && e.setAttribute("placeholder", $t), e.hasAttribute("aria-labelledby") && e.removeAttribute("aria-labelledby");
|
|
4127
|
+
};
|
|
4128
|
+
r();
|
|
4129
|
+
const o = new MutationObserver(r);
|
|
4130
|
+
return o.observe(e, {
|
|
4131
|
+
attributes: !0,
|
|
4132
|
+
attributeFilter: ["role", "aria-labelledby", "placeholder"]
|
|
4133
|
+
}), () => o.disconnect();
|
|
4134
|
+
}, [xe, ln, $t]);
|
|
4135
|
+
const cn = st !== null, ci = x(
|
|
4136
|
+
(e) => {
|
|
4137
|
+
Vn.test(e) && (xe ? ke(`[[${e}]]`, { asHtml: !1 }) : (Me(), ot(go(e))), ue == null || ue(e));
|
|
4138
|
+
},
|
|
4139
|
+
[
|
|
4140
|
+
xe,
|
|
4141
|
+
ke,
|
|
4142
|
+
Me,
|
|
4143
|
+
ot,
|
|
4144
|
+
ue
|
|
4145
|
+
]
|
|
4146
|
+
), qn = k(null), [di, ui] = A(!1), [mi, fi] = A(!1), hi = x(
|
|
4147
|
+
(e, r) => {
|
|
4148
|
+
if (fi(e), !e) return;
|
|
4149
|
+
const o = dt(r);
|
|
4150
|
+
qn.current = o, ui(!o.text.trim());
|
|
4151
|
+
},
|
|
4152
|
+
[dt]
|
|
4153
|
+
), gi = x(
|
|
4154
|
+
(e) => {
|
|
4155
|
+
const r = qn.current ?? dt("document");
|
|
4156
|
+
qn.current = null, Hr(e, r);
|
|
4157
|
+
},
|
|
4158
|
+
[dt, Hr]
|
|
4159
|
+
), Pr = (e, r) => {
|
|
4160
|
+
if (!r) return null;
|
|
4161
|
+
const o = st === e;
|
|
4162
|
+
return {
|
|
4163
|
+
key: e,
|
|
4164
|
+
// While running, the segment becomes a Stop/Cancel button (progress
|
|
4165
|
+
// shows on the scrim spinner).
|
|
4166
|
+
icon: o ? /* @__PURE__ */ t(Dt, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : e === "proofread" ? /* @__PURE__ */ t(Qr, { "aria-hidden": "true", className: "ds:size-5" }) : /* @__PURE__ */ t(Yr, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
4167
|
+
label: o ? H("common.cancel") : e === "proofread" ? H("editor.ai.proofread", "Check spelling & grammar") : H("editor.ai.autoFormat", "Auto-format document"),
|
|
4168
|
+
onClick: o ? $r : () => Ht(e, r, dt("document")),
|
|
4169
|
+
running: o
|
|
4170
|
+
};
|
|
4171
|
+
}, qe = Ji(Ye), Pn = Te && ei === "connecting", ut = [];
|
|
4172
|
+
if (ne && ut.push({
|
|
4173
|
+
key: "dictate",
|
|
4174
|
+
// Connecting: a spinner, not yet the red recording look, so the
|
|
4175
|
+
// red means "speak now". Pressing it still stops the session.
|
|
4176
|
+
icon: Pn ? /* @__PURE__ */ t(
|
|
4177
|
+
Wn,
|
|
4178
|
+
{
|
|
4179
|
+
"aria-hidden": "true",
|
|
4180
|
+
className: "ds:size-5 ds:animate-spin ds:motion-reduce:animate-none"
|
|
4181
|
+
}
|
|
4182
|
+
) : Te ? /* @__PURE__ */ t(Dt, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(Xn, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
4183
|
+
label: H(Te ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
4184
|
+
onClick: () => Er("document"),
|
|
4185
|
+
recording: Te && !Pn,
|
|
4186
|
+
// On from the first press, though not red until it listens.
|
|
4187
|
+
pressed: Te
|
|
4188
|
+
}), ie) {
|
|
4189
|
+
const e = st === "template";
|
|
4190
|
+
ut.push({
|
|
4191
|
+
key: "templates",
|
|
4192
|
+
icon: e ? /* @__PURE__ */ t(Dt, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(Un, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
4193
|
+
label: H(e ? "common.cancel" : "editor.ai.templates"),
|
|
4194
|
+
onClick: e ? $r : void 0,
|
|
4195
|
+
running: e,
|
|
4196
|
+
menu: !e
|
|
4197
|
+
});
|
|
4198
|
+
}
|
|
4199
|
+
const Br = Pr("proofread", ge);
|
|
4200
|
+
Br && ut.push(Br);
|
|
4201
|
+
const Fr = Pr("format", J);
|
|
4202
|
+
Fr && ut.push(Fr), (j || ve) && ut.push({
|
|
4203
|
+
key: "write",
|
|
4204
|
+
icon: /* @__PURE__ */ t(Zr, { "aria-hidden": "true", className: "ds:size-5" }),
|
|
4205
|
+
label: H("editor.ai.helpMeWrite"),
|
|
4206
|
+
onClick: () => Mr("document")
|
|
4207
|
+
});
|
|
4208
|
+
const jr = (e, r) => ie ? /* @__PURE__ */ t(
|
|
4209
|
+
ml,
|
|
4210
|
+
{
|
|
4211
|
+
side: r === "document" ? "top" : "bottom",
|
|
4212
|
+
templates: ie.templates,
|
|
4213
|
+
onPick: gi,
|
|
4214
|
+
onManage: ie.onManage,
|
|
4215
|
+
noteEmpty: di,
|
|
4216
|
+
onOpenChange: (o) => hi(o, r),
|
|
4217
|
+
trigger: e
|
|
4218
|
+
}
|
|
4219
|
+
) : null, Gr = (N ?? []).filter(
|
|
4220
|
+
(e) => !e.contexts || E !== void 0 && e.contexts.includes(E)
|
|
4221
|
+
);
|
|
4222
|
+
$(() => {
|
|
4223
|
+
(et || nn !== null || w) && Fe(!1);
|
|
4224
|
+
}, [et, nn, w, Fe]), $(() => {
|
|
4225
|
+
Se && !(N ?? []).some(
|
|
4226
|
+
(e) => e.id === Se.extension.id && (!e.contexts || E !== void 0 && e.contexts.includes(E))
|
|
4227
|
+
) && Fe();
|
|
4228
|
+
}, [N, E, Se, Fe]);
|
|
4229
|
+
const pi = (e) => {
|
|
4230
|
+
var Y, le;
|
|
4231
|
+
if (yn) return;
|
|
4232
|
+
xn(), Xe(!1), In();
|
|
4233
|
+
const r = new AbortController();
|
|
4234
|
+
Mt.current = r;
|
|
4235
|
+
const o = (Y = Le.current) == null ? void 0 : Y.cloneRange(), a = S.current ? [
|
|
4236
|
+
S.current.selectionStart,
|
|
4237
|
+
S.current.selectionEnd
|
|
4238
|
+
] : null, d = (o == null ? void 0 : o.toString()) ?? (a ? (((le = S.current) == null ? void 0 : le.value) ?? "").slice(...a) : "");
|
|
4239
|
+
let c = !1;
|
|
4240
|
+
const u = (Q) => {
|
|
4241
|
+
var he;
|
|
4242
|
+
c || (c = !0, (he = Ft.current) == null || he.call(Ft, e.id, Q));
|
|
4243
|
+
};
|
|
4244
|
+
tt.current = u;
|
|
4245
|
+
const T = () => {
|
|
4246
|
+
r.signal.aborted || (u({ status: "error" }), r.abort(), wn(!1), dr(!0), kn());
|
|
4247
|
+
}, L = async (Q) => {
|
|
4248
|
+
var Ke;
|
|
4249
|
+
if (r.signal.aborted) return;
|
|
4250
|
+
let he = Q.mode === "image" ? "" : Q.html;
|
|
4251
|
+
if (Q.mode !== "text") {
|
|
4252
|
+
const mt = await Q.pngDataUri();
|
|
4253
|
+
if (r.signal.aborted) return;
|
|
4254
|
+
const Ot = await (await fetch(mt.dataUri, { signal: r.signal })).blob(), Bn = await yr(
|
|
4255
|
+
new File([Ot], "extension-result.png", { type: "image/png" }),
|
|
4256
|
+
r.signal
|
|
4257
|
+
);
|
|
4258
|
+
if (r.signal.aborted) return;
|
|
4259
|
+
const We = document.createElement("img");
|
|
4260
|
+
We.src = Bn, We.alt = Q.text, We.width = mt.width, We.height = mt.height, We.loading = "lazy", he += We.outerHTML;
|
|
4261
|
+
}
|
|
4262
|
+
r.signal.aborted || (o && (Le.current = o.cloneRange()), a && ((Ke = S.current) == null || Ke.setSelectionRange(...a)), Me(), ke(he, { asHtml: !0 }), u({ status: "success" }), Fe());
|
|
4263
|
+
}, G = {
|
|
4264
|
+
html: Ue.getHTML(),
|
|
4265
|
+
text: Ue.getText(),
|
|
4266
|
+
selectionText: d,
|
|
4267
|
+
scope: d ? "selection" : "document",
|
|
4268
|
+
signal: r.signal,
|
|
4269
|
+
close: () => {
|
|
4270
|
+
Mt.current === r && Fe();
|
|
4271
|
+
},
|
|
4272
|
+
insert: async (Q) => {
|
|
4273
|
+
try {
|
|
4274
|
+
await L(Q);
|
|
4275
|
+
} catch {
|
|
4276
|
+
T();
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
};
|
|
4280
|
+
cr({ extension: e, context: G }), e.kind === "action" && (wn(!0), (async () => {
|
|
4281
|
+
try {
|
|
4282
|
+
if (!e.run) throw new Error("Missing extension run");
|
|
4283
|
+
const Q = await e.run(G);
|
|
4284
|
+
if (r.signal.aborted) return;
|
|
4285
|
+
Q ? await L(Q) : (u({ status: "success" }), Fe());
|
|
4286
|
+
} catch {
|
|
4287
|
+
T();
|
|
4288
|
+
}
|
|
4289
|
+
})());
|
|
4290
|
+
}, Vr = zo.map(
|
|
4291
|
+
(e) => Gr.filter(
|
|
4292
|
+
(r) => {
|
|
4293
|
+
var o;
|
|
4294
|
+
return (((o = r.source) == null ? void 0 : o.kind) ?? "kit") === e;
|
|
4295
|
+
}
|
|
4296
|
+
)
|
|
4297
|
+
), bi = Vr.every(
|
|
4298
|
+
(e) => e.length > 0
|
|
4299
|
+
), vi = Gr.length > 0 ? /* @__PURE__ */ t(
|
|
4300
|
+
Hl,
|
|
4301
|
+
{
|
|
4302
|
+
groupedExtensions: Vr,
|
|
4303
|
+
showExtensionGroups: bi,
|
|
4304
|
+
extensionPending: yn,
|
|
4305
|
+
extensionSession: Se,
|
|
4306
|
+
extensionError: vn,
|
|
4307
|
+
openExtension: pi,
|
|
4308
|
+
closeExtension: Fe,
|
|
4309
|
+
saveSelection: bt,
|
|
4310
|
+
closeSignal: _o,
|
|
4311
|
+
restoreFocusOnCloseRef: ur
|
|
4312
|
+
}
|
|
4313
|
+
) : void 0, Kr = !!(j || ve), Wr = !!(ie || ge || J || Kr || ne), yi = !xe && !w && (ze ?? Wr), wi = x(
|
|
4314
|
+
() => {
|
|
4315
|
+
var e;
|
|
4316
|
+
return ((e = q.current) == null ? void 0 : e.querySelector(".redactor-in")) ?? null;
|
|
4317
|
+
},
|
|
4318
|
+
[]
|
|
4319
|
+
);
|
|
4320
|
+
return /* @__PURE__ */ C(
|
|
4321
|
+
"div",
|
|
4322
|
+
{
|
|
4323
|
+
ref: q,
|
|
4324
|
+
className: [Rl(), I].filter(Boolean).join(" "),
|
|
4325
|
+
"data-component": "rich-text-editor",
|
|
4326
|
+
"data-component-id": n,
|
|
4327
|
+
"data-min-height": b,
|
|
4328
|
+
children: [
|
|
4329
|
+
!xe && !w ? /* @__PURE__ */ t(
|
|
4330
|
+
pl,
|
|
4331
|
+
{
|
|
4332
|
+
run: rt,
|
|
4333
|
+
active: Mn,
|
|
4334
|
+
preset: f,
|
|
4335
|
+
tools: v,
|
|
4336
|
+
insertHtml: ot,
|
|
4337
|
+
insertTable: Jo,
|
|
4338
|
+
saveSelection: bt,
|
|
4339
|
+
restoreSelection: Me,
|
|
4340
|
+
getSelectedText: Wo,
|
|
4341
|
+
uploadImage: D || F ? yr : void 0,
|
|
4342
|
+
enableColor: (m == null ? void 0 : m.includes("fontcolor")) ?? !1,
|
|
4343
|
+
enableFontSize: (m == null ? void 0 : m.includes("fontsize")) ?? !1,
|
|
4344
|
+
enableImage: !!(D || F),
|
|
4345
|
+
enableTable: lr,
|
|
4346
|
+
showExtensions: p,
|
|
4347
|
+
extensionControl: vi,
|
|
4348
|
+
variables: hr,
|
|
4349
|
+
recentVariableTokens: Ie,
|
|
4350
|
+
insertVariable: ci
|
|
4351
|
+
}
|
|
4352
|
+
) : null,
|
|
4353
|
+
/* @__PURE__ */ C("div", { className: "ds:relative", ref: Be, children: [
|
|
4354
|
+
/* @__PURE__ */ t(
|
|
4355
|
+
"textarea",
|
|
4356
|
+
{
|
|
4357
|
+
ref: S,
|
|
4358
|
+
id: ae,
|
|
4359
|
+
"aria-label": ln,
|
|
4360
|
+
"aria-multiline": "true",
|
|
4361
|
+
"aria-busy": cn || void 0,
|
|
4362
|
+
placeholder: $t || void 0,
|
|
4363
|
+
onChange: xe ? li : void 0,
|
|
4364
|
+
readOnly: xe ? w : void 0,
|
|
4365
|
+
className: xe ? Ll() : void 0
|
|
4366
|
+
}
|
|
4367
|
+
),
|
|
4368
|
+
cn ? /* @__PURE__ */ t(
|
|
4369
|
+
"div",
|
|
4370
|
+
{
|
|
4371
|
+
"aria-hidden": "true",
|
|
4372
|
+
className: "ds:absolute ds:inset-0 ds:z-[5] ds:flex ds:items-center ds:justify-center ds:cursor-wait ds:rounded-[var(--radius-md)] ds:bg-[color-mix(in_srgb,var(--background)_40%,transparent)]",
|
|
4373
|
+
children: /* @__PURE__ */ t(tr, { size: "lg", variant: "prism" })
|
|
4374
|
+
}
|
|
4375
|
+
) : null,
|
|
4376
|
+
/* @__PURE__ */ C("div", { className: "ds:sticky ds:bottom-0 ds:z-10", children: [
|
|
4377
|
+
ut.length > 0 ? /* @__PURE__ */ C(
|
|
4378
|
+
"div",
|
|
4379
|
+
{
|
|
4380
|
+
ref: Or,
|
|
4381
|
+
className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10",
|
|
4382
|
+
"data-ai-sparkle": it.props["data-ai-sparkle"],
|
|
4383
|
+
children: [
|
|
4384
|
+
/* @__PURE__ */ C("div", { className: Ni, children: [
|
|
4385
|
+
ut.map((e, r) => {
|
|
4386
|
+
const o = /* @__PURE__ */ t(
|
|
4387
|
+
"button",
|
|
4388
|
+
{
|
|
4389
|
+
type: "button",
|
|
4390
|
+
onClick: e.onClick,
|
|
4391
|
+
"aria-pressed": (e.pressed ?? e.recording) || void 0,
|
|
4392
|
+
"aria-busy": e.running || void 0,
|
|
4393
|
+
"aria-haspopup": e.menu ? "menu" : void 0,
|
|
4394
|
+
"data-component-part": `ai-${e.key}`,
|
|
4395
|
+
disabled: cn && !e.running || void 0,
|
|
4396
|
+
"aria-label": e.label,
|
|
4397
|
+
className: e.recording ? Il : _l,
|
|
4398
|
+
children: e.icon
|
|
4399
|
+
}
|
|
4400
|
+
);
|
|
4401
|
+
return /* @__PURE__ */ C(Bt, { children: [
|
|
4402
|
+
r > 0 ? /* @__PURE__ */ t(
|
|
4403
|
+
"span",
|
|
4404
|
+
{
|
|
4405
|
+
"aria-hidden": "true",
|
|
4406
|
+
className: Ti
|
|
4407
|
+
}
|
|
4408
|
+
) : null,
|
|
4409
|
+
At(
|
|
4410
|
+
e.menu ? jr(o, "document") : o,
|
|
4411
|
+
qe
|
|
4412
|
+
)
|
|
4413
|
+
] }, e.key);
|
|
4414
|
+
}),
|
|
4415
|
+
it.state ? /* @__PURE__ */ t(
|
|
4416
|
+
"span",
|
|
4417
|
+
{
|
|
4418
|
+
"aria-hidden": "true",
|
|
4419
|
+
className: `${Ei} ${it.props.className}`
|
|
4420
|
+
}
|
|
4421
|
+
) : null
|
|
4422
|
+
] }),
|
|
4423
|
+
/* @__PURE__ */ t(Ri, { state: it.state })
|
|
4424
|
+
]
|
|
4425
|
+
}
|
|
4426
|
+
) : null,
|
|
4427
|
+
/* @__PURE__ */ t(
|
|
4428
|
+
Kn,
|
|
4429
|
+
{
|
|
4430
|
+
open: !!(Se && (!yn || vn)),
|
|
4431
|
+
onClose: Fe,
|
|
4432
|
+
title: Se ? Co(H, Se.extension.label) : void 0,
|
|
4433
|
+
children: vn ? /* @__PURE__ */ t(xo, {}) : /* @__PURE__ */ t("div", { className: "ds:overflow-y-auto ds:[max-block-size:min(60dvh,calc(var(--rich-text-editor-min-block-size)*3))]", children: (Ur = Se == null ? void 0 : (Xr = Se.extension).render) == null ? void 0 : Ur.call(
|
|
4434
|
+
Xr,
|
|
4435
|
+
Se.context
|
|
4436
|
+
) })
|
|
4437
|
+
}
|
|
4438
|
+
),
|
|
4439
|
+
ve ? ve({
|
|
4440
|
+
open: et && !_e,
|
|
4441
|
+
onClose: () => {
|
|
4442
|
+
Xe(!1), zt(!1);
|
|
4443
|
+
},
|
|
4444
|
+
selectionText: Ho,
|
|
4445
|
+
scope: Oo,
|
|
4446
|
+
creditsExhausted: mr,
|
|
4447
|
+
getHTML: Ue.getHTML,
|
|
4448
|
+
getText: Ue.getText,
|
|
4449
|
+
// All three write seams put AI output into the note, so
|
|
4450
|
+
// each one is an action landing and sparkles the pill.
|
|
4451
|
+
insertAtSelection: (e) => {
|
|
4452
|
+
jt.current && (Le.current = jt.current.cloneRange()), Me(), ke(e, { asHtml: !0 }), z && Ge();
|
|
4453
|
+
},
|
|
4454
|
+
insertAfterSelection: (e) => {
|
|
4455
|
+
const r = jt.current ?? Le.current;
|
|
4456
|
+
if (r) {
|
|
4457
|
+
const o = r.cloneRange();
|
|
4458
|
+
o.collapse(!1), Le.current = o;
|
|
4459
|
+
}
|
|
4460
|
+
Me(), ke(e, { asHtml: !0 }), z && Ge();
|
|
4461
|
+
},
|
|
4462
|
+
setContent: (e) => {
|
|
4463
|
+
Ue.setContent(e), z && Ge();
|
|
4464
|
+
},
|
|
4465
|
+
onDictate: ne,
|
|
4466
|
+
privacyNotice: zr
|
|
4467
|
+
}) : j ? /* @__PURE__ */ t(
|
|
4468
|
+
Is,
|
|
4469
|
+
{
|
|
4470
|
+
open: et && !_e,
|
|
4471
|
+
onClose: () => {
|
|
4472
|
+
Xe(!1), zt(!1);
|
|
4473
|
+
},
|
|
4474
|
+
onRequestAiDraft: j,
|
|
4475
|
+
creditsExhausted: mr,
|
|
4476
|
+
onCreditsExhausted: () => {
|
|
4477
|
+
var e;
|
|
4478
|
+
return (e = Oe.current) == null ? void 0 : e.call(Oe);
|
|
4479
|
+
},
|
|
4480
|
+
onInsert: (e) => {
|
|
4481
|
+
Me(), ke(e, { asHtml: V !== "text" }), z && Ge();
|
|
4482
|
+
},
|
|
4483
|
+
previewAsHtml: V !== "text",
|
|
4484
|
+
privacyNotice: zr,
|
|
4485
|
+
onDictate: ne
|
|
4486
|
+
}
|
|
4487
|
+
) : null,
|
|
4488
|
+
M ? /* @__PURE__ */ t(
|
|
4489
|
+
Kn,
|
|
4490
|
+
{
|
|
4491
|
+
open: nn !== null,
|
|
4492
|
+
onClose: In,
|
|
4493
|
+
ariaLabel: H(
|
|
4494
|
+
"editor.ai.consentRegionLabel",
|
|
4495
|
+
"AI assistance consent for this document"
|
|
4496
|
+
),
|
|
4497
|
+
footer: /* @__PURE__ */ t($e, { intent: "ghost", size: "sm", onClick: In, children: H("common.close") }),
|
|
4498
|
+
children: /* @__PURE__ */ t(
|
|
4499
|
+
Si,
|
|
4500
|
+
{
|
|
4501
|
+
granted: M.granted,
|
|
4502
|
+
grantedAt: M.grantedAt,
|
|
4503
|
+
grantedBy: M.grantedBy,
|
|
4504
|
+
canGrant: (M.canGrant ?? !0) && M.onGrant !== void 0,
|
|
4505
|
+
pending: oi,
|
|
4506
|
+
onGrantConsent: ii,
|
|
4507
|
+
headingLevel: Ee,
|
|
4508
|
+
"aria-label": H(
|
|
4509
|
+
"editor.ai.consentRegionLabel",
|
|
4510
|
+
"AI assistance consent for this document"
|
|
4511
|
+
)
|
|
4512
|
+
}
|
|
4513
|
+
)
|
|
4514
|
+
}
|
|
4515
|
+
) : null
|
|
4516
|
+
] }),
|
|
4517
|
+
!xe && !w && lr ? /* @__PURE__ */ t(
|
|
4518
|
+
tl,
|
|
4519
|
+
{
|
|
4520
|
+
active: Mn,
|
|
4521
|
+
run: rt,
|
|
4522
|
+
areaRef: Be,
|
|
4523
|
+
getActiveTableEl: Xo,
|
|
4524
|
+
enableColor: Lo,
|
|
4525
|
+
saveTableCell: Uo,
|
|
4526
|
+
applyTableBackground: Zo
|
|
4527
|
+
}
|
|
4528
|
+
) : null,
|
|
4529
|
+
!xe && !w ? /* @__PURE__ */ t(
|
|
4530
|
+
ul,
|
|
4531
|
+
{
|
|
4532
|
+
areaRef: Be,
|
|
4533
|
+
activeImageEl: Po,
|
|
4534
|
+
applyImageClass: Qo,
|
|
4535
|
+
setImageWidth: Yo
|
|
4536
|
+
}
|
|
4537
|
+
) : null,
|
|
4538
|
+
yi ? /* @__PURE__ */ t(
|
|
4539
|
+
gl,
|
|
4540
|
+
{
|
|
4541
|
+
active: Mn,
|
|
4542
|
+
run: rt,
|
|
4543
|
+
areaRef: Be,
|
|
4544
|
+
getEditorRoot: wi,
|
|
4545
|
+
suppressed: cn || et || nn !== null || Se !== null,
|
|
4546
|
+
holdOpen: mi,
|
|
4547
|
+
children: Wr ? /* @__PURE__ */ C(Ze, { children: [
|
|
4548
|
+
ne ? At(
|
|
4549
|
+
/* @__PURE__ */ t(
|
|
4550
|
+
te,
|
|
4551
|
+
{
|
|
4552
|
+
size: "sm",
|
|
4553
|
+
intent: "ghost",
|
|
4554
|
+
"data-component-part": "selection-ai-dictate",
|
|
4555
|
+
onMouseDown: It,
|
|
4556
|
+
icon: Pn ? /* @__PURE__ */ t(Wn, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : Te ? /* @__PURE__ */ t(Dt, {}) : /* @__PURE__ */ t(Xn, {}),
|
|
4557
|
+
"aria-pressed": Te,
|
|
4558
|
+
...hn(
|
|
4559
|
+
H(Te ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
|
|
4560
|
+
!!qe
|
|
4561
|
+
),
|
|
4562
|
+
onClick: () => Er("selection")
|
|
4563
|
+
}
|
|
4564
|
+
),
|
|
4565
|
+
qe
|
|
4566
|
+
) : null,
|
|
4567
|
+
ie ? At(
|
|
4568
|
+
jr(
|
|
4569
|
+
/* @__PURE__ */ t(
|
|
4570
|
+
$e,
|
|
4571
|
+
{
|
|
4572
|
+
size: "sm",
|
|
4573
|
+
intent: "ghost",
|
|
4574
|
+
"data-component-part": "selection-ai-templates",
|
|
4575
|
+
onMouseDown: It,
|
|
4576
|
+
startIcon: /* @__PURE__ */ t(Un, {}),
|
|
4577
|
+
endIcon: /* @__PURE__ */ t(or, {}),
|
|
4578
|
+
children: H("editor.ai.templates")
|
|
4579
|
+
}
|
|
4580
|
+
),
|
|
4581
|
+
"selection"
|
|
4582
|
+
),
|
|
4583
|
+
qe
|
|
4584
|
+
) : null,
|
|
4585
|
+
ge ? At(
|
|
4586
|
+
/* @__PURE__ */ t(
|
|
4587
|
+
te,
|
|
4588
|
+
{
|
|
4589
|
+
size: "sm",
|
|
4590
|
+
intent: "ghost",
|
|
4591
|
+
"data-component-part": "selection-ai-proofread",
|
|
4592
|
+
onMouseDown: It,
|
|
4593
|
+
icon: /* @__PURE__ */ t(Qr, {}),
|
|
4594
|
+
...hn(
|
|
4595
|
+
H("editor.ai.proofread"),
|
|
4596
|
+
!!qe
|
|
4597
|
+
),
|
|
4598
|
+
onClick: () => Ht(
|
|
4599
|
+
"proofread",
|
|
4600
|
+
ge,
|
|
4601
|
+
dt("selection")
|
|
4602
|
+
)
|
|
4603
|
+
}
|
|
4604
|
+
),
|
|
4605
|
+
qe
|
|
4606
|
+
) : null,
|
|
4607
|
+
J ? At(
|
|
4608
|
+
/* @__PURE__ */ t(
|
|
4609
|
+
te,
|
|
4610
|
+
{
|
|
4611
|
+
size: "sm",
|
|
4612
|
+
intent: "ghost",
|
|
4613
|
+
"data-component-part": "selection-ai-format",
|
|
4614
|
+
onMouseDown: It,
|
|
4615
|
+
icon: /* @__PURE__ */ t(Yr, {}),
|
|
4616
|
+
...hn(
|
|
4617
|
+
H("editor.ai.autoFormat"),
|
|
4618
|
+
!!qe
|
|
4619
|
+
),
|
|
4620
|
+
onClick: () => Ht(
|
|
4621
|
+
"format",
|
|
4622
|
+
J,
|
|
4623
|
+
dt("selection")
|
|
4624
|
+
)
|
|
4625
|
+
}
|
|
4626
|
+
),
|
|
4627
|
+
qe
|
|
4628
|
+
) : null,
|
|
4629
|
+
Kr ? At(
|
|
4630
|
+
/* @__PURE__ */ t(
|
|
4631
|
+
te,
|
|
4632
|
+
{
|
|
4633
|
+
size: "sm",
|
|
4634
|
+
intent: "ghost",
|
|
4635
|
+
"data-component-part": "selection-ai-write",
|
|
4636
|
+
onMouseDown: It,
|
|
4637
|
+
icon: /* @__PURE__ */ t(Zr, {}),
|
|
4638
|
+
...hn(
|
|
4639
|
+
H("editor.ai.helpMeWrite"),
|
|
4640
|
+
!!qe
|
|
4641
|
+
),
|
|
4642
|
+
onClick: () => Mr("selection")
|
|
4643
|
+
}
|
|
4644
|
+
),
|
|
4645
|
+
qe
|
|
4646
|
+
) : null
|
|
4647
|
+
] }) : null
|
|
4648
|
+
}
|
|
4649
|
+
) : null,
|
|
4650
|
+
pt ? /* @__PURE__ */ t(
|
|
4651
|
+
"div",
|
|
4652
|
+
{
|
|
4653
|
+
className: Sl,
|
|
4654
|
+
style: {
|
|
4655
|
+
"--rte-typeahead-x": `${pt.left}px`,
|
|
4656
|
+
"--rte-typeahead-y": `${pt.top}px`
|
|
4657
|
+
},
|
|
4658
|
+
children: /* @__PURE__ */ t(
|
|
4659
|
+
vo,
|
|
4660
|
+
{
|
|
4661
|
+
ref: br,
|
|
4662
|
+
id: Ln,
|
|
4663
|
+
variables: hr,
|
|
4664
|
+
recentTokens: Ie,
|
|
4665
|
+
query: pt.query,
|
|
4666
|
+
onQueryChange: Ko,
|
|
4667
|
+
onSelect: Go,
|
|
4668
|
+
onClose: Vo,
|
|
4669
|
+
searchFocusable: !1,
|
|
4670
|
+
onActiveDescendantChange: jo
|
|
4671
|
+
}
|
|
4672
|
+
)
|
|
4673
|
+
}
|
|
4674
|
+
) : null
|
|
4675
|
+
] }),
|
|
4676
|
+
ne ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: ni }) : null,
|
|
4677
|
+
gt.length > 0 ? /* @__PURE__ */ t(
|
|
4678
|
+
"p",
|
|
4679
|
+
{
|
|
4680
|
+
id: `${ae}-variables-error`,
|
|
4681
|
+
role: "alert",
|
|
4682
|
+
className: "ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
4683
|
+
children: H("editor.variableInvalid", {
|
|
4684
|
+
tokens: gt.map((e) => `[[${e}]]`).join(", ")
|
|
4685
|
+
})
|
|
4686
|
+
}
|
|
4687
|
+
) : null,
|
|
4688
|
+
ne && ti ? /* @__PURE__ */ t(
|
|
4689
|
+
"p",
|
|
4690
|
+
{
|
|
4691
|
+
role: "alert",
|
|
4692
|
+
className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
4693
|
+
children: H("editor.ai.dictationError")
|
|
4694
|
+
}
|
|
4695
|
+
) : null,
|
|
4696
|
+
ie || ge || J ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: si }) : null,
|
|
4697
|
+
ai || Rr ? /* @__PURE__ */ t(
|
|
4698
|
+
"p",
|
|
4699
|
+
{
|
|
4700
|
+
role: "alert",
|
|
4701
|
+
className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
|
|
4702
|
+
children: H(Rr ? "editor.ai.actionStale" : "editor.ai.actionError")
|
|
4703
|
+
}
|
|
4704
|
+
) : null
|
|
4705
|
+
]
|
|
4706
|
+
}
|
|
4707
|
+
);
|
|
4708
|
+
}
|
|
4709
|
+
);
|
|
4710
|
+
$l.displayName = "RichTextEditor";
|
|
4711
|
+
export {
|
|
4712
|
+
$l as R,
|
|
4713
|
+
Ms as r,
|
|
4714
|
+
Rl as w
|
|
4715
|
+
};
|
|
4716
|
+
//# sourceMappingURL=rich-text-editor-DTadvKa7.js.map
|