@panphora/clayjs 1.25.1 → 1.26.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 (105) hide show
  1. package/dist/all.js +1 -1
  2. package/dist/clay-dom.js +1 -1
  3. package/dist/clay-events.js +1 -1
  4. package/dist/clay-internals.js +1 -1
  5. package/dist/clay-options.js +1 -1
  6. package/dist/clay-router.js +1 -1
  7. package/dist/clay-ui.js +1 -1
  8. package/dist/clay-utils.js +1 -1
  9. package/dist/clay.js +1 -1
  10. package/dist/clay.standalone.js +1141 -345
  11. package/dist/m/c-2EPHRF47.js +1 -0
  12. package/dist/m/{c-2GB34XL4.js → c-2SUFMUZX.js} +2 -2
  13. package/dist/m/{c-BHLYQGTA.js → c-3S3647J6.js} +1 -1
  14. package/dist/m/{c-QL4NYM2L.js → c-3S5TNRZA.js} +1 -1
  15. package/dist/m/{c-3Y234AUB.js → c-3XGLJAS7.js} +2 -2
  16. package/dist/m/{c-O4YIDULY.js → c-42WBOKFM.js} +1 -1
  17. package/dist/m/{c-42RLKGEY.js → c-4TP3UXBT.js} +1 -1
  18. package/dist/m/{c-ASGHHLFX.js → c-5ELELG2F.js} +1 -1
  19. package/dist/m/{c-T5IWJOMW.js → c-5ZYLTN3Q.js} +1 -1
  20. package/dist/m/{c-DDCYVLGG.js → c-67TBU56I.js} +1 -1
  21. package/dist/m/{c-WNOLMHI2.js → c-6BGJAJ67.js} +1 -1
  22. package/dist/m/{c-XS7G6U3Z.js → c-ABOBD7F3.js} +1 -1
  23. package/dist/m/{c-5IIEOPIV.js → c-ARO6CPMA.js} +1 -1
  24. package/dist/m/{c-XUZMRQ7O.js → c-BCS3AZQZ.js} +1 -1
  25. package/dist/m/c-BOS7GONO.js +1 -0
  26. package/dist/m/{c-NICICT4P.js → c-DEYHCYJB.js} +1 -1
  27. package/dist/m/{c-T7LOTEWO.js → c-DZT6W2NG.js} +1 -1
  28. package/dist/m/c-EHJWIGWN.js +1 -0
  29. package/dist/m/{c-V2V5FKXX.js → c-EIUKME3W.js} +1 -1
  30. package/dist/m/{c-ASMLERFA.js → c-EXZOA6XY.js} +1 -1
  31. package/dist/m/{c-STAPQ2X6.js → c-EYFMAR3M.js} +1 -1
  32. package/dist/m/{c-DVMDYRAE.js → c-FUN6AKFE.js} +1 -1
  33. package/dist/m/{c-XMIDHEKF.js → c-GY36NO7C.js} +1 -1
  34. package/dist/m/{c-TWB5ZQU4.js → c-H47C6PJZ.js} +1 -1
  35. package/dist/m/c-KD2ME5UN.js +2 -0
  36. package/dist/m/{c-GO635CRU.js → c-LAKBBJOU.js} +2 -2
  37. package/dist/m/{c-GNFDX6SU.js → c-LETPPG2F.js} +1 -1
  38. package/dist/m/{c-LS7IVQVW.js → c-MMV5JULA.js} +1 -1
  39. package/dist/m/{c-NEQRFC4O.js → c-MVVEIJUU.js} +1 -1
  40. package/dist/m/{c-XCOQNISP.js → c-N362HNGO.js} +1 -1
  41. package/dist/m/{c-7K4SCQB7.js → c-ND3W7D5U.js} +1 -1
  42. package/dist/m/{c-4NAYDOWH.js → c-NNHNXD6M.js} +1 -1
  43. package/dist/m/{c-DAUQ6JZ3.js → c-NYJ577NL.js} +1 -1
  44. package/dist/m/{c-3AAQJAKJ.js → c-PWILUN4T.js} +1 -1
  45. package/dist/m/{c-7Z2625LX.js → c-QA3Q3MDI.js} +1 -1
  46. package/dist/m/{c-2A2ATCIH.js → c-QKOKMQXA.js} +1 -1
  47. package/dist/m/{c-TGIMBAWE.js → c-RBWVF4N5.js} +1 -1
  48. package/dist/m/{c-A5IYL7JI.js → c-SPOEDIMP.js} +1 -1
  49. package/dist/m/{c-ZJ7726FO.js → c-SRW5OBCF.js} +1 -1
  50. package/dist/m/{c-A3OKSYRI.js → c-SYOA4T7V.js} +1 -1
  51. package/dist/m/{c-MHTO3QAD.js → c-TJ5PFOJ2.js} +1 -1
  52. package/dist/m/{c-NW4ZFKCY.js → c-TKV273YU.js} +1 -1
  53. package/dist/m/{c-D4N4UJCQ.js → c-UEKJWXCB.js} +2 -2
  54. package/dist/m/{c-44WITKWQ.js → c-V4DBV5ZV.js} +1 -1
  55. package/dist/m/c-WHMZCRQD.js +6 -0
  56. package/dist/m/{c-WMRJKQ2V.js → c-WHQUZM2V.js} +1 -1
  57. package/dist/m/{c-C27EVUQ6.js → c-XHD7XJTE.js} +1 -1
  58. package/dist/m/{c-PP3CUF3U.js → c-XONFK3WC.js} +1 -1
  59. package/dist/m/c-YYIN4NAF.js +30 -0
  60. package/dist/m/c-ZFAPQQIB.js +1 -0
  61. package/dist/m/core/{conflict-notice-Y2NTMDGJ.js → conflict-notice-UNDOD4BL.js} +1 -1
  62. package/dist/m/core/site-edits-C22O53GS.js +1 -0
  63. package/dist/m/loader-DCKCZKY6.js +1 -0
  64. package/dist/m/{manifest-A27A4278.js → manifest-7954CBE3.js} +1 -1
  65. package/dist/m/{manifest-edit-E8A61EB4.js → manifest-edit-93AA79D7.js} +1 -1
  66. package/dist/m/manifest.json +442 -441
  67. package/dist/m/page/{editor-HS2CAV3W.js → editor-UF3CIA6V.js} +2 -2
  68. package/dist/m/plugins/{cms-4KET6RZT.js → cms-KG6TCTR3.js} +1 -1
  69. package/dist/m/plugins/{live-CO4VJS46.js → live-DF5YS5AH.js} +1 -1
  70. package/dist/m/plugins/page-GZSU77JS.js +2 -0
  71. package/dist/m/plugins/{page-view-6KNTXABH.js → page-view-7MM3FEAR.js} +1 -1
  72. package/dist/m/plugins/{quickcrop-VNRXGRPC.js → quickcrop-UHURKA2F.js} +2 -2
  73. package/dist/m/plugins/richclay-MXH2GFAZ.js +549 -0
  74. package/dist/m/plugins/undo-KLHAGV75.js +1 -0
  75. package/dist/m/sync/{live-sync-DX4K5GDB.js → live-sync-RZQSDMZW.js} +1 -1
  76. package/dist/offline-manifest.json +360 -360
  77. package/package.json +1 -1
  78. package/src/core/site-edits.js +1 -1
  79. package/src/loader-logic.js +0 -13
  80. package/src/page/boot-pack.js +1 -0
  81. package/src/page/history-intent.js +111 -4
  82. package/src/page/ybind/bridge.js +14 -7
  83. package/src/page/ybind/moves.js +437 -3
  84. package/src/page/ybind/origins.js +1 -1
  85. package/src/page/ybind/recovery.js +1 -1
  86. package/src/plugins/page.js +48 -4
  87. package/src/plugins/richclay.js +136 -0
  88. package/src/plugins/undo.js +169 -7
  89. package/src/recovery/undo.js +14 -7
  90. package/src/sync/live-sync.js +24 -0
  91. package/src/ui/vendor-skin.js +9 -4
  92. package/dist/m/c-3XNTQQEJ.js +0 -1
  93. package/dist/m/c-4OZZ7ENT.js +0 -30
  94. package/dist/m/c-D2OPWOWO.js +0 -2
  95. package/dist/m/c-LUBZU4AZ.js +0 -6
  96. package/dist/m/c-LYNLY3MR.js +0 -1
  97. package/dist/m/c-MLMJUNRV.js +0 -1
  98. package/dist/m/c-V5L6HWVL.js +0 -1
  99. package/dist/m/core/site-edits-TIJDPG6H.js +0 -1
  100. package/dist/m/loader-7ORQVRCK.js +0 -1
  101. package/dist/m/plugins/page-L3VKIQU2.js +0 -2
  102. package/dist/m/plugins/richclay-V6WKJTUF.js +0 -549
  103. package/dist/m/plugins/undo-WUK2NLBA.js +0 -1
  104. /package/dist/m/plugins/{quickcrop-VNRXGRPC.js.LEGAL.txt → quickcrop-UHURKA2F.js.LEGAL.txt} +0 -0
  105. /package/dist/m/plugins/{richclay-V6WKJTUF.js.LEGAL.txt → richclay-MXH2GFAZ.js.LEGAL.txt} +0 -0
