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