@@ -0,0 +1,549 @@
1
+ import{a as Oo}from"../c-KD2ME5UN.js";import"../c-J2ZW4HMR.js";import"../c-A5LASUEZ.js";import"../c-4JZDZFF6.js";import"../c-5RZNFTWD.js";import"../c-PKCCHJ5X.js";import{a as br,b as vr}from"../c-FILLTJA7.js";import"../c-NUHP2XDB.js";import{k as Do}from"../c-C7SUMNMI.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-U4TWEIKZ.js";import{b as No}from"../c-HA6INT6J.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var Ro=[".richclay-toolbar",".richclay-float",".richclay-dialog"],Io=`@layer clay-skin{
2
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog),:is(.richclay-toolbar, .richclay-float, .richclay-dialog) *{--richclay-surface:light-dark(#FFFCF6, #11131E) !important;--richclay-surface-alt:light-dark(#F4ECDF, #1A1D2C) !important;--richclay-text:light-dark(#2B241B, #ECEAF2) !important;--richclay-muted:light-dark(#6B5942, #8A90AB) !important;--richclay-border:light-dark(#D8C8AF, #353B52) !important;--richclay-accent:light-dark(#8F6310, #D9A445) !important;--richclay-accent-ink:light-dark(#FDF8F0, #0B0C13) !important;--richclay-focus:light-dark(#8F6310, #D9A445) !important;--richclay-danger:light-dark(#A83A2C, #FF5566) !important;--richclay-radius:0px !important;--richclay-control-size:32px !important;--richclay-shadow:0 1px 2px rgba(0,0,0,.12),0 10px 28px -12px rgba(0,0,0,.35) !important}
3
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog){font-family:system-ui,-apple-system,"Segoe UI",sans-serif !important}
4
+ :where(.richclay-float, .richclay-dialog):is(.richclay-toolbar, .richclay-float, .richclay-dialog){color:light-dark(#2B241B, #ECEAF2) !important;background:light-dark(#FFFCF6, #11131E) !important;border:1px solid light-dark(#D8C8AF, #353B52) !important}
5
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-toolbar{gap:3px !important;margin:0 !important;padding:8px !important;border:1px solid light-dark(#D8C8AF, #353B52) !important;border-radius:0 !important;background:light-dark(#F4ECDF, #1A1D2C) !important;color:light-dark(#2B241B, #ECEAF2) !important}
6
+ .richclay-toolbar:is(.richclay-toolbar, .richclay-float, .richclay-dialog){gap:3px !important;padding:8px !important;border:1px solid light-dark(#D8C8AF, #353B52) !important;border-radius:0 !important;background:light-dark(#F4ECDF, #1A1D2C) !important;color:light-dark(#2B241B, #ECEAF2) !important}
7
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-button{min-width:32px !important;height:32px !important;padding:0 7px !important;gap:6px !important;border:2px solid !important;border-color:light-dark(#FFF9ED, #3C4260) light-dark(#D6C3A5, #1B2033) light-dark(#D6C3A5, #1B2033) light-dark(#FFF9ED, #3C4260) !important;border-radius:0 !important;background:light-dark(#F1E7D4, #22273E) !important;font:14px system-ui,-apple-system,"Segoe UI",sans-serif !important;cursor:pointer !important}
8
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-button:is([aria-pressed="true"], [aria-expanded="true"]){background:light-dark(#E3D0B3, #28304D) !important;border-color:light-dark(#B89F7B, #1F2339) light-dark(#F0E1C9, #4D587A) light-dark(#F0E1C9, #4D587A) light-dark(#B89F7B, #1F2339) !important;box-shadow:none !important;color:light-dark(#2B241B, #ECEAF2) !important}
9
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-button[aria-pressed="true"] > svg{translate:1px 1px !important}
10
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-button:disabled{opacity:.45 !important;cursor:not-allowed !important}
11
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-button:hover:not([aria-pressed="true"], [aria-expanded="true"], :disabled){border-color:light-dark(#FFF9ED, #3C4260) light-dark(#D6C3A5, #1B2033) light-dark(#D6C3A5, #1B2033) light-dark(#FFF9ED, #3C4260) !important;background:color-mix(in srgb, light-dark(#F1E7D4, #22273E), light-dark(#FFF9ED, #3C4260) 45%) !important}
12
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-separator{align-self:center !important;height:22px !important;margin:0 5px !important;background:light-dark(#D8C8AF, #353B52) !important}
13
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-menu{inset-block-start:38px !important;min-width:210px !important;padding:5px !important;border-radius:0 !important;box-shadow:0 1px 2px rgba(0,0,0,.12),0 10px 28px -12px rgba(0,0,0,.35) !important}
14
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-menu-item{padding:8px 10px !important;border:0 !important;border-radius:0 !important;font:14px system-ui,-apple-system,"Segoe UI",sans-serif !important}
15
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-menu-item[aria-checked="true"]{background:light-dark(#F4ECDF, #1A1D2C) !important;box-shadow:inset 2px 0 light-dark(#8F6310, #D9A445) !important}
16
+ .richclay-dialog:is(.richclay-toolbar, .richclay-float, .richclay-dialog){width:min(100%, 360px) !important;padding:14px 16px 12px !important;border:1px solid light-dark(#D8C8AF, #353B52) !important;border-radius:0 !important;background:light-dark(#FFFCF6, #11131E) !important;color:light-dark(#2B241B, #ECEAF2) !important;box-shadow:0 1px 2px rgba(0,0,0,.12),0 10px 28px -12px rgba(0,0,0,.35) !important}
17
+ .richclay-dialog:is(.richclay-toolbar, .richclay-float, .richclay-dialog)::before{content:"" !important;position:absolute !important;left:calc(var(--richclay-dialog-arrow, 28px) - 6px) !important;top:-7px !important;width:12px !important;height:12px !important;background:light-dark(#FFFCF6, #11131E) !important;border-top:1px solid light-dark(#D8C8AF, #353B52) !important;border-left:1px solid light-dark(#D8C8AF, #353B52) !important;transform:rotate(45deg) !important}
18
+ .richclay-dialog:is(.richclay-toolbar, .richclay-float, .richclay-dialog)[data-richclay-side="above"]::before{top:auto !important;bottom:-7px !important;border:0 !important;border-right:1px solid light-dark(#D8C8AF, #353B52) !important;border-bottom:1px solid light-dark(#D8C8AF, #353B52) !important}
19
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-dialog-title{margin-bottom:2px !important;font:500 10px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace !important;text-transform:uppercase !important;letter-spacing:.12em !important}
20
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-field{gap:5px !important}
21
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-field > span{color:light-dark(#4A4033, #C9CDE0) !important;font-size:12px !important}
22
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-input{min-height:30px !important;padding:4px 8px !important;border:2px solid !important;border-color:light-dark(#B89F7B, #1F2339) light-dark(#F0E1C9, #4D587A) light-dark(#F0E1C9, #4D587A) light-dark(#B89F7B, #1F2339) !important;border-radius:0 !important;background:light-dark(#F4ECDF, #1A1D2C) !important;color:light-dark(#2B241B, #ECEAF2) !important;font:13px system-ui,-apple-system,"Segoe UI",sans-serif !important}
23
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-dialog-actions{margin-top:4px !important;padding-top:12px !important;border-top:1px solid light-dark(#E8DCC6, #262B42) !important;flex-wrap:wrap !important}
24
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) :is(.richclay-primary, .richclay-secondary){min-height:30px !important;padding:4px 10px !important;border:2px solid !important;border-color:light-dark(#FFF9ED, #3C4260) light-dark(#D6C3A5, #1B2033) light-dark(#D6C3A5, #1B2033) light-dark(#FFF9ED, #3C4260) !important;border-radius:0 !important;background:light-dark(#F1E7D4, #22273E) !important;color:light-dark(#2B241B, #ECEAF2) !important;font:13px system-ui,-apple-system,"Segoe UI",sans-serif !important}
25
+ :is(.richclay-toolbar, .richclay-float, .richclay-dialog) .richclay-primary{background:light-dark(#2B241B, #ECEAF2) !important;color:light-dark(#FDF8F0, #0B0C13) !important;border-color:color-mix(in srgb, light-dark(#2B241B, #ECEAF2), white 24%) color-mix(in srgb, light-dark(#2B241B, #ECEAF2), black 32%) color-mix(in srgb, light-dark(#2B241B, #ECEAF2), black 32%) color-mix(in srgb, light-dark(#2B241B, #ECEAF2), white 24%) !important}
26
+ .richclay-float:is(.richclay-toolbar, .richclay-float, .richclay-dialog){border-radius:0 !important;box-shadow:0 1px 2px rgba(0,0,0,.12),0 10px 28px -12px rgba(0,0,0,.35) !important}
27
+ .richclay-float:is(.richclay-toolbar, .richclay-float, .richclay-dialog) > .richclay-toolbar{padding:5px !important}
28
+ .richclay-toolbar{align-items:center !important;background:var(--richclay-surface-alt) !important;border:1px solid var(--richclay-border) !important;border-radius:var(--richclay-radius) !important;color:var(--richclay-text) !important;display:flex !important;flex-wrap:wrap !important;gap:2px !important;margin-block:0 6px !important;padding:4px !important}
29
+ .richclay-toolbar:has(+ .richclay-editor){margin-block-end:0 !important;border-bottom-left-radius:0 !important;border-bottom-right-radius:0 !important}
30
+ .richclay-button{align-items:center !important;appearance:none !important;background:transparent !important;border:1px solid transparent !important;border-radius:5px !important;color:currentColor !important;display:inline-flex !important;height:var(--richclay-control-size) !important;justify-content:center !important;margin:0 !important;min-width:var(--richclay-control-size) !important;padding:0 !important;position:relative !important}
31
+ .richclay-button:hover,.richclay-button[aria-expanded="true"],.richclay-menu-item:hover{background:var(--richclay-surface) !important;border-color:var(--richclay-border) !important}
32
+ .richclay-button.is-active,.richclay-button[aria-pressed="true"],.richclay-menu-item.is-active{background:rgb(0 0 0 / 0.13) !important;border-color:rgb(0 0 0 / 0.22) !important;color:var(--richclay-text) !important;box-shadow:inset 0 1px 3px rgb(0 0 0 / 0.26) !important}
33
+ .richclay-button:focus-visible,.richclay-menu-item:focus-visible,.richclay-input:focus-visible,.richclay-primary:focus-visible,.richclay-secondary:focus-visible{outline:3px solid var(--richclay-focus) !important;outline-offset:2px !important}
34
+ .richclay-button:disabled{color:var(--richclay-muted) !important;cursor:not-allowed !important;opacity:0.55 !important}
35
+ .richclay-separator{align-self:stretch !important;background:var(--richclay-border) !important;display:inline-block !important;margin:5px 4px !important;width:1px !important}
36
+ .richclay-menu-wrap{display:inline-flex !important;position:relative !important}
37
+ .richclay-menu{background:var(--richclay-surface) !important;border:1px solid var(--richclay-border) !important;border-radius:var(--richclay-radius) !important;box-shadow:var(--richclay-shadow) !important;color:var(--richclay-text) !important;display:grid !important;gap:2px !important;inset-block-start:calc(100% + 4px) !important;inset-inline-start:0 !important;min-width:160px !important;padding:4px !important;position:absolute !important;z-index:1000 !important}
38
+ .richclay-menu[hidden]{display:none !important}
39
+ .richclay-menu-item{align-items:center !important;appearance:none !important;background:transparent !important;border:1px solid transparent !important;border-radius:4px !important;color:inherit !important;display:flex !important;font:inherit !important;gap:8px !important;min-height:32px !important;padding:5px 9px !important;text-align:start !important}
40
+ .richclay-float{left:0 !important;position:fixed !important;top:0 !important;will-change:transform !important;z-index:99999 !important}
41
+ .richclay-float .richclay-toolbar{box-shadow:var(--richclay-shadow) !important;margin-block:0 !important}
42
+ .richclay-float-rail .richclay-toolbar{--richclay-control-size:28px !important;flex-direction:column !important;flex-wrap:nowrap !important}
43
+ .richclay-float-rail .richclay-toolbar svg{height:15px !important;width:15px !important}
44
+ .richclay-float-rail .richclay-separator{align-self:stretch !important;height:1px !important;margin:4px 5px !important;width:auto !important}
45
+ .richclay-float-rail .richclay-menu{inset-block-start:0 !important;inset-inline-start:calc(100% + 4px) !important}
46
+ .richclay-dialog{background:var(--richclay-surface) !important;border:1px solid var(--richclay-border) !important;border-radius:var(--richclay-radius) !important;box-shadow:var(--richclay-shadow) !important;color:var(--richclay-text) !important;display:grid !important;gap:10px !important;box-sizing:border-box !important;width:min(420px, calc(100vw - 16px)) !important;z-index:99999 !important;padding:12px !important}
47
+ .richclay-dialog-title{font-weight:650 !important}
48
+ .richclay-dialog.richclay-link-popover{align-items:center !important;display:flex !important;gap:6px !important;max-width:min(420px, calc(100vw - 16px)) !important;padding:6px !important;width:auto !important}
49
+ .richclay-link-address{color:inherit !important;font-size:0.875rem !important;max-width:260px !important;overflow:hidden !important;padding:0 6px !important;text-overflow:ellipsis !important;white-space:nowrap !important}
50
+ .richclay-link-popover .richclay-secondary{min-height:30px !important;padding:3px 9px !important}
51
+ .richclay-field{display:grid !important;gap:4px !important}
52
+ .richclay-field span{color:var(--richclay-muted) !important;font-size:0.875rem !important}
53
+ .richclay-input{background:var(--richclay-surface) !important;border:1px solid var(--richclay-border) !important;border-radius:4px !important;color:var(--richclay-text) !important;font:inherit !important;min-height:36px !important;padding:6px 8px !important}
54
+ .richclay-dialog-actions{display:flex !important;gap:8px !important;justify-content:flex-end !important}
55
+ .richclay-dialog-actions [data-richclay-remove-link]{margin-inline-end:auto !important}
56
+ .richclay-primary,.richclay-secondary{appearance:none !important;border:1px solid var(--richclay-border) !important;border-radius:4px !important;font:inherit !important;min-height:34px !important;padding:5px 10px !important}
57
+ .richclay-primary{background:var(--richclay-accent) !important;border-color:var(--richclay-accent) !important;color:var(--richclay-accent-ink) !important}
58
+ .richclay-secondary{background:var(--richclay-surface-alt) !important;color:var(--richclay-text) !important}
59
+ .richclay-sr-only{border:0 !important;clip:rect(0 0 0 0) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;white-space:nowrap !important;width:1px !important}
60
+ @media (forced-colors: active){
61
+ .richclay-toolbar,.richclay-menu,.richclay-input{border-color:CanvasText !important}
62
+ .richclay-dialog{border-color:CanvasText !important}
63
+ .richclay-button.is-active,.richclay-button[aria-pressed="true"],.richclay-menu-item.is-active,.richclay-primary{background:Highlight !important;color:HighlightText !important}
64
+ .richclay-button:focus-visible,.richclay-menu-item:focus-visible,.richclay-input:focus-visible{outline-color:Highlight !important}
65
+ }
66
+ .richclay-toolbar[hidden]{display:none !important}
67
+ .richclay-button[hidden]{display:none !important}
68
+ .richclay-separator[hidden]{display:none !important}
69
+ .richclay-menu-wrap[hidden]{display:none !important}
70
+ .richclay-menu[hidden]{display:none !important}
71
+ .richclay-menu-item[hidden]{display:none !important}
72
+ .richclay-dialog[hidden]{display:none !important}
73
+ .richclay-dialog.richclay-link-popover[hidden]{display:none !important}
74
+ .richclay-field[hidden]{display:none !important}
75
+ .richclay-dialog-actions[hidden]{display:none !important}
76
+ }`;var ti=(()=>{var m=Object.defineProperty,w=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,P=Object.prototype.hasOwnProperty,Ft=(t,e)=>{for(var i in e)m(t,i,{get:e[i],enumerable:!0})},he=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of k(e))!P.call(t,n)&&n!==i&&m(t,n,{get:()=>e[n],enumerable:!(r=w(e,n))||r.enumerable});return t},Ko=t=>he(m({},"__esModule",{value:!0}),t),Cr={};Ft(Cr,{RichClay:()=>Yi,default:()=>Fs,stopAutoWatch:()=>Bs});var $o=()=>!0,ot=class{constructor(t,e,i){this.root=t,this.currentNode=t,this.nodeType=e,this.filter=i||$o}isAcceptableNode(t){let e=t.nodeType;return!!((e===Node.ELEMENT_NODE?1:e===Node.TEXT_NODE?4:0)&this.nodeType)&&this.filter(t)}nextNode(){let t=this.root,e=this.currentNode,i;for(;;){for(i=e.firstChild;!i&&e&&e!==t;)i=e.nextSibling,i||(e=e.parentNode);if(!i)return null;if(this.isAcceptableNode(i))return this.currentNode=i,i;e=i}}previousNode(){let t=this.root,e=this.currentNode,i;for(;;){if(e===t)return null;if(i=e.previousSibling,i)for(;e=i.lastChild;)i=e;else i=e.parentNode;if(!i)return null;if(this.isAcceptableNode(i))return this.currentNode=i,i;e=i}}previousPONode(){let t=this.root,e=this.currentNode,i;for(;;){for(i=e.lastChild;!i&&e&&e!==t;)i=e.previousSibling,i||(e=e.parentNode);if(!i)return null;if(this.isAcceptableNode(i))return this.currentNode=i,i;e=i}}},Pt=navigator.userAgent,ii=/Mac OS X/.test(Pt),Sr=/Windows NT/.test(Pt),kr=/iP(?:ad|hone|od)/.test(Pt)||ii&&!!navigator.maxTouchPoints,_c=/Android/.test(Pt),jo=/Gecko\//.test(Pt),Ne=/Edge\//.test(Pt),Vo=!Ne&&/WebKit\//.test(Pt),et=ii||kr?"Meta-":"Ctrl-",De=Vo,Go="onbeforeinput"in document&&"inputType"in new InputEvent("input"),ft=/[^ \t\r\n\u200B]/,Zo=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|EL|FN)|EM|FONT|HR|I(?:FRAME|MG|NPUT|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:AMP|MALL|PAN|TR(?:IKE|ONG)|U[BP])?|TIME|U|VAR|WBR)$/,Yo=new Set(["BR","HR","IFRAME","IMG","INPUT"]),Qo=0,ri=1,_r=2,Ar=3,Oe=new WeakMap,Lr=()=>{Oe=new WeakMap},_t=t=>Yo.has(t.nodeName),ni=t=>{switch(t.nodeType){case 8:case 3:return ri;case 1:case 11:if(Oe.has(t))return Oe.get(t);break;default:return Qo}let e;return Array.from(t.childNodes).every(L)?Zo.test(t.nodeName)?e=ri:e=_r:e=Ar,Oe.set(t,e),e},L=t=>ni(t)===ri,At=t=>ni(t)===_r,Qt=t=>ni(t)===Ar,x=(t,e,i)=>{let r=document.createElement(t);if(e instanceof Array&&(i=e,e=null),e)for(let n in e){let o=e[n];o!==void 0&&r.setAttribute(n,o)}return i&&i.forEach(n=>r.appendChild(n)),r},Nr=(t,e)=>_t(t)||t.nodeType!==e.nodeType||t.nodeName!==e.nodeName?!1:t instanceof HTMLElement&&e instanceof HTMLElement?t.nodeName!=="A"&&t.className===e.className&&t.style.cssText===e.style.cssText:!0,oi=(t,e,i)=>{if(t.nodeName!==e)return!1;for(let r in i)if(!("getAttribute"in t)||t.getAttribute(r)!==i[r])return!1;return!0},N=(t,e,i,r)=>{for(;t&&t!==e;){if(oi(t,i,r))return t;t=t.parentNode}return null},ai=(t,e)=>{let i=t.childNodes;for(;e&&t instanceof Element;)t=i[e-1],i=t.childNodes,e=i.length;return t},Dr=(t,e)=>{let i=t;if(i instanceof Element){let r=i.childNodes;if(e<r.length)i=r[e];else{for(;i&&!i.nextSibling;)i=i.parentNode;i&&(i=i.nextSibling)}}return i},ht=t=>t instanceof Element||t instanceof DocumentFragment?t.childNodes.length:t instanceof CharacterData?t.length:0,D=t=>{let e=document.createDocumentFragment(),i=t.firstChild;for(;i;)e.appendChild(i),i=t.firstChild;return e},$=t=>{let e=t.parentNode;return e&&e.removeChild(t),t},X=(t,e)=>{let i=t.parentNode;i&&i.replaceChild(e,t)},Xo=t=>t instanceof Element?t.nodeName==="BR":ft.test(t.data),Re=(t,e)=>{let i=t.parentNode;for(;L(i);)i=i.parentNode;let r=new ot(i,5,Xo);return r.currentNode=t,!!r.nextNode()||e&&!r.previousNode()},Ie=(t,e)=>{let i=new ot(t,4),r,n;for(;r=i.nextNode();)for(;(n=r.data.indexOf("\u200B"))>-1&&(!e||r.parentNode!==e);)if(r.length===1){let o=r,a=o.parentNode;for(;a&&(a.removeChild(o),i.currentNode=a,!(!L(a)||ht(a)));)o=a,a=o.parentNode;break}else r.deleteData(n,1)},Jo=0,ta=1,ea=2,ia=3,Lt=(t,e,i)=>{let r=document.createRange();if(r.selectNode(e),i){let n=t.compareBoundaryPoints(ia,r)>-1,o=t.compareBoundaryPoints(ta,r)<1;return!n&&!o}else{let n=t.compareBoundaryPoints(Jo,r)<1,o=t.compareBoundaryPoints(ea,r)>-1;return n&&o}},J=t=>{let{startContainer:e,startOffset:i,endContainer:r,endOffset:n}=t;for(;!(e instanceof Text);){let o=e.childNodes[i];if(!o||_t(o)){if(i&&(o=e.childNodes[i-1],o instanceof Text)){let a=o,l;for(;!a.length&&(l=a.previousSibling)&&l instanceof Text;)a.remove(),a=l;e=a,i=a.data.length}break}e=o,i=0}if(n)for(;!(r instanceof Text);){let o=r.childNodes[n-1];if(!o||_t(o)){if(o&&o.nodeName==="BR"&&!Re(o,!1)){n-=1;continue}break}r=o,n=ht(r)}else for(;!(r instanceof Text);){let o=r.firstChild;if(!o||_t(o))break;r=o}t.setStart(e,i),t.setEnd(r,n)},Ht=(t,e,i,r)=>{let n=t.startContainer,o=t.startOffset,a=t.endContainer,l=t.endOffset,c;for(e||(e=t.commonAncestorContainer),i||(i=e);!o&&n!==e&&n!==r;)c=n.parentNode,o=Array.from(c.childNodes).indexOf(n),n=c;for(;!(a===i||a===r||(a.nodeType!==3&&a.childNodes[l]&&a.childNodes[l].nodeName==="BR"&&!Re(a.childNodes[l],!1)&&(l+=1),l!==ht(a)));)c=a.parentNode,l=Array.from(c.childNodes).indexOf(a)+1,a=c;t.setStart(n,o),t.setEnd(a,l)},Or=(t,e,i)=>{let r=N(t.endContainer,i,e);if(r&&(r=r.parentNode)){let n=t.cloneRange();Ht(n,r,r,i),n.endContainer===r&&(t.setStart(n.endContainer,n.endOffset),t.setEnd(n.endContainer,n.endOffset))}return t},j=t=>{let e=null;if(t instanceof Text)return t;if(L(t)){let i=t.firstChild;if(De)for(;i&&i instanceof Text&&!i.data;)t.removeChild(i),i=t.firstChild;i||(De?e=document.createTextNode("\u200B"):e=document.createTextNode(""))}else if((t instanceof Element||t instanceof DocumentFragment)&&!t.querySelector("BR")&&!ft.test(t.textContent||"")){e=x("BR");let i=t,r;for(;(r=i.lastElementChild)&&!L(r);)i=r;t=i,t instanceof HTMLElement&&t.contentEditable==="true"&&(t=x("DIV"),i.appendChild(t))}if(e)try{t.appendChild(e)}catch{}return t},mt=(t,e)=>{let i=null;return/^(?:TABLE|TBODY|TR|TH|TD|P)/.test(t.nodeName)||(Array.from(t.childNodes).forEach(r=>{let n=r.nodeName==="BR";!n&&L(r)?(i||(i=x("DIV")),i.appendChild(r)):(n||i)&&(i||(i=x("DIV")),j(i),n?t.replaceChild(i,r):t.insertBefore(i,r),i=null),Qt(r)&&mt(r,e)}),i&&t.appendChild(j(i))),t},dt=(t,e,i,r)=>{if(!i.contains(t))throw new Error("split: stopNode does not contain node");if(t instanceof Text&&t!==i){if(typeof e!="number")throw new Error("Offset must be a number to split text node!");if(!t.parentNode)throw new Error("Cannot split text node with no parent!");return dt(t.parentNode,t.splitText(e),i,r)}let n=typeof e=="number"?e<t.childNodes.length?t.childNodes[e]:null:e,o=t.parentNode;if(!o||t===i||!(t instanceof Element))return n;let a=t.cloneNode(!1);for(;n;){let l=n.nextSibling;a.appendChild(n),n=l}return t instanceof HTMLOListElement&&N(t,r,"BLOCKQUOTE")&&(a.start=(+t.start||1)+t.childNodes.length-1),j(t),j(a),o.insertBefore(a,t.nextSibling),dt(o,a,i,r)},Rr=(t,e)=>{let i=t.childNodes,r=i.length,n=[];for(;r--;){let o=i[r],a=r?i[r-1]:null;if(a&&L(o)&&Nr(o,a))e.startContainer===o&&(e.startContainer=a,e.startOffset+=ht(a)),e.endContainer===o&&(e.endContainer=a,e.endOffset+=ht(a)),e.startContainer===t&&(e.startOffset>r?e.startOffset-=1:e.startOffset===r&&(e.startContainer=a,e.startOffset=ht(a))),e.endContainer===t&&(e.endOffset>r?e.endOffset-=1:e.endOffset===r&&(e.endContainer=a,e.endOffset=ht(a))),$(o),o instanceof Text?a.appendData(o.data):n.push(D(o));else if(o instanceof Element){let l;for(;l=n.pop();)o.appendChild(l);Rr(o,e)}}},Xt=(t,e)=>{let i=t instanceof Text?t.parentNode:t;if(i instanceof Element){let r={startContainer:e.startContainer,startOffset:e.startOffset,endContainer:e.endContainer,endOffset:e.endOffset};Rr(i,r),e.setStart(r.startContainer,r.startOffset),e.setEnd(r.endContainer,r.endOffset)}},de=(t,e,i,r)=>{let n=e,o,a;for(;(o=n.parentNode)&&o!==r&&o instanceof Element&&o.childNodes.length===1;)n=o;$(n),a=t.childNodes.length;let l=t.lastChild;l&&l.nodeName==="BR"&&(t.removeChild(l),a-=1),t.appendChild(D(e)),i.setStart(t,a),i.collapse(!0),Xt(t,i)},Et=(t,e)=>{let i=t.previousSibling,r=t.firstChild,n=t.nodeName==="LI";if(!(n&&(!r||!/^[OU]L$/.test(r.nodeName)))){if(i&&Nr(i,t)){if(!Qt(i))if(n){let a=x("DIV");a.appendChild(D(i)),i.appendChild(a)}else return;$(t);let o=!Qt(t);i.appendChild(D(t)),o&&mt(i,e),r&&Et(r,e)}else if(n){let o=x("DIV");t.insertBefore(o,r),j(o)}}},Ir={"font-weight":{regexp:/^bold|^700/i,replace(){return x("B")}},"font-style":{regexp:/^italic/i,replace(){return x("I")}},"font-family":{regexp:ft,replace(t,e){let i=x("SPAN",{class:t.fontFamily});return i.style.fontFamily=e,i}},"font-size":{regexp:ft,replace(t,e){let i=x("SPAN",{class:t.fontSize});return i.style.fontSize=e,i}},"text-decoration":{regexp:/^underline/i,replace(){return x("U")}}},ra=(t,e,i)=>{let r=t.style,n,o;for(let a in Ir){let l=Ir[a],c=r.getPropertyValue(a);if(c&&l.regexp.test(c)){let h=l.replace(i.classNames,c);if(h.nodeName===t.nodeName&&h.className===t.className)continue;o||(o=h),n&&n.appendChild(h),n=h,t.style.removeProperty(a)}}return o&&n&&(n.appendChild(D(t)),t.style.cssText?t.appendChild(o):X(t,o)),n||t},Me=t=>(e,i)=>{let r=x(t),n=e.attributes;for(let o=0,a=n.length;o<a;o+=1){let l=n[o];r.setAttribute(l.name,l.value)}return i.replaceChild(r,e),r.appendChild(D(e)),r},na={1:"10",2:"13",3:"16",4:"18",5:"24",6:"32",7:"48"},oa={STRONG:Me("B"),EM:Me("I"),INS:Me("U"),STRIKE:Me("S"),SPAN:ra,FONT:(t,e,i)=>{let r=t,n=r.face,o=r.size,a=r.color,l=i.classNames,c,h,u,d,f;return n&&(c=x("SPAN",{class:l.fontFamily}),c.style.fontFamily=n,f=c,d=c),o&&(h=x("SPAN",{class:l.fontSize}),h.style.fontSize=na[o]+"px",f||(f=h),d&&d.appendChild(h),d=h),a&&/^#?([\dA-F]{3}){1,2}$/i.test(a)&&(a.charAt(0)!=="#"&&(a="#"+a),u=x("SPAN",{class:l.color}),u.style.color=a,f||(f=u),d&&d.appendChild(u),d=u),(!f||!d)&&(f=d=x("SPAN")),e.replaceChild(f,r),d.appendChild(D(r)),d},TT:(t,e,i)=>{let r=x("SPAN",{class:i.classNames.fontFamily,style:'font-family:menlo,consolas,"courier new",monospace'});return e.replaceChild(r,t),r.appendChild(D(t)),r}},aa=/^(?:A(?:DDRESS|RTICLE|SIDE|UDIO)|BLOCKQUOTE|CAPTION|D(?:[DLT]|IV)|F(?:IGURE|IGCAPTION|OOTER)|H[1-6]|HEADER|L(?:ABEL|EGEND|I)|O(?:L|UTPUT)|P(?:RE)?|SECTION|T(?:ABLE|BODY|D|FOOT|H|HEAD|R)|COL(?:GROUP)?|UL)$/,la=/^(?:HEAD|META|STYLE)/,li=(t,e,i)=>{let r=t.childNodes,n=t;for(;L(n);)n=n.parentNode;let o=new ot(n,5);for(let a=0,l=r.length;a<l;a+=1){let c=r[a],h=c.nodeName,u=oa[h];if(c instanceof HTMLElement){let d=c.childNodes.length;if(u)c=u(c,t,e);else if(la.test(h)){t.removeChild(c),a-=1,l-=1;continue}else if(!aa.test(h)&&!L(c)){a-=1,l+=d-1,t.replaceChild(D(c),c);continue}d&&li(c,e,i||h==="PRE")}else{if(c instanceof Text){let d=c.data,f=!ft.test(d.charAt(0)),b=!ft.test(d.charAt(d.length-1));if(i||!f&&!b)continue;if(f){o.currentNode=c;let g;for(;(g=o.previousPONode())&&!(g.nodeName==="IMG"||g instanceof Text&&ft.test(g.data));)if(!L(g)){g=null;break}d=d.replace(/^[ \t\r\n]+/g,g?" ":"")}if(b){o.currentNode=c;let g;for(;(g=o.nextNode())&&!(g.nodeName==="IMG"||g instanceof Text&&ft.test(g.data));)if(!L(g)){g=null;break}d=d.replace(/[ \t\r\n]+$/g,g?" ":"")}if(d){c.data=d;continue}}t.removeChild(c),a-=1,l-=1}}return t},si=t=>{let e=t.childNodes,i=e.length;for(;i--;){let r=e[i];r instanceof Element&&!_t(r)?(si(r),L(r)&&!r.firstChild&&t.removeChild(r)):r instanceof Text&&!r.data&&t.removeChild(r)}},ci=(t,e,i)=>{let r=t.querySelectorAll("BR"),n=[],o=r.length;for(let a=0;a<o;a+=1)n[a]=Re(r[a],i);for(;o--;){let a=r[o],l=a.parentNode;l&&(n[o]?L(l)||mt(l,e):$(a))}},Mr=t=>t.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;").split('"').join("&quot;"),Be=(t,e)=>{let i=new ot(e,1,At);return i.currentNode=t,i},Ut=(t,e)=>{let i=Be(t,e).previousNode();return i!==e?i:null},Tt=(t,e)=>{let i=Be(t,e).nextNode();return i!==e?i:null},hi=t=>!t.textContent&&!t.querySelector("IMG"),at=(t,e)=>{let i=t.startContainer,r;if(L(i))r=Ut(i,e);else if(i!==e&&i instanceof HTMLElement&&At(i))r=i;else{let n=ai(i,t.startOffset);r=Tt(n,e)}return r&&Lt(t,r,!0)?r:null},qt=(t,e)=>{let i=t.endContainer,r;if(L(i))r=Ut(i,e);else if(i!==e&&i instanceof HTMLElement&&At(i))r=i;else{let n=Dr(i,t.endOffset);if(!n||!e.contains(n)){n=e;let o;for(;o=n.lastChild;)n=o}r=Ut(n,e)}return r&&Lt(t,r,!0)?r:null},Br=t=>t instanceof Text?ft.test(t.data):t.nodeName==="IMG",ue=(t,e)=>{let i=t.startContainer,r=t.startOffset,n;if(i instanceof Text){let l=i.data;for(let c=r;c>0;c-=1)if(l.charAt(c-1)!=="\u200B")return!1;n=i}else if(n=Dr(i,r),n&&!e.contains(n)&&(n=null),!n&&(n=ai(i,r),n instanceof Text&&n.length))return!1;let o=at(t,e);if(!o)return!1;let a=new ot(o,5,Br);return a.currentNode=n,!a.previousNode()},pe=(t,e)=>{let i=t.endContainer,r=t.endOffset,n;if(i instanceof Text){let l=i.data,c=l.length;for(let h=r;h<c;h+=1)if(l.charAt(h)!=="\u200B")return!1;n=i}else n=ai(i,r);let o=qt(t,e);if(!o)return!1;let a=new ot(o,5,Br);return a.currentNode=n,!a.nextNode()},Fr=(t,e)=>{let i=at(t,e),r=qt(t,e),n;i&&r&&(n=i.parentNode,t.setStart(n,Array.from(n.childNodes).indexOf(i)),n=r.parentNode,t.setEnd(n,Array.from(n.childNodes).indexOf(r)+1))};function zt(t,e,i,r){let n=document.createRange();return n.setStart(t,e),i&&typeof r=="number"?n.setEnd(i,r):n.setEnd(t,e),n}var Ct=(t,e)=>{let{startContainer:i,startOffset:r,endContainer:n,endOffset:o}=t,a;if(i instanceof Text){let c=i.parentNode;if(a=c.childNodes,r===i.length)r=Array.from(a).indexOf(i)+1,t.collapsed&&(n=c,o=r);else{if(r){let h=i.splitText(r);n===i?(o-=r,n=h):n===c&&(o+=1),i=h}r=Array.from(a).indexOf(i)}i=c}else a=i.childNodes;let l=a.length;r===l?i.appendChild(e):i.insertBefore(e,a[r]),i===n&&(o+=a.length-l),t.setStart(i,r),t.setEnd(n,o)},Pr=(t,e,i)=>{let r=document.createDocumentFragment();if(t.collapsed)return r;e||(e=t.commonAncestorContainer),e instanceof Text&&(e=e.parentNode);let n=t.startContainer,o=t.startOffset,a=dt(t.endContainer,t.endOffset,e,i),l=0,c=dt(n,o,e,i);for(;c&&c!==a;){let h=c.nextSibling;r.appendChild(c),c=h}return c=a&&a.previousSibling,c&&c instanceof Text&&a instanceof Text&&(l=c.length,c.appendData(a.data),$(a),a=c),t.setStart(n,o),a?t.setEnd(a,l):t.setEnd(e,e.childNodes.length),j(e),r},Hr=(t,e,i)=>{t.currentNode=i;let r;for(;r=t[e]();){if(r instanceof Text||_t(r))return r;if(!L(r))return null}return null},Wt=(t,e)=>{let i=at(t,e),r=qt(t,e),n=i!==r;i&&r&&(J(t),Ht(t,i,r,e));let o=Pr(t,null,e);J(t),n&&(r=qt(t,e),i&&r&&i!==r&&de(i,r,t,e)),i&&j(i);let a=e.firstChild;(!a||a.nodeName==="BR")&&(j(e),e.firstChild&&t.selectNodeContents(e.firstChild)),t.collapse(!0);let l=t.startContainer,c=t.startOffset,h=new ot(e,5),u=l,d=c;(!(u instanceof Text)||d===u.data.length)&&(u=Hr(h,"nextNode",u),d=0);let f=l,b=c-1;(!(f instanceof Text)||b===-1)&&(f=Hr(h,"previousPONode",u||(l instanceof Text?l:l.childNodes[c]||l)),f instanceof Text&&(b=f.data.length));let g=null,E=0;return u instanceof Text&&u.data.charAt(d)===" "&&ue(t,e)?(g=u,E=d):f instanceof Text&&f.data.charAt(b)===" "&&(u instanceof Text&&u.data.charAt(d)===" "||pe(t,e))&&(g=f,E=b),g&&g.replaceData(E,1,"\xA0"),t.setStart(l,c),t.collapse(!0),o},sa=(t,e,i)=>{let r=e.firstChild&&L(e.firstChild),n;for(mt(e,i),n=e;n=Tt(n,i);)j(n);t.collapsed||Wt(t,i),J(t),t.collapse(!1);let o=N(t.endContainer,i,"BLOCKQUOTE")||i,a=at(t,i),l=null,c=Tt(e,e),h=!r&&!!a&&hi(a);if(a&&c&&!h&&!N(c,e,"PRE")&&!N(c,e,"TABLE")){Ht(t,a,a,i),t.collapse(!0);let u=t.endContainer,d=t.endOffset;if(ci(a,i,!1),L(u)){let f=dt(u,d,Ut(u,i)||i,i);u=f.parentNode,d=Array.from(u.childNodes).indexOf(f)}if(d!==ht(u))for(l=document.createDocumentFragment();n=u.childNodes[d];)l.appendChild(n);de(u,c,t,i),u===i?t.setEnd(i,ht(i)):(d=Array.from(u.parentNode.childNodes).indexOf(u)+1,u=u.parentNode,t.setEnd(u,d))}if(ht(e)){h&&a&&(t.setEndBefore(a),t.collapse(!1),$(a)),o.contains(t.endContainer)||(i.contains(t.endContainer)||(t.setEnd(i,ht(i)),t.collapse(!1)),o=N(t.endContainer,i,"BLOCKQUOTE")||i),Ht(t,o,o,i);let u=dt(t.endContainer,t.endOffset,o,i),d=u?u.previousSibling:o.lastChild;o.insertBefore(e,u),u?t.setEndBefore(u):t.setEnd(o,ht(o)),a=qt(t,i),J(t);let f=t.endContainer,b=t.endOffset;u&&Qt(u)&&Et(u,i),u=d&&d.nextSibling,u&&Qt(u)&&Et(u,i),t.setEnd(f,b)}if(l&&a){let u=t.cloneRange();j(l),de(a,l,u,i),t.setEnd(u.endContainer,u.endOffset)}J(t)},Ur=t=>{if(t.collapsed)return"";let e=t.startContainer,i=t.endContainer,r=new ot(t.commonAncestorContainer,5,c=>Lt(t,c,!0));r.currentNode=e;let n=e,o="",a=!1,l;for((!(n instanceof Element)&&!(n instanceof Text)||!r.filter(n))&&(n=r.nextNode());n;)n instanceof Text?(l=n.data,l&&/\S/.test(l)&&(n===i&&(l=l.slice(0,t.endOffset)),n===e&&(l=l.slice(t.startOffset)),o+=l,a=!0)):(n.nodeName==="BR"||a&&!L(n))&&(o+=`
77
+ `,a=!1),n=r.nextNode();return o=o.replace(/ /g," "),o},di=Array.prototype.indexOf,qr=(t,e,i,r,n)=>{let o=n?"":Ur(t),a=at(t,e),l=qt(t,e),c=t.commonAncestorContainer,h=e;a===l&&a?.contains(c)&&(h=a);let u;for(i?(u=Wt(t,e),c.isConnected||(c=t.commonAncestorContainer)):u=t.cloneContents(),c instanceof Text&&(c=c.parentNode);c&&c!==h;){let f=c.cloneNode(!1);f.appendChild(u),u=f,c=c.parentNode}let d;if(u.childNodes.length===1&&u.childNodes[0]instanceof Text)o=u.childNodes[0].data.replace(/ /g," "),d=void 0;else{let f=x("DIV");f.appendChild(u),d=f.innerHTML,r&&(d=r(d))}return n&&d!==void 0&&(o=n(d)),o===d&&(d=void 0),Sr&&(o=o.replace(/\r?\n/g,`\r
78
+ `)),d&&(d="<!-- squire -->"+d),[o,d]},zr=(t,e,i,r,n,o,a)=>{let l=t.clipboardData;if(Ne||!l)return!1;let[c,h]=qr(e,i,r,n,o);return t.preventDefault(),!a&&h&&l.setData("text/html",h),l.setData("text/plain",c),!0},ca=function(t){let e=this.getSelection(),i=this._root;if(e.collapsed){t.preventDefault();return}this.saveUndoState(e),zr(t,e,i,!0,this._config.willCutCopy,this._config.toPlainText,!1)||setTimeout(()=>{try{this._ensureBottomLine()}catch(r){this._config.didError(r)}},0),this.setSelection(e)},ha=function(t){zr(t,this.getSelection(),this._root,!1,this._config.willCutCopy,this._config.toPlainText,!1)},Wr=function(t){this._isShiftDown=t.shiftKey},da=function(t){let e=t.clipboardData,i=e?.items,r=this._isShiftDown,n=!1,o=!1,a=null,l=null;if(i){let T=i.length;for(;T--;){let R=i[T],z=R.type;z==="text/html"?l=R:z==="text/plain"||z==="text/uri-list"?a=R:z==="text/rtf"?n=!0:/^image\/.*/.test(z)&&(o=!0)}if(o&&!(n&&l)&&!a){t.preventDefault(),this.fireEvent("pasteImage",{clipboardData:e});return}if(!Ne){t.preventDefault(),l&&(!r||!a)?l.getAsString(R=>{this.insertHTML(R,!0)}):a&&a.getAsString(R=>{let z=this.getSelection();if(!z.collapsed&&ft.test(z.toString())){let rt=this.linkRegExp.exec(R);if(rt&&rt[0].length===R.length){let K=rt[1]?/^(?:ht|f)tps?:/i.test(rt[1])?rt[1]:"http://"+rt[1]:"mailto:"+rt[0];this.makeLink(K);return}}this.insertPlainText(R,!0)});return}}let c=e?.types;if(!Ne&&c&&(di.call(c,"text/html")>-1||!jo&&di.call(c,"text/plain")>-1&&di.call(c,"text/rtf")<0)){t.preventDefault();let T;!r&&(T=e.getData("text/html"))?this.insertHTML(T,!0):((T=e.getData("text/plain"))||(T=e.getData("text/uri-list")))&&this.insertPlainText(T,!0);return}let h=document.body,u=this.getSelection(),d=u.startContainer,f=u.startOffset,b=u.endContainer,g=u.endOffset,E=x("DIV",{contenteditable:"true",style:"position:fixed; overflow:hidden; top:0; right:100%; width:1px; height:1px;"});h.appendChild(E),u.selectNodeContents(E),this.setSelection(u),setTimeout(()=>{try{let T="",R=E,z;for(;E=R;)R=E.nextSibling,$(E),z=E.firstChild,z&&z===E.lastChild&&z instanceof HTMLDivElement&&(E=z),T+=E.innerHTML;this.setSelection(zt(d,f,b,g)),T&&this.insertHTML(T,!0)}catch(T){this._config.didError(T)}},0)},ua=function(){let t=this.getSelection();t&&!t.collapsed&&this._root.contains(t.commonAncestorContainer)?this._dragRange=t.cloneRange():this._dragRange=null},pa=function(){this._dragRange=null},fa=(t,e,i)=>{let r=null,n=document;if(n.caretPositionFromPoint){let o=n.caretPositionFromPoint(t,e);o&&(r=document.createRange(),r.setStart(o.offsetNode,o.offset),r.collapse(!0))}else n.caretRangeFromPoint&&(r=n.caretRangeFromPoint(t,e));return r&&!i.contains(r.commonAncestorContainer)?null:r},ma=(t,e)=>t.compareBoundaryPoints(Range.START_TO_START,e)>=0&&t.compareBoundaryPoints(Range.END_TO_END,e)<=0,ya=function(t){let e=t.dataTransfer;if(!e)return;let i=e.types,r=!1,n=!1;for(let u=0,d=i.length;u<d;u+=1)switch(i[u]){case"text/plain":r=!0;break;case"text/html":n=!0;break}if(!r&&!n)return;t.preventDefault();let o=this._root,a=fa(t.clientX,t.clientY,o),l=this._dragRange;if(this._dragRange=null,!a)return;let c,h;if(l){if(ma(a,l))return;this._recordUndoState(l,this._isInUndoState);let u=document.createComment("");a.insertNode(u),this._getRangeAndRemoveBookmark(l),[c,h]=qr(l,o,e.dropEffect!=="copy",this._config.willCutCopy,this._config.toPlainText),u.replaceWith(x("INPUT",{id:this.startSelectionId,type:"hidden"}),x("INPUT",{id:this.endSelectionId,type:"hidden"})),this._getRangeAndRemoveBookmark(a),Lr()}else this.saveUndoState(a),n?h=e.getData("text/html"):c=e.getData("text/plain");this.setSelection(a),h!==void 0?this.insertHTML(h,!0):c!==void 0&&this.insertPlainText(c,!0)},Kr=(t,e,i)=>{e.preventDefault(),t.splitBlock(e.shiftKey,i)},fe=(t,e)=>{try{e||(e=t.getSelection());let i=e.startContainer;i instanceof Text&&(i=i.parentNode);let r=i;for(;r!==t._root&&L(r)&&(!r.textContent||r.textContent==="\u200B");)i=r,r=i.parentNode;i!==r&&(e.setStart(r,Array.from(r.childNodes).indexOf(i)),e.collapse(!0),r.removeChild(i),At(r)||(r=Ut(r,t._root)||t._root),j(r),J(e)),i===t._root&&(i=i.firstChild)&&i.nodeName==="BR"&&$(i),t._ensureBottomLine(),t.setSelection(e),t._updatePath(e,!0)}catch(i){t._config.didError(i)}},$r=(t,e)=>{let i;for(;(i=t.parentNode)&&!(i===e||i.isContentEditable);)t=i;$(t)},jr=(t,e,i)=>{if(N(e,t._root,"A"))return;let r=e.data||"",n=Math.max(r.lastIndexOf(" ",i-1),r.lastIndexOf("\xA0",i-1))+1,o=r.slice(n,i),a=t.linkRegExp.exec(o);if(a){let l=t.getSelection();t._docWasChanged(),t._recordUndoState(l),t._getRangeAndRemoveBookmark(l);let c=n+a.index,h=c+a[0].length,u=l.startContainer===e,d=l.startOffset-h;c&&(e=e.splitText(c));let f=t._config.tagAttributes.a,b=x("A",Object.assign({href:a[1]?/^(?:ht|f)tps?:/i.test(a[1])?a[1]:"http://"+a[1]:"mailto:"+a[0]},f));b.textContent=r.slice(c,h),e.parentNode.insertBefore(b,e),e.data=r.slice(h),u&&(l.setStart(e,d),l.setEnd(e,d)),t.setSelection(l)}},ga=(t,e,i)=>{let r=t._root;if(t._removeZWS(),t.saveUndoState(i),!i.collapsed)e.preventDefault(),Wt(i,r),fe(t,i);else if(ue(i,r)){e.preventDefault();let n=at(i,r);if(!n)return;let o=n;mt(o.parentNode,r);let a=Ut(o,r);if(a){if(!a.isContentEditable){$r(a,r);return}for(de(a,o,i,r),o=a.parentNode;o!==r&&!o.nextSibling;)o=o.parentNode;o!==r&&(o=o.nextSibling)&&Et(o,r),t.setSelection(i)}else if(o){if(N(o,r,"UL")||N(o,r,"OL")){t.decreaseListLevel(i);return}else if(N(o,r,"BLOCKQUOTE")){t.removeQuote(i);return}t.setSelection(i),t._updatePath(i,!0)}}else{J(i);let n=i.startContainer,o=i.startOffset,a=n.parentNode;n instanceof Text&&a instanceof HTMLAnchorElement&&o&&a.href.includes(n.data)?(n.deleteData(o-1,1),t.setSelection(i),t.removeLink(),e.preventDefault()):(t.setSelection(i),setTimeout(()=>{fe(t)},0))}},ba=(t,e,i)=>{let r=t._root,n,o,a,l,c,h;if(t._removeZWS(),t.saveUndoState(i),!i.collapsed)e.preventDefault(),Wt(i,r),fe(t,i);else if(pe(i,r)){if(e.preventDefault(),n=at(i,r),!n)return;if(mt(n.parentNode,r),o=Tt(n,r),o){if(!o.isContentEditable){$r(o,r);return}for(de(n,o,i,r),o=n.parentNode;o!==r&&!o.nextSibling;)o=o.parentNode;o!==r&&(o=o.nextSibling)&&Et(o,r),t.setSelection(i),t._updatePath(i,!0)}}else{if(a=i.cloneRange(),Ht(i,r,r,r),l=i.endContainer,c=i.endOffset,l instanceof Element&&(h=l.childNodes[c],h&&h.nodeName==="IMG")){e.preventDefault(),$(h),J(i),fe(t,i);return}t.setSelection(a),setTimeout(()=>{fe(t)},0)}},va=(t,e,i)=>{let r=t._root;if(t._removeZWS(),i.collapsed&&ue(i,r)){let n=at(i,r),o;for(;o=n.parentNode;){if(o.nodeName==="UL"||o.nodeName==="OL"){e.preventDefault(),t.increaseListLevel(i);break}n=o}}},wa=(t,e,i)=>{let r=t._root;if(t._removeZWS(),i.collapsed&&ue(i,r)){let n=i.startContainer;(N(n,r,"UL")||N(n,r,"OL"))&&(e.preventDefault(),t.decreaseListLevel(i))}},xa=(t,e,i)=>{let r,n=t._root;if(t._recordUndoState(i),t._getRangeAndRemoveBookmark(i),!i.collapsed)Wt(i,n),t._ensureBottomLine(),t.setSelection(i),t._updatePath(i,!0);else if(pe(i,n)){let o=at(i,n);if(o&&o.nodeName!=="PRE"){let a=o.textContent?.trimEnd().replace("\u200B","");if(a==="*"||a==="1."){e.preventDefault(),t.insertPlainText(" ",!1),t._docWasChanged(),t.saveUndoState(i);let l=new ot(o,4),c;for(;c=l.nextNode();)$(c);a==="*"?t.makeUnorderedList():t.makeOrderedList();return}}}if(r=i.endContainer,i.endOffset===ht(r))do if(r.nodeName==="A"){i.setStartAfter(r);break}while(!r.nextSibling&&(r=r.parentNode)&&r!==n);if(t._config.addLinks){let o=i.cloneRange();J(o);let a=o.startContainer,l=o.startOffset;setTimeout(()=>{jr(t,a,l)},0)}t.setSelection(i)},Ea=function(t){if(t.defaultPrevented||t.isComposing)return;let e=t.key,i="",r=t.code;/^Digit\d$/.test(r)&&(e=r.slice(-1)),e!=="Backspace"&&e!=="Delete"&&(t.altKey&&(i+="Alt-"),t.ctrlKey&&(i+="Ctrl-"),t.metaKey&&(i+="Meta-"),t.shiftKey&&(i+="Shift-")),Sr&&t.shiftKey&&e==="Delete"&&(i+="Shift-"),e=i+e;let n=this.getSelection(),o=this._keyHandlers[e];o?o(this,t,n):!n.collapsed&&!t.ctrlKey&&!t.metaKey&&e.length===1&&(this.saveUndoState(n),Wt(n,this._root),this._ensureBottomLine(),this.setSelection(n),this._updatePath(n,!0))},U={Backspace:ga,Delete:ba,Tab:va,"Shift-Tab":wa," ":xa,ArrowLeft(t){t._removeZWS()},ArrowRight(t,e,i){t._removeZWS();let r=t.getRoot();if(pe(i,r)){J(i);let n=i.endContainer;do if(n.nodeName==="CODE"){let o=n.nextSibling;if(!(o instanceof Text)||o.length===0){let a=document.createTextNode("\xA0");n.parentNode.insertBefore(a,o),o=a}i.setStart(o,1),t.setSelection(i),e.preventDefault();break}while(!n.nextSibling&&(n=n.parentNode)&&n!==r)}}};Go||(U.Enter=Kr,U["Shift-Enter"]=Kr),!ii&&!kr&&(U.PageUp=t=>{t.moveCursorToStart()},U.PageDown=t=>{t.moveCursorToEnd()});var Jt=(t,e)=>(e=e||null,(i,r)=>{r.preventDefault();let n=i.getSelection();i.hasFormat(t,null,n)?i.changeFormat(null,{tag:t},n):i.changeFormat({tag:t},e,n)});U[et+"b"]=Jt("B"),U[et+"i"]=Jt("I"),U[et+"u"]=Jt("U"),U[et+"Shift-7"]=Jt("S"),U[et+"Shift-5"]=Jt("SUB",{tag:"SUP"}),U[et+"Shift-6"]=Jt("SUP",{tag:"SUB"}),U[et+"Shift-8"]=(t,e)=>{e.preventDefault();let i=t.getPath();/(?:^|>)UL/.test(i)?t.removeList():t.makeUnorderedList()},U[et+"Shift-9"]=(t,e)=>{e.preventDefault();let i=t.getPath();/(?:^|>)OL/.test(i)?t.removeList():t.makeOrderedList()},U[et+"["]=(t,e)=>{e.preventDefault();let i=t.getPath();/(?:^|>)BLOCKQUOTE/.test(i)||!/(?:^|>)[OU]L/.test(i)?t.decreaseQuoteLevel():t.decreaseListLevel()},U[et+"]"]=(t,e)=>{e.preventDefault();let i=t.getPath();/(?:^|>)BLOCKQUOTE/.test(i)||!/(?:^|>)[OU]L/.test(i)?t.increaseQuoteLevel():t.increaseListLevel()},U[et+"d"]=(t,e)=>{e.preventDefault(),t.toggleCode()},U[et+"z"]=(t,e)=>{e.preventDefault(),t.undo()},U[et+"y"]=U[et+"Shift-z"]=U[et+"Shift-Z"]=(t,e)=>{e.preventDefault(),t.redo()};var ui=8,Vr=40,pi=1200,Ta=[{pos:"nw",cursor:"nwse-resize"},{pos:"n",cursor:"ns-resize"},{pos:"ne",cursor:"nesw-resize"},{pos:"e",cursor:"ew-resize"},{pos:"se",cursor:"nwse-resize"},{pos:"s",cursor:"ns-resize"},{pos:"sw",cursor:"nesw-resize"},{pos:"w",cursor:"ew-resize"}],Ca={ArrowUp:(t,e,i)=>{let r=at(e,i);if(r){let n=Ut(r,i);n&&(e.selectNodeContents(n),e.collapse(!1),t.setSelection(e).focus())}},ArrowDown:(t,e,i)=>{let r=at(e,i);if(r){let n=Tt(r,i);n&&(e.selectNodeContents(n),e.collapse(!0),t.setSelection(e).focus())}},Delete:(t,e)=>{t.replaceWithBlankLine(e)},Backspace:(t,e)=>{t.replaceWithBlankLine(e)}},Sa=class{constructor(t,e){this._currentImage=null,this._resizeContainer=null,this._handles=null,this._currentHandle=null,this._startX=0,this._startY=0,this._startWidth=0,this._startHeight=0,this._maxWidth=pi,this._originalRatio=1,this._editor=e,this._root=t,document.addEventListener("click",this),e.addEventListener("drop",this)}destroy(){this._deselectImage(),this._editor.removeEventListener("drop",this),document.removeEventListener("click",this)}handleEvent(t){switch(t.type){case"click":this._onClick(t);break;case"pointerdown":this._onPointerDown(t);break;case"pointermove":this._onPointerMove(t);break;case"pointercancel":case"pointerup":this._onPointerUp(t);break;case"keydown":this._onKeyDown(t);break;case"drop":this._deselectImage();break}}_onClick(t){let e=t.target;e.nodeName==="IMG"&&this._root.contains(e)?(t.stopPropagation(),this._selectImage(e)):this._currentImage&&this._handles&&!this._handles.some(i=>i.element===e)&&this._deselectImage()}_deselectImage(){this._currentImage&&(document.removeEventListener("keydown",this,!0),this._currentHandle&&this._onPointerUp({preventDefault(){},target:this._currentHandle.element}),this._handles&&this._handles.forEach(({element:t})=>t.removeEventListener("pointerdown",this)),this._resizeContainer&&this._resizeContainer.remove(),this._currentImage.removeAttribute("tabindex"),this._handles=null,this._resizeContainer=null,this._currentImage=null)}_selectImage(t){if(this._currentImage===t)return;this._deselectImage(),this._root.blur();let e=Ta.map(({pos:n,cursor:o})=>{let a=ui/2,l="";switch(n){case"nw":l=`left: -${a}px; top: -${a}px;`;break;case"n":l=`left: calc(50% - ${a}px); top: -${a}px;`;break;case"ne":l=`right: -${a}px; top: -${a}px;`;break;case"e":l=`right: -${a}px; top: calc(50% - ${a}px);`;break;case"se":l=`right: -${a}px; bottom: -${a}px;`;break;case"s":l=`left: calc(50% - ${a}px); bottom: -${a}px;`;break;case"sw":l=`left: -${a}px; bottom: -${a}px;`;break;case"w":l=`left: -${a}px; top: calc(50% - ${a}px);`;break}let c=x("div",{class:`squire-resize-handle squire-resize-handle-${n}`,style:`
79
+ position: absolute;
80
+ width: ${ui}px;
81
+ height: ${ui}px;
82
+ background: #0067b9;
83
+ border: 1px solid #fff;
84
+ cursor: ${o};
85
+ pointer-events: auto;
86
+ touch-action: none;
87
+ box-shadow: 0 1px 3px rgba(0,0,0,0.3);
88
+ ${l}
89
+ `});return c.addEventListener("pointerdown",this),{element:c,cursor:o,position:n}}),i=x("div",{class:"squire-image-resize-container","editor-ui":"",style:"position: absolute; pointer-events: none; z-index: 1000;"},e.map(n=>n.element));this._currentImage=t,this._resizeContainer=i,this._handles=e,this._root.appendChild(this._resizeContainer);let r=t.naturalWidth;this._originalRatio=r/t.naturalHeight,this._maxWidth=Math.min(r*2,t.parentElement?t.parentElement.offsetWidth:pi,pi),this._positionResizeContainer(),t.tabIndex=-1,t.focus(),document.addEventListener("keydown",this,!0)}_positionResizeContainer(){let t=this._resizeContainer,e=this._root,i=this._currentImage;if(!t||!i)return;let r=e.getBoundingClientRect(),n=i.getBoundingClientRect(),o=n.top-r.top+e.scrollTop,a=n.left-r.left+e.scrollLeft,l=n.width,c=n.height;t.style.top=o+"px",t.style.left=a+"px",t.style.width=l+"px",t.style.height=c+"px"}_onPointerDown(t){if(this._currentHandle||!this._handles)return;let e=t.target,i=this._handles.find(o=>o.element===e)||null;if(!i)return;let r=this._currentImage;if(!r)return;t.preventDefault(),t.stopPropagation(),e.addEventListener("pointermove",this),e.addEventListener("pointerup",this),e.addEventListener("pointercancel",this),e.setPointerCapture(t.pointerId),this._currentHandle=i,this._startX=t.clientX,this._startY=t.clientY;let n=getComputedStyle(r);this._startWidth=parseFloat(n.width),this._startHeight=parseFloat(n.height),document.body.style.cursor=i.cursor}_onPointerMove(t){t.preventDefault();let e=this._currentHandle,i=this._currentImage;if(!e||!i)return;let r=t.clientX-this._startX,n=t.clientY-this._startY,o=this._maxWidth,a=this._originalRatio,l=this._startWidth,c=this._startHeight;switch(e.position){case"sw":case"nw":case"w":l-=2*r;break;case"se":case"ne":case"e":l+=2*r;break;case"n":c-=n,l=c*a;break;case"s":c+=n,l=c*a;break}l<Vr?l=Vr:l>o&&(l=o);let h=i.style;h.width=l+"px",h.height="auto",this._positionResizeContainer()}_onPointerUp(t){t.preventDefault();let e=t.target;e&&(e.removeEventListener("pointermove",this),e.removeEventListener("pointerup",this),e.removeEventListener("pointercancel",this)),this._currentHandle=null,document.body.style.cursor=""}_onKeyDown(t){t.preventDefault(),t.stopPropagation();let e=Ca[t.key];if(!e)return;let i=this._currentImage;if(!i)return;let r=this._editor,n=this._root;this._deselectImage();let o=r.getSelection();o.selectNode(i),e(r,o,n)}},ka=class{constructor(t,e){this.customEvents=new Set(["pathChange","select","input","pasteImage","undoStateChange"]),this.startSelectionId="squire-selection-start",this.endSelectionId="squire-selection-end",this.linkRegExp=/\b(?:((?:(?:ht|f)tps?:\/\/|www\d{0,3}[.]|[a-z0-9][a-z0-9.\-]*[.][a-z]{2,}\/)(?:[^\s()<>]+|\([^\s()<>]+\))+(?:[^\s?&`!()\[\]{};:'".,<>«»“”‘’]|\([^\s()<>]+\)))|([\w\-.%+]+@(?:[\w\-]+\.)+[a-z]{2,}\b(?:[?][^&?\s]+=[^\s?&`!()\[\]{};:'".,<>«»“”‘’]+(?:&[^&?\s]+=[^\s?&`!()\[\]{};:'".,<>«»“”‘’]+)*)?))/i,this.tagAfterSplit={DT:"DD",DD:"DT",LI:"LI",PRE:"PRE"},this._root=t,this._config=this._makeConfig(e),this._isFocused=!1,this._lastSelection=zt(t,0),this._willRestoreSelection=!1,this._mayHaveZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this._events=new Map,this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this._ignoreChange=!1,this._ignoreAllChanges=!1,this.addEventListener("selectionchange",this._updatePathOnEvent),this.addEventListener("blur",this._enableRestoreSelection),this.addEventListener("mousedown",this._disableRestoreSelection),this.addEventListener("touchstart",this._disableRestoreSelection),this.addEventListener("focus",this._restoreSelection),this.addEventListener("blur",this._removeZWS),this._isShiftDown=!1,this.addEventListener("cut",ca),this.addEventListener("copy",ha),this.addEventListener("paste",da),this._dragRange=null,this.addEventListener("dragstart",ua),this.addEventListener("dragend",pa),this.addEventListener("drop",ya),this.addEventListener("keydown",Wr),this.addEventListener("keyup",Wr),this.addEventListener("keydown",Ea),this._keyHandlers=Object.create(U);let i=new MutationObserver(r=>this._onMutations(r));i.observe(t,{childList:!0,attributes:!0,attributeOldValue:!0,characterData:!0,subtree:!0}),this._mutation=i,t.setAttribute("contenteditable","true"),this.addEventListener("beforeinput",this._beforeInput),this._imageResizer=new Sa(t,this),this.setHTML("")}destroy(){this._events.forEach((t,e)=>{this.removeEventListener(e)}),this._mutation.disconnect(),this._imageResizer.destroy(),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0}_makeConfig(t){let e={blockTag:"DIV",blockAttributes:null,tagAttributes:{},classNames:{color:"color",fontFamily:"font",fontSize:"size",highlight:"highlight"},undo:{documentSizeThreshold:-1,undoLimit:-1},addLinks:!0,willCutCopy:null,toPlainText:null,sanitizeToDOMFragment:i=>{let r=DOMPurify.sanitize(i,{ALLOW_UNKNOWN_PROTOCOLS:!0,WHOLE_DOCUMENT:!1,RETURN_DOM:!0,RETURN_DOM_FRAGMENT:!0,FORCE_BODY:!1});return r?document.importNode(r,!0):document.createDocumentFragment()},didError:i=>console.log(i)};return t&&(Object.assign(e,t),e.blockTag=e.blockTag.toUpperCase()),e}setKeyHandler(t,e){return this._keyHandlers[t]=e,this}_beforeInput(t){switch(t.inputType){case"insertLineBreak":t.preventDefault(),this.splitBlock(!0);break;case"insertParagraph":t.preventDefault(),this.splitBlock(!1);break;case"insertOrderedList":t.preventDefault(),this.makeOrderedList();break;case"insertUnoderedList":t.preventDefault(),this.makeUnorderedList();break;case"historyUndo":t.preventDefault(),this.undo();break;case"historyRedo":t.preventDefault(),this.redo();break;case"formatBold":t.preventDefault(),this.bold();break;case"formatItalic":t.preventDefault(),this.italic();break;case"formatUnderline":t.preventDefault(),this.underline();break;case"formatStrikeThrough":t.preventDefault(),this.strikethrough();break;case"formatSuperscript":t.preventDefault(),this.superscript();break;case"formatSubscript":t.preventDefault(),this.subscript();break;case"formatJustifyFull":case"formatJustifyCenter":case"formatJustifyRight":case"formatJustifyLeft":{t.preventDefault();let e=t.inputType.slice(13).toLowerCase();e==="full"&&(e="justify"),this.setTextAlignment(e);break}case"formatRemove":t.preventDefault(),this.removeAllFormatting();break;case"formatSetBlockTextDirection":{t.preventDefault();let e=t.data;e==="null"&&(e=null),this.setTextDirection(e);break}case"formatBackColor":t.preventDefault(),this.setHighlightColor(t.data);break;case"formatFontColor":t.preventDefault(),this.setTextColor(t.data);break;case"formatFontName":t.preventDefault(),this.setFontFace(t.data);break}}handleEvent(t){this.fireEvent(t.type,t)}fireEvent(t,e){let i=this._events.get(t);if(/^(?:focus|blur)/.test(t)){let r=this._root===document.activeElement;if(t==="focus"){if(!r||this._isFocused)return this;this._isFocused=!0}else{if(r||!this._isFocused)return this;this._isFocused=!1}}if(i){let r=e instanceof Event?e:new CustomEvent(t,{detail:e});i=i.slice();for(let n of i)try{"handleEvent"in n?n.handleEvent(r):n.call(this,r)}catch(o){this._config.didError(o)}}return this}addEventListener(t,e){let i=this._events.get(t),r=this._root;return i||(i=[],this._events.set(t,i),this.customEvents.has(t)||(t==="selectionchange"&&(r=document),r.addEventListener(t,this,!0))),i.push(e),this}removeEventListener(t,e){let i=this._events.get(t),r=this._root;if(i){if(e){let n=i.length;for(;n--;)i[n]===e&&i.splice(n,1)}else i.length=0;i.length||(this._events.delete(t),this.customEvents.has(t)||(t==="selectionchange"&&(r=document),r.removeEventListener(t,this,!0)))}return this}focus(){return this._root.focus({preventScroll:!0}),this}blur(){return this._root.blur(),this}_enableRestoreSelection(){this._willRestoreSelection=!0}_disableRestoreSelection(){this._willRestoreSelection=!1}_restoreSelection(){this._willRestoreSelection&&this.setSelection(this._lastSelection)}_removeZWS(){this._mayHaveZWS&&(Ie(this._root),this._mayHaveZWS=!1)}_saveRangeToBookmark(t){let e=x("INPUT",{id:this.startSelectionId,type:"hidden"}),i=x("INPUT",{id:this.endSelectionId,type:"hidden"}),r;Ct(t,e),t.collapse(!1),Ct(t,i),e.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_PRECEDING&&(e.id=this.endSelectionId,i.id=this.startSelectionId,r=e,e=i,i=r),t.setStartAfter(e),t.setEndBefore(i)}_getRangeAndRemoveBookmark(t){let e=this._root,i=e.querySelectorAll("#"+this.startSelectionId),r=e.querySelectorAll("#"+this.endSelectionId),n=i[0],o=r[0];if(n&&o&&n.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING){let a=n.parentNode,l=o.parentNode,c=Array.from(a.childNodes).indexOf(n),h=Array.from(l.childNodes).indexOf(o);a===l&&(h-=1),n.remove(),o.remove(),t||(t=document.createRange()),t.setStart(a,c),t.setEnd(l,h),Xt(a,t),a!==l&&Xt(l,t),t.collapsed&&(a=t.startContainer,a instanceof Text&&(l=a.childNodes[t.startOffset],(!l||!(l instanceof Text))&&(l=a.childNodes[t.startOffset-1]),l&&l instanceof Text&&(t.setStart(l,0),t.collapse(!0))))}for(let a=0;a<i.length;a+=1)i[a].remove();for(let a=0;a<r.length;a+=1)r[a].remove();return t||null}getSelection(){let t=window.getSelection(),e=this._root,i=null;if(this._isFocused&&t&&t.rangeCount){i=t.getRangeAt(0).cloneRange();let r=i.startContainer,n=i.endContainer;r&&_t(r)&&i.setStartBefore(r),n&&_t(n)&&i.setEndBefore(n)}return i&&e.contains(i.commonAncestorContainer)?this._lastSelection=i:(i=this._lastSelection,document.contains(i.commonAncestorContainer)||(i=null)),i||(i=zt(e.firstElementChild||e,0)),i}setSelection(t){if(this._lastSelection=t,!this._isFocused)this._enableRestoreSelection();else{let e=window.getSelection();e&&("setBaseAndExtent"in Selection.prototype?e.setBaseAndExtent(t.startContainer,t.startOffset,t.endContainer,t.endOffset):(e.removeAllRanges(),e.addRange(t)))}return this}_moveCursorTo(t){let e=this._root,i=zt(e,t?0:e.childNodes.length);return J(i),this.setSelection(i),this}moveCursorToStart(){return this._moveCursorTo(!0)}moveCursorToEnd(){return this._moveCursorTo(!1)}getCursorPosition(){let t=this.getSelection(),e=t.getBoundingClientRect();if(e&&!e.top){this._ignoreChange=!0;let i=x("SPAN");i.textContent="\u200B",Ct(t,i),e=i.getBoundingClientRect();let r=i.parentNode;r.removeChild(i),Xt(r,t)}return e}getPath(){return this._path}_updatePathOnEvent(){this._isFocused&&this._updatePath(this.getSelection())}_updatePath(t,e){let i=t.startContainer,r=t.endContainer,n;(e||i!==this._lastAnchorNode||r!==this._lastFocusNode)&&(this._lastAnchorNode=i,this._lastFocusNode=r,n=i&&r?i===r?this._getPath(r):"(selection)":"",(this._path!==n||i!==r)&&(this._path=n,this.fireEvent("pathChange",{path:n}))),this.fireEvent(t.collapsed?"cursor":"select",{range:t})}_getPath(t){let e=this._root,i=this._config,r="";if(t&&t!==e){let n=t.parentNode;if(r=n?this._getPath(n):"",t instanceof HTMLElement){let o=t.id,a=t.classList,l=Array.from(a).sort(),c=t.dir,h=i.classNames;r+=(r?">":"")+t.nodeName,o&&(r+="#"+o),l.length&&(r+=".",r+=l.join(".")),c&&(r+="[dir="+c+"]"),a.contains(h.highlight)&&(r+="[backgroundColor="+t.style.backgroundColor.replace(/ /g,"")+"]"),a.contains(h.color)&&(r+="[color="+t.style.color.replace(/ /g,"")+"]"),a.contains(h.fontFamily)&&(r+="[fontFamily="+t.style.fontFamily.replace(/ /g,"")+"]"),a.contains(h.fontSize)&&(r+="[fontSize="+t.style.fontSize+"]")}}return r}modifyDocument(t){let e=this._mutation;return e&&((()=>{let i=e.takeRecords();i.length&&this._onMutations(i)})(),e.disconnect()),this._ignoreAllChanges=!0,t(),this._ignoreAllChanges=!1,e&&(e.observe(this._root,{childList:!0,attributes:!0,attributeOldValue:!0,characterData:!0,subtree:!0}),this._ignoreChange=!1),this}_onMutations(t){let e=this._config.onMutations;return e?e(t,this):this._docWasChanged()}_docWasChanged(){if(Lr(),this._mayHaveZWS=!0,!this._ignoreAllChanges){if(this._ignoreChange){this._ignoreChange=!1;return}this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input")}}_recordUndoState(t,e){let i=this._isInUndoState;if(!i||e){let r=this._undoIndex+1,n=this._undoStack,o=this._config.undo,a=o.documentSizeThreshold,l=o.undoLimit;if(r<this._undoStackLength&&(n.length=this._undoStackLength=r),t&&this._saveRangeToBookmark(t),i)return this;let c=this._getRawHTML();e&&(r-=1),a>-1&&c.length*2>a&&l>-1&&r>l&&(n.splice(0,r-l),r=l,this._undoStackLength=l),n[r]=c,this._undoIndex=r,this._undoStackLength+=1,this._isInUndoState=!0}return this}saveUndoState(t){let e=!1;return t||(t=this.getSelection(),e=!0),this._recordUndoState(t,this._isInUndoState),this._getRangeAndRemoveBookmark(t),e&&this.setSelection(t),this}undo(){if(this._undoIndex!==0||!this._isInUndoState){this._recordUndoState(this.getSelection(),!1),this._undoIndex-=1,this._setRawHTML(this._undoStack[this._undoIndex]);let t=this._getRangeAndRemoveBookmark();t&&this.setSelection(t),this._isInUndoState=!0,this.fireEvent("undoStateChange",{canUndo:this._undoIndex!==0,canRedo:!0}),this.fireEvent("input")}return this.focus()}redo(){let t=this._undoIndex,e=this._undoStackLength;if(t+1<e&&this._isInUndoState){this._undoIndex+=1,this._setRawHTML(this._undoStack[this._undoIndex]);let i=this._getRangeAndRemoveBookmark();i&&this.setSelection(i),this.fireEvent("undoStateChange",{canUndo:!0,canRedo:t+2<e}),this.fireEvent("input")}return this.focus()}getRoot(){return this._root}_getRawHTML(){let t=this._config.serializeRoot;return t?t(this._root,this):this._root.innerHTML}_setRawHTML(t){let e=this._root;this._config.replaceRoot?this._config.replaceRoot(e,t,this):e.innerHTML=t;let i=e,r=i.firstChild;if(!r||r.nodeName==="BR"){let n=this.createDefaultBlock();r?i.replaceChild(n,r):i.appendChild(n)}else for(;i=Tt(i,e);)j(i);return this._ignoreChange=!0,this}getHTML(t){if(this._config.serializeRoot)return this._config.serializeRoot(this._root,this,t?this.getSelection():null).replace(/\u200B/g,"");let e,i="";return this.modifyDocument(()=>{t&&(e=this.getSelection(),this._saveRangeToBookmark(e)),i=this._getRawHTML().replace(/\u200B/g,""),t&&this._getRangeAndRemoveBookmark(e)}),i}setHTML(t){let e=this._config.sanitizeToDOMFragment(t,this),i=this._root;li(e,this._config),ci(e,i,!1),mt(e,i);let r=e,n=r.firstChild;if(!n||n.nodeName==="BR"){let a=this.createDefaultBlock();n?r.replaceChild(a,n):r.appendChild(a)}else for(;r=Tt(r,i);)j(r);for(this._ignoreChange=!0;n=i.lastChild;)i.removeChild(n);i.appendChild(e),this._undoIndex=-1,this._undoStack.length=0,this._undoStackLength=0,this._isInUndoState=!1;let o=this._getRangeAndRemoveBookmark()||zt(i.firstElementChild||i,0);return this.saveUndoState(o),this.setSelection(o),this._updatePath(o,!0),this}insertHTML(t,e){let i=this._config,r=i.sanitizeToDOMFragment(t,this),n=this.getSelection();this.saveUndoState(n);try{let o=this._root;i.addLinks&&this.addDetectedLinks(r,r),li(r,this._config),ci(r,o,!1),si(r),r.normalize();let a=r;for(;a=Tt(a,r);)j(a);let l=!0;if(e){let c=new CustomEvent("willPaste",{cancelable:!0,detail:{html:t,fragment:r}});this.fireEvent("willPaste",c),r=c.detail.fragment,l=!c.defaultPrevented}l&&(sa(n,r,o),n.collapse(!1),Or(n,"A",o),this._ensureBottomLine()),this.setSelection(n),this._updatePath(n,!0),e&&this.focus()}catch(o){this._config.didError(o)}return this}insertElement(t,e){if(e||(e=this.getSelection()),e.collapse(!0),L(t))Ct(e,t),e.setStartAfter(t);else{let i=this._root,r=at(e,i),n=r||i,o=null;for(;n!==i&&!n.nextSibling;)n=n.parentNode;if(n!==i){let l=n.parentNode;o=dt(l,n.nextSibling,i,i)}r&&hi(r)&&$(r),i.insertBefore(t,o);let a=this.createDefaultBlock();i.insertBefore(a,o),e.setStart(a,0),e.setEnd(a,0),J(e)}return this.focus(),this.setSelection(e),this._updatePath(e),this}insertImage(t,e){let i=x("IMG",Object.assign({src:t},e));return this.insertElement(i),i}insertPlainText(t,e){let i=this.getSelection();if(i.collapsed&&N(i.startContainer,this._root,"PRE")){let h=i.startContainer,u=i.startOffset,d;if(!h||!(h instanceof Text)){let b=document.createTextNode("");h.insertBefore(b,h.childNodes[u]),d=b,u=0}else d=h;let f=!0;if(e){let b=new CustomEvent("willPaste",{cancelable:!0,detail:{text:t}});this.fireEvent("willPaste",b),t=b.detail.text,f=!b.defaultPrevented}return f&&(this.saveUndoState(i),d.insertData(u,t),i.setStart(d,u+t.length),i.collapse(!0)),this.setSelection(i),this}let r=t.split(`
90
+ `),n=this._config,o=n.blockTag,a=n.blockAttributes,l="</"+o+">",c="<"+o;for(let h in a)c+=" "+h+'="'+Mr(a[h])+'"';c+=">";for(let h=0,u=r.length;h<u;h+=1){let d=r[h];d=Mr(d).replace(/ (?=(?: |$))/g,"&nbsp;"),h&&(d=c+(d||"<BR>")+l),r[h]=d}return this.insertHTML(r.join(""),e)}getSelectedText(t){return Ur(t||this.getSelection())}getFontInfo(t){let e={color:void 0,backgroundColor:void 0,fontFamily:void 0,fontSize:void 0};t||(t=this.getSelection()),J(t);let i=0,r=t.commonAncestorContainer;if(t.collapsed||r instanceof Text)for(r instanceof Text&&(r=r.parentNode);i<4&&r;){let n=r.style;if(n){let o=n.color;!e.color&&o&&(e.color=o,i+=1);let a=n.backgroundColor;!e.backgroundColor&&a&&(e.backgroundColor=a,i+=1);let l=n.fontFamily;!e.fontFamily&&l&&(e.fontFamily=l,i+=1);let c=n.fontSize;!e.fontSize&&c&&(e.fontSize=c,i+=1)}r=r.parentNode}return e}hasFormat(t,e,i){t=t.toUpperCase(),e||(e={}),i||(i=this.getSelection()),!i.collapsed&&i.startContainer instanceof Text&&i.startOffset===i.startContainer.length&&i.startContainer.nextSibling&&i.setStartBefore(i.startContainer.nextSibling),!i.collapsed&&i.endContainer instanceof Text&&i.endOffset===0&&i.endContainer.previousSibling&&i.setEndAfter(i.endContainer.previousSibling);let r=this._root,n=i.commonAncestorContainer;if(N(n,r,t,e))return!0;if(n instanceof Text)return!1;let o=new ot(n,4,c=>Lt(i,c,!0)),a=!1,l;for(;l=o.nextNode();){if(!N(l,r,t,e))return!1;a=!0}return a}changeFormat(t,e,i,r){return i||(i=this.getSelection()),this.saveUndoState(i),e&&(i=this._removeFormat(e.tag.toUpperCase(),e.attributes||{},i,r)),t&&(i=this._addFormat(t.tag.toUpperCase(),t.attributes||{},i)),this.setSelection(i),this._updatePath(i,!0),this.focus()}_addFormat(t,e,i){let r=this._root;if(i.collapsed){let n=j(x(t,e));Ct(i,n);let o=n.firstChild||n,a=o instanceof Text?o.length:0;i.setStart(o,a),i.collapse(!0);let l=n;for(;L(l);)l=l.parentNode;Ie(l,n)}else{let n=new ot(i.commonAncestorContainer,5,h=>(h instanceof Text||h.nodeName==="BR"||h.nodeName==="IMG")&&Lt(i,h,!0)),{startContainer:o,startOffset:a,endContainer:l,endOffset:c}=i;if(n.currentNode=o,!(o instanceof Element)&&!(o instanceof Text)||!n.filter(o)){let h=n.nextNode();if(!h)return i;o=h,a=0}do{let h=n.currentNode;if(!N(h,r,t,e)){h===l&&h.length>c&&h.splitText(c),h===o&&a&&(h=h.splitText(a),l===o?(l=h,c-=a):l===o.parentNode&&(c+=1),o=h,a=0);let u=x(t,e);X(h,u),u.appendChild(h)}}while(n.nextNode());i=zt(o,a,l,c)}return i}_removeFormat(t,e,i,r){this._saveRangeToBookmark(i);let n;i.collapsed&&(De?n=document.createTextNode("\u200B"):n=document.createTextNode(""),Ct(i,n));let o=i.commonAncestorContainer;for(;o!==this._root&&L(o);)o=o.parentNode;let a=i.startContainer,l=i.startOffset,c=i.endContainer,h=i.endOffset,u=[],d=(b,g)=>{if(Lt(i,b,!1))return;let E,T;if(!Lt(i,b,!0)){!(b instanceof HTMLInputElement)&&(!(b instanceof Text)||b.data)&&u.push([g,b]);return}if(b instanceof Text)b===c&&h!==b.length&&u.push([g,b.splitText(h)]),b===a&&l&&(b.splitText(l),u.push([g,b]));else for(E=b.firstChild;E;E=T)T=E.nextSibling,d(E,g)},f=Array.from(o.getElementsByTagName(t)).filter(b=>Lt(i,b,!0)&&oi(b,t,e));if(r||f.forEach(b=>{d(b,b)}),u.forEach(([b,g])=>{b=b.cloneNode(!1),X(g,b),b.appendChild(g)}),f.forEach(b=>{X(b,D(b))}),De&&n){n=n.parentNode;let b=n;for(;b&&L(b);)b=b.parentNode;b&&Ie(b,n)}return this._getRangeAndRemoveBookmark(i),n&&i.collapse(!1),Xt(o,i),i}bold(){return this.changeFormat({tag:"B"})}removeBold(){return this.changeFormat(null,{tag:"B"})}italic(){return this.changeFormat({tag:"I"})}removeItalic(){return this.changeFormat(null,{tag:"I"})}underline(){return this.changeFormat({tag:"U"})}removeUnderline(){return this.changeFormat(null,{tag:"U"})}strikethrough(){return this.changeFormat({tag:"S"})}removeStrikethrough(){return this.changeFormat(null,{tag:"S"})}subscript(){return this.changeFormat({tag:"SUB"},{tag:"SUP"})}removeSubscript(){return this.changeFormat(null,{tag:"SUB"})}superscript(){return this.changeFormat({tag:"SUP"},{tag:"SUB"})}removeSuperscript(){return this.changeFormat(null,{tag:"SUP"})}makeLink(t,e){let i=this.getSelection();if(i.collapsed){let r=t.indexOf(":")+1;if(r)for(;t[r]==="/";)r+=1;Ct(i,document.createTextNode(t.slice(r)))}return e=Object.assign({href:t},this._config.tagAttributes.a,e),this.changeFormat({tag:"A",attributes:e},{tag:"A"},i)}removeLink(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0)}addDetectedLinks(t,e){let i=new ot(t,4,a=>!N(a,e||this._root,"A")),r=this.linkRegExp,n=this._config.tagAttributes.a,o;for(;o=i.nextNode();){let a=o.parentNode,l=o.data,c;for(;c=r.exec(l);){let h=c.index,u=h+c[0].length;h&&a.insertBefore(document.createTextNode(l.slice(0,h)),o);let d=x("A",Object.assign({href:c[1]?/^(?:ht|f)tps?:/i.test(c[1])?c[1]:"http://"+c[1]:"mailto:"+c[0]},n));d.textContent=l.slice(h,u),a.insertBefore(d,o),o.data=l=l.slice(u)}}return this}setFontFace(t){let e=this._config.classNames.fontFamily;return this.changeFormat(t?{tag:"SPAN",attributes:{class:e,style:"font-family: "+t+", sans-serif;"}}:null,{tag:"SPAN",attributes:{class:e}})}setFontSize(t){let e=this._config.classNames.fontSize;return this.changeFormat(t?{tag:"SPAN",attributes:{class:e,style:"font-size: "+(typeof t=="number"?t+"px":t)}}:null,{tag:"SPAN",attributes:{class:e}})}setTextColor(t){let e=this._config.classNames.color;return this.changeFormat(t?{tag:"SPAN",attributes:{class:e,style:"color:"+t}}:null,{tag:"SPAN",attributes:{class:e}})}setHighlightColor(t){let e=this._config.classNames.highlight;return this.changeFormat(t?{tag:"SPAN",attributes:{class:e,style:"background-color:"+t}}:null,{tag:"SPAN",attributes:{class:e}})}_ensureBottomLine(){let t=this._root,e=t.lastElementChild,i=null;for(;e&&(e.matches("[editor-ui],[clay~=editor-ui]")||e.closest("[editor-ui],[clay~=editor-ui]"));)i=e,e=e.previousElementSibling;(!e||e.nodeName!==this._config.blockTag||!At(e))&&t.insertBefore(this.createDefaultBlock(),i)}createDefaultBlock(t){let e=this._config;return j(x(e.blockTag,e.blockAttributes,t))}splitBlock(t,e){e||(e=this.getSelection());let i=this._root,r,n,o,a;if(this._recordUndoState(e),this._removeZWS(),this._getRangeAndRemoveBookmark(e),e.collapsed||Wt(e,i),this._config.addLinks){J(e);let d=e.startContainer,f=e.startOffset;setTimeout(()=>{jr(this,d,f)},0)}if(r=at(e,i),r&&(n=N(r,i,"PRE"))){J(e),o=e.startContainer;let d=e.startOffset;return o instanceof Text||(o=document.createTextNode(""),n.insertBefore(o,n.firstChild),d=0),!t&&o instanceof Text&&(o.data.charAt(d-1)===`
91
+ `||ue(e,i))&&(o.data.charAt(d)===`
92
+ `||pe(e,i))?(o.deleteData(d&&d-1,d?2:1),a=dt(o,d&&d-1,i,i),o=a.previousSibling,o.textContent||$(o),o=this.createDefaultBlock(),a.parentNode.insertBefore(o,a),a.textContent||$(a),e.setStart(o,0)):(o.insertData(d,`
93
+ `),o.nextSibling||n.appendChild(x("BR")),o.length===d+1?e.setStartAfter(o):e.setStart(o,d+1)),e.collapse(!0),this.setSelection(e),this._updatePath(e,!0),this._docWasChanged(),this}if(!r||t||/^T[HD]$/.test(r.nodeName))return Or(e,"A",i),Ct(e,x("BR")),e.collapse(!1),this.setSelection(e),this._updatePath(e,!0),this;if((n=N(r,i,"LI"))&&(r=n),hi(r)){if(N(r,i,"UL")||N(r,i,"OL"))return this.decreaseListLevel(e),this;if(N(r,i,"BLOCKQUOTE"))return this.replaceWithBlankLine(e),this}o=e.startContainer;let l=e.startOffset,c=this.tagAfterSplit[r.nodeName];a=dt(o,l,r.parentNode,this._root);let h=this._config,u=null;for(c||(c=h.blockTag,u=h.blockAttributes),oi(a,c,u)||(r=x(c,u),a.dir&&(r.dir=a.dir),X(a,r),r.appendChild(D(a)),a=r),Ie(r),si(r),j(r);a instanceof Element;){let d=a.firstChild,f;if(a.nodeName==="A"&&(!a.textContent||a.textContent==="\u200B")){d=document.createTextNode(""),X(a,d),a=d;break}for(;d&&d instanceof Text&&!d.data&&(f=d.nextSibling,!(!f||f.nodeName==="BR"));)$(d),d=f;if(!d||d.nodeName==="BR"||d instanceof Text)break;a=d}return e=zt(a,0),this.setSelection(e),this._updatePath(e,!0),this}forEachBlock(t,e,i){i||(i=this.getSelection()),e&&this.saveUndoState(i);let r=this._root,n=at(i,r),o=qt(i,r);if(n&&o)do if(t(n)||n===o)break;while(n=Tt(n,r));return e&&(this.setSelection(i),this._updatePath(i,!0)),this}modifyBlocks(t,e){e||(e=this.getSelection()),this._recordUndoState(e,this._isInUndoState);let i=this._root;Fr(e,i),Ht(e,i,i,i);let r=Pr(e,i,i);if(!e.collapsed){let n=e.endContainer;if(n===i)e.collapse(!1);else{for(;n.parentNode!==i;)n=n.parentNode;e.setStartBefore(n),e.collapse(!0)}}return Ct(e,t.call(this,r)),e.endOffset<e.endContainer.childNodes.length&&Et(e.endContainer.childNodes[e.endOffset],i),Et(e.startContainer.childNodes[e.startOffset],i),this._getRangeAndRemoveBookmark(e),this.setSelection(e),this._updatePath(e,!0),this}setTextAlignment(t){return this.forEachBlock(e=>{let i=e.className.split(/\s+/).filter(r=>!!r&&!/^align/.test(r)).join(" ");t?(e.className=i+" align-"+t,e.style.textAlign=t):(e.className=i,e.style.textAlign="")},!0),this.focus()}setTextDirection(t){return this.forEachBlock(e=>{t?e.dir=t:e.removeAttribute("dir")},!0),this.focus()}_getListSelection(t,e){let i=t.commonAncestorContainer,r=t.startContainer,n=t.endContainer;for(;i&&i!==e&&!/^[OU]L$/.test(i.nodeName);)i=i.parentNode;if(!i||i===e)return null;for(r===i&&(r=r.childNodes[t.startOffset]),n===i&&(n=n.childNodes[t.endOffset]);r&&r.parentNode!==i;)r=r.parentNode;for(;n&&n.parentNode!==i;)n=n.parentNode;return[i,r,n]}increaseListLevel(t){t||(t=this.getSelection());let e=this._root,i=this._getListSelection(t,e);if(!i)return this.focus();let[r,n,o]=i;if(!n||n===r.firstChild)return this.focus();this._recordUndoState(t,this._isInUndoState);let a=r.nodeName,l=n.previousSibling,c,h;l.nodeName!==a&&(c=this._config.tagAttributes[a.toLowerCase()],l=x(a,c),r.insertBefore(l,n));do h=n===o?null:n.nextSibling,l.appendChild(n);while(n=h);return h=l.nextSibling,h&&Et(h,e),this._getRangeAndRemoveBookmark(t),this.setSelection(t),this._updatePath(t,!0),this.focus()}decreaseListLevel(t){t||(t=this.getSelection());let e=this._root,i=this._getListSelection(t,e);if(!i)return this.focus();let[r,n,o]=i;n||(n=r.firstChild),o||(o=r.lastChild),this._recordUndoState(t,this._isInUndoState);let a,l=null;if(n){let c=r.parentNode;if(l=o.nextSibling?dt(r,o.nextSibling,c,e):r.nextSibling,c!==e&&c.nodeName==="LI"){for(c=c.parentNode;l;)a=l.nextSibling,o.appendChild(l),l=a;l=r.parentNode.nextSibling}let h=!/^[OU]L$/.test(c.nodeName);do a=n===o?null:n.nextSibling,r.removeChild(n),h&&n.nodeName==="LI"&&(n=this.createDefaultBlock([D(n)])),c.insertBefore(n,l);while(n=a)}return r.firstChild||$(r),l&&Et(l,e),this._getRangeAndRemoveBookmark(t),this.setSelection(t),this._updatePath(t,!0),this.focus()}_makeList(t,e){let i=Be(t,this._root),r=this._config.tagAttributes,n=r[e.toLowerCase()],o=r.li,a;for(;a=i.nextNode();)if(a.parentNode instanceof HTMLLIElement&&(a=a.parentNode,i.currentNode=a.lastChild),a instanceof HTMLLIElement){a=a.parentNode;let l=a.nodeName;l!==e&&/^[OU]L$/.test(l)&&X(a,x(e,n,[D(a)]))}else{let l=x("LI",o);a.dir&&(l.dir=a.dir);let c=a.previousSibling;c&&c.nodeName===e?(c.appendChild(l),$(a)):X(a,x(e,n,[l])),l.appendChild(D(a)),i.currentNode=l}return t}makeUnorderedList(){return this.modifyBlocks(t=>this._makeList(t,"UL")),this.focus()}makeOrderedList(){return this.modifyBlocks(t=>this._makeList(t,"OL")),this.focus()}removeList(){return this.modifyBlocks(t=>{let e=t.querySelectorAll("UL, OL"),i=t.querySelectorAll("LI"),r=this._root;for(let n=0,o=e.length;n<o;n+=1){let a=e[n],l=D(a);mt(l,r),X(a,l)}for(let n=0,o=i.length;n<o;n+=1){let a=i[n];At(a)?X(a,this.createDefaultBlock([D(a)])):(mt(a,r),X(a,D(a)))}return t}),this.focus()}increaseQuoteLevel(t){return this.modifyBlocks(e=>x("BLOCKQUOTE",this._config.tagAttributes.blockquote,[e]),t),this.focus()}decreaseQuoteLevel(t){return this.modifyBlocks(e=>(Array.from(e.querySelectorAll("blockquote")).filter(i=>!N(i.parentNode,e,"BLOCKQUOTE")).forEach(i=>{X(i,D(i))}),e),t),this.focus()}removeQuote(t){return this.modifyBlocks(e=>(Array.from(e.querySelectorAll("blockquote")).forEach(i=>{X(i,D(i))}),e),t),this.focus()}replaceWithBlankLine(t){return this.modifyBlocks(()=>this.createDefaultBlock([x("INPUT",{id:this.startSelectionId,type:"hidden"}),x("INPUT",{id:this.endSelectionId,type:"hidden"})]),t),this.focus()}code(){let t=this.getSelection();return t.collapsed||Qt(t.commonAncestorContainer)?(this.modifyBlocks(e=>{let i=this._root,r=document.createDocumentFragment(),n=Be(e,i),o;for(;o=n.nextNode();){let l=o.querySelectorAll("BR"),c=[],h=l.length;for(let u=0;u<h;u+=1)c[u]=Re(l[u],!1);for(;h--;){let u=l[h];c[h]?X(u,document.createTextNode(`
94
+ `)):$(u)}for(l=o.querySelectorAll("CODE"),h=l.length;h--;)X(l[h],D(l[h]));r.childNodes.length&&r.appendChild(document.createTextNode(`
95
+ `)),r.appendChild(D(o))}let a=new ot(r,4);for(;o=a.nextNode();)o.data=o.data.replace(/ /g," ");return r.normalize(),j(x("PRE",this._config.tagAttributes.pre,[r]))},t),this.focus()):this.changeFormat({tag:"CODE",attributes:this._config.tagAttributes.code},null,t),this}removeCode(){let t=this.getSelection(),e=t.commonAncestorContainer;return N(e,this._root,"PRE")?(this.modifyBlocks(i=>{let r=this._root,n=i.querySelectorAll("PRE"),o=n.length;for(;o--;){let a=n[o],l=new ot(a,4),c;for(;c=l.nextNode();){let h=c.data;h=h.replace(/ (?= )/g,"\xA0");let u=document.createDocumentFragment(),d;for(;(d=h.indexOf(`
96
+ `))>-1;)u.appendChild(document.createTextNode(h.slice(0,d))),u.appendChild(x("BR")),h=h.slice(d+1);c.parentNode.insertBefore(u,c),c.data=h}mt(a,r),X(a,D(a))}return i},t),this.focus()):this.changeFormat(null,{tag:"CODE"},t),this}toggleCode(){return this.hasFormat("PRE")||this.hasFormat("CODE")?this.removeCode():this.code(),this}_removeFormatting(t,e){for(let i=t.firstChild,r;i;i=r){if(r=i.nextSibling,L(i)){if(i instanceof Text||i.nodeName==="BR"||i.nodeName==="IMG"){e.appendChild(i);continue}}else if(At(i)){e.appendChild(this.createDefaultBlock([this._removeFormatting(i,document.createDocumentFragment())]));continue}this._removeFormatting(i,e)}return e}removeAllFormatting(t){if(t||(t=this.getSelection()),t.collapsed)return this.focus();let e=this._root,i=t.commonAncestorContainer;for(;i&&i!==e&&!At(i);)i=i.parentNode;if(i||(Fr(t,e),i=e),i instanceof Text)return this.focus();this.saveUndoState(t),Ht(t,i,i,e);let r=t.startContainer,n=t.startOffset,o=t.endContainer,a=t.endOffset,l=document.createDocumentFragment(),c=document.createDocumentFragment(),h=dt(o,a,i,e),u=dt(r,n,i,e),d;for(;u!==h;)d=u.nextSibling,l.appendChild(u),u=d;if(this._removeFormatting(l,c),c.normalize(),u=c.firstChild,d=c.lastChild,u){i.insertBefore(c,h);let f=Array.from(i.childNodes);n=f.indexOf(u),a=d?f.indexOf(d)+1:0}else h&&(n=Array.from(i.childNodes).indexOf(h),a=n);return t.setStart(i,n),t.setEnd(i,a),Xt(i,t),J(t),this.setSelection(t),this._updatePath(t,!0),this.focus()}},_a=ka;function Gr(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function Aa(t){if(Array.isArray(t))return t}function La(t,e){var i=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(i!=null){var r,n,o,a,l=[],c=!0,h=!1;try{if(o=(i=i.call(t)).next,e!==0)for(;!(c=(r=o.call(i)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){h=!0,n=u}finally{try{if(!c&&i.return!=null&&(a=i.return(),Object(a)!==a))return}finally{if(h)throw n}}return l}}function Na(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
97
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Da(t,e){return Aa(t)||La(t,e)||Oa(t,e)||Na()}function Oa(t,e){if(t){if(typeof t=="string")return Gr(t,e);var i={}.toString.call(t).slice(8,-1);return i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set"?Array.from(t):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Gr(t,e):void 0}}var Zr=Object.entries,Yr=Object.setPrototypeOf,Ra=Object.isFrozen,Ia=Object.getPrototypeOf,Ma=Object.getOwnPropertyDescriptor,Z=Object.freeze,Y=Object.seal,te=Object.create,Qr=typeof Reflect<"u"&&Reflect,fi=Qr.apply,mi=Qr.construct;Z||(Z=function(t){return t}),Y||(Y=function(t){return t}),fi||(fi=function(t,e){for(var i=arguments.length,r=new Array(i>2?i-2:0),n=2;n<i;n++)r[n-2]=arguments[n];return t.apply(e,r)}),mi||(mi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return new t(...i)});var me=q(Array.prototype.forEach),Ba=q(Array.prototype.lastIndexOf),Xr=q(Array.prototype.pop),ee=q(Array.prototype.push),Fa=q(Array.prototype.splice),Nt=Array.isArray,ye=q(String.prototype.toLowerCase),yi=q(String.prototype.toString),Jr=q(String.prototype.match),ge=q(String.prototype.replace),tn=q(String.prototype.indexOf),Pa=q(String.prototype.trim),Ha=q(Number.prototype.toString),Ua=q(Boolean.prototype.toString),en=typeof BigInt>"u"?null:q(BigInt.prototype.toString),rn=typeof Symbol>"u"?null:q(Symbol.prototype.toString),V=q(Object.prototype.hasOwnProperty),be=q(Object.prototype.toString),Q=q(RegExp.prototype.test),Kt=qa(TypeError);function q(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];return fi(t,e,r)}}function qa(t){return function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return mi(t,i)}}function S(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ye;if(Yr&&Yr(t,null),!Nt(e))return t;let r=e.length;for(;r--;){let n=e[r];if(typeof n=="string"){let o=i(n);o!==n&&(Ra(e)||(e[r]=o),n=o)}t[n]=!0}return t}function za(t){for(let e=0;e<t.length;e++)V(t,e)||(t[e]=null);return t}function it(t){let e=te(null);for(let r of Zr(t)){var i=Da(r,2);let n=i[0],o=i[1];V(t,n)&&(Nt(o)?e[n]=za(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=it(o):e[n]=o)}return e}function Wa(t){switch(typeof t){case"string":return t;case"number":return Ha(t);case"boolean":return Ua(t);case"bigint":return en?en(t):"0";case"symbol":return rn?rn(t):"Symbol()";case"undefined":return be(t);case"function":case"object":{if(t===null)return be(t);let e=t,i=yt(e,"toString");if(typeof i=="function"){let r=i(e);return typeof r=="string"?r:be(r)}return be(t)}default:return be(t)}}function yt(t,e){for(;t!==null;){let r=Ma(t,e);if(r){if(r.get)return q(r.get);if(typeof r.value=="function")return q(r.value)}t=Ia(t)}function i(){return null}return i}function Ka(t){try{return Q(t,""),!0}catch{return!1}}var nn=Z(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gi=Z(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bi=Z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$a=Z(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),vi=Z(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ja=Z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),on=Z(["#text"]),an=Z(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),wi=Z(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ln=Z(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Fe=Z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Va=Y(/{{[\w\W]*|^[\w\W]*}}/g),Ga=Y(/<%[\w\W]*|^[\w\W]*%>/g),Za=Y(/\${[\w\W]*/g),Ya=Y(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qa=Y(/^aria-[\-\w]+$/),sn=Y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Xa=Y(/^(?:\w+script|data):/i),Ja=Y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tl=Y(/^html$/i),el=Y(/^[a-z][.\w]*(-[.\w]+)+$/i),cn=Y(/<[/\w!]/g),il=Y(/<[/\w]/g),rl=Y(/<\/no(script|embed|frames)/i),nl=Y(/\/>/i),gt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ol=function(){return typeof window>"u"?null:window},al=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null,r="data-tt-policy-suffix";e&&e.hasAttribute(r)&&(i=e.getAttribute(r));let n="dompurify"+(i?"#"+i:"");try{return t.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},hn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Dt=function(t,e,i,r){return V(t,e)&&Nt(t[e])?S(r.base?it(r.base):{},t[e],r.transform):i};function dn(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ol(),e=s=>dn(s);if(e.version="3.4.11",e.removed=[],!t||!t.document||t.document.nodeType!==gt.document||!t.Element)return e.isSupported=!1,e;let i=t.document,r=i,n=r.currentScript;t.DocumentFragment;let o=t.HTMLTemplateElement,a=t.Node,l=t.Element,c=t.NodeFilter;t.NamedNodeMap===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;let u=t.DOMParser,d=t.trustedTypes,f=l.prototype,b=yt(f,"cloneNode"),g=yt(f,"remove"),E=yt(f,"nextSibling"),T=yt(f,"childNodes"),R=yt(f,"parentNode"),z=yt(f,"shadowRoot"),rt=yt(f,"attributes"),K=a&&a.prototype?yt(a.prototype,"nodeType"):null,pt=a&&a.prototype?yt(a.prototype,"nodeName"):null;if(typeof o=="function"){let s=i.createElement("template");s.content&&s.content.ownerDocument&&(i=s.content.ownerDocument)}let st,jt="",tr,to=!1,Se=0,eo=function(){if(Se>0)throw Kt('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ne=function(s){eo(),Se++;try{return st.createHTML(s)}finally{Se--}},Ps=function(s){eo(),Se++;try{return st.createScriptURL(s)}finally{Se--}},Hs=function(){return to||(tr=al(d,n),to=!0),tr},je=i,er=je.implementation,io=je.createNodeIterator,Us=je.createDocumentFragment,qs=je.getElementsByTagName,zs=r.importNode,H=hn();e.isSupported=typeof Zr=="function"&&typeof R=="function"&&er&&er.createHTMLDocument!==void 0;let Ws=Va,Ks=Ga,$s=Za,js=Ya,Vs=Qa,Gs=Xa,ro=Ja,Zs=el,no=sn,I=null,oo=S({},[...nn,...gi,...bi,...vi,...on]),M=null,ao=S({},[...an,...wi,...ln,...Fe]),B=Object.seal(te(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ke=null,lo=null,Rt=Object.seal(te(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),so=!0,ir=!0,co=!1,ho=!0,It=!1,_e=!0,Vt=!1,rr=!1,nr=null,or=null,ar=!1,oe=!1,Ve=!1,Ge=!1,uo=!0,po=!1,fo="user-content-",lr=!0,sr=!1,ae={},vt=null,cr=S({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),mo=null,yo=S({},["audio","video","img","source","image","track"]),hr=null,go=S({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ze="http://www.w3.org/1998/Math/MathML",Ye="http://www.w3.org/2000/svg",wt="http://www.w3.org/1999/xhtml",le=wt,dr=!1,ur=null,Ys=S({},[Ze,Ye,wt],yi),bo=Z(["mi","mo","mn","ms","mtext"]),pr=S({},bo),vo=Z(["annotation-xml"]),fr=S({},vo),Qs=S({},["title","style","font","a","script"]),Ae=null,Xs=["application/xhtml+xml","text/html"],Js="text/html",F=null,se=null,tc=i.createElement("form"),wo=function(s){return s instanceof RegExp||s instanceof Function},mr=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(se&&se===s)return;(!s||typeof s!="object")&&(s={}),s=it(s),Ae=Xs.indexOf(s.PARSER_MEDIA_TYPE)===-1?Js:s.PARSER_MEDIA_TYPE,F=Ae==="application/xhtml+xml"?yi:ye,I=Dt(s,"ALLOWED_TAGS",oo,{transform:F}),M=Dt(s,"ALLOWED_ATTR",ao,{transform:F}),ur=Dt(s,"ALLOWED_NAMESPACES",Ys,{transform:yi}),hr=Dt(s,"ADD_URI_SAFE_ATTR",go,{transform:F,base:go}),mo=Dt(s,"ADD_DATA_URI_TAGS",yo,{transform:F,base:yo}),vt=Dt(s,"FORBID_CONTENTS",cr,{transform:F}),ke=Dt(s,"FORBID_TAGS",it({}),{transform:F}),lo=Dt(s,"FORBID_ATTR",it({}),{transform:F}),ae=V(s,"USE_PROFILES")?s.USE_PROFILES&&typeof s.USE_PROFILES=="object"?it(s.USE_PROFILES):s.USE_PROFILES:!1,so=s.ALLOW_ARIA_ATTR!==!1,ir=s.ALLOW_DATA_ATTR!==!1,co=s.ALLOW_UNKNOWN_PROTOCOLS||!1,ho=s.ALLOW_SELF_CLOSE_IN_ATTR!==!1,It=s.SAFE_FOR_TEMPLATES||!1,_e=s.SAFE_FOR_XML!==!1,Vt=s.WHOLE_DOCUMENT||!1,oe=s.RETURN_DOM||!1,Ve=s.RETURN_DOM_FRAGMENT||!1,Ge=s.RETURN_TRUSTED_TYPE||!1,ar=s.FORCE_BODY||!1,uo=s.SANITIZE_DOM!==!1,po=s.SANITIZE_NAMED_PROPS||!1,lr=s.KEEP_CONTENT!==!1,sr=s.IN_PLACE||!1,no=Ka(s.ALLOWED_URI_REGEXP)?s.ALLOWED_URI_REGEXP:sn,le=typeof s.NAMESPACE=="string"?s.NAMESPACE:wt,pr=V(s,"MATHML_TEXT_INTEGRATION_POINTS")&&s.MATHML_TEXT_INTEGRATION_POINTS&&typeof s.MATHML_TEXT_INTEGRATION_POINTS=="object"?it(s.MATHML_TEXT_INTEGRATION_POINTS):S({},bo),fr=V(s,"HTML_INTEGRATION_POINTS")&&s.HTML_INTEGRATION_POINTS&&typeof s.HTML_INTEGRATION_POINTS=="object"?it(s.HTML_INTEGRATION_POINTS):S({},vo);let p=V(s,"CUSTOM_ELEMENT_HANDLING")&&s.CUSTOM_ELEMENT_HANDLING&&typeof s.CUSTOM_ELEMENT_HANDLING=="object"?it(s.CUSTOM_ELEMENT_HANDLING):te(null);if(B=te(null),V(p,"tagNameCheck")&&wo(p.tagNameCheck)&&(B.tagNameCheck=p.tagNameCheck),V(p,"attributeNameCheck")&&wo(p.attributeNameCheck)&&(B.attributeNameCheck=p.attributeNameCheck),V(p,"allowCustomizedBuiltInElements")&&typeof p.allowCustomizedBuiltInElements=="boolean"&&(B.allowCustomizedBuiltInElements=p.allowCustomizedBuiltInElements),Y(B),It&&(ir=!1),Ve&&(oe=!0),ae&&(I=S({},on),M=te(null),ae.html===!0&&(S(I,nn),S(M,an)),ae.svg===!0&&(S(I,gi),S(M,wi),S(M,Fe)),ae.svgFilters===!0&&(S(I,bi),S(M,wi),S(M,Fe)),ae.mathMl===!0&&(S(I,vi),S(M,ln),S(M,Fe))),Rt.tagCheck=null,Rt.attributeCheck=null,V(s,"ADD_TAGS")&&(typeof s.ADD_TAGS=="function"?Rt.tagCheck=s.ADD_TAGS:Nt(s.ADD_TAGS)&&(I===oo&&(I=it(I)),S(I,s.ADD_TAGS,F))),V(s,"ADD_ATTR")&&(typeof s.ADD_ATTR=="function"?Rt.attributeCheck=s.ADD_ATTR:Nt(s.ADD_ATTR)&&(M===ao&&(M=it(M)),S(M,s.ADD_ATTR,F))),V(s,"ADD_URI_SAFE_ATTR")&&Nt(s.ADD_URI_SAFE_ATTR)&&S(hr,s.ADD_URI_SAFE_ATTR,F),V(s,"FORBID_CONTENTS")&&Nt(s.FORBID_CONTENTS)&&(vt===cr&&(vt=it(vt)),S(vt,s.FORBID_CONTENTS,F)),V(s,"ADD_FORBID_CONTENTS")&&Nt(s.ADD_FORBID_CONTENTS)&&(vt===cr&&(vt=it(vt)),S(vt,s.ADD_FORBID_CONTENTS,F)),lr&&(I["#text"]=!0),Vt&&S(I,["html","head","body"]),I.table&&(S(I,["tbody"]),delete ke.tbody),s.TRUSTED_TYPES_POLICY){if(typeof s.TRUSTED_TYPES_POLICY.createHTML!="function")throw Kt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof s.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Kt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let y=st;st=s.TRUSTED_TYPES_POLICY;try{jt=ne("")}catch(v){throw st=y,v}}else s.TRUSTED_TYPES_POLICY===null?(st=void 0,jt=""):(st===void 0&&(st=Hs()),st&&typeof jt=="string"&&(jt=ne("")));Z&&Z(s),se=s},xo=S({},[...gi,...bi,...$a]),Eo=S({},[...vi,...ja]),ec=function(s,p,y){return p.namespaceURI===wt?s==="svg":p.namespaceURI===Ze?s==="svg"&&(y==="annotation-xml"||pr[y]):!!xo[s]},ic=function(s,p,y){return p.namespaceURI===wt?s==="math":p.namespaceURI===Ye?s==="math"&&fr[y]:!!Eo[s]},rc=function(s,p,y){return p.namespaceURI===Ye&&!fr[y]||p.namespaceURI===Ze&&!pr[y]?!1:!Eo[s]&&(Qs[s]||!xo[s])},nc=function(s){let p=R(s);(!p||!p.tagName)&&(p={namespaceURI:le,tagName:"template"});let y=ye(s.tagName),v=ye(p.tagName);return ur[s.namespaceURI]?s.namespaceURI===Ye?ec(y,p,v):s.namespaceURI===Ze?ic(y,p,v):s.namespaceURI===wt?rc(y,p,v):!!(Ae==="application/xhtml+xml"&&ur[s.namespaceURI]):!1},Gt=function(s){ee(e.removed,{element:s});try{R(s).removeChild(s)}catch{if(g(s),!R(s))throw Kt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},To=function(s){let p=T(s);if(p){let v=[];me(p,C=>{ee(v,C)}),me(v,C=>{try{g(C)}catch{}})}let y=rt(s);if(y)for(let v=y.length-1;v>=0;--v){let C=y[v],_=C&&C.name;if(typeof _=="string")try{s.removeAttribute(_)}catch{}}},Zt=function(s,p){try{ee(e.removed,{attribute:p.getAttributeNode(s),from:p})}catch{ee(e.removed,{attribute:null,from:p})}if(p.removeAttribute(s),s==="is")if(oe||Ve)try{Gt(p)}catch{}else try{p.setAttribute(s,"")}catch{}},oc=function(s){let p=rt(s);if(p)for(let y=p.length-1;y>=0;--y){let v=p[y],C=v&&v.name;if(!(typeof C!="string"||M[F(C)]))try{s.removeAttribute(C)}catch{}}},ac=function(s){let p=[s];for(;p.length>0;){let y=p.pop();(K?K(y):y.nodeType)===gt.element&&oc(y);let v=T(y);if(v)for(let C=v.length-1;C>=0;--C)p.push(v[C])}},Co=function(s){let p=null,y=null;if(ar)s="<remove></remove>"+s;else{let _=Jr(s,/^[\r\n\t ]+/);y=_&&_[0]}Ae==="application/xhtml+xml"&&le===wt&&(s='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+s+"</body></html>");let v=st?ne(s):s;if(le===wt)try{p=new u().parseFromString(v,Ae)}catch{}if(!p||!p.documentElement){p=er.createDocument(le,"template",null);try{p.documentElement.innerHTML=dr?jt:v}catch{}}let C=p.body||p.documentElement;return s&&y&&C.insertBefore(i.createTextNode(y),C.childNodes[0]||null),le===wt?qs.call(p,Vt?"html":"body")[0]:Vt?p.documentElement:C},So=function(s){return io.call(s.ownerDocument||s,s,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Qe=function(s){return s=ge(s,Ws," "),s=ge(s,Ks," "),s=ge(s,$s," "),s},yr=function(s){var p;s.normalize();let y=io.call(s.ownerDocument||s,s,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),v=y.nextNode();for(;v;)v.data=Qe(v.data),v=y.nextNode();let C=(p=s.querySelectorAll)===null||p===void 0?void 0:p.call(s,"template");C&&me(C,_=>{ce(_.content)&&yr(_.content)})},Xe=function(s){let p=pt?pt(s):null;return typeof p!="string"||F(p)!=="form"?!1:typeof s.nodeName!="string"||typeof s.textContent!="string"||typeof s.removeChild!="function"||s.attributes!==rt(s)||typeof s.removeAttribute!="function"||typeof s.setAttribute!="function"||typeof s.namespaceURI!="string"||typeof s.insertBefore!="function"||typeof s.hasChildNodes!="function"||s.nodeType!==K(s)||s.childNodes!==T(s)},ce=function(s){if(!K||typeof s!="object"||s===null)return!1;try{return K(s)===gt.documentFragment}catch{return!1}},Le=function(s){if(!K||typeof s!="object"||s===null)return!1;try{return typeof K(s)=="number"}catch{return!1}};function kt(s,p,y){s.length!==0&&me(s,v=>{v.call(e,p,y,se)})}let lc=function(s,p){return!!(_e&&s.hasChildNodes()&&!Le(s.firstElementChild)&&Q(cn,s.textContent)&&Q(cn,s.innerHTML)||_e&&s.namespaceURI===wt&&p==="style"&&Le(s.firstElementChild)||s.nodeType===gt.processingInstruction||_e&&s.nodeType===gt.comment&&Q(il,s.data))},sc=function(s,p){if(!ke[p]&&Ao(p)&&(B.tagNameCheck instanceof RegExp&&Q(B.tagNameCheck,p)||B.tagNameCheck instanceof Function&&B.tagNameCheck(p)))return!1;if(lr&&!vt[p]){let y=R(s),v=T(s);if(v&&y){let C=v.length;for(let _=C-1;_>=0;--_){let A=sr?v[_]:b(v[_],!0);y.insertBefore(A,E(s))}}}return Gt(s),!0},ko=function(s){if(kt(H.beforeSanitizeElements,s,null),Xe(s))return Gt(s),!0;let p=F(pt?pt(s):s.nodeName);if(kt(H.uponSanitizeElement,s,{tagName:p,allowedTags:I}),lc(s,p))return Gt(s),!0;if(ke[p]||!(Rt.tagCheck instanceof Function&&Rt.tagCheck(p))&&!I[p])return sc(s,p);if((K?K(s):s.nodeType)===gt.element&&!nc(s)||(p==="noscript"||p==="noembed"||p==="noframes")&&Q(rl,s.innerHTML))return Gt(s),!0;if(It&&s.nodeType===gt.text){let y=Qe(s.textContent);s.textContent!==y&&(ee(e.removed,{element:s.cloneNode()}),s.textContent=y)}return kt(H.afterSanitizeElements,s,null),!1},_o=function(s,p,y){if(lo[p]||uo&&(p==="id"||p==="name")&&(y in i||y in tc))return!1;let v=M[p]||Rt.attributeCheck instanceof Function&&Rt.attributeCheck(p,s);if(!(ir&&Q(js,p))&&!(so&&Q(Vs,p))){if(v){if(!hr[p]&&!Q(no,ge(y,ro,""))&&!((p==="src"||p==="xlink:href"||p==="href")&&s!=="script"&&tn(y,"data:")===0&&mo[s])&&!(co&&!Q(Gs,ge(y,ro,"")))&&y)return!1}else if(!(Ao(s)&&(B.tagNameCheck instanceof RegExp&&Q(B.tagNameCheck,s)||B.tagNameCheck instanceof Function&&B.tagNameCheck(s))&&(B.attributeNameCheck instanceof RegExp&&Q(B.attributeNameCheck,p)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(p,s))||p==="is"&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&Q(B.tagNameCheck,y)||B.tagNameCheck instanceof Function&&B.tagNameCheck(y))))return!1}return!0},cc=S({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ao=function(s){return!cc[ye(s)]&&Q(Zs,s)},hc=function(s,p,y,v){if(st&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!y)switch(d.getAttributeType(s,p)){case"TrustedHTML":return ne(v);case"TrustedScriptURL":return Ps(v)}return v},dc=function(s,p,y,v){try{y?s.setAttributeNS(y,p,v):s.setAttribute(p,v),Xe(s)?Gt(s):Xr(e.removed)}catch{Zt(p,s)}},Lo=function(s){kt(H.beforeSanitizeAttributes,s,null);let p=s.attributes;if(!p||Xe(s))return;let y={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0},v=p.length,C=F(s.nodeName);for(;v--;){let _=p[v],A=_.name,Yt=_.namespaceURI,Mt=_.value,ct=F(A),Bt=Mt,nt=A==="value"?Bt:Pa(Bt);if(y.attrName=ct,y.attrValue=nt,y.keepAttr=!0,y.forceKeepAttr=void 0,kt(H.uponSanitizeAttribute,s,y),nt=y.attrValue,po&&(ct==="id"||ct==="name")&&tn(nt,fo)!==0&&(Zt(A,s),nt=fo+nt),_e&&Q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,nt)){Zt(A,s);continue}if(ct==="attributename"&&Jr(nt,"href")){Zt(A,s);continue}if(!y.forceKeepAttr){if(!y.keepAttr){Zt(A,s);continue}if(!ho&&Q(nl,nt)){Zt(A,s);continue}if(It&&(nt=Qe(nt)),!_o(C,ct,nt)){Zt(A,s);continue}nt=hc(C,ct,Yt,nt),nt!==Bt&&dc(s,A,Yt,nt)}}kt(H.afterSanitizeAttributes,s,null)},Je=function(s){let p=null,y=So(s);for(kt(H.beforeSanitizeShadowDOM,s,null);p=y.nextNode();)if(kt(H.uponSanitizeShadowNode,p,null),ko(p),Lo(p),ce(p.content)&&Je(p.content),(K?K(p):p.nodeType)===gt.element){let v=z(p);ce(v)&&(gr(v),Je(v))}kt(H.afterSanitizeShadowDOM,s,null)},gr=function(s){let p=[{node:s,shadow:null}];for(;p.length>0;){let y=p.pop();if(y.shadow){Je(y.shadow);continue}let v=y.node,C=(K?K(v):v.nodeType)===gt.element,_=T(v);if(_)for(let A=_.length-1;A>=0;--A)p.push({node:_[A],shadow:null});if(C){let A=pt?pt(v):null;if(typeof A=="string"&&F(A)==="template"){let Yt=v.content;ce(Yt)&&p.push({node:Yt,shadow:null})}}if(C){let A=z(v);ce(A)&&p.push({node:null,shadow:A},{node:A,shadow:null})}}};return e.sanitize=function(s){let p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=null,v=null,C=null,_=null;if(dr=!s,dr&&(s="<!-->"),typeof s!="string"&&!Le(s)&&(s=Wa(s),typeof s!="string"))throw Kt("dirty is not a string, aborting");if(!e.isSupported)return s;rr?(I=nr,M=or):mr(p),(H.uponSanitizeElement.length>0||H.uponSanitizeAttribute.length>0)&&(I=it(I)),H.uponSanitizeAttribute.length>0&&(M=it(M)),e.removed=[];let A=sr&&typeof s!="string"&&Le(s);if(A){let ct=pt?pt(s):s.nodeName;if(typeof ct=="string"){let Bt=F(ct);if(!I[Bt]||ke[Bt])throw Kt("root node is forbidden and cannot be sanitized in-place")}if(Xe(s))throw Kt("root node is clobbered and cannot be sanitized in-place");try{gr(s)}catch(Bt){throw To(s),Bt}}else if(Le(s))y=Co("<!---->"),v=y.ownerDocument.importNode(s,!0),v.nodeType===gt.element&&v.nodeName==="BODY"||v.nodeName==="HTML"?y=v:y.appendChild(v),gr(v);else{if(!oe&&!It&&!Vt&&s.indexOf("<")===-1)return st&&Ge?ne(s):s;if(y=Co(s),!y)return oe?null:Ge?jt:""}y&&ar&&Gt(y.firstChild);let Yt=So(A?s:y);try{for(;C=Yt.nextNode();)ko(C),Lo(C),ce(C.content)&&Je(C.content)}catch(ct){throw A&&To(s),ct}if(A)return me(e.removed,ct=>{ct.element&&ac(ct.element)}),It&&yr(s),s;if(oe){if(It&&yr(y),Ve)for(_=Us.call(y.ownerDocument);y.firstChild;)_.appendChild(y.firstChild);else _=y;return(M.shadowroot||M.shadowrootmode)&&(_=zs.call(r,_,!0)),_}let Mt=Vt?y.outerHTML:y.innerHTML;return Vt&&I["!doctype"]&&y.ownerDocument&&y.ownerDocument.doctype&&y.ownerDocument.doctype.name&&Q(tl,y.ownerDocument.doctype.name)&&(Mt="<!DOCTYPE "+y.ownerDocument.doctype.name+`>
98
+ `+Mt),It&&(Mt=Qe(Mt)),st&&Ge?ne(Mt):Mt},e.setConfig=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mr(s),rr=!0,nr=I,or=M},e.clearConfig=function(){se=null,rr=!1,nr=null,or=null,st=tr,jt=""},e.isValidAttribute=function(s,p,y){se||mr({});let v=F(s),C=F(p);return _o(v,C,y)},e.addHook=function(s,p){typeof p=="function"&&V(H,s)&&ee(H[s],p)},e.removeHook=function(s,p){if(V(H,s)){if(p!==void 0){let y=Ba(H[s],p);return y===-1?void 0:Fa(H[s],y,1)[0]}return Xr(H[s])}},e.removeHooks=function(s){V(H,s)&&(H[s]=[])},e.removeAllHooks=function(){H=hn()},e}var ll=dn(),W=(t,e="0 0 18 18")=>`<svg viewBox="${e}" width="18" height="18" aria-hidden="true" focusable="false">${t}</svg>`,O={bold:W('<path fill="currentColor" d="M178.48,115.7A44,44,0,0,0,148,40H80a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8h80a48,48,0,0,0,18.48-92.3ZM88,56h60a28,28,0,0,1,0,56H88Zm72,136H88V128h72a32,32,0,0,1,0,64Z"/>',"0 0 256 256"),italic:W('<path fill="currentColor" d="M200,56a8,8,0,0,1-8,8H157.77L115.1,192H144a8,8,0,0,1,0,16H64a8,8,0,0,1,0-16H98.23L140.9,64H112a8,8,0,0,1,0-16h80A8,8,0,0,1,200,56Z"/>',"0 0 256 256"),underline:W('<path fill="currentColor" d="M200,224a8,8,0,0,1-8,8H64a8,8,0,0,1,0-16H192A8,8,0,0,1,200,224Zm-72-24a64.07,64.07,0,0,0,64-64V56a8,8,0,0,0-16,0v80a48,48,0,0,1-96,0V56a8,8,0,0,0-16,0v80A64.07,64.07,0,0,0,128,200Z"/>',"0 0 256 256"),strike:W('<path fill="currentColor" d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"/>',"0 0 256 256"),link:W('<path fill="currentColor" d="M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"/>',"0 0 256 256"),unlink:W('<path fill="currentColor" d="M198.63,57.37a32,32,0,0,0-45.19-.06L141.79,69.52a8,8,0,0,1-11.58-11l11.72-12.29a1.59,1.59,0,0,1,.13-.13,48,48,0,0,1,67.88,67.88,1.59,1.59,0,0,1-.13.13l-12.29,11.72a8,8,0,0,1-11-11.58l12.21-11.65A32,32,0,0,0,198.63,57.37ZM114.21,186.48l-11.65,12.21a32,32,0,0,1-45.25-45.25l12.21-11.65a8,8,0,0,0-11-11.58L46.19,141.93a1.59,1.59,0,0,0-.13.13,48,48,0,0,0,67.88,67.88,1.59,1.59,0,0,0,.13-.13l11.72-12.29a8,8,0,1,0-11.58-11ZM216,152H192a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16ZM40,104H64a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm120,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V192A8,8,0,0,0,160,184ZM96,72a8,8,0,0,0,8-8V40a8,8,0,0,0-16,0V64A8,8,0,0,0,96,72Z"/>',"0 0 256 256"),ul:W('<path fill="currentColor" d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"/>',"0 0 256 256"),ol:W('<path fill="currentColor" d="M224,128a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM104,72H216a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16ZM216,184H104a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM43.58,55.16,48,52.94V104a8,8,0,0,0,16,0V40a8,8,0,0,0-11.58-7.16l-16,8a8,8,0,0,0,7.16,14.32ZM79.77,156.72a23.73,23.73,0,0,0-9.6-15.95,24.86,24.86,0,0,0-34.11,4.7,23.63,23.63,0,0,0-3.57,6.46,8,8,0,1,0,15,5.47,7.84,7.84,0,0,1,1.18-2.13,8.76,8.76,0,0,1,12-1.59A7.91,7.91,0,0,1,63.93,159a7.64,7.64,0,0,1-1.57,5.78,1,1,0,0,0-.08.11L33.59,203.21A8,8,0,0,0,40,216H72a8,8,0,0,0,0-16H56l19.08-25.53A23.47,23.47,0,0,0,79.77,156.72Z"/>',"0 0 256 256"),quote:W('<path fill="currentColor" d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z"/>',"0 0 256 256"),undo:W('<path fill="currentColor" d="M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"/>',"0 0 256 256"),redo:W('<path fill="currentColor" d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/>',"0 0 256 256"),clear:W('<path fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="square" stroke-linejoin="miter" d="M3 3l18 18M5 5v3M9 5h10v3M12 5v3M12 12v7M8 19h8"/>',"0 0 24 24"),code:W('<path fill="currentColor" d="M69.12,94.15,28.5,128l40.62,33.85a8,8,0,1,1-10.24,12.29l-48-40a8,8,0,0,1,0-12.29l48-40a8,8,0,0,1,10.24,12.3Zm176,27.7-48-40a8,8,0,1,0-10.24,12.3L227.5,128l-40.62,33.85a8,8,0,1,0,10.24,12.29l48-40a8,8,0,0,0,0-12.29ZM162.73,32.48a8,8,0,0,0-10.25,4.79l-64,176a8,8,0,0,0,4.79,10.26A8.14,8.14,0,0,0,96,224a8,8,0,0,0,7.52-5.27l64-176A8,8,0,0,0,162.73,32.48Z"/>',"0 0 256 256"),indent:W('<path fill="currentColor" d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM34.34,141.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0,0-11.32l-40-40A8,8,0,0,0,34.34,61.66L68.69,96,34.34,130.34A8,8,0,0,0,34.34,141.66Z"/>',"0 0 256 256"),outdent:W('<path fill="currentColor" d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM72,144a8,8,0,0,0,5.66-13.66L43.31,96,77.66,61.66A8,8,0,0,0,66.34,50.34l-40,40a8,8,0,0,0,0,11.32l40,40A8,8,0,0,0,72,144Z"/>',"0 0 256 256"),blocks:W('<path fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="square" stroke-linejoin="miter" d="M19 4h-9a4.5 4.5 0 0 0 0 9h3M13 4v16M17 4v16"/>',"0 0 24 24"),h1:W('<path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M3.5 5.5v12M12 5.5v12M3.5 11.5H12M17 12l3-2v10"/>',"0 0 24 24"),h2:W('<path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M3.5 5.5v12M12 5.5v12M3.5 11.5H12M16 12.5c0-3.5 6-3.5 6 0 0 2-2.5 3.5-6 7.5h6"/>',"0 0 24 24"),h3:W('<path fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M3.5 5.5v12M12 5.5v12M3.5 11.5H12M16 11c1.5-1.5 6-1.5 6 1.5 0 1.5-1.5 2.5-3 2.5h-1M19 15c1.5 0 3 1 3 2.5 0 3-4.5 3-6 1.5"/>',"0 0 24 24")},St=t=>t.blocksStayOut(),sl=t=>!!t.element.closest("a"),Pe={minimal:["bold","italic","link","unorderedList"],inline:["bold","italic","underline","strikethrough","code","link","undo","redo","clearFormatting"],standard:["blockMenu","bold","italic","underline","strikethrough","code","link","unorderedList","orderedList","quote","outdent","indent","undo","redo","clearFormatting"]};function cl(){return new Map(dl.map(t=>[t.id,t]))}function ie(t=globalThis){let e=t?.navigator;return e?/Mac|iPhone|iPad|iPod/.test(e.platform||e.userAgent||""):!1}function hl(t,e=globalThis){return t?t.replace("Mod",ie(e)?"Cmd":"Ctrl"):""}var dl=[Ot("bold","Bold",O.bold,"Mod+B","inline",t=>t.toggleFormat("B","bold","removeBold")),Ot("italic","Italic",O.italic,"Mod+I","inline",t=>t.toggleFormat("I","italic","removeItalic")),Ot("underline","Underline",O.underline,"Mod+U","inline",t=>t.toggleFormat("U","underline","removeUnderline")),Ot("strikethrough","Strikethrough",O.strike,"Mod+Shift+7","inline",t=>t.toggleFormat("S","strikethrough","removeStrikethrough")),Ot("code","Code",O.code,null,"inline",t=>t.toggleCode(),t=>t.selectionHasFormat("CODE")||t.selectionHasFormat("PRE")),{id:"link",label:"Link",ariaLabel:"Insert or edit link",icon:O.link,group:"links",shortcut:"Mod+K",mutates:!1,isDisabled:sl,run:t=>t.openLinkDialog(),isActive:t=>!!t.currentLinkElement()},{id:"unlink",label:"Remove link",ariaLabel:"Remove link",icon:O.unlink,group:"links",run:t=>t.squire.removeLink()},Ot("unorderedList","Bulleted list",O.ul,"Mod+Shift+8","lists",t=>t.toggleList("UL"),t=>t.pathHas("UL"),St),Ot("orderedList","Numbered list",O.ol,"Mod+Shift+9","lists",t=>t.toggleList("OL"),t=>t.pathHas("OL"),St),Ot("quote","Quote",O.quote,null,"blocks",t=>t.pathHas("BLOCKQUOTE")?t.squire.decreaseQuoteLevel():t.squire.increaseQuoteLevel(),t=>t.pathHas("BLOCKQUOTE"),St),{id:"outdent",label:"Outdent",ariaLabel:"Decrease indent",icon:O.outdent,group:"blocks",shortcut:"Mod+[",isDisabled:St,run:t=>t.outdent()},{id:"indent",label:"Indent",ariaLabel:"Increase indent",icon:O.indent,group:"blocks",shortcut:"Mod+]",isDisabled:St,run:t=>t.indent()},{id:"undo",label:"Undo",ariaLabel:"Undo",icon:O.undo,group:"history",shortcut:"Mod+Z",mutates:!1,run:t=>t.history("undo")},{id:"redo",label:"Redo",ariaLabel:"Redo",icon:O.redo,group:"history",shortcut:"Mod+Shift+Z",mutates:!1,run:t=>t.history("redo")},{id:"clearFormatting",label:"Clear formatting",ariaLabel:"Clear formatting",icon:O.clear,group:"cleanup",run:t=>t.squire.removeAllFormatting()},{id:"blockMenu",type:"menu",label:"Block style",ariaLabel:"Choose block style",icon:O.blocks,group:"blocks",isDisabled:St,options:[He("Paragraph","P",O.blocks),He("Heading 1","H1",O.h1),He("Heading 2","H2",O.h2),He("Heading 3","H3",O.h3),{label:"Quote",icon:O.quote,value:"BLOCKQUOTE",isDisabled:St,run:t=>t.squire.increaseQuoteLevel(),isActive:t=>t.pathHas("BLOCKQUOTE")},{label:"Code block",icon:O.code,value:"PRE",isDisabled:St,run:t=>t.setBlockType("PRE"),isActive:t=>t.pathHas("PRE")}]}];function Ot(t,e,i,r,n,o,a=c=>c.selectionHasFormat(ul(t)),l){return{id:t,label:e,ariaLabel:e,icon:i,group:n,shortcut:r,isDisabled:l,run:o,isActive:a}}function ul(t){return{bold:"B",italic:"I",underline:"U",strikethrough:"S"}[t]}function He(t,e,i){return{label:t,icon:i,value:e,isDisabled:St,run:r=>r.setBlockType(e),isActive:r=>r.pathHas(e)}}var xi=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|EL|FN)|EM|FONT|HR|I(?:FRAME|MG|NPUT|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:AMP|MALL|PAN|TR(?:IKE|ONG)|U[BP])?|TIME|U|VAR|WBR)$/,Ue=/[^ \t\r\n]/,pl=new Set(["BR","HR","IFRAME","IMG","INPUT","WBR"]),Ei=t=>t?.nodeType===1&&t.matches('[editor-ui],[clay~="editor-ui"]'),ve=new Set(["svg","math"]);function qe(t){let e=t.nodeType;return e===3||e===8?!0:e!==1?!1:ve.has(t.nodeName)?!0:xi.test(t.nodeName)?Array.from(t.childNodes).every(qe):!1}function we(t){return Array.from(t.childNodes).some(e=>!qe(e))}var Ti=t=>t?.nodeType===1&&!ve.has(t.nodeName)&&!xi.test(t.nodeName);function Ci(t,e){let i=Array.from(t.childNodes),r=0;return i.forEach((n,o)=>{if(!(n.nodeType!==1||ve.has(n.nodeName))&&(r+=Ci(n,e),!!Ti(n))){for(Ti(i[o-1])&&t.insertBefore(e(),n);n.firstChild;)t.insertBefore(n.firstChild,n);n.remove(),r+=1}}),r}var Si=new Set(["TABLE","THEAD","TBODY","TFOOT","TR","COLGROUP"]);function ki(t){return!!t.closest?.("p")||Si.has(t.nodeName)}var fl=new Set(["P","H1","H2","H3","H4","H5","H6","PRE","LABEL","LEGEND","LI","TD","TH","DT","DD","FIGCAPTION","SUMMARY","CAPTION"]);function ml(t){return fl.has(t.nodeName)||_i(t)}var un=new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]),yl=new Set(["SCRIPT","STYLE","TEXTAREA","TITLE","IFRAME","NOSCRIPT","XMP"]),pn="http://www.w3.org/1999/xhtml";function gl(t){return Si.has(t.nodeName)||un.has(t.nodeName)||yl.has(t.nodeName)||t.nodeName==="TEMPLATE"||!!t.namespaceURI&&t.namespaceURI!==pn}function bl(t){return Si.has(t.nodeName)?"a table element cannot be an editable region. Move the editable attribute to a <td>, a <th>, or an element inside one.":t.namespaceURI&&t.namespaceURI!==pn?"an SVG or MathML element cannot be an editable region: an edit puts an HTML block inside it, and the next page load moves that text out of the graphic entirely. Put a <foreignObject> in the SVG and mark an HTML element inside it instead.":un.has(t.nodeName)?"this element cannot contain anything, so there is nothing to edit. Move the editable attribute to an element that holds text.":t.nodeName==="TEMPLATE"?"a <template> keeps its content out of the document, so edits to it are never saved.":"this element treats its content as plain text, so any edit would be saved as visible markup rather than formatting."}function _i(t){return t.nodeType===1&&!ve.has(t.nodeName)&&xi.test(t.nodeName)}function fn(t){return Array.from(t.querySelectorAll("*")).some(Ti)}function vl(t,e={}){let{blockTag:i="DIV",wrapBareRoot:r=!1,onBareRootWrapped:n,blocksAllowed:o=!ki(t)}=e;return yn(t),o&&Tl(t,i,r,n),t}var wl=t=>qe(t)&&t.nodeType!==8&&!Ei(t),xl=t=>t.nodeType!==8&&!Ei(t)&&!(t.nodeType===3&&!Ue.test(t.nodeValue));function El(t,{wrapBareRoot:e=!1,blocksAllowed:i=!ki(t)}={}){return i?we(t)?Array.from(t.childNodes).some(wl)||mn(t):e:!1}function mn(t){return Array.from(t.children).some(e=>we(e)?!Ai(e)&&Array.from(e.childNodes).some(i=>i.nodeType===3&&!Ue.test(i.nodeValue))||mn(e):!1)}function yn(t){we(t)&&(Ai(t)||Array.from(t.childNodes).forEach(e=>{e.nodeType===3&&!Ue.test(e.nodeValue)&&e.remove()}),Array.from(t.children).forEach(yn))}function Tl(t,e,i,r){if(!we(t)){if(!i)return;let a=t.ownerDocument.createElement(e);if(!Array.from(t.childNodes).some(xl)){a.appendChild(t.ownerDocument.createElement("BR")),t.appendChild(a);return}for(;t.firstChild;)a.appendChild(t.firstChild);t.appendChild(a),r?.(t,a);return}let n=[],o=()=>{let a=n;if(n=[],!a.some(c=>c.nodeType!==8))return;let l=t.ownerDocument.createElement(e);t.insertBefore(l,a[0]),a.forEach(c=>l.appendChild(c))};Array.from(t.childNodes).forEach(a=>{Ei(a)?o():qe(a)?n.push(a):o()}),o()}function Ai(t){return t.nodeName==="PRE"}function Cl(t,e){return{start:gn(t,e.startContainer,e.startOffset),end:gn(t,e.endContainer,e.endOffset),collapsed:e.collapsed}}function Sl(t,e,i){vn(e,"setStart",t,i.start),i.collapsed?e.collapse(!0):vn(e,"setEnd",t,i.end)}function gn(t,e,i){if(!t.contains(e))return{scope:t,after:[],before:[]};if(e.nodeType===3){if(!kl(e))return{container:e,offset:i};let r=e.parentNode;return bn(r,Array.from(r.childNodes).indexOf(e))}return{container:e,offset:i,childCount:e.childNodes.length,...bn(e,i)}}function bn(t,e){let i=Array.from(t.childNodes),r=Math.max(0,e);return{scope:t,after:i.slice(r),before:i.slice(0,r).reverse()}}function vn(t,e,i,r){let{container:n,childCount:o}=r;if(n&&i.contains(n)&&(o===void 0||o===n.childNodes.length)){t[e](n,Math.min(r.offset,Li(n)));return}let a=r.after?.find(h=>i.contains(h));if(a){t[e](ze(a,!0),0);return}let l=r.before?.find(h=>i.contains(h));if(l){let h=ze(l,!1);t[e](h,Li(h));return}let c=r.scope&&i.contains(r.scope)?r.scope:i;t[e](c,0)}function kl(t){return t.nodeType===3&&!Ue.test(t.nodeValue)&&!!t.parentNode&&t.parentNode.nodeType===1&&we(t.parentNode)&&!Ai(t.parentNode)}var xe=t=>t.nodeType===1||t.nodeType===3;function ze(t,e=!0){let i=t;for(;i.nodeType===1&&!ve.has(i.nodeName);){let r=Array.from(i.childNodes).filter(xe),n=e?r[0]:r[r.length-1];if(!n||pl.has(n.nodeName))break;i=n}return i}function Li(t){return t.nodeType===3?t.nodeValue.length:t.childNodes.length}var ut="[data-richclay], [richclay], [editable], [clay-editable]",_l="[data-richclay], [richclay], [clay-editable]",Al=["editable","clay-editable"],Ni=':is([editable~="single-line"], [clay-editable~="single-line"])';function Di(t){return!t||typeof t.matches!="function"?!1:t.tagName.includes("-")?t.matches(_l):!0}var Ll="[data-richclay-toolbar], [data-richclay-menu], [data-richclay-dialog], [data-richclay-link-popover], [data-richclay-live], [data-richclay-float]",Nl=["richclay-editor","richclay-inline","richclay-active","richclay-empty","richclay-focused"],Oi=new WeakSet,wn=new WeakSet,xn=["clay:ready","hyperclay:ready"];function En(t){return[t.clay?.ready,t.hyperclay?.ready].find(e=>e&&typeof e.then=="function")||null}function Tn(t){return typeof t.clay?.isEditMode=="boolean"?t.clay.isEditMode:typeof t.hyperclay?.isEditMode=="boolean"?t.hyperclay.isEditMode:null}function Dl(t){let e=t.hyperclayModules,i=t.__hyperclayNoAutoExport===!1&&e&&typeof e=="object"&&typeof e.nodeType!="number";return Tn(t)!==null||!!En(t)||!!i}function Ol(t){return t.clay?.addDocumentTransform||t.hyperclay?.beforeSave||null}function Rl(t){return t.clay?.onSnapshot||t.hyperclay?.onSnapshot||null}var Il={boxSizing:"border-box",minWidth:"100%",overflow:"auto",width:"0"};function Ri(t={},e=window){return t.hyperclay===!1?!1:t.hyperclay===!0?!0:!!(Dl(e)||Kl(e))}function Cn(t=window){let e=_n(t);if(e!==null)return e;if(typeof t.__hyperclayEditMode=="boolean")return t.__hyperclayEditMode;let i=Tn(t);return i!==null?i:$l(t)}function Ml(t={},e=window){return t.readOnly?!1:Ri(t,e)?Cn(e):!0}function Bl(t){let e=Al.find(n=>t.hasAttribute(n));if(!e)return null;let i=new Set((t.getAttribute(e)||"").trim().split(/\s+/).filter(Boolean)),r={inline:!0,singleLine:i.has("single-line"),toolbarOnSelect:i.has("toolbar-on-select")};return i.has("no-toolbar")&&(r.toolbar=!1),i.has("link-label")&&(r.singleLine=!0,r.linkLabel=!0,r.toolbar=["link","undo","redo"]),r}function Sn(t=window){if(Oi.has(t))return;let e=Rl(t)||Ol(t);if(typeof e!="function"){Fl(t);return}e(i=>Ii(i)),Oi.add(t)}function Fl(t){if(wn.has(t))return;let e=t.document,i=En(t);if(!e&&!i)return;wn.add(t);let r=()=>{Sn(t),Oi.has(t)&&n()},n=()=>{e&&xn.forEach(o=>e.removeEventListener(o,r))};e&&xn.forEach(o=>e.addEventListener(o,r)),i&&i.then(r,()=>{})}function Ii(t){t.querySelectorAll?.(Ll).forEach(e=>e.remove()),t.querySelectorAll?.(ut).forEach(e=>{if(e.getAttribute("data-richclay-active")==="true"){if(Bi(e,"save"),ql(e)){let i=e.ownerDocument,r=!!e.matches?.(Ni);Ci(e,()=>r?i.createTextNode(" "):i.createElement("br")),e.querySelectorAll(e.localName).forEach(n=>{for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.remove()})}e.matches?.(Ni)&&Wl(e),e.querySelectorAll("#squire-selection-start, #squire-selection-end").forEach(i=>{i.remove()}),e.querySelectorAll(".squire-image-resize-container").forEach(i=>i.remove()),zl(e),(e.matches?.("pre")?[e,...e.querySelectorAll("pre")]:Array.from(e.querySelectorAll("pre"))).filter(i=>i.hasAttribute("data-richclay-pre")).forEach(i=>{Object.entries(Il).forEach(([r,n])=>{i.style[r]||(i.style[r]=n)}),i.removeAttribute("data-richclay-pre")})}}),t.querySelectorAll?.("#squire-selection-start, #squire-selection-end").forEach(e=>e.remove())}var Pl="p, td, th, li, dl, dt, dd, table, blockquote, div, section, article, aside, main, header, footer, figure, figcaption",Mi="data-richclay-measure";function Hl(t){let e=t.ownerDocument,i=t.closest(Pl)||t;t.setAttribute(Mi,"");let r=e.createElement("div");try{r.innerHTML=i.outerHTML}finally{t.removeAttribute(Mi)}let n=r.querySelector(`[${Mi}]`);return!n||n.textContent!==t.textContent}var Ul=t=>!!t.querySelector(t.localName),ql=t=>!!t.matches?.(Ni)||(fn(t)||Ul(t))&&Hl(t);function Bi(t,e){let i=t.getAttribute("data-richclay-runtime-contenteditable");t.hasAttribute("contenteditable")&&(i==="true"?t.removeAttribute("contenteditable"):i?e==="destroy"?t.setAttribute("contenteditable",i):(t.setAttribute("inert-contenteditable",i),t.removeAttribute("contenteditable")):e==="save"&&(t.setAttribute("inert-contenteditable",t.getAttribute("contenteditable")),t.removeAttribute("contenteditable"))),Nl.forEach(r=>t.classList.remove(r)),t.getAttribute("class")===""&&t.removeAttribute("class"),Fi(t,"role","data-richclay-runtime-role"),Fi(t,"aria-multiline","data-richclay-runtime-aria-multiline"),Fi(t,"no-undo","data-richclay-runtime-no-undo"),t.getAttribute("data-richclay-runtime-display")==="true"&&(t.style.removeProperty("display"),t.getAttribute("style")===""&&t.removeAttribute("style")),jl(t),t.removeAttribute("data-richclay-active"),t.removeAttribute("data-richclay-placeholder"),t.removeAttribute("data-richclay-pre"),t.removeAttribute("data-richclay-runtime-role"),t.removeAttribute("data-richclay-runtime-aria-multiline"),t.removeAttribute("data-richclay-runtime-no-undo"),t.removeAttribute("data-richclay-runtime-describedby"),t.removeAttribute("data-richclay-runtime-contenteditable"),t.removeAttribute("data-richclay-runtime-display"),t.getAttribute("data-richclay-runtime-marker")==="true"&&t.removeAttribute("data-richclay"),t.removeAttribute("data-richclay-runtime-marker")}function zl(t){let e=[t];for(;e.length;)e.pop().childNodes.forEach(i=>{i.nodeType===3?i.nodeValue.includes("\u200B")&&(i.nodeValue=i.nodeValue.split("\u200B").join("")):i.nodeType===1&&e.push(i)});t.querySelectorAll("b, i, u, s, em, strong, code, sub, sup, span").forEach(i=>{i.children.length===0&&(i.textContent||"")===""&&i.attributes.length===0&&i.remove()})}function Wl(t){let e=Array.from(t.childNodes).filter(r=>r.nodeType!==3||(r.nodeValue||"").trim()!=="");if(e.length!==1)return;let i=e[0];if(!(i.nodeType!==1||i.nodeName!=="P"||i.attributes.length>0)){for(;i.firstChild;)t.insertBefore(i.firstChild,i);i.remove()}}function kn(t){if(!t.hasAttribute("inert-contenteditable"))return null;let e=t.getAttribute("inert-contenteditable");return["false","plaintext-only"].includes(e)||(e="true"),t.setAttribute("contenteditable",e),t.removeAttribute("inert-contenteditable"),e==="true"&&t.setAttribute("data-richclay-runtime-contenteditable","true"),e}function $t(t){return t.setAttribute("snapshot-remove",""),t.setAttribute("no-watch",""),t}function _n(t){try{let e=new URLSearchParams(t.location?.search||"");if(e.get("editmode")==="true")return!0;if(e.get("editmode")==="false")return!1}catch{return null}return null}function Kl(t){return _n(t)!==null||typeof t.__hyperclayEditMode=="boolean"}function $l(t){let e=(t.document?.cookie||"").match(/(?:^|;\s*)isAdminOfCurrentResource=([^;]*)/);return!!(e&&e[1]!=="")}function Fi(t,e,i){t.hasAttribute(i)&&t.removeAttribute(e)}function jl(t){let e=t.getAttribute("data-richclay-runtime-describedby");if(!e)return;let i=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean).filter(r=>r!==e);i.length?t.setAttribute("aria-describedby",i.join(" ")):t.removeAttribute("aria-describedby")}var Vl=0;function Gl(t=document){let e=t.createElement("div");return e.id=`richclay-live-${++Vl}`,e.className="richclay-sr-only",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.setAttribute("data-richclay-live",""),$t(e),t.body.appendChild(e),e}function Ee(t,e){!t||!e||(t.textContent="",t.ownerDocument.defaultView.setTimeout(()=>{t.textContent=e},20))}function Pi(t){t.preventDefault()}function An(t){try{return t?.cloneRange?.()||null}catch{return null}}function Te(t){try{return An(t?.getSelection?.())}catch{return null}}function Hi(t,e){if(!t||!e)return!1;try{return t.setSelection(e),!0}catch{return!1}}function Ui(t,e,i,r){t.hasAttribute(e)||t.setAttribute(r,"true"),t.setAttribute(e,i)}function Zl(t,e){let i=new Set((t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean));i.add(e.id),t.setAttribute("aria-describedby",Array.from(i).join(" ")),t.setAttribute("data-richclay-runtime-describedby",e.id)}var Yl=0,Ln=class{constructor(t,e,i={}){this.editor=t,this.controls=e,this.options=i,this.id=++Yl,this.items=[],this.menus=new Map,this.activeIndex=0,this.root=this.createRoot(),this.onRootKeydown=r=>this.handleRootKeydown(r),this.onRootClick=r=>this.handleRootClick(r),this.onRootPointerDown=r=>this.handleRootPointerDown(r),this.onDocumentPointerDown=r=>this.handleDocumentPointerDown(r),this.render(),this.root.addEventListener("keydown",this.onRootKeydown),this.root.addEventListener("click",this.onRootClick),this.root.addEventListener("mousedown",this.onRootPointerDown),this.root.ownerDocument.addEventListener("mousedown",this.onDocumentPointerDown)}destroy(){this.closeMenus(),this.root.removeEventListener("keydown",this.onRootKeydown),this.root.removeEventListener("click",this.onRootClick),this.root.removeEventListener("mousedown",this.onRootPointerDown),this.root.ownerDocument.removeEventListener("mousedown",this.onDocumentPointerDown),this.root.remove()}update(){this.items.forEach(t=>{let{def:e,button:i}=t;if(typeof e.isActive=="function"){let r=!!e.isActive(this.editor);i.setAttribute("aria-pressed",r?"true":"false"),i.classList.toggle("is-active",r)}typeof e.isDisabled=="function"&&(i.disabled=!!e.isDisabled(this.editor))}),this.ensureSingleTabStop()}focusFirst(){this.activeIndex=0,this.ensureSingleTabStop(),this.items[0]?.button.focus()}createRoot(){let t=this.editor.element.ownerDocument,e=t.createElement("div");e.className="richclay-toolbar",e.setAttribute("role","toolbar"),e.setAttribute("aria-label",this.options.ariaLabel||"Rich text formatting"),e.setAttribute("data-richclay-toolbar",""),$t(e);let i=Ql(this.options.toolbarContainer,t);return i?i.appendChild(e):this.editor.element.insertAdjacentElement("beforebegin",e),e}render(){this.root.textContent="",this.items=[],this.menus.clear();let t=null;this.visibleControls().forEach((e,i)=>{if(e.type==="separator"){this.root.appendChild(Dn(this.root.ownerDocument)),t=null;return}t&&e.group&&e.group!==t&&this.root.appendChild(Dn(this.root.ownerDocument)),t=e.group||t,e.type==="menu"?this.renderMenu(e,i):this.renderButton(e,i)}),this.ensureSingleTabStop(),this.update()}visibleControls(){let t=this.controls.filter(i=>i.type==="separator"||!i.isDisabled?.(this.editor)),e=[];for(t.forEach(i=>{let r=e[e.length-1];i.type==="separator"&&(!r||r.type==="separator")||e.push(i)});e[e.length-1]?.type==="separator";)e.pop();return e}renderButton(t,e){let i=Nn(this.root.ownerDocument,t);i.dataset.richclayControl=t.id,i.dataset.richclayIndex=String(e),typeof t.isActive=="function"&&i.setAttribute("aria-pressed","false"),this.root.appendChild(i),this.items.push({def:t,button:i,type:"button"})}renderMenu(t,e){let i=this.root.ownerDocument,r=Nn(i,t),n=`richclay-menu-${this.id}-${t.id}`;r.dataset.richclayControl=t.id,r.dataset.richclayIndex=String(e),r.setAttribute("aria-haspopup","menu"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-controls",n);let o=i.createElement("div");o.id=n,o.className="richclay-menu",o.hidden=!0,o.setAttribute("role","menu"),o.setAttribute("data-richclay-menu",""),$t(o),t.options.forEach((l,c)=>{let h=i.createElement("button");h.type="button",h.className="richclay-menu-item",h.setAttribute("role","menuitemradio"),h.setAttribute("tabindex","-1"),h.dataset.richclayMenuItem=t.id,h.dataset.richclayOptionIndex=String(c),h.innerHTML=l.icon||"",h.appendChild(i.createTextNode(l.label)),h.addEventListener("mousedown",Pi),h.addEventListener("click",u=>{u.preventDefault(),this.chooseMenuItem(t,l,r)}),h.addEventListener("keydown",u=>this.handleMenuKeydown(u,t,r)),o.appendChild(h)});let a=i.createElement("span");a.className="richclay-menu-wrap",a.append(r,o),this.root.appendChild(a),this.items.push({def:t,button:r,type:"menu",menu:o}),this.menus.set(t.id,{def:t,button:r,menu:o})}handleRootPointerDown(t){let e=t.target.closest?.("[data-richclay-control]");!e||!this.root.contains(e)||(Pi(t),this.editor.saveSelection())}handleRootClick(t){let e=t.target.closest?.("[data-richclay-control]");if(!e||!this.root.contains(e))return;t.preventDefault();let i=this.items.find(r=>r.button===e);if(!(!i||e.disabled)){if(this.activeIndex=this.items.indexOf(i),this.ensureSingleTabStop(),i.type==="menu"){this.toggleMenu(i.def.id);return}this.closeMenus(),this.editor.runControl(i.def)}}handleRootKeydown(t){let e=t.key,i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(e in i){t.preventDefault(),this.moveFocus(i[e]);return}if(e==="Home"){t.preventDefault(),this.setFocusIndex(0);return}if(e==="End"){t.preventDefault(),this.setFocusIndex(this.items.length-1);return}let r=this.items[this.activeIndex];if(r&&((e==="Enter"||e===" ")&&r.type==="menu"&&(t.preventDefault(),this.openMenu(r.def.id,"first")),e==="Escape")){let n=Array.from(this.menus.values()).some(o=>!o.menu.hidden);this.closeMenus(),n?r.button.focus():this.editor.focus()}}handleMenuKeydown(t,e,i){t.stopPropagation();let r=this.menus.get(e.id)?.menu,n=Array.from(r.querySelectorAll(".richclay-menu-item")),o=n.indexOf(t.currentTarget),a=o;if(t.key==="ArrowDown"&&(a=(o+1)%n.length),t.key==="ArrowUp"&&(a=(o-1+n.length)%n.length),t.key==="Home"&&(a=0),t.key==="End"&&(a=n.length-1),a!==o){t.preventDefault(),n[a].focus();return}if(t.key==="Escape"){t.preventDefault(),this.closeMenus(),i.focus();return}if(t.key==="Enter"||t.key===" "){t.preventDefault();let l=e.options[o];this.chooseMenuItem(e,l,i)}}handleDocumentPointerDown(t){this.root.contains(t.target)||this.closeMenus()}chooseMenuItem(t,e,i){this.closeMenus(),this.editor.runControl({...e,id:`${t.id}:${e.value}`,ariaLabel:e.label}),i.focus()}toggleMenu(t){let e=this.menus.get(t);e&&(e.menu.hidden?this.openMenu(t,"first"):this.closeMenus())}openMenu(t,e="first"){this.closeMenus(t);let i=this.menus.get(t);if(!i)return;i.menu.hidden=!1,i.button.setAttribute("aria-expanded","true"),this.updateMenuState(i);let r=Array.from(i.menu.querySelectorAll(".richclay-menu-item")),n=r.find(o=>o.getAttribute("aria-checked")==="true");(e==="active"&&n||r[0])?.focus()}closeMenus(t=null){this.menus.forEach((e,i)=>{i!==t&&(e.menu.hidden=!0,e.button.setAttribute("aria-expanded","false"))})}updateMenuState(t){Array.from(t.menu.querySelectorAll(".richclay-menu-item")).forEach((e,i)=>{let r=!!t.def.options[i].isActive?.(this.editor);e.setAttribute("aria-checked",r?"true":"false"),e.classList.toggle("is-active",r)})}moveFocus(t){if(!this.items.length)return;let e=this.activeIndex;do e=(e+t+this.items.length)%this.items.length;while(this.items[e].button.disabled&&e!==this.activeIndex);this.setFocusIndex(e)}setFocusIndex(t){this.activeIndex=Math.max(0,Math.min(t,this.items.length-1)),this.ensureSingleTabStop(),this.items[this.activeIndex]?.button.focus()}ensureSingleTabStop(){let t=this.items.filter(e=>!e.button.disabled);t.length&&(t.includes(this.items[this.activeIndex])||(this.activeIndex=this.items.indexOf(t[0])),this.items.forEach((e,i)=>{e.button.tabIndex=i===this.activeIndex?0:-1}))}};function Nn(t,e){let i=t.createElement("button");i.type="button",i.className="richclay-button";let r=hl(e.shortcut,t.defaultView),n=r?`${e.ariaLabel||e.label} (${r})`:e.ariaLabel||e.label;return i.setAttribute("aria-label",n),i.title=n,i.innerHTML=`${e.icon||""}<span class="richclay-sr-only">${e.label}</span>`,i}function Dn(t){let e=t.createElement("span");return e.className="richclay-separator",e.setAttribute("role","separator"),e.setAttribute("aria-orientation","vertical"),e}function Ql(t,e){return t?typeof t=="string"?e.querySelector(t):t:null}var On=16,Xl=[16,8,0],G=8,Jl=4;function ts({anchor:t,bar:e,rail:i,viewport:r,current:n=null}){let o=f=>n===f?Jl:0;if(t.bottom<=0||t.top>=r.height||t.right<=0||t.left>=r.width)return{mode:"hidden",x:0,y:0};let a=f=>Math.max(G,Math.min(t.left,r.width-f-G)),l=t.top-On-e.height;if(l>=G-o("above"))return{mode:"above",x:a(e.width),y:l};let c=t.bottom+On;if(c+e.height<=r.height-G+o("below"))return{mode:"below",x:a(e.width),y:c};let h=r.width-t.right-G,u=t.left-G,d=h>=u?[["rail-right",h],["rail-left",u]]:[["rail-left",u],["rail-right",h]];for(let[f,b]of d)for(let g of Xl){if(i.width+g>b+o(f))continue;let E=f==="rail-right"?Math.min(t.right+g,r.width-i.width-G):Math.max(t.left-g-i.width,G),T=Math.min(t.bottom,r.height-G)-i.height,R=Math.max(G,Math.min(Math.max(t.top,G),T));return{mode:f,x:E,y:R,gap:g}}return{mode:"pinned",x:a(e.width),y:G}}var es=10,is=28;function Rn({anchor:t,box:e,viewport:i,gap:r=es}){let n=i.height-G-t.bottom-r,o=t.top-r-G,a=n>=e.height||n>=o?"below":"above",l=a==="below"?t.bottom+r:t.top-r-e.height,c=Math.max(G,Math.min(l,i.height-G-e.height)),h=(t.left+t.right)/2,u=Math.max(G,Math.min(h-is,i.width-G-e.width)),d=Math.max(14,Math.min(h-u,e.width-14));return{side:a,x:u,y:c,arrow:d}}function lt(t,e,i){t.style.setProperty(e,i,"important")}var rs=class{constructor(t,e){this.editor=t,this.mode=null,this.hidden=!1,this.frame=0,this.bar={width:0,height:0},this.rail={width:0,height:0};let i=t.element.ownerDocument;this.doc=i,this.win=i.defaultView||globalThis,this.root=i.createElement("div"),this.root.className="richclay-float",this.root.setAttribute("data-richclay-float",""),this.root.setAttribute("save-remove",""),$t(this.root),i.body.appendChild(this.root),this.toolbar=new Ln(t,e,{toolbarContainer:this.root}),this.onScroll=()=>this.schedule(),this.onResize=()=>{this.measure(),this.schedule()},i.addEventListener("scroll",this.onScroll,{capture:!0,passive:!0}),this.win.addEventListener("resize",this.onResize,{passive:!0}),this.win.visualViewport?.addEventListener("resize",this.onResize,{passive:!0}),this.win.visualViewport?.addEventListener("scroll",this.onScroll,{passive:!0}),this.resizeObserver=typeof this.win.ResizeObserver=="function"?new this.win.ResizeObserver(()=>this.schedule()):null,this.resizeObserver?.observe(t.element),this.measure(),this.reposition()}measure(){let t=this.root.classList.contains("richclay-float-rail");lt(this.root,"visibility","hidden"),this.root.classList.remove("richclay-float-rail"),this.bar={width:this.root.offsetWidth||0,height:this.root.offsetHeight||0},this.root.classList.add("richclay-float-rail"),this.rail={width:this.root.offsetWidth||0,height:this.root.offsetHeight||0},this.root.classList.toggle("richclay-float-rail",t),this.root.style.removeProperty("visibility")}schedule(){if(!this.win.requestAnimationFrame){this.reposition();return}this.frame||(this.frame=this.win.requestAnimationFrame(()=>{this.frame=0,this.reposition()}))}setVisible(t){this.hidden=!t,this.reposition()}reposition(){if(this.hidden){lt(this.root,"display","none");return}let t=this.editor.element.getBoundingClientRect(),e={width:this.win.visualViewport?.width??this.win.innerWidth,height:this.win.visualViewport?.height??this.win.innerHeight},i=ts({anchor:t,bar:this.bar,rail:this.rail,viewport:e,current:this.mode});if(this.mode=i.mode,i.mode==="hidden"){lt(this.root,"display","none");return}this.root.style.removeProperty("display"),this.root.classList.toggle("richclay-float-rail",i.mode==="rail-left"||i.mode==="rail-right"),this.root.classList.toggle("richclay-float-pinned",i.mode==="pinned"),lt(this.root,"transform",`translate(${Math.round(i.x)}px, ${Math.round(i.y)}px)`)}destroy(){this.frame&&this.win.cancelAnimationFrame?.(this.frame),this.frame=0,this.doc.removeEventListener("scroll",this.onScroll,{capture:!0}),this.win.removeEventListener("resize",this.onResize),this.win.visualViewport?.removeEventListener("resize",this.onResize),this.win.visualViewport?.removeEventListener("scroll",this.onScroll),this.resizeObserver?.disconnect(),this.toolbar.destroy(),this.root.remove()}},ns={ALLOWED_TAGS:["a","b","blockquote","br","code","div","em","h1","h2","h3","h4","h5","h6","i","li","ol","p","pre","s","span","strong","sub","sup","u","ul"],ALLOWED_ATTR:["aria-label","href","rel","target","title"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!0,ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,FORBID_TAGS:["script","style","iframe","object","embed","form","input"],FORBID_ATTR:["style","srcset","onerror","onclick","onload"]};function In(t={},e=document){let i=We(e);return{sanitizeHTML(r){return Mn(r,t,e,i)},sanitizeElement(r){return Bn(r,t,i)},sanitizeToDOMFragment(r,n){let o=n?.getRoot?.().ownerDocument||e;return os(r,t,o,i)}}}function Mn(t,e={},i=document,r=We(i)){let n=i.createElement("template");return n.innerHTML=r.sanitize(String(t||""),qi(e)),zi(n.content),n.innerHTML}function Bn(t,e={},i=We(t.ownerDocument)){let r=t.ownerDocument.createElement("div");for(;t.firstChild;)r.appendChild(t.firstChild);for(i.sanitize(r,{...qi(e),IN_PLACE:!0}),zi(r);r.firstChild;)t.appendChild(r.firstChild);return t}function os(t,e={},i=document,r=We(i)){let n=r.sanitize(String(t||""),{...qi(e),RETURN_DOM_FRAGMENT:!0}),o=n?.ownerDocument===i?n:i.importNode(n,!0);return zi(o),o||i.createDocumentFragment()}function qi(t){return{...ns,...t}}var as=new Set(["http","https","mailto","tel"]),ls=new RegExp("[\\u0000-\\u0020\\u007F-\\u009F]","g");function Fn(t){let e=(String(t??"").replace(ls,"").match(/^([a-z][a-z0-9+.\-]*):/i)||[])[1];return!e||as.has(e.toLowerCase())}var ss=/^[^\s/?#:]+\.(?:html?|pdf|txt|csv|json|xml|svg|png|jpe?g|gif|webp|docx?|xlsx?|pptx?|bib|tex|zip)(?:[?#]\S*)?$/i,cs=/^[^\s/?#:.]+\/\S*$/;function hs(t){let e=String(t??"").trim();return!e||!Fn(e)?"":/^(?:https?:|mailto:|tel:)/i.test(e)?e:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?`mailto:${e}`:/^(?:[#?]|\/|\.{1,2}\/)/.test(e)||ss.test(e)||cs.test(e)?e:`https://${e}`}function We(t){let e=globalThis.DOMPurify;if(e?.sanitize)return e;if(typeof e=="function")return e(t.defaultView||globalThis);throw new Error("RichClay requires DOMPurify. Load vendor/purify.min.js before richclay.js or provide globalThis.DOMPurify.")}function zi(t){t.querySelectorAll?.("a[href]").forEach(e=>{let i=e.getAttribute("href")||"";if(/^\s*javascript:/i.test(i)&&e.removeAttribute("href"),e.getAttribute("target")==="_blank"){let r=new Set((e.getAttribute("rel")||"").split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),e.setAttribute("rel",Array.from(r).join(" "))}})}var Pn={ADD_TAGS:["img"],ADD_ATTR:["class","id","src","alt","width","height"]};function Wi(t={}){return{...t,ADD_TAGS:[...new Set([...Pn.ADD_TAGS,...t.ADD_TAGS||[]])],ADD_ATTR:[...new Set([...Pn.ADD_ATTR,...t.ADD_ATTR||[]])],ALLOW_DATA_ATTR:t.ALLOW_DATA_ATTR??!0}}var Hn="p, div, h1, h2, h3, h4, h5, h6, blockquote, pre, ul, ol, li, figure, figcaption, table, thead, tbody, tr, td, th";function ds(t){let e=t.ownerDocument||document;t.querySelectorAll?.("br").forEach(r=>r.replaceWith(e.createTextNode(" ")));let i=t.querySelector?.(Hn);for(;i;){let r=i.parentNode;for(r.insertBefore(e.createTextNode(" "),i);i.firstChild;)r.insertBefore(i.firstChild,i);r.insertBefore(e.createTextNode(" "),i),i.remove(),i=t.querySelector(Hn)}return us(t,e),t}function us(t,e){t.normalize?.();let i=e.createTreeWalker(t,4),r=[];for(;i.nextNode();)r.push(i.currentNode);r.forEach(a=>{a.nodeValue=a.nodeValue.replace(/\s+/g," ")});let n=t.firstChild;n?.nodeType===3&&(n.nodeValue=n.nodeValue.replace(/^\s+/,""));let o=t.lastChild;o?.nodeType===3&&(o.nodeValue=o.nodeValue.replace(/\s+$/,""))}var ps=300,fs=t=>t.replace(/^mailto:/i,"").replace(/^https?:\/\//i,""),ms=class{constructor(t){this.editor=t,this.root=null,this.anchor=null,this.href=null,this.dismissed=null,this.hideTimer=null,this.pointerInside=!1,this.cleanup=null}currentAnchor(){let t=this.editor;if(!t.active||t.options.readOnly||t.dialog)return null;let e=t.element.ownerDocument;if(e.hidden)return null;let i=e.getSelection?.();return!i||!i.rangeCount||!t.element.contains(i.anchorNode)?null:t.currentLinkElement()}update(){let t=this.currentAnchor();if(!(t&&t===this.dismissed)){if(this.dismissed=null,!t){this.scheduleHide();return}this.cancelHide(),this.show(t)}}show(t){this.root||this.mount();let e=t.getAttribute("href")||"";if(t!==this.anchor||e!==this.href){this.anchor=t,this.href=e;let i=this.root.querySelector(".richclay-link-address");i.textContent=fs(e)||e,i.title=e,e&&Fn(e)?i.setAttribute("href",e):i.removeAttribute("href"),/^(?:mailto|tel):/i.test(e)?i.removeAttribute("target"):i.setAttribute("target","_blank")}this.position()}mount(){let t=this.editor,e=t.element.ownerDocument,i=e.defaultView||globalThis,r=e.createElement("div");r.className="richclay-dialog richclay-link-popover",r.setAttribute("role","group"),r.setAttribute("aria-label","Link"),r.setAttribute("data-richclay-link-popover",""),$t(r),r.setAttribute("save-remove",""),r.innerHTML=`
99
+ <a class="richclay-link-address" rel="noopener noreferrer"></a>
100
+ <button type="button" class="richclay-secondary" data-richclay-link-edit>Edit</button>
101
+ <button type="button" class="richclay-secondary" data-richclay-link-remove>Remove</button>
102
+ `,t.options.linkLabel&&r.querySelector("[data-richclay-link-remove]").remove(),r.addEventListener("pointerdown",Pi),r.addEventListener("pointerenter",()=>{this.pointerInside=!0,this.cancelHide()}),r.addEventListener("pointerleave",()=>{this.pointerInside=!1,this.update()}),r.querySelector("[data-richclay-link-edit]").addEventListener("click",()=>{let c=this.anchor;if(!c||!t.element.contains(c))return this.hide();t.selectElement(c),t.openLinkDialog()}),r.querySelector("[data-richclay-link-remove]")?.addEventListener("click",()=>{let c=this.anchor;this.hide(),t.removeLinkElement(c),t.focus()});let n=t.element.closest("dialog")||e.body,o=typeof r.showPopover=="function";o&&r.setAttribute("popover","manual"),lt(r,"position","fixed"),lt(r,"inset","0px auto auto 0px"),lt(r,"margin","0"),lt(r,"overflow","visible"),n.appendChild(r),o&&r.showPopover(),this.root=r;let a=()=>this.position(),l=c=>{c.key!=="Escape"||!this.root||(this.dismissed=this.anchor,this.hide())};e.addEventListener("scroll",a,{capture:!0,passive:!0}),i.addEventListener("resize",a,{passive:!0}),t.element.addEventListener("keydown",l),this.cleanup=()=>{e.removeEventListener("scroll",a,{capture:!0}),i.removeEventListener("resize",a),t.element.removeEventListener("keydown",l)}}position(){let t=this.root;if(!t||!this.anchor)return;let e=t.ownerDocument.defaultView||globalThis,i=Rn({anchor:this.anchor.getBoundingClientRect(),box:{width:t.offsetWidth||0,height:t.offsetHeight||0},viewport:{width:e.visualViewport?.width??e.innerWidth,height:e.visualViewport?.height??e.innerHeight}});t.setAttribute("data-richclay-side",i.side),t.style.setProperty("--richclay-dialog-arrow",`${Math.round(i.arrow)}px`),lt(t,"transform",`translate(${Math.round(i.x)}px, ${Math.round(i.y)}px)`)}scheduleHide(){if(!this.root||this.hideTimer!==null)return;let t=this.root.ownerDocument.defaultView||globalThis;this.hideTimer=t.setTimeout(()=>{this.hideTimer=null,this.pointerInside||this.hide()},ps)}cancelHide(){this.hideTimer!==null&&((this.editor.element.ownerDocument.defaultView||globalThis).clearTimeout(this.hideTimer),this.hideTimer=null)}onEditorBlur(t){let e=t?.relatedTarget;e&&this.editor.ownsFocusTarget(e)||this.hide()}hide(){this.cancelHide(),this.cleanup?.(),this.cleanup=null,this.root?.remove(),this.root=null,this.anchor=null,this.href=null,this.pointerInside=!1}destroy(){this.hide(),this.dismissed=null}},Un="richclay-styles",Ki=new WeakSet,$i="";function ys(t){$i=t||""}function gs(t=document){if(!t||Ki.has(t))return;if(t.getElementById(Un)){Ki.add(t);return}if(!$i)return;let e=t.createElement("style");e.id=Un,e.setAttribute("save-remove",""),e.setAttribute("save-ignore",""),e.textContent=$i,(t.head||t.documentElement).appendChild(e),Ki.add(t)}var ji=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),bs=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Ac=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function Ke(t,e){if(!t||t.nodeType!==1)return!1;let i=t.getAttribute?.("clay");return!!(i&&i.split(/\s+/).includes(e)||t.hasAttribute?.(e))}function qn(t,e){if(Ke(t,e))return!0;for(let[i,r]of Object.entries(bs))if(r.includes(e)&&Ke(t,i))return!0;return!1}function Vi(t){let e=ji[t];if(!e)throw new Error(`Unknown region capability: ${t}`);return[...e.tokens,...e.bundles].flatMap(i=>[`[clay~="${i}"]`,`[${i}]`]).join(", ")}function Gi(t,e){let i=t&&t.nodeType===1?t:t?.parentElement;for(;i&&i.nodeType===1;){let r=ji[e];if(!r)throw new Error(`Unknown region capability: ${e}`);if(r.tokens.some(n=>qn(i,n))||r.bundles.some(n=>Ke(i,n)))return i;i=i.parentElement}return null}function vs(t,e){return!!Gi(t,e)}var ws=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function xs(t,e){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(t.tagName||""))return;let i=(t.getAttribute?.("type")||"").toLowerCase();"value"in t&&"value"in e&&t.tagName!=="OPTION"&&i!=="checkbox"&&i!=="radio"&&i!=="file"&&(e.value=t.value),t.tagName==="INPUT"&&(i==="checkbox"||i==="radio")&&(e.checked=t.checked),t.tagName==="OPTION"&&(e.selected=t.selected),"indeterminate"in t&&"indeterminate"in e&&(e.indeterminate=t.indeterminate)}function zn(t,e,i,r){if(r)return!!t.closest?.(e);let n=t;for(;n?.nodeType===1;){if(n.matches(e))return!0;if(n===i)break;n=n.parentElement}return!1}function Wn(t,e,i,r,n,o){return(o?vs(t,e):zn(t,i,n,!1))||!!(r&&(o&&t!==n?t.matches(r):zn(t,r,n,o)))}function Es(t,e){let i=ji[e];return i.tokens.some(r=>qn(t,r))||i.bundles.some(r=>Ke(t,r))}var Ts=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Kn(t,e,i,r){if(t.nodeType===1&&r(t)){i.dropped.push(e);return}i.cloneToLive.set(e,t),i.liveToClone.set(t,e);let n=t,o=e;if(t.nodeType===1){if(Ts.has(t.tagName)&&i.controls.push(t,e),t.tagName==="TEMPLATE"){for(;e.firstChild;)e.removeChild(e.firstChild);n=t.content,o=e.content,i.cloneToLive.set(o,n),i.liveToClone.set(n,o)}}else if(t.nodeType!==11)return;let a=o.firstChild;for(let l=n.firstChild;l&&a;l=l.nextSibling)Kn(l,a,i,r),a=a.nextSibling}function $n(t,{capability:e="data",exclude:i=null,inherit:r=!0,provenance:n=null}={}){if(!t)throw new TypeError("createContentView requires a DOM context");let o=t.nodeType===9?t:t.ownerDocument;if(!o?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let a=o.implementation.createHTMLDocument(""),l=n||new WeakMap,c=new WeakMap,h=t.nodeType===9?t.documentElement:t;i&&a.documentElement.matches(i);let u=Vi(e),d=r?g=>Es(g,e)||!!(i&&g.matches(i)):g=>Wn(g,e,u,i,h,!1),f=null;if(h.nodeType!==1||!Wn(h,e,u,i,h,r)){f=a.importNode(h,!0);let g={cloneToLive:l,liveToClone:c,dropped:[],controls:[]};Kn(h,f,g,d);for(let E of g.dropped)E.remove();for(let E=0;E<g.controls.length;E+=2)xs(g.controls[E],g.controls[E+1])}t.nodeType===9&&f&&(a.replaceChild(f,a.documentElement),c.set(t,a),l.set(a,t));let b=g=>{if(ws.test(g))throw new Error(`Filtered content queries do not support stateful selector: ${g}`)};return{root:f,document:a,capability:e,selector:Vi(e),cloneToLive:l,liveToClone:c,original(g){return l.get(g)||null},cloneOf(g){return c.get(g)||null},query(g,E=f){return b(g),Array.from(E.querySelectorAll(g),T=>l.get(T)||T)},text(g=f){return(g===f?f:c.get(g))?.textContent||""},html(g=f){return(g===f?f:c.get(g))?.innerHTML??""},clone(g=f){let E=g===f?f:c.get(g);return E?a.importNode(E,!0):null}}}var Cs=Vi("history");function jn(t,e){let i=e.createElement("template");i.innerHTML=String(t||"");for(let r of i.content.querySelectorAll(Cs))r.remove();return i.innerHTML}function Vn(t,e){return jn(t,e)}function Ss(t,e){let i=e.createElement("template");i.innerHTML=Vn(t,e);let r=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DIV","DL","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","TABLE","UL"]),n="",o=a=>{if(a.nodeType===3)n+=a.data;else if(a.nodeType===1&&a.tagName==="BR")n+=`
103
+ `;else{let l=a.nodeType===1&&r.has(a.tagName);l&&n&&!n.endsWith(`
104
+ `)&&(n+=`
105
+ `);for(let c of a.childNodes||[])o(c);l&&n&&!n.endsWith(`
106
+ `)&&(n+=`
107
+ `)}};return o(i.content),n.replace(/\n{3,}/g,`
108
+
109
+ `).replace(/^\n|\n$/g,"")}function ks(t,e,i=null){let r=$n(t,{capability:"history",inherit:!1}),n=r.root,o=(l,c)=>{for(;l&&!r.cloneOf(l);){let d=l.parentNode;if(!d)return{container:n,offset:0};c=Array.from(d.childNodes).indexOf(l),l=d}let h=r.cloneOf(l)||n;if(l?.nodeType===3)return{container:h,offset:Math.min(c,h.length)};let u=Array.from(l?.childNodes||[]).slice(0,c).filter(d=>r.cloneOf(d)).length;return{container:h,offset:Math.min(u,h.childNodes.length)}},a=(l,c,h)=>{let u=o(c,h),d=n.ownerDocument.createElement("input");d.id=l,d.type="hidden";let f=n.ownerDocument.createRange();f.setStart(u.container,u.offset),f.collapse(!0),f.insertNode(d)};if(i)a(e.endSelectionId,i.endContainer,i.endOffset),a(e.startSelectionId,i.startContainer,i.startOffset);else for(let l of[e.startSelectionId,e.endSelectionId]){if(n.querySelector(`#${l}`))continue;let c=t.querySelector(`#${l}`);c&&a(l,c.parentNode,Array.from(c.parentNode.childNodes).indexOf(c))}return n.innerHTML}var bt=new WeakMap,Gn=new WeakMap,$e=new WeakMap,Zi=cl(),Zn=Symbol("richclay-keep-focus"),Yn=["cut","paste","drop"],_s=["Alt","Ctrl","Meta","Shift"],Qn=0;function As(t){return typeof t.clay?.mode=="string"}var Ls={toolbar:"standard",toolbarContainer:null,sanitize:{},placeholder:"",readOnly:!1,hyperclay:"auto",onChange:null,Squire:null,inline:!1,singleLine:!1,toolbarOnSelect:!1,linkPopover:!0,linkLabel:!1},Xn=["link","undo","redo"],Yi=class xt{static presets=Pe;static selector=ut;static hostHistory=!1;static keepsOwnHistory=null;constructor(e,i={}){if(!e)throw new Error("RichClay requires an element.");let r=bt.get(e);if(r)return r;this.element=e,this.unsupported=Qi(e)||Os(e);let n={...Bl(e),...i};this.options={...Ls,...n},this.options.singleLine&&!("toolbar"in n)&&(this.options.toolbar="inline"),this._blockTag=this.options.inline?"DIV":"P",this.registry=new Map(Zi),this.toolbar=null,this.float=null,this._onToolbarKey=null,this._onFloatFocusOut=null,this._onDocPointerDown=null,this.liveRegion=null,this.description=null,this.dialog=null,this.dialogCleanup=null,this.linkPopover=null,this.savedSelection=null,this.path="",this.active=!1,this._squire=null,this._squireHTML=null,this._squireListeners=[],this._onBeforeInput=null,this._onHistoryInput=null,this._onRootBeforeInput=null,this._onRootKeydown=null,this._onRootTransfer=null,this._shortcutKeys=[],this._appleDeleteKeys=new Set,this._authoredPres=new WeakSet,this._warnedInlineBlock=!1,this._onFocus=()=>{this.element.classList.add("richclay-focused"),this.options.inline&&this.ensureFloatingToolbar()},this._onBlur=o=>{this.element.classList.remove("richclay-focused"),this.linkPopover?.onEditorBlur(o),this.options.inline&&this.scheduleFloatTeardown(o)},this._onLinkActivation=o=>{if(!this.active||this.options.readOnly)return;let a=o.target?.nodeType===1?o.target:o.target?.parentElement,l=a?.closest("a[href]");if(!l)return;let c=Gi(a,"history");c&&c!==this.element&&this.element.contains(c)&&c.contains(l)||o.preventDefault()},this._onExternalWrite=()=>{this._squire&&(this._squire._mutation?.takeRecords(),this.options.linkLabel&&(this._labelHref=this.element.querySelector("a[href]")?.getAttribute("href")??this._labelHref),this.resetSquireUndoBaseline(),this.updatePlaceholder())},this.ensureMarker(),this.hyperclay=Ri(this.options,this.window),this.hyperclay&&Sn(this.window),bt.set(e,this),this.sanitizeConfig=this.options.inline?Wi(this.options.sanitize):this.options.sanitize,this.sanitizer=In(this.sanitizeConfig,this.element.ownerDocument),this.options.inline||Bn(this.element,Wi(this.options.sanitize)),Ml(this.options,this.window)&&this.activate()}get squire(){return this._squire}get window(){return this.element.ownerDocument.defaultView||window}static init(e=ut,i={}){let r=e===ut?Di:()=>!0;return Ns(e).filter(r).filter(n=>!Qi(n)).map(n=>new xt(n,i))}static autoInit(e=typeof window<"u"?window:void 0){if(!e||!e.document)return()=>{};let i=Gn.get(e);if(i)return i;let r=!1,n=null,o=()=>{r||As(e)||Ri({},e)&&Cn(e)&&(xt.init(),n=xt.watch(e))},a=()=>{r=!0,n?.()};return Gn.set(e,a),e.document.readyState==="loading"?e.document.addEventListener("DOMContentLoaded",o,{once:!0}):o(),a}static watch(e=typeof window<"u"?window:void 0,i={}){if(!e||!e.document)return()=>{};let r=$e.get(e);if(r)return r;let n=h=>{Ce(h)&&!bt.has(h)&&!Qi(h)&&new xt(h,i)},o=h=>bt.get(h)?.destroy(),a=new e.MutationObserver(h=>{h.forEach(u=>{if(u.type==="attributes"){let d=u.target;Ce(d)?n(d):o(d);return}u.addedNodes.forEach(d=>{d.nodeType===1&&(d.matches?.(ut)&&n(d),d.querySelectorAll?.(ut).forEach(n))}),u.removedNodes.forEach(d=>{if(d.nodeType!==1)return;let f=b=>{b.isConnected||bt.get(b)?.destroy()};d.matches?.(ut)&&f(d),d.querySelectorAll?.(ut).forEach(f)})})}),l=!1,c=()=>{l||(l=!0,a.disconnect(),$e.get(e)===c&&$e.delete(e))};return a.observe(e.document.documentElement||e.document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["editable","clay-editable","data-richclay","richclay"]}),$e.set(e,c),c}static registerButton(e){return Xi(e),Zi.set(e.id,e),xt}static unregisterButton(e){return Zi.delete(e),xt}static stripFromClone(e){Ii(e)}static stripElement(e){if(!e||typeof e.getAttribute!="function")return;let i=bt.get(e);if(i){i.destroy();return}Bi(e,"destroy")}static savedContent(e){if(!e||typeof e.matches!="function"||!e.matches(ut)||!Di(e))return;let i=e.ownerDocument.createElement("div"),r=e.cloneNode(!0);return r.setAttribute("data-richclay-active","true"),i.append(r),Ii(i),i.firstElementChild?i.firstElementChild.innerHTML:""}static setSavedContent(e,i,{morph:r}={}){if(typeof xt.savedContent(e)!="string")return!1;let n=bt.get(e);return!n||!n.active?(e.innerHTML=i,!0):(n.replaceContent(i,r),n._onExternalWrite(),n.toolbar?.update(),!0)}registerButton(e){return Xi(e),this.registry.set(e.id,e),this.active&&this.renderToolbar(),this}unregisterButton(e){return this.registry.delete(e),this.active&&this.renderToolbar(),this}canHistory(e){let i=this._squire;return!i||xt.hostHistory&&this.element.hasAttribute("data-richclay-runtime-no-undo")&&!xt.keepsOwnHistory?.(this.element)?!1:e==="redo"?i._undoIndex+1<i._undoStackLength&&i._isInUndoState:i._undoIndex>0||!i._isInUndoState}history(e){return this.canHistory(e)?(e==="redo"?this._squire.redo():this._squire.undo(),this):(this.element.dispatchEvent(new this.window.CustomEvent("richclay:history-exhausted",{bubbles:!0,detail:{direction:e}})),this)}quiet(e){let i=this.window.clay?.Mutation;if(typeof i?.pause!="function"||typeof i?.resume!="function")return e();i.pause();try{return e()}finally{i.resume()}}activate(){return this.quiet(()=>this.activateNow())}destroy(){return this.quiet(()=>this.destroyNow())}reattach(){return this.quiet(()=>this.reattachNow())}activateNow(){if(this.unsupported||this.active)return;this.active=!0,this.applyInlineBox(),gs(this.element.ownerDocument),kn(this.element);let e=this.options.inline?Array.from(this.element.childNodes):null,i=this.options.inline?null:this.element.innerHTML,r=this.options.Squire||this.window.Squire||globalThis.Squire;if(!r)throw new Error("RichClay requires Squire. Load vendor/squire.js before richclay.js.");if(this.setupEditorAttributes(),this.liveRegion=Gl(this.element.ownerDocument),this._squire=new r(this.element,{blockTag:this._blockTag,serializeRoot:ks,willCutCopy:n=>Vn(n,this.element.ownerDocument),toPlainText:n=>Ss(n,this.element.ownerDocument),replaceRoot:(n,o,a)=>{this.replaceContent(o)&&(a._ensureBottomLine(),a._mutation?.takeRecords())},onMutations:(n,o)=>{let a=(h,u)=>{let d=Gi(h,u);return!!d&&d!==this.element&&this.element.contains(d)},l=!1,c=!1;for(let h of n){if(a(h.target,"history"))continue;let u=h.type==="childList"?[...h.addedNodes,...h.removedNodes]:[h.target];for(let d of u)a(d,"history")||(a(h.target,"undo")||a(d,"undo")?c=!0:l=!0)}if(l){let h=o._ignoreChange;o._docWasChanged(),c&&h&&o.fireEvent("input"),this.options.linkLabel&&this.keepOneLink()}else c?(o._mayHaveZWS=!0,o.fireEvent("input")):o._ignoreChange=!1},sanitizeToDOMFragment:(n,o)=>{let a=this.sanitizer.sanitizeToDOMFragment(jn(n,this.element.ownerDocument),o);return this.options.singleLine?ds(a):a},didError:n=>{console.error("RichClay/Squire error",n)}}),this.options.inline)this.element.replaceChildren(...e),this.resetSquireUndoBaseline();else{let n=this.sanitizer;this.sanitizer=In(Wi(this.options.sanitize),this.element.ownerDocument);try{this._squire.setHTML(i)}finally{this.sanitizer=n}}if(this.bindSquire(),this.options.singleLine&&this.installSingleLineGuards(),this.options.inline&&!this.options.singleLine&&this.installRootGuards(),this.installAppleDeleteKeys(),this.blocksStayOut()&&(this._squire._ensureBottomLine=()=>{}),this.maskSquireCodeShortcut(),this.maskSquireBlockShortcuts(),this.installShortcuts(),this._onHistoryInput=n=>{if(!this.element.contains(n.target)||n.inputType!=="historyUndo"&&n.inputType!=="historyRedo")return;let o=n.target;if(o!==this.element&&o.closest?.('input, textarea, select, [editor-ui], [clay~="editor-ui"]')){n.stopPropagation();return}n.preventDefault(),n.stopImmediatePropagation(),this.history(n.inputType==="historyRedo"?"redo":"undo")},this.element.ownerDocument.addEventListener("beforeinput",this._onHistoryInput,!0),this.options.linkLabel&&this.maskFormattingShortcuts(),this.options.inline&&(this._onToolbarKey=n=>{n.altKey&&n.key==="F10"&&(n.preventDefault(),this.ensureFloatingToolbar(),this.float?.toolbar.focusFirst())},this.element.addEventListener("keydown",this._onToolbarKey)),this.blocksStayOut()){let n=o=>{let a=o.detail?.fragment;if(!a)return;let l=this.element.ownerDocument;Ci(a,()=>this.options.singleLine?l.createTextNode(" "):l.createElement("br"))};this._squire.addEventListener("willPaste",n),this._squireListeners.push(["willPaste",n])}if(this.options.linkLabel){let n=o=>{let a=o.detail?.fragment;if(!a)return;let l=a.textContent.replace(/\s+/g," ");a.replaceChildren(this.element.ownerDocument.createTextNode(l))};this._squire.addEventListener("willPaste",n),this._squireListeners.push(["willPaste",n]),this._labelHref=this.element.querySelector("a[href]")?.getAttribute("href")??null}this.renderToolbar(),this.updatePlaceholder(),this.warnOnBlockInInlineRegion(),this.element.querySelectorAll("pre").forEach(n=>this._authoredPres.add(n)),this._squireHTML=this.element.innerHTML,this.element.dispatchEvent(new this.window.CustomEvent("richclay:mount",{bubbles:!0}))}reattachNow(){if(this.unsupported||!this.active)return!1;let e=this.element.getAttribute("contenteditable")==="true"&&this.element.getAttribute("data-richclay-active")==="true"&&Ce(this.element);return e||(this.ensureMarker(),this.applyInlineBox(),kn(this.element),this.setupEditorAttributes()),this._squire&&this.element.innerHTML!==this._squireHTML&&this.resetSquireUndoBaseline(),!e}applyInlineBox(){_i(this.element)&&!this.element.style.display&&(this.element.style.display="inline-block",this.element.setAttribute("data-richclay-runtime-display","true"))}replaceContent(e,i=this.window.clay?.morph||this.window.hyperclay?.morph){let r=this.element;if(typeof i!="function"){if(r.querySelector('[editor-ui], [clay~="editor-ui"]'))throw new Error("RichClay requires a retention-aware morph host to replay history containing editor-ui.");return r.innerHTML=e,!1}return i(r,e,{morphStyle:"innerHTML",restoreFocus:!1,scripts:{handle:!1,merge:!1},policy:"history"}),!0}getHTML(){return this._squire?this._squire.getHTML():this.element.innerHTML}setHTML(e){return this._squire?this._squire.setHTML(String(e||"")):this.element.innerHTML=Mn(e,this.sanitizeConfig,this.element.ownerDocument),this.updatePlaceholder(),this.toolbar?.update(),this.options.onChange?.(this.getHTML()),this}focus(){return this._squire?this._squire.focus():this.element.focus(),this}destroyNow(){this.closeLinkDialog(),this.linkPopover?.destroy(),this.linkPopover=null,this.teardownFloatingToolbar(),this.toolbar?.destroy(),this.toolbar=null,this._onToolbarKey&&(this.element.removeEventListener("keydown",this._onToolbarKey),this._onToolbarKey=null),this.liveRegion?.remove(),this.liveRegion=null,this.description?.remove(),this.description=null,this._shortcutKeys.forEach(i=>this._squire?.setKeyHandler?.(i,null)),this._squireListeners.forEach(([i,r])=>{this._squire?.removeEventListener?.(i,r)}),this._squireListeners=[],this._shortcutKeys=[],this._onBeforeInput&&(this.element.ownerDocument.removeEventListener("beforeinput",this._onBeforeInput,!0),this._onBeforeInput=null),this._onHistoryInput&&(this.element.ownerDocument.removeEventListener("beforeinput",this._onHistoryInput,!0),this._onHistoryInput=null);let e=this.element.ownerDocument;this._onRootBeforeInput&&(e.removeEventListener("beforeinput",this._onRootBeforeInput,!0),this._onRootBeforeInput=null),this._onRootKeydown&&(e.removeEventListener("keydown",this._onRootKeydown,!0),this._onRootKeydown=null),this._onRootTransfer&&(Yn.forEach(i=>e.removeEventListener(i,this._onRootTransfer,!0)),this._onRootTransfer=null),this._squire?.destroy?.(),this._squire=null,this.cleanupEditorAttributes(),bt.delete(this.element)}saveSelection(){return this.savedSelection=Te(this._squire)||this.savedSelection,this.savedSelection}restoreSelection(){return Hi(this._squire,this.savedSelection)}installRootGuards(){let e=this.element.ownerDocument,i=r=>this.element.contains(r.target);this._onRootBeforeInput=r=>{!i(r)||r.isComposing||/^history/.test(r.inputType||"")||this.ensureRootIsEditable()},this._onRootKeydown=r=>{!i(r)||r.defaultPrevented||r.isComposing||this.isEditingKey(r)&&this.ensureRootIsEditable()},this._onRootTransfer=r=>{i(r)&&this.ensureRootIsEditable()},e.addEventListener("beforeinput",this._onRootBeforeInput,!0),e.addEventListener("keydown",this._onRootKeydown,!0),Yn.forEach(r=>{e.addEventListener(r,this._onRootTransfer,!0)})}ensureRootIsEditable(){if(!this._squire||this.options.singleLine)return;let e=this.options.inline,i=!this.blocksStayOut();if(!El(this.element,{wrapBareRoot:e,blocksAllowed:i}))return;let r=Te(this._squire),n=r?Cl(this.element,r):null,o=()=>{vl(this.element,{blockTag:this._blockTag,wrapBareRoot:e,blocksAllowed:i,onBareRootWrapped:(a,l)=>{console.warn(`richclay: wrapped this region's loose text in a <div> so multi-line editing works. Wrap the content in your own block element to keep the markup you wrote, or use editable="single-line" if it is meant to be one line.`,a,l)}})};typeof this._squire.modifyDocument=="function"?this._squire.modifyDocument(o):o(),n&&(Sl(this.element,r,n),Hi(this._squire,r),this.savedSelection=An(r))}isEditingKey(e){return["Backspace","Delete","Enter"].includes(e.key)?!0:e.key==="Tab"?this.caretIsInList():e.key.length!==1?!1:!e.ctrlKey&&!e.metaKey&&!e.altKey?!0:e.ctrlKey&&!e.metaKey&&!e.altKey&&this._appleDeleteKeys.has(e.key.toLowerCase())}caretIsInList(){let e=this._squire?.getSelection()?.startContainer;if(!e)return!1;let i=e.nodeType===1?e:e.parentElement;return!!(i&&this.element.contains(i)&&i.closest("ul, ol"))}runControl(e){if(!this._squire||typeof e.run!="function"||e.isDisabled?.(this))return;this.restoreSelection(),e.mutates!==!1&&this.ensureRootIsEditable();let i=e.run(this);this.element.querySelectorAll("pre:not([data-richclay-pre])").forEach(r=>{this._authoredPres.has(r)||r.setAttribute("data-richclay-pre","")}),e.mutates!==!1&&(this.ensureRootIsEditable(),this.anchorSelectionInBlock()),this.saveSelection(),this.toolbar?.update(),this.updatePlaceholder(),this.announceControl(e),i!==Zn&&this.focus(),this.warnOnBlockInInlineRegion()}anchorSelectionInBlock(){let e=Te(this._squire);if(!e?.collapsed||e.startContainer!==this.element)return;let i=Array.from(this.element.childNodes),r=e.startOffset>=i.length,n=r?i.filter(xe).pop():i.slice(e.startOffset).find(xe)||i.slice(0,e.startOffset).filter(xe).pop();if(!n)return;let o=ze(n,!r);e.setStart(o,r?Li(o):0),e.collapse(!0),Hi(this._squire,e)}selectionHasFormat(e){if(!e||!this._squire?.hasFormat)return!1;try{return this._squire.hasFormat(e)}catch{return!1}}pathHas(e){let i=Te(this._squire);if(!i)return!1;let r=e.toLowerCase(),n=Jn(this.element,i.startContainer,i.startOffset,!0,r);return!!n&&n===Jn(this.element,i.endContainer,i.endOffset,!1,r)}blocksStayOut(){return this.options.singleLine||ki(this.element)||ml(this.element)}warnOnBlockInInlineRegion(){if(this._warnedInlineBlock||!_i(this.element)||!fn(this.element))return;this._warnedInlineBlock=!0;let e=this.element.nodeName.toLowerCase();console.warn(`richclay: a block element inside <${e} editable> is not valid HTML. It stays where it is and saves correctly, but a validator will flag it. Put the editable attribute on a block element if you want blocks here.`,this.element)}toggleFormat(e,i,r){return this.selectionHasFormat(e)?this._squire[r]():this._squire[i]()}toggleList(e){return this.pathHas(e)?this._squire.removeList():e==="UL"?this._squire.makeUnorderedList():this._squire.makeOrderedList()}indent(){return this.pathHas("UL")||this.pathHas("OL")?this._squire.increaseListLevel():this._squire.increaseQuoteLevel()}outdent(){return this.pathHas("UL")||this.pathHas("OL")?this._squire.decreaseListLevel():this._squire.decreaseQuoteLevel()}setBlockType(e){let i=e.toUpperCase();return i==="BLOCKQUOTE"?this._squire.increaseQuoteLevel():this._squire.modifyBlocks(r=>{let n=this.element.ownerDocument,o=n.createDocumentFragment();return Array.from(r.childNodes).forEach(a=>{if(a.nodeType!==1){o.appendChild(a);return}if(a.nodeName===i){o.appendChild(a);return}let l=n.createElement(i);for(;a.firstChild;)l.appendChild(a.firstChild);o.appendChild(l)}),o})}openLinkDialog(){this.saveSelection(),this.closeLinkDialog(),this.linkPopover?.hide();let e=this.element.ownerDocument,i=this.currentLinkElement(),r=i?.getAttribute("href")||"",n=e.createElement("form"),o=`richclay-link-label-${++Qn}`;n.className="richclay-dialog",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",o),n.setAttribute("data-richclay-dialog",""),$t(n),n.setAttribute("save-remove",""),n.innerHTML=`
110
+ <div class="richclay-dialog-title" id="${o}">${i?"Edit link":"Insert link"}</div>
111
+ <label class="richclay-field">
112
+ <span>URL</span>
113
+ <input class="richclay-input" name="url" type="text" inputmode="url" autocomplete="url" placeholder="https://example.com">
114
+ </label>
115
+ <div class="richclay-dialog-actions">
116
+ ${i&&!this.options.linkLabel?'<button type="button" class="richclay-secondary" data-richclay-remove-link>Remove link</button>':""}
117
+ <button type="button" class="richclay-secondary" data-richclay-cancel>Cancel</button>
118
+ <button type="submit" class="richclay-primary">Apply</button>
119
+ </div>
120
+ `;let a=()=>{this.closeLinkDialog(),this.toolbar?.update(),this.focus(),this.updateLinkPopover()},l=()=>{this.restoreSelection(),this.removeLinkElement(this.currentLinkElement()),a()},c=()=>{a(),this.restoreSelection(),this.updateLinkPopover()};n.addEventListener("submit",T=>{T.preventDefault();let R=new FormData(n),z=String(R.get("url")||"").trim();if(!z&&i){l();return}let rt=hs(z);if(!rt){Ee(this.liveRegion,"Enter a valid URL");return}this.restoreSelection();let K=this.options.linkLabel?null:this.currentLinkElement();if(this.options.linkLabel){let pt=this.element.ownerDocument.createRange();pt.selectNodeContents(this.element),this._squire.setSelection(pt)}K?(this.selectElement(K),this._squire.saveUndoState(),K.setAttribute("href",rt)):this._squire.makeLink(rt),Ee(this.liveRegion,"Link applied"),a()}),n.querySelector("[data-richclay-remove-link]")?.addEventListener("click",l),n.querySelector("[data-richclay-cancel]").addEventListener("click",c),n.addEventListener("keydown",T=>{T.key==="Escape"?(T.preventDefault(),c()):T.key==="Tab"&&Is(T,n)});let h=this.element.closest("dialog")||e.body,u=typeof n.showPopover=="function";u&&n.setAttribute("popover","manual"),lt(n,"position","fixed"),lt(n,"inset","0px auto auto 0px"),lt(n,"margin","0"),lt(n,"overflow","visible"),h.appendChild(n),u&&n.showPopover(),this.dialog=n;let d=e.defaultView||globalThis,f=()=>this.positionLinkDialog(),b=T=>{n.contains(T.target)||this.closeLinkDialog()},g=typeof d.ResizeObserver=="function"?new d.ResizeObserver(f):null;g?.observe(n),e.addEventListener("scroll",f,{capture:!0,passive:!0}),d.addEventListener("resize",f,{passive:!0}),d.visualViewport?.addEventListener("resize",f,{passive:!0}),d.visualViewport?.addEventListener("scroll",f,{passive:!0}),e.addEventListener("pointerdown",b,!0),this.dialogCleanup=()=>{g?.disconnect(),e.removeEventListener("scroll",f,{capture:!0}),d.removeEventListener("resize",f),d.visualViewport?.removeEventListener("resize",f),d.visualViewport?.removeEventListener("scroll",f),e.removeEventListener("pointerdown",b,!0)},this.positionLinkDialog();let E=n.querySelector("input");return E.value=r,E.focus(),E.select(),Zn}removeLinkElement(e){return!e||!this.element.contains(e)?!1:(this.selectElement(e),this._squire.removeLink(),Ee(this.liveRegion,"Link removed"),!0)}updateLinkPopover(){if(!(this.options.linkPopover===!1||this.options.readOnly||!this._squire)){if(!this.linkPopover){if(this.dialog||!this.currentLinkElement())return;this.linkPopover=new ms(this)}this.linkPopover.update()}}currentLinkElement(){let e=Te(this._squire);if(!e||!this.element.contains(e.commonAncestorContainer))return null;if(e.collapsed){let i=e.startContainer,r=(i.nodeType===1?i:i.parentElement)?.closest("a[href]");return r&&r!==this.element&&this.element.contains(r)?r:null}for(let i of this.element.querySelectorAll("a[href]")){let r=i.ownerDocument.createRange(),n=i,o=i;for(;n.firstChild;)n=n.firstChild;for(;o.lastChild;)o=o.lastChild;if(r.setStart(n,0),r.setEnd(o,o.nodeType===3?o.length:o.childNodes.length),e.compareBoundaryPoints(e.END_TO_START,r)<0&&e.compareBoundaryPoints(e.START_TO_END,r)>0)return i}return null}currentLinkHref(){let e=this.currentLinkElement();return e&&e.getAttribute("href")||""}selectElement(e){let i=e.ownerDocument.createRange();return i.selectNode(e),this._squire.setSelection(i),this.saveSelection(),i}linkAnchorRect(){let e=this.savedSelection;if(typeof e?.getClientRects=="function"){let i=[...e.getClientRects()].filter(r=>r.width||r.height);if(i.length)return e.collapsed?i[0]:e.getBoundingClientRect()}return(this.toolbar?.items.find(i=>i.def.id==="link")?.button||this.toolbar?.root||this.element).getBoundingClientRect()}positionLinkDialog(){let e=this.dialog;if(!e)return;let i=e.ownerDocument.defaultView||globalThis,r=Rn({anchor:this.linkAnchorRect(),box:{width:e.offsetWidth||0,height:e.offsetHeight||0},viewport:{width:i.visualViewport?.width??i.innerWidth,height:i.visualViewport?.height??i.innerHeight}});e.setAttribute("data-richclay-side",r.side),e.style.setProperty("--richclay-dialog-arrow",`${Math.round(r.arrow)}px`),lt(e,"transform",`translate(${Math.round(r.x)}px, ${Math.round(r.y)}px)`)}closeLinkDialog(){this.dialogCleanup?.(),this.dialogCleanup=null,this.dialog?.remove(),this.dialog=null}ensureMarker(){Ce(this.element)||(this.element.setAttribute("data-richclay-runtime-marker","true"),this.element.setAttribute("data-richclay",""))}setupEditorAttributes(){if(this.element.classList.add(this.options.inline?"richclay-inline":"richclay-editor","richclay-active"),this.element.setAttribute("data-richclay-active","true"),!this.element.hasAttribute("data-richclay-runtime-contenteditable")){let e=this.element.getAttribute("contenteditable");e===null?this.element.setAttribute("data-richclay-runtime-contenteditable","true"):e!=="true"&&e!==""&&this.element.setAttribute("data-richclay-runtime-contenteditable",e)}this.element.setAttribute("contenteditable","true"),this.element.hasAttribute("role")||Ui(this.element,"role","textbox","data-richclay-runtime-role"),this.element.hasAttribute("aria-multiline")||Ui(this.element,"aria-multiline",this.options.singleLine?"false":"true","data-richclay-runtime-aria-multiline"),this.element.hasAttribute("no-undo")||Ui(this.element,"no-undo","","data-richclay-runtime-no-undo"),this.options.placeholder&&(this.element.setAttribute("data-richclay-placeholder",this.options.placeholder),this.description||(this.description=this.element.ownerDocument.createElement("div"),this.description.id=`richclay-placeholder-${++Qn}`,this.description.className="richclay-sr-only",this.description.textContent=this.options.placeholder,this.description.setAttribute("data-richclay-live",""),$t(this.description)),this.description.isConnected||this.element.insertAdjacentElement("afterend",this.description),Zl(this.element,this.description)),this.element.addEventListener("focus",this._onFocus),this.element.addEventListener("blur",this._onBlur),this.element.addEventListener("click",this._onLinkActivation,!0),this.element.addEventListener("auxclick",this._onLinkActivation,!0),this.element.addEventListener("clay:external-write",this._onExternalWrite)}cleanupEditorAttributes(){Bi(this.element,"destroy"),this.element.removeEventListener("focus",this._onFocus),this.element.removeEventListener("blur",this._onBlur),this.element.removeEventListener("click",this._onLinkActivation,!0),this.element.removeEventListener("auxclick",this._onLinkActivation,!0),this.element.removeEventListener("clay:external-write",this._onExternalWrite)}keepOneLink(){let e=this.element,i=e.ownerDocument,r=e.querySelector("a[href]"),n=r?.getAttribute("href")??this._labelHref;if(!n)return;this._labelHref=n;let o=e.textContent.replace(/\u200B/g,"").replace(/\s*[\r\n]+\s*/g," "),a=e.childNodes.length===1&&e.firstChild===r?r:null;if(a&&[...a.childNodes].every(h=>h.nodeType===3)&&!a.textContent.includes("\u200B")||!o)return;let l=this._squire.getSelection(),c=o.length;if(l&&e.contains(l.startContainer)){let h=i.createRange();h.selectNodeContents(e),h.setEnd(l.startContainer,l.startOffset),c=h.toString().replace(/\u200B/g,"").replace(/\s*[\r\n]+\s*/g," ").length}this._squire.modifyDocument(()=>{let h=r??i.createElement("a");r||h.setAttribute("href",n),h.replaceChildren(i.createTextNode(o)),e.replaceChildren(h);let u=i.createRange();u.setStart(h.firstChild,Math.min(c,o.length)),u.collapse(!0),this._squire.setSelection(u)})}bindSquire(){let e=()=>{this._squireHTML=this.element.innerHTML,this.saveSelection(),this.updatePlaceholder(),this.options.onChange?.(this.getHTML()),this.toolbar?.update(),this.updateLinkPopover()},i=n=>{this.path=n.detail?.path||this._squire.getPath?.()||"",this.saveSelection(),this.toolbar?.update(),this.updateLinkPopover()},r=()=>{this.saveSelection(),this.toolbar?.update(),this.options.toolbarOnSelect&&this.updateFloatVisibility(),this.updateLinkPopover()};[["input",e],["pathChange",i],["select",r],["cursor",r],["undoStateChange",()=>this.toolbar?.update()]].forEach(([n,o])=>{this._squire.addEventListener(n,o),this._squireListeners.push([n,o])})}renderToolbar(){if(!this.active||this.options.readOnly)return;if(this.options.inline){this.float&&(this.teardownFloatingToolbar(),this.ensureFloatingToolbar());return}this.toolbar?.destroy(),this.toolbar=null;let e=this.resolveToolbarControls(this.options.toolbar);e.length&&(this.toolbar=new Ln(this,e,{toolbarContainer:this.options.toolbarContainer}))}ensureFloatingToolbar(){if(this.float||!this.active||this.options.readOnly)return;let e=this.resolveToolbarControls(this.options.toolbar);e.length&&(this.float=new rs(this,e),this._onFloatFocusOut=i=>this.scheduleFloatTeardown(i),this.float.root.addEventListener("focusout",this._onFloatFocusOut),this._onDocPointerDown=i=>{if(this.ownsFocusTarget(i.target))return;let r=this.element.ownerDocument;r.activeElement&&this.ownsFocusTarget(r.activeElement)&&r.activeElement.blur?.(),this.teardownFloatingToolbar()},this.element.ownerDocument.addEventListener("pointerdown",this._onDocPointerDown,!0),this.toolbar=this.float.toolbar,this.toolbar.update(),this.options.toolbarOnSelect&&this.updateFloatVisibility())}teardownFloatingToolbar(){this.float&&(this._onFloatFocusOut&&(this.float.root.removeEventListener("focusout",this._onFloatFocusOut),this._onFloatFocusOut=null),this._onDocPointerDown&&(this.element.ownerDocument.removeEventListener("pointerdown",this._onDocPointerDown,!0),this._onDocPointerDown=null),this.float.destroy(),this.float=null,this.toolbar=null)}scheduleFloatTeardown(e){let i=e?.relatedTarget;if(i&&this.ownsFocusTarget(i))return;let r=this.element.ownerDocument;(r.defaultView||globalThis).setTimeout(()=>{let n=r.activeElement;n&&this.ownsFocusTarget(n)||this.teardownFloatingToolbar()},0)}ownsFocusTarget(e){return e===this.element||this.element.contains(e)||!!this.float?.root.contains(e)||!!this.dialog?.contains(e)||!!this.linkPopover?.root?.contains(e)}updateFloatVisibility(){if(!this.float)return;let e=this.savedSelection;this.float.setVisible(!!(e&&!e.collapsed))}resolveToolbarControls(e){return e===!1||e===null||e==="none"?[]:(Array.isArray(e)?e:Pe[e]||Pe.standard).map(i=>{if(typeof i=="string"){let r=this.registry.get(i);if(!r)throw new Error(`Unknown RichClay toolbar control: ${i}`);return r}return i?.type==="separator"||Xi(i),i})}installShortcuts(){let e=new Set,i=[...this.registry.values()].filter(n=>(!this.options.singleLine||Pe.inline.includes(n.id))&&(!this.options.linkLabel||Xn.includes(n.id))),r=[...this.resolveToolbarControls(this.options.toolbar),...i];if(r.forEach(n=>{if(n.type==="menu"||n.type==="separator"||!n.shortcut||!n.id||e.has(n.id))return;if(n.isDisabled?.(this)){let a=Ji(n.shortcut,this.window);this._squire.setKeyHandler(a,null),this._shortcutKeys.push(a);return}e.add(n.id);let o=Ji(n.shortcut,this.window);this._squire.setKeyHandler(o,(a,l)=>{l.preventDefault(),this.runControl(n)}),this._shortcutKeys.push(o)}),!ie(this.window)){let n=r.find(o=>o.id==="redo"&&o.shortcut);n&&!n.isDisabled?.(this)&&(this._squire.setKeyHandler("Ctrl-y",(o,a)=>{a.preventDefault(),this.runControl(n)}),this._shortcutKeys.push("Ctrl-y"))}}maskFormattingShortcuts(){for(let e of this.registry.values()){if(!e.shortcut||Xn.includes(e.id))continue;let i=Ji(e.shortcut,this.window);this._squire.setKeyHandler(i,(r,n)=>n.preventDefault()),this._shortcutKeys.push(i)}}maskSquireCodeShortcut(){let e=`${ie(this.window)?"Meta":"Ctrl"}-d`;this._squire.setKeyHandler(e,null),this._shortcutKeys.push(e)}maskSquireBlockShortcuts(){if(!this.blocksStayOut())return;let e=ie(this.window)?"Meta":"Ctrl";[`${e}-]`,`${e}-[`,`${e}-Shift-8`,`${e}-Shift-9`].forEach(i=>{this._squire.setKeyHandler(i,null),this._shortcutKeys.push(i)})}toggleCode(){return this.blocksStayOut()?this.selectionHasFormat("CODE")?this._squire.changeFormat(null,{tag:"CODE"}):this._squire.changeFormat({tag:"CODE"},null):this._squire.toggleCode()}installAppleDeleteKeys(){if(!ie(this.window))return;let e=this._squire._keyHandlers;e&&[["Ctrl-d","Delete"],["Ctrl-h","Backspace"]].forEach(([i,r])=>{typeof e[r]=="function"&&(this._squire.setKeyHandler(i,e[r]),this._shortcutKeys.push(i),this._appleDeleteKeys.add(i.slice(5)))})}installSingleLineGuards(){["Enter","Shift-Enter"].forEach(e=>{this._squire.setKeyHandler(e,(i,r)=>r.preventDefault()),this._shortcutKeys.push(e)}),this._onBeforeInput=e=>{if(!this.element.contains(e.target))return;let i=this.options.linkLabel&&e.inputType.startsWith("format");(e.inputType==="insertParagraph"||e.inputType==="insertLineBreak"||i)&&(e.preventDefault(),e.stopPropagation())},this.element.ownerDocument.addEventListener("beforeinput",this._onBeforeInput,!0)}resetSquireUndoBaseline(){let e=this._squire;!e||!Array.isArray(e._undoStack)||typeof e.saveUndoState!="function"||(this._squireHTML=this.element.innerHTML,e._undoStack.length=0,e._undoStackLength=0,e._undoIndex=-1,e._isInUndoState=!1,e.saveUndoState())}updatePlaceholder(){let e=$n(this.element,{capability:"history",inherit:!1}),i=e.text().replace(/\u200B/g,"").trim(),r=e.root.querySelector("img, video, audio, iframe, table"),n=!i&&!r;this.element.classList.toggle("richclay-empty",n)}announceControl(e){if(!this.liveRegion)return;let i=e.ariaLabel||e.label;i&&(typeof e.isActive=="function"?Ee(this.liveRegion,`${i} ${e.isActive(this)?"on":"off"}`):Ee(this.liveRegion,`${i} applied`))}};function Ns(t){return typeof t=="string"?Array.from(document.querySelectorAll(t)):t?.nodeType===1?[t]:Array.from(t||[])}function Jn(t,e,i,r,n){let o=e;if(o===t){let l=Array.from(t.childNodes).filter(xe);if(!l.length)return null;let c=Math.min(r?i:Math.max(i-1,0),l.length-1);o=ze(l[c],r)}let a=(o?.nodeType===1?o:o?.parentElement)?.closest?.(n);return a&&t.contains(a)&&a!==t?a:null}function Ds(t){let e=t.parentElement;for(;e;){if(bt.has(e)||Ce(e))return e;e=e.parentElement}return null}function Ce(t){return!!t.matches?.(ut)&&Di(t)}function Qi(t){let e=Ds(t),i=Array.from(t.querySelectorAll?.(ut)||[]).find(n=>bt.has(n)),r=e||i;return r?(console.warn("richclay: nested editable regions are not supported, so this one was skipped. Remove the editable attribute from either it or the other region.",t,r),!0):!1}function Os(t){return gl(t)?(console.warn(`richclay: ${bl(t)} This region was skipped.`,t),!0):!1}function Xi(t){if(!t||!t.id)throw new Error("RichClay button definitions require an id.");if(t.type!=="menu"&&typeof t.run!="function")throw new Error(`RichClay button "${t.id}" requires a run(editor) function.`)}function Ji(t,e){let i=t.split("+"),r=i[i.length-1],n=new Set(i.slice(0,-1).map(Rs));n.delete("Mod")&&n.add(ie(e)?"Meta":"Ctrl");let o=r.length===1?n.has("Shift")?r.toUpperCase():r.toLowerCase():r,a=_s.filter(l=>n.has(l)).join("-");return`${a?`${a}-`:""}${o}`}function Rs(t){return t==="Cmd"?"Meta":t}function Is(t,e){let i=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!i.length)return;let r=i[0],n=i[i.length-1],o=e.ownerDocument.activeElement;t.shiftKey&&o===r?(t.preventDefault(),n.focus()):!t.shiftKey&&o===n&&(t.preventDefault(),r.focus())}var Ms=`:root {
121
+ --richclay-surface: #ffffff;
122
+ --richclay-surface-alt: #f6f7f9;
123
+ --richclay-text: #0b0e14;
124
+ --richclay-muted: #667085;
125
+ --richclay-border: #c9ced8;
126
+ --richclay-accent: #0f766e;
127
+ --richclay-accent-ink: #ffffff;
128
+ --richclay-focus: #2563eb;
129
+ --richclay-danger: #b42318;
130
+ --richclay-radius: 6px;
131
+ --richclay-control-size: 34px;
132
+ --richclay-shadow: 0 10px 24px rgb(15 23 42 / 0.16);
133
+ --richclay-dialog-arrow: 28px;
134
+ }
135
+
136
+ @media (prefers-color-scheme: dark) {
137
+ :root {
138
+ --richclay-surface: #16181d;
139
+ --richclay-surface-alt: #22252c;
140
+ --richclay-text: #ffffff;
141
+ --richclay-muted: #a3aab8;
142
+ --richclay-border: #4a5260;
143
+ --richclay-accent: #2dd4bf;
144
+ --richclay-accent-ink: #05201d;
145
+ --richclay-focus: #93c5fd;
146
+ --richclay-shadow: 0 12px 28px rgb(0 0 0 / 0.35);
147
+ }
148
+ }
149
+
150
+ .richclay-toolbar {
151
+ align-items: center;
152
+ background: var(--richclay-surface-alt);
153
+ border: 1px solid var(--richclay-border);
154
+ border-radius: var(--richclay-radius);
155
+ color: var(--richclay-text);
156
+ display: flex;
157
+ flex-wrap: wrap;
158
+ gap: 2px;
159
+ margin-block: 0 6px;
160
+ padding: 4px;
161
+ }
162
+
163
+ /* Seamless card: in the default layout the toolbar sits directly above the
164
+ editor. Fuse them into a single bordered card with one divider \u2014 the
165
+ toolbar's bottom border \u2014 instead of two stacked, separated boxes. */
166
+ .richclay-toolbar:has(+ .richclay-editor) {
167
+ margin-block-end: 0;
168
+ border-bottom-left-radius: 0;
169
+ border-bottom-right-radius: 0;
170
+ }
171
+
172
+ .richclay-toolbar + .richclay-editor {
173
+ border-top: 0;
174
+ border-top-left-radius: 0;
175
+ border-top-right-radius: 0;
176
+ }
177
+
178
+ /* In a fused card, draw the focus ring inside the body so it never crosses
179
+ the toolbar divider. */
180
+ .richclay-toolbar + .richclay-editor:focus-visible {
181
+ outline-offset: -3px;
182
+ }
183
+
184
+ .richclay-button {
185
+ align-items: center;
186
+ appearance: none;
187
+ background: transparent;
188
+ border: 1px solid transparent;
189
+ border-radius: 5px;
190
+ color: currentColor;
191
+ display: inline-flex;
192
+ height: var(--richclay-control-size);
193
+ justify-content: center;
194
+ margin: 0;
195
+ min-width: var(--richclay-control-size);
196
+ padding: 0;
197
+ position: relative;
198
+ }
199
+
200
+ .richclay-button:hover,
201
+ .richclay-button[aria-expanded="true"],
202
+ .richclay-menu-item:hover {
203
+ background: var(--richclay-surface);
204
+ border-color: var(--richclay-border);
205
+ }
206
+
207
+ .richclay-button.is-active,
208
+ .richclay-button[aria-pressed="true"],
209
+ .richclay-menu-item.is-active {
210
+ background: rgb(0 0 0 / 0.13);
211
+ border-color: rgb(0 0 0 / 0.22);
212
+ color: var(--richclay-text);
213
+ box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.26);
214
+ }
215
+
216
+ .richclay-button:focus-visible,
217
+ .richclay-menu-item:focus-visible,
218
+ .richclay-editor:focus-visible,
219
+ .richclay-input:focus-visible,
220
+ .richclay-primary:focus-visible,
221
+ .richclay-secondary:focus-visible {
222
+ outline: 3px solid var(--richclay-focus);
223
+ outline-offset: 2px;
224
+ }
225
+
226
+ .richclay-button:disabled {
227
+ color: var(--richclay-muted);
228
+ cursor: not-allowed;
229
+ opacity: 0.55;
230
+ }
231
+
232
+ .richclay-separator {
233
+ align-self: stretch;
234
+ background: var(--richclay-border);
235
+ display: inline-block;
236
+ margin: 5px 4px;
237
+ width: 1px;
238
+ }
239
+
240
+ .richclay-menu-wrap {
241
+ display: inline-flex;
242
+ position: relative;
243
+ }
244
+
245
+ .richclay-menu {
246
+ background: var(--richclay-surface);
247
+ border: 1px solid var(--richclay-border);
248
+ border-radius: var(--richclay-radius);
249
+ box-shadow: var(--richclay-shadow);
250
+ color: var(--richclay-text);
251
+ display: grid;
252
+ gap: 2px;
253
+ inset-block-start: calc(100% + 4px);
254
+ inset-inline-start: 0;
255
+ min-width: 160px;
256
+ padding: 4px;
257
+ position: absolute;
258
+ z-index: 1000;
259
+ }
260
+
261
+ .richclay-menu[hidden] {
262
+ display: none;
263
+ }
264
+
265
+ .richclay-menu-item {
266
+ align-items: center;
267
+ appearance: none;
268
+ background: transparent;
269
+ border: 1px solid transparent;
270
+ border-radius: 4px;
271
+ color: inherit;
272
+ display: flex;
273
+ font: inherit;
274
+ gap: 8px;
275
+ min-height: 32px;
276
+ padding: 5px 9px;
277
+ text-align: start;
278
+ }
279
+
280
+ .richclay-editor {
281
+ background: var(--richclay-surface);
282
+ border: 1px solid var(--richclay-border);
283
+ border-radius: var(--richclay-radius);
284
+ color: var(--richclay-text);
285
+ min-height: 9rem;
286
+ /* Break a long unbreakable string (e.g. a bare URL) in prose rather than let
287
+ it widen the editor. \`anywhere\` also lowers min-content, so the editor can't
288
+ grow even as a flex/grid item. Inert on the code <pre> (white-space: pre). */
289
+ overflow-wrap: anywhere;
290
+ padding: 12px;
291
+ position: relative;
292
+ }
293
+
294
+ .richclay-editor.richclay-empty::before {
295
+ color: var(--richclay-muted);
296
+ content: attr(data-richclay-placeholder);
297
+ inset-block-start: 12px;
298
+ inset-inline-start: 12px;
299
+ pointer-events: none;
300
+ position: absolute;
301
+ }
302
+
303
+ .richclay-editor p,
304
+ .richclay-editor h1,
305
+ .richclay-editor h2,
306
+ .richclay-editor h3,
307
+ .richclay-editor h4,
308
+ .richclay-editor h5,
309
+ .richclay-editor h6,
310
+ .richclay-editor blockquote,
311
+ .richclay-editor pre,
312
+ .richclay-editor ul,
313
+ .richclay-editor ol {
314
+ margin-block: 0 0.75em;
315
+ }
316
+
317
+ .richclay-editor > :last-child {
318
+ margin-block-end: 0;
319
+ }
320
+
321
+ /* Inline editors ([editable]) inherit the page's own styling. richclay adds
322
+ only a caret, a discoverability outline, and empty-state affordances. */
323
+ .richclay-inline {
324
+ caret-color: currentColor;
325
+ }
326
+
327
+ .richclay-inline:hover {
328
+ outline: 1px dashed var(--richclay-border);
329
+ outline-offset: 2px;
330
+ }
331
+
332
+ .richclay-inline.richclay-focused,
333
+ .richclay-inline:focus-visible {
334
+ outline: 2px dashed var(--richclay-focus);
335
+ outline-offset: 2px;
336
+ }
337
+
338
+ .richclay-inline.richclay-empty {
339
+ min-height: 1em;
340
+ min-width: 1ch;
341
+ }
342
+
343
+ .richclay-inline.richclay-empty::before {
344
+ color: var(--richclay-muted);
345
+ content: attr(data-richclay-placeholder);
346
+ pointer-events: none;
347
+ }
348
+
349
+ /* Floating toolbar shell for inline editors. Fixed-position and body-mounted:
350
+ fixed elements never create scrollbars, and body mounting avoids transformed
351
+ ancestors silently turning fixed into ancestor-relative. */
352
+ .richclay-float {
353
+ left: 0;
354
+ position: fixed;
355
+ top: 0;
356
+ will-change: transform;
357
+ z-index: 99999;
358
+ }
359
+
360
+ .richclay-float .richclay-toolbar {
361
+ box-shadow: var(--richclay-shadow);
362
+ margin-block: 0;
363
+ }
364
+
365
+ /* Compact vertical rail for narrow margins. */
366
+ .richclay-float-rail .richclay-toolbar {
367
+ --richclay-control-size: 28px;
368
+ flex-direction: column;
369
+ flex-wrap: nowrap;
370
+ }
371
+
372
+ .richclay-float-rail .richclay-toolbar svg {
373
+ height: 15px;
374
+ width: 15px;
375
+ }
376
+
377
+ .richclay-float-rail .richclay-separator {
378
+ align-self: stretch;
379
+ height: 1px;
380
+ margin: 4px 5px;
381
+ width: auto;
382
+ }
383
+
384
+ .richclay-float-rail .richclay-menu {
385
+ inset-block-start: 0;
386
+ inset-inline-start: calc(100% + 4px);
387
+ }
388
+
389
+ .richclay-editor blockquote {
390
+ border-inline-start: 3px solid var(--richclay-border);
391
+ color: var(--richclay-muted);
392
+ margin-inline: 0;
393
+ padding-inline-start: 12px;
394
+ }
395
+
396
+ /* Code blocks scroll horizontally inside the editor instead of widening it.
397
+ \`width: 0; min-width: 100%\` zeroes the pre's intrinsic-width contribution so a
398
+ long unbreakable line can't push an intrinsically-sized ancestor (flex/grid
399
+ item, inline-block, table cell) wider, while still filling the editor and
400
+ scrolling its own overflow. box-sizing keeps padding inside that 100%.
401
+ Containment applies to inline editors too: \`white-space: pre\` never wraps, so
402
+ without it one code block runs off the side of the page. Only the decoration
403
+ below stays card-scoped, since inline mode keeps the page's own typography. */
404
+ .richclay-editor pre,
405
+ .richclay-inline pre {
406
+ box-sizing: border-box;
407
+ min-width: 100%;
408
+ overflow: auto;
409
+ width: 0;
410
+ }
411
+
412
+ .richclay-editor pre {
413
+ background: var(--richclay-surface-alt);
414
+ border-radius: 4px;
415
+ padding: 10px;
416
+ }
417
+
418
+ .richclay-dialog {
419
+ background: var(--richclay-surface);
420
+ border: 1px solid var(--richclay-border);
421
+ border-radius: var(--richclay-radius);
422
+ box-shadow: var(--richclay-shadow);
423
+ color: var(--richclay-text);
424
+ display: grid;
425
+ gap: 10px;
426
+ box-sizing: border-box;
427
+ width: min(420px, calc(100vw - 16px));
428
+ z-index: 99999;
429
+ padding: 12px;
430
+ }
431
+
432
+ .richclay-dialog-title {
433
+ font-weight: 650;
434
+ }
435
+
436
+ .richclay-dialog.richclay-link-popover {
437
+ align-items: center;
438
+ display: flex;
439
+ gap: 6px;
440
+ max-width: min(420px, calc(100vw - 16px));
441
+ padding: 6px;
442
+ width: auto;
443
+ }
444
+
445
+ .richclay-link-address {
446
+ color: inherit;
447
+ font-size: 0.875rem;
448
+ max-width: 260px;
449
+ overflow: hidden;
450
+ padding: 0 6px;
451
+ text-overflow: ellipsis;
452
+ white-space: nowrap;
453
+ }
454
+
455
+ .richclay-link-popover .richclay-secondary {
456
+ min-height: 30px;
457
+ padding: 3px 9px;
458
+ }
459
+
460
+ .richclay-field {
461
+ display: grid;
462
+ gap: 4px;
463
+ }
464
+
465
+ .richclay-field span {
466
+ color: var(--richclay-muted);
467
+ font-size: 0.875rem;
468
+ }
469
+
470
+ .richclay-input {
471
+ background: var(--richclay-surface);
472
+ border: 1px solid var(--richclay-border);
473
+ border-radius: 4px;
474
+ color: var(--richclay-text);
475
+ font: inherit;
476
+ min-height: 36px;
477
+ padding: 6px 8px;
478
+ }
479
+
480
+ .richclay-dialog-actions {
481
+ display: flex;
482
+ gap: 8px;
483
+ justify-content: flex-end;
484
+ }
485
+
486
+ .richclay-dialog-actions [data-richclay-remove-link] {
487
+ margin-inline-end: auto;
488
+ }
489
+
490
+ .richclay-primary,
491
+ .richclay-secondary {
492
+ appearance: none;
493
+ border: 1px solid var(--richclay-border);
494
+ border-radius: 4px;
495
+ font: inherit;
496
+ min-height: 34px;
497
+ padding: 5px 10px;
498
+ }
499
+
500
+ .richclay-primary {
501
+ background: var(--richclay-accent);
502
+ border-color: var(--richclay-accent);
503
+ color: var(--richclay-accent-ink);
504
+ }
505
+
506
+ .richclay-secondary {
507
+ background: var(--richclay-surface-alt);
508
+ color: var(--richclay-text);
509
+ }
510
+
511
+ .richclay-sr-only {
512
+ border: 0;
513
+ clip: rect(0 0 0 0);
514
+ clip-path: inset(50%);
515
+ height: 1px;
516
+ margin: -1px;
517
+ overflow: hidden;
518
+ padding: 0;
519
+ position: absolute;
520
+ white-space: nowrap;
521
+ width: 1px;
522
+ }
523
+
524
+ @media (forced-colors: active) {
525
+ .richclay-toolbar,
526
+ .richclay-editor,
527
+ .richclay-menu,
528
+ .richclay-dialog,
529
+ .richclay-input {
530
+ border-color: CanvasText;
531
+ }
532
+
533
+ .richclay-button.is-active,
534
+ .richclay-button[aria-pressed="true"],
535
+ .richclay-menu-item.is-active,
536
+ .richclay-primary {
537
+ background: Highlight;
538
+ color: HighlightText;
539
+ }
540
+
541
+ .richclay-button:focus-visible,
542
+ .richclay-menu-item:focus-visible,
543
+ .richclay-editor:focus-visible,
544
+ .richclay-input:focus-visible {
545
+ outline-color: Highlight;
546
+ }
547
+ }
548
+ `,re=typeof globalThis<"u"?globalThis:self;re&&!re.Squire&&(re.Squire=_a),re&&!re.DOMPurify&&(re.DOMPurify=ll),ys(Ms);var Bs=Yi.autoInit(),Fs=Yi;return Ko(Cr)})();window.__hyperclayNoAutoExport||(window.hyperclay=window.hyperclay||{},window.hyperclay.RichClay=ti.default,window.RichClay=window.RichClay||ti.default,window.h=window.hyperclay);var tt=ti.default,Nc=ti.default;Oo("richclay",Io,{roots:Ro});var Er=m=>{if(m.hasAttribute("no-undo")&&!m.hasAttribute("data-richclay-runtime-no-undo")||(m.getAttribute("clay")||"").split(/\s+/).includes("no-undo"))return!0;let w=m.parentElement;return!!w&&window.clay?.region?.resolveRegionPolicy?.(w)?.undoable===!1},uc=/^(P|DIV|UL|OL|LI|H[1-6]|BLOCKQUOTE|TABLE|THEAD|TBODY|TR|TD|TH|FIGURE|FIGCAPTION|HR|SECTION|ARTICLE|ASIDE|HEADER|FOOTER|DL|DT|DD)$/,wr=m=>m?.nodeType===1&&uc.test(m.nodeName),pc=m=>{let w=m.ownerDocument.createTreeWalker(m,4),k=[];for(let P=w.nextNode();P;P=w.nextNode()){if(/\S/.test(P.data)||P.parentElement?.closest("pre"))continue;let Ft=P.parentNode;((!P.previousSibling||!P.nextSibling)&&(Ft===m||wr(Ft))||wr(P.previousSibling)||wr(P.nextSibling))&&k.push(P)}k.forEach(P=>P.remove())},Ho=m=>{let w=m.cloneNode(!0);return No(w),pc(w),tt.savedContent(w)},Mo='[editor-ui], [clay~="editor-ui"], [no-undo]:not([data-richclay-runtime-no-undo]), [clay~="no-undo"]',Uo=m=>[...m.querySelectorAll(Mo)].filter(w=>{for(let k=w.parentElement;k&&k!==m;k=k.parentElement)if(k.matches(Mo))return!1;return!0}),fc=m=>{let w=m.cloneNode(!0);return Uo(w).forEach(k=>k.replaceWith(w.ownerDocument.createElement("clay-kept"))),Ho(w)},mc=(m,w)=>{if(!w.includes("<clay-kept"))return w;let k=m.ownerDocument.createElement("template");k.innerHTML=w;let P=Uo(m);return[...k.content.querySelectorAll("clay-kept")].forEach((Ft,he)=>{P[he]?Ft.replaceWith(P[he].cloneNode(!0)):Ft.remove()}),k.innerHTML},yc=m=>!m.matches?.(tt.selector)||Er(m)?void 0:Ho(m),gc=(m,w)=>{m.innerHTML=w},bc=m=>{let w=br();return w?w.morph:(vr().catch(()=>{}),m.querySelector('[editor-ui], [clay~="editor-ui"]')?void 0:gc)},qo=()=>window.clay?.undo?.pageHistory===!0&&window.clay.undo.recordingMode!=="commands",xr=new Map,zo=m=>{let w=window.clay?.undo;if(!(!qo()||Er(m))&&(xr.set(m,w.trackContent(m,{read:fc,write:(k,P)=>{tt.setSavedContent(k,mc(k,P),{morph:bc(k)})}})),!br()&&m.querySelector('[editor-ui], [clay~="editor-ui"]')&&typeof w.hold=="function")){let k=w.hold();vr().catch(()=>{}).finally(k)}},vc=()=>{for(let m of xr.values())m();xr.clear()};document.addEventListener("richclay:mount",m=>zo(m.target));var Bo=null,Tr=()=>{let m=window.clay?.undo;m?.addDurableForm&&Bo!==m&&(m.addDurableForm(yc),Bo=m),tt.hostHistory=qo(),tt.keepsOwnHistory=Er,tt.hostHistory?document.querySelectorAll("[data-richclay-active]").forEach(zo):vc()};document.addEventListener("clay:undo-session",Tr);document.addEventListener("clay:undo-recording",Tr);document.addEventListener("clay:ready",Tr);document.addEventListener("richclay:history-exhausted",m=>{let w=window.clay?.undo;!w||window.clay.modeLifecycle?.canWrite?.()===!1||(m.detail?.direction==="redo"?w.redo():w.undo())});var ei=null,Fo=(m,w)=>Object.assign(new Error(`clay:richclay: ${m}`),{code:w}),wc=m=>m?m.signal?.aborted?!0:typeof m.isCurrent=="function"&&!m.isCurrent():!1,xc=m=>({root:m,win:m.ownerDocument?.defaultView||window,admitted:!1,stopWatch:null,subscriber:null}),Wo=m=>[...m.root.querySelectorAll(tt.selector)];function Po(m){for(let w of tt.init(Wo(m)))w.reattach()}function Ec(m){let w=()=>Po(m);return{enable(){if(m.admitted)return;m.admitted=!0,Po(m),m.stopWatch=tt.watch(m.win);let k=m.root.ownerDocument||document;m.subscriber={target:k,type:"clay:sync-applied",handler:w},k.addEventListener(m.subscriber.type,w)},quiesce(){m.admitted=!1,m.stopWatch&&(m.stopWatch(),m.stopWatch=null)},resume(){m.admitted||(m.admitted=!0,m.stopWatch=tt.watch(m.win))},dispose(){m.admitted=!1,m.stopWatch&&(m.stopWatch(),m.stopWatch=null);let k=m.subscriber;m.subscriber=null,k&&k.target.removeEventListener(k.type,k.handler);for(let P of Wo(m))tt.stripElement(P);ei===m&&(ei=null)}}}function Tc(m=document){return{id:"clay:richclay",order:310,async prepare(w={}){if(w.initial===!0)return Cc();if(typeof tt.watch!="function"||typeof tt.stripElement!="function")throw Fo("this vendor build has no watchable lifecycle","unsupported-plugin");if(wc(w))throw Fo("prepared for a stale generation","stale-document");let k=tt.autoInit?.();return typeof k=="function"&&k(),Ec(ei||(ei=xc(m)))}}}async function Cc(){let m=await kc;return{enable(){},quiesce:()=>m?.quiesce(),resume:()=>m?.resume(),dispose:()=>m?.dispose()}}async function Sc(){if(!Do())return null;let m=await Tc().prepare();return m.enable(),m}var kc=Sc();var Kc=tt;export{tt as RichClay,Kc as default,Sc as init,Tc as modeParticipant,kc as ready,Tc as richclayParticipant};
549
+ /*! For license information please see richclay-MXH2GFAZ.js.LEGAL.txt */